This section discusses the main Wraplock APIs.
wraplock contract exposes the following public actions:
transfernotification: transferring native tokens to the
wraplockcontract will lock them and trigger an inline
wraplock::emitxferaction which records the token transfer in the action parameters. A proof of execution of a
wraplock::emitxferaction with specific parameters on the source chain, provided to the
wraptokencontract on the destination chain, allows the
wraptokenendpoint to issue a quantity of wrapped tokens, to the beneficiary named in the (now proven)
wraplock::emitxferaction invocation, that is equivalent to the quantity of tokens locked by this token-locking transfer; it also allows the
wraptokencontract on the destination chain to decide to cancel the token transfer from the source chain (see the Wraptoken API in the next section).
withdrawa: attempts to verify a provided block proof using the heavy proof scheme and an action proof of a
wraptoken::emitxferaction from the paired chain that proves that some wrapped tokens on the paired chain have been retired. On verification success, transfers native tokens from this
wraplockcontract to the beneficiary account, in this chain, that is named in the parameters to the
withdrawb: same as
withdrawa, but verifies a block proof using the light proof scheme.
cancela: attempts to verify a provided block proof using the heavy scheme and an action proof of a
wraptoken::emitxferaction from the paired chain that proves that some wrapped tokens on the paired chain have been retired. On verification success, triggers an inline
emitxferaction to reissue and return the wrapped tokens to a beneficiary account on the paired chain.
cancelb: same as
cancela, but verifies a block proof using the light proof scheme.
In essence, the
transfer notification on the
wraplock contract produces an inline action that records the information needed to issue and transfer the equivalent wrapped tokens over at the destination chain, using the block and action proving methods of the IBC Bridge. The
memo field of the
eosio.token transfer into the
wraplock contract specifies the name of the account, on the destination chain, that is the beneficiary, that is, the account that is going to receive the equivalent amount of wrapped tokens.
On the other hand, the
cancelb actions work on the opposite direction: they act upon a proof of a
wraptoken::emitxfer inline action being triggered on the destination chain (see the Wraptoken API in the next section). Possessing a proof that some account on the destination chain has retired (destroyed) some wrapped tokens allows the
wraplock contract to release the equivalent amount of locked native tokens to some beneficiary (that is named in the
wraptoken::emitxfer action invocation's parameters) using the
withdraw actions, or cancel that transfer of wrapped tokens back into native tokens, using the
These are internal inline actions that are triggered by user action:
emitxfer: As mentioned above, this is an internal inline action that is triggered when native tokens are locked in this contract (as a side-effect of a
transferof tokens to it) or a cross-chain transfer to this chain is cancelled (via the
cancelbactions listed above). Specifies the token, quantity and beneficiary, and forms part of the proof.
init: initializes the token bridge, between this chain and another specific chain.
addcontract: adds support for a native token contract and its corresponding
wraptokencontract on the paired chain.
delcontract: removes support for a native token contract.
For more information, refer to the Wraplock reference documentation.