Artifacts
DISCLAIMER // NFA // DYOR
This analysis is based on observations of the contract behavior. We are not smart contract security experts. This document aims to explain what the contract appears to do based on the code. It should not be considered a comprehensive security audit or financial advice. Always verify critical information independently and consult with blockchain security professionals for important decisions.
⊙ generated by robots | curated by humans
| METADATA | |
|---|---|
| Contract Address | 0xc4eD7EA2...F8cB0A (etherscan) |
| Network | Ethereum Mainnet |
| Analysis Date | 2026-11-27 |
Runtime Bytecode
The deployed implementation bytecode, 9,277 bytes. The two immutables are embedded in it: factory 0x00D19609...6d7f8E (etherscan) and self 0xc4eD7EA2...F8cB0A (etherscan). The same bytes are at the same address on Base (basescan).
Source: Etherscan - Contract Code
Command:
Artifact:
0x60806040526003361161009d575b3615610017575f80fd5b6001600160a01b037f000000000000000000000000c4ed7ea21b8cc334f08945b4d0c182e0aff8cb0a163014610075576040513481527f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f8852587460203392a2005b7f82b42900000000000000000000000000000000000000000000000000000000005f5260045ffd5b5f3560e01c80630906e6471461131a57806310348665146112b95780631312690214611265578063137d29d9146112485780631d29bd5a1461119057806321c0b34214611074578063228250c91461104a5780632348dd181461102f57806337558af514610cd857806348b7504414610ba757806363453ae114610a025780636a42b8f8146109dd5780637284e416146109a257806379ba5097146109325780638868f490146108f15780638da5cb5b146108cc57806390c3f38f146107a85780639711715a146104e9578063affed0e0146104c4578063c4d252f5146103db578063cb313c171461025e578063da9425e214610226578063e30c397814610200578063ea70b4af146101e35763f2fde38b0361000d57346101df5760203660031901126101df576101cd61151c565b303303610075576101dd90611a7c565b005b5f80fd5b346101df575f3660031901126101df576020600454604051908152f35b346101df575f3660031901126101df5760206001600160a01b0360015416604051908152f35b346101df5760203660031901126101df576001600160a01b0361024761151c565b165f526007602052602060405f2054604051908152f35b346101df5760403660031901126101df5760043567ffffffffffffffff81116101df5761028f90369060040161155b565b610297611548565b60ff5f5c166103b3576040516102c5816102b760208201948688876119be565b03601f19810183528261176e565b51902090815f52600660205260405f205492831580156103aa575b61037e5762127500840180851161036a57421161033e579061031891835f5260066020525f604081205561031384612362565b6120ab565b7f76b127dd1235a20820e8a643d0e4be3984ad16c7e748bfd0fdef7325bf98a6e55f80a2005b837ff80dbaea000000000000000000000000000000000000000000000000000000005f5260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b837f5a997526000000000000000000000000000000000000000000000000000000005f5260045260245ffd5b508342106102e0565b7f0f2e5b6c000000000000000000000000000000000000000000000000000000005f5260045ffd5b346101df5760203660031901126101df57600435805f52600660205260405f20546001600160a01b035f5416331415806104a6575b61047e571561045657805f5260066020525f604081205561043081612362565b7fbaa1eb22f2a492ba1a5fea61b8df4d27c6c8b5f3971e63bb58fa14ff72eedb705f80a2005b7f5c52a868000000000000000000000000000000000000000000000000000000005f5260045ffd5b7f30cd7471000000000000000000000000000000000000000000000000000000005f5260045ffd5b50801580610410575062127500810180821161036a57421115610410565b346101df575f3660031901126101df57602063ffffffff5f5460c01c16604051908152f35b346101df575f3660031901126101df57606060a060405161050981611752565b5f81525f60208201525f6040820152828082015282608082015201525f546040519061053482611752565b6001600160a01b03811682526020820163ffffffff8260a01c16815263ffffffff604084019260c01c1682526040516105778161057081611616565b038261176e565b60608401908152610586611873565b92608085019384526004549261059b8461185b565b936105a9604051958661176e565b8085526020850160045f527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5f915b838310610762576001600160a01b038a8a8a61062e8b63ffffffff8c818d60a08901968752604051998a9960208b52511660208a015251166040880152511660608601525160c0608086015260e08501906115ba565b915191601f198482030160a0850152825180825260208201916020808360051b8301019501925f915b8383106106e45750505050505190601f198382030160c0840152815180825260208201916020808360051b8301019401925f915b8383106106985786860387f35b9193955091936020806106d2600193601f19868203018752606060408b5180518452858101518685015201519181604082015201906115ba565b9701930193019092869594929361068b565b9193965091939460208061074f600193601f198682030187528a51906001600160a01b0382511681526bffffffffffffffffffffffff848301511684820152606061073e60408401516080604085015260808401906115ba565b9201519060608184039101526115ba565b9801930193019092879695949293610657565b6003602060019260405161077581611736565b855481528486015483820152604051610795816105708160028b016116b5565b60408201528152019201920191906105d8565b346101df5760203660031901126101df5760043567ffffffffffffffff81116101df576107d990369060040161155b565b3033036100755767ffffffffffffffff81116108b857610803816107fe6002546115de565b6117ab565b5f601f8211600114610840578190610830935f92610835575b50508160011b915f199060031b1c19161790565b600255005b01359050838061081c565b601f198216927f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace915f5b8581106108a057508360019510610887575b505050811b01600255005b01355f19600384901b60f8161c1916905582808061087c565b9092602060018192868601358155019401910161086a565b634e487b7160e01b5f52604160045260245ffd5b346101df575f3660031901126101df5760206001600160a01b035f5416604051908152f35b346101df5760203660031901126101df5760043567ffffffffffffffff81116101df57610922903690600401611589565b303303610075576101dd91611bcf565b346101df575f3660031901126101df576001546001600160a01b0381163303610075576001600160a01b0319905f54336001600160a01b0382167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3821633175f55166001556101dd61221a565b346101df575f3660031901126101df576109d96040516109c58161057081611616565b6040519182916020835260208301906115ba565b0390f35b346101df575f3660031901126101df57602063ffffffff5f5460a01c16604051908152f35b346101df5760203660031901126101df57610a1b61151c565b60ff5f5c166103b357600160ff195f5c16175f5d610a38816120dc565b90610a5a6001600160a01b03821692835f52600760205260405f205490611946565b908115610456576003545f91825b828410610aa557857fb649c98f58055c520df0dcb5709eff2e931217ff2fb1e21376130d31bbb1c0af602087604051908152a260ff195f5c165f5d005b610aae84611a20565b50936001810180821161036a578403610b765781876001600160a01b03610ae1610ada6001968b611946565b80946119e3565b97541691610af0818488612040565b5015610b01575b5050500192610a68565b60207f393ce2c0bfa95c5e6f8a6a5fa26f9c0bc5fdc639dbbcc4483deabe68055c9eea91835f526008825260405f206001600160a01b0386165f52825260405f20610b4d8282546119e3565b9055835f526007825260405f20610b658282546119e3565b9055604051908152a3878781610af7565b845460a01c918683029280840488149015171561036a57876001600160a01b03610ae16127106001960480946119e3565b346101df5760403660031901126101df57610bc061151c565b610bc8611532565b60ff5f5c166103b357600160ff195f5c16175f5d6001600160a01b03821690815f52600860205260405f206001600160a01b0382165f5260205260405f2054928315610456578382610c5392855f52600860205260405f206001600160a01b0383165f526020525f6040812055855f52600760205260405f20610c4c848254611946565b9055611f92565b9015610c99575060206001600160a01b037f2d87480f50083e2b2759522a8fdda59802650a8055e609a7772cf70c07748f52926040519586521693a360ff195f5c165f5d005b82602082511115610cad5750602081519101fd5b7fca0b64e5000000000000000000000000000000000000000000000000000000005f5260045260245ffd5b346101df5760203660031901126101df5760043567ffffffffffffffff81116101df57610d0990369060040161155b565b9060ff5f5c166103b3575f54906001600160a01b038216330361047e5763ffffffff8260c01c1663ffffffff811461036a57600101917fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff7bffffffff0000000000000000000000000000000000000000000000008460c01b1691161791825f5563ffffffff6040516020810190610da6816102b7868a89876119be565b5190209360a01c1680610e2757509281837fbdef012f70eb3f9cb205f1123e2f1cc1d8aae8c9b91a562c660bb80e4eab3136610df994602097610df186604051938493429085611a57565b0390a26120ab565b807f76b127dd1235a20820e8a643d0e4be3984ad16c7e748bfd0fdef7325bf98a6e55f80a25b604051908152f35b610e3490949194426119e3565b835f5260066020528060405f20556004546001810180911161036a57845f52600560205260405f205560405194610e6a86611736565b8486526020860195828752610e7e84611953565b96610e8c604051988961176e565b84885236858701116101df57848660208a01375f6020868a01015260408201978852600454680100000000000000008110156108b857806001610ed292016004556119f0565b91909161101c576002925182555160018201550195519283519667ffffffffffffffff88116108b857878795610f1460209a610f0e85546115de565b85611817565b8990601f8311600114610f8c57827fbdef012f70eb3f9cb205f1123e2f1cc1d8aae8c9b91a562c660bb80e4eab3136989993610f79969593610f6a935f92610f815750508160011b915f199060031b1c19161790565b90555b60405194859485611a57565b0390a2610e1f565b015190508d8061081c565b97929190601f19821698835f52815f20995f5b8181106110025750996001928492610f79989796957fbdef012f70eb3f9cb205f1123e2f1cc1d8aae8c9b91a562c660bb80e4eab31369c9d10610fea575b505050811b019055610f6d565b01515f1960f88460031b161c191690558c8080610fdd565b838301518c556001909b019a8c9a50928d01928d01610f9f565b634e487b7160e01b5f525f60045260245ffd5b346101df575f3660031901126101df576020604051606b8152f35b346101df5760203660031901126101df576004355f526006602052602060405f2054604051908152f35b346101df5760403660031901126101df5761108d61151c565b611095611532565b9060ff5f5c166103b357600160ff195f5c16175f5d6001600160a01b03811690815f52600860205260405f206001600160a01b0333165f5260205260405f205490811561045657825f52600860205260405f206001600160a01b0333165f526020525f6040812055825f52600760205260405f20611114838254611946565b9055818484611181575f809350809281925af161112f61196f565b905b15610c995750604080516001600160a01b03949094168452602084019190915233927f913c992353dc81b7a8ba31496c484e9b6306bd2f6c509a649a38fdf5e1c953b29190a360ff195f5c165f5d005b61118a92611f92565b90611131565b346101df575f3660031901126101df576111a8611873565b6040518091602082016020835281518091526040830190602060408260051b8601019301915f905b8282106111df57505050500390f35b919360019193955060206112388192603f198a82030186528851906001600160a01b0382511681526bffffffffffffffffffffffff848301511684820152606061073e60408401516080604085015260808401906115ba565b96019201920185949391926111d0565b346101df575f3660031901126101df576020604051621275008152f35b346101df5760403660031901126101df5761127e61151c565b6001600160a01b0361128e611532565b91165f5260086020526001600160a01b0360405f2091165f52602052602060405f2054604051908152f35b346101df5760203660031901126101df5760043563ffffffff811681036101df57303303610075577fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff63ffffffff60a01b5f549260a01b169116175f555f80f35b60803660031901126101df5761132e61151c565b611336611548565b9060443567ffffffffffffffff81116101df5761135790369060040161155b565b929060643567ffffffffffffffff81116101df57611379903690600401611589565b9390926001600160a01b037f00000000000000000000000000d19609f2349d4160d2babaf46b0cd1ec6d7f8e163314801590611511575b610075577fffffffffffffffff0000000000000000000000000000000000000000000000006001600160a01b0363ffffffff60a01b5f549360a01b169316911617175f5567ffffffffffffffff84116108b857611412846107fe6002546115de565b5f90601f851160011461148b5793806114439261144b965f926114805750508160011b915f199060031b1c19161790565b600255611bcf565b4761145257005b5f7f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f88525874602047604051908152a2005b01359050868061081c565b601f1985169160025f527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace925f5b8181106114f9575091600193918761144b9894106114e0575b505050811b01600255611bcf565b01355f19600384901b60f8161c191690558580806114d2565b919360206001819287870135815501950192016114b9565b5060035415156113b0565b600435906001600160a01b03821682036101df57565b602435906001600160a01b03821682036101df57565b6024359063ffffffff821682036101df57565b9181601f840112156101df5782359167ffffffffffffffff83116101df57602083818601950101116101df57565b9181601f840112156101df5782359167ffffffffffffffff83116101df576020808501948460051b0101116101df57565b805180835260209291819084018484015e5f828201840152601f01601f1916010190565b90600182811c9216801561160c575b60208310146115f857565b634e487b7160e01b5f52602260045260245ffd5b91607f16916115ed565b6002545f9291611625826115de565b80825291600181169081156116995750600114611640575050565b60025f9081529293509091907f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace5b83831061167f575060209250010190565b60018160209294939454838587010152019101919061166e565b9050602093945060ff929192191683830152151560051b010190565b5f92918154916116c4836115de565b808352926001811690811561171957506001146116e057505050565b5f9081526020812093945091925b8383106116ff575060209250010190565b6001816020929493945483858701015201910191906116ee565b915050602093945060ff929192191683830152151560051b010190565b6060810190811067ffffffffffffffff8211176108b857604052565b60c0810190811067ffffffffffffffff8211176108b857604052565b90601f8019910116810190811067ffffffffffffffff8211176108b857604052565b5f5b82811061179e57505050565b5f82820155600101611792565b601f81116117b8575b5050565b8181116117c3575050565b60025f5261180d917f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace91601f820160051c9160201161180f575b601f82910160051c039101611790565b565b5f91506117fd565b91601f821161182557505050565b80821161183157505050565b61180d925f5260205f20916020601f830160051c921061180f57601f82910160051c039101611790565b67ffffffffffffffff81116108b85760051b60200190565b600354906118808261185b565b9161188e604051938461176e565b80835260035f9081527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b9190602085015b8282106118cc5750505050565b6040516080810181811067ffffffffffffffff8211176108b85760019260039260209260405287546001600160a01b038116825260a01c8382015260405161191a8161057081898d016116b5565b6040820152604051611933816105708160028d016116b5565b60608201528152019401910190926118bf565b9190820391821161036a57565b67ffffffffffffffff81116108b857601f01601f191660200190565b3d15611999573d9061198082611953565b9161198e604051938461176e565b82523d5f602084013e565b606090565b908060209392818452848401375f828201840152601f01601f1916010190565b916119dc60209263ffffffff9296959660408652604086019161199e565b9416910152565b9190820180921161036a57565b600454811015611a0c5760045f52600360205f20910201905f90565b634e487b7160e01b5f52603260045260245ffd5b600354811015611a0c5760035f81815291027fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0191565b611a79949263ffffffff6060931682526020820152816040820152019161199e565b90565b6001600160a01b0381168015611ac9575f546001600160a01b031603611abb57506001600160a01b035f5b166001600160a01b03196001541617600155565b6001600160a01b0390611aa7565b50506001600160a01b03195f545f6001600160a01b0382167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3165f556001600160a01b03196001541660015561180d61221a565b611b2a81546115de565b9081611b34575050565b81601f5f9311600114611b45575055565b81835260208320611b6291601f0160051c84190190600101611790565b8082528160208120915555565b356bffffffffffffffffffffffff811681036101df5790565b356001600160a01b03811681036101df5790565b903590601e19813603018212156101df570180359067ffffffffffffffff82116101df576020019181360383136101df57565b91909182158015611f88575b611e8a576003545f60035580611ee3575b505f9291839136819003607e190191835b85811015611ed2578060051b830135848112156101df57830160208101976bffffffffffffffffffffffff611c318a611b6f565b1615908115611eb2575b50611e8a57611c6a611c4c82611b88565b966bffffffffffffffffffffffff611c638b611b6f565b16906119e3565b97600354680100000000000000008110156108b857806001611c8f9201600355611a20565b91909161101c57611cc0906001600160a01b03611cab85611b88565b166001600160a01b0319845416178355611b6f565b6001600160a01b036001600160a01b031983549260a01b16911617815560018101611cee6040840184611b9c565b9067ffffffffffffffff82116108b857611d0c82610f0e85546115de565b5f90601f8311600114611e1f5782611d50959360029593611d41935f92611dac5750508160011b915f199060031b1c19161790565b90555b01916060810190611b9c565b9067ffffffffffffffff82116108b857611d6e82610f0e85546115de565b5f90601f8311600114611db7579180611da09260019695945f92611dac5750508160011b915f199060031b1c19161790565b90555b01959395611bfd565b013590505f8061081c565b601f19831691845f5260205f20925f5b818110611e07575091600196959492918388959310611dee575b505050811b019055611da3565b01355f19600384901b60f8161c191690555f8080611de1565b91936020600181928787013581550195019201611dc7565b601f19831691845f5260205f20925f5b818110611e725750926001928592611d5098966002989610611e59575b505050811b019055611d44565b01355f19600384901b60f8161c191690555f8080611e4c565b91936020600181928787013581550195019201611e2f565b7f40da0647000000000000000000000000000000000000000000000000000000005f5260045ffd5b90506001600160a01b0380611ec684611b88565b9216911611155f611c3b565b5094505050612710915003611e8a57565b8060030290600382040361036a5760035f525f5b818110611f045750611bec565b805f6003927fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0155611f577fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85c8201611b20565b611f827fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85d8201611b20565b01611ef7565b50606b8311611bdb565b5f929183926001600160a01b0383161561202d5760405163a9059cbb60e01b602082019081526001600160a01b03909316602482015260448101919091528390611fdf81606481016102b7565b51925af1611feb61196f565b9080611ff45791565b5080518015908115612004575091565b6020811015915081612014575091565b60208381019250908301839003126101df575160011491565b8392508291620186a0f190611a7961196f565b929190925f9160606001600160a01b03831615612097575093826102b7611fdf829697604051928391602083019663a9059cbb60e01b885260248401602090939291936001600160a01b0360408201951681520152565b945f935083925082918291620186a0f19190565b5f9182918160405192839283378101838152039082305af16120cb61196f565b90156120d45750565b602081519101fd5b6001600160a01b03811615612158575f809160405160208101907f70a082310000000000000000000000000000000000000000000000000000000082523060248201526024815261212e60448261176e565b51915afa61213a61196f565b90156120d457602081519181808201938492010103126101df575190565b504790565b6004548015612206575f1901600454811015611a0c5760045f52600381027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b016002905f81555f6001820155016121b481546115de565b90816121c2575b5050600455565b81601f5f93116001146121d95750555b5f806121bb565b818352602083206121f691601f0160051c84190190600101611790565b80825281602081209155556121d2565b634e487b7160e01b5f52603160045260245ffd5b6004545b801561227f575f1901612230816119f0565b5054805f5260066020525f6040812055805f5260056020525f604081205561225661215d565b7fbaa1eb22f2a492ba1a5fea61b8df4d27c6c8b5f3971e63bb58fa14ff72eedb705f80a261221e565b50565b91909182811461235d5761229683546115de565b67ffffffffffffffff81116108b8576122b9816122b384546115de565b84611817565b5f93601f82116001146122f7576122e892939482915f926122ec5750508160011b915f199060031b1c19161790565b9055565b015490505f8061081c565b601f198216905f5260205f2094835f5260205f20915f5b8181106123455750958360019596971061232d575b505050811b019055565b01545f1960f88460031b161c191690555f8080612323565b9192600180602092868b01548155019401920161230e565b509050565b805f52600560205260405f205480156117b457600454808203612399575b505061238a61215d565b5f5260056020525f6040812055565b5f19810190811161036a576123ad906119f0565b505f19820182811161036a576123c2906119f0565b61101c578181036123e3575b50545f52600560205260405f20555f80612380565b61240190825481556001830154600182015560028084019101612282565b5f6123ce56fea2646970667358221220163af7be752543ef1a6351422f3c57b463e56ab45a5f4bc1d57da2d3c2813b9964736f6c63430008260033
Creation Bytecode
The implementation has no creation transaction of its own. The factory's constructor ran this 9,328-byte init code with CREATE2 at salt 0, inside the transaction 0x5cfd85b7...4a8f50 (tx) that deployed the factory. The constructor takes no arguments; it records msg.sender and address(this) as the two immutables.
Source: Etherscan - Contract Creation, via the getcontractcreation endpoint
Command:
curl -s "https://api.etherscan.io/v2/api?chainid=1&module=contract&action=getcontractcreation&contractaddresses=0xc4eD7EA21B8CC334F08945B4D0c182e0afF8cB0A&apikey=$ETHERSCAN_API_KEY"
Artifact:
0x60c08060405234602e57336080523060a05261243d9081610033823960805181611386015260a0518160210152f35b5f80fdfe60806040526003361161009d575b3615610017575f80fd5b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163014610075576040513481527f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f8852587460203392a2005b7f82b42900000000000000000000000000000000000000000000000000000000005f5260045ffd5b5f3560e01c80630906e6471461131a57806310348665146112b95780631312690214611265578063137d29d9146112485780631d29bd5a1461119057806321c0b34214611074578063228250c91461104a5780632348dd181461102f57806337558af514610cd857806348b7504414610ba757806363453ae114610a025780636a42b8f8146109dd5780637284e416146109a257806379ba5097146109325780638868f490146108f15780638da5cb5b146108cc57806390c3f38f146107a85780639711715a146104e9578063affed0e0146104c4578063c4d252f5146103db578063cb313c171461025e578063da9425e214610226578063e30c397814610200578063ea70b4af146101e35763f2fde38b0361000d57346101df5760203660031901126101df576101cd61151c565b303303610075576101dd90611a7c565b005b5f80fd5b346101df575f3660031901126101df576020600454604051908152f35b346101df575f3660031901126101df5760206001600160a01b0360015416604051908152f35b346101df5760203660031901126101df576001600160a01b0361024761151c565b165f526007602052602060405f2054604051908152f35b346101df5760403660031901126101df5760043567ffffffffffffffff81116101df5761028f90369060040161155b565b610297611548565b60ff5f5c166103b3576040516102c5816102b760208201948688876119be565b03601f19810183528261176e565b51902090815f52600660205260405f205492831580156103aa575b61037e5762127500840180851161036a57421161033e579061031891835f5260066020525f604081205561031384612362565b6120ab565b7f76b127dd1235a20820e8a643d0e4be3984ad16c7e748bfd0fdef7325bf98a6e55f80a2005b837ff80dbaea000000000000000000000000000000000000000000000000000000005f5260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b837f5a997526000000000000000000000000000000000000000000000000000000005f5260045260245ffd5b508342106102e0565b7f0f2e5b6c000000000000000000000000000000000000000000000000000000005f5260045ffd5b346101df5760203660031901126101df57600435805f52600660205260405f20546001600160a01b035f5416331415806104a6575b61047e571561045657805f5260066020525f604081205561043081612362565b7fbaa1eb22f2a492ba1a5fea61b8df4d27c6c8b5f3971e63bb58fa14ff72eedb705f80a2005b7f5c52a868000000000000000000000000000000000000000000000000000000005f5260045ffd5b7f30cd7471000000000000000000000000000000000000000000000000000000005f5260045ffd5b50801580610410575062127500810180821161036a57421115610410565b346101df575f3660031901126101df57602063ffffffff5f5460c01c16604051908152f35b346101df575f3660031901126101df57606060a060405161050981611752565b5f81525f60208201525f6040820152828082015282608082015201525f546040519061053482611752565b6001600160a01b03811682526020820163ffffffff8260a01c16815263ffffffff604084019260c01c1682526040516105778161057081611616565b038261176e565b60608401908152610586611873565b92608085019384526004549261059b8461185b565b936105a9604051958661176e565b8085526020850160045f527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5f915b838310610762576001600160a01b038a8a8a61062e8b63ffffffff8c818d60a08901968752604051998a9960208b52511660208a015251166040880152511660608601525160c0608086015260e08501906115ba565b915191601f198482030160a0850152825180825260208201916020808360051b8301019501925f915b8383106106e45750505050505190601f198382030160c0840152815180825260208201916020808360051b8301019401925f915b8383106106985786860387f35b9193955091936020806106d2600193601f19868203018752606060408b5180518452858101518685015201519181604082015201906115ba565b9701930193019092869594929361068b565b9193965091939460208061074f600193601f198682030187528a51906001600160a01b0382511681526bffffffffffffffffffffffff848301511684820152606061073e60408401516080604085015260808401906115ba565b9201519060608184039101526115ba565b9801930193019092879695949293610657565b6003602060019260405161077581611736565b855481528486015483820152604051610795816105708160028b016116b5565b60408201528152019201920191906105d8565b346101df5760203660031901126101df5760043567ffffffffffffffff81116101df576107d990369060040161155b565b3033036100755767ffffffffffffffff81116108b857610803816107fe6002546115de565b6117ab565b5f601f8211600114610840578190610830935f92610835575b50508160011b915f199060031b1c19161790565b600255005b01359050838061081c565b601f198216927f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace915f5b8581106108a057508360019510610887575b505050811b01600255005b01355f19600384901b60f8161c1916905582808061087c565b9092602060018192868601358155019401910161086a565b634e487b7160e01b5f52604160045260245ffd5b346101df575f3660031901126101df5760206001600160a01b035f5416604051908152f35b346101df5760203660031901126101df5760043567ffffffffffffffff81116101df57610922903690600401611589565b303303610075576101dd91611bcf565b346101df575f3660031901126101df576001546001600160a01b0381163303610075576001600160a01b0319905f54336001600160a01b0382167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3821633175f55166001556101dd61221a565b346101df575f3660031901126101df576109d96040516109c58161057081611616565b6040519182916020835260208301906115ba565b0390f35b346101df575f3660031901126101df57602063ffffffff5f5460a01c16604051908152f35b346101df5760203660031901126101df57610a1b61151c565b60ff5f5c166103b357600160ff195f5c16175f5d610a38816120dc565b90610a5a6001600160a01b03821692835f52600760205260405f205490611946565b908115610456576003545f91825b828410610aa557857fb649c98f58055c520df0dcb5709eff2e931217ff2fb1e21376130d31bbb1c0af602087604051908152a260ff195f5c165f5d005b610aae84611a20565b50936001810180821161036a578403610b765781876001600160a01b03610ae1610ada6001968b611946565b80946119e3565b97541691610af0818488612040565b5015610b01575b5050500192610a68565b60207f393ce2c0bfa95c5e6f8a6a5fa26f9c0bc5fdc639dbbcc4483deabe68055c9eea91835f526008825260405f206001600160a01b0386165f52825260405f20610b4d8282546119e3565b9055835f526007825260405f20610b658282546119e3565b9055604051908152a3878781610af7565b845460a01c918683029280840488149015171561036a57876001600160a01b03610ae16127106001960480946119e3565b346101df5760403660031901126101df57610bc061151c565b610bc8611532565b60ff5f5c166103b357600160ff195f5c16175f5d6001600160a01b03821690815f52600860205260405f206001600160a01b0382165f5260205260405f2054928315610456578382610c5392855f52600860205260405f206001600160a01b0383165f526020525f6040812055855f52600760205260405f20610c4c848254611946565b9055611f92565b9015610c99575060206001600160a01b037f2d87480f50083e2b2759522a8fdda59802650a8055e609a7772cf70c07748f52926040519586521693a360ff195f5c165f5d005b82602082511115610cad5750602081519101fd5b7fca0b64e5000000000000000000000000000000000000000000000000000000005f5260045260245ffd5b346101df5760203660031901126101df5760043567ffffffffffffffff81116101df57610d0990369060040161155b565b9060ff5f5c166103b3575f54906001600160a01b038216330361047e5763ffffffff8260c01c1663ffffffff811461036a57600101917fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff7bffffffff0000000000000000000000000000000000000000000000008460c01b1691161791825f5563ffffffff6040516020810190610da6816102b7868a89876119be565b5190209360a01c1680610e2757509281837fbdef012f70eb3f9cb205f1123e2f1cc1d8aae8c9b91a562c660bb80e4eab3136610df994602097610df186604051938493429085611a57565b0390a26120ab565b807f76b127dd1235a20820e8a643d0e4be3984ad16c7e748bfd0fdef7325bf98a6e55f80a25b604051908152f35b610e3490949194426119e3565b835f5260066020528060405f20556004546001810180911161036a57845f52600560205260405f205560405194610e6a86611736565b8486526020860195828752610e7e84611953565b96610e8c604051988961176e565b84885236858701116101df57848660208a01375f6020868a01015260408201978852600454680100000000000000008110156108b857806001610ed292016004556119f0565b91909161101c576002925182555160018201550195519283519667ffffffffffffffff88116108b857878795610f1460209a610f0e85546115de565b85611817565b8990601f8311600114610f8c57827fbdef012f70eb3f9cb205f1123e2f1cc1d8aae8c9b91a562c660bb80e4eab3136989993610f79969593610f6a935f92610f815750508160011b915f199060031b1c19161790565b90555b60405194859485611a57565b0390a2610e1f565b015190508d8061081c565b97929190601f19821698835f52815f20995f5b8181106110025750996001928492610f79989796957fbdef012f70eb3f9cb205f1123e2f1cc1d8aae8c9b91a562c660bb80e4eab31369c9d10610fea575b505050811b019055610f6d565b01515f1960f88460031b161c191690558c8080610fdd565b838301518c556001909b019a8c9a50928d01928d01610f9f565b634e487b7160e01b5f525f60045260245ffd5b346101df575f3660031901126101df576020604051606b8152f35b346101df5760203660031901126101df576004355f526006602052602060405f2054604051908152f35b346101df5760403660031901126101df5761108d61151c565b611095611532565b9060ff5f5c166103b357600160ff195f5c16175f5d6001600160a01b03811690815f52600860205260405f206001600160a01b0333165f5260205260405f205490811561045657825f52600860205260405f206001600160a01b0333165f526020525f6040812055825f52600760205260405f20611114838254611946565b9055818484611181575f809350809281925af161112f61196f565b905b15610c995750604080516001600160a01b03949094168452602084019190915233927f913c992353dc81b7a8ba31496c484e9b6306bd2f6c509a649a38fdf5e1c953b29190a360ff195f5c165f5d005b61118a92611f92565b90611131565b346101df575f3660031901126101df576111a8611873565b6040518091602082016020835281518091526040830190602060408260051b8601019301915f905b8282106111df57505050500390f35b919360019193955060206112388192603f198a82030186528851906001600160a01b0382511681526bffffffffffffffffffffffff848301511684820152606061073e60408401516080604085015260808401906115ba565b96019201920185949391926111d0565b346101df575f3660031901126101df576020604051621275008152f35b346101df5760403660031901126101df5761127e61151c565b6001600160a01b0361128e611532565b91165f5260086020526001600160a01b0360405f2091165f52602052602060405f2054604051908152f35b346101df5760203660031901126101df5760043563ffffffff811681036101df57303303610075577fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff63ffffffff60a01b5f549260a01b169116175f555f80f35b60803660031901126101df5761132e61151c565b611336611548565b9060443567ffffffffffffffff81116101df5761135790369060040161155b565b929060643567ffffffffffffffff81116101df57611379903690600401611589565b9390926001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163314801590611511575b610075577fffffffffffffffff0000000000000000000000000000000000000000000000006001600160a01b0363ffffffff60a01b5f549360a01b169316911617175f5567ffffffffffffffff84116108b857611412846107fe6002546115de565b5f90601f851160011461148b5793806114439261144b965f926114805750508160011b915f199060031b1c19161790565b600255611bcf565b4761145257005b5f7f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f88525874602047604051908152a2005b01359050868061081c565b601f1985169160025f527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace925f5b8181106114f9575091600193918761144b9894106114e0575b505050811b01600255611bcf565b01355f19600384901b60f8161c191690558580806114d2565b919360206001819287870135815501950192016114b9565b5060035415156113b0565b600435906001600160a01b03821682036101df57565b602435906001600160a01b03821682036101df57565b6024359063ffffffff821682036101df57565b9181601f840112156101df5782359167ffffffffffffffff83116101df57602083818601950101116101df57565b9181601f840112156101df5782359167ffffffffffffffff83116101df576020808501948460051b0101116101df57565b805180835260209291819084018484015e5f828201840152601f01601f1916010190565b90600182811c9216801561160c575b60208310146115f857565b634e487b7160e01b5f52602260045260245ffd5b91607f16916115ed565b6002545f9291611625826115de565b80825291600181169081156116995750600114611640575050565b60025f9081529293509091907f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace5b83831061167f575060209250010190565b60018160209294939454838587010152019101919061166e565b9050602093945060ff929192191683830152151560051b010190565b5f92918154916116c4836115de565b808352926001811690811561171957506001146116e057505050565b5f9081526020812093945091925b8383106116ff575060209250010190565b6001816020929493945483858701015201910191906116ee565b915050602093945060ff929192191683830152151560051b010190565b6060810190811067ffffffffffffffff8211176108b857604052565b60c0810190811067ffffffffffffffff8211176108b857604052565b90601f8019910116810190811067ffffffffffffffff8211176108b857604052565b5f5b82811061179e57505050565b5f82820155600101611792565b601f81116117b8575b5050565b8181116117c3575050565b60025f5261180d917f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace91601f820160051c9160201161180f575b601f82910160051c039101611790565b565b5f91506117fd565b91601f821161182557505050565b80821161183157505050565b61180d925f5260205f20916020601f830160051c921061180f57601f82910160051c039101611790565b67ffffffffffffffff81116108b85760051b60200190565b600354906118808261185b565b9161188e604051938461176e565b80835260035f9081527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b9190602085015b8282106118cc5750505050565b6040516080810181811067ffffffffffffffff8211176108b85760019260039260209260405287546001600160a01b038116825260a01c8382015260405161191a8161057081898d016116b5565b6040820152604051611933816105708160028d016116b5565b60608201528152019401910190926118bf565b9190820391821161036a57565b67ffffffffffffffff81116108b857601f01601f191660200190565b3d15611999573d9061198082611953565b9161198e604051938461176e565b82523d5f602084013e565b606090565b908060209392818452848401375f828201840152601f01601f1916010190565b916119dc60209263ffffffff9296959660408652604086019161199e565b9416910152565b9190820180921161036a57565b600454811015611a0c5760045f52600360205f20910201905f90565b634e487b7160e01b5f52603260045260245ffd5b600354811015611a0c5760035f81815291027fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0191565b611a79949263ffffffff6060931682526020820152816040820152019161199e565b90565b6001600160a01b0381168015611ac9575f546001600160a01b031603611abb57506001600160a01b035f5b166001600160a01b03196001541617600155565b6001600160a01b0390611aa7565b50506001600160a01b03195f545f6001600160a01b0382167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3165f556001600160a01b03196001541660015561180d61221a565b611b2a81546115de565b9081611b34575050565b81601f5f9311600114611b45575055565b81835260208320611b6291601f0160051c84190190600101611790565b8082528160208120915555565b356bffffffffffffffffffffffff811681036101df5790565b356001600160a01b03811681036101df5790565b903590601e19813603018212156101df570180359067ffffffffffffffff82116101df576020019181360383136101df57565b91909182158015611f88575b611e8a576003545f60035580611ee3575b505f9291839136819003607e190191835b85811015611ed2578060051b830135848112156101df57830160208101976bffffffffffffffffffffffff611c318a611b6f565b1615908115611eb2575b50611e8a57611c6a611c4c82611b88565b966bffffffffffffffffffffffff611c638b611b6f565b16906119e3565b97600354680100000000000000008110156108b857806001611c8f9201600355611a20565b91909161101c57611cc0906001600160a01b03611cab85611b88565b166001600160a01b0319845416178355611b6f565b6001600160a01b036001600160a01b031983549260a01b16911617815560018101611cee6040840184611b9c565b9067ffffffffffffffff82116108b857611d0c82610f0e85546115de565b5f90601f8311600114611e1f5782611d50959360029593611d41935f92611dac5750508160011b915f199060031b1c19161790565b90555b01916060810190611b9c565b9067ffffffffffffffff82116108b857611d6e82610f0e85546115de565b5f90601f8311600114611db7579180611da09260019695945f92611dac5750508160011b915f199060031b1c19161790565b90555b01959395611bfd565b013590505f8061081c565b601f19831691845f5260205f20925f5b818110611e07575091600196959492918388959310611dee575b505050811b019055611da3565b01355f19600384901b60f8161c191690555f8080611de1565b91936020600181928787013581550195019201611dc7565b601f19831691845f5260205f20925f5b818110611e725750926001928592611d5098966002989610611e59575b505050811b019055611d44565b01355f19600384901b60f8161c191690555f8080611e4c565b91936020600181928787013581550195019201611e2f565b7f40da0647000000000000000000000000000000000000000000000000000000005f5260045ffd5b90506001600160a01b0380611ec684611b88565b9216911611155f611c3b565b5094505050612710915003611e8a57565b8060030290600382040361036a5760035f525f5b818110611f045750611bec565b805f6003927fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0155611f577fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85c8201611b20565b611f827fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85d8201611b20565b01611ef7565b50606b8311611bdb565b5f929183926001600160a01b0383161561202d5760405163a9059cbb60e01b602082019081526001600160a01b03909316602482015260448101919091528390611fdf81606481016102b7565b51925af1611feb61196f565b9080611ff45791565b5080518015908115612004575091565b6020811015915081612014575091565b60208381019250908301839003126101df575160011491565b8392508291620186a0f190611a7961196f565b929190925f9160606001600160a01b03831615612097575093826102b7611fdf829697604051928391602083019663a9059cbb60e01b885260248401602090939291936001600160a01b0360408201951681520152565b945f935083925082918291620186a0f19190565b5f9182918160405192839283378101838152039082305af16120cb61196f565b90156120d45750565b602081519101fd5b6001600160a01b03811615612158575f809160405160208101907f70a082310000000000000000000000000000000000000000000000000000000082523060248201526024815261212e60448261176e565b51915afa61213a61196f565b90156120d457602081519181808201938492010103126101df575190565b504790565b6004548015612206575f1901600454811015611a0c5760045f52600381027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b016002905f81555f6001820155016121b481546115de565b90816121c2575b5050600455565b81601f5f93116001146121d95750555b5f806121bb565b818352602083206121f691601f0160051c84190190600101611790565b80825281602081209155556121d2565b634e487b7160e01b5f52603160045260245ffd5b6004545b801561227f575f1901612230816119f0565b5054805f5260066020525f6040812055805f5260056020525f604081205561225661215d565b7fbaa1eb22f2a492ba1a5fea61b8df4d27c6c8b5f3971e63bb58fa14ff72eedb705f80a261221e565b50565b91909182811461235d5761229683546115de565b67ffffffffffffffff81116108b8576122b9816122b384546115de565b84611817565b5f93601f82116001146122f7576122e892939482915f926122ec5750508160011b915f199060031b1c19161790565b9055565b015490505f8061081c565b601f198216905f5260205f2094835f5260205f20915f5b8181106123455750958360019596971061232d575b505050811b019055565b01545f1960f88460031b161c191690555f8080612323565b9192600180602092868b01548155019401920161230e565b509050565b805f52600560205260405f205480156117b457600454808203612399575b505061238a61215d565b5f5260056020525f6040812055565b5f19810190811161036a576123ad906119f0565b505f19820182811161036a576123c2906119f0565b61101c578181036123e3575b50545f52600560205260405f20555f80612380565b61240190825481556001830154600182015560028084019101612282565b5f6123ce56fea2646970667358221220163af7be752543ef1a6351422f3c57b463e56ab45a5f4bc1d57da2d3c2813b9964736f6c63430008260033
Verified Source Code
Source code verified on Etherscan. The verified file src/Distribution.sol contains both Distribution and DistributionFactory; lines 1–426, the Distribution contract, are reproduced here. The factory's part is in the factory artifacts.
Source: Etherscan - Contract Source
Artifact:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
/// @notice A sink that splits what it receives between a fixed table of beneficiaries, escrows the
/// shares it cannot push, and puts every change to itself behind one timelock.
/// @dev Deployed once as an implementation and used through PUSH0 clones. `factory` and `self` live
/// in the implementation's bytecode, so a clone reads the implementation's deployer and the
/// implementation's own address — which is how the implementation rejects ETH while a clone accepts it.
contract Distribution {
struct Beneficiary {
address account;
uint96 bps;
string name;
string note;
}
struct Pending {
bytes32 hash;
uint256 eta;
bytes action;
}
struct Snapshot {
address owner;
uint32 delay;
uint32 nonce;
string description;
Beneficiary[] table;
Pending[] pending;
}
event Received(address indexed from, uint256 amount);
event Distributed(address indexed token, uint256 amount);
event Escrowed(address indexed token, address indexed account, uint256 amount);
event Released(address indexed token, address indexed account, uint256 amount);
event Claimed(address indexed token, address indexed account, address to, uint256 amount);
event Queued(bytes32 indexed hash, uint32 nonce, uint256 eta, bytes action);
event Applied(bytes32 indexed hash);
event Cancelled(bytes32 indexed hash);
/// @dev Ownable2Step's name and shape. Emitted on acceptance and on a renounce: the nomination
/// already rides in `Queued`'s calldata, so without this a log reader sees "B was nominated" and
/// never "B took it" — the one state change in the contract with no trace of its own. A renounce
/// is the other, and it emits `newOwner == address(0)`.
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
error NotOwner();
error BadTable();
error NotReady(uint256 eta);
error NothingToDo();
error Locked();
error Unauthorized();
error ReleaseFailed(address token);
error Expired(uint256 eta);
/// @dev Measured in m03-t01 (`test/PushGas.t.sol`, cold): a Safe v1.4.1 proxy receives in 4,029
/// gas and a multisig.software vault clone in 404, so 100_000 is 23x the larger need and was kept
/// under decision 30.
uint256 private constant PUSH_GAS = 100_000;
uint256 private constant BPS_TOTAL = 10_000;
/// @notice How long after its eta a matured action stays applicable. Past it, `applyQueued`
/// reverts `Expired` and anyone may `cancel` the entry. Compound's Timelock shape: a change nobody
/// applied inside the window lapses instead of waiting as a permanent option held by the public.
uint256 public constant GRACE = 14 days;
/// @dev Measured in m03-t01 (`test/TableCap.t.sol`): a worst-case row, where the recipient burns
/// the whole push cap and then fails, costs 138,917 gas, so 107 rows distribute in 14,896,325 and
/// 108 need 15,035,242. The rule enforced is that a worst-case `distribute` stays under half a
/// 30M block. Those three figures are of the tree t01 measured, `main` at `b055bc3`; re-measure
/// rather than quote them.
uint256 public constant MAX_BENEFICIARIES = 107;
bytes4 private constant TRANSFER = 0xa9059cbb;
bytes4 private constant BALANCE_OF = 0x70a08231;
address public owner;
uint32 public delay;
uint32 public nonce;
/// @dev After `nonce`, not after `owner`: `owner`, `delay` and `nonce` pack into one slot and a
/// 20-byte address cannot join them, so placing it here leaves that slot whole and `propose` and
/// `snapshot` keep their single read of it.
address public pendingOwner;
string public description;
/// @dev Stored in the order given, which table validation forces to be ascending by account.
Beneficiary[] private _table;
Pending[] private _pending;
/// @dev 1-based index into `_pending`; 0 means absent.
mapping(bytes32 => uint256) private _pendingIndex;
/// @notice Queued action hash to the timestamp it becomes applicable.
mapping(bytes32 => uint256) public queued;
/// @notice Token (0 for ETH) to the total this contract holds on behalf of failed pushes.
mapping(address => uint256) public reserved;
/// @notice Token (0 for ETH) to account to the amount escrowed for it.
mapping(address => mapping(address => uint256)) public escrowed;
bool private transient locked;
address private immutable factory;
address private immutable self;
constructor() {
factory = msg.sender;
self = address(this);
}
modifier nonReentrant() {
if (locked) revert Locked();
locked = true;
_;
locked = false;
}
/// @dev Refuses entry while a money path holds the lock; does not take it. A configuration change
/// landing between two rows of `distribute` would pay the rest from a table nobody has seen.
modifier notLocked() {
if (locked) revert Locked();
_;
}
/// @dev The timelock reaches state only through a self-call, so every mutator is `onlySelf`.
modifier onlySelf() {
if (msg.sender != address(this)) revert Unauthorized();
_;
}
/// @notice Initialise a clone. Callable once, by whoever deployed the implementation. Any value
/// present at this point is logged as `Received(address(0), balance)` — the sentinel for "present
/// at init, sender unknown" — which covers both value that rode the `create` and value sent to the
/// counterfactual address before any code existed there. Forced sends after deployment stay
/// unlogged; `docs/REFERENCE.md` says so.
function init(address owner_, uint32 delay_, string calldata description_, Beneficiary[] calldata table_)
external
payable
{
if (msg.sender != factory || _table.length != 0) revert Unauthorized();
owner = owner_;
delay = delay_;
description = description_;
_set(table_);
if (address(this).balance != 0) emit Received(address(0), address(this).balance);
}
/// @dev Must run under a 2,300-gas `transfer` stipend, so it does nothing but the guard and the log.
receive() external payable {
if (address(this) == self) revert Unauthorized();
emit Received(msg.sender, msg.value);
}
/// @notice Split everything not already escrowed between the table, in table order.
/// @param token The ERC-20 to split, or `address(0)` for ETH.
function distribute(address token) external nonReentrant {
uint256 amount = _balance(token) - reserved[token];
if (amount == 0) revert NothingToDo();
uint256 n = _table.length;
uint256 paid;
for (uint256 i; i < n; ++i) {
Beneficiary storage b = _table[i];
// The last row takes the remainder, so the shares always sum to `amount`.
uint256 share = i + 1 == n ? amount - paid : (uint256(b.bps) * amount) / BPS_TOTAL;
paid += share;
address account = b.account;
(bool ok,) = _push(token, account, share, false);
if (!ok) {
escrowed[token][account] += share;
reserved[token] += share;
emit Escrowed(token, account, share);
}
}
emit Distributed(token, amount);
}
/// @notice Retry the escrowed amount for one account. Reverts if the retry fails, leaving the escrow.
function release(address token, address account) external nonReentrant {
uint256 amount = escrowed[token][account];
if (amount == 0) revert NothingToDo();
escrowed[token][account] = 0;
reserved[token] -= amount;
(bool ok, bytes memory data) = _push(token, account, amount, true);
// A word or less is the bare `false` of a non-reverting token, empty revert data, or an
// argument-less custom error: no reason worth bubbling, so name the failure instead
// (decision 24). Anything longer carries its own reason and keeps it.
if (!ok) {
if (data.length <= 32) revert ReleaseFailed(token);
_bubble(data);
}
emit Released(token, account, amount);
}
/// @notice The escrowed account takes its own escrow, to an address it names, with the caller's
/// gas: no `PUSH_GAS` cap, because the beneficiary is paying for its own receive. Only
/// `msg.sender`'s escrow moves, so neither the owner nor anyone else gains a path to funds.
/// @param token The escrowed ERC-20, or `address(0)` for ETH.
/// @param to Where to send it. Not validated: it is the beneficiary's own money.
function claim(address token, address to) external nonReentrant {
uint256 amount = escrowed[token][msg.sender];
if (amount == 0) revert NothingToDo();
escrowed[token][msg.sender] = 0;
reserved[token] -= amount;
bool ok;
bytes memory data;
if (token == address(0)) (ok, data) = to.call{value: amount}("");
else (ok, data) = _push(token, to, amount, true);
// `release`'s failure path (decision 24): a word or less is named, a longer reason bubbles.
if (!ok) {
if (data.length <= 32) revert ReleaseFailed(token);
_bubble(data);
}
emit Claimed(token, msg.sender, to, amount);
}
/// @notice Queue a self-call, or run it now when `delay` is zero. Refused while `distribute` or
/// `release` is running.
/// @param action Calldata for one of this contract's `onlySelf` functions.
function propose(bytes calldata action) external notLocked returns (bytes32 hash) {
if (msg.sender != owner) revert NotOwner();
uint32 n = ++nonce;
hash = keccak256(abi.encode(action, n));
uint32 d = delay;
if (d == 0) {
emit Queued(hash, n, block.timestamp, action);
_selfCall(action);
emit Applied(hash);
} else {
uint256 eta = block.timestamp + d;
queued[hash] = eta;
_pendingIndex[hash] = _pending.length + 1;
_pending.push(Pending({hash: hash, eta: eta, action: action}));
emit Queued(hash, n, eta, action);
}
}
/// @notice Run a queued action once its eta has passed, and only until `GRACE` after it: past that
/// the action has expired, this reverts `Expired`, and anyone may `cancel` the entry. A failing
/// action stays queued for a retry. Refused while `distribute` or `release` is running.
function applyQueued(bytes calldata action, uint32 nonce_) external notLocked {
bytes32 hash = keccak256(abi.encode(action, nonce_));
uint256 eta = queued[hash];
// A timelock is a timestamp comparison; a validator's few seconds of drift is not the threat.
// forge-lint: disable-next-line(block-timestamp)
if (eta == 0 || block.timestamp < eta) revert NotReady(eta);
// forge-lint: disable-next-line(block-timestamp)
if (block.timestamp > eta + GRACE) revert Expired(eta);
delete queued[hash];
_remove(hash);
_selfCall(action);
emit Applied(hash);
}
/// @notice Drop a queued action. Immediate: the delay guards applying, not cancelling. The owner's
/// while the action can still be applied; once it has expired — more than `GRACE` after its eta —
/// anyone may drop it, so a renounced or inattentive owner cannot leave the queue uncleanable.
function cancel(bytes32 hash) external {
uint256 eta = queued[hash];
// Anyone may drop an expired action; everything else stays the owner's. This order matters:
// a non-owner must still see `NotOwner` for an entry that does not exist or has not expired,
// which checking `NothingToDo` first would turn into `NothingToDo`.
// forge-lint: disable-next-line(block-timestamp)
if (msg.sender != owner && (eta == 0 || block.timestamp <= eta + GRACE)) revert NotOwner();
if (eta == 0) revert NothingToDo();
delete queued[hash];
_remove(hash);
emit Cancelled(hash);
}
function setBeneficiaries(Beneficiary[] calldata table_) external onlySelf {
_set(table_);
}
function setDescription(string calldata description_) external onlySelf {
description = description_;
}
function setDelay(uint32 delay_) external onlySelf {
delay = delay_;
}
/// @notice Name the next owner, who must call `acceptOwnership()` before anything changes; until
/// then the current owner keeps every power. `address(0)` renounces at once — nothing can be
/// proposed again, it drops every queued action, and it emits `OwnershipTransferred(owner,
/// address(0))`, so a renounce leaves the same trace a handover does — and drops any pending
/// transfer with it. Naming the current owner withdraws a pending transfer.
function transferOwnership(address owner_) external onlySelf {
if (owner_ == address(0)) {
emit OwnershipTransferred(owner, address(0));
owner = address(0);
pendingOwner = address(0);
_clearQueue();
return;
}
pendingOwner = owner_ == owner ? address(0) : owner_;
}
/// @notice Take ownership after the owner named you with `transferOwnership`, and drops every
/// action the previous owner queued.
function acceptOwnership() external {
if (msg.sender != pendingOwner) revert Unauthorized();
emit OwnershipTransferred(owner, msg.sender);
owner = msg.sender;
pendingOwner = address(0);
_clearQueue();
}
/// @notice Everything a reader needs in one call.
function snapshot() external view returns (Snapshot memory) {
return Snapshot({
owner: owner, delay: delay, nonce: nonce, description: description, table: _table, pending: _pending
});
}
/// @dev Not `table()`: forge reserves the `table` prefix for table tests and fails the suite.
function beneficiaries() external view returns (Beneficiary[] memory) {
return _table;
}
function pendingCount() external view returns (uint256) {
return _pending.length;
}
/// @dev Ascending accounts make duplicates impossible and keep the first row above `address(0)`.
function _set(Beneficiary[] calldata table_) private {
uint256 n = table_.length;
if (n == 0 || n > MAX_BENEFICIARIES) revert BadTable();
delete _table;
uint256 sum;
address prev;
for (uint256 i; i < n; ++i) {
Beneficiary calldata b = table_[i];
if (b.bps == 0 || b.account <= prev) revert BadTable();
prev = b.account;
sum += b.bps;
_table.push(b);
}
if (sum != BPS_TOTAL) revert BadTable();
}
/// @dev Drops every queued action, newest first, emitting `Cancelled` for each so a log reader's
/// pending list empties the way it would have by hand. Runs on a handover and on a renounce:
/// what the previous owner queued was queued under an authority that no longer exists.
function _clearQueue() private {
uint256 n = _pending.length;
while (n > 0) {
bytes32 hash = _pending[--n].hash;
delete queued[hash];
delete _pendingIndex[hash];
_pending.pop();
emit Cancelled(hash);
}
}
/// @dev Swap-and-pop, so `_pending` stays iterable and the surviving order is stable otherwise.
function _remove(bytes32 hash) private {
uint256 i = _pendingIndex[hash];
if (i == 0) return;
uint256 last = _pending.length;
if (i != last) {
Pending storage moved = _pending[last - 1];
_pending[i - 1] = moved;
_pendingIndex[moved.hash] = i;
}
_pending.pop();
delete _pendingIndex[hash];
}
function _selfCall(bytes calldata action) private {
(bool ok, bytes memory data) = address(this).call(action);
if (!ok) _bubble(data);
}
/// @dev A token with no code returns nothing here, which does not decode — so it fails.
function _balance(address token) private view returns (uint256) {
if (token == address(0)) return address(this).balance;
(bool ok, bytes memory data) = token.staticcall(abi.encodeWithSelector(BALANCE_OF, address(this)));
if (!ok) _bubble(data);
return abi.decode(data, (uint256));
}
/// @dev ETH is capped so one hostile recipient cannot burn the whole distribution; an ERC-20 push
/// is bounded by the token. A no-return token (mainnet USDT) counts as success; anything else must
/// answer with a word equal to one, decoded as a `uint256` so hostile return data cannot revert here.
///
/// `keepData` buys the ETH branch's return data. `distribute` passes false and calls with a
/// zero-length output area, so a recipient reverting with megabytes costs it one `RETURNDATASIZE`
/// it never reads instead of the memory to hold them — unbounded copying inside the loop broke the
/// half-block property decision 27 rests on at about eleven hostile rows. `release` passes true,
/// because decision 24 bubbles a reason longer than a word and cannot name one it did not copy.
/// The ERC-20 branch ignores the flag: it needs the return word below, and the token is the one
/// `distribute(token)` was called with, so a hostile token's return data costs only the caller who
/// named it.
function _push(address token, address to, uint256 amount, bool keepData)
private
returns (bool ok, bytes memory data)
{
if (token == address(0)) {
if (keepData) {
(ok, data) = to.call{value: amount, gas: PUSH_GAS}("");
} else {
uint256 gasCap = PUSH_GAS;
assembly ("memory-safe") {
ok := call(gasCap, to, amount, 0, 0, 0, 0)
}
}
return (ok, data);
}
(ok, data) = token.call(abi.encodeWithSelector(TRANSFER, to, amount));
ok = ok && (data.length == 0 || (data.length >= 32 && abi.decode(data, (uint256)) == 1));
}
function _bubble(bytes memory data) private pure {
assembly ("memory-safe") {
revert(add(data, 0x20), mload(data))
}
}
}
Additional Artifacts
ABI
The Application Binary Interface (ABI).
Source: Etherscan getsourcecode, ABI field
Artifact:
[
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "BadTable",
"type": "error"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "eta",
"type": "uint256"
}
],
"name": "Expired",
"type": "error"
},
{
"inputs": [],
"name": "Locked",
"type": "error"
},
{
"inputs": [],
"name": "NotOwner",
"type": "error"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "eta",
"type": "uint256"
}
],
"name": "NotReady",
"type": "error"
},
{
"inputs": [],
"name": "NothingToDo",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "token",
"type": "address"
}
],
"name": "ReleaseFailed",
"type": "error"
},
{
"inputs": [],
"name": "Unauthorized",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "hash",
"type": "bytes32"
}
],
"name": "Applied",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "hash",
"type": "bytes32"
}
],
"name": "Cancelled",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "token",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "Claimed",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "token",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "Distributed",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "token",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "Escrowed",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "hash",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "uint32",
"name": "nonce",
"type": "uint32"
},
{
"indexed": false,
"internalType": "uint256",
"name": "eta",
"type": "uint256"
},
{
"indexed": false,
"internalType": "bytes",
"name": "action",
"type": "bytes"
}
],
"name": "Queued",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "Received",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "token",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "Released",
"type": "event"
},
{
"inputs": [],
"name": "GRACE",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "MAX_BENEFICIARIES",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "acceptOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes",
"name": "action",
"type": "bytes"
},
{
"internalType": "uint32",
"name": "nonce_",
"type": "uint32"
}
],
"name": "applyQueued",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "beneficiaries",
"outputs": [
{
"components": [
{
"internalType": "address",
"name": "account",
"type": "address"
},
{
"internalType": "uint96",
"name": "bps",
"type": "uint96"
},
{
"internalType": "string",
"name": "name",
"type": "string"
},
{
"internalType": "string",
"name": "note",
"type": "string"
}
],
"internalType": "struct Distribution.Beneficiary[]",
"name": "",
"type": "tuple[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "hash",
"type": "bytes32"
}
],
"name": "cancel",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
}
],
"name": "claim",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "delay",
"outputs": [
{
"internalType": "uint32",
"name": "",
"type": "uint32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "description",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "token",
"type": "address"
}
],
"name": "distribute",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "escrowed",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner_",
"type": "address"
},
{
"internalType": "uint32",
"name": "delay_",
"type": "uint32"
},
{
"internalType": "string",
"name": "description_",
"type": "string"
},
{
"components": [
{
"internalType": "address",
"name": "account",
"type": "address"
},
{
"internalType": "uint96",
"name": "bps",
"type": "uint96"
},
{
"internalType": "string",
"name": "name",
"type": "string"
},
{
"internalType": "string",
"name": "note",
"type": "string"
}
],
"internalType": "struct Distribution.Beneficiary[]",
"name": "table_",
"type": "tuple[]"
}
],
"name": "init",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [],
"name": "nonce",
"outputs": [
{
"internalType": "uint32",
"name": "",
"type": "uint32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "pendingCount",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "pendingOwner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes",
"name": "action",
"type": "bytes"
}
],
"name": "propose",
"outputs": [
{
"internalType": "bytes32",
"name": "hash",
"type": "bytes32"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"name": "queued",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "release",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "reserved",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "address",
"name": "account",
"type": "address"
},
{
"internalType": "uint96",
"name": "bps",
"type": "uint96"
},
{
"internalType": "string",
"name": "name",
"type": "string"
},
{
"internalType": "string",
"name": "note",
"type": "string"
}
],
"internalType": "struct Distribution.Beneficiary[]",
"name": "table_",
"type": "tuple[]"
}
],
"name": "setBeneficiaries",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint32",
"name": "delay_",
"type": "uint32"
}
],
"name": "setDelay",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "description_",
"type": "string"
}
],
"name": "setDescription",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "snapshot",
"outputs": [
{
"components": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "uint32",
"name": "delay",
"type": "uint32"
},
{
"internalType": "uint32",
"name": "nonce",
"type": "uint32"
},
{
"internalType": "string",
"name": "description",
"type": "string"
},
{
"components": [
{
"internalType": "address",
"name": "account",
"type": "address"
},
{
"internalType": "uint96",
"name": "bps",
"type": "uint96"
},
{
"internalType": "string",
"name": "name",
"type": "string"
},
{
"internalType": "string",
"name": "note",
"type": "string"
}
],
"internalType": "struct Distribution.Beneficiary[]",
"name": "table",
"type": "tuple[]"
},
{
"components": [
{
"internalType": "bytes32",
"name": "hash",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "eta",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "action",
"type": "bytes"
}
],
"internalType": "struct Distribution.Pending[]",
"name": "pending",
"type": "tuple[]"
}
],
"internalType": "struct Distribution.Snapshot",
"name": "",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner_",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"stateMutability": "payable",
"type": "receive"
}
]
DNZN Clone Snapshot
Command:
cast call 0xB611Ff193DA8Fa9391C0A3DAa29C3c9a0F4D5199 "snapshot()((address,uint32,uint32,string,(address,uint96,string,string)[],(bytes32,uint256,bytes)[]))"
Artifact:
(0x00c0e88778E3e3d17AcaaBC7550deC7Ab61F3790, 604800 [6.048e5], 0, "DNZN // FUND DISTRIBUTION", [(0x00b6E7D12EdE9Ca4A74fE69be758aAB1ee02cFb9, 2000, "treasury", "long-term growth, future projects"), (0x00c0e88778E3e3d17AcaaBC7550deC7Ab61F3790, 4000, "ops", "infrastructure, services, tokens"), (0x357836fFcB45307FA7ff2A574F505753c961902B, 4000, "creator", "founding engineer, product vision")], [])
Storage Reads
Implementation slots 0–4 and DNZN clone slots 0–8 at block 26,508,644 (etherscan), followed by constants read through the clone.
Command:
Artifact:
SELFDESTRUCT: 0
DELEGATECALL: 0
CALLCODE: 0
CREATE2: 0
TSTORE: 6
TLOAD: 11
STATICCALL: 1
CALL : 0
SSTORE: 66
LOG2: 10
--- implementation slots @ 26508644
0 0x0000000000000000000000000000000000000000000000000000000000000000
1 0x0000000000000000000000000000000000000000000000000000000000000000
2 0x0000000000000000000000000000000000000000000000000000000000000000
3 0x0000000000000000000000000000000000000000000000000000000000000000
4 0x0000000000000000000000000000000000000000000000000000000000000000
--- clone slots @ 26508644
0 0x000000000000000000093a8000c0e88778e3e3d17acaabc7550dec7ab61f3790
1 0x0000000000000000000000000000000000000000000000000000000000000000
2 0x444e5a4e202f2f2046554e4420444953545249425554494f4e00000000000032
3 0x0000000000000000000000000000000000000000000000000000000000000003
4 0x0000000000000000000000000000000000000000000000000000000000000000
5 0x0000000000000000000000000000000000000000000000000000000000000000
6 0x0000000000000000000000000000000000000000000000000000000000000000
7 0x0000000000000000000000000000000000000000000000000000000000000000
8 0x0000000000000000000000000000000000000000000000000000000000000000
pending base 0x8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b
description slot 2 decoded: DNZN // FUND DISTRIBUTION
1209600 [1.209e6]
107
0
0
Beneficiary Row Slots
Row slots from keccak256(uint256(3)), three per row.
Artifact:
row0 +0 0xc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b 0x0000000000000000000007d000b6e7d12ede9ca4a74fe69be758aab1ee02cfb9
row0 +1 0xc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85c 0x7472656173757279000000000000000000000000000000000000000000000010
row0 +2 0xc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85d 0x0000000000000000000000000000000000000000000000000000000000000043
row1 +0 0xc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85e 0x000000000000000000000fa000c0e88778e3e3d17acaabc7550dec7ab61f3790
row1 +1 0xc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85f 0x6f70730000000000000000000000000000000000000000000000000000000006
row1 +2 0xc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f860 0x0000000000000000000000000000000000000000000000000000000000000041
row2 +0 0xc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f861 0x000000000000000000000fa0357836ffcb45307fa7ff2a574f505753c961902b
row2 +1 0xc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f862 0x63726561746f720000000000000000000000000000000000000000000000000e
row2 +2 0xc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f863 0x0000000000000000000000000000000000000000000000000000000000000043
Revert Path and Timelock Simulations
cast call results against the DNZN clone at block 26,508,644 (etherscan). The timelock cases override queued[hash] with --override-state-diff; the stipend cases override the code of a test address. The script is reproduced in the methodology.
Artifact:
## distribute(ETH), empty clone
Error: server returned an error response: error code 3: execution reverted, data: "0x5c52a868"
## distribute(USDC), empty clone
Error: server returned an error response: error code 3: execution reverted, data: "0x5c52a868"
## distribute(EOA as token)
Error: server returned an error response: error code 3: execution reverted, data: "0x"
## release(ETH, ops), nothing escrowed
Error: server returned an error response: error code 3: execution reverted, data: "0x5c52a868"
## claim(ETH) from ops, nothing escrowed
Error: server returned an error response: error code 3: execution reverted, data: "0x5c52a868"
## propose(setDelay(0)) from random
Error: server returned an error response: error code 3: execution reverted, data: "0x30cd7471"
## propose(setDelay(0)) from owner (simulated)
0x387f6b7e8c5c7197892865e06475399ccc024b7ff0775143981ae4423894e1ba
## applyQueued(setDelay(0), 1), not queued
Error: server returned an error response: error code 3: execution reverted, data: "0x5a9975260000000000000000000000000000000000000000000000000000000000000000"
## hash of (setDelay(0), nonce 1)
0x387f6b7e8c5c7197892865e06475399ccc024b7ff0775143981ae4423894e1ba
## cancel(hash) from random, not queued
Error: server returned an error response: error code 3: execution reverted, data: "0x30cd7471"
## cancel(hash) from owner, not queued
Error: server returned an error response: error code 3: execution reverted, data: "0x5c52a868"
## setDelay(0) called directly by owner
Error: server returned an error response: error code 3: execution reverted, data: "0x82b42900"
## setBeneficiaries called directly by owner
Error: server returned an error response: error code 3: execution reverted, data: "0x82b42900"
## transferOwnership called directly by owner
Error: server returned an error response: error code 3: execution reverted, data: "0x82b42900"
## acceptOwnership from random (no nominee)
Error: server returned an error response: error code 3: execution reverted, data: "0x82b42900"
## init from factory on existing clone
Error: server returned an error response: error code 3: execution reverted, data: "0x82b42900"
## plain ETH to implementation
Error: server returned an error response: error code 3: execution reverted, data: "0x82b42900"
## plain ETH to clone
0x
## queued slot for hash
0x770d73c2edb43ab4f026812ae46915f8211b86120fe40dfcf89ffb21a96da6a9 now=1795807739
## applyQueued, eta in the future
Error: server returned an error response: error code 3: execution reverted, data: "0x5a997526000000000000000000000000000000000000000000000000000000006b0b2b7b"
## applyQueued by random, matured 1 day ago
0x
## applyQueued, matured 15 days ago (past GRACE)
Error: server returned an error response: error code 3: execution reverted, data: "0xf80dbaea000000000000000000000000000000000000000000000000000000006af6137b"
## cancel by random, matured 1 day ago
Error: server returned an error response: error code 3: execution reverted, data: "0x30cd7471"
## cancel by random, expired
0x
## acceptOwnership by nominee
0x
## stipend send (transfer/send), implementation cold
0x0000000000000000000000000000000000000000000000000000000000000000
## stipend send, implementation warmed first
0x0000000000000000000000000000000000000000000000000000000000000001
Payout Traces
cast call --trace results with balance, code and storage overrides on the DNZN clone. Labels such as Multisig and TetherToken are names Etherscan supplies for verified contracts.
Artifact:
################ distribute(ETH) with 1 ether
[51297] Distribution::distribute(0x0000000000000000000000000000000000000000)
├─ [48636] 0xc4eD7EA21B8CC334F08945B4D0c182e0afF8cB0A::distribute(0x0000000000000000000000000000000000000000) [delegatecall]
│ ├─ [2704] Multisig::receive{value: 200000000000000000}()
│ │ ├─ [55] Multisig::receive{value: 200000000000000000}() [delegatecall]
│ │ │ └─ ← [Stop]
│ │ └─ ← [Return]
│ ├─ [204] Multisig::receive{value: 400000000000000000}()
│ │ ├─ [55] Multisig::receive{value: 400000000000000000}() [delegatecall]
│ │ │ └─ ← [Stop]
│ │ └─ ← [Return]
│ ├─ [55] 0x357836fFcB45307FA7ff2A574F505753c961902B::fallback{value: 400000000000000000}()
│ │ └─ ← [Stop]
│ ├─ emit Distributed(token: 0x0000000000000000000000000000000000000000, amount: 1000000000000000000 [1e18])
│ └─ ← [Stop]
└─ ← [Return]
Transaction successfully executed.
Gas used: 72489
################ distribute(ETH) with 10,001 wei (rounding)
[51297] Distribution::distribute(0x0000000000000000000000000000000000000000)
├─ [48636] Distribution::distribute(0x0000000000000000000000000000000000000000) [delegatecall]
│ ├─ [2704] Multisig::receive{value: 2000}()
│ │ ├─ [55] Multisig::receive{value: 2000}() [delegatecall]
│ │ │ └─ ← [Stop]
│ │ └─ ← [Return]
│ ├─ [204] Multisig::receive{value: 4000}()
│ │ ├─ [55] Multisig::receive{value: 4000}() [delegatecall]
│ │ │ └─ ← [Stop]
│ │ └─ ← [Return]
│ ├─ [55] 0x357836fFcB45307FA7ff2A574F505753c961902B::fallback{value: 4001}()
│ │ └─ ← [Stop]
│ ├─ emit Distributed(token: 0x0000000000000000000000000000000000000000, amount: 10001 [1e4])
│ └─ ← [Stop]
└─ ← [Return]
Transaction successfully executed.
Gas used: 72489
################ distribute(ETH), treasury code replaced by PUSH0 PUSH0 REVERT
[95439] Distribution::distribute(0x0000000000000000000000000000000000000000)
├─ [92778] Distribution::distribute(0x0000000000000000000000000000000000000000) [delegatecall]
│ ├─ [4] Multisig::receive{value: 200000000000000000}()
│ │ └─ ← [Revert] EvmError: Revert
│ ├─ emit Escrowed(token: 0x0000000000000000000000000000000000000000, account: Multisig: [0x00b6E7D12EdE9Ca4A74fE69be758aAB1ee02cFb9], amount: 200000000000000000 [2e17])
│ ├─ [2704] Multisig::receive{value: 400000000000000000}()
│ │ ├─ [55] Multisig::receive{value: 400000000000000000}() [delegatecall]
│ │ │ └─ ← [Stop]
│ │ └─ ← [Return]
│ ├─ [55] 0x357836fFcB45307FA7ff2A574F505753c961902B::fallback{value: 400000000000000000}()
│ │ └─ ← [Stop]
│ ├─ emit Distributed(token: 0x0000000000000000000000000000000000000000, amount: 1000000000000000000 [1e18])
│ └─ ← [Stop]
└─ ← [Return]
Transaction successfully executed.
Gas used: 116631
escrowed[ETH][treasury] slot 0xbe5c6ee863fc4b8da276dfdeb91e0135e40b488848bc9502bc1d0d8b5a782be4 ; reserved[ETH] slot 0x6d5257204ebe7d88fd91ae87941cb2dd9d8062b64ae5a2bd2d28ec40b9fbf6df
################ distribute(ETH), 1.2 ether held, 0.2 reserved
[51297] Distribution::distribute(0x0000000000000000000000000000000000000000)
├─ [48636] Distribution::distribute(0x0000000000000000000000000000000000000000) [delegatecall]
│ ├─ [2704] Multisig::receive{value: 200000000000000000}()
│ │ ├─ [55] Multisig::receive{value: 200000000000000000}() [delegatecall]
│ │ │ └─ ← [Stop]
│ │ └─ ← [Return]
│ ├─ [204] Multisig::receive{value: 400000000000000000}()
│ │ ├─ [55] Multisig::receive{value: 400000000000000000}() [delegatecall]
│ │ │ └─ ← [Stop]
│ │ └─ ← [Return]
│ ├─ [55] 0x357836fFcB45307FA7ff2A574F505753c961902B::fallback{value: 400000000000000000}()
│ │ └─ ← [Stop]
│ ├─ emit Distributed(token: 0x0000000000000000000000000000000000000000, amount: 1000000000000000000 [1e18])
│ └─ ← [Stop]
└─ ← [Return]
Transaction successfully executed.
Gas used: 72489
################ release(ETH, treasury) by random
[28138] Distribution::release(0x0000000000000000000000000000000000000000, Multisig: [0x00b6E7D12EdE9Ca4A74fE69be758aAB1ee02cFb9])
├─ [25471] Distribution::release(0x0000000000000000000000000000000000000000, Multisig: [0x00b6E7D12EdE9Ca4A74fE69be758aAB1ee02cFb9]) [delegatecall]
│ ├─ [2704] Multisig::receive{value: 200000000000000000}()
│ │ ├─ [55] Multisig::receive{value: 200000000000000000}() [delegatecall]
│ │ │ └─ ← [Stop]
│ │ └─ ← [Return]
│ ├─ emit Released(token: 0x0000000000000000000000000000000000000000, account: Multisig: [0x00b6E7D12EdE9Ca4A74fE69be758aAB1ee02cFb9], amount: 200000000000000000 [2e17])
│ └─ ← [Stop]
└─ ← [Return]
Transaction successfully executed.
Gas used: 40086
################ release(ETH, treasury), treasury still reverting
[23476] Distribution::release(0x0000000000000000000000000000000000000000, Multisig: [0x00b6E7D12EdE9Ca4A74fE69be758aAB1ee02cFb9])
├─ [20804] Distribution::release(0x0000000000000000000000000000000000000000, Multisig: [0x00b6E7D12EdE9Ca4A74fE69be758aAB1ee02cFb9]) [delegatecall]
│ ├─ [4] Multisig::receive{value: 200000000000000000}()
│ │ └─ ← [Revert] EvmError: Revert
│ └─ ← [Revert] ReleaseFailed(0x0000000000000000000000000000000000000000)
└─ ← [Revert] ReleaseFailed(0x0000000000000000000000000000000000000000)
Error: Transaction failed.
Gas used: 45024
################ claim(ETH, creator) by treasury
[28232] Distribution::claim(0x0000000000000000000000000000000000000000, 0x357836fFcB45307FA7ff2A574F505753c961902B)
├─ [25565] Distribution::claim(0x0000000000000000000000000000000000000000, 0x357836fFcB45307FA7ff2A574F505753c961902B) [delegatecall]
│ ├─ [55] 0x357836fFcB45307FA7ff2A574F505753c961902B::fallback{value: 200000000000000000}()
│ │ └─ ← [Stop]
│ ├─ emit Claimed(token: 0x0000000000000000000000000000000000000000, account: 0x00b6E7D12EdE9Ca4A74fE69be758aAB1ee02cFb9, to: 0x357836fFcB45307FA7ff2A574F505753c961902B, amount: 200000000000000000 [2e17])
│ └─ ← [Stop]
└─ ← [Return]
Transaction successfully executed.
Gas used: 40192
################ claim(ETH) by random (no escrow)
[5689] Distribution::claim(0x0000000000000000000000000000000000000000, 0x1111111111111111111111111111111111111111)
├─ [3020] Distribution::claim(0x0000000000000000000000000000000000000000, 0x1111111111111111111111111111111111111111) [delegatecall]
│ └─ ← [Revert] NothingToDo()
└─ ← [Revert] NothingToDo()
Error: Transaction failed.
Gas used: 27249
## distribute(USDT), 10,001 units via balances slot 0x849fb2e34c2e0ed586d2acfbcb1e56c5a548300febf68bac32da29a235de77d4
│ ├─ [5031] TetherToken::balanceOf(Distribution: [0xB611Ff193DA8Fa9391C0A3DAa29C3c9a0F4D5199]) [staticcall]
│ ├─ [37601] TetherToken::transfer(0x00b6E7D12EdE9Ca4A74fE69be758aAB1ee02cFb9, 2000)
│ │ ├─ emit Transfer(from: Distribution: [0xB611Ff193DA8Fa9391C0A3DAa29C3c9a0F4D5199], to: 0x00b6E7D12EdE9Ca4A74fE69be758aAB1ee02cFb9, value: 2000)
│ ├─ [26801] TetherToken::transfer(0x00c0e88778E3e3d17AcaaBC7550deC7Ab61F3790, 4000)
│ │ ├─ emit Transfer(from: Distribution: [0xB611Ff193DA8Fa9391C0A3DAa29C3c9a0F4D5199], to: 0x00c0e88778E3e3d17AcaaBC7550deC7Ab61F3790, value: 4000)
│ ├─ [9701] TetherToken::transfer(0x357836fFcB45307FA7ff2A574F505753c961902B, 4001)
│ │ ├─ emit Transfer(from: Distribution: [0xB611Ff193DA8Fa9391C0A3DAa29C3c9a0F4D5199], to: 0x357836fFcB45307FA7ff2A574F505753c961902B, value: 4001)
│ ├─ emit Distributed(token: TetherToken: [0xdAC17F958D2ee523a2206206994597C13D831ec7], amount: 10001 [1e4])
Gas used: 118036
## distribute(USDC), 10,001 units via slot 0x2935271132415678ab01fbb2a9b4cbbaf1be5395e30f85f8dc022ba91e80be75
│ │ ├─ [2553] FiatTokenV2_2::balanceOf(Distribution: [0xB611Ff193DA8Fa9391C0A3DAa29C3c9a0F4D5199]) [delegatecall]
│ │ ├─ [31363] FiatTokenV2_2::transfer(0x00b6E7D12EdE9Ca4A74fE69be758aAB1ee02cFb9, 2000) [delegatecall]
│ │ │ ├─ emit Transfer(from: Distribution: [0xB611Ff193DA8Fa9391C0A3DAa29C3c9a0F4D5199], to: 0x00b6E7D12EdE9Ca4A74fE69be758aAB1ee02cFb9, value: 2000)
│ │ ├─ [26563] FiatTokenV2_2::transfer(0x00c0e88778E3e3d17AcaaBC7550deC7Ab61F3790, 4000) [delegatecall]
│ │ │ ├─ emit Transfer(from: Distribution: [0xB611Ff193DA8Fa9391C0A3DAa29C3c9a0F4D5199], to: 0x00c0e88778E3e3d17AcaaBC7550deC7Ab61F3790, value: 4000)
│ │ ├─ [26563] FiatTokenV2_2::transfer(0x357836fFcB45307FA7ff2A574F505753c961902B, 4001) [delegatecall]
│ │ │ ├─ emit Transfer(from: Distribution: [0xB611Ff193DA8Fa9391C0A3DAa29C3c9a0F4D5199], to: 0x357836fFcB45307FA7ff2A574F505753c961902B, value: 4001)
│ ├─ emit Distributed(token: FiatTokenProxy: [0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48], amount: 10001 [1e4])
Gas used: 136501
## treasury re-enters with 0xcb313c17 during distribute(ETH)
[96729] Distribution::distribute(0x0000000000000000000000000000000000000000)
├─ [94068] Distribution::distribute(0x0000000000000000000000000000000000000000) [delegatecall]
│ ├─ [1294] Multisig::receive{value: 200000000000000000}()
│ │ ├─ [1113] Distribution::applyQueued(0x103486650000000000000000000000000000000000000000000000000000000000000000, 1)
│ │ │ ├─ [926] Distribution::applyQueued(0x103486650000000000000000000000000000000000000000000000000000000000000000, 1) [delegatecall]
│ │ │ │ └─ ← [Revert] Locked()
│ │ │ └─ ← [Revert] Locked()
│ │ └─ ← [Revert] Locked()
│ ├─ emit Escrowed(token: 0x0000000000000000000000000000000000000000, account: Multisig: [0x00b6E7D12EdE9Ca4A74fE69be758aAB1ee02cFb9], amount: 200000000000000000 [2e17])
│ ├─ [2704] Multisig::receive{value: 400000000000000000}()
│ │ ├─ [55] Multisig::receive{value: 400000000000000000}() [delegatecall]
│ ├─ [55] 0x357836fFcB45307FA7ff2A574F505753c961902B::fallback{value: 400000000000000000}()
## treasury re-enters with 0x63453ae1 during distribute(ETH)
[96302] Distribution::distribute(0x0000000000000000000000000000000000000000)
├─ [93641] Distribution::distribute(0x0000000000000000000000000000000000000000) [delegatecall]
│ ├─ [867] Multisig::receive{value: 200000000000000000}()
│ │ ├─ [710] Distribution::distribute(0x0000000000000000000000000000000000000000)
│ │ │ ├─ [547] Distribution::distribute(0x0000000000000000000000000000000000000000) [delegatecall]
│ │ │ │ └─ ← [Revert] Locked()
│ │ │ └─ ← [Revert] Locked()
│ │ └─ ← [Revert] Locked()
│ ├─ emit Escrowed(token: 0x0000000000000000000000000000000000000000, account: Multisig: [0x00b6E7D12EdE9Ca4A74fE69be758aAB1ee02cFb9], amount: 200000000000000000 [2e17])
│ ├─ [2704] Multisig::receive{value: 400000000000000000}()
│ │ ├─ [55] Multisig::receive{value: 400000000000000000}() [delegatecall]
│ ├─ [55] 0x357836fFcB45307FA7ff2A574F505753c961902B::fallback{value: 400000000000000000}()