Puzzle #2
AddressGame
Author
0xb49bf876be26435b6fae1ef42c3c82c5867fa149
chainlight.io
SoliditySolidity's logo.Puzzle
Curtacallsverify()
1
// SPDX-License-Identifier: UNLICENSED
2
pragma solidity 0.8.19;
3
4
interface IPuzzle {
5
function name() external pure returns (string memory);
6
function generate(address _seed) external returns (uint256);
7
function verify(uint256 _start, uint256 _solution) external returns (bool);
8
}
9
10
interface IBox {
11
function isSolved() external view returns (bool);
12
}
13
14
contract AddressGame is IPuzzle {
15
uint256 public number;
16
function name() external pure returns (string memory) {
17
return "AddressGame";
18
}
19
20
function generate(address x) public pure returns (uint256) {
21
return uint256(keccak256(abi.encode(x)));
22
}
23
24
function verify(uint256 seed, uint256 solution) external returns (bool) {
25
uint256[16] memory c;
26
for (uint256 i = 0; i < 40; i++) {
27
uint256 step = (solution >> (i * 4)) & 0xf;
28
c[step] += 1;
29
}
30
31
{
32
require(((c[0xa] + c[0xe]) & 1) == box(seed, 0) % 2, "#vowels");
33
require(((c[0xb] + c[0xc] + c[0xd] + c[0xf]) % 3) == box(seed, 1) % 3, "#consonant");
34
}
35
36
{
37
uint256 _sum = 0;
38
for (uint256 i = 1; i < 10; i++) {
39
_sum += c[i] * i;
40
}
41
require(_sum == 25 + seed % 50);
42
}
43
44
return IBox(address(uint160(solution))).isSolved();
45
}
46
47
function box(uint256 seed, uint256 anything) public pure returns (uint256) {
48
unchecked {
49
return (0x123456789 * seed + 17879862832311687437 * anything) % (15203777108537674021);
50
}
51
}
52
}
First Blood
punkdev.eth
02:01:52
16
Time Left

Solve locally (WIP)

  1. Clone GitHub repo + install deps
git clone https://github.com/waterfall-mkt/curta-puzzles.git && cd curta-puzzles && forge install
  1. Set RPC_URL_MAINNET in .env
.env
RPC_URL_MAINNET=""
  1. Write solution + run script
forge script <PATH_TO_PUZZLE> -f mainnet -vvv
This is still WIP.
Waterfall