ava-labs / avalanche-starter-kit

77 stars 109 forks source link

Migrate Teleporter Token Bridge instructions to new Hub and Spoke version #11

Closed martineckardt closed 4 months ago

martineckardt commented 5 months ago

Preparation

Migration

Update the instructions. Limit the search and replace to the /src/* of the Avalanche Starter Kit.

Contract file names

forge create --rpc-url local-c --private-key $PK lib/teleporter-token-bridge/contracts/src/ERC20Source.sol:ERC20Source --constructor-args $TELEPORTER_REGISTRY_C_CHAIN $FUNDED_ADDRESS $ERC20_ORIGIN_C_CHAIN

Needs to turn into

forge create --rpc-url local-c --private-key $PK lib/teleporter-token-bridge/contracts/src/TokenHub/ERC20TokenHub.sol:ERC20TokenHub --constructor-args $TELEPORTER_REGISTRY_C_CHAIN $FUNDED_ADDRESS $ERC20_ORIGIN_C_CHAIN

So reach and replace lib/teleporter-token-bridge/contracts/src/ERC20Source.sol:ERC20Source => lib/teleporter-token-bridge/contracts/src/TokenHub/ERC20TokenHub.sol:ERC20TokenHub and so on for all other source and destination contracts.

Spoke registration

The function name for registering a source (spoke) with a destination (hub) has changed:

cast send --rpc-url mysubnet --private-key $PK $ERC20_TOKEN_DESTINATION_SUBNET "registerWithSource((address, uint256))" "(0x0000000000000000000000000000000000000000, 0)"

Search and replace:

registerWithSource( => registerWithHub(

Verify

Run all instructions and see if everything still wotks

martineckardt commented 4 months ago

Could you run through all instructions real quick for the different bridges? I tried out 6-erc20-to-native-bridge and had some minor issues (missing constructor arg).