unapply_transfer
Unapplies a crosschain transfer that has expired. This operation must be called if apply_transfer
was already executed on this chain. To successfully unapply a transfer, it must have been:
canceled or any later hop (including the target chain), or
recalled on the target chain. This operation should not be called on the init chain -
revert_transfer
should be used instead.
Throws "INVALID TRANSFER"
if the transfer that is being unapplied was:
never applied on this chain
already canceled or unapplied
Throws "INPUT ERROR"
if the input is malformed. This could be one of many different things:
arguments found in
init_transfer_tx
andlast_tx
do not matchhop_index
is out of bounds or points to a different chain than this onehop_index
points to the target chain, where canceling or recall should happen (not unapplying)last_tx
has not been sent to the chain that comes after this one on the transfer hops
Throws"UNSUPPORTED LAST OP"
if the operation found in last_tx
at the given index is neither of the three supported operations:
cancel_transfer
if the transfer was canceled before being applied on the chain that came after this one on the transfer hopsrecall_unclaimed_transfer
if the transfer was applied on the target chain, it was sent to a non-existing account, and it has expiredunapply_transfer
if the transfer was canceled or recalled, and then unapplied on another chain before reaching this one
Throws "TRANSFER NOT EXPIRED"
if the transfer being reverted did not expire
Throws if the init_tx_op_index
does not point to init_transfer
on init_transfer_tx
Throws if the required assets cannot be transferred. While this could throw in all cases of misconfiguration considered possible for apply_transfer
, to unapply a transfer it must first have been applied. This means that the most probable scenario for the transfer of funds to fail is if the sender blockchain account balance is lower than amount
.
Other cases considered possible for apply_transfer
are still possible, although unlikely. For example, the asset entity could have been deleted, which means that the asset is no longer registered on this chain.
Requires no flags - no authorization is performed to unapply a transfer.
Parameters
the transaction containing the init_transfer
operation which corresponds to the transfer to unapply
the index of the init_transfer
operation in init_transfer_tx
the last transaction in this transfer flow, as sent to the previous hop. Note that "previous" in this context refers to the chain at n + 1 in the hops array in relation to this blockchain, since we are walking the hops array backwards. It must contain one of the three supported operations described above.
the index of the supported operation in last_tx
which index in the hops array provided in the original transaction this chain represents.
See also
for edge cases where this operation might throw
to know more about the crosschain transfer workflow
to know more about transfer unapplying
to know more about transfer canceling
to know more about transfer recall