mirror of
https://github.com/status-im/EIPs.git
synced 2025-01-14 17:04:11 +00:00
Updated to use staticcall
This commit is contained in:
parent
d39b3885d4
commit
50f59da47f
@ -145,16 +145,14 @@ contract ERC165Cache {
|
|||||||
return ImplStatus.No;
|
return ImplStatus.No;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update this after the Metropolis hard fork to use staticcall!
|
|
||||||
function noThrowCall(address _contract, bytes4 _interfaceId) internal view returns (bool result) {
|
function noThrowCall(address _contract, bytes4 _interfaceId) internal view returns (bool result) {
|
||||||
bytes4 erc165ID = ERC165ID;
|
bytes4 erc165ID = ERC165ID;
|
||||||
assembly {
|
assembly {
|
||||||
let x := mload(0x40) // Find empty storage location using "free memory pointer"
|
let x := mload(0x40) // Find empty storage location using "free memory pointer"
|
||||||
mstore(x, erc165ID) // Place signature at begining of empty storage
|
mstore(x, erc165ID) // Place signature at begining of empty storage
|
||||||
mstore(add(x, 0x04), _interfaceId) // Place first argument directly next to signature
|
mstore(add(x, 0x04), _interfaceId) // Place first argument directly next to signature
|
||||||
call(30000, // 30k gas
|
staticcall(30000, // 30k gas
|
||||||
_contract, // To addr
|
_contract, // To addr
|
||||||
0, // No value
|
|
||||||
x, // Inputs are stored at location x
|
x, // Inputs are stored at location x
|
||||||
0x8, // Inputs are 8 byes long
|
0x8, // Inputs are 8 byes long
|
||||||
x, // Store output over input (saves space)
|
x, // Store output over input (saves space)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user