Contract: Mint Canonical Token Transfer Refund
Trigger cBridge `withdraw` function with all needed info. Then cBridge OriginalTokenVault contract will transfer corresponding assets back to user's address on source chain
Certain failed transfers sent via OriginTokenVault contract can be refunded using the withdraw function. Please read the gateway refund process first to learn how to obtain the parameters required. NOTE: DO NOT call addLiquidity from a smart contract, as currently it is not possible to withdraw liquidity added from contract addresses.
Here is the abi for OriginalTokenVault: https://github.com/celer-network/cBridge-typescript-client/tree/main/contract/abi/pegged/OriginalTokenVault.sol
originalTokenVault.withdraw(wdmsg, sigs, signers, powers)
wdmsg | BytesLike | wd_onchain |
sigs | Array<BytesLike> | sorted_sigs |
signers | Array<String> | signers |
powers | Array<BigNumber> | powers |
Notice: Since the types of parameters are different between getTransferStatus response and withdraw request, please convert them accordingly. See details in the below code sample
JavaScript
import { base64, getAddress, hexlify } from "ethers/lib/utils";
const wdmsg = base64.decode(wd_onchain);
const signers = _signers.map(item => {
const decodeSigners = base64.decode(item);
const hexlifyObj = hexlify(decodeSigners);
return getAddress(hexlifyObj);
});
const sigs = sorted_sigs.map(item => {
return base64.decode(item);
});
const powers = _powers.map(item => {
return base64.decode(item);
});
Since this function is an on-chain transaction, the response is the corresponding transaction response.