apply_transfer
This operation must be called on every chain listed in the hops array provided to the init_transfer function which corresponds to this transfer.
When this is done, one of two things will happen:
If this is an intermediary hop, this chain will update its internal record of which chain that owns how much of what asset
If this is the final hop, the transferred amount will be credited to the recipient account
In the case where this is the last hop and the recipient account does not exist, one of two things can happen:
If the create on transfer account creation strategy is enabled, the assets will be received and the recipient will be able create the account and claim them.
If the feature is not enabled, the transfer will be rejected, in which case, the sender can get their assets back by calling the
cancel_transferin the reverse hops order.
Anyone can call this operation on behalf of any transfer, but it needs to include an iccf_proof operation which prove that the transaction was applied in the previous hop.
The functionality provided by apply_transfer can be modified by extending before_apply_transfer and after_apply_transfer
Throws "TRANSFER EXPIRED"` if deadline is a past timestamp
Throws "MISSING ACCOUNT" if all these conditions apply:
this chain is the last chain in the crosschain transaction
the account corresponding to
recipient_iddoes not existcreating account on crosschain transfer is not enabled on this chain
Throws if additional conditions provided through extensions of before_apply_transfer and after_apply_transfer are not satisfied
Throws if the current transfer is misconfigured. Common cases are:
the next hop or the previous one are:
equal to one another
this blockchain's RID
the ID of an account on this chain which is not a blockchain account
amount is:
not in the accepted range (0, 2^256) (exclusive)
higher than the blockchain account balance they're coming from
the asset is not registered on this chain
input is malformed:
arguments found in
init_transfer_txandprevious_hop_txdo not matchhop_indexis out of boundsprevious_hop_txhas not been sent to the chain that comes before this one on the transfer hopsthe transfer has already been applied, canceled or unapplied on this chain.
the chain at
hop_indexon the init transaction is not this chainthe
op_indexonprevious_hop_txdoes not point to:init_transferwhenhop_indexis 0apply_transferotherwisethe
init_tx_op_indexdoes not point toinit_transferon itsinit_transfer_txthe operation preceding
init_transferis not an auth operation
Throws if all these conditions apply:
this chain is the last chain in the crosschain transaction
the account corresponding to
recipient_iddoes not existcreating account on crosschain transfer is enabled on this chain
the function implementing the account creation strategy being used (extension of
create_on_crosschain_transfer) has conditions which are not satisfied
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.
Requires no flags - no authorization is performed to apply a transfer.
Parameters
the gtx_transaction that represents the tx containing the init_transfer operation on the initial chain
the index of the init_transfer operation in init_transfer_tx
the tx containing the init_transfer or apply_transfer operation from the previous step. In the first hop, init_transfer_tx and this argument will be the same
the index of the apply_transfer operation in previous_hop_tx
which index in the hops array provided in the original transaction this chain represents.
See also
for information on auth operations
to add custom logic before this operation
to add custom logic after this operation
to know more about the crosschain transfer workflow
to know more about account creation on crosschain transfer