ERC-6357: Single-contract Multi-delegatecall
Allows an EOA to call multiple functions of a smart contract in a single transaction
Abstract
This EIP standardizes an interface containing a single function, multicall
, allowing EOAs to call multiple functions of a smart contract in a single transaction, and revert all calls if any call fails.
Motivation
Currently, in order to transfer several ERC-721 NFTs, one needs to submit a number of transactions equal to the number of NFTs being tranferred. This wastes users' funds by requiring them to pay 21000 gas fee for every NFT they transfer.
Specification
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 and RFC 8174.
Contracts implementing this EIP must implement the following interface:
Rationale
multicallPayable
is optional because it isn't always feasible to implement, due to the msg.value
splitting.
Backwards Compatibility
This is compatible with most existing multicall functions.
Test Cases
The following JavaScript code, using the Ethers library, should atomically transfer amt
units of an ERC-20 token to both addressA
and addressB
.
Reference Implementation
Security Considerations
multicallPayable
should only be used if the contract is able to support it. A naive attempt at implementing it could allow an attacker to call a payable function multiple times with the same ether.
Copyright
Copyright and related rights waived via CC0.