Batch Operations

Published by Marianne Poser on

Since all tokens are within a contract, multiple queries and operations can be performed in one transaction. Batch operations were introduced for this purpose. For the batch balance query, the address of the owner and the tokenIDs being queried would be included in two arrays and the number would also be returned in an array. Also, the transfer function is extended in the batch variant by two arrays with information of tokenID and amount. For the approval functions, however, the approach is “all or nothing”. There are no restrictions in amount or tokenID.

However, all functions will also be available without a batch feature to remain gas-efficient for single operations. In general, the approach of a multi-token contract is extremely gas-efficient since there is no need to create multiple contracts for the different token types and the transactions also take place within one contract.