You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
781 B
Solidity
26 lines
781 B
Solidity
2 years ago
|
// SPDX-License-Identifier: MIT
|
||
|
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Multicall.sol)
|
||
|
|
||
|
pragma solidity ^0.8.0;
|
||
|
|
||
|
import "./Address.sol";
|
||
|
|
||
|
/**
|
||
|
* @dev Provides a function to batch together multiple calls in a single external call.
|
||
|
*
|
||
|
* _Available since v4.1._
|
||
|
*/
|
||
|
abstract contract Multicall {
|
||
|
/**
|
||
|
* @dev Receives and executes a batch of function calls on this contract.
|
||
|
* @custom:oz-upgrades-unsafe-allow-reachable delegatecall
|
||
|
*/
|
||
|
function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) {
|
||
|
results = new bytes[](data.length);
|
||
|
for (uint256 i = 0; i < data.length; i++) {
|
||
|
results[i] = Address.functionDelegateCall(address(this), data[i]);
|
||
|
}
|
||
|
return results;
|
||
|
}
|
||
|
}
|