Contract: Pool-Based Transfer
Trigger cBridge contract `send` function to move user's assets to cBridge contract on source chain. Then cBridge gateway and Celer SGN will send assets to the user's asset on the destination chain
Implementation
Pool-based transfers are done via the Bridge contract, specifically via the send or sendNative functions. For advanced users, these two functions can be called from smart contracts, but please read the refund process before you proceed.
Here is the abi for Bridge: https://github.com/celer-network/cBridge-typescript-client/tree/main/contract/abi/Bridge.sol
Transfer gas token(ETH): sendNative. No need to provide token address
Transfer ERC20 token: send. Token address is needed
Request Parameters
receiver
String
User's wallet address
token
String
Token's address on source chain
amount
BigNumber
Token amount to be sent
dst_chain_id
BigNumber
Destination chain id
nonce
BigNumber
Current timestamp
If you want to use a max_slippage with your own calculation, please make sure it is not less than minimalMaxSlippage given by cBridge contract. Otherwise, the transaction will fail.
If receiver
is a smart contract and the token you are sending is a wrapped native gas token on the destination chain, make sure the contract can receive native gas token by implementing fallback
/ receive
functions.
TransferId Generation
When you submit on-chain send transaction, you can also generate a transfer id for future reference. For example, it is used for getTransferStatus and withdrawLiquidityForTransferRefund. It should be the same as transferId inside on-chain transaction log.
Response
Since this function is an Ethereum on-chain transaction, the response is the corresponding transaction response.
Last updated