🌉
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: Mint Canonical Token(OriginalTokenVault)

Lock user's assets into cBridge and mint corresponding token on the destination chain

PreviousGateway: TransferHistoryNextContract: Mint Canonical Token(OriginalTokenVaultV2)

Last updated 2 years ago

Implementation

Minting is the process of locking original tokens on the source chain and minting canonical tokens that are pegged 1:1 on the destination chain. Original tokens can be deposited into the contract on the source chain, specifically via the or functions, which will trigger the minting of canonical tokens from the contract on the destination chain. For advanced users, the two deposit functions can be called from smart contracts.

Here is the abi for the canonical / pegged token bridge contracts: ,

const transferTx = await transactor(
     originalTokenVault!.deposit(
          pegConfig.config.org_token.token.address, 
          value,
          pegConfig.config.pegged_chain_id,
          address, 
          nonce,
     ),    
).catch(e => {
     /// Handle Error
});

Request Parameters

Name
Type
Description

token

String

Token's address

amount

UInt256

locked token amount

mint_chain_id

UInt64

destination chainId to mint tokens

nonce

UInt64

Current timestamp

mint_account

String

User's wallet address

If the mint_account 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

/// Example transaction:
/// https://testnet.bscscan.com/tx/0x5a4a0b50a74c9671f39694a506f1117bdfda2fbd001fe853c0494ca542d7687f#eventlog
const deposit_id = ethers.utils.solidityKeccak256(
     [
      "address",
      "address",
      "uint256", 
      "uint64", 
      "address",
      "uint64", 
      "uint64"
     ], 
     [
      "0x51d36e18e3d32d121a3cfe2f3e5771a6fd53274e", /// User's wallet address, 
      "0x0368ba12d5b0fc5cd2e17199f8074fbac9abb7aa", /// selectedTokenAddress,
      "50000000000000000000", /// Mint amount in String 
      "65", /// Pegged Chain Id
      "0x51d36e18e3d32d121a3cfe2f3e5771a6fd53274e", /// User's wallet address, 
      "....", /// Nonce
      "...", /// Original chain id
     ],
)

Response

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

When you submit on-chain deposit transaction, 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.

OriginalTokenVault
deposit
depositNative
PeggedTokenBridge
https://github.com/celer-network/cBridge-typescript-client/tree/main/contract/abi/pegged/PeggedTokenBridge.sol
https://github.com/celer-network/cBridge-typescript-client/tree/main/contract/abi/pegged/OriginalTokenVault.sol
getTransferStatus