deploy scroll
This commit is contained in:
6
contracts/external/Multicall.sol
vendored
6
contracts/external/Multicall.sol
vendored
@@ -12,13 +12,13 @@ contract Multicall {
|
||||
address target;
|
||||
bytes callData;
|
||||
}
|
||||
function aggregate(Call[] memory calls) public returns (uint256 blockNumber, bytes[] memory returnData, bool[] memory dataValid) {
|
||||
|
||||
function aggregate(Call[] memory calls) public returns (uint256 blockNumber, bytes[] memory returnData) {
|
||||
blockNumber = block.number;
|
||||
returnData = new bytes[](calls.length);
|
||||
dataValid = new bool[](calls.length);
|
||||
for(uint256 i = 0; i < calls.length; i++) {
|
||||
(bool success, bytes memory ret) = calls[i].target.call(calls[i].callData);
|
||||
dataValid[i] = success;
|
||||
require(success);
|
||||
returnData[i] = ret;
|
||||
}
|
||||
}
|
||||
|
||||
47
contracts/external/MulticallWithValid.sol
vendored
Normal file
47
contracts/external/MulticallWithValid.sol
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
pragma solidity 0.6.9;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
/// @title Multicall - Aggregate results from multiple read-only function calls
|
||||
/// @author Michael Elliot <mike@makerdao.com>
|
||||
/// @author Joshua Levine <joshua@makerdao.com>
|
||||
/// @author Nick Johnson <arachnid@notdot.net>
|
||||
|
||||
// WithValid
|
||||
contract Multicall {
|
||||
struct Call {
|
||||
address target;
|
||||
bytes callData;
|
||||
}
|
||||
function aggregate(Call[] memory calls) public returns (uint256 blockNumber, bytes[] memory returnData, bool[] memory dataValid) {
|
||||
blockNumber = block.number;
|
||||
returnData = new bytes[](calls.length);
|
||||
dataValid = new bool[](calls.length);
|
||||
for(uint256 i = 0; i < calls.length; i++) {
|
||||
(bool success, bytes memory ret) = calls[i].target.call(calls[i].callData);
|
||||
dataValid[i] = success;
|
||||
returnData[i] = ret;
|
||||
}
|
||||
}
|
||||
// Helper functions
|
||||
function getEthBalance(address addr) public view returns (uint256 balance) {
|
||||
balance = addr.balance;
|
||||
}
|
||||
function getBlockHash(uint256 blockNumber) public view returns (bytes32 blockHash) {
|
||||
blockHash = blockhash(blockNumber);
|
||||
}
|
||||
function getLastBlockHash() public view returns (bytes32 blockHash) {
|
||||
blockHash = blockhash(block.number - 1);
|
||||
}
|
||||
function getCurrentBlockTimestamp() public view returns (uint256 timestamp) {
|
||||
timestamp = block.timestamp;
|
||||
}
|
||||
function getCurrentBlockDifficulty() public view returns (uint256 difficulty) {
|
||||
difficulty = block.difficulty;
|
||||
}
|
||||
function getCurrentBlockGasLimit() public view returns (uint256 gaslimit) {
|
||||
gaslimit = block.gaslimit;
|
||||
}
|
||||
function getCurrentBlockCoinbase() public view returns (address coinbase) {
|
||||
coinbase = block.coinbase;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user