Created
December 11, 2023 08:34
-
-
Save adria0/cc71b9b5884b4a4ff829fdb8fb462aeb to your computer and use it in GitHub Desktop.
EccMulTest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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