Address Contract Partially Verified
Address
0xDa11A6e746Df831A3d7568Fe6E642b897Fcc798B
Balance
0.049286 ETH
Nonce
1
Code Size
15750 bytes
Creator
0xe4017661...8A9F at tx 0xc7e11328...1f1896
Indexed Transactions
0
Contract Bytecode
15750 bytes
0x608060405260043610610250575f3560e01c80638b5b9ccc11610138578063d8a4676f116100b5578063eafa02b411610079578063eafa02b414610881578063f2fde38b146108bd578063f3f43703146108e5578063f6d361cc14610921578063f71d96cb1461094b578063f9efb5051461098757610250565b8063d8a4676f146107bc578063d968f51b146107f9578063e0c8628914610823578063e580f47b1461084d578063e97dcb621461087757610250565b80639eccacf6116100fc5780639eccacf6146106c5578063a168fa89146106ef578063b0fb162f1461072c578063b3e022de14610756578063d56d229d1461079257610250565b80638b5b9ccc146105d15780638b8840e0146105fb5780638da5cb5b146106375780638ea98117146106615780639b211fc41461068957610250565b80633d359dca116101d1578063735de9f711610195578063735de9f7146104d757806379ba5097146105015780637ccfd7fc1461051757806381447999146105415780638984d7691461056b5780638ac00021146105a757610250565b80633d359dca146103cc57806342f53c3f146104085780634fd66eae146104445780635cc050c41461048357806361728f39146104ad57610250565b806324f746971161021857806324f746971461030e5780632a966fcb146103385780632fff297e146103625780633ad10ef61461038c5780633ccfd60b146103b657610250565b806306a9ba1414610254578063107c646a1461027e5780631a0de74c146102ba5780631fe543e3146102d057806322911367146102f8575b5f80fd5b34801561025f575f80fd5b506102686109b1565b6040516102759190612c8a565b60405180910390f35b348015610289575f80fd5b506102a4600480360381019061029f9190612d0e565b6109b6565b6040516102b19190612c8a565b60405180910390f35b3480156102c5575f80fd5b506102ce6109cb565b005b3480156102db575f80fd5b506102f660048036038101906102f19190612dc4565b610c95565b005b348015610303575f80fd5b5061030c610d59565b005b348015610319575f80fd5b50610322610ffd565b60405161032f9190612e3f565b60405180910390f35b348015610343575f80fd5b5061034c611012565b6040516103599190612e67565b60405180910390f35b34801561036d575f80fd5b5061037661102a565b6040516103839190612e67565b60405180910390f35b348015610397575f80fd5b506103a0611030565b6040516103ad9190612ea0565b60405180910390f35b3480156103c1575f80fd5b506103ca611054565b005b3480156103d7575f80fd5b506103f260048036038101906103ed9190612d0e565b611211565b6040516103ff9190612c8a565b60405180910390f35b348015610413575f80fd5b5061042e60048036038101906104299190612eb9565b6112be565b60405161043b9190612c8a565b60405180910390f35b34801561044f575f80fd5b5061046a60048036038101906104659190612d0e565b6112de565b60405161047a9493929190612ee4565b60405180910390f35b34801561048e575f80fd5b506104976113b4565b6040516104a49190612c8a565b60405180910390f35b3480156104b8575f80fd5b506104c16113cb565b6040516104ce9190612f3f565b60405180910390f35b3480156104e2575f80fd5b506104eb6113d1565b6040516104f89190612fb3565b60405180910390f35b34801561050c575f80fd5b506105156113f6565b005b348015610522575f80fd5b5061052b611585565b6040516105389190612e3f565b60405180910390f35b34801561054c575f80fd5b5061055561159b565b604051610562919061303f565b60405180910390f35b348015610576575f80fd5b50610591600480360381019061058c9190612eb9565b6115ad565b60405161059e9190612ea0565b60405180910390f35b3480156105b2575f80fd5b506105bb6115e1565b6040516105c89190612c8a565b60405180910390f35b3480156105dc575f80fd5b506105e56115e7565b6040516105f2919061310f565b60405180910390f35b348015610606575f80fd5b50610621600480360381019061061c9190612d0e565b611672565b60405161062e9190612c8a565b60405180910390f35b348015610642575f80fd5b5061064b611687565b6040516106589190612e67565b60405180910390f35b34801561066c575f80fd5b5061068760048036038101906106829190612d0e565b6116ae565b005b348015610694575f80fd5b506106af60048036038101906106aa9190612d0e565b61188b565b6040516106bc9190612c8a565b60405180910390f35b3480156106d0575f80fd5b506106d96118a0565b6040516106e6919061314f565b60405180910390f35b3480156106fa575f80fd5b5061071560048036038101906107109190612eb9565b6118c5565b604051610723929190613182565b60405180910390f35b348015610737575f80fd5b506107406118fd565b60405161074d91906131c5565b60405180910390f35b348015610761575f80fd5b5061077c60048036038101906107779190612eb9565b611911565b6040516107899190612ea0565b60405180910390f35b34801561079d575f80fd5b506107a6611945565b6040516107b391906131fe565b60405180910390f35b3480156107c7575f80fd5b506107e260048036038101906107dd9190612eb9565b611969565b6040516107f09291906132ce565b60405180910390f35b348015610804575f80fd5b5061080d611a87565b60405161081a9190612c8a565b60405180910390f35b34801561082e575f80fd5b50610837611a8c565b6040516108449190612c8a565b60405180910390f35b348015610858575f80fd5b50610861611cd7565b60405161086e9190612c8a565b60405180910390f35b61087f611cdd565b005b34801561088c575f80fd5b506108a760048036038101906108a29190612d0e565b61223e565b6040516108b49190612c8a565b60405180910390f35b3480156108c8575f80fd5b506108e360048036038101906108de9190612d0e565b612253565b005b3480156108f0575f80fd5b5061090b60048036038101906109069190612d0e565b612267565b6040516109189190612c8a565b60405180910390f35b34801561092c575f80fd5b5061093561227c565b6040516109429190612c8a565b60405180910390f35b348015610956575f80fd5b50610971600480360381019061096c9190612eb9565b612287565b60405161097e9190612ea0565b60405180910390f35b348015610992575f80fd5b5061099b6122c2565b6040516109a89190612c8a565b60405180910390f35b600a81565b6010602052805f5260405f205f915090505481565b601c60069054906101000a900463ffffffff1663ffffffff166009805490501015610a22576040517f0da00b7600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600a60058054905014610a61576040517f3d8a0f6c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f600a67ffffffffffffffff811115610a7d57610a7c6132fc565b5b604051908082528060200260200182016040528015610aab5781602001602082028036833780820191505090505b509050610ab6612ae7565b5f5b6003811015610c76575f600a60098381548110610ad857610ad7613329565b5b905f5260205f200154610aeb9190613383565b90505b838181518110610b0157610b00613329565b5b602002602001015115610b2e57600a600182610b1d91906133e0565b610b279190613383565b9050610aee565b6001848281518110610b4357610b42613329565b5b60200260200101901515908115158152505060058181548110610b6957610b68613329565b5b905f5260205f20015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16838360038110610ba457610ba3613329565b5b602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060105f60058381548110610bf257610bf1613329565b5b905f5260205f20015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f815480929190610c6390613413565b9190505550818060010192505050610ab8565b50806006906003610c88929190612b09565b50610c916122c8565b5050565b60025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610d49573360025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040517f1cf993f4000000000000000000000000000000000000000000000000000000008152600401610d4092919061345a565b60405180910390fd5b610d5483838361273c565b505050565b610d6161283d565b5f600b5411610da5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d9c906134db565b60405180910390fd5b5f600b5490505f600b819055505f600267ffffffffffffffff811115610dce57610dcd6132fc565b5b604051908082528060200260200182016040528015610dfc5781602001602082028036833780820191505090505b50905060195f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e69573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e8d919061350d565b815f81518110610ea057610e9f613329565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505073370a366f402e2e41cdbbe54ecec12aae0cce195581600181518110610f0357610f02613329565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060195f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637ff36ab5835f8461dead60b442610f8d91906133e0565b6040518663ffffffff1660e01b8152600401610fac9493929190613628565b5f6040518083038185885af1158015610fc7573d5f803e3d5ffd5b50505050506040513d5f823e3d601f19601f82011682018060405250810190610ff091906137a1565b505050610ffb61288c565b565b601c5f9054906101000a900463ffffffff1681565b73370a366f402e2e41cdbbe54ecec12aae0cce195581565b61dead81565b7f000000000000000000000000e4017661491fa0fbeae3734018e8d2b5cb218a9f81565b61105c61283d565b5f600d5f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205490505f81036110d6576040517f794afc1400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f600d5f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055505f3373ffffffffffffffffffffffffffffffffffffffff168260405161113d90613815565b5f6040518083038185875af1925050503d805f8114611177576040519150601f19603f3d011682016040523d82523d5f602084013e61117c565b606091505b50509050806111b7576040517f8188b9e200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff167fbc158bb64f05d6383aea69bbb0b20c1bbf4b7a18f63359c5649b7c39e29d3884836040516111fd9190612c8a565b60405180910390a2505061120f61288c565b565b5f80600f5f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205490505f8111611260575f6112b6565b80606460105f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20546112ab9190613829565b6112b5919061386a565b5b915050919050565b600981815481106112cd575f80fd5b905f5260205f20015f915090505481565b5f805f80600e5f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054600f5f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205461136787611211565b60115f8973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205493509350935093509193509193565b600a662386f26fc100006113c89190613829565b81565b601b5481565b60195f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611485576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161147c906138e4565b60405180910390fd5b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050335f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505f60015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350565b601c60069054906101000a900463ffffffff1681565b600c5f9054906101000a900460ff1681565b601281600781106115bc575f80fd5b015f915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b601a5481565b6060600580548060200260200160405190810160405280929190818152602001828054801561166857602002820191905f5260205f20905b815f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001906001019080831161161f575b5050505050905090565b600e602052805f5260405f205f915090505481565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6116b6611687565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415801561173e575060025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b156117ac573361174c611687565b60025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040517f061db9c10000000000000000000000000000000000000000000000000000000081526004016117a393929190613902565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611811576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060025f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fd1a6a14209a385a964d036e404cb5cfb71f4000cdb03c9366292430787261be6816040516118809190612e67565b60405180910390a150565b6011602052805f5260405f205f915090505481565b60025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6004602052805f5260405f205f91509050805f015f9054906101000a900460ff1690805f0160019054906101000a900460ff16905082565b601c60049054906101000a900461ffff1681565b60068160038110611920575f80fd5b015f915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b7f000000000000000000000000b09f884d48543ee12ebbeb0e565fdecc8077ec3281565b5f606060045f8481526020019081526020015f205f0160019054906101000a900460ff166119cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119c390613981565b60405180910390fd5b5f60045f8581526020019081526020015f206040518060600160405290815f82015f9054906101000a900460ff161515151581526020015f820160019054906101000a900460ff1615151515815260200160018201805480602002602001604051908101604052809291908181526020018280548015611a6957602002820191905f5260205f20905b815481526020019060010190808311611a55575b5050505050815250509050805f015181604001519250925050915091565b600581565b5f60025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639b1c385e6040518060c00160405280601b548152602001601a548152602001601c60049054906101000a900461ffff1661ffff168152602001601c5f9054906101000a900463ffffffff1663ffffffff168152602001601c60069054906101000a900463ffffffff1663ffffffff168152602001611b5360405180602001604052805f1515815250612896565b8152506040518263ffffffff1660e01b8152600401611b729190613acc565b6020604051808303815f875af1158015611b8e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611bb29190613aec565b905060405180606001604052805f151581526020016001151581526020015f67ffffffffffffffff811115611bea57611be96132fc565b5b604051908082528060200260200182016040528015611c185781602001602082028036833780820191505090505b5081525060045f8381526020019081526020015f205f820151815f015f6101000a81548160ff0219169083151502179055506020820151815f0160016101000a81548160ff0219169083151502179055506040820151816001019080519060200190611c85929190612b85565b509050507fcc58b13ad3eab50626c6a6300b1d139cd6ebb1688a7cced9461c2f7e762665ee81601c60069054906101000a900463ffffffff16604051611ccc929190613b17565b60405180910390a190565b600a5481565b611ce561283d565b5f7f000000000000000000000000b09f884d48543ee12ebbeb0e565fdecc8077ec3273ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b8152600401611d3f9190612e67565b602060405180830381865afa158015611d5a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611d7e9190613aec565b03611db5576040517fcc0dbdbc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b662386f26fc100003414611df5576040517fc4672a9d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f6002811115611e0857611e07612fcc565b5b600c5f9054906101000a900460ff166002811115611e2957611e28612fcc565b5b14611e60576040517f3d8a0f6c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600a60058054905010611e9f576040517f40a8bdf700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b600580549050811015611f5b573373ffffffffffffffffffffffffffffffffffffffff1660058281548110611ed957611ed8613329565b5b905f5260205f20015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1603611f4e576040517f2a11963600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8080600101915050611ea1565b505f80600f5f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054149050600533908060018154018082558091505060019003905f5260205f20015f9091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600f5f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f81548092919061204c90613413565b9190505550600560115f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825461209e91906133e0565b925050819055503373ffffffffffffffffffffffffffffffffffffffff167f1d64fb5ba9f2548c5b98468d58f25b87b9e866afee0122e92d9fe722bf85076c60405160405180910390a28015612132573373ffffffffffffffffffffffffffffffffffffffff167f8cd3331e32cec677d80b82cf0f71496605e7ed6ff864a3ccedc7d5d11d838c8360405160405180910390a25b600a60058054905003612233576002600c5f6101000a81548160ff0219169083600281111561216457612163612fcc565b5b02179055503073ffffffffffffffffffffffffffffffffffffffff1663e0c862896040518163ffffffff1660e01b81526004016020604051808303815f875af19250505080156121d257506040513d601f19601f820116820180604052508101906121cf9190613aec565b60015b612231575f600c5f6101000a81548160ff021916908360028111156121fa576121f9612fcc565b5b02179055506040517f537eddd800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b5061223c61288c565b565b600f602052805f5260405f205f915090505481565b61225b61292e565b612264816129bd565b50565b600d602052805f5260405f205f915090505481565b662386f26fc1000081565b60058181548110612296575f80fd5b905f5260205f20015f915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600b5481565b5f6064603c600a662386f26fc100006122e19190613829565b6122eb9190613829565b6122f5919061386a565b90505f60646005600a662386f26fc100006123109190613829565b61231a9190613829565b612324919061386a565b90505f6064601e600a662386f26fc1000061233f9190613829565b6123499190613829565b612353919061386a565b905060646005600a662386f26fc1000061236d9190613829565b6123779190613829565b612381919061386a565b600b819055505f600384612395919061386a565b90505f5b600381101561248e575f600682600381106123b7576123b6613329565b5b015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905082600d5f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825461242691906133e0565b9250508190555082600e5f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825461247991906133e0565b92505081905550818060010192505050612399565b5082600d5f7f000000000000000000000000e4017661491fa0fbeae3734018e8d2b5cb218a9f73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8282546124fb91906133e0565b9250508190555082600e5f7f000000000000000000000000e4017661491fa0fbeae3734018e8d2b5cb218a9f73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825461256e91906133e0565b925050819055505f600783612583919061386a565b90505f5b60058110156126ab5781600d5f601284600781106125a8576125a7613329565b5b015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825461261091906133e0565b9250508190555081600e5f6012846007811061262f5761262e613329565b5b015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825461269791906133e0565b925050819055508080600101915050612587565b50600a5f8154809291906126be90613413565b919050555060055f6126d09190612bd0565b60095f6126dd9190612bee565b5f600c5f6101000a81548160ff0219169083600281111561270157612700612fcc565b5b0217905550600a547fae4cf40c31a833f14b2aee71da8cb55d5fd1944a9ed5b7696022328921f6e31760405160405180910390a25050505050565b60045f8481526020019081526020015f205f0160019054906101000a900460ff1661279c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161279390613981565b60405180910390fd5b600160045f8581526020019081526020015f205f015f6101000a81548160ff021916908315150217905550818160045f8681526020019081526020015f2060010191906127ea929190612c0c565b508181600991906127fc929190612c0c565b507ffe2e2d779dba245964d4e3ef9b994be63856fd568bf7d3ca9e224755cb1bd54d83838360405161283093929190613ba6565b60405180910390a1505050565b600260035403612882576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161287990613c20565b60405180910390fd5b6002600381905550565b6001600381905550565b60607f92fd13387c7fe7befbc38d303d6468778fb9731bc4583f17d92989c6fcfdeaaa826040516024016128ca9190613c67565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050919050565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146129bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129b290613cca565b60405180910390fd5b565b3373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603612a2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a2290613d32565b60405180910390fd5b8060015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae127860405160405180910390a350565b6040518060600160405280600390602082028036833780820191505090505090565b8260038101928215612b74579160200282015b82811115612b73578251825f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555091602001919060010190612b1c565b5b509050612b819190612c57565b5090565b828054828255905f5260205f20908101928215612bbf579160200282015b82811115612bbe578251825591602001919060010190612ba3565b5b509050612bcc9190612c57565b5090565b5080545f8255905f5260205f2090810190612beb9190612c57565b50565b5080545f8255905f5260205f2090810190612c099190612c57565b50565b828054828255905f5260205f20908101928215612c46579160200282015b82811115612c45578235825591602001919060010190612c2a565b5b509050612c539190612c57565b5090565b5b80821115612c6e575f815f905550600101612c58565b5090565b5f819050919050565b612c8481612c72565b82525050565b5f602082019050612c9d5f830184612c7b565b92915050565b5f604051905090565b5f80fd5b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f612cdd82612cb4565b9050919050565b612ced81612cd3565b8114612cf7575f80fd5b50565b5f81359050612d0881612ce4565b92915050565b5f60208284031215612d2357612d22612cac565b5b5f612d3084828501612cfa565b91505092915050565b612d4281612c72565b8114612d4c575f80fd5b50565b5f81359050612d5d81612d39565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f840112612d8457612d83612d63565b5b8235905067ffffffffffffffff811115612da157612da0612d67565b5b602083019150836020820283011115612dbd57612dbc612d6b565b5b9250929050565b5f805f60408486031215612ddb57612dda612cac565b5b5f612de886828701612d4f565b935050602084013567ffffffffffffffff811115612e0957612e08612cb0565b5b612e1586828701612d6f565b92509250509250925092565b5f63ffffffff82169050919050565b612e3981612e21565b82525050565b5f602082019050612e525f830184612e30565b92915050565b612e6181612cd3565b82525050565b5f602082019050612e7a5f830184612e58565b92915050565b5f612e8a82612cb4565b9050919050565b612e9a81612e80565b82525050565b5f602082019050612eb35f830184612e91565b92915050565b5f60208284031215612ece57612ecd612cac565b5b5f612edb84828501612d4f565b91505092915050565b5f608082019050612ef75f830187612c7b565b612f046020830186612c7b565b612f116040830185612c7b565b612f1e6060830184612c7b565b95945050505050565b5f819050919050565b612f3981612f27565b82525050565b5f602082019050612f525f830184612f30565b92915050565b5f819050919050565b5f612f7b612f76612f7184612cb4565b612f58565b612cb4565b9050919050565b5f612f8c82612f61565b9050919050565b5f612f9d82612f82565b9050919050565b612fad81612f93565b82525050565b5f602082019050612fc65f830184612fa4565b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b6003811061300a57613009612fcc565b5b50565b5f81905061301a82612ff9565b919050565b5f6130298261300d565b9050919050565b6130398161301f565b82525050565b5f6020820190506130525f830184613030565b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61308a81612e80565b82525050565b5f61309b8383613081565b60208301905092915050565b5f602082019050919050565b5f6130bd82613058565b6130c78185613062565b93506130d283613072565b805f5b838110156131025781516130e98882613090565b97506130f4836130a7565b9250506001810190506130d5565b5085935050505092915050565b5f6020820190508181035f83015261312781846130b3565b905092915050565b5f61313982612f82565b9050919050565b6131498161312f565b82525050565b5f6020820190506131625f830184613140565b92915050565b5f8115159050919050565b61317c81613168565b82525050565b5f6040820190506131955f830185613173565b6131a26020830184613173565b9392505050565b5f61ffff82169050919050565b6131bf816131a9565b82525050565b5f6020820190506131d85f8301846131b6565b92915050565b5f6131e882612f82565b9050919050565b6131f8816131de565b82525050565b5f6020820190506132115f8301846131ef565b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61324981612c72565b82525050565b5f61325a8383613240565b60208301905092915050565b5f602082019050919050565b5f61327c82613217565b6132868185613221565b935061329183613231565b805f5b838110156132c15781516132a8888261324f565b97506132b383613266565b925050600181019050613294565b5085935050505092915050565b5f6040820190506132e15f830185613173565b81810360208301526132f38184613272565b90509392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f61338d82612c72565b915061339883612c72565b9250826133a8576133a7613356565b5b828206905092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6133ea82612c72565b91506133f583612c72565b925082820190508082111561340d5761340c6133b3565b5b92915050565b5f61341d82612c72565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361344f5761344e6133b3565b5b600182019050919050565b5f60408201905061346d5f830185612e58565b61347a6020830184612e58565b9392505050565b5f82825260208201905092915050565b7f4e6f2066756e647320746f206275726e000000000000000000000000000000005f82015250565b5f6134c5601083613481565b91506134d082613491565b602082019050919050565b5f6020820190508181035f8301526134f2816134b9565b9050919050565b5f8151905061350781612ce4565b92915050565b5f6020828403121561352257613521612cac565b5b5f61352f848285016134f9565b91505092915050565b5f819050919050565b5f61355b61355661355184613538565b612f58565b612c72565b9050919050565b61356b81613541565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6135a381612cd3565b82525050565b5f6135b4838361359a565b60208301905092915050565b5f602082019050919050565b5f6135d682613571565b6135e0818561357b565b93506135eb8361358b565b805f5b8381101561361b57815161360288826135a9565b975061360d836135c0565b9250506001810190506135ee565b5085935050505092915050565b5f60808201905061363b5f830187613562565b818103602083015261364d81866135cc565b905061365c6040830185612e58565b6136696060830184612c7b565b95945050505050565b5f601f19601f8301169050919050565b61368b82613672565b810181811067ffffffffffffffff821117156136aa576136a96132fc565b5b80604052505050565b5f6136bc612ca3565b90506136c88282613682565b919050565b5f67ffffffffffffffff8211156136e7576136e66132fc565b5b602082029050602081019050919050565b5f8151905061370681612d39565b92915050565b5f61371e613719846136cd565b6136b3565b9050808382526020820190506020840283018581111561374157613740612d6b565b5b835b8181101561376a578061375688826136f8565b845260208401935050602081019050613743565b5050509392505050565b5f82601f83011261378857613787612d63565b5b815161379884826020860161370c565b91505092915050565b5f602082840312156137b6576137b5612cac565b5b5f82015167ffffffffffffffff8111156137d3576137d2612cb0565b5b6137df84828501613774565b91505092915050565b5f81905092915050565b50565b5f6138005f836137e8565b915061380b826137f2565b5f82019050919050565b5f61381f826137f5565b9150819050919050565b5f61383382612c72565b915061383e83612c72565b925082820261384c81612c72565b91508282048414831517613863576138626133b3565b5b5092915050565b5f61387482612c72565b915061387f83612c72565b92508261388f5761388e613356565b5b828204905092915050565b7f4d7573742062652070726f706f736564206f776e6572000000000000000000005f82015250565b5f6138ce601683613481565b91506138d98261389a565b602082019050919050565b5f6020820190508181035f8301526138fb816138c2565b9050919050565b5f6060820190506139155f830186612e58565b6139226020830185612e58565b61392f6040830184612e58565b949350505050565b7f72657175657374206e6f7420666f756e640000000000000000000000000000005f82015250565b5f61396b601183613481565b915061397682613937565b602082019050919050565b5f6020820190508181035f8301526139988161395f565b9050919050565b6139a881612f27565b82525050565b6139b7816131a9565b82525050565b6139c681612e21565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015613a035780820151818401526020810190506139e8565b5f8484015250505050565b5f613a18826139cc565b613a2281856139d6565b9350613a328185602086016139e6565b613a3b81613672565b840191505092915050565b5f60c083015f830151613a5b5f86018261399f565b506020830151613a6e6020860182613240565b506040830151613a8160408601826139ae565b506060830151613a9460608601826139bd565b506080830151613aa760808601826139bd565b5060a083015184820360a0860152613abf8282613a0e565b9150508091505092915050565b5f6020820190508181035f830152613ae48184613a46565b905092915050565b5f60208284031215613b0157613b00612cac565b5b5f613b0e848285016136f8565b91505092915050565b5f604082019050613b2a5f830185612c7b565b613b376020830184612e30565b9392505050565b5f80fd5b82818337505050565b5f613b568385613221565b93507f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831115613b8957613b88613b3e565b5b602083029250613b9a838584613b42565b82840190509392505050565b5f604082019050613bb95f830186612c7b565b8181036020830152613bcc818486613b4b565b9050949350505050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c005f82015250565b5f613c0a601f83613481565b9150613c1582613bd6565b602082019050919050565b5f6020820190508181035f830152613c3781613bfe565b9050919050565b613c4781613168565b82525050565b602082015f820151613c615f850182613c3e565b50505050565b5f602082019050613c7a5f830184613c4d565b92915050565b7f4f6e6c792063616c6c61626c65206279206f776e6572000000000000000000005f82015250565b5f613cb4601683613481565b9150613cbf82613c80565b602082019050919050565b5f6020820190508181035f830152613ce181613ca8565b9050919050565b7f43616e6e6f74207472616e7366657220746f2073656c660000000000000000005f82015250565b5f613d1c601783613481565b9150613d2782613ce8565b602082019050919050565b5f6020820190508181035f830152613d4981613d10565b905091905056fea26469706673582212203d891b784ddf078f0d426e23b39752d441ea8e60d359e4160f7a1aa88854fddb64736f6c63430008140033
Verified Source Code Partial Match
Compiler: v0.8.20+commit.a1b79de6
EVM: shanghai
Optimization: No
VRFSoup.sol 1095 lines
// Sources flattened with hardhat v2.22.19 https://hardhat.org // SPDX-License-Identifier: MIT // File @chainlink/contracts/src/v0.8/shared/interfaces/[email protected] // Original license: SPDX_License_Identifier: MIT pragma solidity ^0.8.0; interface IOwnable { function owner() external returns (address); function transferOwnership(address recipient) external; function acceptOwnership() external; } // File @chainlink/contracts/src/v0.8/shared/access/[email protected] // Original license: SPDX_License_Identifier: MIT pragma solidity ^0.8.0; /// @title The ConfirmedOwner contract /// @notice A contract with helpers for basic contract ownership. contract ConfirmedOwnerWithProposal is IOwnable { address private s_owner; address private s_pendingOwner; event OwnershipTransferRequested(address indexed from, address indexed to); event OwnershipTransferred(address indexed from, address indexed to); constructor(address newOwner, address pendingOwner) { // solhint-disable-next-line gas-custom-errors require(newOwner != address(0), "Cannot set owner to zero"); s_owner = newOwner; if (pendingOwner != address(0)) { _transferOwnership(pendingOwner); } } /// @notice Allows an owner to begin transferring ownership to a new address. function transferOwnership(address to) public override onlyOwner { _transferOwnership(to); } /// @notice Allows an ownership transfer to be completed by the recipient. function acceptOwnership() external override { // solhint-disable-next-line gas-custom-errors require(msg.sender == s_pendingOwner, "Must be proposed owner"); address oldOwner = s_owner; s_owner = msg.sender; s_pendingOwner = address(0); emit OwnershipTransferred(oldOwner, msg.sender); } /// @notice Get the current owner function owner() public view override returns (address) { return s_owner; } /// @notice validate, transfer ownership, and emit relevant events function _transferOwnership(address to) private { // solhint-disable-next-line gas-custom-errors require(to != msg.sender, "Cannot transfer to self"); s_pendingOwner = to; emit OwnershipTransferRequested(s_owner, to); } /// @notice validate access function _validateOwnership() internal view { // solhint-disable-next-line gas-custom-errors require(msg.sender == s_owner, "Only callable by owner"); } /// @notice Reverts if called by anyone other than the contract owner. modifier onlyOwner() { _validateOwnership(); _; } } // File @chainlink/contracts/src/v0.8/shared/access/[email protected] // Original license: SPDX_License_Identifier: MIT pragma solidity ^0.8.0; /// @title The ConfirmedOwner contract /// @notice A contract with helpers for basic contract ownership. contract ConfirmedOwner is ConfirmedOwnerWithProposal { constructor(address newOwner) ConfirmedOwnerWithProposal(newOwner, address(0)) {} } // File @chainlink/contracts/src/v0.8/vrf/dev/interfaces/[email protected] // Original license: SPDX_License_Identifier: MIT pragma solidity ^0.8.0; /// @notice The IVRFSubscriptionV2Plus interface defines the subscription /// @notice related methods implemented by the V2Plus coordinator. interface IVRFSubscriptionV2Plus { /** * @notice Add a consumer to a VRF subscription. * @param subId - ID of the subscription * @param consumer - New consumer which can use the subscription */ function addConsumer(uint256 subId, address consumer) external; /** * @notice Remove a consumer from a VRF subscription. * @param subId - ID of the subscription * @param consumer - Consumer to remove from the subscription */ function removeConsumer(uint256 subId, address consumer) external; /** * @notice Cancel a subscription * @param subId - ID of the subscription * @param to - Where to send the remaining LINK to */ function cancelSubscription(uint256 subId, address to) external; /** * @notice Accept subscription owner transfer. * @param subId - ID of the subscription * @dev will revert if original owner of subId has * not requested that msg.sender become the new owner. */ function acceptSubscriptionOwnerTransfer(uint256 subId) external; /** * @notice Request subscription owner transfer. * @param subId - ID of the subscription * @param newOwner - proposed new owner of the subscription */ function requestSubscriptionOwnerTransfer(uint256 subId, address newOwner) external; /** * @notice Create a VRF subscription. * @return subId - A unique subscription id. * @dev You can manage the consumer set dynamically with addConsumer/removeConsumer. * @dev Note to fund the subscription with LINK, use transferAndCall. For example * @dev LINKTOKEN.transferAndCall( * @dev address(COORDINATOR), * @dev amount, * @dev abi.encode(subId)); * @dev Note to fund the subscription with Native, use fundSubscriptionWithNative. Be sure * @dev to send Native with the call, for example: * @dev COORDINATOR.fundSubscriptionWithNative{value: amount}(subId); */ function createSubscription() external returns (uint256 subId); /** * @notice Get a VRF subscription. * @param subId - ID of the subscription * @return balance - LINK balance of the subscription in juels. * @return nativeBalance - native balance of the subscription in wei. * @return reqCount - Requests count of subscription. * @return owner - owner of the subscription. * @return consumers - list of consumer address which are able to use this subscription. */ function getSubscription( uint256 subId ) external view returns (uint96 balance, uint96 nativeBalance, uint64 reqCount, address owner, address[] memory consumers); /* * @notice Check to see if there exists a request commitment consumers * for all consumers and keyhashes for a given sub. * @param subId - ID of the subscription * @return true if there exists at least one unfulfilled request for the subscription, false * otherwise. */ function pendingRequestExists(uint256 subId) external view returns (bool); /** * @notice Paginate through all active VRF subscriptions. * @param startIndex index of the subscription to start from * @param maxCount maximum number of subscriptions to return, 0 to return all * @dev the order of IDs in the list is **not guaranteed**, therefore, if making successive calls, one * @dev should consider keeping the blockheight constant to ensure a holistic picture of the contract state */ function getActiveSubscriptionIds(uint256 startIndex, uint256 maxCount) external view returns (uint256[] memory); /** * @notice Fund a subscription with native. * @param subId - ID of the subscription * @notice This method expects msg.value to be greater than or equal to 0. */ function fundSubscriptionWithNative(uint256 subId) external payable; } // File @chainlink/contracts/src/v0.8/vrf/dev/libraries/[email protected] // Original license: SPDX_License_Identifier: MIT pragma solidity ^0.8.4; // End consumer library. library VRFV2PlusClient { // extraArgs will evolve to support new features bytes4 public constant EXTRA_ARGS_V1_TAG = bytes4(keccak256("VRF ExtraArgsV1")); struct ExtraArgsV1 { bool nativePayment; } struct RandomWordsRequest { bytes32 keyHash; uint256 subId; uint16 requestConfirmations; uint32 callbackGasLimit; uint32 numWords; bytes extraArgs; } function _argsToBytes(ExtraArgsV1 memory extraArgs) internal pure returns (bytes memory bts) { return abi.encodeWithSelector(EXTRA_ARGS_V1_TAG, extraArgs); } } // File @chainlink/contracts/src/v0.8/vrf/dev/interfaces/[email protected] // Original license: SPDX_License_Identifier: MIT pragma solidity ^0.8.0; // Interface that enables consumers of VRFCoordinatorV2Plus to be future-proof for upgrades // This interface is supported by subsequent versions of VRFCoordinatorV2Plus interface IVRFCoordinatorV2Plus is IVRFSubscriptionV2Plus { /** * @notice Request a set of random words. * @param req - a struct containing following fields for randomness request: * keyHash - Corresponds to a particular oracle job which uses * that key for generating the VRF proof. Different keyHash's have different gas price * ceilings, so you can select a specific one to bound your maximum per request cost. * subId - The ID of the VRF subscription. Must be funded * with the minimum subscription balance required for the selected keyHash. * requestConfirmations - How many blocks you'd like the * oracle to wait before responding to the request. See SECURITY CONSIDERATIONS * for why you may want to request more. The acceptable range is * [minimumRequestBlockConfirmations, 200]. * callbackGasLimit - How much gas you'd like to receive in your * fulfillRandomWords callback. Note that gasleft() inside fulfillRandomWords * may be slightly less than this amount because of gas used calling the function * (argument decoding etc.), so you may need to request slightly more than you expect * to have inside fulfillRandomWords. The acceptable range is * [0, maxGasLimit] * numWords - The number of uint256 random values you'd like to receive * in your fulfillRandomWords callback. Note these numbers are expanded in a * secure way by the VRFCoordinator from a single random value supplied by the oracle. * extraArgs - abi-encoded extra args * @return requestId - A unique identifier of the request. Can be used to match * a request to a response in fulfillRandomWords. */ function requestRandomWords(VRFV2PlusClient.RandomWordsRequest calldata req) external returns (uint256 requestId); } // File @chainlink/contracts/src/v0.8/vrf/dev/interfaces/[email protected] // Original license: SPDX_License_Identifier: MIT pragma solidity ^0.8.0; /// @notice The IVRFMigratableConsumerV2Plus interface defines the /// @notice method required to be implemented by all V2Plus consumers. /// @dev This interface is designed to be used in VRFConsumerBaseV2Plus. interface IVRFMigratableConsumerV2Plus { event CoordinatorSet(address vrfCoordinator); /// @notice Sets the VRF Coordinator address /// @notice This method should only be callable by the coordinator or contract owner function setCoordinator(address vrfCoordinator) external; } // File @chainlink/contracts/src/v0.8/vrf/dev/[email protected] // Original license: SPDX_License_Identifier: MIT pragma solidity ^0.8.4; /** **************************************************************************** * @notice Interface for contracts using VRF randomness * ***************************************************************************** * @dev PURPOSE * * @dev Reggie the Random Oracle (not his real job) wants to provide randomness * @dev to Vera the verifier in such a way that Vera can be sure he's not * @dev making his output up to suit himself. Reggie provides Vera a public key * @dev to which he knows the secret key. Each time Vera provides a seed to * @dev Reggie, he gives back a value which is computed completely * @dev deterministically from the seed and the secret key. * * @dev Reggie provides a proof by which Vera can verify that the output was * @dev correctly computed once Reggie tells it to her, but without that proof, * @dev the output is indistinguishable to her from a uniform random sample * @dev from the output space. * * @dev The purpose of this contract is to make it easy for unrelated contracts * @dev to talk to Vera the verifier about the work Reggie is doing, to provide * @dev simple access to a verifiable source of randomness. It ensures 2 things: * @dev 1. The fulfillment came from the VRFCoordinatorV2Plus. * @dev 2. The consumer contract implements fulfillRandomWords. * ***************************************************************************** * @dev USAGE * * @dev Calling contracts must inherit from VRFConsumerBaseV2Plus, and can * @dev initialize VRFConsumerBaseV2Plus's attributes in their constructor as * @dev shown: * * @dev contract VRFConsumerV2Plus is VRFConsumerBaseV2Plus { * @dev constructor(<other arguments>, address _vrfCoordinator, address _subOwner) * @dev VRFConsumerBaseV2Plus(_vrfCoordinator, _subOwner) public { * @dev <initialization with other arguments goes here> * @dev } * @dev } * * @dev The oracle will have given you an ID for the VRF keypair they have * @dev committed to (let's call it keyHash). Create a subscription, fund it * @dev and your consumer contract as a consumer of it (see VRFCoordinatorInterface * @dev subscription management functions). * @dev Call requestRandomWords(keyHash, subId, minimumRequestConfirmations, * @dev callbackGasLimit, numWords, extraArgs), * @dev see (IVRFCoordinatorV2Plus for a description of the arguments). * * @dev Once the VRFCoordinatorV2Plus has received and validated the oracle's response * @dev to your request, it will call your contract's fulfillRandomWords method. * * @dev The randomness argument to fulfillRandomWords is a set of random words * @dev generated from your requestId and the blockHash of the request. * * @dev If your contract could have concurrent requests open, you can use the * @dev requestId returned from requestRandomWords to track which response is associated * @dev with which randomness request. * @dev See "SECURITY CONSIDERATIONS" for principles to keep in mind, * @dev if your contract could have multiple requests in flight simultaneously. * * @dev Colliding `requestId`s are cryptographically impossible as long as seeds * @dev differ. * * ***************************************************************************** * @dev SECURITY CONSIDERATIONS * * @dev A method with the ability to call your fulfillRandomness method directly * @dev could spoof a VRF response with any random value, so it's critical that * @dev it cannot be directly called by anything other than this base contract * @dev (specifically, by the VRFConsumerBaseV2Plus.rawFulfillRandomness method). * * @dev For your users to trust that your contract's random behavior is free * @dev from malicious interference, it's best if you can write it so that all * @dev behaviors implied by a VRF response are executed *during* your * @dev fulfillRandomness method. If your contract must store the response (or * @dev anything derived from it) and use it later, you must ensure that any * @dev user-significant behavior which depends on that stored value cannot be * @dev manipulated by a subsequent VRF request. * * @dev Similarly, both miners and the VRF oracle itself have some influence * @dev over the order in which VRF responses appear on the blockchain, so if * @dev your contract could have multiple VRF requests in flight simultaneously, * @dev you must ensure that the order in which the VRF responses arrive cannot * @dev be used to manipulate your contract's user-significant behavior. * * @dev Since the block hash of the block which contains the requestRandomness * @dev call is mixed into the input to the VRF *last*, a sufficiently powerful * @dev miner could, in principle, fork the blockchain to evict the block * @dev containing the request, forcing the request to be included in a * @dev different block with a different hash, and therefore a different input * @dev to the VRF. However, such an attack would incur a substantial economic * @dev cost. This cost scales with the number of blocks the VRF oracle waits * @dev until it calls responds to a request. It is for this reason that * @dev that you can signal to an oracle you'd like them to wait longer before * @dev responding to the request (however this is not enforced in the contract * @dev and so remains effective only in the case of unmodified oracle software). */ abstract contract VRFConsumerBaseV2Plus is IVRFMigratableConsumerV2Plus, ConfirmedOwner { error OnlyCoordinatorCanFulfill(address have, address want); error OnlyOwnerOrCoordinator(address have, address owner, address coordinator); error ZeroAddress(); // s_vrfCoordinator should be used by consumers to make requests to vrfCoordinator // so that coordinator reference is updated after migration IVRFCoordinatorV2Plus public s_vrfCoordinator; /** * @param _vrfCoordinator address of VRFCoordinator contract */ constructor(address _vrfCoordinator) ConfirmedOwner(msg.sender) { if (_vrfCoordinator == address(0)) { revert ZeroAddress(); } s_vrfCoordinator = IVRFCoordinatorV2Plus(_vrfCoordinator); } /** * @notice fulfillRandomness handles the VRF response. Your contract must * @notice implement it. See "SECURITY CONSIDERATIONS" above for important * @notice principles to keep in mind when implementing your fulfillRandomness * @notice method. * * @dev VRFConsumerBaseV2Plus expects its subcontracts to have a method with this * @dev signature, and will call it once it has verified the proof * @dev associated with the randomness. (It is triggered via a call to * @dev rawFulfillRandomness, below.) * * @param requestId The Id initially returned by requestRandomness * @param randomWords the VRF output expanded to the requested number of words */ // solhint-disable-next-line chainlink-solidity/prefix-internal-functions-with-underscore function fulfillRandomWords(uint256 requestId, uint256[] calldata randomWords) internal virtual; // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF // proof. rawFulfillRandomness then calls fulfillRandomness, after validating // the origin of the call function rawFulfillRandomWords(uint256 requestId, uint256[] calldata randomWords) external { if (msg.sender != address(s_vrfCoordinator)) { revert OnlyCoordinatorCanFulfill(msg.sender, address(s_vrfCoordinator)); } fulfillRandomWords(requestId, randomWords); } /** * @inheritdoc IVRFMigratableConsumerV2Plus */ function setCoordinator(address _vrfCoordinator) external override onlyOwnerOrCoordinator { if (_vrfCoordinator == address(0)) { revert ZeroAddress(); } s_vrfCoordinator = IVRFCoordinatorV2Plus(_vrfCoordinator); emit CoordinatorSet(_vrfCoordinator); } modifier onlyOwnerOrCoordinator() { if (msg.sender != owner() && msg.sender != address(s_vrfCoordinator)) { revert OnlyOwnerOrCoordinator(msg.sender, owner(), address(s_vrfCoordinator)); } _; } } // File @openzeppelin/contracts/utils/introspection/[email protected] // Original license: SPDX_License_Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } // File @openzeppelin/contracts/token/ERC721/[email protected] // Original license: SPDX_License_Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); } // File @uniswap/v2-periphery/contracts/interfaces/[email protected] pragma solidity >=0.6.2; interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); } // File @uniswap/v2-periphery/contracts/interfaces/[email protected] pragma solidity >=0.6.2; interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; } // File @openzeppelin/contracts/security/[email protected] // Original license: SPDX_License_Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == _ENTERED; } } // File contracts/VRFSoup.sol // Original license: SPDX_License_Identifier: MIT pragma solidity ^0.8.19; contract VRFSoup is VRFConsumerBaseV2Plus, ReentrancyGuard { event RequestSent(uint256 requestId, uint32 numWords); event RequestFulfilled(uint256 requestId, uint256[] randomWords); event LotteryEnter(address indexed player); event PlayerRegistered(address indexed player); event WinnersSelected(address payable[3] winners, uint256[] amounts); event WithdrawalMade(address indexed recipient, uint256 amount); event NewRoundStarted(uint256 indexed lotteryId); event NFTContractUpdated(address indexed newNFTContract); address public constant TOAD_ADDRESS = 0x370a366f402e2e41CDBbE54EcEC12aaE0cce1955; address public constant SOUP_KITCHEN = 0x000000000000000000000000000000000000dEaD; uint256 public constant MAXIMUM_PLAYERS = 10; uint256 public constant ENTRY_FEE = 0.01 ether; uint256 public constant FINAL_PRIZE_POOL = ENTRY_FEE * MAXIMUM_PLAYERS; uint256 public constant POINTS_PER_ENTRY = 5; struct RequestStatus { bool fulfilled; bool exists; uint256[] randomWords; } mapping(uint256 => RequestStatus) public s_requests; address payable[] public players; address payable[3] public recentWinners; uint256[] public latestRandomWords; uint256 public lotteryId; uint256 public toBurnAmount; LOTTERY_STATE public lottery_state; mapping(address => uint256) public pendingWithdrawals; mapping(address => uint256) public totalWinnings; mapping(address => uint256) public entriesCount; mapping(address => uint256) public winsCount; mapping(address => uint256) public playerPoints; address payable public immutable devAddress; address payable[7] public fundingAddresses; IUniswapV2Router02 public uniswapRouter; IERC721 public immutable nftContract; uint256 public s_subscriptionId; bytes32 public keyHash = 0x8077df514608a09f83e4e8d300645594e5d7234665448ba83f51a50f842bd3d9; uint32 public callbackGasLimit = 2500000; uint16 public requestConfirmations = 3; uint32 public numWords = 3; enum LOTTERY_STATE { OPEN, CLOSED, CALCULATING_WINNER } error Lottery__InvalidEntry(); error Lottery__MaxPlayersReached(); error Lottery__InvalidState(); error Lottery__DuplicateEntry(); error Lottery__NoWithdrawalAvailable(); error Lottery__WithdrawalFailed(); error Lottery__VRFRequestFailed(); error Lottery__NoRandomWords(); error Lottery__WinnersAlreadySelected(); error Lottery__PrizesAlreadyDistributed(); error Lottery__WinnersNotSelected(); error Lottery__NoNFTOwnership(); constructor( uint256 subscriptionId, address payable _devAddress, address payable[5] memory _fundingAddresses, address _nftContractAddress ) VRFConsumerBaseV2Plus(0xD7f86b4b8Cae7D942340FF628F82735b7a20893a) { s_subscriptionId = subscriptionId; devAddress = _devAddress; fundingAddresses = _fundingAddresses; lottery_state = LOTTERY_STATE.OPEN; uniswapRouter = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); nftContract = IERC721(_nftContractAddress); } function enter() public payable nonReentrant { // NFT ownership check if (nftContract.balanceOf(msg.sender) == 0) revert Lottery__NoNFTOwnership(); if (msg.value != ENTRY_FEE) revert Lottery__InvalidEntry(); if (lottery_state != LOTTERY_STATE.OPEN) revert Lottery__InvalidState(); if (players.length >= MAXIMUM_PLAYERS) revert Lottery__MaxPlayersReached(); for (uint256 i = 0; i < players.length; ) { if (players[i] == msg.sender) revert Lottery__DuplicateEntry(); unchecked { i++; } } bool isNewPlayer = entriesCount[msg.sender] == 0; players.push(payable(msg.sender)); entriesCount[msg.sender]++; playerPoints[msg.sender] += POINTS_PER_ENTRY; emit LotteryEnter(msg.sender); if (isNewPlayer) emit PlayerRegistered(msg.sender); if (players.length == MAXIMUM_PLAYERS) { lottery_state = LOTTERY_STATE.CALCULATING_WINNER; try this.requestRandomWords() {} catch { lottery_state = LOTTERY_STATE.OPEN; revert Lottery__VRFRequestFailed(); } } } function requestRandomWords() public returns (uint256 requestId) { requestId = s_vrfCoordinator.requestRandomWords( VRFV2PlusClient.RandomWordsRequest({ keyHash: keyHash, subId: s_subscriptionId, requestConfirmations: requestConfirmations, callbackGasLimit: callbackGasLimit, numWords: numWords, extraArgs: VRFV2PlusClient._argsToBytes( VRFV2PlusClient.ExtraArgsV1({nativePayment: false}) ) }) ); s_requests[requestId] = RequestStatus({ randomWords: new uint256[](0), exists: true, fulfilled: false }); emit RequestSent(requestId, numWords); } function fulfillRandomWords(uint256 _requestId, uint256[] calldata _randomWords) internal override { require(s_requests[_requestId].exists, "request not found"); s_requests[_requestId].fulfilled = true; s_requests[_requestId].randomWords = _randomWords; latestRandomWords = _randomWords; emit RequestFulfilled(_requestId, _randomWords); } function selectWinners() external { if (latestRandomWords.length < numWords) revert Lottery__NoRandomWords(); if (players.length != MAXIMUM_PLAYERS) revert Lottery__InvalidState(); bool[] memory used = new bool[](MAXIMUM_PLAYERS); address payable[3] memory winners; for (uint256 i = 0; i < 3; ) { uint256 index = latestRandomWords[i] % MAXIMUM_PLAYERS; while (used[index]) { index = (index + 1) % MAXIMUM_PLAYERS; } used[index] = true; winners[i] = players[index]; winsCount[players[index]]++; unchecked { i++; } } recentWinners = winners; distributePrizes(); } function distributePrizes() internal { uint256 winnersShare = (FINAL_PRIZE_POOL * 60) / 100; uint256 devShare = (FINAL_PRIZE_POOL * 5) / 100; uint256 fundingShareTotal = (FINAL_PRIZE_POOL * 30) / 100; toBurnAmount = (FINAL_PRIZE_POOL * 5) / 100; uint256 singleWinnerShare = winnersShare / 3; for (uint256 i = 0; i < 3; ) { address winner = recentWinners[i]; pendingWithdrawals[winner] += singleWinnerShare; totalWinnings[winner] += singleWinnerShare; unchecked { i++; } } pendingWithdrawals[devAddress] += devShare; totalWinnings[devAddress] += devShare; uint256 fundingPerAddress = fundingShareTotal / 7; for (uint256 i = 0; i < 5; ) { pendingWithdrawals[fundingAddresses[i]] += fundingPerAddress; totalWinnings[fundingAddresses[i]] += fundingPerAddress; unchecked { i++; } } lotteryId++; delete players; delete latestRandomWords; lottery_state = LOTTERY_STATE.OPEN; emit NewRoundStarted(lotteryId); } function burnToads() external nonReentrant { require(toBurnAmount > 0, "No funds to burn"); uint256 burnAmount = toBurnAmount; toBurnAmount = 0; address[] memory path = new address[](2); path[0] = uniswapRouter.WETH(); path[1] = TOAD_ADDRESS; uniswapRouter.swapExactETHForTokens{value: burnAmount}( 0, path, SOUP_KITCHEN, block.timestamp + 180 ); } function withdraw() public nonReentrant { uint256 amount = pendingWithdrawals[msg.sender]; if (amount == 0) revert Lottery__NoWithdrawalAvailable(); pendingWithdrawals[msg.sender] = 0; (bool success, ) = msg.sender.call{value: amount}(""); if (!success) revert Lottery__WithdrawalFailed(); emit WithdrawalMade(msg.sender, amount); } function getWinningRate(address player) public view returns (uint256) { uint256 entries = entriesCount[player]; return entries > 0 ? (winsCount[player] * 100) / entries : 0; } function getPlayerStats(address player) public view returns ( uint256 totalWon, uint256 participationCount, uint256 winRate, uint256 points ) { return ( totalWinnings[player], entriesCount[player], getWinningRate(player), playerPoints[player] ); } function getRequestStatus(uint256 _requestId) external view returns (bool fulfilled, uint256[] memory randomWords) { require(s_requests[_requestId].exists, "request not found"); RequestStatus memory request = s_requests[_requestId]; return (request.fulfilled, request.randomWords); } function getPlayers() public view returns (address payable[] memory) { return players; } }
Read Contract
ENTRY_FEE 0xf6d361cc → uint256
FINAL_PRIZE_POOL 0x5cc050c4 → uint256
MAXIMUM_PLAYERS 0x06a9ba14 → uint256
POINTS_PER_ENTRY 0xd968f51b → uint256
SOUP_KITCHEN 0x2fff297e → address
TOAD_ADDRESS 0x2a966fcb → address
callbackGasLimit 0x24f74697 → uint32
devAddress 0x3ad10ef6 → address
entriesCount 0xeafa02b4 → uint256
fundingAddresses 0x8984d769 → address
getPlayerStats 0x4fd66eae → uint256, uint256, uint256, uint256
getPlayers 0x8b5b9ccc → address[]
getRequestStatus 0xd8a4676f → bool, uint256[]
getWinningRate 0x3d359dca → uint256
keyHash 0x61728f39 → bytes32
latestRandomWords 0x42f53c3f → uint256
lotteryId 0xe580f47b → uint256
lottery_state 0x81447999 → uint8
nftContract 0xd56d229d → address
numWords 0x7ccfd7fc → uint32
owner 0x8da5cb5b → address
pendingWithdrawals 0xf3f43703 → uint256
playerPoints 0x9b211fc4 → uint256
players 0xf71d96cb → address
recentWinners 0xb3e022de → address
requestConfirmations 0xb0fb162f → uint16
s_requests 0xa168fa89 → bool, bool
s_subscriptionId 0x8ac00021 → uint256
s_vrfCoordinator 0x9eccacf6 → address
toBurnAmount 0xf9efb505 → uint256
totalWinnings 0x8b8840e0 → uint256
uniswapRouter 0x735de9f7 → address
winsCount 0x107c646a → uint256
Write Contract 9 functions
These functions modify contract state and require a wallet transaction to execute.
acceptOwnership 0x79ba5097
No parameters
burnToads 0x22911367
No parameters
enter 0xe97dcb62
No parameters
rawFulfillRandomWords 0x1fe543e3
uint256 requestId
uint256[] randomWords
requestRandomWords 0xe0c86289
No parameters
returns: uint256
selectWinners 0x1a0de74c
No parameters
setCoordinator 0x8ea98117
address _vrfCoordinator
transferOwnership 0xf2fde38b
address to
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address