Updated to use staticcall

This commit is contained in:
William Entriken 2018-02-16 06:35:16 -05:00 committed by GitHub
parent d39b3885d4
commit 50f59da47f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 3 deletions

View File

@ -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)