OPERATION

unapply_transfer

@mount("ft4.crosschain.unapply_transfer") operation unapply_transfer(init_transfer_tx: gtx_transaction, init_tx_op_index: integer, last_tx: gtx_transaction, last_op_index: integer, hop_index: integer)

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 and last_tx do not match
  • hop_index is out of bounds or points to a different chain than this one
  • hop_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 hops
  • recall_unclaimed_transfer if the transfer was applied on the target chain, it was sent to a non-existing account, and it has expired
  • unapply_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

  • init_transfer_tx — the transaction containing the init_transfer operation which corresponds to the transfer to unapply
  • init_tx_op_index — the index of the init_transfer operation in init_transfer_tx
  • last_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.
  • last_op_index — the index of the supported operation in last_tx
  • hop_index — which index in the hops array provided in the original transaction this chain represents.

See Also

  • apply_transfer — for edge cases where this operation might throw
  • [core.crosschain.applied_transfers] — to know more about the crosschain transfer workflow
  • [core.crosschain.unapplied_transfers] — to know more about transfer unapplying
  • [core.crosschain.canceled_transfers] — to know more about transfer canceling
  • [core.crosschain.recalled_transfers] — to know more about transfer recall
© 2024 Chromia