Created
February 8, 2023 09:57
-
-
Save LCamel/a2cd1868da9ad1445d9e464ae0e0c8e2 to your computer and use it in GitHub Desktop.
Poseidon library / contract hack
This file contains hidden or 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.18; | |
| // HACK: PROTOTYPING ONLY: use "contract" with a fixed address to avoid compiler library settings | |
| contract Poseidon4 { | |
| function poseidon(uint256[4] memory) public pure returns (uint256) {} | |
| } | |
| // goerli: after block 8166444 | |
| Poseidon4 constant P = Poseidon4(0x3b44AA63Ac599170357dC587880fC30E506612e7); | |
| contract A { | |
| function add() public pure returns (uint256) { | |
| return P.poseidon([uint256(1), 2, 3, 4]); | |
| // 18821383157269793795438455681495246036402687001665670618754263018637548127333 | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment