Burn
To withdraw user's original token on original chain, FE(front-end) needs to do the following things:
Get basic pegged configs through cBridge gateway. The same api as general token transfer
Check user's on-chain token allowance for cBridge PeggedTokenBridge contract. If the allowance is not enough for burn, trigger the corresponding on-chain approve flow
Submit on-chain burn request to cBridge PeggedTokenBridge contract on pegged chain
Get transfer status repeatedly to check whether the burn/withdraw is complete.
If bridge_version given by pegged_pair_config is 2, you should submit transaction using PeggedTokenBridgeV2 abi. Otherwise, use PeggedTokenBridge. The parameters of burn function are different since PeggedTokenBridgeV2 supports Burn-Mint mode.
Burn-Mint (PeggedTokenBridgeV2 only)
Unlike PeggedTokenBridge, you can burn canonical token on pegged chain where PeggedTokenBridgeV2 is deployed and Celer SGN will mint corresponding tokens on another pegged chain if both pegged chains share the same original chain id and the same original token. In this scenario, the user can skip interaction with OriginalTokenVault and have a better experience for his assets transfer.
Last updated