Skip to content

Instantly share code, notes, and snippets.

@Neurone
Last active January 30, 2023 15:54
Show Gist options
  • Save Neurone/d031cdc622681dcc22e9b8814ebbbade to your computer and use it in GitHub Desktop.
Save Neurone/d031cdc622681dcc22e9b8814ebbbade to your computer and use it in GitHub Desktop.
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract EIP_196_197 {
// After calling testAdd() output variable cointains these values:
// - output[0] == 0x030644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd3
// - output[1] == 0x15ed738c0e0a7c92e7845f96b2ae9c0a68a6a449e3538fc7ff3ebf7a5a18a2c4
uint256[2] public output;
function testAdd() public returns (bool success, uint256[2] memory _output){
uint256[4] memory input;
input[0] = 1;
input[1] = 2;
input[2] = 1;
input[3] = 2;
assembly {
// Address 0x6 == ecAdd
success := staticcall(sub(gas(), 2000), 0x6, input, 128, _output, 64)
}
output = _output;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment