Delegate
  • Overview
  • Delegating a wallet
  • Comparison with Others
  • FAQ
  • Audits
  • Integrate In Your Project
    • Smart Contract Examples
    • Token Ownership Claiming
  • Upgrade to V2
    • V2 is a Separate Contract
    • V1 → V2 migration
    • Batching
    • Subdelegations
  • Advanced Use Cases
    • Shadow Delegation
  • Delegate Market
    • Overview
    • FAQ
  • Gaming
    • Delegate for Gaming
  • Technical Documentation
    • Delegate Registry
      • Contract Addresses
      • IDelegateRegistry.sol
    • Javascript SDK
      • Installation / Importing
      • Setup
      • Check Delegations
        • checkDelegateForAll
        • checkDelegateForContract
        • checkDelegateForERC721
        • checkDelegateForERC1155
        • checkDelegateForERC20
      • Fetch Delegations
      • Delegate/Revoke
        • delegateAll
        • delegateContract
        • delegateERC721
        • delegateERC1155
        • delegateERC20
    • REST API
      • v2
      • v1
  • Resources
    • Media Kit
    • Github
    • Twitter
    • Live Stats
  • V1 Registry (Legacy)
    • Technical Documentation
Powered by GitBook
On this page
  1. Upgrade to V2

Batching

The multicall() method in V2 registry lets users queue up multiple delegations and submit them all in a single transaction. This is more gas-efficient and saves user time.

The function is simple, use a frontend library to pack each method call into its bytes representation then submit an array of byte function calls. This can be used for both writes and reads.

function multicall(bytes[] calldata data) external payable override returns (bytes[] memory results) {
    results = new bytes[](data.length);
    bool success;
    unchecked {
        for (uint256 i = 0; i < data.length; ++i) {
            //slither-disable-next-line calls-loop,delegatecall-loop
            (success, results[i]) = address(this).delegatecall(data[i]);
            if (!success) revert MulticallFailed();
        }
    }
}

PreviousV1 → V2 migrationNextSubdelegations

Last updated 1 year ago