Mint
To mint pegged token for user on pegged chain, FE(front-end) needs to do the following things:
- Get basic pegged configs through cBridge gateway. The same api as general token transfer
- After collecting all needed information, always get updated estimation for the mint. The same estimation api as general token transfer
- Check user’s on-chain token allowance for cBridge contract. If the allowance is not enough for mint, trigger the corresponding on-chain approve flow
- Submit on-chain deposit/mint request to cBridge OriginalTokenVault contract on source chain
- Get transfer status repeatedly to check whether the mint is complete.
Note: Mint/Burn flow are quite similar to pool-based token transfer flow. However, it is simpler because there is no slippage-related transfer failure scenario. If user’s original token could be moved into OriginalTokenVault, peggedTokenBridge will mint and send corresponding pegged tokens to user’s wallet address on pegged chain.
Note: If vault_version given by pegged_pair_config is 2, please use OriginalTokenVaultV2. Otherwise, use OriginalTokenVault