Skip to content

Instantly share code, notes, and snippets.

@adria0
Created December 11, 2023 08:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adria0/cc71b9b5884b4a4ff829fdb8fb462aeb to your computer and use it in GitHub Desktop.
Save adria0/cc71b9b5884b4a4ff829fdb8fb462aeb to your computer and use it in GitHub Desktop.
EccMulTest
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract EccMulTest {
struct Point {
uint x;
uint y;
}
event Log(uint x, uint y);
constructor() {
Point memory r = eccmul(Point(1, 2),0);
emit Log(r.x,r.y);
}
function eccmul(Point memory p, uint s) public view returns (Point memory r){
uint[3] memory input;
input[0] = p.x;
input[1] = p.y;
input[2] = s;
assembly {
if iszero (staticcall(gas(), 0x07, input, 0x60, r, 0x40)) {
revert (0,0)
}
}
return r;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment