1// SPDX-License-Identifier: MIT2pragma solidity ^0.8.18;3
4interface IStarknetCore {5 function consumeMessageFromL2(uint256, uint256[] calldata)6 external7 returns (bytes32);8}9
10// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong11// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong12// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong13// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong14// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong15// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong16// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong17// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong18// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong19// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong20// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong21// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong22// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong23// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong24// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong25// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong26// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong27// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong28// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong29// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong30
31/// @title PingPong32/// @author exp.table33contract PingPong {34
35 IStarknetCore constant starknetCore = IStarknetCore(0xc662c410C0ECf747543f5bA90660f6ABeBD9C8c4);36 uint256 constant pong = 0x012d8ab4947254afb512883d7d768d17436c9057a1ae21e53389603266c397f7;37 address a;38
39 constructor(bytes memory bytecode) {40 assembly {41 sstore(a.slot, create(0, add(bytecode, 0x20), mload(bytecode)))42 }43 }44 45 function name() external pure returns (string memory) {46 return "Ping Pong";47 }48
49 function generate(address _seed) external view returns (uint256) {50 return uint256(keccak256(abi.encodePacked(_seed, block.number)));51 }52
53 function verify(uint256 _start, uint256 _solution) external returns (bool success) {54 uint256[] memory payload = new uint256[](3);55 payload[0] = _start >> 128;56 payload[1] = _start & 340282366920938463463374607431768211455;57 payload[2] = _solution;58
59 starknetCore.consumeMessageFromL2(pong, payload);60
61 (, bytes memory result) = a.call(abi.encode(_solution));62 success = abi.decode(result, (bool));63 }64
65 function gist() external pure returns (string memory) {66 return "9761e3575eb6439a1fab1d834ddc18aa";67 }68}
Time Left
Solve locally (WIP)
- Clone GitHub repo + install deps
git clone https://github.com/waterfall-mkt/curta-puzzles.git && cd curta-puzzles && forge install
- Set
RPC_URL_MAINNET
in.env
.env
RPC_URL_MAINNET=""
- Write solution + run script
forge script <PATH_TO_PUZZLE> -f mainnet -vvv
This is still WIP.