Contract: TransferAgent Burn Token Submission

Burn canonical token on source chain and unlock user's assets on destination chain

circle-exclamation

Implementation

Through TransferAgent's transfer function, user can burn token on source chain and unlock user's assets on destination chain. According to pegged_pair_config.bridge_version, you should set different parameters communicating with TransferAgent contract.

Communicate with PeggedTokenBridge through TransferAgent contract

transferAgent!.transfer(
     receiverAddress /// Destination chain receiver address, could be any length.
     pegConfig.config.org_token.token.address /// Source chain token address
     value, /// Transfer amount
     destinationChainId, /// Destination Chain Id 
     nonce, /// Current timestamp
     0, /// Canonical token transfer doesn't require max slippage
     3, /// BridgeSendType.PegBurn
        /// https://github.com/celer-network/sgn-v2-contracts/blob/
        /// c66326d458b9d34058ed960f610af69d8514716c/contracts/
        /// libraries/BridgeTransferLib.sol#L27
     [] /// Extensions are not required
)

Communicate with PeggedTokenBridgeV2 through TransferAgent contract

Request Parameters

Name
Type
Description

receiver_address

String

Receiver's address on destination chain

token_address

String

Token address on source chain

amount

UInt256

Transfer amount on source chain

nonce

UInt64

Timestamp

max_slippage

UInt32

Not required

bridgeSendType

Bridge Send Type

extensions

Not required

TransferId Generation

When you submit on-chain mint transaction through TransferAgentContract, you can also generate a transfer id for future reference. For example, it is used for getTransferStatus. It should be the same as transferId inside on-chain transaction log.

Transfer Id Generation with PeggedTokenBridge

Transfer Id Generation with PeggedTokenBridgeV2

Response

Since this function is an on-chain transaction, the response is the corresponding transaction response.

Last updated