logoAcademy

Deploy Wrapped Exchange Contract

Deploy the DexERC20Wrapper on your own blockchain

Let's deploy our wrapper for the exchange contract on your own blockchain.

Wrapper Deployment

While deploying the wrapped exchange contract, you will need to send two constructor arguments to the contract.

  • The first argument is the wrapped native token (WDJT) address on the destination chain (Lothar), which is: 0xd00ae08403B9bbb9124bB305C09058E32C39A48c.
  • The second argument is the Trader Joe's (or any other Uniswap V2-like dapp) Factory V1 contract address on the destination chain (Lothar), which is: 0xF5c7d9733e5f53abCC1695820c4818C59B457C2C.
forge create --rpc-url local-c --private-key $PK contracts/interchain-token-transfer/cross-chain-token-swaps/DexERC20Wrapper.sol:DexERC20Wrapper --constructor-args 0xd00ae08403B9bbb9124bB305C09058E32C39A48c 0xF5c7d9733e5f53abCC1695820c4818C59B457C2C

Save the Wrapper Address

Save the Deployed to address in an environment variable.

export WRAPPED_EXCHANGE_ADDRESS=<address>

In case you skipped the deployment phase mentioned on the previous page, you can use a wrapper contract, that is already deployed at 0x38B097d95B96CD17966Cf617A71b7B20F61ba85B.

export WRAPPED_EXCHANGE_ADDRESS=0x38B097d95B96CD17966Cf617A71b7B20F61ba85B

Initiate the Cross-Chain Swap

Now that the wrapped exchange contract has been deployed, send an ERC20 token to execute a swap for WDJT or DJT from your Dijets ECC to Lothar using the cast send command in foundry.

cast send --rpc-url echo --private-key $PK $ERC20_HOME_C_CHAIN "sendAndCall((bytes32, address, address, bytes, uint256, uint256, address, address, address, uint256, uint256), uint256)" "(${C_CHAIN_BLOCKCHAIN_ID_HEX}, ${ERC20_TOKEN_REMOTE_ECC}, ${WRAPPED_EXCHANGE_ADDRESS}, 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 2500000, 2000000, 0x0000000000000000000000000000000000000000, ${FUNDED_ADDRESS}, ${ERC20_HOME_C_CHAIN}, 0, 0)" 100000000000000000000

Verify the Results

TBD: Provide instructions

On this page