Contract: Mint Canonical Token(OriginalTokenVault)

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

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 OriginalTokenVaultarrow-up-right contract on the source chain, specifically via the depositarrow-up-right or depositNativearrow-up-right functions, which will trigger the minting of canonical tokens from the PeggedTokenBridgearrow-up-right 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: https://github.com/celer-network/cBridge-typescript-client/tree/main/contract/abi/pegged/PeggedTokenBridge.solarrow-up-right, https://github.com/celer-network/cBridge-typescript-client/tree/main/contract/abi/pegged/OriginalTokenVault.solarrow-up-right

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

circle-exclamation

TransferId Generation

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

Response

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

Last updated