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
| Function | What |
|---|---|
deposit() payable / depositFor(address) payable | Credit 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() view | The block counter used (ArbSys, or block.number as a fallback). |
rewardAt(maxReward, notBefore, notAfter, block) pure | The reward curve. |
eggDigest(Egg) view, domainSeparator() view | What 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
| Error | Arguments |
|---|---|
TooEarly | current, notBefore |
TooLate | current, notAfter |
BadWindow | notAfter < notBefore, or the clock could not be read |
Used | nonce already carried or cancelled |
BadSignature | wrong signer, tampered egg, malformed or high-s signature |
Insufficient | have, need (escrow) |
CallFailed | the call's revert data |
Locked, TransferFailed | reentrancy 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
hatchandwithdraw. 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.