1

On the Tzip for FA2, I read that

Every transfer operation MUST happen atomically and in order. If at least one transfer in the batch cannot be completed, the whole transaction MUST fail, all token transfers MUST be reverted, and token balances MUST remain unchanged.

How does failing of transactions work? If I batch 10 transfers into 1 operation and 1 of the token transfers fails, do the other 9 fail automatically as well? Or do I have to revert them manually?

5

Other transactions will fail automatically and the contract will revert to the previous storage state automatically.

By design, any invocation of the Tezos smart contract works as an atomic transaction. An entry point gets the current contract storage value and returns an updated storage value. If the operation fails for any reason, a new storage value is discarded and the contract keeps the previous storage value.

The FA2 storage keeps the ledger with token balances. When processing a batch, transfer operation updates the ledger applying individual transfers sequentially and then returns the resulting ledger. If any of the individual transfers fails, the resulting ledger and any other contract storage changes are discarded.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.