-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[REG-1409]feat: add multicall to the sandbox #366
[REG-1409]feat: add multicall to the sandbox #366
Conversation
Contracts size report
|
function aggregate(Call[] calldata calls) public payable returns (uint256 blockNumber, bytes[] memory returnData) { | ||
blockNumber = block.number; | ||
uint256 length = calls.length; | ||
returnData = new bytes[](length); | ||
Call calldata call; | ||
for (uint256 i = 0; i < length; ) { | ||
bool success; | ||
call = calls[i]; | ||
(success, returnData[i]) = call.target.call(call.callData); | ||
require(success, 'Multicall3: call failed'); | ||
unchecked { | ||
++i; | ||
} | ||
} | ||
} |
Check notice
Code scanning / Slither
Calls inside a loop Low
function aggregate(Call[] calldata calls) public payable returns (uint256 blockNumber, bytes[] memory returnData) { | ||
blockNumber = block.number; | ||
uint256 length = calls.length; | ||
returnData = new bytes[](length); | ||
Call calldata call; | ||
for (uint256 i = 0; i < length; ) { | ||
bool success; | ||
call = calls[i]; | ||
(success, returnData[i]) = call.target.call(call.callData); | ||
require(success, 'Multicall3: call failed'); | ||
unchecked { | ||
++i; | ||
} | ||
} | ||
} |
Check warning
Code scanning / Slither
Low-level calls Warning
function tryAggregate(bool requireSuccess, Call[] calldata calls) public payable returns (Result[] memory returnData) { | ||
uint256 length = calls.length; | ||
returnData = new Result[](length); | ||
Call calldata call; | ||
for (uint256 i = 0; i < length; ) { | ||
Result memory result = returnData[i]; | ||
call = calls[i]; | ||
(result.success, result.returnData) = call.target.call(call.callData); | ||
if (requireSuccess) require(result.success, 'Multicall3: call failed'); | ||
unchecked { | ||
++i; | ||
} | ||
} | ||
} |
Check notice
Code scanning / Slither
Calls inside a loop Low
function tryAggregate(bool requireSuccess, Call[] calldata calls) public payable returns (Result[] memory returnData) { | ||
uint256 length = calls.length; | ||
returnData = new Result[](length); | ||
Call calldata call; | ||
for (uint256 i = 0; i < length; ) { | ||
Result memory result = returnData[i]; | ||
call = calls[i]; | ||
(result.success, result.returnData) = call.target.call(call.callData); | ||
if (requireSuccess) require(result.success, 'Multicall3: call failed'); | ||
unchecked { | ||
++i; | ||
} | ||
} | ||
} |
Check warning
Code scanning / Slither
Low-level calls Warning
function aggregate3(Call3[] calldata calls) public payable returns (Result[] memory returnData) { | ||
uint256 length = calls.length; | ||
returnData = new Result[](length); | ||
Call3 calldata calli; | ||
for (uint256 i = 0; i < length; ) { | ||
Result memory result = returnData[i]; | ||
calli = calls[i]; | ||
(result.success, result.returnData) = calli.target.call(calli.callData); | ||
assembly { | ||
// Revert if the call fails and failure is not allowed | ||
// `allowFailure := calldataload(add(calli, 0x20))` and `success := mload(result)` | ||
if iszero(or(calldataload(add(calli, 0x20)), mload(result))) { | ||
// set "Error(string)" signature: bytes32(bytes4(keccak256("Error(string)"))) | ||
mstore(0x00, 0x08c379a000000000000000000000000000000000000000000000000000000000) | ||
// set data offset | ||
mstore(0x04, 0x0000000000000000000000000000000000000000000000000000000000000020) | ||
// set length of revert string | ||
mstore(0x24, 0x0000000000000000000000000000000000000000000000000000000000000017) | ||
// set revert string: bytes32(abi.encodePacked("Multicall3: call failed")) | ||
mstore(0x44, 0x4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000) | ||
revert(0x00, 0x64) | ||
} | ||
} | ||
unchecked { | ||
++i; | ||
} | ||
} | ||
} |
Check notice
Code scanning / Slither
Calls inside a loop Low
function aggregate3Value(Call3Value[] calldata calls) public payable returns (Result[] memory returnData) { | ||
uint256 valAccumulator; | ||
uint256 length = calls.length; | ||
returnData = new Result[](length); | ||
Call3Value calldata calli; | ||
for (uint256 i = 0; i < length; ) { | ||
Result memory result = returnData[i]; | ||
calli = calls[i]; | ||
uint256 val = calli.value; | ||
// Humanity will be a Type V Kardashev Civilization before this overflows - andreas | ||
// ~ 10^25 Wei in existence << ~ 10^76 size uint fits in a uint256 | ||
unchecked { | ||
valAccumulator += val; | ||
} | ||
(result.success, result.returnData) = calli.target.call{value: val}(calli.callData); | ||
assembly { | ||
// Revert if the call fails and failure is not allowed | ||
// `allowFailure := calldataload(add(calli, 0x20))` and `success := mload(result)` | ||
if iszero(or(calldataload(add(calli, 0x20)), mload(result))) { | ||
// set "Error(string)" signature: bytes32(bytes4(keccak256("Error(string)"))) | ||
mstore(0x00, 0x08c379a000000000000000000000000000000000000000000000000000000000) | ||
// set data offset | ||
mstore(0x04, 0x0000000000000000000000000000000000000000000000000000000000000020) | ||
// set length of revert string | ||
mstore(0x24, 0x0000000000000000000000000000000000000000000000000000000000000017) | ||
// set revert string: bytes32(abi.encodePacked("Multicall3: call failed")) | ||
mstore(0x44, 0x4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000) | ||
revert(0x00, 0x84) | ||
} | ||
} | ||
unchecked { | ||
++i; | ||
} | ||
} | ||
// Finally, make sure the msg.value = SUM(call[0...i].value) | ||
require(msg.value == valAccumulator, 'Multicall3: value mismatch'); | ||
} |
Check warning
Code scanning / Slither
Low-level calls Warning
function aggregate3Value(Call3Value[] calldata calls) public payable returns (Result[] memory returnData) { | ||
uint256 valAccumulator; | ||
uint256 length = calls.length; | ||
returnData = new Result[](length); | ||
Call3Value calldata calli; | ||
for (uint256 i = 0; i < length; ) { | ||
Result memory result = returnData[i]; | ||
calli = calls[i]; | ||
uint256 val = calli.value; | ||
// Humanity will be a Type V Kardashev Civilization before this overflows - andreas | ||
// ~ 10^25 Wei in existence << ~ 10^76 size uint fits in a uint256 | ||
unchecked { | ||
valAccumulator += val; | ||
} | ||
(result.success, result.returnData) = calli.target.call{value: val}(calli.callData); | ||
assembly { | ||
// Revert if the call fails and failure is not allowed | ||
// `allowFailure := calldataload(add(calli, 0x20))` and `success := mload(result)` | ||
if iszero(or(calldataload(add(calli, 0x20)), mload(result))) { | ||
// set "Error(string)" signature: bytes32(bytes4(keccak256("Error(string)"))) | ||
mstore(0x00, 0x08c379a000000000000000000000000000000000000000000000000000000000) | ||
// set data offset | ||
mstore(0x04, 0x0000000000000000000000000000000000000000000000000000000000000020) | ||
// set length of revert string | ||
mstore(0x24, 0x0000000000000000000000000000000000000000000000000000000000000017) | ||
// set revert string: bytes32(abi.encodePacked("Multicall3: call failed")) | ||
mstore(0x44, 0x4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000) | ||
revert(0x00, 0x84) | ||
} | ||
} | ||
unchecked { | ||
++i; | ||
} | ||
} | ||
// Finally, make sure the msg.value = SUM(call[0...i].value) | ||
require(msg.value == valAccumulator, 'Multicall3: value mismatch'); | ||
} |
Check warning
Code scanning / Slither
Too many digits Warning
- mstore(uint256,uint256)(0x24,0x0000000000000000000000000000000000000000000000000000000000000017)
function aggregate3Value(Call3Value[] calldata calls) public payable returns (Result[] memory returnData) { | ||
uint256 valAccumulator; | ||
uint256 length = calls.length; | ||
returnData = new Result[](length); | ||
Call3Value calldata calli; | ||
for (uint256 i = 0; i < length; ) { | ||
Result memory result = returnData[i]; | ||
calli = calls[i]; | ||
uint256 val = calli.value; | ||
// Humanity will be a Type V Kardashev Civilization before this overflows - andreas | ||
// ~ 10^25 Wei in existence << ~ 10^76 size uint fits in a uint256 | ||
unchecked { | ||
valAccumulator += val; | ||
} | ||
(result.success, result.returnData) = calli.target.call{value: val}(calli.callData); | ||
assembly { | ||
// Revert if the call fails and failure is not allowed | ||
// `allowFailure := calldataload(add(calli, 0x20))` and `success := mload(result)` | ||
if iszero(or(calldataload(add(calli, 0x20)), mload(result))) { | ||
// set "Error(string)" signature: bytes32(bytes4(keccak256("Error(string)"))) | ||
mstore(0x00, 0x08c379a000000000000000000000000000000000000000000000000000000000) | ||
// set data offset | ||
mstore(0x04, 0x0000000000000000000000000000000000000000000000000000000000000020) | ||
// set length of revert string | ||
mstore(0x24, 0x0000000000000000000000000000000000000000000000000000000000000017) | ||
// set revert string: bytes32(abi.encodePacked("Multicall3: call failed")) | ||
mstore(0x44, 0x4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000) | ||
revert(0x00, 0x84) | ||
} | ||
} | ||
unchecked { | ||
++i; | ||
} | ||
} | ||
// Finally, make sure the msg.value = SUM(call[0...i].value) | ||
require(msg.value == valAccumulator, 'Multicall3: value mismatch'); | ||
} |
Check warning
Code scanning / Slither
Too many digits Warning
- mstore(uint256,uint256)(0x44,0x4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000)
function aggregate3Value(Call3Value[] calldata calls) public payable returns (Result[] memory returnData) { | ||
uint256 valAccumulator; | ||
uint256 length = calls.length; | ||
returnData = new Result[](length); | ||
Call3Value calldata calli; | ||
for (uint256 i = 0; i < length; ) { | ||
Result memory result = returnData[i]; | ||
calli = calls[i]; | ||
uint256 val = calli.value; | ||
// Humanity will be a Type V Kardashev Civilization before this overflows - andreas | ||
// ~ 10^25 Wei in existence << ~ 10^76 size uint fits in a uint256 | ||
unchecked { | ||
valAccumulator += val; | ||
} | ||
(result.success, result.returnData) = calli.target.call{value: val}(calli.callData); | ||
assembly { | ||
// Revert if the call fails and failure is not allowed | ||
// `allowFailure := calldataload(add(calli, 0x20))` and `success := mload(result)` | ||
if iszero(or(calldataload(add(calli, 0x20)), mload(result))) { | ||
// set "Error(string)" signature: bytes32(bytes4(keccak256("Error(string)"))) | ||
mstore(0x00, 0x08c379a000000000000000000000000000000000000000000000000000000000) | ||
// set data offset | ||
mstore(0x04, 0x0000000000000000000000000000000000000000000000000000000000000020) | ||
// set length of revert string | ||
mstore(0x24, 0x0000000000000000000000000000000000000000000000000000000000000017) | ||
// set revert string: bytes32(abi.encodePacked("Multicall3: call failed")) | ||
mstore(0x44, 0x4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000) | ||
revert(0x00, 0x84) | ||
} | ||
} | ||
unchecked { | ||
++i; | ||
} | ||
} | ||
// Finally, make sure the msg.value = SUM(call[0...i].value) | ||
require(msg.value == valAccumulator, 'Multicall3: value mismatch'); | ||
} |
Check warning
Code scanning / Slither
Too many digits Warning
- mstore(uint256,uint256)(0x04,0x0000000000000000000000000000000000000000000000000000000000000020)
function aggregate3Value(Call3Value[] calldata calls) public payable returns (Result[] memory returnData) { | ||
uint256 valAccumulator; | ||
uint256 length = calls.length; | ||
returnData = new Result[](length); | ||
Call3Value calldata calli; | ||
for (uint256 i = 0; i < length; ) { | ||
Result memory result = returnData[i]; | ||
calli = calls[i]; | ||
uint256 val = calli.value; | ||
// Humanity will be a Type V Kardashev Civilization before this overflows - andreas | ||
// ~ 10^25 Wei in existence << ~ 10^76 size uint fits in a uint256 | ||
unchecked { | ||
valAccumulator += val; | ||
} | ||
(result.success, result.returnData) = calli.target.call{value: val}(calli.callData); | ||
assembly { | ||
// Revert if the call fails and failure is not allowed | ||
// `allowFailure := calldataload(add(calli, 0x20))` and `success := mload(result)` | ||
if iszero(or(calldataload(add(calli, 0x20)), mload(result))) { | ||
// set "Error(string)" signature: bytes32(bytes4(keccak256("Error(string)"))) | ||
mstore(0x00, 0x08c379a000000000000000000000000000000000000000000000000000000000) | ||
// set data offset | ||
mstore(0x04, 0x0000000000000000000000000000000000000000000000000000000000000020) | ||
// set length of revert string | ||
mstore(0x24, 0x0000000000000000000000000000000000000000000000000000000000000017) | ||
// set revert string: bytes32(abi.encodePacked("Multicall3: call failed")) | ||
mstore(0x44, 0x4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000) | ||
revert(0x00, 0x84) | ||
} | ||
} | ||
unchecked { | ||
++i; | ||
} | ||
} | ||
// Finally, make sure the msg.value = SUM(call[0...i].value) | ||
require(msg.value == valAccumulator, 'Multicall3: value mismatch'); | ||
} |
Check warning
Code scanning / Slither
Too many digits Warning
- mstore(uint256,uint256)(0x00,0x08c379a000000000000000000000000000000000000000000000000000000000)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
We are adding multicall3 to the sandbox + deployed addresses to uns config. Here is some info about multicall: https://www.multicall3.com/
https://linear.app/unstoppable-domains/issue/REG-1409/create-service-to-check-usdc-balance-and-approved-amount-for-provided
PR Checklist
1. Contracts versioning
patch
version of the contracts is increased if changes have been made to theUNSRegistry
,MintingManager
,ProxyReader
,ENSCustody
contracts.minor
version of the contracts is increased if breaking changes have been made to theUNSRegistry
,MintingManager
,ProxyReader
,ENSCustody
contracts. It includes changes of interfaces.2. Contracts licensing
3. Coverage
4. Configs versioning
uns-config.json
is increased if changes have been made to the config.ens-config.json
is increased if changes have been made to the config.resolver-keys.json
is increased if changes have been made to the config.ens-resolver-keys.json
is increased if changes have been made to the config.5. Package versioning
patch
version of package is increased if valuable changes have been made to the package. It includes contracts update, configs update, etc.major.minor
version of package is synced with version ofUNSRegistry
contract.CHANGELOG
is updated with short description for the new version.6. Code review
resolver-keys.json
code review is required from DevTools teamens-resolver-keys.json
code review is required from DevTools team