ICRC-2
The ICRC-2 standard is an extension of the ICRC-1 standard that enables additional functionality for icrc2_approve
and icrc2_transfer_from
transactions. Since it is an extension of ICRC-1, it supports all of the ICRC-1 standard's methods and metadata. The approve
method allows an account owner to delegate token transfers to a third party on the owner's behalf, while the transfer_from
method enables approved token transactions to be initiated. These workflows are common in the Ethereum ecosystem through the ERC-20 token standard.
The approve
and transfer_from
workflow uses two steps:
First, the account owner allows another user to transfer up to X tokens from their account (A) by calling the ledger's
icrc2_approve
method.The user transfers up to X tokens from account A to any account through the
icrc2_transfer_from
method. The number of transfers is not limited as long as the total amount spent is below X.
Example ICRC-2 tokens on ICP include:
View an example of a dapp for an ICRC-2 token swap.
View an example of a dapp that enables the transfer_from
workflow.