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_transfer
in 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_id
does 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_tx
andprevious_hop_tx
do not matchhop_index
is out of boundsprevious_hop_tx
has 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_index
on the init transaction is not this chainthe
op_index
onprevious_hop_tx
does not point to:init_transfer
whenhop_index
is 0apply_transfer
otherwisethe
init_tx_op_index
does not point toinit_transfer
on itsinit_transfer_tx
the operation preceding
init_transfer
is 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_id
does 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