Custom Gateway Bridging¶
Check out this tutorial on GitHub: custom_gateway_bridging
When neither the standard ERC20 gateway, nor the generic-custom gateway
are enough to fulfill the bridging requirements of a token, there is the
possibility of creating and registering a custom gateway.
custom_gateway_bridging demonstrates how to create and register a
custom gateway in the Arbitrum’s Token Bridge.
For more info on bridging assets on Arbitrum, see our token bridging docs.
Token bridging using a custom gateway¶
Bridging custom tokens through a custom gateway follow a similar process than that of Arbitrum’s generic-custom gateway. The difference, however, is that during the gateway registration process, a custom gateway is registered instead of the generic-custom gateway.
Here, we deploy a demo custom token to the parent chain and a demo custom token to the child chain. We also deploy a demo custom gateway on both the parent chain and the child chain. We then use the Arbitrum router contract to register both gateways.
We use the Arbitrum SDK library to initiate and verify the bridging.
See exec.py for inline explanation.
Set environment variables¶
Set the values shown in .env-sample as environmental variables. To
copy it into a .env file:
cp .env-sample .env
You’ll still need to edit some variables, i.e., PRIVATE_KEY,
CHAIN_RPC, PARENT_CHAIN_RPC.
Note that you can also set the environment variables in an .env file
in the root of the monorepo, which will be available in all tutorials.
Run¶
Install dependencies and build the contracts:
chmod +x ./build.sh && ./build.sh
Run the script:
python3 scripts/exec.py
Disclaimer¶
The code contained within this package is meant for testing purposes only and does not guarantee any level of security. It has not undergone any formal audit or security analysis. Use it at your own risk. Any potential damages or security breaches occurring from the use of this code are not the responsibility of the author(s) or contributor(s) of this repository. Please exercise caution and due diligence while using this code in any environment.