🌉
Celer cBridge
  • 👋Welcome to cBridge
  • Introduction
    • Architectural Benefits
    • State Guardian Network
    • SGN and cBridge
      • The SGN as a cBridge node gateway and Service Level Agreement (SLA) arbitrator
      • The SGN as a Shared Liquidity Pool Manager
    • Fungible Token Bridging Models
    • cBridge Security
  • Tutorial
    • Cross-chain Transfer
    • LP Guide
    • SGN V2 Staking Guide
    • SGN V1 Unbonding Guide
    • Smart Contract as LP
    • Aptos Bridging Guide
    • Ape Chain Bridging Guide
    • Flow Cadence Bridging Guide
    • Flow EVM Bridging Guide
  • Developer
    • Circle Cross-chain USDC Transfer Protocol(CCTP)
    • cBridge SDK
    • cBridge Pool-Based Transfer (xLiquidity)
      • Transfer
      • Transfer Refund
    • cBridge Canonical Mapping Transfer (xAsset)
      • Mint
      • Mint Refund
      • Burn
      • Burn Refund
    • cBridge Transfer Web Widget
    • cBridge Aptos Transfer (xAsset Only)
    • Custom Transfer URL Schemes
    • cBridge APIs for Sui
    • Referral Specific Transfer
    • cBridge Limit Parameters
    • API Reference
      • Gateway: GetTransferConfigsForAll
      • Gateway: EstimateAmt
      • Contract: Pool-Based Transfer
      • Gateway: GetTransferStatus
      • Contract: Pool-Based Transfer Refund
      • Gateway: TransferHistory
      • Contract: Mint Canonical Token(OriginalTokenVault)
      • Contract: Mint Canonical Token(OriginalTokenVaultV2)
      • Contract: Mint Canonical Token Transfer Refund
      • Contract: Burn Canonical Token(PeggedTokenBridge)
      • Contract: Burn Canonical Token (PeggedTokenBridgeV2)
      • Contract: Burn Canonical Token Transfer Refund
      • Gateway: MarkRefRelation
      • Contract: TransferAgent Mint Token Submission
      • Contract: TransferAgent Burn Token Submission
      • Contract: Aptos Vault Mint Token Submission
      • Contract: Aptos PegBridge Burn Token Submission
  • NFT Bridge
    • Introduction
    • NFT Bridge Fee
  • List Your Tokens
    • Simple Listing Process
  • Reference
    • FAQ
    • Audit Reports
    • Contract Addresses
Powered by GitBook
On this page
  • Implementation
  • Request Parameters
  • TransferId Generation
  • Response
  1. Developer
  2. API Reference

Contract: TransferAgent Burn Token Submission

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

PreviousContract: TransferAgent Mint Token SubmissionNextContract: Aptos Vault Mint Token Submission

Last updated 2 years ago

TransferAgent transfer is not recommended if receiver's wallet address is no more than 20 bytes

Implementation

Through TransferAgent's transfer function, user can burn token on source chain and unlock user's assets on destination chain. According to , 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

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
     5, /// BridgeSendType.PegBurn
        /// https://github.com/celer-network/sgn-v2-contracts/blob/
        /// c66326d458b9d34058ed960f610af69d8514716c/contracts/
        /// libraries/BridgeTransferLib.sol#L27
     [] /// Extensions are not required
)

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

Transfer Id Generation with PeggedTokenBridge

const burn_id = ethers.utils.solidityKeccak256(
     [
      "address",
      "address",
      "uint256", 
      "uint64",
      "address",
      "uint64", 
      "uint64",
     ], 
     [
      "...", /// TransferAgent contract address
      "...", /// Token address on source chain,
      "...", /// Mint amount in String 
      "12360001", /// Destination Chain Id
      "0x0000000000000000000000000000000000000000", /// Hardcoded address zero
      "...", /// Nonce
      "...", /// Source chain id
     ],
)

Transfer Id Generation with PeggedTokenBridgeV2

const burn_id = ethers.utils.solidityKeccak256(
     [
      "address",
      "address",
      "uint256", 
      "uint64",
      "address",
      "uint64", 
      "uint64",
     ], 
     [
      "...", /// TransferAgent contract address
      "...", /// Token address on source chain,
      "...", /// Mint amount in String 
      "12360001", /// Destination Chain Id
      "0x0000000000000000000000000000000000000000", /// Hardcoded address zero
      "...", /// Nonce
      "...", /// Source chain id
      "...", /// Pegged Token Bridge V2 contract address on source chain
     ],
)

Response

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

Array<>

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 . It should be the same as transferId inside on-chain transaction log.

getTransferStatus
BridgeSendType
Extension
pegged_pair_config.bridge_version