cuckoo

Reference

Contract reference

Every function, struct, event and error of Cuckoo.sol.

Solidity 0.8.26, no dependencies, no constructor arguments, no owner, no upgrade. Runtime size 3068 bytes.

Struct

struct Egg { address owner; address target; uint256 value; bytes data;
             uint64 notBefore; uint64 notAfter; uint256 maxReward; uint256 nonce; }

Functions

FunctionWhat
deposit() payable / depositFor(address) payableCredit ETH to an escrow.
withdraw(uint256)Take escrow back, any time.
cancel(uint256 nonce)Burn one of your own nonces.
hatch(Egg, bytes signature) returns (uint256 reward)Carry an egg. Anyone. First valid call wins.
clock() viewThe block counter used (ArbSys, or block.number as a fallback).
rewardAt(maxReward, notBefore, notAfter, block) pureThe reward curve.
eggDigest(Egg) view, domainSeparator() viewWhat a wallet signs.
escrow(address), used(address, uint256)Public state.

Events

Deposited(owner, amount)   Withdrawn(owner, amount)   Cancelled(owner, nonce)
Hatched(owner, nonce, keeper, landedBlock, reward)

Errors

ErrorArguments
TooEarlycurrent, notBefore
TooLatecurrent, notAfter
BadWindownotAfter < notBefore, or the clock could not be read
Usednonce already carried or cancelled
BadSignaturewrong signer, tampered egg, malformed or high-s signature
Insufficienthave, need (escrow)
CallFailedthe call's revert data
Locked, TransferFailedreentrancy lock, ETH send failed

Safety properties

  • Effects before interactions: the nonce is burned and the escrow debited before the call runs.
  • A reentrancy lock covers hatch and withdraw. A keeper that tries to hatch again from its payment callback is refused (tested).
  • Plain ETH sent to the contract is refused, so no money can arrive without an owner.