cancel_transfer

@mount("ft4.crosschain.cancel_transfer") operation cancel_transfer(init_transfer_tx: gtx_transaction, init_tx_op_index: integer, previous_hop_tx: gtx_transaction, op_index: integer, hop_index: integer)(source)

Cancels a crosschain transfer that has expired. This operation must be called in place of apply_transfer to start the transfer canceling process. unapply_transfer must then be called on all previous chains to bring the funds back to the sender account.

Throws "TRANSFER NOT EXPIRED" if the transfer has not yet expired.

Throws in various cases of misconfiguration. Some examples:

  • the transfer has already been applied, canceled or unapplied on this chain.

  • the chain at hop_index on the init transaction is not this chain

  • the op_index on previous_hop_tx does not point to:

    • init_transfer when hop_index is 0

    • apply_transfer otherwise

  • the init_tx_op_index does not point to init_transfer on its init_transfer_tx

  • the operation preceding init_transfer is not an auth operation

  • arguments found in init_transfer_tx and previous_hop_tx do not match

  • hop_index is out of bounds

  • previous_hop_tx has not been sent to the chain that comes before this one on the transfer hops

Throws if the transaction is missing the iccf_proof operation, which demonstrates that the block containing the previous_hop_tx has been anchored from the previous chain.

Anyone can call this operation, but it needs to include an iccf_proof operation that apply_transfer was performed on the previous chain.

Parameters

init_transfer_tx

the transaction containing the init_transfer operation which corresponds to the transfer to cancel

init_tx_op_index

the index of the init_transfer operation in init_transfer_tx

previous_hop_tx

the transaction containing the apply_transfer operation of the previous hop

op_index

the index of the apply_transfer or init_transfer operation in previous_hop_tx

hop_index

which index in the hops array provided in the original transaction this chain represents.

See also

core.auth.is_auth_op

for information on auth operations

core.crosschain.applied_transfers

to know more about the crosschain transfer workflow

core.crosschain.canceled_transfers

to know more about transfer canceling

crosschain.unapply_transfer

for information on