Search is not available for this dataset
chain_id
uint64 1
1
| block_number
uint64 19.5M
20M
| block_hash
stringlengths 64
64
| transaction_hash
stringlengths 64
64
| deployer_address
stringlengths 40
40
| factory_address
stringlengths 40
40
| contract_address
stringlengths 40
40
| creation_bytecode
stringlengths 0
98.3k
| runtime_bytecode
stringlengths 0
49.2k
| creation_sourcecode
stringlengths 0
976k
|
---|---|---|---|---|---|---|---|---|---|
1 | 20,291,139 | f171a8cb609591c33967327467f0fc2df9c4c5a023bdc7e688cb4ca87c20ce91 | ebf500b832e4a8cf35a9a738ed0830a9c531aa123b0bc3f6b578a05da4980f7d | a0069523092d67f78c2ae0d2f3db1dfb39b5b937 | 5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f | 579181ffcd44b00d2eee15647727e1789c90170b | 60806040526001600c5534801561001557600080fd5b506040514690806052612d228239604080519182900360520182208282018252600a8352692ab734b9bbb0b8102b1960b11b6020938401528151808301835260018152603160f81b908401528151808401919091527fbfcc8ef98ffbf7b6c3fec7bf5185b566b9863e35a9d83acd49ad6824b5969738818301527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606082015260808101949094523060a0808601919091528151808603909101815260c09094019052825192019190912060035550600580546001600160a01b03191633179055612c1d806101056000396000f3fe608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429 | 608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032 | // File: contracts/interfaces/IUniswapV2Pair.sol
pragma solidity >=0.5.0;
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
// File: contracts/interfaces/IUniswapV2ERC20.sol
pragma solidity >=0.5.0;
interface IUniswapV2ERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
}
// File: contracts/libraries/SafeMath.sol
pragma solidity =0.5.16;
// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)
library SafeMath {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x, 'ds-math-add-overflow');
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x, 'ds-math-sub-underflow');
}
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');
}
}
// File: contracts/UniswapV2ERC20.sol
pragma solidity =0.5.16;
contract UniswapV2ERC20 is IUniswapV2ERC20 {
using SafeMath for uint;
string public constant name = 'Uniswap V2';
string public constant symbol = 'UNI-V2';
uint8 public constant decimals = 18;
uint public totalSupply;
mapping(address => uint) public balanceOf;
mapping(address => mapping(address => uint)) public allowance;
bytes32 public DOMAIN_SEPARATOR;
// keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
mapping(address => uint) public nonces;
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
constructor() public {
uint chainId;
assembly {
chainId := chainid
}
DOMAIN_SEPARATOR = keccak256(
abi.encode(
keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),
keccak256(bytes(name)),
keccak256(bytes('1')),
chainId,
address(this)
)
);
}
function _mint(address to, uint value) internal {
totalSupply = totalSupply.add(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(address(0), to, value);
}
function _burn(address from, uint value) internal {
balanceOf[from] = balanceOf[from].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(from, address(0), value);
}
function _approve(address owner, address spender, uint value) private {
allowance[owner][spender] = value;
emit Approval(owner, spender, value);
}
function _transfer(address from, address to, uint value) private {
balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function approve(address spender, uint value) external returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transfer(address to, uint value) external returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function transferFrom(address from, address to, uint value) external returns (bool) {
if (allowance[from][msg.sender] != uint(-1)) {
allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
}
_transfer(from, to, value);
return true;
}
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
require(deadline >= block.timestamp, 'UniswapV2: EXPIRED');
bytes32 digest = keccak256(
abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE');
_approve(owner, spender, value);
}
}
// File: contracts/libraries/Math.sol
pragma solidity =0.5.16;
// a library for performing various math operations
library Math {
function min(uint x, uint y) internal pure returns (uint z) {
z = x < y ? x : y;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
z = y;
uint x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}
// File: contracts/libraries/UQ112x112.sol
pragma solidity =0.5.16;
// a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))
// range: [0, 2**112 - 1]
// resolution: 1 / 2**112
library UQ112x112 {
uint224 constant Q112 = 2**112;
// encode a uint112 as a UQ112x112
function encode(uint112 y) internal pure returns (uint224 z) {
z = uint224(y) * Q112; // never overflows
}
// divide a UQ112x112 by a uint112, returning a UQ112x112
function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) {
z = x / uint224(y);
}
}
// File: contracts/interfaces/IERC20.sol
pragma solidity >=0.5.0;
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
}
// File: contracts/interfaces/IUniswapV2Factory.sol
pragma solidity >=0.5.0;
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
// File: contracts/interfaces/IUniswapV2Callee.sol
pragma solidity >=0.5.0;
interface IUniswapV2Callee {
function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external;
}
// File: contracts/UniswapV2Pair.sol
pragma solidity =0.5.16;
contract UniswapV2Pair is IUniswapV2Pair, UniswapV2ERC20 {
using SafeMath for uint;
using UQ112x112 for uint224;
uint public constant MINIMUM_LIQUIDITY = 10**3;
bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)')));
address public factory;
address public token0;
address public token1;
uint112 private reserve0; // uses single storage slot, accessible via getReserves
uint112 private reserve1; // uses single storage slot, accessible via getReserves
uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves
uint public price0CumulativeLast;
uint public price1CumulativeLast;
uint public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event
uint private unlocked = 1;
modifier lock() {
require(unlocked == 1, 'UniswapV2: LOCKED');
unlocked = 0;
_;
unlocked = 1;
}
function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) {
_reserve0 = reserve0;
_reserve1 = reserve1;
_blockTimestampLast = blockTimestampLast;
}
function _safeTransfer(address token, address to, uint value) private {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'UniswapV2: TRANSFER_FAILED');
}
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
constructor() public {
factory = msg.sender;
}
// called once by the factory at time of deployment
function initialize(address _token0, address _token1) external {
require(msg.sender == factory, 'UniswapV2: FORBIDDEN'); // sufficient check
token0 = _token0;
token1 = _token1;
}
// update reserves and, on the first call per block, price accumulators
function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private {
require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'UniswapV2: OVERFLOW');
uint32 blockTimestamp = uint32(block.timestamp % 2**32);
uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired
if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) {
// * never overflows, and + overflow is desired
price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed;
price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed;
}
reserve0 = uint112(balance0);
reserve1 = uint112(balance1);
blockTimestampLast = blockTimestamp;
emit Sync(reserve0, reserve1);
}
// if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k)
function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {
address feeTo = IUniswapV2Factory(factory).feeTo();
feeOn = feeTo != address(0);
uint _kLast = kLast; // gas savings
if (feeOn) {
if (_kLast != 0) {
uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1));
uint rootKLast = Math.sqrt(_kLast);
if (rootK > rootKLast) {
uint numerator = totalSupply.mul(rootK.sub(rootKLast));
uint denominator = rootK.mul(5).add(rootKLast);
uint liquidity = numerator / denominator;
if (liquidity > 0) _mint(feeTo, liquidity);
}
}
} else if (_kLast != 0) {
kLast = 0;
}
}
// this low-level function should be called from a contract which performs important safety checks
function mint(address to) external lock returns (uint liquidity) {
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
uint balance0 = IERC20(token0).balanceOf(address(this));
uint balance1 = IERC20(token1).balanceOf(address(this));
uint amount0 = balance0.sub(_reserve0);
uint amount1 = balance1.sub(_reserve1);
bool feeOn = _mintFee(_reserve0, _reserve1);
uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
if (_totalSupply == 0) {
liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY);
_mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens
} else {
liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1);
}
require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED');
_mint(to, liquidity);
_update(balance0, balance1, _reserve0, _reserve1);
if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
emit Mint(msg.sender, amount0, amount1);
}
// this low-level function should be called from a contract which performs important safety checks
function burn(address to) external lock returns (uint amount0, uint amount1) {
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
address _token0 = token0; // gas savings
address _token1 = token1; // gas savings
uint balance0 = IERC20(_token0).balanceOf(address(this));
uint balance1 = IERC20(_token1).balanceOf(address(this));
uint liquidity = balanceOf[address(this)];
bool feeOn = _mintFee(_reserve0, _reserve1);
uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution
amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution
require(amount0 > 0 && amount1 > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED');
_burn(address(this), liquidity);
_safeTransfer(_token0, to, amount0);
_safeTransfer(_token1, to, amount1);
balance0 = IERC20(_token0).balanceOf(address(this));
balance1 = IERC20(_token1).balanceOf(address(this));
_update(balance0, balance1, _reserve0, _reserve1);
if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
emit Burn(msg.sender, amount0, amount1, to);
}
// this low-level function should be called from a contract which performs important safety checks
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock {
require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT');
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
require(amount0Out < _reserve0 && amount1Out < _reserve1, 'UniswapV2: INSUFFICIENT_LIQUIDITY');
uint balance0;
uint balance1;
{ // scope for _token{0,1}, avoids stack too deep errors
address _token0 = token0;
address _token1 = token1;
require(to != _token0 && to != _token1, 'UniswapV2: INVALID_TO');
if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens
if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens
if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data);
balance0 = IERC20(_token0).balanceOf(address(this));
balance1 = IERC20(_token1).balanceOf(address(this));
}
uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0;
uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0;
require(amount0In > 0 || amount1In > 0, 'UniswapV2: INSUFFICIENT_INPUT_AMOUNT');
{ // scope for reserve{0,1}Adjusted, avoids stack too deep errors
uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3));
uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3));
require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'UniswapV2: K');
}
_update(balance0, balance1, _reserve0, _reserve1);
emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to);
}
// force balances to match reserves
function skim(address to) external lock {
address _token0 = token0; // gas savings
address _token1 = token1; // gas savings
_safeTransfer(_token0, to, IERC20(_token0).balanceOf(address(this)).sub(reserve0));
_safeTransfer(_token1, to, IERC20(_token1).balanceOf(address(this)).sub(reserve1));
}
// force reserves to match balances
function sync() external lock {
_update(IERC20(token0).balanceOf(address(this)), IERC20(token1).balanceOf(address(this)), reserve0, reserve1);
}
} |
1 | 20,291,140 | 5302f209e59b04b5c42774a81afbcd6ed07231d1fed3a00e06b28ca9e833f9d7 | 6340ef6fb73f5e8abe8f288cd3de6e7dd98781787ab1a364d8b687a64159d7d2 | d24400ae8bfebb18ca49be86258a3c749cf46853 | 485b9a41e8bf06e57bb64c6ba7cb04f9d53d2d76 | cf264f9ed8d311730ffa360925ef93e5ba9d028c | 3d602d80600a3d3981f3363d3d373d3d3d363d7339778bc77bd7a9456655b19fd4c5d0bf2071104e5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7339778bc77bd7a9456655b19fd4c5d0bf2071104e5af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,144 | 095bff61c89529225d085fa4fd618fe249544abb418229c91ef0227d67cd81c6 | 26f0530344896d2ec0366dbe51b01d31085b6c0f10da9d4c39bd9c6c65e45dc8 | d1ae7f25ace194df69eef015a37c5eb9ed6b8733 | d1ae7f25ace194df69eef015a37c5eb9ed6b8733 | ad2b30ecbd960e5fc8846fdd30f9261cacfb6cdc | 61014080604052346200054b5760e081620027dc80380380916200002482856200066d565b8339810103126200054b576200003a8162000691565b90620000496020820162000691565b620000576040830162000691565b91620000666060820162000691565b9060808101519260c060a08301519201519560805260a0526200008984620007c4565b8060c052600052600060205260406000209260018060a01b038516938460018060a01b031982541617905560036020526040600020556040519360208560048163313ce56760e01b978882525afa948515620005725760009562000642575b50620001119060c0516000526001602052604060002060ff8019971687825416179055620006f3565b6200011c82620007c4565b8060e05260005260036020526040600020556000602052602060406000209260018060a01b038316938460018060a01b031982541617905560046040518095819382525afa8015620005725762000198926000916200060c575b5060e051600052600160205260ff6040600020911684825416179055620006f3565b60a0516040805163f6c0092760e01b8152600481019490945290839060249082906001600160a01b03165afa9081156200057257600091620005b7575b6001600160a01b038216610120819052620002309350620001f683620007c4565b8061010052600052600060205260406000209060018060a01b031982541617905560016020526012604060002091825416179055620006f3565b60a0516101205160405163038fff2d60e41b81526001600160a01b0392831692909160209183916004918391165afa801562000572576000906200057e575b60009150602460405180948193631f29a8cd60e31b835260048301525afa90811562000572576000916200043b575b5060005b81518110156200033657600581901b820160200151600280549092916001600160a01b031690680100000000000000008110156200032057600181018085558110156200030a5760019360005260206000200190838060a01b031982541617905501620002a2565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b604051611fd290816200080a8239608051818181610238015281816102f9015281816103fc0152818161052b0152818161059c0152610ab8015260a051818181610374015281816108e20152818161096a01528181610b7801528181610c090152818161119501528181611228015281816115a70152611638015260c0518181816119750152611d87015260e0518181816103b001528181611e5701528181611ea901528181611ed20152611f050152610100518181816119af01528181611de30152611e800152610120518181816106a901528181610f38015281816110d90152818161114d015281816112a1015281816114320152818161155f01526118b60152f35b3d9150816000823e6200044f82826200066d565b60608183810103126200054b578051916001600160401b0383116200054b57808201601f8484010112156200054b57828201516200048d81620006c1565b936200049d60405195866200066d565b81855260208086019260051b82860101019083850182116200054b578401602001915b818310620005505750505060208201516001600160401b0381116200054b578201818301601f820112156200054b578051916020806200050085620006c1565b6200050f60405191826200066d565b858152019360051b830101930183116200054b57602001905b8282106200053a57505050386200029e565b815181526020918201910162000528565b600080fd5b82516001600160a01b03811681036200054b57815260209283019201620004c0565b6040513d6000823e3d90fd5b506020813d602011620005ae575b816200059b602093836200066d565b810103126200054b57600090516200026f565b3d91506200058c565b90506040823d60401162000603575b81620005d5604093836200066d565b810103126200054b5760036020620005ed8462000691565b93015110156200054b57620002309190620001d5565b3d9150620005c6565b62000633915060203d6020116200063a575b6200062a81836200066d565b810190620006a6565b3862000176565b503d6200061e565b62000111919550620006659060203d6020116200063a576200062a81836200066d565b9490620000e8565b601f909101601f19168101906001600160401b038211908210176200032057604052565b51906001600160a01b03821682036200054b57565b908160209103126200054b575160ff811681036200054b5790565b6001600160401b038111620003205760051b60200190565b908160209103126200054b575180151581036200054b5790565b60805160405163095ea7b360e01b8082526001600160a01b039283166004830152600019602483018190526020949093929083169185826044816000875af1801562000572578694604493600092620007a2575b5060a051169360405196879586948552600485015260248401525af18015620005725762000773575050565b816200079792903d106200079a575b6200078e81836200066d565b810190620006d9565b50565b503d62000782565b620007bc90873d89116200079a576200078e81836200066d565b503862000747565b604051606091821b6001600160601b03191660208201908152600060348084019190915282529181016001600160401b0381118282101762000320576040525190209056fe608080604052600436101561001d575b50361561001b57600080fd5b005b600090813560e01c9081630242d7121461199857508063088b699e1461195d578063150b7a02146118da57806316f0115b1461188957806319b88edb1461186c5780633f47e6621461183f5780633fc20d4f146103d357806349bfcca1146103985780637e7701e31461034757806391ac7e651461031d578063a6ec335f146102cc578063cf35bdd014610261578063e92ebd3a1461020d578063f23a6e611461010c5763f8fdeb680361000f57346101095760206003193601126101095773ffffffffffffffffffffffffffffffffffffffff60406020926004358152808452205416604051908152f35b80fd5b50346101095760a0600319360112610109576101266119d2565b5061012f6119f5565b5060843567ffffffffffffffff80821161020957366023830112156102095781600401359081116101da5760405161018f60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8501160182611abf565b81815236602483850101116101d657816024602094018483013701015260206040517ff23a6e61000000000000000000000000000000000000000000000000000000008152f35b8380fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b8280fd5b50346101095761021c36611a18565b505050505073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001633036101095780fd5b5034610109576020600319360112610109576004356002548110156102c85773ffffffffffffffffffffffffffffffffffffffff906002602093527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace015416604051908152f35b5080fd5b5034610109578060031936011261010957602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b50346101095760206003193601126101095760406020916004358152600383522054604051908152f35b5034610109578060031936011261010957602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b503461010957806003193601126101095760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b5034610109576103e236611a18565b91905073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016330361183b578385528460205261051160807f010000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff60408920541617604051602081019182526020815261048281611aa3565b5190519060208110611829575b506040519061049d82611a57565b81526020810188815260408083018a8152606084018781528585018c905291517f739653ba00000000000000000000000000000000000000000000000000000000815284516004820152925160248401525160448301525160648201526080909101516084820152918290819060a4820190565b03818973ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165af180156117fe57611809575b506040517f8fec800900000000000000000000000000000000000000000000000000000000815260208160048173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165afa80156117fe5786906117c6575b6105d6915082611b22565b9084865260016020526105fa60ff6040882054166105f48484611b2c565b90611f39565b905082018092116113a2579061060f91611b2c565b83855260016020526106288160ff604088205416611f39565b50936106348482611d85565b81875260036020526040872054958588526040882054966002549760038410159889610e0a5760018503610ea357505050604051907f38fff2d000000000000000000000000000000000000000000000000000000000825260208260048173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165afa918215610e98578992610e64575b508389528860205273ffffffffffffffffffffffffffffffffffffffff60408a20541690878a5273ffffffffffffffffffffffffffffffffffffffff60408b2054166040519283602081011067ffffffffffffffff6020860111176101da57602084016040528b8452604051948560c081011067ffffffffffffffff60c0880111176101da5760c0860160405285528b602086015260408501526060840152608083015260a082015260405161078e81611a73565b30815288602082015230604082015288606082015261012c42014211610e3757604051917f52bbbe2900000000000000000000000000000000000000000000000000000000835260e06004840152805160e484015260208101516002811015610e0a57602092606061086660a08795869561010487015273ffffffffffffffffffffffffffffffffffffffff60408201511661012487015273ffffffffffffffffffffffffffffffffffffffff84820151166101448701526080810151610164870152015160c06101848601526101a4850190611c9c565b9173ffffffffffffffffffffffffffffffffffffffff8151166024850152858101511515604485015273ffffffffffffffffffffffffffffffffffffffff60408201511660648501520151151560848301528860a483015261012c420160c483015203818b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165af1908115610dff578891610dc8575b505b8588526001602052604088205460ff16600060128203610cb8575050955b868511610c8e57610c61578592919060018103610b3f57506040805191825260208201929092529081019190915260608101919091527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166080820152600160a08201527f976ffbca84869d39bddd7057048dffc33e97641e3c7fe06fd7fc2b039c17b6e59060c090a15b825281602052610a9e608073ffffffffffffffffffffffffffffffffffffffff6040852054166040516020810191825260208152610a0f81611aa3565b5190519060208110610b2d575b5060405190610a2a82611a57565b81526020810185815260408083018781526060840187815285850189905291517f739653ba00000000000000000000000000000000000000000000000000000000815284516004820152925160248401525160448301525160648201526080909101516084820152918290819060a4820190565b03818673ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165af18015610b225760209350610af2575b50604051908152f35b610b139060803d608011610b1b575b610b0b8183611abf565b810190611b00565b505050610ae9565b503d610b01565b6040513d85823e3d90fd5b6000199060200360031b1b1638610a1c565b610bd45760408051918252602082019290925290810191909152606081019190915273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000166080820152600160a08201527f884d9201fa8b7681d1481b193805aec6deb56538f54e2abef3286e2c5bf28ff3908060c081015b0390a16109d2565b50604080518581526020810192909252810185905260608101929092525073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000166080820152600160a08201527f2e0d08763feb8b33376106fd02b993cd22509e7a3381381573d3c80818c27509908060c08101610bcc565b6024877f4e487b710000000000000000000000000000000000000000000000000000000081526021600452fd5b60046040517f66516a6e000000000000000000000000000000000000000000000000000000008152fd5b6012821015610d1f575060120360ff8111610cf05760ff610cd99116611f2b565b90818102918183041490151715610cf05795610932565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffee90989298019060ff8211610d9b5750610d5f60ff610d669216611f2b565b8098611b22565b96610932575b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b807f4e487b7100000000000000000000000000000000000000000000000000000000602492526011600452fd5b90506020813d602011610df7575b81610de360209383611abf565b81010312610df2575138610912565b600080fd5b3d9150610dd6565b6040513d8a823e3d90fd5b60248b7f4e487b710000000000000000000000000000000000000000000000000000000081526021600452fd5b6024897f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b9091506020813d602011610e90575b81610e8060209383611abf565b81010312610df2575190386106d9565b3d9150610e73565b6040513d8b823e3d90fd5b909592919980979499509794979589156000146113cf5750610ec7610ece91611b51565b998a611ba0565b528751806000198101116113a257600019610ee99101611b51565b95855b8751811015611006576040517f82687a5600000000000000000000000000000000000000000000000000000000815260208160048173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165afa908115610dff578891610fd4575b50811015610f905780610f7e6001925b8c611ba0565b51610f89828b611ba0565b5201610eec565b60018101808211610fa75790610f7e600192610f78565b6024887f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b90506020813d602011610ffe575b81610fef60209383611abf565b81010312610df2575138610f68565b3d9150610fe2565b509295611067611035919992959893969960405192839160016020840152606060408401526080830190611c68565b886060830152037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101835282611abf565b6040519161107483611a73565b61107c611be3565b83526020830152604082015287606082015287604051917f70a0823100000000000000000000000000000000000000000000000000000000835230600484015260208360248173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165afa92831561132b57829361136b575b506040517f38fff2d000000000000000000000000000000000000000000000000000000000815260208160048173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165afa908115610b22578391611336575b5073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000163b156102095761120e91839160405193849283927fb95cac280000000000000000000000000000000000000000000000000000000084526004840152306024840152306044840152608060648401526084830190611cfa565b03818373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165af1801561132b57611313575b5050604051907f70a0823100000000000000000000000000000000000000000000000000000000825230600483015260208260248173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165afa8015610e985789906112df575b6112da9250611b2c565b610914565b506020823d60201161130b575b816112f960209383611abf565b81010312610df2576112da91516112d0565b3d91506112ec565b61131c90611a8f565b611327578738611255565b8780fd5b6040513d84823e3d90fd5b9250506020823d602011611363575b8161135260209383611abf565b81010312610df2578991513861117d565b3d9150611345565b915091506020813d60201161139a575b8161138860209383611abf565b81010312610df2578890519138611109565b3d915061137b565b6024867f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b929598939699506113e290979497611b51565b91866113ee8285611ba0565b526040517f82687a5600000000000000000000000000000000000000000000000000000000815260208160048173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165afa9081156117bb578b91611785575b50811015611744575b604051918a6020840152604083015260608201526060815261148c81611a73565b6040519161149983611a73565b6114a1611be3565b8352602083015260408201528760608201528588528760205273ffffffffffffffffffffffffffffffffffffffff604089205416604051917f70a08231000000000000000000000000000000000000000000000000000000008352306004840152602083602481855afa9283156116cd578a9361170c575b5089604051917f38fff2d000000000000000000000000000000000000000000000000000000000835260208360048173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165afa92831561132b5782936116d8575b5073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000163b156102c85761161e9260405193849283927f8bdb39130000000000000000000000000000000000000000000000000000000084526004840152306024840152306044840152608060648401526084830190611cfa565b03818373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165af180156116cd576116b4575b50906020602492604051938480927f70a082310000000000000000000000000000000000000000000000000000000082523060048301525afa8015610e985789906112df576112da9250611b2c565b60249291996116c4602092611a8f565b99919250611665565b6040513d8c823e3d90fd5b9092506020813d602011611704575b816116f460209383611abf565b810103126102c85751913861158f565b3d91506116e7565b9092506020813d60201161173c575b8161172860209383611abf565b8101031261173857519138611519565b8980fd5b3d915061171b565b80600019810111611758576000190161146b565b60248a7f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b90506020813d6020116117b3575b816117a060209383611abf565b810103126117af575138611462565b8a80fd5b3d9150611793565b6040513d8d823e3d90fd5b506020813d6020116117f6575b816117e060209383611abf565b810103126117f2576105d690516105cb565b8580fd5b3d91506117d3565b6040513d88823e3d90fd5b6118219060803d608011610b1b57610b0b8183611abf565b505050610558565b6000199060200360031b1b163861048f565b8480fd5b50346101095760206003193601126101095760ff6040602092600435815260018452205416604051908152f35b503461010957602060031936011261010957602090604051908152f35b5034610109578060031936011261010957602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b5034610109576080600319360112610109576118f46119d2565b506118fd6119f5565b5060643567ffffffffffffffff808211610209573660238301121561020957816004013590811161020957369101602401116101095760206040517f150b7a02000000000000000000000000000000000000000000000000000000008152f35b503461010957806003193601126101095760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b9050346102c857816003193601126102c8576020907f00000000000000000000000000000000000000000000000000000000000000008152f35b6004359073ffffffffffffffffffffffffffffffffffffffff82168203610df257565b6024359073ffffffffffffffffffffffffffffffffffffffff82168203610df257565b60031960a0910112610df25760043590602435906044359060643573ffffffffffffffffffffffffffffffffffffffff81168103610df2579060843590565b60a0810190811067ffffffffffffffff8211176101da57604052565b6080810190811067ffffffffffffffff8211176101da57604052565b67ffffffffffffffff81116101da57604052565b6040810190811067ffffffffffffffff8211176101da57604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176101da57604052565b9190826080910312610df2578151916020810151916060604083015192015190565b8115610d6c570490565b91908203918211610cf057565b67ffffffffffffffff81116101da5760051b60200190565b90611b5b82611b39565b611b686040519182611abf565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0611b968294611b39565b0190602036910137565b8051821015611bb45760209160051b010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60405190600254808352826020918282019060026000527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace936000905b828210611c3857505050611c3692500383611abf565b565b855473ffffffffffffffffffffffffffffffffffffffff1684526001958601958895509381019390910190611c20565b90815180825260208080930193019160005b828110611c88575050505090565b835185529381019392810192600101611c7a565b919082519283825260005b848110611ce65750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006020809697860101520116010190565b602081830181015184830182015201611ca7565b9060808101825160808352805180925260a083019160208092019060005b818110611d5b57505050611d50611d3e6060938385948801519087830390880152611c68565b60408601518582036040870152611c9c565b930151151591015290565b825173ffffffffffffffffffffffffffffffffffffffff1685529383019391830191600101611d18565b7f000000000000000000000000000000000000000000000000000000000000000091908281148080611f02575b8015611ecf575b15611dc75750505050600190565b8015611ea6575b80611e7d575b15611de157505050600090565b7f0000000000000000000000000000000000000000000000000000000000000000149182611e40575b505015611e1657600290565b60046040517fd9dd971c000000000000000000000000000000000000000000000000000000008152fd5b811491508115611e53575b503880611e0a565b90507f00000000000000000000000000000000000000000000000000000000000000001438611e4b565b507f00000000000000000000000000000000000000000000000000000000000000008214611dd4565b507f00000000000000000000000000000000000000000000000000000000000000008114611dce565b507f000000000000000000000000000000000000000000000000000000000000000082148015611db95750838314611db9565b507f00000000000000000000000000000000000000000000000000000000000000008314611db2565b604d8111610cf057600a0a90565b60ff1660128103611f4b575090600090565b80601210600014611fa3577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffee0160ff8111610cf05760ff611f8c9116611f2b565b90818102918183041490151715610cf05790600090565b60129291920360ff8111610cf05760ff611fbd9116611f2b565b611fc78184611b22565b928115610d6c5706905600000000000000000000000010597c960343213b947674e103c15b41c9f94f22000000000000000000000000ba12222222228d8ba445958a75a0704d566bf2c8000000000000000000000000a1290d69c65a6fe4df752f95823fae25cb99e5a7000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000258aadfb1afac0ad7fca1148f3cde6aedf5236b6d00000000000000000000067f | 608080604052600436101561001d575b50361561001b57600080fd5b005b600090813560e01c9081630242d7121461199857508063088b699e1461195d578063150b7a02146118da57806316f0115b1461188957806319b88edb1461186c5780633f47e6621461183f5780633fc20d4f146103d357806349bfcca1146103985780637e7701e31461034757806391ac7e651461031d578063a6ec335f146102cc578063cf35bdd014610261578063e92ebd3a1461020d578063f23a6e611461010c5763f8fdeb680361000f57346101095760206003193601126101095773ffffffffffffffffffffffffffffffffffffffff60406020926004358152808452205416604051908152f35b80fd5b50346101095760a0600319360112610109576101266119d2565b5061012f6119f5565b5060843567ffffffffffffffff80821161020957366023830112156102095781600401359081116101da5760405161018f60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8501160182611abf565b81815236602483850101116101d657816024602094018483013701015260206040517ff23a6e61000000000000000000000000000000000000000000000000000000008152f35b8380fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b8280fd5b50346101095761021c36611a18565b505050505073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000010597c960343213b947674e103c15b41c9f94f221633036101095780fd5b5034610109576020600319360112610109576004356002548110156102c85773ffffffffffffffffffffffffffffffffffffffff906002602093527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace015416604051908152f35b5080fd5b5034610109578060031936011261010957602060405173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000010597c960343213b947674e103c15b41c9f94f22168152f35b50346101095760206003193601126101095760406020916004358152600383522054604051908152f35b5034610109578060031936011261010957602060405173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000ba12222222228d8ba445958a75a0704d566bf2c8168152f35b503461010957806003193601126101095760206040517f0f46498815660c285e81f4c96af30b3f9fc2c23c902034b65fa5de9511bebdce8152f35b5034610109576103e236611a18565b91905073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000010597c960343213b947674e103c15b41c9f94f2216330361183b578385528460205261051160807f010000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff60408920541617604051602081019182526020815261048281611aa3565b5190519060208110611829575b506040519061049d82611a57565b81526020810188815260408083018a8152606084018781528585018c905291517f739653ba00000000000000000000000000000000000000000000000000000000815284516004820152925160248401525160448301525160648201526080909101516084820152918290819060a4820190565b03818973ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000010597c960343213b947674e103c15b41c9f94f22165af180156117fe57611809575b506040517f8fec800900000000000000000000000000000000000000000000000000000000815260208160048173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000010597c960343213b947674e103c15b41c9f94f22165afa80156117fe5786906117c6575b6105d6915082611b22565b9084865260016020526105fa60ff6040882054166105f48484611b2c565b90611f39565b905082018092116113a2579061060f91611b2c565b83855260016020526106288160ff604088205416611f39565b50936106348482611d85565b81875260036020526040872054958588526040882054966002549760038410159889610e0a5760018503610ea357505050604051907f38fff2d000000000000000000000000000000000000000000000000000000000825260208260048173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000058aadfb1afac0ad7fca1148f3cde6aedf5236b6d165afa918215610e98578992610e64575b508389528860205273ffffffffffffffffffffffffffffffffffffffff60408a20541690878a5273ffffffffffffffffffffffffffffffffffffffff60408b2054166040519283602081011067ffffffffffffffff6020860111176101da57602084016040528b8452604051948560c081011067ffffffffffffffff60c0880111176101da5760c0860160405285528b602086015260408501526060840152608083015260a082015260405161078e81611a73565b30815288602082015230604082015288606082015261012c42014211610e3757604051917f52bbbe2900000000000000000000000000000000000000000000000000000000835260e06004840152805160e484015260208101516002811015610e0a57602092606061086660a08795869561010487015273ffffffffffffffffffffffffffffffffffffffff60408201511661012487015273ffffffffffffffffffffffffffffffffffffffff84820151166101448701526080810151610164870152015160c06101848601526101a4850190611c9c565b9173ffffffffffffffffffffffffffffffffffffffff8151166024850152858101511515604485015273ffffffffffffffffffffffffffffffffffffffff60408201511660648501520151151560848301528860a483015261012c420160c483015203818b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000ba12222222228d8ba445958a75a0704d566bf2c8165af1908115610dff578891610dc8575b505b8588526001602052604088205460ff16600060128203610cb8575050955b868511610c8e57610c61578592919060018103610b3f57506040805191825260208201929092529081019190915260608101919091527f000000000000000000000000ba12222222228d8ba445958a75a0704d566bf2c873ffffffffffffffffffffffffffffffffffffffff166080820152600160a08201527f976ffbca84869d39bddd7057048dffc33e97641e3c7fe06fd7fc2b039c17b6e59060c090a15b825281602052610a9e608073ffffffffffffffffffffffffffffffffffffffff6040852054166040516020810191825260208152610a0f81611aa3565b5190519060208110610b2d575b5060405190610a2a82611a57565b81526020810185815260408083018781526060840187815285850189905291517f739653ba00000000000000000000000000000000000000000000000000000000815284516004820152925160248401525160448301525160648201526080909101516084820152918290819060a4820190565b03818673ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000010597c960343213b947674e103c15b41c9f94f22165af18015610b225760209350610af2575b50604051908152f35b610b139060803d608011610b1b575b610b0b8183611abf565b810190611b00565b505050610ae9565b503d610b01565b6040513d85823e3d90fd5b6000199060200360031b1b1638610a1c565b610bd45760408051918252602082019290925290810191909152606081019190915273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000ba12222222228d8ba445958a75a0704d566bf2c8166080820152600160a08201527f884d9201fa8b7681d1481b193805aec6deb56538f54e2abef3286e2c5bf28ff3908060c081015b0390a16109d2565b50604080518581526020810192909252810185905260608101929092525073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000ba12222222228d8ba445958a75a0704d566bf2c8166080820152600160a08201527f2e0d08763feb8b33376106fd02b993cd22509e7a3381381573d3c80818c27509908060c08101610bcc565b6024877f4e487b710000000000000000000000000000000000000000000000000000000081526021600452fd5b60046040517f66516a6e000000000000000000000000000000000000000000000000000000008152fd5b6012821015610d1f575060120360ff8111610cf05760ff610cd99116611f2b565b90818102918183041490151715610cf05795610932565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffee90989298019060ff8211610d9b5750610d5f60ff610d669216611f2b565b8098611b22565b96610932575b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b807f4e487b7100000000000000000000000000000000000000000000000000000000602492526011600452fd5b90506020813d602011610df7575b81610de360209383611abf565b81010312610df2575138610912565b600080fd5b3d9150610dd6565b6040513d8a823e3d90fd5b60248b7f4e487b710000000000000000000000000000000000000000000000000000000081526021600452fd5b6024897f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b9091506020813d602011610e90575b81610e8060209383611abf565b81010312610df2575190386106d9565b3d9150610e73565b6040513d8b823e3d90fd5b909592919980979499509794979589156000146113cf5750610ec7610ece91611b51565b998a611ba0565b528751806000198101116113a257600019610ee99101611b51565b95855b8751811015611006576040517f82687a5600000000000000000000000000000000000000000000000000000000815260208160048173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000058aadfb1afac0ad7fca1148f3cde6aedf5236b6d165afa908115610dff578891610fd4575b50811015610f905780610f7e6001925b8c611ba0565b51610f89828b611ba0565b5201610eec565b60018101808211610fa75790610f7e600192610f78565b6024887f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b90506020813d602011610ffe575b81610fef60209383611abf565b81010312610df2575138610f68565b3d9150610fe2565b509295611067611035919992959893969960405192839160016020840152606060408401526080830190611c68565b886060830152037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101835282611abf565b6040519161107483611a73565b61107c611be3565b83526020830152604082015287606082015287604051917f70a0823100000000000000000000000000000000000000000000000000000000835230600484015260208360248173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000058aadfb1afac0ad7fca1148f3cde6aedf5236b6d165afa92831561132b57829361136b575b506040517f38fff2d000000000000000000000000000000000000000000000000000000000815260208160048173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000058aadfb1afac0ad7fca1148f3cde6aedf5236b6d165afa908115610b22578391611336575b5073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000ba12222222228d8ba445958a75a0704d566bf2c8163b156102095761120e91839160405193849283927fb95cac280000000000000000000000000000000000000000000000000000000084526004840152306024840152306044840152608060648401526084830190611cfa565b03818373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000ba12222222228d8ba445958a75a0704d566bf2c8165af1801561132b57611313575b5050604051907f70a0823100000000000000000000000000000000000000000000000000000000825230600483015260208260248173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000058aadfb1afac0ad7fca1148f3cde6aedf5236b6d165afa8015610e985789906112df575b6112da9250611b2c565b610914565b506020823d60201161130b575b816112f960209383611abf565b81010312610df2576112da91516112d0565b3d91506112ec565b61131c90611a8f565b611327578738611255565b8780fd5b6040513d84823e3d90fd5b9250506020823d602011611363575b8161135260209383611abf565b81010312610df2578991513861117d565b3d9150611345565b915091506020813d60201161139a575b8161138860209383611abf565b81010312610df2578890519138611109565b3d915061137b565b6024867f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b929598939699506113e290979497611b51565b91866113ee8285611ba0565b526040517f82687a5600000000000000000000000000000000000000000000000000000000815260208160048173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000058aadfb1afac0ad7fca1148f3cde6aedf5236b6d165afa9081156117bb578b91611785575b50811015611744575b604051918a6020840152604083015260608201526060815261148c81611a73565b6040519161149983611a73565b6114a1611be3565b8352602083015260408201528760608201528588528760205273ffffffffffffffffffffffffffffffffffffffff604089205416604051917f70a08231000000000000000000000000000000000000000000000000000000008352306004840152602083602481855afa9283156116cd578a9361170c575b5089604051917f38fff2d000000000000000000000000000000000000000000000000000000000835260208360048173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000058aadfb1afac0ad7fca1148f3cde6aedf5236b6d165afa92831561132b5782936116d8575b5073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000ba12222222228d8ba445958a75a0704d566bf2c8163b156102c85761161e9260405193849283927f8bdb39130000000000000000000000000000000000000000000000000000000084526004840152306024840152306044840152608060648401526084830190611cfa565b03818373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000ba12222222228d8ba445958a75a0704d566bf2c8165af180156116cd576116b4575b50906020602492604051938480927f70a082310000000000000000000000000000000000000000000000000000000082523060048301525afa8015610e985789906112df576112da9250611b2c565b60249291996116c4602092611a8f565b99919250611665565b6040513d8c823e3d90fd5b9092506020813d602011611704575b816116f460209383611abf565b810103126102c85751913861158f565b3d91506116e7565b9092506020813d60201161173c575b8161172860209383611abf565b8101031261173857519138611519565b8980fd5b3d915061171b565b80600019810111611758576000190161146b565b60248a7f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b90506020813d6020116117b3575b816117a060209383611abf565b810103126117af575138611462565b8a80fd5b3d9150611793565b6040513d8d823e3d90fd5b506020813d6020116117f6575b816117e060209383611abf565b810103126117f2576105d690516105cb565b8580fd5b3d91506117d3565b6040513d88823e3d90fd5b6118219060803d608011610b1b57610b0b8183611abf565b505050610558565b6000199060200360031b1b163861048f565b8480fd5b50346101095760206003193601126101095760ff6040602092600435815260018452205416604051908152f35b503461010957602060031936011261010957602090604051908152f35b5034610109578060031936011261010957602060405173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000058aadfb1afac0ad7fca1148f3cde6aedf5236b6d168152f35b5034610109576080600319360112610109576118f46119d2565b506118fd6119f5565b5060643567ffffffffffffffff808211610209573660238301121561020957816004013590811161020957369101602401116101095760206040517f150b7a02000000000000000000000000000000000000000000000000000000008152f35b503461010957806003193601126101095760206040517fe479b49d91ff2381b7a2f7d8f50a0204d923e601faa59df139000b76d72698058152f35b9050346102c857816003193601126102c8576020907f7b8d34b9273f41f906bfbe3d95c62f1bb9bdce81f73ca41864767f33f2ca0d2c8152f35b6004359073ffffffffffffffffffffffffffffffffffffffff82168203610df257565b6024359073ffffffffffffffffffffffffffffffffffffffff82168203610df257565b60031960a0910112610df25760043590602435906044359060643573ffffffffffffffffffffffffffffffffffffffff81168103610df2579060843590565b60a0810190811067ffffffffffffffff8211176101da57604052565b6080810190811067ffffffffffffffff8211176101da57604052565b67ffffffffffffffff81116101da57604052565b6040810190811067ffffffffffffffff8211176101da57604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176101da57604052565b9190826080910312610df2578151916020810151916060604083015192015190565b8115610d6c570490565b91908203918211610cf057565b67ffffffffffffffff81116101da5760051b60200190565b90611b5b82611b39565b611b686040519182611abf565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0611b968294611b39565b0190602036910137565b8051821015611bb45760209160051b010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60405190600254808352826020918282019060026000527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace936000905b828210611c3857505050611c3692500383611abf565b565b855473ffffffffffffffffffffffffffffffffffffffff1684526001958601958895509381019390910190611c20565b90815180825260208080930193019160005b828110611c88575050505090565b835185529381019392810192600101611c7a565b919082519283825260005b848110611ce65750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006020809697860101520116010190565b602081830181015184830182015201611ca7565b9060808101825160808352805180925260a083019160208092019060005b818110611d5b57505050611d50611d3e6060938385948801519087830390880152611c68565b60408601518582036040870152611c9c565b930151151591015290565b825173ffffffffffffffffffffffffffffffffffffffff1685529383019391830191600101611d18565b7fe479b49d91ff2381b7a2f7d8f50a0204d923e601faa59df139000b76d726980591908281148080611f02575b8015611ecf575b15611dc75750505050600190565b8015611ea6575b80611e7d575b15611de157505050600090565b7f7b8d34b9273f41f906bfbe3d95c62f1bb9bdce81f73ca41864767f33f2ca0d2c149182611e40575b505015611e1657600290565b60046040517fd9dd971c000000000000000000000000000000000000000000000000000000008152fd5b811491508115611e53575b503880611e0a565b90507f0f46498815660c285e81f4c96af30b3f9fc2c23c902034b65fa5de9511bebdce1438611e4b565b507f7b8d34b9273f41f906bfbe3d95c62f1bb9bdce81f73ca41864767f33f2ca0d2c8214611dd4565b507f0f46498815660c285e81f4c96af30b3f9fc2c23c902034b65fa5de9511bebdce8114611dce565b507f0f46498815660c285e81f4c96af30b3f9fc2c23c902034b65fa5de9511bebdce82148015611db95750838314611db9565b507f0f46498815660c285e81f4c96af30b3f9fc2c23c902034b65fa5de9511bebdce8314611db2565b604d8111610cf057600a0a90565b60ff1660128103611f4b575090600090565b80601210600014611fa3577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffee0160ff8111610cf05760ff611f8c9116611f2b565b90818102918183041490151715610cf05790600090565b60129291920360ff8111610cf05760ff611fbd9116611f2b565b611fc78184611b22565b928115610d6c57069056 | {{
"language": "Solidity",
"sources": {
"src/adapters/BalancerAdapter.sol": {
"content": "// SPDX-License-Identifier: MIT\n// Cowri Labs Inc.\n\npragma solidity ^0.8.19;\n\nimport { IERC20Metadata } from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport \"./OceanAdapter.sol\";\nimport \"../interfaces/IBalancerVault.sol\";\n\nenum ComputeType {\n Deposit,\n Swap,\n Withdraw\n}\n\n/**\n * @notice\n * balancer adapter to do swaps/deposits and withdrawals through balancer\n */\ncontract BalancerAdapter is OceanAdapter {\n /////////////////////////////////////////////////////////////////////\n // Errors //\n /////////////////////////////////////////////////////////////////////\n error INVALID_COMPUTE_TYPE();\n error SLIPPAGE_LIMIT_EXCEEDED();\n\n /////////////////////////////////////////////////////////////////////\n // Events //\n /////////////////////////////////////////////////////////////////////\n event Swap(uint256 inputToken, uint256 inputAmount, uint256 outputAmount, bytes32 slippageProtection, address user, bool computeOutput);\n event Deposit(uint256 inputToken, uint256 inputAmount, uint256 outputAmount, bytes32 slippageProtection, address user, bool computeOutput);\n event Withdraw(uint256 outputToken, uint256 inputAmount, uint256 outputAmount, bytes32 slippageProtection, address user, bool computeOutput);\n\n /// @notice x token Ocean ID.\n uint256 public immutable xToken;\n\n /// @notice y token Ocean ID.\n uint256 public immutable yToken;\n\n /// @notice lp token Ocean ID.\n uint256 public immutable lpTokenId;\n\n /// @notice pool address\n IPool public immutable pool;\n\n /// @notice pool asset list\n IAsset[] public assets;\n\n /// @notice map token Ocean IDs to corresponding Curve pool indices\n mapping(uint256 => uint256) public indexOf;\n\n //*********************************************************************//\n // ---------------------------- constructor -------------------------- //\n //*********************************************************************//\n\n /**\n * @notice only initializing the immutables, mappings & approves tokens\n */\n constructor(address ocean_, address primitive_, address underlyingTokenX_, address underlyingTokenY_, uint256 tokenXIndex_, uint256 tokenYIndex_, bytes32 poolId_) OceanAdapter(ocean_, primitive_) {\n address xTokenAddress = underlyingTokenX_;\n xToken = _calculateOceanId(xTokenAddress, 0);\n underlying[xToken] = xTokenAddress;\n indexOf[xToken] = tokenXIndex_;\n decimals[xToken] = IERC20Metadata(xTokenAddress).decimals();\n _approveToken(xTokenAddress);\n\n address yTokenAddress = underlyingTokenY_;\n yToken = _calculateOceanId(yTokenAddress, 0);\n indexOf[yToken] = tokenYIndex_;\n underlying[yToken] = yTokenAddress;\n decimals[yToken] = IERC20Metadata(yTokenAddress).decimals();\n _approveToken(yTokenAddress);\n\n (address _pool,) = IBalancerVault(primitive).getPool(poolId_);\n pool = IPool(_pool);\n\n lpTokenId = _calculateOceanId(_pool, 0);\n underlying[lpTokenId] = _pool;\n decimals[lpTokenId] = 18;\n _approveToken(_pool);\n\n (IERC20[] memory tokens,,) = IBalancerVault(primitive).getPoolTokens(pool.getPoolId());\n for (uint256 i; i < tokens.length;) {\n assets.push(IAsset(address(tokens[i])));\n unchecked {\n ++i;\n }\n }\n }\n\n /**\n * @dev wraps the underlying token into the Ocean\n * @param tokenId Ocean ID of token to wrap\n * @param amount wrap amount\n */\n function wrapToken(uint256 tokenId, uint256 amount, bytes32 metadata) internal override {\n address tokenAddress = underlying[tokenId];\n\n Interaction memory interaction = Interaction({ interactionTypeAndAddress: _fetchInteractionId(tokenAddress, uint256(InteractionType.WrapErc20)), inputToken: 0, outputToken: 0, specifiedAmount: amount, metadata: bytes32(0) });\n\n IOceanInteractions(ocean).doInteraction(interaction);\n }\n\n /**\n * @dev unwraps the underlying token from the Ocean\n * @param tokenId Ocean ID of token to unwrap\n * @param amount unwrap amount\n */\n function unwrapToken(uint256 tokenId, uint256 amount, bytes32 metadata) internal override returns (uint256 unwrappedAmount) {\n address tokenAddress = underlying[tokenId];\n\n Interaction memory interaction = Interaction({ interactionTypeAndAddress: _fetchInteractionId(tokenAddress, uint256(InteractionType.UnwrapErc20)), inputToken: 0, outputToken: 0, specifiedAmount: amount, metadata: bytes32(0) });\n\n IOceanInteractions(ocean).doInteraction(interaction);\n\n // handle the unwrap fee scenario\n uint256 unwrapFee = amount / IOceanInteractions(ocean).unwrapFeeDivisor();\n (, uint256 truncated) = _convertDecimals(NORMALIZED_DECIMALS, decimals[tokenId], amount - unwrapFee);\n unwrapFee = unwrapFee + truncated;\n\n unwrappedAmount = amount - unwrapFee;\n }\n\n /**\n * @dev swaps/add liquidity/remove liquidity from Curve 2pool\n * @param inputToken The user is giving this token to the pool\n * @param outputToken The pool is giving this token to the user\n * @param inputAmount The amount of the inputToken the user is giving to the pool\n * @param minimumOutputAmount The minimum amount of tokens expected back after the exchange\n */\n function primitiveOutputAmount(uint256 inputToken, uint256 outputToken, uint256 inputAmount, bytes32 minimumOutputAmount) internal override returns (uint256 outputAmount) {\n (uint256 rawInputAmount,) = _convertDecimals(NORMALIZED_DECIMALS, decimals[inputToken], inputAmount);\n\n ComputeType action = _determineComputeType(inputToken, outputToken);\n\n uint256 rawOutputAmount;\n\n // avoid multiple SLOADS\n uint256 indexOfInputAmount = indexOf[inputToken];\n uint256 indexOfOutputAmount = indexOf[outputToken];\n uint256 assetLength = assets.length;\n\n if (action == ComputeType.Swap) {\n IBalancerVault.SingleSwap memory singleSwap = IBalancerVault.SingleSwap({\n poolId: pool.getPoolId(),\n kind: IBalancerVault.SwapKind.GIVEN_IN,\n assetIn: IAsset(underlying[inputToken]),\n assetOut: IAsset(underlying[outputToken]),\n amount: rawInputAmount,\n userData: new bytes(0)\n });\n\n IBalancerVault.FundManagement memory fundManagement = IBalancerVault.FundManagement({ sender: payable(address(this)), fromInternalBalance: false, recipient: payable(address(this)), toInternalBalance: false });\n rawOutputAmount = IBalancerVault(primitive).swap(singleSwap, fundManagement, uint256(minimumOutputAmount), block.timestamp + 300);\n } else if (action == ComputeType.Deposit) {\n uint256[] memory amounts = new uint256[](assetLength);\n amounts[indexOfInputAmount] = rawInputAmount;\n\n uint256[] memory amountsWithoutBpt = new uint256[](amounts.length - 1);\n for (uint256 i; i < amountsWithoutBpt.length;) {\n amountsWithoutBpt[i] = amounts[i < pool.getBptIndex() ? i : i + 1];\n unchecked {\n ++i;\n }\n }\n\n IBalancerVault.JoinPoolRequest memory joinPool = IBalancerVault.JoinPoolRequest({ assets: assets, maxAmountsIn: amounts, userData: abi.encode(1, amountsWithoutBpt, uint256(minimumOutputAmount)), fromInternalBalance: false });\n\n uint256 bptBalanceBeforeDeposit = IERC20Metadata(address(pool)).balanceOf(address(this));\n IBalancerVault(primitive).joinPool(pool.getPoolId(), address(this), address(this), joinPool);\n rawOutputAmount = IERC20Metadata(address(pool)).balanceOf(address(this)) - bptBalanceBeforeDeposit;\n } else {\n uint256[] memory amounts = new uint256[](assetLength);\n amounts[indexOfOutputAmount] = uint256(minimumOutputAmount);\n\n IBalancerVault.ExitPoolRequest memory exitPool = IBalancerVault.ExitPoolRequest({\n assets: assets,\n minAmountsOut: amounts,\n userData: abi.encode(0, rawInputAmount, indexOfOutputAmount < pool.getBptIndex() ? indexOfOutputAmount : indexOfOutputAmount - 1),\n toInternalBalance: false\n });\n address outputTokenAddress = underlying[outputToken];\n uint256 outputTokenBalanceBeforeWithdraw = IERC20Metadata(outputTokenAddress).balanceOf(address(this));\n\n IBalancerVault(primitive).exitPool(pool.getPoolId(), address(this), payable(address(this)), exitPool);\n rawOutputAmount = IERC20Metadata(outputTokenAddress).balanceOf(address(this)) - outputTokenBalanceBeforeWithdraw;\n }\n\n (outputAmount,) = _convertDecimals(decimals[outputToken], NORMALIZED_DECIMALS, rawOutputAmount);\n\n if (uint256(minimumOutputAmount) > outputAmount) revert SLIPPAGE_LIMIT_EXCEEDED();\n\n if (action == ComputeType.Swap) {\n emit Swap(inputToken, inputAmount, outputAmount, minimumOutputAmount, primitive, true);\n } else if (action == ComputeType.Deposit) {\n emit Deposit(inputToken, inputAmount, outputAmount, minimumOutputAmount, primitive, true);\n } else {\n emit Withdraw(outputToken, inputAmount, outputAmount, minimumOutputAmount, primitive, true);\n }\n }\n\n /**\n * @dev Approves token to be spent by the Ocean and the Curve pool\n */\n function _approveToken(address tokenAddress) private {\n IERC20Metadata(tokenAddress).approve(ocean, type(uint256).max);\n IERC20Metadata(tokenAddress).approve(primitive, type(uint256).max);\n }\n\n /**\n * @dev Uses the inputToken and outputToken to determine the ComputeType\n * (input: xToken, output: yToken) | (input: yToken, output: xToken) => SWAP\n * base := xToken | yToken\n * (input: base, output: lpToken) => DEPOSIT\n * (input: lpToken, output: base) => WITHDRAW\n */\n function _determineComputeType(uint256 inputToken, uint256 outputToken) private view returns (ComputeType computeType) {\n if (((inputToken == xToken) && (outputToken == yToken)) || ((inputToken == yToken) && (outputToken == xToken))) {\n return ComputeType.Swap;\n } else if (((inputToken == xToken) || (inputToken == yToken)) && (outputToken == lpTokenId)) {\n return ComputeType.Deposit;\n } else if ((inputToken == lpTokenId) && ((outputToken == xToken) || (outputToken == yToken))) {\n return ComputeType.Withdraw;\n } else {\n revert INVALID_COMPUTE_TYPE();\n }\n }\n\n receive() external payable { }\n}\n"
},
"node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n"
},
"src/adapters/OceanAdapter.sol": {
"content": "// SPDX-License-Identifier: MIT\n// Cowri Labs Inc.\n\npragma solidity ^0.8.19;\n\nimport \"../interfaces/IOceanPrimitive.sol\";\nimport \"../interfaces/Interactions.sol\";\n\n/**\n * @notice\n * Helper contract for shell adapters\n */\nabstract contract OceanAdapter is IOceanPrimitive {\n /// @notice normalized decimals to be compatible with the Ocean.\n uint8 constant NORMALIZED_DECIMALS = 18;\n\n /// @notice Ocean address.\n address public immutable ocean;\n\n /// @notice external primitive address.\n address public immutable primitive;\n\n /// @notice The underlying token address corresponding to the Ocean ID.\n mapping(uint256 => address) public underlying;\n\n /// @notice The underlying token decimals wrt to the Ocean ID\n mapping(uint256 => uint8) public decimals;\n\n //*********************************************************************//\n // ---------------------------- constructor -------------------------- //\n //*********************************************************************//\n\n /// @notice only initializing the immutables\n constructor(address ocean_, address primitive_) {\n ocean = ocean_;\n primitive = primitive_;\n }\n\n /// @notice only allow the Ocean to call a method\n modifier onlyOcean() {\n require(msg.sender == ocean);\n _;\n }\n\n /**\n * @dev The Ocean must always know the input and output tokens in order to\n * do the accounting. One of the token amounts is chosen by the user, and\n * the other amount is chosen by the primitive. When computeOutputAmount is\n * called, the user provides the inputAmount, and the primitive uses this to\n * compute the outputAmount\n * @param inputToken The user is giving this token to the primitive\n * @param outputToken The primitive is giving this token to the user\n * @param inputAmount The amount of the inputToken the user is giving to the primitive\n * @param metadata a bytes32 value that the user provides the Ocean\n * @dev the unused param is an address field called userAddress\n */\n function computeOutputAmount(uint256 inputToken, uint256 outputToken, uint256 inputAmount, address, bytes32 metadata) external override onlyOcean returns (uint256 outputAmount) {\n uint256 unwrappedAmount = unwrapToken(inputToken, inputAmount, metadata);\n\n outputAmount = primitiveOutputAmount(inputToken, outputToken, unwrappedAmount, metadata);\n\n wrapToken(outputToken, outputAmount, metadata);\n }\n\n /**\n * @notice Not implemented for this primitive\n */\n function computeInputAmount(uint256 inputToken, uint256 outputToken, uint256 outputAmount, address userAddress, bytes32 maximumInputAmount) external override onlyOcean returns (uint256 inputAmount) {\n revert();\n }\n\n /**\n * @notice used to fetch the Ocean interaction ID\n */\n function _fetchInteractionId(address token, uint256 interactionType) internal pure returns (bytes32) {\n uint256 packedValue = uint256(uint160(token));\n packedValue |= interactionType << 248;\n return bytes32(abi.encode(packedValue));\n }\n\n /**\n * @notice calculates Ocean ID for a underlying token\n */\n function _calculateOceanId(address tokenAddress, uint256 tokenId) internal pure returns (uint256) {\n return uint256(keccak256(abi.encodePacked(tokenAddress, tokenId)));\n }\n\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(address, address, uint256, uint256, bytes memory) public pure returns (bytes4) {\n return this.onERC1155Received.selector;\n }\n\n function onERC721Received(address, address, uint256, bytes calldata) public pure returns (bytes4) {\n return this.onERC721Received.selector;\n }\n\n /**\n * @notice returning 0 here since this primitive should not have any tokens\n */\n function getTokenSupply(uint256 tokenId) external view virtual override returns (uint256) {\n return 0;\n }\n\n /**\n * @dev convert a uint256 from one fixed point decimal basis to another,\n * returning the truncated amount if a truncation occurs.\n * @dev fn(from, to, a) => b\n * @dev a = (x * 10**from) => b = (x * 10**to), where x is constant.\n * @param amountToConvert the amount being converted\n * @param decimalsFrom the fixed decimal basis of amountToConvert\n * @param decimalsTo the fixed decimal basis of the returned convertedAmount\n * @return convertedAmount the amount after conversion\n * @return truncatedAmount if (from > to), there may be some truncation, it\n * is up to the caller to decide what to do with the truncated amount.\n */\n function _convertDecimals(uint8 decimalsFrom, uint8 decimalsTo, uint256 amountToConvert) internal pure returns (uint256 convertedAmount, uint256 truncatedAmount) {\n if (decimalsFrom == decimalsTo) {\n // no shift\n convertedAmount = amountToConvert;\n truncatedAmount = 0;\n } else if (decimalsFrom < decimalsTo) {\n // Decimal shift left (add precision)\n uint256 shift = 10 ** (uint256(decimalsTo - decimalsFrom));\n convertedAmount = amountToConvert * shift;\n truncatedAmount = 0;\n } else {\n // Decimal shift right (remove precision) -> truncation\n uint256 shift = 10 ** (uint256(decimalsFrom - decimalsTo));\n convertedAmount = amountToConvert / shift;\n truncatedAmount = amountToConvert % shift;\n }\n }\n\n function primitiveOutputAmount(uint256 inputToken, uint256 outputToken, uint256 inputAmount, bytes32 metadata) internal virtual returns (uint256 outputAmount);\n\n function wrapToken(uint256 tokenId, uint256 amount, bytes32 metadata) internal virtual;\n\n function unwrapToken(uint256 tokenId, uint256 amount, bytes32 metadata) internal virtual returns (uint256 unwrappedAmount);\n}\n"
},
"src/interfaces/IBalancerVault.sol": {
"content": "// SPDX-License-Identifier: MIT\n// Cowri Labs Inc.\n\npragma solidity ^0.8.19;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface IAsset {\n// solhint-disable-previous-line no-empty-blocks\n}\n\ninterface IBalancerQueries {\n function queryExit(bytes32 poolId, address sender, address recipient, IBalancerVault.ExitPoolRequest memory request) external returns (uint256 bptIn, uint256[] memory amountsOut);\n}\n\ninterface IPool {\n function getBptIndex() external view returns (uint256);\n\n function getPoolId() external view returns (bytes32);\n\n function getAmplificationParameter() external view returns (uint256, bool, uint256);\n\n function getScalingFactors() external view returns (uint256[] memory);\n\n function getSwapFeePercentage() external view returns (uint256);\n}\n\ninterface IBalancerVault {\n enum SwapKind {\n GIVEN_IN,\n GIVEN_OUT\n }\n\n enum PoolSpecialization {\n GENERAL,\n MINIMAL_SWAP_INFO,\n TWO_TOKEN\n }\n\n function getPoolTokens(bytes32 poolId) external view returns (IERC20[] memory tokens, uint256[] memory balances, uint256 lastChangeBlock);\n\n function getPool(bytes32 poolId) external view returns (address, PoolSpecialization);\n\n function joinPool(bytes32 poolId, address sender, address recipient, JoinPoolRequest memory request) external payable;\n\n struct JoinPoolRequest {\n IAsset[] assets;\n uint256[] maxAmountsIn;\n bytes userData;\n bool fromInternalBalance;\n }\n\n function exitPool(bytes32 poolId, address sender, address payable recipient, ExitPoolRequest memory request) external;\n\n struct ExitPoolRequest {\n IAsset[] assets;\n uint256[] minAmountsOut;\n bytes userData;\n bool toInternalBalance;\n }\n\n function swap(SingleSwap memory singleSwap, FundManagement memory funds, uint256 limit, uint256 deadline) external payable returns (uint256);\n\n struct SingleSwap {\n bytes32 poolId;\n SwapKind kind;\n IAsset assetIn;\n IAsset assetOut;\n uint256 amount;\n bytes userData;\n }\n\n struct FundManagement {\n address sender;\n bool fromInternalBalance;\n address payable recipient;\n bool toInternalBalance;\n }\n}\n"
},
"node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n"
},
"src/interfaces/IOceanPrimitive.sol": {
"content": "// SPDX-License-Identifier: unlicensed\n// Cowri Labs Inc.\n\npragma solidity ^0.8.19;\n\n/// @notice Implementing this allows a primitive to be called by the Ocean's\n/// defi framework.\ninterface IOceanPrimitive {\n function computeOutputAmount(uint256 inputToken, uint256 outputToken, uint256 inputAmount, address userAddress, bytes32 metadata) external returns (uint256 outputAmount);\n\n function computeInputAmount(uint256 inputToken, uint256 outputToken, uint256 outputAmount, address userAddress, bytes32 metadata) external returns (uint256 inputAmount);\n\n function getTokenSupply(uint256 tokenId) external view returns (uint256 totalSupply);\n}\n"
},
"src/interfaces/Interactions.sol": {
"content": "// SPDX-License-Identifier: unlicensed\n// Cowri Labs Inc.\n\npragma solidity ^0.8.19;\n\n/**\n * @param interactionTypeAndAddress the type of interaction and the external\n * contract called during this interaction.\n * @param inputToken this field is ignored except when the interaction type\n * begins with \"Compute\". During a \"Compute\" interaction, this token is given\n * to the external contract.\n * @param outputToken this field is ignored except when the interaction type\n * begins with \"Compute\". During a \"Compute\" interaction, this token is\n * received from the external contract.\n * @param specifiedAmount This value is the amount of the specified token.\n * See the comment above the declaration for InteractionType for information\n * on specified tokens. When this value is equal to type(uint256).max, it is\n * a request by the user to use the intra-transaction delta of the specified\n * token as the specified amount. See LibBalanceDelta for more information\n * about this. When the Ocean executes an interaction, it resolves the\n * specifiedAmount before calling the external contract. During a \"721\"\n * interaction, the resolved specifiedAmount must be identically \"1\".\n * @param metadata This value is used in two ways. During \"Compute\"\n * interactions, it is forwarded to the external contract. The external\n * contract can define whatever expectations it wants for these 32 bytes. The\n * caller is expected to be aware of the expectations of the external contract\n * invoked during the interaction. During 721/1155 and wraps and unwraps,\n * these bytes are cast to uint256 and used as the external ledger's token ID\n * for the interaction.\n */\nstruct Interaction {\n bytes32 interactionTypeAndAddress;\n uint256 inputToken;\n uint256 outputToken;\n uint256 specifiedAmount;\n bytes32 metadata;\n}\n\n/**\n * InteractionType determines how the properties of Interaction are interpreted\n *\n * The interface implemented by the external contract, the specified token\n * for the interaction, and what sign (+/-) of delta can be used are\n * determined by the InteractionType.\n *\n * @param WrapErc20\n * type(externalContract).interfaceId == IERC20\n * specifiedToken == calculateOceanId(externalContract, 0)\n * negative delta can be used as specifiedAmount\n *\n * @param UnwrapErc20\n * type(externalContract).interfaceId == IERC20\n * specifiedToken == calculateOceanId(externalContract, 0)\n * positive delta can be used as specifiedAmount\n *\n * @param WrapErc721\n * type(externalContract).interfaceId == IERC721\n * specifiedToken == calculateOceanId(externalContract, metadata)\n * negative delta can be used as specifiedAmount\n *\n * @param UnwrapErc721\n * type(externalContract).interfaceId == IERC721\n * specifiedToken == calculateOceanId(externalContract, metadata)\n * positive delta can be used as specifiedAmount\n *\n * @param WrapErc1155\n * type(externalContract).interfaceId == IERC1155\n * specifiedToken == calculateOceanId(externalContract, metadata)\n * negative delta can be used as specifiedAmount\n *\n * @param WrapErc1155\n * type(externalContract).interfaceId == IERC1155\n * specifiedToken == calculateOceanId(externalContract, metadata)\n * positive delta can be used as specifiedAmount\n *\n * @param ComputeInputAmount\n * type(externalContract).interfaceId == IOceanexternalContract\n * specifiedToken == outputToken\n * negative delta can be used as specifiedAmount\n *\n * @param ComputeOutputAmount\n * type(externalContract).interfaceId == IOceanexternalContract\n * specifiedToken == inputToken\n * positive delta can be used as specifiedAmount\n */\nenum InteractionType {\n WrapErc20,\n UnwrapErc20,\n WrapErc721,\n UnwrapErc721,\n WrapErc1155,\n UnwrapErc1155,\n ComputeInputAmount,\n ComputeOutputAmount,\n UnwrapEther\n}\n\ninterface IOceanInteractions {\n function unwrapFeeDivisor() external view returns (uint256);\n\n function doMultipleInteractions(Interaction[] calldata interactions, uint256[] calldata ids) external payable returns (uint256[] memory burnIds, uint256[] memory burnAmounts, uint256[] memory mintIds, uint256[] memory mintAmounts);\n\n function forwardedDoMultipleInteractions(\n Interaction[] calldata interactions,\n uint256[] calldata ids,\n address userAddress\n )\n external\n payable\n returns (uint256[] memory burnIds, uint256[] memory burnAmounts, uint256[] memory mintIds, uint256[] memory mintAmounts);\n\n function doInteraction(Interaction calldata interaction) external payable returns (uint256 burnId, uint256 burnAmount, uint256 mintId, uint256 mintAmount);\n\n function forwardedDoInteraction(Interaction calldata interaction, address userAddress) external payable returns (uint256 burnId, uint256 burnAmount, uint256 mintId, uint256 mintAmount);\n}\n"
}
},
"settings": {
"remappings": [
"@prb/test/=lib/prb-test/src/",
"forge-std/=lib/forge-std/src/",
"@sablier/v2-core/=lib/v2-core/",
"balancer-v2-monorepo/=lib/balancer-v2-monorepo/",
"src/=src/",
"@openzeppelin/=node_modules/@openzeppelin/",
"@shell-v2-ocean/=node_modules/shell-v2-ocean/",
"abdk-libraries-solidity/=node_modules/abdk-libraries-solidity/",
"@balancer-labs/=lib/balancer-v2-monorepo/../../node_modules/@balancer-labs/",
"ds-test/=lib/forge-std/lib/ds-test/src/",
"prb-math/=lib/prb-math/src/",
"prb-test/=lib/prb-test/src/"
],
"optimizer": {
"enabled": true,
"runs": 10000
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "none",
"appendCBOR": false
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "paris",
"viaIR": true,
"libraries": {}
}
}} |
1 | 20,291,145 | f091062898d4f141d140b1a636209b6b44e162aead2d9b38fe3d5188b12d985b | 96ae23fd0c33517716894cf4650818cfa109c35ba8624039dfbbd3c2f05a3a75 | b02c6c40a798184d5e012fbb1dc698977671f8fc | ffa397285ce46fb78c588a9e993286aac68c37cd | 440e529c150937bc288f4f9dd08ccac0ea2b2541 | 3d602d80600a3d3981f3363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3 | pragma solidity 0.7.5;
/*
The MIT License (MIT)
Copyright (c) 2018 Murray Software, LLC.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//solhint-disable max-line-length
//solhint-disable no-inline-assembly
contract CloneFactory {
function createClone(address target, bytes32 salt)
internal
returns (address payable result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the clone contract data
let clone := mload(0x40)
// The bytecode block below is responsible for contract initialization
// during deployment, it is worth noting the proxied contract constructor will not be called during
// the cloning procedure and that is why an initialization function needs to be called after the
// clone is created
mstore(
clone,
0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000
)
// This stores the address location of the implementation contract
// so that the proxy knows where to delegate call logic to
mstore(add(clone, 0x14), targetBytes)
// The bytecode block is the actual code that is deployed for each clone created.
// It forwards all calls to the already deployed implementation via a delegatecall
mstore(
add(clone, 0x28),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// deploy the contract using the CREATE2 opcode
// this deploys the minimal proxy defined above, which will proxy all
// calls to use the logic defined in the implementation contract `target`
result := create2(0, clone, 0x37, salt)
}
}
function isClone(address target, address query)
internal
view
returns (bool result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the comparison clone
let clone := mload(0x40)
// The next three lines store the expected bytecode for a miniml proxy
// that targets `target` as its implementation contract
mstore(
clone,
0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000
)
mstore(add(clone, 0xa), targetBytes)
mstore(
add(clone, 0x1e),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// the next two lines store the bytecode of the contract that we are checking in memory
let other := add(clone, 0x40)
extcodecopy(query, other, 0, 0x2d)
// Check if the expected bytecode equals the actual bytecode and return the result
result := and(
eq(mload(clone), mload(other)),
eq(mload(add(clone, 0xd)), mload(add(other, 0xd)))
)
}
}
}
/**
* Contract that exposes the needed erc20 token functions
*/
abstract contract ERC20Interface {
// Send _value amount of tokens to address _to
function transfer(address _to, uint256 _value)
public
virtual
returns (bool success);
// Get the account balance of another account with address _owner
function balanceOf(address _owner)
public
virtual
view
returns (uint256 balance);
}
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
function safeApprove(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeApprove: approve failed'
);
}
function safeTransfer(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeTransfer: transfer failed'
);
}
function safeTransferFrom(
address token,
address from,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::transferFrom: transferFrom failed'
);
}
function safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');
}
}
/**
* Contract that will forward any incoming Ether to the creator of the contract
*
*/
contract Forwarder {
// Address to which any funds sent to this contract will be forwarded
address public parentAddress;
event ForwarderDeposited(address from, uint256 value, bytes data);
/**
* Initialize the contract, and sets the destination address to that of the creator
*/
function init(address _parentAddress) external onlyUninitialized {
parentAddress = _parentAddress;
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
// NOTE: since we are forwarding on initialization,
// we don't have the context of the original sender.
// We still emit an event about the forwarding but set
// the sender to the forwarder itself
emit ForwarderDeposited(address(this), value, msg.data);
}
/**
* Modifier that will execute internal code block only if the sender is the parent address
*/
modifier onlyParent {
require(msg.sender == parentAddress, 'Only Parent');
_;
}
/**
* Modifier that will execute internal code block only if the contract has not been initialized yet
*/
modifier onlyUninitialized {
require(parentAddress == address(0x0), 'Already initialized');
_;
}
/**
* Default function; Gets called when data is sent but does not match any other function
*/
fallback() external payable {
flush();
}
/**
* Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address
*/
receive() external payable {
flush();
}
/**
* Execute a token transfer of the full balance from the forwarder token to the parent address
* @param tokenContractAddress the address of the erc20 token contract
*/
function flushTokens(address tokenContractAddress) external onlyParent {
ERC20Interface instance = ERC20Interface(tokenContractAddress);
address forwarderAddress = address(this);
uint256 forwarderBalance = instance.balanceOf(forwarderAddress);
if (forwarderBalance == 0) {
return;
}
TransferHelper.safeTransfer(
tokenContractAddress,
parentAddress,
forwarderBalance
);
}
/**
* Flush the entire balance of the contract to the parent address.
*/
function flush() public {
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
emit ForwarderDeposited(msg.sender, value, msg.data);
}
}
contract ForwarderFactory is CloneFactory {
address public implementationAddress;
event ForwarderCreated(address newForwarderAddress, address parentAddress);
constructor(address _implementationAddress) {
implementationAddress = _implementationAddress;
}
function createForwarder(address parent, bytes32 salt) external {
// include the signers in the salt so any contract deployed to a given address must have the same signers
bytes32 finalSalt = keccak256(abi.encodePacked(parent, salt));
address payable clone = createClone(implementationAddress, finalSalt);
Forwarder(clone).init(parent);
emit ForwarderCreated(clone, parent);
}
} |
1 | 20,291,145 | f091062898d4f141d140b1a636209b6b44e162aead2d9b38fe3d5188b12d985b | 05432bad9462ac13667c0e322145d32871521c1e2f7e3b3c75b7402f9eac1dd3 | 6a111f7d28856385263eedba7e12b37e4eed7997 | 6a111f7d28856385263eedba7e12b37e4eed7997 | beb89bb3f417ae6db631e74d9d0f418e6c26233f | 6080604052346100a157613cbb80380380610019816100b9565b9283398101906060818303126100a15780516001600160401b0381116100a157826100459183016100e3565b60208201519091906001600160401b0381116100a157836100679183016100e3565b6040820151939091906001600160401b0385116100a1576100929461008c92016100e3565b916103c9565b60405161375490816105678239f35b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b6040519190601f01601f191682016001600160401b038111838210176100de57604052565b6100a5565b81601f820112156100a1578051906001600160401b0382116100de57610112601f8301601f19166020016100b9565b92828452602083830101116100a157815f9260208093018386015e8301015290565b90600182811c92168015610162575b602083101461014e57565b634e487b7160e01b5f52602260045260245ffd5b91607f1691610143565b601f8111610178575050565b60025f5260205f20906020601f840160051c830193106101b2575b601f0160051c01905b8181106101a7575050565b5f815560010161019c565b9091508190610193565b601f82116101c957505050565b5f5260205f20906020601f840160051c83019310610201575b601f0160051c01905b8181106101f6575050565b5f81556001016101eb565b90915081906101e2565b80519091906001600160401b0381116100de576102348161022d600354610134565b60036101bc565b602092601f821160011461027457610264929382915f92610269575b50508160011b915f199060031b1c19161790565b600355565b015190505f80610250565b60035f52601f198216937fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b915f5b8681106102d857508360019596106102c0575b505050811b01600355565b01515f1960f88460031b161c191690555f80806102b5565b919260206001819286850151815501940192016102a2565b80519091906001600160401b0381116100de5761031981610312600d54610134565b600d6101bc565b602092601f821160011461034d57610348929382915f926102695750508160011b915f199060031b1c19161790565b600d55565b600d5f52601f198216937fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb5915f5b8681106103b15750836001959610610399575b505050811b01600d55565b01515f1960f88460031b161c191690555f808061038e565b9192602060018192868501518155019401920161037b565b805190939291906001600160401b0381116100de576103f2816103ed600254610134565b61016c565b6020601f8211600114610457578161043093926104289261044297985f926102695750508160011b915f199060031b1c19161790565b60025561020b565b5f805561043d60016104e1565b6102f0565b61044c60c0600955565b6104553361052d565b565b60025f52601f198216957f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace965f5b8181106104c957509660019284926104309695610442999a106104b1575b505050811b0160025561020b565b01515f1960f88460031b161c191690555f80806104a3565b83830151895560019098019760209384019301610485565b156104e857565b60405162461bcd60e51b815260206004820152601f60248201527f4665652064656e6f6d696e61746f722063616e6e6f74206265207a65726f2e006044820152606490fd5b6001600160a01b0316638b78c6d8198190555f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a356fe60806040526004361015610011575f80fd5b5f3560e01c806301ffc9a71461038457806304634d8d1461037f57806306fdde031461037a578063081812fc14610375578063095ea7b3146103705780630e0f96b61461036b5780630eaaf4c814610366578063117d97741461036157806311d927e41461035c578063127caa881461035757806316c38b3c1461035257806318160ddd1461034d5780631f2bf46914610348578063230f7ed01461034357806323b872dd1461033e57806325692962146103395780632a55205a146103345780632c69f97c1461032f578063305a67a81461032a57806334829bf4146103255780633ccfd60b1461032057806342842e0e1461031b578063451df52e1461031657806354d1f13d146103115780635c975abb1461030c57806362823db4146103075780636352211e1461030257806370a08231146102fd578063715018a6146102f857806371bf439e146102f3578063748b3307146102ee5780637f38e526146102e95780637f3c8160146102e457806380e2c55d146102df5780638da5cb5b146102da5780638f043c6b146102d557806395d89b41146102d0578063960bfe04146102cb5780639979ef45146102c6578063a22cb465146102c1578063ae04443a146102bc578063b14c63c5146102b7578063b88d4fde146102b2578063c87b56dd146102ad578063cfc86f7b146102a8578063d3d7ee44146102a3578063e985e9c51461029e578063ed4127df14610299578063ee8f699214610294578063efe13c281461028f578063f04e283e1461028a578063f2fde38b14610285578063f3f4370314610280578063fee81cf41461027b5763ff4240c714610276575f80fd5b611fd4565b611f9e565b611f62565b611f23565b611ed2565b611e6b565b611d99565b611d7e565b611d18565b611c73565b611bce565b61180f565b6117ac565b611730565b611713565b61167a565b6115a5565b611584565b6114df565b61145c565b611390565b61135a565b61133d565b611301565b6112e0565b6112c4565b61127b565b611207565b6111d8565b6110b3565b611091565b61104d565b61101a565b611008565b610fc2565b610f08565b610e4b565b610cff565b610c78565b610c2f565b610c1b565b610bd2565b610b86565b610b65565b610b2c565b610af8565b610ab1565b610a50565b610928565b6106fe565b6105f7565b61058e565b6104b4565b610403565b6103b7565b7fffffffff000000000000000000000000000000000000000000000000000000008116036103b357565b5f80fd5b346103b35760203660031901126103b35760206004356103d681610389565b60e01c604051906301ffc9a7632a55205a821491141715158152f35b6001600160a01b038116036103b357565b346103b35760403660031901126103b357600435610420816103f2565b602435906bffffffffffffffffffffffff82168092036103b357610442612abf565b612710821161046f5760601b8015610462571768aa4ec00224afccfdb755005b63b4457eaa5f526004601cfd5b63350a88b35f526004601cfd5b805180835260209291819084018484015e5f828201840152601f01601f1916010190565b9060206104b192818152019061047c565b90565b346103b3575f3660031901126103b3576040515f6002546104d481611b96565b808452906001811690811561056a575060011461050c575b610508836104fc8185038261140b565b604051918291826104a0565b0390f35b60025f9081527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace939250905b808210610550575090915081016020016104fc6104ec565b919260018160209254838588010152019101909291610538565b60ff191660208086019190915291151560051b840190910191506104fc90506104ec565b346103b35760203660031901126103b3576004356105ab81612adb565b156105cf575f52600660205260206001600160a01b0360405f205416604051908152f35b7fcf4700e4000000000000000000000000000000000000000000000000000000005f5260045ffd5b60403660031901126103b35760043561060f816103f2565b602435906001600160a01b0361062483612d48565b169081330361069d575b806106756001600160a01b039261064d865f52600660205260405f2090565b906001600160a01b031673ffffffffffffffffffffffffffffffffffffffff19825416179055565b16907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9255f80a4005b815f52600760205260ff6106c53360405f20906001600160a01b03165f5260205260405f2090565b541661062e57612b1a565b9181601f840112156103b35782359167ffffffffffffffff83116103b357602083818601950101116103b357565b60a03660031901126103b35760043560243560443560643560843567ffffffffffffffff81116103b3576107369036906004016106d0565b9290923068929eee149b4bd21268541461091b573068929eee149b4bd212685561098661076383886120a4565b111580610901575b6107799096929491966120b6565b61079a6107926107898587612119565b600a5490612119565b34101561212c565b81935b6107a781846120a4565b85101561083857855b6107ba85886120a4565b81101561082c57806108006107fb6107f76107f06001956107e38c5f52601060205260405f2090565b905f5260205260405f2090565b5460ff1690565b1590565b612177565b610826610819826107e38a5f52601060205260405f2090565b805460ff19166001179055565b016107b0565b5060019094019361079d565b916108de94506108a06108eb976108e6976108636108d9955f549361085c33612bf1565b3691611776565b602081519101209061087361142d565b948552602085015285604085015286606085015242608085015260a08401525f52600f60205260405f2090565b9060a060059180518455602081015160018501556040810151600285015560608101516003850155608081015160048501550151910155565b612119565b600c546120a4565b600c55565b6108f3612d18565b3868929eee149b4bd2126855005b5061077961090f84876120a4565b6009541015905061076b565b63ab143c065f526004601cfd5b346103b35760203660031901126103b357600435805f5260146020526001600160a01b0360405f2054163303610a0c5761096a815f52601360205260405f2090565b54905f61097f825f52601360205260405f2090565b556109b2610995825f52601460205260405f2090565b73ffffffffffffffffffffffffffffffffffffffff198154169055565b815f8115610a03575b5f80809381933390f1156109fe5760405191825233917f8f8619524e8d462cead34604bd2247ede24175801481e4d0b8059ac8aa41c3019080602081015b0390a3005b6121c2565b506108fc6109bb565b606460405162461bcd60e51b815260206004820152601660248201527f4e6f7420746865206869676865737420626964646572000000000000000000006044820152fd5b346103b3575f3660031901126103b3576020600a54604051908152f35b6004359061ffff821682036103b357565b6024359061ffff821682036103b357565b6044359061ffff821682036103b357565b6064359061ffff821682036103b357565b346103b35760803660031901126103b3576020610aee610acf610a6d565b610ad7610a7e565b610adf610a8f565b90610ae8610aa0565b926121e3565b6040519015158152f35b346103b35760203660031901126103b3576004355f526015602052602060405f2054604051908152f35b801515036103b357565b346103b35760203660031901126103b357600435610b4981610b22565b610b51612abf565b60ff80196018541691151516176018555f80f35b346103b3575f3660031901126103b35760205f546001549003604051908152f35b346103b35760203660031901126103b3576004355f526012602052606060405f2060ff600182549201546040519283526001600160a01b038116602084015260a01c1615156040820152f35b346103b3575f3660031901126103b3576020600954604051908152f35b60609060031901126103b357600435610c07816103f2565b90602435610c14816103f2565b9060443590565b610c2d610c2736610bef565b91612287565b005b5f3660031901126103b35763389a75e1600c52335f526202a30042016020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a2005b346103b35760403660031901126103b357600435602435905f5268aa4ec00224afccfdb760205260405f2054908160601c918215610ce7575b90612710918360601b1890815f1904811182023d3d3e604080516001600160a01b03959095168552910291909104602083015290f35b5068aa4ec00224afccfdb754606081901c9250610cb1565b346103b35760203660031901126103b3576004353068929eee149b4bd21268541461091b573068929eee149b4bd2126855610d4c6001600160a01b03610d4483612d48565b1633146124ae565b610d816001600160a01b03610d79610d6c845f52601460205260405f2090565b546001600160a01b031690565b1615156124f9565b610d96610d6c825f52601460205260405f2090565b90610da9815f52601360205260405f2090565b54905f610dbe825f52601360205260405f2090565b55610dd4610995825f52601460205260405f2090565b335f908152601660205260409020610ded8382546120a4565b9055610dfa8184336125be565b7f1e42e95a909495fee2f816f68a8ad0d98bd2370b427930d8726790b48b80ae1a6001600160a01b0360405194169380610e3a3395829190602083019252565b0390a43868929eee149b4bd2126855005b346103b35760203660031901126103b357600435805f5260126020526001600160a01b03600160405f200154163303610ec457610e9e610e93825f52601260205260405f2090565b60015f918281550155565b7f411aee90354c51b1b04cd563fcab2617142a9d50da19232d888547c8a1b7fd8a5f80a2005b606460405162461bcd60e51b815260206004820152600e60248201527f4e6f74207468652073656c6c65720000000000000000000000000000000000006044820152fd5b346103b3575f3660031901126103b3573068929eee149b4bd21268541461091b573068929eee149b4bd2126855335f52601660205260405f20548015610f7e575f8080806108f39481610f6c336001600160a01b03165f52601660205260405f2090565b55335af1610f78612544565b50612573565b606460405162461bcd60e51b815260206004820152601260248201527f4e6f2070656e64696e672062616c616e636500000000000000000000000000006044820152fd5b346103b3575f3660031901126103b357610fda612abf565b5f808080476001600160a01b03638b78c6d8195416828215610fff575bf1156109fe57005b506108fc610ff7565b610c2d61101436610bef565b916125be565b346103b35760203660031901126103b3576004355f52601460205260206001600160a01b0360405f205416604051908152f35b5f3660031901126103b35763389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2005b346103b3575f3660031901126103b357602060ff601854166040519015158152f35b346103b35760203660031901126103b3576001600160a01b036004356110d8816103f2565b6110e0612abf565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152911690602081602481855afa9081156109fe575f926020926111739285916111ab575b506040517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481019190915293849283919082906044820190565b03925af180156109fe5761118357005b610c2d9060203d6020116111a4575b61119c818361140b565b8101906125ea565b503d611192565b6111cb9150843d86116111d1575b6111c3818361140b565b8101906125db565b5f61112f565b503d6111b9565b346103b35760203660031901126103b35760206001600160a01b036111fe600435612d48565b16604051908152f35b346103b35760203660031901126103b3576001600160a01b0360043561122c816103f2565b168015611253575f526005602052602067ffffffffffffffff60405f205416604051908152f35b7f8f4eb604000000000000000000000000000000000000000000000000000000005f5260045ffd5b5f3660031901126103b35761128e612abf565b5f638b78c6d819547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a35f638b78c6d81955005b346103b3575f3660031901126103b35760206040516109868152f35b346103b35760203660031901126103b3576004356112fc612abf565b600a55005b346103b35760203660031901126103b3576001600160a01b03600435611326816103f2565b165f526017602052602060405f2054604051908152f35b346103b3575f3660031901126103b3576020600b54604051908152f35b346103b3575f3660031901126103b3576080600c54600b54600954600a5491604051938452602084015260408301526060820152f35b346103b3575f3660031901126103b3576020638b78c6d819546001600160a01b0360405191168152f35b634e487b7160e01b5f52604160045260245ffd5b60a0810190811067ffffffffffffffff8211176113ea57604052565b6113ba565b6060810190811067ffffffffffffffff8211176113ea57604052565b90601f8019910116810190811067ffffffffffffffff8211176113ea57604052565b6040519061143c60c08361140b565b565b6040519061143c60608361140b565b6040519061143c60a08361140b565b366003190160c081126103b35760a0136103b35760405161147c816113ce565b611484610a6d565b815261148e610a7e565b602082015261149b610a8f565b60408201526114a8610aa0565b6060820152608435608082015260a4359067ffffffffffffffff82116103b3576114d9610c2d9236906004016106d0565b916125ff565b346103b3575f3660031901126103b3576040515f6003546114ff81611b96565b808452906001811690811561056a575060011461152657610508836104fc8185038261140b565b60035f9081527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b939250905b80821061156a575090915081016020016104fc6104ec565b919260018160209254838588010152019101909291611552565b346103b35760203660031901126103b3576004356115a0612abf565b600b55005b60203660031901126103b3576004353068929eee149b4bd21268541461091b576108f3903068929eee149b4bd2126855805f5260126020526115f460ff600160405f20015460a01c16156126db565b6116296116186001600160a01b0361160b84612d48565b166001600160a01b031690565b6001600160a01b0316331415612726565b611658611650611644610d6c845f52601460205260405f2090565b6001600160a01b031690565b331415612771565b61167561166d825f52601360205260405f2090565b5434116127bc565b613210565b346103b35760403660031901126103b357600435611697816103f2565b6001600160a01b03602435916116ac83610b22565b335f5260076020526116d28160405f20906001600160a01b03165f5260205260405f2090565b60ff1981541660ff85151516179055604051921515835216907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a3005b346103b3575f3660031901126103b3576020600c54604051908152f35b346103b35760203660031901126103b3576004355f526013602052602060405f2054604051908152f35b67ffffffffffffffff81116113ea57601f01601f191660200190565b9291926117828261175a565b91611790604051938461140b565b8294818452818301116103b3578281602093845f960137010152565b60803660031901126103b3576004356117c4816103f2565b602435906117d1826103f2565b6044356064359267ffffffffffffffff84116103b357366023850112156103b357611809610c2d943690602481600401359101611776565b92612807565b346103b35760203660031901126103b35760043561182c81612adb565b61183590612861565b611847815f52600f60205260405f2090565b611850906128ac565b9061185a8161342b565b906118649061342b565b9180516118709061342b565b90602081015161187f9061342b565b604082015161188d9061342b565b916060015161189b9061342b565b6040517f7b226e616d65223a202253706f742023000000000000000000000000000000006020820152958695919491603087016118d791612903565b7f222c20226465736372697074696f6e223a20224120756e697175652073706f7481527f206f6e20746865204d696c6c7943616e766173222c200000000000000000000060208201526036017f22696d616765223a2022000000000000000000000000000000000000000000008152600a0161195290612915565b61195b91612903565b7f222c20000000000000000000000000000000000000000000000000000000000081526003017f2261747472696275746573223a205b00000000000000000000000000000000008152600f017f7b2274726169745f74797065223a202258222c202276616c7565223a202200008152601e016119d691612903565b630113e96160e51b81526004017f7b2274726169745f74797065223a202259222c202276616c7565223a202200008152601e01611a1291612903565b630113e96160e51b81526004017f7b2274726169745f74797065223a20225769647468222c202276616c7565223a81527f20220000000000000000000000000000000000000000000000000000000000006020820152602201611a7491612903565b630113e96160e51b81526004017f7b2274726169745f74797065223a2022486569676874222c202276616c75652281527f3a202200000000000000000000000000000000000000000000000000000000006020820152602301611ad691612903565b7f227d00000000000000000000000000000000000000000000000000000000000081526002017f5d7d000000000000000000000000000000000000000000000000000000000000815260020103601f1981018252611b34908261140b565b611b3d90613613565b6040517f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000006020820152908190603d8201611b7691612903565b03601f1981018252611b88908261140b565b6040516105088192826104a0565b90600182811c92168015611bc4575b6020831014611bb057565b634e487b7160e01b5f52602260045260245ffd5b91607f1691611ba5565b346103b3575f3660031901126103b3576040515f600d54611bee81611b96565b808452906001811690811561056a5750600114611c1557610508836104fc8185038261140b565b600d5f9081527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb5939250905b808210611c59575090915081016020016104fc6104ec565b919260018160209254838588010152019101909291611c41565b60203660031901126103b3576004353068929eee149b4bd21268541461091b576108f3903068929eee149b4bd2126855805f52601260205260405f20611d10600160405192611cc1846113ef565b805484520154611cf6611cf160ff60208601936001600160a01b038116855260a01c161515806040870152151590565b61299c565b611d03835134101561212c565b516001600160a01b031690565b90519161349b565b346103b35760403660031901126103b357602060ff611d72600435611d3c816103f2565b6001600160a01b0360243591611d51836103f2565b165f526007845260405f20906001600160a01b03165f5260205260405f2090565b54166040519015158152f35b346103b3575f3660031901126103b357602060405160c08152f35b346103b35760403660031901126103b35760043560243590805f526012602052611dd8611dd360ff600160405f20015460a01c1615151590565b6126db565b611dfa611dea61164461164484612d48565b6001600160a01b031633146124ae565b611e058215156129e7565b611e37611e1061143e565b83815233602082015260016040820152611e32835f52601260205260405f2090565b612a32565b60405191825233917f92082651515300d88519a26e4776238666185a5ed2e422bb5c6261497c3894fa9080602081016109f9565b346103b35760203660031901126103b3576004355f908152601160209081526040918290208054600190910154835161ffff8084168252601084901c8116828601529383901c84169481019490945260309190911c9091166060830152608082015260a090f35b60203660031901126103b357600435611eea816103f2565b611ef2612abf565b63389a75e1600c52805f526020600c209081544211611f16575f610c2d9255612e97565b636f5e88185f526004601cfd5b60203660031901126103b357600435611f3b816103f2565b611f43612abf565b8060601b15611f5557610c2d90612e97565b637448fbae5f526004601cfd5b346103b35760203660031901126103b3576001600160a01b03600435611f87816103f2565b165f526016602052602060405f2054604051908152f35b346103b35760203660031901126103b357600435611fbb816103f2565b63389a75e1600c525f52602080600c2054604051908152f35b346103b35760203660031901126103b3576004355f52601160205261050861208061207b60405f2061207561206561206c61206560405194612015866113ce565b80549561ffff8716815261ffff8760101c16602082015260806001604083019361ffff8a60201c16855261205861ffff606086019b60301c168b9061ffff169052565b01549101525161ffff1690565b61ffff1690565b925161ffff1690565b90612119565b6135f6565b6040519081529081906020820190565b634e487b7160e01b5f52601160045260245ffd5b919082018092116120b157565b612090565b156120bd57565b606460405162461bcd60e51b815260206004820152601260248201527f53706f74206f7574206f6620626f756e647300000000000000000000000000006044820152fd5b9061098682029180830461098614901517156120b157565b818102929181159184041417156120b157565b1561213357565b606460405162461bcd60e51b815260206004820152601460248201527f496e73756666696369656e74207061796d656e740000000000000000000000006044820152fd5b1561217e57565b606460405162461bcd60e51b815260206004820152601260248201527f53706f7420616c72656164792074616b656e00000000000000000000000000006044820152fd5b6040513d5f823e3d90fd5b9061ffff8091169116019061ffff82116120b157565b9192909261ffff8316925b61ffff6121fb83836121cd565b1684101561227e5761ffff85165b61ffff61221685886121cd565b1681101561227257610986810281810461098614821517156120b15761223f8661225b926120a4565b6001908060081c5f52600e60205260ff60405f205491161c1690565b61226757600101612209565b505050505050600190565b506001909301926121ee565b50505050505f90565b9190916001600160a01b0361229b83612d48565b911692836001600160a01b03831603612435575f838152600660205260409020805492906122d86001600160a01b03871633908114908614171590565b6123f0575b6001600160a01b03936122ef86612db8565b6123e7575b50612310856001600160a01b03165f52600560205260405f2090565b80545f19019055612332826001600160a01b03165f52600560205260405f2090565b805460010190556001600160a01b0382164260a01b17600160e11b17612360855f52600460205260405f2090565b55600160e11b8116156123a2575b501680927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef5f80a41561239d57565b612b92565b600184016123b8815f52600460205260405f2090565b54156123c5575b5061236e565b5f5481146123bf576123df905f52600460205260405f2090565b555f806123bf565b5f90555f6122f4565b61242b6107f76107f0336124158a6001600160a01b03165f52600760205260405f2090565b906001600160a01b03165f5260205260405f2090565b156122dd57612b6a565b612b42565b5f805268aa4ec00224afccfdb76020527f913817da311d664dd3395c9b93b1f96a4af2b60ec505387b3ac50cc4468f348854606081901c9291908315612496575b90612710918460601b1890815f1904811182023d3d3e020490565b5068aa4ec00224afccfdb754606081901c935061247b565b156124b557565b606460405162461bcd60e51b815260206004820152600d60248201527f4e6f7420746865206f776e6572000000000000000000000000000000000000006044820152fd5b1561250057565b606460405162461bcd60e51b815260206004820152600e60248201527f4e6f206269647320706c616365640000000000000000000000000000000000006044820152fd5b3d1561256e573d906125558261175a565b91612563604051938461140b565b82523d5f602084013e565b606090565b1561257a57565b606460405162461bcd60e51b815260206004820152600f60248201527f5472616e73666572206661696c656400000000000000000000000000000000006044820152fd5b909161143c92604051926125d360208561140b565b5f8452612807565b908160209103126103b3575190565b908160209103126103b357516104b181610b22565b90913068929eee149b4bd21268541461091b573068929eee149b4bd2126855604082019261ffff8451169261263e606082019461ffff86511690612119565b9361264e610792600a5487612119565b8415612697576126899561268491612668845161ffff1690565b9161267e61206c61206c602088015161ffff1690565b92612f6b565b6130e5565b3868929eee149b4bd2126855565b606460405162461bcd60e51b815260206004820152601660248201527f43616e6e6f742073656e6420656d707479206d61726b000000000000000000006044820152fd5b156126e257565b606460405162461bcd60e51b815260206004820152601760248201527f53706f74206973206c697374656420666f722073616c650000000000000000006044820152fd5b1561272d57565b606460405162461bcd60e51b815260206004820152601560248201527f43616e277420626964206f6e206f776e2073706f7400000000000000000000006044820152fd5b1561277857565b606460405162461bcd60e51b815260206004820152601660248201527f416c7265616479206869676865737420626964646572000000000000000000006044820152fd5b156127c357565b606460405162461bcd60e51b815260206004820152600b60248201527f42696420746f6f206c6f770000000000000000000000000000000000000000006044820152fd5b929190612815828286612287565b803b612822575b50505050565b61282b936133fb565b15612839575f80808061281c565b7fd1a57ed6000000000000000000000000000000000000000000000000000000005f5260045ffd5b1561286857565b606460405162461bcd60e51b815260206004820152601460248201527f546f6b656e20646f6573206e6f742065786973740000000000000000000000006044820152fd5b9060405160c0810181811067ffffffffffffffff8211176113ea5760405260a06005829480548452600181015460208501526002810154604085015260038101546060850152600481015460808501520154910152565b805191908290602001825e015f815290565b600d545f929161292482611b96565b916001811690811561298a575060011461293c575050565b600d5f90815292935090917fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb55b8382106129765750500190565b600181602092548486015201910190612969565b60ff1916825250811515909102019150565b156129a357565b606460405162461bcd60e51b815260206004820152601160248201527f53706f74206e6f7420666f722073616c650000000000000000000000000000006044820152fd5b156129ee57565b606460405162461bcd60e51b815260206004820152601c60248201527f5072696365206d7573742062652067726561746572207468616e2030000000006044820152fd5b6001604091835181550191612a776001600160a01b0360208301511684906001600160a01b031673ffffffffffffffffffffffffffffffffffffffff19825416179055565b015181547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690151560a01b74ff000000000000000000000000000000000000000016179055565b638b78c6d819543303612ace57565b6382b429005f526004601cfd5b905f915f548110612ae95750565b9091505b805f52600460205260405f205480612b0e575080156120b1575f1901612aed565b600160e01b9150161590565b7fcfb3b942000000000000000000000000000000000000000000000000000000005f5260045ffd5b7fa1148100000000000000000000000000000000000000000000000000000000005f5260045ffd5b7f59c896be000000000000000000000000000000000000000000000000000000005f5260045ffd5b7fea553b34000000000000000000000000000000000000000000000000000000005f5260045ffd5b7f2e076300000000000000000000000000000000000000000000000000000000005f5260045ffd5b636f96cda160e11b5f5260045ffd5b90604051612c0060208261140b565b5f81525f5490612c11600183612e27565b6001600160a01b0384164260a01b17600160e11b17612c38835f52600460205260405f2090565b55612c54846001600160a01b03165f52600560205260405f2090565b6801000000000000000181540190556001600160a01b038416928315612d135760018301929460015b15612cb0575b5f86865f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4612c7d565b9460010194838603612c83579291945092505f55803b612ccf57509050565b5f545f198101929060015b15612cfe575b5f612cf36107f787600188019787613344565b15612cda575b612839565b808410612ce05792509250505f54036103b357565b612bba565b620f4240612d2b600c54600b5490612119565b0460c0018060c0116120b1576009548111612d435750565b600955565b612d5a815f52600460205260405f2090565b54908115612d715750600160e01b8116612be25790565b90505f54811015612be2575b5f19015f81815260046020526040902054908115612db15750600160e01b8116156104b157636f96cda160e11b5f5260045ffd5b9050612d7d565b5f5b60018110612dc6575050565b808201908183116120b157612e06826001935f5260126020525f84604082208281550155805f5260136020525f60408120555f52601460205260405f2090565b73ffffffffffffffffffffffffffffffffffffffff19815416905501612dba565b905f5b818110612e3657505050565b808301908184116120b157612e76826001935f5260126020525f84604082208281550155805f5260136020525f60408120555f52601460205260405f2090565b73ffffffffffffffffffffffffffffffffffffffff19815416905501612e2a565b6001600160a01b031680638b78c6d819547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3638b78c6d81955565b15612edc57565b606460405162461bcd60e51b815260206004820152601560248201527f44726177696e67206f7574206f6620626f756e647300000000000000000000006044820152fd5b15612f2757565b606460405162461bcd60e51b815260206004820152601660248201527f506978656c20616c7265616479206f63637570696564000000000000000000006044820152fd5b91612065612fb3919592949561098661ffff612f8783886121cd565b1611158061304f575b9093949250612f9f9150612ed5565b61ffff8116925b612fb361206584846121cd565b8410156130475761ffff85165b612fcd61206588886121cd565b81101561303a5780613034612fec87612fe7600195612101565b6120a4565b6130176130126107f7836001908060081c5f52600e60205260ff60405f205491161c1690565b612f20565b8060081c5f52600e602052600160ff60405f2092161b8154179055565b01612fc0565b5060019390930192612fa6565b945050505050565b50612f9f61305d88886121cd565b61ffff600954911611159050612f90565b81518154602080850151604086015165ffffffffffff1990931661ffff9485161760109190911b63ffff0000161791901b65ffff0000000016178255606083015191926001926080926130de9116855467ffff000000000000191660309190911b67ffff00000000000016178555565b0151910155565b5f5493929091906130f533612bf1565b369061310092611776565b805190602001209080516131159061ffff1690565b91602082019182516131289061ffff1690565b946040820194855161313b9061ffff1690565b966060840197885161314e9061ffff1690565b9161315761144d565b61ffff909416845261ffff16602084015261ffff16604083015261ffff166060820152836080820152613192885f52601160205260405f2090565b9061319c9161306e565b600c54906131a9916120a4565b600c556131b4612d18565b519151925193516040805161ffff94851681529484166020860152948316948401949094529216606082015260808101919091527fe49c824dd9285e5a675d11631ebbb14a83e2f5199068bb7be236198048bced919060a090a2565b805f5260146020526001600160a01b0360405f2054166132a6575b3461323e825f52601360205260405f2090565b556132553361064d835f52601460205260405f2090565b62093a8042018042116120b157613274825f52601560205260405f2090565b556040513481523391907f0e54eff26401bf69b81b26f60bd85ef47f5d85275c1d268d84f68d6897431c4790602090a3565b6132b8815f52601360205260405f2090565b546132ef6001600160a01b036132d6845f52601460205260405f2090565b54166001600160a01b03165f52601760205260405f2090565b80549182018092116120b1575561322b565b908160209103126103b357516104b181610389565b90926001600160a01b03608093816104b197961684521660208301526040820152816060820152019061047c565b91613373926020925f6001600160a01b03604051809781968295630a85bd0160e11b8452853360048601613316565b0393165af15f91816133ca575b5061339c5761338d612544565b805115612cf957805190602001fd5b7fffffffff0000000000000000000000000000000000000000000000000000000016630a85bd0160e11b1490565b6133ed91925060203d6020116133f4575b6133e5818361140b565b810190613301565b905f613380565b503d6133db565b906020925f6001600160a01b03613373969460405197889687958693630a85bd0160e11b85523360048601613316565b90604051600a608082019360a083016040525f8552935b5f19019360308282060185530492831561345e57600a90613442565b809350608091030191601f1901918252565b6040519061347d826113ef565b5f6040838281528260208201520152565b919082039182116120b157565b90613589906134ba6134ab613470565b6001600160a01b039092168252565b6135256134cd602083019580875261243a565b9050604083019081526134eb610e93865f52601260205260405f2090565b8051613519613511638b78c6d819546001600160a01b03165f52601760205260405f2090565b9182546120a4565b9055855190519061348e565b61355361351161353c84516001600160a01b031690565b6001600160a01b03165f52601760205260405f2090565b90556135718361356a83516001600160a01b031690565b33906125be565b83518034116135c6575b50516001600160a01b031690565b915160405190815233926001600160a01b031691907f1e42e95a909495fee2f816f68a8ad0d98bd2370b427930d8726790b48b80ae1a90602090a4565b6135d0903461348e565b6135ee613511336001600160a01b03165f52601760205260405f2090565b90555f61357b565b90815f925b6136025750565b6001909201915f19810116806135fb565b80516060929181613622575050565b9092506003600284010460021b90604051937f4142434445464748494a4b4c4d4e4f505152535455565758595a616263646566601f526106707f6768696a6b6c6d6e6f707172737475767778797a303132333435363738392d5f18603f52602085019183860190602082019260208183010194600460038751945f89525b0191603f8351818160121c16515f538181600c1c1651600153818160061c165160025316516003535f5181520190858210156136e1576004906003906136a0565b50935060407f3d3d000000000000000000000000000000000000000000000000000000000000936003935f9752016040520660020482035252825256fea2646970667358221220e37e645cc28d9c8d324a708bf5493fd6176e477538d718a9756335665720838a64736f6c634300081a0033000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000036d696c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000036d696c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005068747470733a2f2f676174657761792e70696e6174612e636c6f75642f697066732f516d5a5569644373613448717755556e683651747959566b734b4c696a3377476e7832434a324e786f686f6a536900000000000000000000000000000000 | 60806040526004361015610011575f80fd5b5f3560e01c806301ffc9a71461038457806304634d8d1461037f57806306fdde031461037a578063081812fc14610375578063095ea7b3146103705780630e0f96b61461036b5780630eaaf4c814610366578063117d97741461036157806311d927e41461035c578063127caa881461035757806316c38b3c1461035257806318160ddd1461034d5780631f2bf46914610348578063230f7ed01461034357806323b872dd1461033e57806325692962146103395780632a55205a146103345780632c69f97c1461032f578063305a67a81461032a57806334829bf4146103255780633ccfd60b1461032057806342842e0e1461031b578063451df52e1461031657806354d1f13d146103115780635c975abb1461030c57806362823db4146103075780636352211e1461030257806370a08231146102fd578063715018a6146102f857806371bf439e146102f3578063748b3307146102ee5780637f38e526146102e95780637f3c8160146102e457806380e2c55d146102df5780638da5cb5b146102da5780638f043c6b146102d557806395d89b41146102d0578063960bfe04146102cb5780639979ef45146102c6578063a22cb465146102c1578063ae04443a146102bc578063b14c63c5146102b7578063b88d4fde146102b2578063c87b56dd146102ad578063cfc86f7b146102a8578063d3d7ee44146102a3578063e985e9c51461029e578063ed4127df14610299578063ee8f699214610294578063efe13c281461028f578063f04e283e1461028a578063f2fde38b14610285578063f3f4370314610280578063fee81cf41461027b5763ff4240c714610276575f80fd5b611fd4565b611f9e565b611f62565b611f23565b611ed2565b611e6b565b611d99565b611d7e565b611d18565b611c73565b611bce565b61180f565b6117ac565b611730565b611713565b61167a565b6115a5565b611584565b6114df565b61145c565b611390565b61135a565b61133d565b611301565b6112e0565b6112c4565b61127b565b611207565b6111d8565b6110b3565b611091565b61104d565b61101a565b611008565b610fc2565b610f08565b610e4b565b610cff565b610c78565b610c2f565b610c1b565b610bd2565b610b86565b610b65565b610b2c565b610af8565b610ab1565b610a50565b610928565b6106fe565b6105f7565b61058e565b6104b4565b610403565b6103b7565b7fffffffff000000000000000000000000000000000000000000000000000000008116036103b357565b5f80fd5b346103b35760203660031901126103b35760206004356103d681610389565b60e01c604051906301ffc9a7632a55205a821491141715158152f35b6001600160a01b038116036103b357565b346103b35760403660031901126103b357600435610420816103f2565b602435906bffffffffffffffffffffffff82168092036103b357610442612abf565b612710821161046f5760601b8015610462571768aa4ec00224afccfdb755005b63b4457eaa5f526004601cfd5b63350a88b35f526004601cfd5b805180835260209291819084018484015e5f828201840152601f01601f1916010190565b9060206104b192818152019061047c565b90565b346103b3575f3660031901126103b3576040515f6002546104d481611b96565b808452906001811690811561056a575060011461050c575b610508836104fc8185038261140b565b604051918291826104a0565b0390f35b60025f9081527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace939250905b808210610550575090915081016020016104fc6104ec565b919260018160209254838588010152019101909291610538565b60ff191660208086019190915291151560051b840190910191506104fc90506104ec565b346103b35760203660031901126103b3576004356105ab81612adb565b156105cf575f52600660205260206001600160a01b0360405f205416604051908152f35b7fcf4700e4000000000000000000000000000000000000000000000000000000005f5260045ffd5b60403660031901126103b35760043561060f816103f2565b602435906001600160a01b0361062483612d48565b169081330361069d575b806106756001600160a01b039261064d865f52600660205260405f2090565b906001600160a01b031673ffffffffffffffffffffffffffffffffffffffff19825416179055565b16907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9255f80a4005b815f52600760205260ff6106c53360405f20906001600160a01b03165f5260205260405f2090565b541661062e57612b1a565b9181601f840112156103b35782359167ffffffffffffffff83116103b357602083818601950101116103b357565b60a03660031901126103b35760043560243560443560643560843567ffffffffffffffff81116103b3576107369036906004016106d0565b9290923068929eee149b4bd21268541461091b573068929eee149b4bd212685561098661076383886120a4565b111580610901575b6107799096929491966120b6565b61079a6107926107898587612119565b600a5490612119565b34101561212c565b81935b6107a781846120a4565b85101561083857855b6107ba85886120a4565b81101561082c57806108006107fb6107f76107f06001956107e38c5f52601060205260405f2090565b905f5260205260405f2090565b5460ff1690565b1590565b612177565b610826610819826107e38a5f52601060205260405f2090565b805460ff19166001179055565b016107b0565b5060019094019361079d565b916108de94506108a06108eb976108e6976108636108d9955f549361085c33612bf1565b3691611776565b602081519101209061087361142d565b948552602085015285604085015286606085015242608085015260a08401525f52600f60205260405f2090565b9060a060059180518455602081015160018501556040810151600285015560608101516003850155608081015160048501550151910155565b612119565b600c546120a4565b600c55565b6108f3612d18565b3868929eee149b4bd2126855005b5061077961090f84876120a4565b6009541015905061076b565b63ab143c065f526004601cfd5b346103b35760203660031901126103b357600435805f5260146020526001600160a01b0360405f2054163303610a0c5761096a815f52601360205260405f2090565b54905f61097f825f52601360205260405f2090565b556109b2610995825f52601460205260405f2090565b73ffffffffffffffffffffffffffffffffffffffff198154169055565b815f8115610a03575b5f80809381933390f1156109fe5760405191825233917f8f8619524e8d462cead34604bd2247ede24175801481e4d0b8059ac8aa41c3019080602081015b0390a3005b6121c2565b506108fc6109bb565b606460405162461bcd60e51b815260206004820152601660248201527f4e6f7420746865206869676865737420626964646572000000000000000000006044820152fd5b346103b3575f3660031901126103b3576020600a54604051908152f35b6004359061ffff821682036103b357565b6024359061ffff821682036103b357565b6044359061ffff821682036103b357565b6064359061ffff821682036103b357565b346103b35760803660031901126103b3576020610aee610acf610a6d565b610ad7610a7e565b610adf610a8f565b90610ae8610aa0565b926121e3565b6040519015158152f35b346103b35760203660031901126103b3576004355f526015602052602060405f2054604051908152f35b801515036103b357565b346103b35760203660031901126103b357600435610b4981610b22565b610b51612abf565b60ff80196018541691151516176018555f80f35b346103b3575f3660031901126103b35760205f546001549003604051908152f35b346103b35760203660031901126103b3576004355f526012602052606060405f2060ff600182549201546040519283526001600160a01b038116602084015260a01c1615156040820152f35b346103b3575f3660031901126103b3576020600954604051908152f35b60609060031901126103b357600435610c07816103f2565b90602435610c14816103f2565b9060443590565b610c2d610c2736610bef565b91612287565b005b5f3660031901126103b35763389a75e1600c52335f526202a30042016020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a2005b346103b35760403660031901126103b357600435602435905f5268aa4ec00224afccfdb760205260405f2054908160601c918215610ce7575b90612710918360601b1890815f1904811182023d3d3e604080516001600160a01b03959095168552910291909104602083015290f35b5068aa4ec00224afccfdb754606081901c9250610cb1565b346103b35760203660031901126103b3576004353068929eee149b4bd21268541461091b573068929eee149b4bd2126855610d4c6001600160a01b03610d4483612d48565b1633146124ae565b610d816001600160a01b03610d79610d6c845f52601460205260405f2090565b546001600160a01b031690565b1615156124f9565b610d96610d6c825f52601460205260405f2090565b90610da9815f52601360205260405f2090565b54905f610dbe825f52601360205260405f2090565b55610dd4610995825f52601460205260405f2090565b335f908152601660205260409020610ded8382546120a4565b9055610dfa8184336125be565b7f1e42e95a909495fee2f816f68a8ad0d98bd2370b427930d8726790b48b80ae1a6001600160a01b0360405194169380610e3a3395829190602083019252565b0390a43868929eee149b4bd2126855005b346103b35760203660031901126103b357600435805f5260126020526001600160a01b03600160405f200154163303610ec457610e9e610e93825f52601260205260405f2090565b60015f918281550155565b7f411aee90354c51b1b04cd563fcab2617142a9d50da19232d888547c8a1b7fd8a5f80a2005b606460405162461bcd60e51b815260206004820152600e60248201527f4e6f74207468652073656c6c65720000000000000000000000000000000000006044820152fd5b346103b3575f3660031901126103b3573068929eee149b4bd21268541461091b573068929eee149b4bd2126855335f52601660205260405f20548015610f7e575f8080806108f39481610f6c336001600160a01b03165f52601660205260405f2090565b55335af1610f78612544565b50612573565b606460405162461bcd60e51b815260206004820152601260248201527f4e6f2070656e64696e672062616c616e636500000000000000000000000000006044820152fd5b346103b3575f3660031901126103b357610fda612abf565b5f808080476001600160a01b03638b78c6d8195416828215610fff575bf1156109fe57005b506108fc610ff7565b610c2d61101436610bef565b916125be565b346103b35760203660031901126103b3576004355f52601460205260206001600160a01b0360405f205416604051908152f35b5f3660031901126103b35763389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2005b346103b3575f3660031901126103b357602060ff601854166040519015158152f35b346103b35760203660031901126103b3576001600160a01b036004356110d8816103f2565b6110e0612abf565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152911690602081602481855afa9081156109fe575f926020926111739285916111ab575b506040517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481019190915293849283919082906044820190565b03925af180156109fe5761118357005b610c2d9060203d6020116111a4575b61119c818361140b565b8101906125ea565b503d611192565b6111cb9150843d86116111d1575b6111c3818361140b565b8101906125db565b5f61112f565b503d6111b9565b346103b35760203660031901126103b35760206001600160a01b036111fe600435612d48565b16604051908152f35b346103b35760203660031901126103b3576001600160a01b0360043561122c816103f2565b168015611253575f526005602052602067ffffffffffffffff60405f205416604051908152f35b7f8f4eb604000000000000000000000000000000000000000000000000000000005f5260045ffd5b5f3660031901126103b35761128e612abf565b5f638b78c6d819547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a35f638b78c6d81955005b346103b3575f3660031901126103b35760206040516109868152f35b346103b35760203660031901126103b3576004356112fc612abf565b600a55005b346103b35760203660031901126103b3576001600160a01b03600435611326816103f2565b165f526017602052602060405f2054604051908152f35b346103b3575f3660031901126103b3576020600b54604051908152f35b346103b3575f3660031901126103b3576080600c54600b54600954600a5491604051938452602084015260408301526060820152f35b346103b3575f3660031901126103b3576020638b78c6d819546001600160a01b0360405191168152f35b634e487b7160e01b5f52604160045260245ffd5b60a0810190811067ffffffffffffffff8211176113ea57604052565b6113ba565b6060810190811067ffffffffffffffff8211176113ea57604052565b90601f8019910116810190811067ffffffffffffffff8211176113ea57604052565b6040519061143c60c08361140b565b565b6040519061143c60608361140b565b6040519061143c60a08361140b565b366003190160c081126103b35760a0136103b35760405161147c816113ce565b611484610a6d565b815261148e610a7e565b602082015261149b610a8f565b60408201526114a8610aa0565b6060820152608435608082015260a4359067ffffffffffffffff82116103b3576114d9610c2d9236906004016106d0565b916125ff565b346103b3575f3660031901126103b3576040515f6003546114ff81611b96565b808452906001811690811561056a575060011461152657610508836104fc8185038261140b565b60035f9081527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b939250905b80821061156a575090915081016020016104fc6104ec565b919260018160209254838588010152019101909291611552565b346103b35760203660031901126103b3576004356115a0612abf565b600b55005b60203660031901126103b3576004353068929eee149b4bd21268541461091b576108f3903068929eee149b4bd2126855805f5260126020526115f460ff600160405f20015460a01c16156126db565b6116296116186001600160a01b0361160b84612d48565b166001600160a01b031690565b6001600160a01b0316331415612726565b611658611650611644610d6c845f52601460205260405f2090565b6001600160a01b031690565b331415612771565b61167561166d825f52601360205260405f2090565b5434116127bc565b613210565b346103b35760403660031901126103b357600435611697816103f2565b6001600160a01b03602435916116ac83610b22565b335f5260076020526116d28160405f20906001600160a01b03165f5260205260405f2090565b60ff1981541660ff85151516179055604051921515835216907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a3005b346103b3575f3660031901126103b3576020600c54604051908152f35b346103b35760203660031901126103b3576004355f526013602052602060405f2054604051908152f35b67ffffffffffffffff81116113ea57601f01601f191660200190565b9291926117828261175a565b91611790604051938461140b565b8294818452818301116103b3578281602093845f960137010152565b60803660031901126103b3576004356117c4816103f2565b602435906117d1826103f2565b6044356064359267ffffffffffffffff84116103b357366023850112156103b357611809610c2d943690602481600401359101611776565b92612807565b346103b35760203660031901126103b35760043561182c81612adb565b61183590612861565b611847815f52600f60205260405f2090565b611850906128ac565b9061185a8161342b565b906118649061342b565b9180516118709061342b565b90602081015161187f9061342b565b604082015161188d9061342b565b916060015161189b9061342b565b6040517f7b226e616d65223a202253706f742023000000000000000000000000000000006020820152958695919491603087016118d791612903565b7f222c20226465736372697074696f6e223a20224120756e697175652073706f7481527f206f6e20746865204d696c6c7943616e766173222c200000000000000000000060208201526036017f22696d616765223a2022000000000000000000000000000000000000000000008152600a0161195290612915565b61195b91612903565b7f222c20000000000000000000000000000000000000000000000000000000000081526003017f2261747472696275746573223a205b00000000000000000000000000000000008152600f017f7b2274726169745f74797065223a202258222c202276616c7565223a202200008152601e016119d691612903565b630113e96160e51b81526004017f7b2274726169745f74797065223a202259222c202276616c7565223a202200008152601e01611a1291612903565b630113e96160e51b81526004017f7b2274726169745f74797065223a20225769647468222c202276616c7565223a81527f20220000000000000000000000000000000000000000000000000000000000006020820152602201611a7491612903565b630113e96160e51b81526004017f7b2274726169745f74797065223a2022486569676874222c202276616c75652281527f3a202200000000000000000000000000000000000000000000000000000000006020820152602301611ad691612903565b7f227d00000000000000000000000000000000000000000000000000000000000081526002017f5d7d000000000000000000000000000000000000000000000000000000000000815260020103601f1981018252611b34908261140b565b611b3d90613613565b6040517f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000006020820152908190603d8201611b7691612903565b03601f1981018252611b88908261140b565b6040516105088192826104a0565b90600182811c92168015611bc4575b6020831014611bb057565b634e487b7160e01b5f52602260045260245ffd5b91607f1691611ba5565b346103b3575f3660031901126103b3576040515f600d54611bee81611b96565b808452906001811690811561056a5750600114611c1557610508836104fc8185038261140b565b600d5f9081527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb5939250905b808210611c59575090915081016020016104fc6104ec565b919260018160209254838588010152019101909291611c41565b60203660031901126103b3576004353068929eee149b4bd21268541461091b576108f3903068929eee149b4bd2126855805f52601260205260405f20611d10600160405192611cc1846113ef565b805484520154611cf6611cf160ff60208601936001600160a01b038116855260a01c161515806040870152151590565b61299c565b611d03835134101561212c565b516001600160a01b031690565b90519161349b565b346103b35760403660031901126103b357602060ff611d72600435611d3c816103f2565b6001600160a01b0360243591611d51836103f2565b165f526007845260405f20906001600160a01b03165f5260205260405f2090565b54166040519015158152f35b346103b3575f3660031901126103b357602060405160c08152f35b346103b35760403660031901126103b35760043560243590805f526012602052611dd8611dd360ff600160405f20015460a01c1615151590565b6126db565b611dfa611dea61164461164484612d48565b6001600160a01b031633146124ae565b611e058215156129e7565b611e37611e1061143e565b83815233602082015260016040820152611e32835f52601260205260405f2090565b612a32565b60405191825233917f92082651515300d88519a26e4776238666185a5ed2e422bb5c6261497c3894fa9080602081016109f9565b346103b35760203660031901126103b3576004355f908152601160209081526040918290208054600190910154835161ffff8084168252601084901c8116828601529383901c84169481019490945260309190911c9091166060830152608082015260a090f35b60203660031901126103b357600435611eea816103f2565b611ef2612abf565b63389a75e1600c52805f526020600c209081544211611f16575f610c2d9255612e97565b636f5e88185f526004601cfd5b60203660031901126103b357600435611f3b816103f2565b611f43612abf565b8060601b15611f5557610c2d90612e97565b637448fbae5f526004601cfd5b346103b35760203660031901126103b3576001600160a01b03600435611f87816103f2565b165f526016602052602060405f2054604051908152f35b346103b35760203660031901126103b357600435611fbb816103f2565b63389a75e1600c525f52602080600c2054604051908152f35b346103b35760203660031901126103b3576004355f52601160205261050861208061207b60405f2061207561206561206c61206560405194612015866113ce565b80549561ffff8716815261ffff8760101c16602082015260806001604083019361ffff8a60201c16855261205861ffff606086019b60301c168b9061ffff169052565b01549101525161ffff1690565b61ffff1690565b925161ffff1690565b90612119565b6135f6565b6040519081529081906020820190565b634e487b7160e01b5f52601160045260245ffd5b919082018092116120b157565b612090565b156120bd57565b606460405162461bcd60e51b815260206004820152601260248201527f53706f74206f7574206f6620626f756e647300000000000000000000000000006044820152fd5b9061098682029180830461098614901517156120b157565b818102929181159184041417156120b157565b1561213357565b606460405162461bcd60e51b815260206004820152601460248201527f496e73756666696369656e74207061796d656e740000000000000000000000006044820152fd5b1561217e57565b606460405162461bcd60e51b815260206004820152601260248201527f53706f7420616c72656164792074616b656e00000000000000000000000000006044820152fd5b6040513d5f823e3d90fd5b9061ffff8091169116019061ffff82116120b157565b9192909261ffff8316925b61ffff6121fb83836121cd565b1684101561227e5761ffff85165b61ffff61221685886121cd565b1681101561227257610986810281810461098614821517156120b15761223f8661225b926120a4565b6001908060081c5f52600e60205260ff60405f205491161c1690565b61226757600101612209565b505050505050600190565b506001909301926121ee565b50505050505f90565b9190916001600160a01b0361229b83612d48565b911692836001600160a01b03831603612435575f838152600660205260409020805492906122d86001600160a01b03871633908114908614171590565b6123f0575b6001600160a01b03936122ef86612db8565b6123e7575b50612310856001600160a01b03165f52600560205260405f2090565b80545f19019055612332826001600160a01b03165f52600560205260405f2090565b805460010190556001600160a01b0382164260a01b17600160e11b17612360855f52600460205260405f2090565b55600160e11b8116156123a2575b501680927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef5f80a41561239d57565b612b92565b600184016123b8815f52600460205260405f2090565b54156123c5575b5061236e565b5f5481146123bf576123df905f52600460205260405f2090565b555f806123bf565b5f90555f6122f4565b61242b6107f76107f0336124158a6001600160a01b03165f52600760205260405f2090565b906001600160a01b03165f5260205260405f2090565b156122dd57612b6a565b612b42565b5f805268aa4ec00224afccfdb76020527f913817da311d664dd3395c9b93b1f96a4af2b60ec505387b3ac50cc4468f348854606081901c9291908315612496575b90612710918460601b1890815f1904811182023d3d3e020490565b5068aa4ec00224afccfdb754606081901c935061247b565b156124b557565b606460405162461bcd60e51b815260206004820152600d60248201527f4e6f7420746865206f776e6572000000000000000000000000000000000000006044820152fd5b1561250057565b606460405162461bcd60e51b815260206004820152600e60248201527f4e6f206269647320706c616365640000000000000000000000000000000000006044820152fd5b3d1561256e573d906125558261175a565b91612563604051938461140b565b82523d5f602084013e565b606090565b1561257a57565b606460405162461bcd60e51b815260206004820152600f60248201527f5472616e73666572206661696c656400000000000000000000000000000000006044820152fd5b909161143c92604051926125d360208561140b565b5f8452612807565b908160209103126103b3575190565b908160209103126103b357516104b181610b22565b90913068929eee149b4bd21268541461091b573068929eee149b4bd2126855604082019261ffff8451169261263e606082019461ffff86511690612119565b9361264e610792600a5487612119565b8415612697576126899561268491612668845161ffff1690565b9161267e61206c61206c602088015161ffff1690565b92612f6b565b6130e5565b3868929eee149b4bd2126855565b606460405162461bcd60e51b815260206004820152601660248201527f43616e6e6f742073656e6420656d707479206d61726b000000000000000000006044820152fd5b156126e257565b606460405162461bcd60e51b815260206004820152601760248201527f53706f74206973206c697374656420666f722073616c650000000000000000006044820152fd5b1561272d57565b606460405162461bcd60e51b815260206004820152601560248201527f43616e277420626964206f6e206f776e2073706f7400000000000000000000006044820152fd5b1561277857565b606460405162461bcd60e51b815260206004820152601660248201527f416c7265616479206869676865737420626964646572000000000000000000006044820152fd5b156127c357565b606460405162461bcd60e51b815260206004820152600b60248201527f42696420746f6f206c6f770000000000000000000000000000000000000000006044820152fd5b929190612815828286612287565b803b612822575b50505050565b61282b936133fb565b15612839575f80808061281c565b7fd1a57ed6000000000000000000000000000000000000000000000000000000005f5260045ffd5b1561286857565b606460405162461bcd60e51b815260206004820152601460248201527f546f6b656e20646f6573206e6f742065786973740000000000000000000000006044820152fd5b9060405160c0810181811067ffffffffffffffff8211176113ea5760405260a06005829480548452600181015460208501526002810154604085015260038101546060850152600481015460808501520154910152565b805191908290602001825e015f815290565b600d545f929161292482611b96565b916001811690811561298a575060011461293c575050565b600d5f90815292935090917fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb55b8382106129765750500190565b600181602092548486015201910190612969565b60ff1916825250811515909102019150565b156129a357565b606460405162461bcd60e51b815260206004820152601160248201527f53706f74206e6f7420666f722073616c650000000000000000000000000000006044820152fd5b156129ee57565b606460405162461bcd60e51b815260206004820152601c60248201527f5072696365206d7573742062652067726561746572207468616e2030000000006044820152fd5b6001604091835181550191612a776001600160a01b0360208301511684906001600160a01b031673ffffffffffffffffffffffffffffffffffffffff19825416179055565b015181547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690151560a01b74ff000000000000000000000000000000000000000016179055565b638b78c6d819543303612ace57565b6382b429005f526004601cfd5b905f915f548110612ae95750565b9091505b805f52600460205260405f205480612b0e575080156120b1575f1901612aed565b600160e01b9150161590565b7fcfb3b942000000000000000000000000000000000000000000000000000000005f5260045ffd5b7fa1148100000000000000000000000000000000000000000000000000000000005f5260045ffd5b7f59c896be000000000000000000000000000000000000000000000000000000005f5260045ffd5b7fea553b34000000000000000000000000000000000000000000000000000000005f5260045ffd5b7f2e076300000000000000000000000000000000000000000000000000000000005f5260045ffd5b636f96cda160e11b5f5260045ffd5b90604051612c0060208261140b565b5f81525f5490612c11600183612e27565b6001600160a01b0384164260a01b17600160e11b17612c38835f52600460205260405f2090565b55612c54846001600160a01b03165f52600560205260405f2090565b6801000000000000000181540190556001600160a01b038416928315612d135760018301929460015b15612cb0575b5f86865f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4612c7d565b9460010194838603612c83579291945092505f55803b612ccf57509050565b5f545f198101929060015b15612cfe575b5f612cf36107f787600188019787613344565b15612cda575b612839565b808410612ce05792509250505f54036103b357565b612bba565b620f4240612d2b600c54600b5490612119565b0460c0018060c0116120b1576009548111612d435750565b600955565b612d5a815f52600460205260405f2090565b54908115612d715750600160e01b8116612be25790565b90505f54811015612be2575b5f19015f81815260046020526040902054908115612db15750600160e01b8116156104b157636f96cda160e11b5f5260045ffd5b9050612d7d565b5f5b60018110612dc6575050565b808201908183116120b157612e06826001935f5260126020525f84604082208281550155805f5260136020525f60408120555f52601460205260405f2090565b73ffffffffffffffffffffffffffffffffffffffff19815416905501612dba565b905f5b818110612e3657505050565b808301908184116120b157612e76826001935f5260126020525f84604082208281550155805f5260136020525f60408120555f52601460205260405f2090565b73ffffffffffffffffffffffffffffffffffffffff19815416905501612e2a565b6001600160a01b031680638b78c6d819547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3638b78c6d81955565b15612edc57565b606460405162461bcd60e51b815260206004820152601560248201527f44726177696e67206f7574206f6620626f756e647300000000000000000000006044820152fd5b15612f2757565b606460405162461bcd60e51b815260206004820152601660248201527f506978656c20616c7265616479206f63637570696564000000000000000000006044820152fd5b91612065612fb3919592949561098661ffff612f8783886121cd565b1611158061304f575b9093949250612f9f9150612ed5565b61ffff8116925b612fb361206584846121cd565b8410156130475761ffff85165b612fcd61206588886121cd565b81101561303a5780613034612fec87612fe7600195612101565b6120a4565b6130176130126107f7836001908060081c5f52600e60205260ff60405f205491161c1690565b612f20565b8060081c5f52600e602052600160ff60405f2092161b8154179055565b01612fc0565b5060019390930192612fa6565b945050505050565b50612f9f61305d88886121cd565b61ffff600954911611159050612f90565b81518154602080850151604086015165ffffffffffff1990931661ffff9485161760109190911b63ffff0000161791901b65ffff0000000016178255606083015191926001926080926130de9116855467ffff000000000000191660309190911b67ffff00000000000016178555565b0151910155565b5f5493929091906130f533612bf1565b369061310092611776565b805190602001209080516131159061ffff1690565b91602082019182516131289061ffff1690565b946040820194855161313b9061ffff1690565b966060840197885161314e9061ffff1690565b9161315761144d565b61ffff909416845261ffff16602084015261ffff16604083015261ffff166060820152836080820152613192885f52601160205260405f2090565b9061319c9161306e565b600c54906131a9916120a4565b600c556131b4612d18565b519151925193516040805161ffff94851681529484166020860152948316948401949094529216606082015260808101919091527fe49c824dd9285e5a675d11631ebbb14a83e2f5199068bb7be236198048bced919060a090a2565b805f5260146020526001600160a01b0360405f2054166132a6575b3461323e825f52601360205260405f2090565b556132553361064d835f52601460205260405f2090565b62093a8042018042116120b157613274825f52601560205260405f2090565b556040513481523391907f0e54eff26401bf69b81b26f60bd85ef47f5d85275c1d268d84f68d6897431c4790602090a3565b6132b8815f52601360205260405f2090565b546132ef6001600160a01b036132d6845f52601460205260405f2090565b54166001600160a01b03165f52601760205260405f2090565b80549182018092116120b1575561322b565b908160209103126103b357516104b181610389565b90926001600160a01b03608093816104b197961684521660208301526040820152816060820152019061047c565b91613373926020925f6001600160a01b03604051809781968295630a85bd0160e11b8452853360048601613316565b0393165af15f91816133ca575b5061339c5761338d612544565b805115612cf957805190602001fd5b7fffffffff0000000000000000000000000000000000000000000000000000000016630a85bd0160e11b1490565b6133ed91925060203d6020116133f4575b6133e5818361140b565b810190613301565b905f613380565b503d6133db565b906020925f6001600160a01b03613373969460405197889687958693630a85bd0160e11b85523360048601613316565b90604051600a608082019360a083016040525f8552935b5f19019360308282060185530492831561345e57600a90613442565b809350608091030191601f1901918252565b6040519061347d826113ef565b5f6040838281528260208201520152565b919082039182116120b157565b90613589906134ba6134ab613470565b6001600160a01b039092168252565b6135256134cd602083019580875261243a565b9050604083019081526134eb610e93865f52601260205260405f2090565b8051613519613511638b78c6d819546001600160a01b03165f52601760205260405f2090565b9182546120a4565b9055855190519061348e565b61355361351161353c84516001600160a01b031690565b6001600160a01b03165f52601760205260405f2090565b90556135718361356a83516001600160a01b031690565b33906125be565b83518034116135c6575b50516001600160a01b031690565b915160405190815233926001600160a01b031691907f1e42e95a909495fee2f816f68a8ad0d98bd2370b427930d8726790b48b80ae1a90602090a4565b6135d0903461348e565b6135ee613511336001600160a01b03165f52601760205260405f2090565b90555f61357b565b90815f925b6136025750565b6001909201915f19810116806135fb565b80516060929181613622575050565b9092506003600284010460021b90604051937f4142434445464748494a4b4c4d4e4f505152535455565758595a616263646566601f526106707f6768696a6b6c6d6e6f707172737475767778797a303132333435363738392d5f18603f52602085019183860190602082019260208183010194600460038751945f89525b0191603f8351818160121c16515f538181600c1c1651600153818160061c165160025316516003535f5181520190858210156136e1576004906003906136a0565b50935060407f3d3d000000000000000000000000000000000000000000000000000000000000936003935f9752016040520660020482035252825256fea2646970667358221220e37e645cc28d9c8d324a708bf5493fd6176e477538d718a9756335665720838a64736f6c634300081a0033 | |
1 | 20,291,146 | c232518ea936beb7012246d8a62b11974fd2cec13aaffe1fc3eb7585975f2e5d | 501e33135c40ae31d88dc6848807c8fe69c8dd95f00b00a7a69999da74f2241e | 21ca0219fbf188a4ce905ae000c026eab407ec48 | 21ca0219fbf188a4ce905ae000c026eab407ec48 | 25d82b7f4b99f27b4545d4532b87832e6a8f1710 | 6080604052600f600655600f6007555f6008555f6009556014600a556014600b55601e600c556032600d555f600e556009600a61003c919061030a565b61004a906301312d0061031f565b600f556100596009600a61030a565b610067906301312d0061031f565b6010556100766009600a61030a565b610083906298968061031f565b6011556100926009600a61030a565b61009f906298968061031f565b6012556014805461ffff60a81b191690555f60158190556016553480156100c4575f80fd5b505f80546001600160a01b031916339081178255604051909182917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600580546001600160a01b031916331790556101236009600a61030a565b61013190633b9aca0061031f565b335f9081526001602081905260408220929092556003906101595f546001600160a01b031690565b6001600160a01b03908116825260208083019390935260409182015f908120805495151560ff1996871617905530815260039093528183208054851660019081179091556005549091168352912080549092161790556101b63390565b6001600160a01b03165f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6101ed6009600a61030a565b6101fb90633b9aca0061031f565b60405190815260200160405180910390a3610336565b634e487b7160e01b5f52601160045260245ffd5b6001815b60018411156102605780850481111561024457610244610211565b600184161561025257908102905b60019390931c928002610229565b935093915050565b5f8261027657506001610304565b8161028257505f610304565b816001811461029857600281146102a2576102be565b6001915050610304565b60ff8411156102b3576102b3610211565b50506001821b610304565b5060208310610133831016604e8410600b84101617156102e1575081810a610304565b6102ed5f198484610225565b805f190482111561030057610300610211565b0290505b92915050565b5f61031860ff841683610268565b9392505050565b808202811582820484141761030457610304610211565b611c12806103435f395ff3fe608060405260043610610164575f3560e01c8063751039fc116100cd578063b4fe8f6a11610087578063d34628cc11610062578063d34628cc14610404578063dd62ed3e14610423578063e086e5ec14610467578063ec1f3f631461047b575f80fd5b8063b4fe8f6a146103c7578063bf474bed146103db578063c9567bf9146103f0575f80fd5b8063751039fc146103185780637d1db4a51461032c5780638da5cb5b146103415780638f9a55c01461036757806395d89b411461037c578063a9059cbb146103a8575f80fd5b8063313ce5671161011e578063313ce5671461024b57806331c2d847146102665780633bbac5791461028557806351bc3c85146102bc57806370a08231146102d0578063715018a614610304575f80fd5b806306fdde031461016f578063095ea7b3146101b05780630faee56f146101df578063109daa991461020257806318160ddd1461021857806323b872dd1461022c575f80fd5b3661016b57005b5f80fd5b34801561017a575f80fd5b506040805180820190915260078152664b65726f70706960c81b60208201525b6040516101a79190611714565b60405180910390f35b3480156101bb575f80fd5b506101cf6101ca36600461176d565b61049a565b60405190151581526020016101a7565b3480156101ea575f80fd5b506101f460125481565b6040519081526020016101a7565b34801561020d575f80fd5b506102166104b0565b005b348015610223575f80fd5b506101f461051e565b348015610237575f80fd5b506101cf610246366004611797565b61053e565b348015610256575f80fd5b50604051600981526020016101a7565b348015610271575f80fd5b506102166102803660046117e9565b6105a5565b348015610290575f80fd5b506101cf61029f3660046118b4565b6001600160a01b03165f9081526004602052604090205460ff1690565b3480156102c7575f80fd5b5061021661062c565b3480156102db575f80fd5b506101f46102ea3660046118b4565b6001600160a01b03165f9081526001602052604090205490565b34801561030f575f80fd5b50610216610679565b348015610323575f80fd5b506102166106ea565b348015610337575f80fd5b506101f4600f5481565b34801561034c575f80fd5b505f546040516001600160a01b0390911681526020016101a7565b348015610372575f80fd5b506101f460105481565b348015610387575f80fd5b506040805180820190915260048152634b45524f60e01b602082015261019a565b3480156103b3575f80fd5b506101cf6103c236600461176d565b610796565b3480156103d2575f80fd5b506102166107a2565b3480156103e6575f80fd5b506101f460115481565b3480156103fb575f80fd5b506102166107db565b34801561040f575f80fd5b5061021661041e3660046117e9565b610b84565b34801561042e575f80fd5b506101f461043d3660046118cf565b6001600160a01b039182165f90815260026020908152604080832093909416825291909152205490565b348015610472575f80fd5b50610216610c08565b348015610486575f80fd5b50610216610495366004611906565b610c34565b5f6104a6338484610c79565b5060015b92915050565b5f546001600160a01b031633146104e25760405162461bcd60e51b81526004016104d99061191d565b60405180910390fd5b5f600d8190556040519081527fe9b79e1a6c2dc43b4c0c6ff01ce9e3332d810e482270f464c0a21ad6c5fc6de3906020015b60405180910390a1565b5f61052b6009600a611a49565b61053990633b9aca00611a57565b905090565b5f61054a848484610d9c565b61059b843361059685604051806060016040528060288152602001611bb5602891396001600160a01b038a165f9081526002602090815260408083203384529091529020549190611390565b610c79565b5060019392505050565b5f546001600160a01b031633146105ce5760405162461bcd60e51b81526004016104d99061191d565b5f5b8151811015610628575f60045f8484815181106105ef576105ef611a6e565b6020908102919091018101516001600160a01b031682528101919091526040015f20805460ff19169115159190911790556001016105d0565b5050565b6005546001600160a01b0316336001600160a01b03161461064b575f80fd5b305f90815260016020526040902054801561066957610669816113c8565b4780156106285761062881611538565b5f546001600160a01b031633146106a25760405162461bcd60e51b81526004016104d99061191d565b5f80546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a35f80546001600160a01b0319169055565b5f546001600160a01b031633146107135760405162461bcd60e51b81526004016104d99061191d565b61071f6009600a611a49565b61072d90633b9aca00611a57565b600f5561073c6009600a611a49565b61074a90633b9aca00611a57565b6010557f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf61077a6009600a611a49565b61078890633b9aca00611a57565b604051908152602001610514565b5f6104a6338484610d9c565b6005546001600160a01b0316336001600160a01b0316146107c1575f80fd5b5f6008819055600981905560068190556007819055600d55565b5f546001600160a01b031633146108045760405162461bcd60e51b81526004016104d99061191d565b601454600160a01b900460ff161561085e5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016104d9565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556108a79030906108996009600a611a49565b61059690633b9aca00611a57565b60135f9054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108f7573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061091b9190611a82565b6001600160a01b031663c9c653963060135f9054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561097a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061099e9190611a82565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303815f875af11580156109e8573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a0c9190611a82565b601480546001600160a01b039283166001600160a01b03199091161790556013541663f305d7194730610a53816001600160a01b03165f9081526001602052604090205490565b5f80610a665f546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610acc573d5f803e3d5ffd5b50505050506040513d601f19601f82011682018060405250810190610af19190611a9d565b505060145460135460405163095ea7b360e01b81526001600160a01b0391821660048201525f1960248201529116915063095ea7b3906044016020604051808303815f875af1158015610b46573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b6a9190611ac8565b506014805462ff00ff60a01b19166201000160a01b179055565b5f546001600160a01b03163314610bad5760405162461bcd60e51b81526004016104d99061191d565b5f5b815181101561062857600160045f848481518110610bcf57610bcf611a6e565b6020908102919091018101516001600160a01b031682528101919091526040015f20805460ff1916911515919091179055600101610baf565b6005546001600160a01b0316336001600160a01b031614610c27575f80fd5b47610c3181611538565b50565b6005546001600160a01b0316336001600160a01b031614610c53575f80fd5b6008548111158015610c6757506009548111155b610c6f575f80fd5b6008819055600955565b6001600160a01b038316610cdb5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104d9565b6001600160a01b038216610d3c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104d9565b6001600160a01b038381165f8181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610e005760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104d9565b6001600160a01b038216610e625760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104d9565b5f8111610ec35760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104d9565b5f80546001600160a01b03858116911614801590610eee57505f546001600160a01b03848116911614155b15611253576001600160a01b0384165f9081526004602052604090205460ff16158015610f3357506001600160a01b0383165f9081526004602052604090205460ff16155b610f3b575f80fd5b600e545f03610f7357610f706064610f6a600a54600e5411610f5f57600654610f63565b6008545b859061156f565b906115f4565b90505b600e5415610f9857610f956064610f6a600d548561156f90919063ffffffff16565b90505b6014546001600160a01b038581169116148015610fc357506013546001600160a01b03848116911614155b8015610fe757506001600160a01b0383165f9081526003602052604090205460ff16155b156110ea57600f5482111561103e5760405162461bcd60e51b815260206004820152601960248201527f4578636565647320746865205f6d61785478416d6f756e742e0000000000000060448201526064016104d9565b60105482611060856001600160a01b03165f9081526001602052604090205490565b61106a9190611ae7565b11156110b85760405162461bcd60e51b815260206004820152601a60248201527f4578636565647320746865206d617857616c6c657453697a652e00000000000060448201526064016104d9565b6110d36064610f6a600a54600e5411610f5f57600654610f63565b600e80549192505f6110e483611afa565b91905055505b6014546001600160a01b03848116911614801561111057506001600160a01b0384163014155b1561113d5761113a6064610f6a600b54600e541161113057600754610f63565b600954859061156f565b90505b305f90815260016020526040902054601454600160a81b900460ff1615801561117357506014546001600160a01b038581169116145b80156111885750601454600160b01b900460ff165b8015611195575060115481115b80156111a45750600c54600e54115b15611251576016544311156111b8575f6015555b60036015541061120a5760405162461bcd60e51b815260206004820152601760248201527f4f6e6c7920332073656c6c732070657220626c6f636b2100000000000000000060448201526064016104d9565b6112276112228461121d84601254611635565b611635565b6113c8565b4780156112375761123747611538565b60158054905f61124683611afa565b909155505043601655505b505b80156112cb57305f908152600160205260409020546112729082611649565b305f81815260016020526040908190209290925590516001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906112c29085815260200190565b60405180910390a35b6001600160a01b0384165f908152600160205260409020546112ed90836116a7565b6001600160a01b0385165f9081526001602052604090205561133061131283836116a7565b6001600160a01b0385165f9081526001602052604090205490611649565b6001600160a01b038085165f8181526001602052604090209290925585167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef61137985856116a7565b60405190815260200160405180910390a350505050565b5f81848411156113b35760405162461bcd60e51b81526004016104d99190611714565b505f6113bf8486611b12565b95945050505050565b6014805460ff60a81b1916600160a81b1790556040805160028082526060820183525f9260208301908036833701905050905030815f8151811061140e5761140e611a6e565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611465573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114899190611a82565b8160018151811061149c5761149c611a6e565b6001600160a01b0392831660209182029290920101526013546114c29130911684610c79565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac947906114fa9085905f90869030904290600401611b25565b5f604051808303815f87803b158015611511575f80fd5b505af1158015611523573d5f803e3d5ffd5b50506014805460ff60a81b1916905550505050565b6005546040516001600160a01b039091169082156108fc029083905f818181858888f19350505050158015610628573d5f803e3d5ffd5b5f825f0361157e57505f6104aa565b5f6115898385611a57565b9050826115968583611b95565b146115ed5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104d9565b9392505050565b5f6115ed83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116e8565b5f81831161164357826115ed565b50919050565b5f806116558385611ae7565b9050838110156115ed5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104d9565b5f6115ed83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611390565b5f81836117085760405162461bcd60e51b81526004016104d99190611714565b505f6113bf8486611b95565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b6001600160a01b0381168114610c31575f80fd5b803561176881611749565b919050565b5f806040838503121561177e575f80fd5b823561178981611749565b946020939093013593505050565b5f805f606084860312156117a9575f80fd5b83356117b481611749565b925060208401356117c481611749565b929592945050506040919091013590565b634e487b7160e01b5f52604160045260245ffd5b5f602082840312156117f9575f80fd5b813567ffffffffffffffff81111561180f575f80fd5b8201601f8101841361181f575f80fd5b803567ffffffffffffffff811115611839576118396117d5565b8060051b604051601f19603f830116810181811067ffffffffffffffff82111715611866576118666117d5565b604052918252602081840181019290810187841115611883575f80fd5b6020850194505b838510156118a95761189b8561175d565b81526020948501940161188a565b509695505050505050565b5f602082840312156118c4575f80fd5b81356115ed81611749565b5f80604083850312156118e0575f80fd5b82356118eb81611749565b915060208301356118fb81611749565b809150509250929050565b5f60208284031215611916575f80fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b5f52601160045260245ffd5b6001815b60018411156119a15780850481111561198557611985611952565b600184161561199357908102905b60019390931c92800261196a565b935093915050565b5f826119b7575060016104aa565b816119c357505f6104aa565b81600181146119d957600281146119e3576119ff565b60019150506104aa565b60ff8411156119f4576119f4611952565b50506001821b6104aa565b5060208310610133831016604e8410600b8410161715611a22575081810a6104aa565b611a2e5f198484611966565b805f1904821115611a4157611a41611952565b029392505050565b5f6115ed60ff8416836119a9565b80820281158282048414176104aa576104aa611952565b634e487b7160e01b5f52603260045260245ffd5b5f60208284031215611a92575f80fd5b81516115ed81611749565b5f805f60608486031215611aaf575f80fd5b5050815160208301516040909301519094929350919050565b5f60208284031215611ad8575f80fd5b815180151581146115ed575f80fd5b808201808211156104aa576104aa611952565b5f60018201611b0b57611b0b611952565b5060010190565b818103818111156104aa576104aa611952565b5f60a0820187835286602084015260a0604084015280865180835260c0850191506020880192505f5b81811015611b755783516001600160a01b0316835260209384019390920191600101611b4e565b50506001600160a01b039590951660608401525050608001529392505050565b5f82611baf57634e487b7160e01b5f52601260045260245ffd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122075fd60ee9e8c952202809e917216d3b3b9c9f5a8b1779430c6b4fc3c40d5159e64736f6c634300081a0033 | 608060405260043610610164575f3560e01c8063751039fc116100cd578063b4fe8f6a11610087578063d34628cc11610062578063d34628cc14610404578063dd62ed3e14610423578063e086e5ec14610467578063ec1f3f631461047b575f80fd5b8063b4fe8f6a146103c7578063bf474bed146103db578063c9567bf9146103f0575f80fd5b8063751039fc146103185780637d1db4a51461032c5780638da5cb5b146103415780638f9a55c01461036757806395d89b411461037c578063a9059cbb146103a8575f80fd5b8063313ce5671161011e578063313ce5671461024b57806331c2d847146102665780633bbac5791461028557806351bc3c85146102bc57806370a08231146102d0578063715018a614610304575f80fd5b806306fdde031461016f578063095ea7b3146101b05780630faee56f146101df578063109daa991461020257806318160ddd1461021857806323b872dd1461022c575f80fd5b3661016b57005b5f80fd5b34801561017a575f80fd5b506040805180820190915260078152664b65726f70706960c81b60208201525b6040516101a79190611714565b60405180910390f35b3480156101bb575f80fd5b506101cf6101ca36600461176d565b61049a565b60405190151581526020016101a7565b3480156101ea575f80fd5b506101f460125481565b6040519081526020016101a7565b34801561020d575f80fd5b506102166104b0565b005b348015610223575f80fd5b506101f461051e565b348015610237575f80fd5b506101cf610246366004611797565b61053e565b348015610256575f80fd5b50604051600981526020016101a7565b348015610271575f80fd5b506102166102803660046117e9565b6105a5565b348015610290575f80fd5b506101cf61029f3660046118b4565b6001600160a01b03165f9081526004602052604090205460ff1690565b3480156102c7575f80fd5b5061021661062c565b3480156102db575f80fd5b506101f46102ea3660046118b4565b6001600160a01b03165f9081526001602052604090205490565b34801561030f575f80fd5b50610216610679565b348015610323575f80fd5b506102166106ea565b348015610337575f80fd5b506101f4600f5481565b34801561034c575f80fd5b505f546040516001600160a01b0390911681526020016101a7565b348015610372575f80fd5b506101f460105481565b348015610387575f80fd5b506040805180820190915260048152634b45524f60e01b602082015261019a565b3480156103b3575f80fd5b506101cf6103c236600461176d565b610796565b3480156103d2575f80fd5b506102166107a2565b3480156103e6575f80fd5b506101f460115481565b3480156103fb575f80fd5b506102166107db565b34801561040f575f80fd5b5061021661041e3660046117e9565b610b84565b34801561042e575f80fd5b506101f461043d3660046118cf565b6001600160a01b039182165f90815260026020908152604080832093909416825291909152205490565b348015610472575f80fd5b50610216610c08565b348015610486575f80fd5b50610216610495366004611906565b610c34565b5f6104a6338484610c79565b5060015b92915050565b5f546001600160a01b031633146104e25760405162461bcd60e51b81526004016104d99061191d565b60405180910390fd5b5f600d8190556040519081527fe9b79e1a6c2dc43b4c0c6ff01ce9e3332d810e482270f464c0a21ad6c5fc6de3906020015b60405180910390a1565b5f61052b6009600a611a49565b61053990633b9aca00611a57565b905090565b5f61054a848484610d9c565b61059b843361059685604051806060016040528060288152602001611bb5602891396001600160a01b038a165f9081526002602090815260408083203384529091529020549190611390565b610c79565b5060019392505050565b5f546001600160a01b031633146105ce5760405162461bcd60e51b81526004016104d99061191d565b5f5b8151811015610628575f60045f8484815181106105ef576105ef611a6e565b6020908102919091018101516001600160a01b031682528101919091526040015f20805460ff19169115159190911790556001016105d0565b5050565b6005546001600160a01b0316336001600160a01b03161461064b575f80fd5b305f90815260016020526040902054801561066957610669816113c8565b4780156106285761062881611538565b5f546001600160a01b031633146106a25760405162461bcd60e51b81526004016104d99061191d565b5f80546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a35f80546001600160a01b0319169055565b5f546001600160a01b031633146107135760405162461bcd60e51b81526004016104d99061191d565b61071f6009600a611a49565b61072d90633b9aca00611a57565b600f5561073c6009600a611a49565b61074a90633b9aca00611a57565b6010557f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf61077a6009600a611a49565b61078890633b9aca00611a57565b604051908152602001610514565b5f6104a6338484610d9c565b6005546001600160a01b0316336001600160a01b0316146107c1575f80fd5b5f6008819055600981905560068190556007819055600d55565b5f546001600160a01b031633146108045760405162461bcd60e51b81526004016104d99061191d565b601454600160a01b900460ff161561085e5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016104d9565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556108a79030906108996009600a611a49565b61059690633b9aca00611a57565b60135f9054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108f7573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061091b9190611a82565b6001600160a01b031663c9c653963060135f9054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561097a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061099e9190611a82565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303815f875af11580156109e8573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a0c9190611a82565b601480546001600160a01b039283166001600160a01b03199091161790556013541663f305d7194730610a53816001600160a01b03165f9081526001602052604090205490565b5f80610a665f546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610acc573d5f803e3d5ffd5b50505050506040513d601f19601f82011682018060405250810190610af19190611a9d565b505060145460135460405163095ea7b360e01b81526001600160a01b0391821660048201525f1960248201529116915063095ea7b3906044016020604051808303815f875af1158015610b46573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b6a9190611ac8565b506014805462ff00ff60a01b19166201000160a01b179055565b5f546001600160a01b03163314610bad5760405162461bcd60e51b81526004016104d99061191d565b5f5b815181101561062857600160045f848481518110610bcf57610bcf611a6e565b6020908102919091018101516001600160a01b031682528101919091526040015f20805460ff1916911515919091179055600101610baf565b6005546001600160a01b0316336001600160a01b031614610c27575f80fd5b47610c3181611538565b50565b6005546001600160a01b0316336001600160a01b031614610c53575f80fd5b6008548111158015610c6757506009548111155b610c6f575f80fd5b6008819055600955565b6001600160a01b038316610cdb5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104d9565b6001600160a01b038216610d3c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104d9565b6001600160a01b038381165f8181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610e005760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104d9565b6001600160a01b038216610e625760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104d9565b5f8111610ec35760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104d9565b5f80546001600160a01b03858116911614801590610eee57505f546001600160a01b03848116911614155b15611253576001600160a01b0384165f9081526004602052604090205460ff16158015610f3357506001600160a01b0383165f9081526004602052604090205460ff16155b610f3b575f80fd5b600e545f03610f7357610f706064610f6a600a54600e5411610f5f57600654610f63565b6008545b859061156f565b906115f4565b90505b600e5415610f9857610f956064610f6a600d548561156f90919063ffffffff16565b90505b6014546001600160a01b038581169116148015610fc357506013546001600160a01b03848116911614155b8015610fe757506001600160a01b0383165f9081526003602052604090205460ff16155b156110ea57600f5482111561103e5760405162461bcd60e51b815260206004820152601960248201527f4578636565647320746865205f6d61785478416d6f756e742e0000000000000060448201526064016104d9565b60105482611060856001600160a01b03165f9081526001602052604090205490565b61106a9190611ae7565b11156110b85760405162461bcd60e51b815260206004820152601a60248201527f4578636565647320746865206d617857616c6c657453697a652e00000000000060448201526064016104d9565b6110d36064610f6a600a54600e5411610f5f57600654610f63565b600e80549192505f6110e483611afa565b91905055505b6014546001600160a01b03848116911614801561111057506001600160a01b0384163014155b1561113d5761113a6064610f6a600b54600e541161113057600754610f63565b600954859061156f565b90505b305f90815260016020526040902054601454600160a81b900460ff1615801561117357506014546001600160a01b038581169116145b80156111885750601454600160b01b900460ff165b8015611195575060115481115b80156111a45750600c54600e54115b15611251576016544311156111b8575f6015555b60036015541061120a5760405162461bcd60e51b815260206004820152601760248201527f4f6e6c7920332073656c6c732070657220626c6f636b2100000000000000000060448201526064016104d9565b6112276112228461121d84601254611635565b611635565b6113c8565b4780156112375761123747611538565b60158054905f61124683611afa565b909155505043601655505b505b80156112cb57305f908152600160205260409020546112729082611649565b305f81815260016020526040908190209290925590516001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906112c29085815260200190565b60405180910390a35b6001600160a01b0384165f908152600160205260409020546112ed90836116a7565b6001600160a01b0385165f9081526001602052604090205561133061131283836116a7565b6001600160a01b0385165f9081526001602052604090205490611649565b6001600160a01b038085165f8181526001602052604090209290925585167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef61137985856116a7565b60405190815260200160405180910390a350505050565b5f81848411156113b35760405162461bcd60e51b81526004016104d99190611714565b505f6113bf8486611b12565b95945050505050565b6014805460ff60a81b1916600160a81b1790556040805160028082526060820183525f9260208301908036833701905050905030815f8151811061140e5761140e611a6e565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611465573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114899190611a82565b8160018151811061149c5761149c611a6e565b6001600160a01b0392831660209182029290920101526013546114c29130911684610c79565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac947906114fa9085905f90869030904290600401611b25565b5f604051808303815f87803b158015611511575f80fd5b505af1158015611523573d5f803e3d5ffd5b50506014805460ff60a81b1916905550505050565b6005546040516001600160a01b039091169082156108fc029083905f818181858888f19350505050158015610628573d5f803e3d5ffd5b5f825f0361157e57505f6104aa565b5f6115898385611a57565b9050826115968583611b95565b146115ed5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104d9565b9392505050565b5f6115ed83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116e8565b5f81831161164357826115ed565b50919050565b5f806116558385611ae7565b9050838110156115ed5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104d9565b5f6115ed83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611390565b5f81836117085760405162461bcd60e51b81526004016104d99190611714565b505f6113bf8486611b95565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b6001600160a01b0381168114610c31575f80fd5b803561176881611749565b919050565b5f806040838503121561177e575f80fd5b823561178981611749565b946020939093013593505050565b5f805f606084860312156117a9575f80fd5b83356117b481611749565b925060208401356117c481611749565b929592945050506040919091013590565b634e487b7160e01b5f52604160045260245ffd5b5f602082840312156117f9575f80fd5b813567ffffffffffffffff81111561180f575f80fd5b8201601f8101841361181f575f80fd5b803567ffffffffffffffff811115611839576118396117d5565b8060051b604051601f19603f830116810181811067ffffffffffffffff82111715611866576118666117d5565b604052918252602081840181019290810187841115611883575f80fd5b6020850194505b838510156118a95761189b8561175d565b81526020948501940161188a565b509695505050505050565b5f602082840312156118c4575f80fd5b81356115ed81611749565b5f80604083850312156118e0575f80fd5b82356118eb81611749565b915060208301356118fb81611749565b809150509250929050565b5f60208284031215611916575f80fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b5f52601160045260245ffd5b6001815b60018411156119a15780850481111561198557611985611952565b600184161561199357908102905b60019390931c92800261196a565b935093915050565b5f826119b7575060016104aa565b816119c357505f6104aa565b81600181146119d957600281146119e3576119ff565b60019150506104aa565b60ff8411156119f4576119f4611952565b50506001821b6104aa565b5060208310610133831016604e8410600b8410161715611a22575081810a6104aa565b611a2e5f198484611966565b805f1904821115611a4157611a41611952565b029392505050565b5f6115ed60ff8416836119a9565b80820281158282048414176104aa576104aa611952565b634e487b7160e01b5f52603260045260245ffd5b5f60208284031215611a92575f80fd5b81516115ed81611749565b5f805f60608486031215611aaf575f80fd5b5050815160208301516040909301519094929350919050565b5f60208284031215611ad8575f80fd5b815180151581146115ed575f80fd5b808201808211156104aa576104aa611952565b5f60018201611b0b57611b0b611952565b5060010190565b818103818111156104aa576104aa611952565b5f60a0820187835286602084015260a0604084015280865180835260c0850191506020880192505f5b81811015611b755783516001600160a01b0316835260209384019390920191600101611b4e565b50506001600160a01b039590951660608401525050608001529392505050565b5f82611baf57634e487b7160e01b5f52601260045260245ffd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122075fd60ee9e8c952202809e917216d3b3b9c9f5a8b1779430c6b4fc3c40d5159e64736f6c634300081a0033 | {{
"language": "Solidity",
"sources": {
"Keroppi.sol": {
"content": "/**\r\n..........................................................................................\r\n..........................................................................................\r\n......................... ................. .........................\r\n...................... ........... ......................\r\n.................... ....... ....................\r\n................... ...: :.................\r\n.................: :---: .: .:---. ..................\r\n.................. -#%%%%%#: : +#%%%%%*. :................\r\n................. :%%%%%%%%#. . =%%%%%%%%* .................\r\n.................. .#%%%%%%%# : =%%%%%%%%* :................\r\n.................. :*%%%%%*. .: =#%%%%#= :................\r\n................... .::: ::: .::: :.................\r\n.................::. .::::: ::.................\r\n...............:::::: ::::::::. .:::::...............\r\n..............:::::::::. .::::::::::::.. .::::::::::.............\r\n.............::::::::::::::........:::::::::::::::::::::.......:::::::::::::::............\r\n............:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::...........\r\n...........:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::..........\r\n..........::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::..........\r\n..........:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::.........\r\n..........:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::.........\r\n..........:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::.........\r\n..........:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::.........\r\n..........::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::..........\r\n...........:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::..........\r\n............::::::::::::::::=+=::::::::::::::::::::::::::::-=+=::::::::::::::::...........\r\n.............:::::::::::::::=*##*+-:::::::::::::::::::::-+*##+-:::::::::::::::............\r\n..............:::::::::::::::::-+*##*+==--::::::::-==+*##*+-::::::::::::::::..............\r\n................:::::::::::::::::::-=+**###########**+=-::::::::::::::::::................\r\n...................:::::::::::::::::::::::-------:::::::::::::::::::::::..................\r\n......................:::::::::::::::::::::::::::::::::::::::::::::::.....................\r\n..........................:::::::::::::::::::::::::::::::::::::::.........................\r\n................................:::::::::::::::::::::::::::...............................\r\n\r\nKeroppi The Japanese Frog 😀😀😀😀😀😀😀😀😀\r\n$KERO is a fictional character in the Hello Kitty universe created by Sanrio in 1988.\r\nKeroppi lives a peaceful life at the pond.\r\nJoin us on this journey as we take a deep dive into the life of Keroppi.\r\n\r\n Website: https://keroppi.meme\r\n Twitter: https://x.com/ethkeroppi\r\n Telegram: https://t.me/KEROPPI_ERC20\r\n**/\r\n\r\n// SPDX-License-Identifier: UNLICENSE\r\n\r\n\r\npragma solidity 0.8.26;\r\n\r\nabstract contract Context {\r\n function _msgSender() internal view virtual returns (address) {\r\n return msg.sender;\r\n }\r\n}\r\n\r\ninterface IERC20 {\r\n function totalSupply() external view returns (uint256);\r\n function balanceOf(address account) external view returns (uint256);\r\n function transfer(address recipient, uint256 amount) external returns (bool);\r\n function allowance(address owner, address spender) external view returns (uint256);\r\n function approve(address spender, uint256 amount) external returns (bool);\r\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\r\n event Transfer(address indexed from, address indexed to, uint256 value);\r\n event Approval(address indexed owner, address indexed spender, uint256 value);\r\n}\r\n\r\nlibrary SafeMath {\r\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\r\n uint256 c = a + b;\r\n require(c >= a, \"SafeMath: addition overflow\");\r\n return c;\r\n }\r\n\r\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return sub(a, b, \"SafeMath: subtraction overflow\");\r\n }\r\n\r\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\r\n require(b <= a, errorMessage);\r\n uint256 c = a - b;\r\n return c;\r\n }\r\n\r\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\r\n if (a == 0) {\r\n return 0;\r\n }\r\n uint256 c = a * b;\r\n require(c / a == b, \"SafeMath: multiplication overflow\");\r\n return c;\r\n }\r\n\r\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return div(a, b, \"SafeMath: division by zero\");\r\n }\r\n\r\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\r\n require(b > 0, errorMessage);\r\n uint256 c = a / b;\r\n return c;\r\n }\r\n\r\n}\r\n\r\ncontract Ownable is Context {\r\n address private _owner;\r\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\r\n\r\n constructor () {\r\n address msgSender = _msgSender();\r\n _owner = msgSender;\r\n emit OwnershipTransferred(address(0), msgSender);\r\n }\r\n\r\n function owner() public view returns (address) {\r\n return _owner;\r\n }\r\n\r\n modifier onlyOwner() {\r\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\r\n _;\r\n }\r\n\r\n function renounceOwnership() public virtual onlyOwner {\r\n emit OwnershipTransferred(_owner, address(0));\r\n _owner = address(0);\r\n }\r\n\r\n}\r\n\r\ninterface IUniswapV2Factory {\r\n function createPair(address tokenA, address tokenB) external returns (address pair);\r\n}\r\n\r\ninterface IUniswapV2Router02 {\r\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\r\n uint amountIn,\r\n uint amountOutMin,\r\n address[] calldata path,\r\n address to,\r\n uint deadline\r\n ) external;\r\n function factory() external pure returns (address);\r\n function WETH() external pure returns (address);\r\n function addLiquidityETH(\r\n address token,\r\n uint amountTokenDesired,\r\n uint amountTokenMin,\r\n uint amountETHMin,\r\n address to,\r\n uint deadline\r\n ) external payable returns (uint amountToken, uint amountETH, uint liquidity);\r\n}\r\n\r\ncontract Keroppi is Context, IERC20, Ownable {\r\n using SafeMath for uint256;\r\n mapping (address => uint256) private _balances;\r\n mapping (address => mapping (address => uint256)) private _allowances;\r\n mapping (address => bool) private _isExcludedFromFee;\r\n mapping (address => bool) private bots;\r\n address payable private _taxWallet;\r\n string private constant _name = unicode\"Keroppi\";\r\n string private constant _symbol = unicode\"KERO\";\r\n\r\n uint256 private _initialBuyTax=15;\r\n uint256 private _initialSellTax=15;\r\n uint256 private _finalBuyTax=0;\r\n uint256 private _finalSellTax=0;\r\n uint256 private _reduceBuyTaxAt=20;\r\n uint256 private _reduceSellTaxAt=20;\r\n uint256 private _preventSwapBefore=30;\r\n uint256 private _transferTax=50;\r\n uint256 private _buyCount=0;\r\n\r\n uint8 private constant _decimals = 9;\r\n uint256 private constant _tTotal = 1_000_000_000 * 10**_decimals;\r\n uint256 public _maxTxAmount = 20_000_000 * 10**_decimals;\r\n uint256 public _maxWalletSize = 20_000_000 * 10**_decimals;\r\n uint256 public _taxSwapThreshold= 10_000_000 * 10**_decimals;\r\n uint256 public _maxTaxSwap= 10_000_000 * 10**_decimals;\r\n \r\n IUniswapV2Router02 private uniswapV2Router;\r\n address private uniswapV2Pair;\r\n bool private tradingOpen;\r\n bool private inSwap = false;\r\n bool private swapEnabled = false;\r\n uint256 private sellCount = 0;\r\n uint256 private lastSellBlock = 0;\r\n event MaxTxAmountUpdated(uint _maxTxAmount);\r\n event TransferTaxUpdated(uint _tax);\r\n modifier lockTheSwap {\r\n inSwap = true;\r\n _;\r\n inSwap = false;\r\n }\r\n\r\n constructor () {\r\n _taxWallet = payable(_msgSender());\r\n _balances[_msgSender()] = _tTotal;\r\n _isExcludedFromFee[owner()] = true;\r\n _isExcludedFromFee[address(this)] = true;\r\n _isExcludedFromFee[_taxWallet] = true;\r\n\r\n emit Transfer(address(0), _msgSender(), _tTotal);\r\n }\r\n\r\n function name() public pure returns (string memory) {\r\n return _name;\r\n }\r\n\r\n function symbol() public pure returns (string memory) {\r\n return _symbol;\r\n }\r\n\r\n function decimals() public pure returns (uint8) {\r\n return _decimals;\r\n }\r\n\r\n function totalSupply() public pure override returns (uint256) {\r\n return _tTotal;\r\n }\r\n\r\n function balanceOf(address account) public view override returns (uint256) {\r\n return _balances[account];\r\n }\r\n\r\n function transfer(address recipient, uint256 amount) public override returns (bool) {\r\n _transfer(_msgSender(), recipient, amount);\r\n return true;\r\n }\r\n\r\n function allowance(address owner, address spender) public view override returns (uint256) {\r\n return _allowances[owner][spender];\r\n }\r\n\r\n function approve(address spender, uint256 amount) public override returns (bool) {\r\n _approve(_msgSender(), spender, amount);\r\n return true;\r\n }\r\n\r\n function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {\r\n _transfer(sender, recipient, amount);\r\n _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, \"ERC20: transfer amount exceeds allowance\"));\r\n return true;\r\n }\r\n\r\n function _approve(address owner, address spender, uint256 amount) private {\r\n require(owner != address(0), \"ERC20: approve from the zero address\");\r\n require(spender != address(0), \"ERC20: approve to the zero address\");\r\n _allowances[owner][spender] = amount;\r\n emit Approval(owner, spender, amount);\r\n }\r\n\r\n function _transfer(address from, address to, uint256 amount) private {\r\n require(from != address(0), \"ERC20: transfer from the zero address\");\r\n require(to != address(0), \"ERC20: transfer to the zero address\");\r\n require(amount > 0, \"Transfer amount must be greater than zero\");\r\n uint256 taxAmount=0;\r\n if (from != owner() && to != owner()) {\r\n require(!bots[from] && !bots[to]);\r\n\r\n if(_buyCount==0){\r\n taxAmount = amount.mul((_buyCount>_reduceBuyTaxAt)?_finalBuyTax:_initialBuyTax).div(100);\r\n }\r\n if(_buyCount>0){\r\n taxAmount = amount.mul(_transferTax).div(100);\r\n }\r\n\r\n if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] ) {\r\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\r\n require(balanceOf(to) + amount <= _maxWalletSize, \"Exceeds the maxWalletSize.\");\r\n taxAmount = amount.mul((_buyCount>_reduceBuyTaxAt)?_finalBuyTax:_initialBuyTax).div(100);\r\n _buyCount++;\r\n }\r\n\r\n if(to == uniswapV2Pair && from!= address(this) ){\r\n taxAmount = amount.mul((_buyCount>_reduceSellTaxAt)?_finalSellTax:_initialSellTax).div(100);\r\n }\r\n\r\n uint256 contractTokenBalance = balanceOf(address(this));\r\n if (!inSwap && to == uniswapV2Pair && swapEnabled && contractTokenBalance > _taxSwapThreshold && _buyCount > _preventSwapBefore) {\r\n if (block.number > lastSellBlock) {\r\n sellCount = 0;\r\n }\r\n require(sellCount < 3, \"Only 3 sells per block!\");\r\n swapTokensForEth(min(amount, min(contractTokenBalance, _maxTaxSwap)));\r\n uint256 contractETHBalance = address(this).balance;\r\n if (contractETHBalance > 0) {\r\n sendETHToFee(address(this).balance);\r\n }\r\n sellCount++;\r\n lastSellBlock = block.number;\r\n }\r\n }\r\n\r\n if(taxAmount>0){\r\n _balances[address(this)]=_balances[address(this)].add(taxAmount);\r\n emit Transfer(from, address(this),taxAmount);\r\n }\r\n _balances[from]=_balances[from].sub(amount);\r\n _balances[to]=_balances[to].add(amount.sub(taxAmount));\r\n emit Transfer(from, to, amount.sub(taxAmount));\r\n }\r\n\r\n\r\n function min(uint256 a, uint256 b) private pure returns (uint256){\r\n return (a>b)?b:a;\r\n }\r\n\r\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\r\n address[] memory path = new address[](2);\r\n path[0] = address(this);\r\n path[1] = uniswapV2Router.WETH();\r\n _approve(address(this), address(uniswapV2Router), tokenAmount);\r\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\r\n tokenAmount,\r\n 0,\r\n path,\r\n address(this),\r\n block.timestamp\r\n );\r\n }\r\n\r\n function removeLimits() external onlyOwner{\r\n _maxTxAmount = _tTotal;\r\n _maxWalletSize=_tTotal;\r\n emit MaxTxAmountUpdated(_tTotal);\r\n }\r\n\r\n function removeTransferTax() external onlyOwner{\r\n _transferTax = 0;\r\n emit TransferTaxUpdated(0);\r\n }\r\n\r\n function sendETHToFee(uint256 amount) private {\r\n _taxWallet.transfer(amount);\r\n }\r\n\r\n function addBots(address[] memory bots_) public onlyOwner {\r\n for (uint i = 0; i < bots_.length; i++) {\r\n bots[bots_[i]] = true;\r\n }\r\n }\r\n\r\n function delBots(address[] memory notbot) public onlyOwner {\r\n for (uint i = 0; i < notbot.length; i++) {\r\n bots[notbot[i]] = false;\r\n }\r\n }\r\n\r\n function isBot(address a) public view returns (bool){\r\n return bots[a];\r\n }\r\n\r\n function openTrading() external onlyOwner() {\r\n require(!tradingOpen,\"trading is already open\");\r\n uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\r\n _approve(address(this), address(uniswapV2Router), _tTotal);\r\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());\r\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);\r\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\r\n swapEnabled = true;\r\n tradingOpen = true;\r\n }\r\n\r\n function reduceFee(uint256 _newFee) external{\r\n require(_msgSender()==_taxWallet);\r\n require(_newFee<=_finalBuyTax && _newFee<=_finalSellTax);\r\n _finalBuyTax=_newFee;\r\n _finalSellTax=_newFee;\r\n }\r\n\r\n function removeAllTax() external{\r\n require(_msgSender()==_taxWallet);\r\n _finalBuyTax=0;\r\n _finalSellTax=0;\r\n _initialBuyTax=0;\r\n _initialSellTax=0;\r\n _transferTax = 0;\r\n }\r\n\r\n receive() external payable {}\r\n\r\n function manualSwap() external {\r\n require(_msgSender()==_taxWallet);\r\n uint256 tokenBalance=balanceOf(address(this));\r\n if(tokenBalance>0){\r\n swapTokensForEth(tokenBalance);\r\n }\r\n uint256 ethBalance=address(this).balance;\r\n if(ethBalance>0){\r\n sendETHToFee(ethBalance);\r\n }\r\n }\r\n\r\n function withdrawETH() external {\r\n require(_msgSender()==_taxWallet);\r\n uint256 contractETHBalance = address(this).balance;\r\n sendETHToFee(contractETHBalance);\r\n }\r\n}"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}
}} |
1 | 20,291,153 | 5a5a6b81ef84f5ba48f23d3a3d3011686ab99d4644a2eb8fff0393a0e9b86336 | 49f2cd4463be7d6f8d1b7914213893ded635ab61cd2148842700a63132c38b67 | d1d2ac7d7f4a7da7cf4e095499b3bfc0842f6553 | 5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f | 4b92f363082314a7fb2db7a53cb8591fc73a9ee9 | 60806040526001600c5534801561001557600080fd5b506040514690806052612d228239604080519182900360520182208282018252600a8352692ab734b9bbb0b8102b1960b11b6020938401528151808301835260018152603160f81b908401528151808401919091527fbfcc8ef98ffbf7b6c3fec7bf5185b566b9863e35a9d83acd49ad6824b5969738818301527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606082015260808101949094523060a0808601919091528151808603909101815260c09094019052825192019190912060035550600580546001600160a01b03191633179055612c1d806101056000396000f3fe608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429 | 608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032 | // File: contracts/interfaces/IUniswapV2Pair.sol
pragma solidity >=0.5.0;
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
// File: contracts/interfaces/IUniswapV2ERC20.sol
pragma solidity >=0.5.0;
interface IUniswapV2ERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
}
// File: contracts/libraries/SafeMath.sol
pragma solidity =0.5.16;
// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)
library SafeMath {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x, 'ds-math-add-overflow');
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x, 'ds-math-sub-underflow');
}
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');
}
}
// File: contracts/UniswapV2ERC20.sol
pragma solidity =0.5.16;
contract UniswapV2ERC20 is IUniswapV2ERC20 {
using SafeMath for uint;
string public constant name = 'Uniswap V2';
string public constant symbol = 'UNI-V2';
uint8 public constant decimals = 18;
uint public totalSupply;
mapping(address => uint) public balanceOf;
mapping(address => mapping(address => uint)) public allowance;
bytes32 public DOMAIN_SEPARATOR;
// keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
mapping(address => uint) public nonces;
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
constructor() public {
uint chainId;
assembly {
chainId := chainid
}
DOMAIN_SEPARATOR = keccak256(
abi.encode(
keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),
keccak256(bytes(name)),
keccak256(bytes('1')),
chainId,
address(this)
)
);
}
function _mint(address to, uint value) internal {
totalSupply = totalSupply.add(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(address(0), to, value);
}
function _burn(address from, uint value) internal {
balanceOf[from] = balanceOf[from].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(from, address(0), value);
}
function _approve(address owner, address spender, uint value) private {
allowance[owner][spender] = value;
emit Approval(owner, spender, value);
}
function _transfer(address from, address to, uint value) private {
balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function approve(address spender, uint value) external returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transfer(address to, uint value) external returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function transferFrom(address from, address to, uint value) external returns (bool) {
if (allowance[from][msg.sender] != uint(-1)) {
allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
}
_transfer(from, to, value);
return true;
}
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
require(deadline >= block.timestamp, 'UniswapV2: EXPIRED');
bytes32 digest = keccak256(
abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE');
_approve(owner, spender, value);
}
}
// File: contracts/libraries/Math.sol
pragma solidity =0.5.16;
// a library for performing various math operations
library Math {
function min(uint x, uint y) internal pure returns (uint z) {
z = x < y ? x : y;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
z = y;
uint x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}
// File: contracts/libraries/UQ112x112.sol
pragma solidity =0.5.16;
// a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))
// range: [0, 2**112 - 1]
// resolution: 1 / 2**112
library UQ112x112 {
uint224 constant Q112 = 2**112;
// encode a uint112 as a UQ112x112
function encode(uint112 y) internal pure returns (uint224 z) {
z = uint224(y) * Q112; // never overflows
}
// divide a UQ112x112 by a uint112, returning a UQ112x112
function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) {
z = x / uint224(y);
}
}
// File: contracts/interfaces/IERC20.sol
pragma solidity >=0.5.0;
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
}
// File: contracts/interfaces/IUniswapV2Factory.sol
pragma solidity >=0.5.0;
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
// File: contracts/interfaces/IUniswapV2Callee.sol
pragma solidity >=0.5.0;
interface IUniswapV2Callee {
function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external;
}
// File: contracts/UniswapV2Pair.sol
pragma solidity =0.5.16;
contract UniswapV2Pair is IUniswapV2Pair, UniswapV2ERC20 {
using SafeMath for uint;
using UQ112x112 for uint224;
uint public constant MINIMUM_LIQUIDITY = 10**3;
bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)')));
address public factory;
address public token0;
address public token1;
uint112 private reserve0; // uses single storage slot, accessible via getReserves
uint112 private reserve1; // uses single storage slot, accessible via getReserves
uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves
uint public price0CumulativeLast;
uint public price1CumulativeLast;
uint public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event
uint private unlocked = 1;
modifier lock() {
require(unlocked == 1, 'UniswapV2: LOCKED');
unlocked = 0;
_;
unlocked = 1;
}
function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) {
_reserve0 = reserve0;
_reserve1 = reserve1;
_blockTimestampLast = blockTimestampLast;
}
function _safeTransfer(address token, address to, uint value) private {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'UniswapV2: TRANSFER_FAILED');
}
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
constructor() public {
factory = msg.sender;
}
// called once by the factory at time of deployment
function initialize(address _token0, address _token1) external {
require(msg.sender == factory, 'UniswapV2: FORBIDDEN'); // sufficient check
token0 = _token0;
token1 = _token1;
}
// update reserves and, on the first call per block, price accumulators
function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private {
require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'UniswapV2: OVERFLOW');
uint32 blockTimestamp = uint32(block.timestamp % 2**32);
uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired
if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) {
// * never overflows, and + overflow is desired
price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed;
price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed;
}
reserve0 = uint112(balance0);
reserve1 = uint112(balance1);
blockTimestampLast = blockTimestamp;
emit Sync(reserve0, reserve1);
}
// if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k)
function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {
address feeTo = IUniswapV2Factory(factory).feeTo();
feeOn = feeTo != address(0);
uint _kLast = kLast; // gas savings
if (feeOn) {
if (_kLast != 0) {
uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1));
uint rootKLast = Math.sqrt(_kLast);
if (rootK > rootKLast) {
uint numerator = totalSupply.mul(rootK.sub(rootKLast));
uint denominator = rootK.mul(5).add(rootKLast);
uint liquidity = numerator / denominator;
if (liquidity > 0) _mint(feeTo, liquidity);
}
}
} else if (_kLast != 0) {
kLast = 0;
}
}
// this low-level function should be called from a contract which performs important safety checks
function mint(address to) external lock returns (uint liquidity) {
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
uint balance0 = IERC20(token0).balanceOf(address(this));
uint balance1 = IERC20(token1).balanceOf(address(this));
uint amount0 = balance0.sub(_reserve0);
uint amount1 = balance1.sub(_reserve1);
bool feeOn = _mintFee(_reserve0, _reserve1);
uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
if (_totalSupply == 0) {
liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY);
_mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens
} else {
liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1);
}
require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED');
_mint(to, liquidity);
_update(balance0, balance1, _reserve0, _reserve1);
if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
emit Mint(msg.sender, amount0, amount1);
}
// this low-level function should be called from a contract which performs important safety checks
function burn(address to) external lock returns (uint amount0, uint amount1) {
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
address _token0 = token0; // gas savings
address _token1 = token1; // gas savings
uint balance0 = IERC20(_token0).balanceOf(address(this));
uint balance1 = IERC20(_token1).balanceOf(address(this));
uint liquidity = balanceOf[address(this)];
bool feeOn = _mintFee(_reserve0, _reserve1);
uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution
amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution
require(amount0 > 0 && amount1 > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED');
_burn(address(this), liquidity);
_safeTransfer(_token0, to, amount0);
_safeTransfer(_token1, to, amount1);
balance0 = IERC20(_token0).balanceOf(address(this));
balance1 = IERC20(_token1).balanceOf(address(this));
_update(balance0, balance1, _reserve0, _reserve1);
if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
emit Burn(msg.sender, amount0, amount1, to);
}
// this low-level function should be called from a contract which performs important safety checks
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock {
require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT');
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
require(amount0Out < _reserve0 && amount1Out < _reserve1, 'UniswapV2: INSUFFICIENT_LIQUIDITY');
uint balance0;
uint balance1;
{ // scope for _token{0,1}, avoids stack too deep errors
address _token0 = token0;
address _token1 = token1;
require(to != _token0 && to != _token1, 'UniswapV2: INVALID_TO');
if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens
if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens
if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data);
balance0 = IERC20(_token0).balanceOf(address(this));
balance1 = IERC20(_token1).balanceOf(address(this));
}
uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0;
uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0;
require(amount0In > 0 || amount1In > 0, 'UniswapV2: INSUFFICIENT_INPUT_AMOUNT');
{ // scope for reserve{0,1}Adjusted, avoids stack too deep errors
uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3));
uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3));
require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'UniswapV2: K');
}
_update(balance0, balance1, _reserve0, _reserve1);
emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to);
}
// force balances to match reserves
function skim(address to) external lock {
address _token0 = token0; // gas savings
address _token1 = token1; // gas savings
_safeTransfer(_token0, to, IERC20(_token0).balanceOf(address(this)).sub(reserve0));
_safeTransfer(_token1, to, IERC20(_token1).balanceOf(address(this)).sub(reserve1));
}
// force reserves to match balances
function sync() external lock {
_update(IERC20(token0).balanceOf(address(this)), IERC20(token1).balanceOf(address(this)), reserve0, reserve1);
}
} |
1 | 20,291,162 | 8a13a952698fdbb935f19218d19f23b31bcfedfc1d7b5eab5387195f0c1c1c7c | 35ff94c37b834ca01463aa5f89e43eef94a3387467fd1ea0ea0dc1c0941e6d28 | 4e565f63257d90f988e5ec9d065bab00f94d2dfd | 9fa5c5733b53814692de4fb31fd592070de5f5f0 | e3a1c4ac971b27fb3db5122b6f37dd84a695d8aa | 608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe | ||
1 | 20,291,168 | 7793f749ef213744971c5092f4259f146925306a0a7f611ba114ecbd4c7a5a31 | b5ad87b93745bf333269d4168be38e5b3347b826a039121b092c2d6ac670b585 | 0000db5c8b030ae20308ac975898e09741e70000 | ed0e416e0feea5b484ba5c95d375545ac2b60572 | 2e07010473351f768db29375069c6af0dab02baa | 608060405234801561001057600080fd5b50604051610a1a380380610a1a8339818101604052810190610032919061011c565b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550326000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610149565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100e9826100be565b9050919050565b6100f9816100de565b811461010457600080fd5b50565b600081519050610116816100f0565b92915050565b600060208284031215610132576101316100b9565b5b600061014084828501610107565b91505092915050565b6108c2806101586000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063caa5c23f1461003b578063cce3d5d314610057575b600080fd5b610055600480360381019061005091906105fa565b610073565b005b610071600480360381019061006c9190610679565b6101ca565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614610101576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100f890610703565b60405180910390fd5b60005b81518110156101c6578181815181106101205761011f610723565b5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1682828151811061015557610154610723565b5b60200260200101516020015160405161016e91906107c3565b6000604051808303816000865af19150503d80600081146101ab576040519150601f19603f3d011682016040523d82523d6000602084013e6101b0565b606091505b50505080806101be90610809565b915050610104565b5050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614610258576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161024f90610703565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168160405161029e90610877565b60006040518083038185875af1925050503d80600081146102db576040519150601f19603f3d011682016040523d82523d6000602084013e6102e0565b606091505b50505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610348826102ff565b810181811067ffffffffffffffff8211171561036757610366610310565b5b80604052505050565b600061037a6102e6565b9050610386828261033f565b919050565b600067ffffffffffffffff8211156103a6576103a5610310565b5b602082029050602081019050919050565b600080fd5b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006103f1826103c6565b9050919050565b610401816103e6565b811461040c57600080fd5b50565b60008135905061041e816103f8565b92915050565b600080fd5b600067ffffffffffffffff82111561044457610443610310565b5b61044d826102ff565b9050602081019050919050565b82818337600083830152505050565b600061047c61047784610429565b610370565b90508281526020810184848401111561049857610497610424565b5b6104a384828561045a565b509392505050565b600082601f8301126104c0576104bf6102fa565b5b81356104d0848260208601610469565b91505092915050565b6000604082840312156104ef576104ee6103bc565b5b6104f96040610370565b905060006105098482850161040f565b600083015250602082013567ffffffffffffffff81111561052d5761052c6103c1565b5b610539848285016104ab565b60208301525092915050565b60006105586105538461038b565b610370565b9050808382526020820190506020840283018581111561057b5761057a6103b7565b5b835b818110156105c257803567ffffffffffffffff8111156105a05761059f6102fa565b5b8086016105ad89826104d9565b8552602085019450505060208101905061057d565b5050509392505050565b600082601f8301126105e1576105e06102fa565b5b81356105f1848260208601610545565b91505092915050565b6000602082840312156106105761060f6102f0565b5b600082013567ffffffffffffffff81111561062e5761062d6102f5565b5b61063a848285016105cc565b91505092915050565b6000819050919050565b61065681610643565b811461066157600080fd5b50565b6000813590506106738161064d565b92915050565b60006020828403121561068f5761068e6102f0565b5b600061069d84828501610664565b91505092915050565b600082825260208201905092915050565b7f43616c6c6572206973206e6f7420746865206f776e6572000000000000000000600082015250565b60006106ed6017836106a6565b91506106f8826106b7565b602082019050919050565b6000602082019050818103600083015261071c816106e0565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081519050919050565b600081905092915050565b60005b8381101561078657808201518184015260208101905061076b565b60008484015250505050565b600061079d82610752565b6107a7818561075d565b93506107b7818560208601610768565b80840191505092915050565b60006107cf8284610792565b915081905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061081482610643565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610846576108456107da565b5b600182019050919050565b50565b600061086160008361075d565b915061086c82610851565b600082019050919050565b600061088282610854565b915081905091905056fea264697066735822122036692b46567a60a4f6844f8be0961cccba9ff2777bd37b4ea35791aba4c5159b64736f6c63430008120033000000000000000000000000000037bb05b2cef17c6469f4bcdb198826ce0000 | 608060405234801561001057600080fd5b50600436106100365760003560e01c8063caa5c23f1461003b578063cce3d5d314610057575b600080fd5b610055600480360381019061005091906105fa565b610073565b005b610071600480360381019061006c9190610679565b6101ca565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614610101576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100f890610703565b60405180910390fd5b60005b81518110156101c6578181815181106101205761011f610723565b5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1682828151811061015557610154610723565b5b60200260200101516020015160405161016e91906107c3565b6000604051808303816000865af19150503d80600081146101ab576040519150601f19603f3d011682016040523d82523d6000602084013e6101b0565b606091505b50505080806101be90610809565b915050610104565b5050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614610258576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161024f90610703565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168160405161029e90610877565b60006040518083038185875af1925050503d80600081146102db576040519150601f19603f3d011682016040523d82523d6000602084013e6102e0565b606091505b50505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610348826102ff565b810181811067ffffffffffffffff8211171561036757610366610310565b5b80604052505050565b600061037a6102e6565b9050610386828261033f565b919050565b600067ffffffffffffffff8211156103a6576103a5610310565b5b602082029050602081019050919050565b600080fd5b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006103f1826103c6565b9050919050565b610401816103e6565b811461040c57600080fd5b50565b60008135905061041e816103f8565b92915050565b600080fd5b600067ffffffffffffffff82111561044457610443610310565b5b61044d826102ff565b9050602081019050919050565b82818337600083830152505050565b600061047c61047784610429565b610370565b90508281526020810184848401111561049857610497610424565b5b6104a384828561045a565b509392505050565b600082601f8301126104c0576104bf6102fa565b5b81356104d0848260208601610469565b91505092915050565b6000604082840312156104ef576104ee6103bc565b5b6104f96040610370565b905060006105098482850161040f565b600083015250602082013567ffffffffffffffff81111561052d5761052c6103c1565b5b610539848285016104ab565b60208301525092915050565b60006105586105538461038b565b610370565b9050808382526020820190506020840283018581111561057b5761057a6103b7565b5b835b818110156105c257803567ffffffffffffffff8111156105a05761059f6102fa565b5b8086016105ad89826104d9565b8552602085019450505060208101905061057d565b5050509392505050565b600082601f8301126105e1576105e06102fa565b5b81356105f1848260208601610545565b91505092915050565b6000602082840312156106105761060f6102f0565b5b600082013567ffffffffffffffff81111561062e5761062d6102f5565b5b61063a848285016105cc565b91505092915050565b6000819050919050565b61065681610643565b811461066157600080fd5b50565b6000813590506106738161064d565b92915050565b60006020828403121561068f5761068e6102f0565b5b600061069d84828501610664565b91505092915050565b600082825260208201905092915050565b7f43616c6c6572206973206e6f7420746865206f776e6572000000000000000000600082015250565b60006106ed6017836106a6565b91506106f8826106b7565b602082019050919050565b6000602082019050818103600083015261071c816106e0565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081519050919050565b600081905092915050565b60005b8381101561078657808201518184015260208101905061076b565b60008484015250505050565b600061079d82610752565b6107a7818561075d565b93506107b7818560208601610768565b80840191505092915050565b60006107cf8284610792565b915081905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061081482610643565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610846576108456107da565b5b600182019050919050565b50565b600061086160008361075d565b915061086c82610851565b600082019050919050565b600061088282610854565b915081905091905056fea264697066735822122036692b46567a60a4f6844f8be0961cccba9ff2777bd37b4ea35791aba4c5159b64736f6c63430008120033 | |
1 | 20,291,170 | 0abd5c01ccc487258cd756169cb151a63c9657b68b25eb18da4fb6ce9cfc46d1 | 5c18da5893892d57e36e8d01ab02d7401c562148eb5fd56c742f83b14c6ea2ad | a7fb5ca286fc3fd67525629048a4de3ba24cba2e | c77ad0a71008d7094a62cfbd250a2eb2afdf2776 | 6eed373d68d45385db90c8335b98b1c8420c3f66 | 608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe | ||
1 | 20,291,172 | a85942a2ff50cd6e9e307751ca647e38ad372aa968cd630f35a92396aad8ad93 | 6fae71d2489397a4ebc1edef3cb1ac3a608cd992ff54fd296a46a15804a441b8 | b02c6c40a798184d5e012fbb1dc698977671f8fc | ffa397285ce46fb78c588a9e993286aac68c37cd | b89e199179c3f71cba3915e4eac2738b2e33bc2c | 3d602d80600a3d3981f3363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3 | pragma solidity 0.7.5;
/*
The MIT License (MIT)
Copyright (c) 2018 Murray Software, LLC.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//solhint-disable max-line-length
//solhint-disable no-inline-assembly
contract CloneFactory {
function createClone(address target, bytes32 salt)
internal
returns (address payable result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the clone contract data
let clone := mload(0x40)
// The bytecode block below is responsible for contract initialization
// during deployment, it is worth noting the proxied contract constructor will not be called during
// the cloning procedure and that is why an initialization function needs to be called after the
// clone is created
mstore(
clone,
0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000
)
// This stores the address location of the implementation contract
// so that the proxy knows where to delegate call logic to
mstore(add(clone, 0x14), targetBytes)
// The bytecode block is the actual code that is deployed for each clone created.
// It forwards all calls to the already deployed implementation via a delegatecall
mstore(
add(clone, 0x28),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// deploy the contract using the CREATE2 opcode
// this deploys the minimal proxy defined above, which will proxy all
// calls to use the logic defined in the implementation contract `target`
result := create2(0, clone, 0x37, salt)
}
}
function isClone(address target, address query)
internal
view
returns (bool result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the comparison clone
let clone := mload(0x40)
// The next three lines store the expected bytecode for a miniml proxy
// that targets `target` as its implementation contract
mstore(
clone,
0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000
)
mstore(add(clone, 0xa), targetBytes)
mstore(
add(clone, 0x1e),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// the next two lines store the bytecode of the contract that we are checking in memory
let other := add(clone, 0x40)
extcodecopy(query, other, 0, 0x2d)
// Check if the expected bytecode equals the actual bytecode and return the result
result := and(
eq(mload(clone), mload(other)),
eq(mload(add(clone, 0xd)), mload(add(other, 0xd)))
)
}
}
}
/**
* Contract that exposes the needed erc20 token functions
*/
abstract contract ERC20Interface {
// Send _value amount of tokens to address _to
function transfer(address _to, uint256 _value)
public
virtual
returns (bool success);
// Get the account balance of another account with address _owner
function balanceOf(address _owner)
public
virtual
view
returns (uint256 balance);
}
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
function safeApprove(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeApprove: approve failed'
);
}
function safeTransfer(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeTransfer: transfer failed'
);
}
function safeTransferFrom(
address token,
address from,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::transferFrom: transferFrom failed'
);
}
function safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');
}
}
/**
* Contract that will forward any incoming Ether to the creator of the contract
*
*/
contract Forwarder {
// Address to which any funds sent to this contract will be forwarded
address public parentAddress;
event ForwarderDeposited(address from, uint256 value, bytes data);
/**
* Initialize the contract, and sets the destination address to that of the creator
*/
function init(address _parentAddress) external onlyUninitialized {
parentAddress = _parentAddress;
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
// NOTE: since we are forwarding on initialization,
// we don't have the context of the original sender.
// We still emit an event about the forwarding but set
// the sender to the forwarder itself
emit ForwarderDeposited(address(this), value, msg.data);
}
/**
* Modifier that will execute internal code block only if the sender is the parent address
*/
modifier onlyParent {
require(msg.sender == parentAddress, 'Only Parent');
_;
}
/**
* Modifier that will execute internal code block only if the contract has not been initialized yet
*/
modifier onlyUninitialized {
require(parentAddress == address(0x0), 'Already initialized');
_;
}
/**
* Default function; Gets called when data is sent but does not match any other function
*/
fallback() external payable {
flush();
}
/**
* Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address
*/
receive() external payable {
flush();
}
/**
* Execute a token transfer of the full balance from the forwarder token to the parent address
* @param tokenContractAddress the address of the erc20 token contract
*/
function flushTokens(address tokenContractAddress) external onlyParent {
ERC20Interface instance = ERC20Interface(tokenContractAddress);
address forwarderAddress = address(this);
uint256 forwarderBalance = instance.balanceOf(forwarderAddress);
if (forwarderBalance == 0) {
return;
}
TransferHelper.safeTransfer(
tokenContractAddress,
parentAddress,
forwarderBalance
);
}
/**
* Flush the entire balance of the contract to the parent address.
*/
function flush() public {
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
emit ForwarderDeposited(msg.sender, value, msg.data);
}
}
contract ForwarderFactory is CloneFactory {
address public implementationAddress;
event ForwarderCreated(address newForwarderAddress, address parentAddress);
constructor(address _implementationAddress) {
implementationAddress = _implementationAddress;
}
function createForwarder(address parent, bytes32 salt) external {
// include the signers in the salt so any contract deployed to a given address must have the same signers
bytes32 finalSalt = keccak256(abi.encodePacked(parent, salt));
address payable clone = createClone(implementationAddress, finalSalt);
Forwarder(clone).init(parent);
emit ForwarderCreated(clone, parent);
}
} |
1 | 20,291,173 | 25dbc3046e84cb57d1935087046e41a8a3be912d6714eae4706d3eeb02b62e6f | 609330e90e71443ba3f48de2807b30c5804a8cf22b4740f978a50fe3630a2746 | 4fd1719fc6a104c1884125e754b04e3540136425 | ffa397285ce46fb78c588a9e993286aac68c37cd | 2521bf024117cee811d020f48b5024d8319f55b0 | 3d602d80600a3d3981f3363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3 | pragma solidity 0.7.5;
/*
The MIT License (MIT)
Copyright (c) 2018 Murray Software, LLC.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//solhint-disable max-line-length
//solhint-disable no-inline-assembly
contract CloneFactory {
function createClone(address target, bytes32 salt)
internal
returns (address payable result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the clone contract data
let clone := mload(0x40)
// The bytecode block below is responsible for contract initialization
// during deployment, it is worth noting the proxied contract constructor will not be called during
// the cloning procedure and that is why an initialization function needs to be called after the
// clone is created
mstore(
clone,
0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000
)
// This stores the address location of the implementation contract
// so that the proxy knows where to delegate call logic to
mstore(add(clone, 0x14), targetBytes)
// The bytecode block is the actual code that is deployed for each clone created.
// It forwards all calls to the already deployed implementation via a delegatecall
mstore(
add(clone, 0x28),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// deploy the contract using the CREATE2 opcode
// this deploys the minimal proxy defined above, which will proxy all
// calls to use the logic defined in the implementation contract `target`
result := create2(0, clone, 0x37, salt)
}
}
function isClone(address target, address query)
internal
view
returns (bool result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the comparison clone
let clone := mload(0x40)
// The next three lines store the expected bytecode for a miniml proxy
// that targets `target` as its implementation contract
mstore(
clone,
0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000
)
mstore(add(clone, 0xa), targetBytes)
mstore(
add(clone, 0x1e),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// the next two lines store the bytecode of the contract that we are checking in memory
let other := add(clone, 0x40)
extcodecopy(query, other, 0, 0x2d)
// Check if the expected bytecode equals the actual bytecode and return the result
result := and(
eq(mload(clone), mload(other)),
eq(mload(add(clone, 0xd)), mload(add(other, 0xd)))
)
}
}
}
/**
* Contract that exposes the needed erc20 token functions
*/
abstract contract ERC20Interface {
// Send _value amount of tokens to address _to
function transfer(address _to, uint256 _value)
public
virtual
returns (bool success);
// Get the account balance of another account with address _owner
function balanceOf(address _owner)
public
virtual
view
returns (uint256 balance);
}
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
function safeApprove(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeApprove: approve failed'
);
}
function safeTransfer(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeTransfer: transfer failed'
);
}
function safeTransferFrom(
address token,
address from,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::transferFrom: transferFrom failed'
);
}
function safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');
}
}
/**
* Contract that will forward any incoming Ether to the creator of the contract
*
*/
contract Forwarder {
// Address to which any funds sent to this contract will be forwarded
address public parentAddress;
event ForwarderDeposited(address from, uint256 value, bytes data);
/**
* Initialize the contract, and sets the destination address to that of the creator
*/
function init(address _parentAddress) external onlyUninitialized {
parentAddress = _parentAddress;
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
// NOTE: since we are forwarding on initialization,
// we don't have the context of the original sender.
// We still emit an event about the forwarding but set
// the sender to the forwarder itself
emit ForwarderDeposited(address(this), value, msg.data);
}
/**
* Modifier that will execute internal code block only if the sender is the parent address
*/
modifier onlyParent {
require(msg.sender == parentAddress, 'Only Parent');
_;
}
/**
* Modifier that will execute internal code block only if the contract has not been initialized yet
*/
modifier onlyUninitialized {
require(parentAddress == address(0x0), 'Already initialized');
_;
}
/**
* Default function; Gets called when data is sent but does not match any other function
*/
fallback() external payable {
flush();
}
/**
* Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address
*/
receive() external payable {
flush();
}
/**
* Execute a token transfer of the full balance from the forwarder token to the parent address
* @param tokenContractAddress the address of the erc20 token contract
*/
function flushTokens(address tokenContractAddress) external onlyParent {
ERC20Interface instance = ERC20Interface(tokenContractAddress);
address forwarderAddress = address(this);
uint256 forwarderBalance = instance.balanceOf(forwarderAddress);
if (forwarderBalance == 0) {
return;
}
TransferHelper.safeTransfer(
tokenContractAddress,
parentAddress,
forwarderBalance
);
}
/**
* Flush the entire balance of the contract to the parent address.
*/
function flush() public {
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
emit ForwarderDeposited(msg.sender, value, msg.data);
}
}
contract ForwarderFactory is CloneFactory {
address public implementationAddress;
event ForwarderCreated(address newForwarderAddress, address parentAddress);
constructor(address _implementationAddress) {
implementationAddress = _implementationAddress;
}
function createForwarder(address parent, bytes32 salt) external {
// include the signers in the salt so any contract deployed to a given address must have the same signers
bytes32 finalSalt = keccak256(abi.encodePacked(parent, salt));
address payable clone = createClone(implementationAddress, finalSalt);
Forwarder(clone).init(parent);
emit ForwarderCreated(clone, parent);
}
} |
1 | 20,291,176 | dfd51ab22152a8d177bb98ae767660cc2ee970d5c6511eec361ce312fc2d42fc | 10bacea2e069aa94ca9e906a81b07cffe43bc68e9669d9db3caec23646d38bd4 | cefa4c316e855c5ad6c9d75dbe554a1d2ec15980 | 00b19a5200a100e5fc4c9800772f4d002f218400 | e6ccfefb09e87c50171d4b2199a3f214ad003f78 | 3d602d80600a3d3981f3363d3d373d3d3d363d739f36ee33fd56c7d9a78facd3249c580b1ca464a25af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d739f36ee33fd56c7d9a78facd3249c580b1ca464a25af43d82803e903d91602b57fd5bf3 | {{
"language": "Solidity",
"sources": {
"src/clones/ERC1155SeaDropCloneable.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n ERC1155SeaDropContractOffererCloneable\n} from \"./ERC1155SeaDropContractOffererCloneable.sol\";\n\n/**\n * @title ERC1155SeaDropCloneable\n * @author James Wenzel (emo.eth)\n * @author Ryan Ghods (ralxz.eth)\n * @author Stephan Min (stephanm.eth)\n * @author Michael Cohen (notmichael.eth)\n * @custom:contributor Limit Break (@limitbreak)\n * @notice A cloneable ERC1155 token contract that can mint as a\n * Seaport contract offerer.\n * Implements Limit Break's Creator Token Standards transfer\n * validation for royalty enforcement.\n */\ncontract ERC1155SeaDropCloneable is ERC1155SeaDropContractOffererCloneable {\n /**\n * @notice Initialize the token contract.\n *\n * @param allowedConfigurer The address of the contract allowed to\n * implementation code. Also contains SeaDrop\n * implementation code.\n * @param allowedSeaport The address of the Seaport contract allowed to\n * interact.\n * @param name_ The name of the token.\n * @param symbol_ The symbol of the token.\n */\n function initialize(\n address allowedConfigurer,\n address allowedSeaport,\n string memory name_,\n string memory symbol_,\n address initialOwner\n ) public initializer {\n // Initialize ownership.\n _initializeOwner(initialOwner);\n\n // Initialize ERC1155SeaDropContractOffererCloneable.\n __ERC1155SeaDropContractOffererCloneable_init(\n allowedConfigurer,\n allowedSeaport,\n name_,\n symbol_\n );\n }\n\n /**\n * @notice Burns a token, restricted to the owner or approved operator,\n * and must have sufficient balance.\n *\n * @param from The address to burn from.\n * @param id The token id to burn.\n * @param amount The amount to burn.\n */\n function burn(address from, uint256 id, uint256 amount) external {\n // Burn the token.\n _burn(msg.sender, from, id, amount);\n }\n\n /**\n * @notice Burns a batch of tokens, restricted to the owner or\n * approved operator, and must have sufficient balance.\n *\n * @param from The address to burn from.\n * @param ids The token ids to burn.\n * @param amounts The amounts to burn per token id.\n */\n function batchBurn(\n address from,\n uint256[] calldata ids,\n uint256[] calldata amounts\n ) external {\n // Burn the tokens.\n _batchBurn(msg.sender, from, ids, amounts);\n }\n}\n"
},
"src/clones/ERC1155SeaDropContractOffererCloneable.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { IERC1155SeaDrop } from \"../interfaces/IERC1155SeaDrop.sol\";\n\nimport { ISeaDropToken } from \"../interfaces/ISeaDropToken.sol\";\n\nimport {\n ERC1155ContractMetadataCloneable\n} from \"./ERC1155ContractMetadataCloneable.sol\";\n\nimport {\n ERC1155SeaDropContractOffererStorage\n} from \"../lib/ERC1155SeaDropContractOffererStorage.sol\";\n\nimport {\n ERC1155SeaDropErrorsAndEvents\n} from \"../lib/ERC1155SeaDropErrorsAndEvents.sol\";\n\nimport { PublicDrop } from \"../lib//ERC1155SeaDropStructs.sol\";\n\nimport { AllowListData } from \"../lib/SeaDropStructs.sol\";\n\nimport {\n ERC1155ConduitPreapproved\n} from \"../lib/ERC1155ConduitPreapproved.sol\";\n\nimport { ERC1155 } from \"solady/src/tokens/ERC1155.sol\";\n\nimport { SpentItem } from \"seaport-types/src/lib/ConsiderationStructs.sol\";\n\nimport {\n ContractOffererInterface\n} from \"seaport-types/src/interfaces/ContractOffererInterface.sol\";\n\nimport {\n IERC165\n} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @title ERC1155SeaDropContractOffererCloneable\n * @author James Wenzel (emo.eth)\n * @author Ryan Ghods (ralxz.eth)\n * @author Stephan Min (stephanm.eth)\n * @author Michael Cohen (notmichael.eth)\n * @notice A cloneable ERC1155 token contract that can mint as a\n * Seaport contract offerer.\n */\ncontract ERC1155SeaDropContractOffererCloneable is\n ERC1155ContractMetadataCloneable,\n ERC1155SeaDropErrorsAndEvents\n{\n using ERC1155SeaDropContractOffererStorage for ERC1155SeaDropContractOffererStorage.Layout;\n\n /**\n * @notice Initialize the token contract.\n *\n * @param allowedConfigurer The address of the contract allowed to\n * configure parameters. Also contains SeaDrop\n * implementation code.\n * @param allowedSeaport The address of the Seaport contract allowed to\n * interact.\n * @param name_ The name of the token.\n * @param symbol_ The symbol of the token.\n */\n function __ERC1155SeaDropContractOffererCloneable_init(\n address allowedConfigurer,\n address allowedSeaport,\n string memory name_,\n string memory symbol_\n ) internal onlyInitializing {\n // Set the allowed Seaport to interact with this contract.\n if (allowedSeaport == address(0)) {\n revert AllowedSeaportCannotBeZeroAddress();\n }\n ERC1155SeaDropContractOffererStorage.layout()._allowedSeaport[\n allowedSeaport\n ] = true;\n\n // Set the allowed Seaport enumeration.\n address[] memory enumeratedAllowedSeaport = new address[](1);\n enumeratedAllowedSeaport[0] = allowedSeaport;\n ERC1155SeaDropContractOffererStorage\n .layout()\n ._enumeratedAllowedSeaport = enumeratedAllowedSeaport;\n\n // Emit an event noting the contract deployment.\n emit SeaDropTokenDeployed(SEADROP_TOKEN_TYPE.ERC1155_CLONE);\n\n // Initialize ERC1155ContractMetadataCloneable.\n __ERC1155ContractMetadataCloneable_init(\n allowedConfigurer,\n name_,\n symbol_\n );\n }\n\n /**\n * @notice The fallback function is used as a dispatcher for SeaDrop\n * methods.\n */\n fallback(bytes calldata) external returns (bytes memory output) {\n // Get the function selector.\n bytes4 selector = msg.sig;\n\n // Get the rest of the msg data after the selector.\n bytes calldata data = msg.data[4:];\n\n // Determine if we should forward the call to the implementation\n // contract with SeaDrop logic.\n bool callSeaDropImplementation = selector ==\n ISeaDropToken.updateAllowedSeaport.selector ||\n selector == ISeaDropToken.updateDropURI.selector ||\n selector == ISeaDropToken.updateAllowList.selector ||\n selector == ISeaDropToken.updateCreatorPayouts.selector ||\n selector == ISeaDropToken.updatePayer.selector ||\n selector == ISeaDropToken.updateAllowedFeeRecipient.selector ||\n selector == ISeaDropToken.updateSigner.selector ||\n selector == IERC1155SeaDrop.updatePublicDrop.selector ||\n selector == ContractOffererInterface.previewOrder.selector ||\n selector == ContractOffererInterface.generateOrder.selector ||\n selector == ContractOffererInterface.getSeaportMetadata.selector ||\n selector == IERC1155SeaDrop.getPublicDrop.selector ||\n selector == IERC1155SeaDrop.getPublicDropIndexes.selector ||\n selector == ISeaDropToken.getAllowedSeaport.selector ||\n selector == ISeaDropToken.getCreatorPayouts.selector ||\n selector == ISeaDropToken.getAllowListMerkleRoot.selector ||\n selector == ISeaDropToken.getAllowedFeeRecipients.selector ||\n selector == ISeaDropToken.getSigners.selector ||\n selector == ISeaDropToken.getDigestIsUsed.selector ||\n selector == ISeaDropToken.getPayers.selector;\n\n // Determine if we should require only the owner or configurer calling.\n bool requireOnlyOwnerOrConfigurer = selector ==\n ISeaDropToken.updateAllowedSeaport.selector ||\n selector == ISeaDropToken.updateDropURI.selector ||\n selector == ISeaDropToken.updateAllowList.selector ||\n selector == ISeaDropToken.updateCreatorPayouts.selector ||\n selector == ISeaDropToken.updatePayer.selector ||\n selector == ISeaDropToken.updateAllowedFeeRecipient.selector ||\n selector == IERC1155SeaDrop.updatePublicDrop.selector;\n\n if (callSeaDropImplementation) {\n // For update calls, ensure the sender is only the owner\n // or configurer contract.\n if (requireOnlyOwnerOrConfigurer) {\n _onlyOwnerOrConfigurer();\n } else if (selector == ISeaDropToken.updateSigner.selector) {\n // For updateSigner, a signer can disallow themselves.\n // Get the signer parameter.\n address signer = address(bytes20(data[12:32]));\n // If the signer is not allowed, ensure sender is only owner\n // or configurer.\n if (\n msg.sender != signer ||\n (msg.sender == signer &&\n !ERC1155SeaDropContractOffererStorage\n .layout()\n ._allowedSigners[signer])\n ) {\n _onlyOwnerOrConfigurer();\n }\n }\n\n // Forward the call to the implementation contract.\n (bool success, bytes memory returnedData) = _CONFIGURER\n .delegatecall(msg.data);\n\n // Require that the call was successful.\n if (!success) {\n // Bubble up the revert reason.\n assembly {\n revert(add(32, returnedData), mload(returnedData))\n }\n }\n\n // If the call was to generateOrder, mint the tokens.\n if (selector == ContractOffererInterface.generateOrder.selector) {\n _mintOrder(data);\n }\n\n // Return the data from the delegate call.\n return returnedData;\n } else if (selector == IERC1155SeaDrop.getMintStats.selector) {\n // Get the minter and token id.\n (address minter, uint256 tokenId) = abi.decode(\n data,\n (address, uint256)\n );\n\n // Get the mint stats.\n (\n uint256 minterNumMinted,\n uint256 minterNumMintedForTokenId,\n uint256 totalMintedForTokenId,\n uint256 maxSupply\n ) = _getMintStats(minter, tokenId);\n\n // Encode the return data.\n return\n abi.encode(\n minterNumMinted,\n minterNumMintedForTokenId,\n totalMintedForTokenId,\n maxSupply\n );\n } else if (selector == ContractOffererInterface.ratifyOrder.selector) {\n // This function is a no-op, nothing additional needs to happen here.\n // Utilize assembly to efficiently return the ratifyOrder magic value.\n assembly {\n mstore(0, 0xf4dd92ce)\n return(0x1c, 32)\n }\n } else if (selector == ISeaDropToken.configurer.selector) {\n // Return the configurer contract.\n return abi.encode(_CONFIGURER);\n } else if (selector == IERC1155SeaDrop.multiConfigureMint.selector) {\n // Ensure only the owner or configurer can call this function.\n _onlyOwnerOrConfigurer();\n\n // Mint the tokens.\n _multiConfigureMint(data);\n } else {\n // Revert if the function selector is not supported.\n revert UnsupportedFunctionSelector(selector);\n }\n }\n\n /**\n * @notice Returns a set of mint stats for the address.\n * This assists in enforcing maxSupply, maxTotalMintableByWallet,\n * and maxTokenSupplyForStage checks.\n *\n * @dev NOTE: Implementing contracts should always update these numbers\n * before transferring any tokens with _safeMint() to mitigate\n * consequences of malicious onERC1155Received() hooks.\n *\n * @param minter The minter address.\n * @param tokenId The token id to return the stats for.\n */\n function _getMintStats(\n address minter,\n uint256 tokenId\n )\n internal\n view\n returns (\n uint256 minterNumMinted,\n uint256 minterNumMintedForTokenId,\n uint256 totalMintedForTokenId,\n uint256 maxSupply\n )\n {\n // Put the token supply on the stack.\n TokenSupply storage tokenSupply = _tokenSupply[tokenId];\n\n // Assign the return values.\n totalMintedForTokenId = tokenSupply.totalMinted;\n maxSupply = tokenSupply.maxSupply;\n minterNumMinted = _totalMintedByUser[minter];\n minterNumMintedForTokenId = _totalMintedByUserPerToken[minter][tokenId];\n }\n\n /**\n * @dev Handle ERC-1155 safeTransferFrom. If \"from\" is this contract,\n * the sender can only be Seaport or the conduit.\n *\n * @param from The address to transfer from.\n * @param to The address to transfer to.\n * @param id The token id to transfer.\n * @param amount The amount of tokens to transfer.\n * @param data The data to pass to the onERC1155Received hook.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) public virtual override {\n if (from == address(this)) {\n // Only Seaport or the conduit can use this function\n // when \"from\" is this contract.\n if (\n msg.sender != _CONDUIT &&\n !ERC1155SeaDropContractOffererStorage.layout()._allowedSeaport[\n msg.sender\n ]\n ) {\n revert InvalidCallerOnlyAllowedSeaport(msg.sender);\n }\n return;\n }\n\n ERC1155._safeTransfer(_by(), from, to, id, amount, data);\n }\n\n /**\n * @notice Returns whether the interface is supported.\n *\n * @param interfaceId The interface id to check against.\n */\n function supportsInterface(\n bytes4 interfaceId\n )\n public\n view\n virtual\n override(ERC1155ContractMetadataCloneable)\n returns (bool)\n {\n return\n interfaceId == type(IERC1155SeaDrop).interfaceId ||\n interfaceId == type(ContractOffererInterface).interfaceId ||\n interfaceId == 0x2e778efc || // SIP-5 (getSeaportMetadata)\n // ERC1155ContractMetadata returns supportsInterface true for\n // IERC1155ContractMetadata, ERC-4906, ERC-2981\n // ERC1155A returns supportsInterface true for\n // ERC165, ERC1155, ERC1155MetadataURI\n ERC1155ContractMetadataCloneable.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Internal function to mint tokens during a generateOrder call\n * from Seaport.\n *\n * @param data The original transaction calldata, without the selector.\n */\n function _mintOrder(bytes calldata data) internal {\n // Decode fulfiller, minimumReceived, and context from calldata.\n (\n address fulfiller,\n SpentItem[] memory minimumReceived,\n ,\n bytes memory context\n ) = abi.decode(data, (address, SpentItem[], SpentItem[], bytes));\n\n // Assign the minter from context[22:42]. We validate context has the\n // correct minimum length in the implementation's `_decodeOrder`.\n address minter;\n assembly {\n minter := shr(96, mload(add(add(context, 0x20), 22)))\n }\n\n // If the minter is the zero address, set it to the fulfiller.\n if (minter == address(0)) {\n minter = fulfiller;\n }\n\n // Set the token ids and quantities.\n uint256 minimumReceivedLength = minimumReceived.length;\n uint256[] memory tokenIds = new uint256[](minimumReceivedLength);\n uint256[] memory quantities = new uint256[](minimumReceivedLength);\n for (uint256 i = 0; i < minimumReceivedLength; ) {\n tokenIds[i] = minimumReceived[i].identifier;\n quantities[i] = minimumReceived[i].amount;\n unchecked {\n ++i;\n }\n }\n\n // Mint the tokens.\n _batchMint(minter, tokenIds, quantities, \"\");\n }\n\n /**\n * @dev Internal function to mint tokens during a multiConfigureMint call\n * from the configurer contract.\n *\n * @param data The original transaction calldata, without the selector.\n */\n function _multiConfigureMint(bytes calldata data) internal {\n // Decode the calldata.\n (\n address recipient,\n uint256[] memory tokenIds,\n uint256[] memory amounts\n ) = abi.decode(data, (address, uint256[], uint256[]));\n\n _batchMint(recipient, tokenIds, amounts, \"\");\n }\n}\n"
},
"src/interfaces/IERC1155SeaDrop.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { ISeaDropToken } from \"./ISeaDropToken.sol\";\n\nimport { PublicDrop } from \"../lib/ERC1155SeaDropStructs.sol\";\n\n/**\n * @dev A helper interface to get and set parameters for ERC1155SeaDrop.\n * The token does not expose these methods as part of its external\n * interface to optimize contract size, but does implement them.\n */\ninterface IERC1155SeaDrop is ISeaDropToken {\n /**\n * @notice Update the SeaDrop public drop parameters at a given index.\n *\n * @param publicDrop The new public drop parameters.\n * @param index The public drop index.\n */\n function updatePublicDrop(\n PublicDrop calldata publicDrop,\n uint256 index\n ) external;\n\n /**\n * @notice Returns the public drop stage parameters at a given index.\n *\n * @param index The index of the public drop stage.\n */\n function getPublicDrop(\n uint256 index\n ) external view returns (PublicDrop memory);\n\n /**\n * @notice Returns the public drop indexes.\n */\n function getPublicDropIndexes() external view returns (uint256[] memory);\n\n /**\n * @notice Returns a set of mint stats for the address.\n * This assists SeaDrop in enforcing maxSupply,\n * maxTotalMintableByWallet, maxTotalMintableByWalletPerToken,\n * and maxTokenSupplyForStage checks.\n *\n * @dev NOTE: Implementing contracts should always update these numbers\n * before transferring any tokens with _safeMint() to mitigate\n * consequences of malicious onERC1155Received() hooks.\n *\n * @param minter The minter address.\n * @param tokenId The token id to return stats for.\n */\n function getMintStats(\n address minter,\n uint256 tokenId\n )\n external\n view\n returns (\n uint256 minterNumMinted,\n uint256 minterNumMintedForTokenId,\n uint256 totalMintedForTokenId,\n uint256 maxSupply\n );\n\n /**\n * @notice This function is only allowed to be called by the configurer\n * contract as a way to batch mints and configuration in one tx.\n *\n * @param recipient The address to receive the mints.\n * @param tokenIds The tokenIds to mint.\n * @param amounts The amounts to mint.\n */\n function multiConfigureMint(\n address recipient,\n uint256[] calldata tokenIds,\n uint256[] calldata amounts\n ) external;\n}\n"
},
"src/interfaces/ISeaDropToken.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n ISeaDropTokenContractMetadata\n} from \"./ISeaDropTokenContractMetadata.sol\";\n\nimport { AllowListData, CreatorPayout } from \"../lib/SeaDropStructs.sol\";\n\n/**\n * @dev A helper base interface for IERC721SeaDrop and IERC1155SeaDrop.\n * The token does not expose these methods as part of its external\n * interface to optimize contract size, but does implement them.\n */\ninterface ISeaDropToken is ISeaDropTokenContractMetadata {\n /**\n * @notice Update the SeaDrop allowed Seaport contracts privileged to mint.\n * Only the owner can use this function.\n *\n * @param allowedSeaport The allowed Seaport addresses.\n */\n function updateAllowedSeaport(address[] calldata allowedSeaport) external;\n\n /**\n * @notice Update the SeaDrop allowed fee recipient.\n * Only the owner can use this function.\n *\n * @param feeRecipient The new fee recipient.\n * @param allowed Whether the fee recipient is allowed.\n */\n function updateAllowedFeeRecipient(\n address feeRecipient,\n bool allowed\n ) external;\n\n /**\n * @notice Update the SeaDrop creator payout addresses.\n * The total basis points must add up to exactly 10_000.\n * Only the owner can use this function.\n *\n * @param creatorPayouts The new creator payouts.\n */\n function updateCreatorPayouts(\n CreatorPayout[] calldata creatorPayouts\n ) external;\n\n /**\n * @notice Update the SeaDrop drop URI.\n * Only the owner can use this function.\n *\n * @param dropURI The new drop URI.\n */\n function updateDropURI(string calldata dropURI) external;\n\n /**\n * @notice Update the SeaDrop allow list data.\n * Only the owner can use this function.\n *\n * @param allowListData The new allow list data.\n */\n function updateAllowList(AllowListData calldata allowListData) external;\n\n /**\n * @notice Update the SeaDrop allowed payers.\n * Only the owner can use this function.\n *\n * @param payer The payer to update.\n * @param allowed Whether the payer is allowed.\n */\n function updatePayer(address payer, bool allowed) external;\n\n /**\n * @notice Update the SeaDrop allowed signer.\n * Only the owner can use this function.\n * An allowed signer can also disallow themselves.\n *\n * @param signer The signer to update.\n * @param allowed Whether the signer is allowed.\n */\n function updateSigner(address signer, bool allowed) external;\n\n /**\n * @notice Get the SeaDrop allowed Seaport contracts privileged to mint.\n */\n function getAllowedSeaport() external view returns (address[] memory);\n\n /**\n * @notice Returns the SeaDrop creator payouts.\n */\n function getCreatorPayouts() external view returns (CreatorPayout[] memory);\n\n /**\n * @notice Returns the SeaDrop allow list merkle root.\n */\n function getAllowListMerkleRoot() external view returns (bytes32);\n\n /**\n * @notice Returns the SeaDrop allowed fee recipients.\n */\n function getAllowedFeeRecipients() external view returns (address[] memory);\n\n /**\n * @notice Returns the SeaDrop allowed signers.\n */\n function getSigners() external view returns (address[] memory);\n\n /**\n * @notice Returns if the signed digest has been used.\n *\n * @param digest The digest hash.\n */\n function getDigestIsUsed(bytes32 digest) external view returns (bool);\n\n /**\n * @notice Returns the SeaDrop allowed payers.\n */\n function getPayers() external view returns (address[] memory);\n\n /**\n * @notice Returns the configurer contract.\n */\n function configurer() external view returns (address);\n}\n"
},
"src/clones/ERC1155ContractMetadataCloneable.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n IERC1155ContractMetadata\n} from \"../interfaces/IERC1155ContractMetadata.sol\";\n\nimport {\n ERC1155ConduitPreapproved\n} from \"../lib/ERC1155ConduitPreapproved.sol\";\n\nimport {\n ICreatorToken,\n ILegacyCreatorToken\n} from \"../interfaces/ICreatorToken.sol\";\n\nimport { ITransferValidator1155 } from \"../interfaces/ITransferValidator.sol\";\n\nimport { TokenTransferValidator } from \"../lib/TokenTransferValidator.sol\";\n\nimport { ERC1155 } from \"solady/src/tokens/ERC1155.sol\";\n\nimport { ERC2981 } from \"solady/src/tokens/ERC2981.sol\";\n\nimport { Ownable } from \"solady/src/auth/Ownable.sol\";\n\nimport {\n Initializable\n} from \"@openzeppelin-upgradeable/contracts/proxy/utils/Initializable.sol\";\n\n/**\n * @title ERC1155ContractMetadataCloneable\n * @author James Wenzel (emo.eth)\n * @author Ryan Ghods (ralxz.eth)\n * @author Stephan Min (stephanm.eth)\n * @author Michael Cohen (notmichael.eth)\n * @notice A cloneable token contract that extends ERC-1155\n * with additional metadata and ownership capabilities.\n */\ncontract ERC1155ContractMetadataCloneable is\n ERC1155ConduitPreapproved,\n TokenTransferValidator,\n ERC2981,\n Ownable,\n IERC1155ContractMetadata,\n Initializable\n{\n /// @notice A struct containing the token supply info per token id.\n mapping(uint256 => TokenSupply) _tokenSupply;\n\n /// @notice The total number of tokens minted by address.\n mapping(address => uint256) _totalMintedByUser;\n\n /// @notice The total number of tokens minted per token id by address.\n mapping(address => mapping(uint256 => uint256)) _totalMintedByUserPerToken;\n\n /// @notice The name of the token.\n string internal _name;\n\n /// @notice The symbol of the token.\n string internal _symbol;\n\n /// @notice The base URI for token metadata.\n string internal _baseURI;\n\n /// @notice The contract URI for contract metadata.\n string internal _contractURI;\n\n /// @notice The provenance hash for guaranteeing metadata order\n /// for random reveals.\n bytes32 internal _provenanceHash;\n\n /// @notice The allowed contract that can configure SeaDrop parameters.\n address internal _CONFIGURER;\n\n /**\n * @dev Reverts if the sender is not the owner or the allowed\n * configurer contract.\n *\n * This is used as a function instead of a modifier\n * to save contract space when used multiple times.\n */\n function _onlyOwnerOrConfigurer() internal view {\n if (msg.sender != _CONFIGURER && msg.sender != owner()) {\n revert Unauthorized();\n }\n }\n\n /**\n * @notice Deploy the token contract.\n *\n * @param allowedConfigurer The address of the contract allowed to\n * configure parameters. Also contains SeaDrop\n * implementation code.\n * @param name_ The name of the token.\n * @param symbol_ The symbol of the token.\n */\n function __ERC1155ContractMetadataCloneable_init(\n address allowedConfigurer,\n string memory name_,\n string memory symbol_\n ) internal onlyInitializing {\n // Set the name of the token.\n _name = name_;\n\n // Set the symbol of the token.\n _symbol = symbol_;\n\n // Set the allowed configurer contract to interact with this contract.\n _CONFIGURER = allowedConfigurer;\n }\n\n /**\n * @notice Sets the base URI for the token metadata and emits an event.\n *\n * @param newBaseURI The new base URI to set.\n */\n function setBaseURI(string calldata newBaseURI) external override {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Set the new base URI.\n _baseURI = newBaseURI;\n\n // Emit an event with the update.\n emit BatchMetadataUpdate(0, type(uint256).max);\n }\n\n /**\n * @notice Sets the contract URI for contract metadata.\n *\n * @param newContractURI The new contract URI.\n */\n function setContractURI(string calldata newContractURI) external override {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Set the new contract URI.\n _contractURI = newContractURI;\n\n // Emit an event with the update.\n emit ContractURIUpdated(newContractURI);\n }\n\n /**\n * @notice Emit an event notifying metadata updates for\n * a range of token ids, according to EIP-4906.\n *\n * @param fromTokenId The start token id.\n * @param toTokenId The end token id.\n */\n function emitBatchMetadataUpdate(\n uint256 fromTokenId,\n uint256 toTokenId\n ) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Emit an event with the update.\n if (fromTokenId == toTokenId) {\n // If only one token is being updated, use the event\n // in the 1155 spec.\n emit URI(uri(fromTokenId), fromTokenId);\n } else {\n emit BatchMetadataUpdate(fromTokenId, toTokenId);\n }\n }\n\n /**\n * @notice Sets the max token supply and emits an event.\n *\n * @param tokenId The token id to set the max supply for.\n * @param newMaxSupply The new max supply to set.\n */\n function setMaxSupply(uint256 tokenId, uint256 newMaxSupply) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Ensure the max supply does not exceed the maximum value of uint64,\n // a limit due to the storage of bit-packed variables in TokenSupply,\n if (newMaxSupply > 2 ** 64 - 1) {\n revert CannotExceedMaxSupplyOfUint64(newMaxSupply);\n }\n\n // Set the new max supply.\n _tokenSupply[tokenId].maxSupply = uint64(newMaxSupply);\n\n // Emit an event with the update.\n emit MaxSupplyUpdated(tokenId, newMaxSupply);\n }\n\n /**\n * @notice Sets the provenance hash and emits an event.\n *\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it has not been\n * modified after mint started.\n *\n * This function will revert if the provenance hash has already\n * been set, so be sure to carefully set it only once.\n *\n * @param newProvenanceHash The new provenance hash to set.\n */\n function setProvenanceHash(bytes32 newProvenanceHash) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Keep track of the old provenance hash for emitting with the event.\n bytes32 oldProvenanceHash = _provenanceHash;\n\n // Revert if the provenance hash has already been set.\n if (oldProvenanceHash != bytes32(0)) {\n revert ProvenanceHashCannotBeSetAfterAlreadyBeingSet();\n }\n\n // Set the new provenance hash.\n _provenanceHash = newProvenanceHash;\n\n // Emit an event with the update.\n emit ProvenanceHashUpdated(oldProvenanceHash, newProvenanceHash);\n }\n\n /**\n * @notice Sets the default royalty information.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator of 10_000 basis points.\n */\n function setDefaultRoyalty(address receiver, uint96 feeNumerator) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Set the default royalty.\n // ERC2981 implementation ensures feeNumerator <= feeDenominator\n // and receiver != address(0).\n _setDefaultRoyalty(receiver, feeNumerator);\n\n // Emit an event with the updated params.\n emit RoyaltyInfoUpdated(receiver, feeNumerator);\n }\n\n /**\n * @notice Returns the name of the token.\n */\n function name() external view returns (string memory) {\n return _name;\n }\n\n /**\n * @notice Returns the symbol of the token.\n */\n function symbol() external view returns (string memory) {\n return _symbol;\n }\n\n /**\n * @notice Returns the base URI for token metadata.\n */\n function baseURI() external view override returns (string memory) {\n return _baseURI;\n }\n\n /**\n * @notice Returns the contract URI for contract metadata.\n */\n function contractURI() external view override returns (string memory) {\n return _contractURI;\n }\n\n /**\n * @notice Returns the max token supply for a token id.\n */\n function maxSupply(uint256 tokenId) external view returns (uint256) {\n return _tokenSupply[tokenId].maxSupply;\n }\n\n /**\n * @notice Returns the total supply for a token id.\n */\n function totalSupply(uint256 tokenId) external view returns (uint256) {\n return _tokenSupply[tokenId].totalSupply;\n }\n\n /**\n * @notice Returns the total minted for a token id.\n */\n function totalMinted(uint256 tokenId) external view returns (uint256) {\n return _tokenSupply[tokenId].totalMinted;\n }\n\n /**\n * @notice Returns the provenance hash.\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it is unmodified\n * after mint has started.\n */\n function provenanceHash() external view override returns (bytes32) {\n return _provenanceHash;\n }\n\n /**\n * @notice Returns the URI for token metadata.\n *\n * This implementation returns the same URI for *all* token types.\n * It relies on the token type ID substitution mechanism defined\n * in the EIP to replace {id} with the token id.\n *\n * @custom:param tokenId The token id to get the URI for.\n */\n function uri(\n uint256 /* tokenId */\n ) public view virtual override returns (string memory) {\n // Return the base URI.\n return _baseURI;\n }\n\n /**\n * @notice Returns the transfer validation function used.\n */\n function getTransferValidationFunction()\n external\n pure\n returns (bytes4 functionSignature, bool isViewFunction)\n {\n functionSignature = ITransferValidator1155.validateTransfer.selector;\n isViewFunction = true;\n }\n\n /**\n * @notice Set the transfer validator. Only callable by the token owner.\n */\n function setTransferValidator(address newValidator) external onlyOwner {\n // Set the new transfer validator.\n _setTransferValidator(newValidator);\n }\n\n /// @dev Override this function to return true if `_beforeTokenTransfer` is used.\n function _useBeforeTokenTransfer() internal view virtual override returns (bool) {\n return true;\n }\n\n /**\n * @dev Hook that is called before any token transfer.\n * This includes minting and burning.\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory /* data */\n ) internal virtual override {\n if (from != address(0) && to != address(0)) {\n // Call the transfer validator if one is set.\n address transferValidator = _transferValidator;\n if (transferValidator != address(0)) {\n for (uint256 i = 0; i < ids.length; i++) {\n ITransferValidator1155(transferValidator).validateTransfer(\n msg.sender,\n from,\n to,\n ids[i],\n amounts[i]\n );\n }\n }\n }\n }\n\n /**\n * @notice Returns whether the interface is supported.\n *\n * @param interfaceId The interface id to check against.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155, ERC2981) returns (bool) {\n return\n interfaceId == type(IERC1155ContractMetadata).interfaceId ||\n interfaceId == type(ICreatorToken).interfaceId ||\n interfaceId == type(ILegacyCreatorToken).interfaceId ||\n interfaceId == 0x49064906 || // ERC-4906 (MetadataUpdate)\n ERC2981.supportsInterface(interfaceId) ||\n // ERC1155 returns supportsInterface true for\n // ERC165, ERC1155, ERC1155MetadataURI\n ERC1155.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Adds to the internal counters for a mint.\n *\n * @param to The address to mint to.\n * @param id The token id to mint.\n * @param amount The quantity to mint.\n * @param data The data to pass if receiver is a contract.\n */\n function _mint(\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual override {\n // Increment mint counts.\n _incrementMintCounts(to, id, amount);\n\n ERC1155._mint(to, id, amount, data);\n }\n\n /**\n * @dev Adds to the internal counters for a batch mint.\n *\n * @param to The address to mint to.\n * @param ids The token ids to mint.\n * @param amounts The quantities to mint.\n * @param data The data to pass if receiver is a contract.\n */\n function _batchMint(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual override {\n // Put ids length on the stack to save MLOADs.\n uint256 idsLength = ids.length;\n\n for (uint256 i = 0; i < idsLength; ) {\n // Increment mint counts.\n _incrementMintCounts(to, ids[i], amounts[i]);\n\n unchecked {\n ++i;\n }\n }\n\n ERC1155._batchMint(to, ids, amounts, data);\n }\n\n /**\n * @dev Subtracts from the internal counters for a burn.\n *\n * @param by The address calling the burn.\n * @param from The address to burn from.\n * @param id The token id to burn.\n * @param amount The amount to burn.\n */\n function _burn(\n address by,\n address from,\n uint256 id,\n uint256 amount\n ) internal virtual override {\n // Reduce the supply.\n _reduceSupplyOnBurn(id, amount);\n\n ERC1155._burn(by, from, id, amount);\n }\n\n /**\n * @dev Subtracts from the internal counters for a batch burn.\n *\n * @param by The address calling the burn.\n * @param from The address to burn from.\n * @param ids The token ids to burn.\n * @param amounts The amounts to burn.\n */\n function _batchBurn(\n address by,\n address from,\n uint256[] memory ids,\n uint256[] memory amounts\n ) internal virtual override {\n // Put ids length on the stack to save MLOADs.\n uint256 idsLength = ids.length;\n\n for (uint256 i = 0; i < idsLength; ) {\n // Reduce the supply.\n _reduceSupplyOnBurn(ids[i], amounts[i]);\n\n unchecked {\n ++i;\n }\n }\n\n ERC1155._batchBurn(by, from, ids, amounts);\n }\n\n function _reduceSupplyOnBurn(uint256 id, uint256 amount) internal {\n // Get the current token supply.\n TokenSupply storage tokenSupply = _tokenSupply[id];\n\n // Reduce the totalSupply.\n unchecked {\n tokenSupply.totalSupply -= uint64(amount);\n }\n }\n\n /**\n * @dev Internal function to increment mint counts.\n *\n * Note that this function does not check if the mint exceeds\n * maxSupply, which should be validated before this function is called.\n *\n * @param to The address to mint to.\n * @param id The token id to mint.\n * @param amount The quantity to mint.\n */\n function _incrementMintCounts(\n address to,\n uint256 id,\n uint256 amount\n ) internal {\n // Get the current token supply.\n TokenSupply storage tokenSupply = _tokenSupply[id];\n\n if (tokenSupply.totalMinted + amount > tokenSupply.maxSupply) {\n revert MintExceedsMaxSupply(\n tokenSupply.totalMinted + amount,\n tokenSupply.maxSupply\n );\n }\n\n // Increment supply and number minted.\n // Can be unchecked because maxSupply cannot be set to exceed uint64.\n unchecked {\n tokenSupply.totalSupply += uint64(amount);\n tokenSupply.totalMinted += uint64(amount);\n\n // Increment total minted by user.\n _totalMintedByUser[to] += amount;\n\n // Increment total minted by user per token.\n _totalMintedByUserPerToken[to][id] += amount;\n }\n }\n}\n"
},
"src/lib/ERC1155SeaDropContractOffererStorage.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { PublicDrop } from \"./ERC1155SeaDropStructs.sol\";\n\nimport { CreatorPayout } from \"./SeaDropStructs.sol\";\n\nlibrary ERC1155SeaDropContractOffererStorage {\n struct Layout {\n /// @notice The allowed Seaport addresses that can mint.\n mapping(address => bool) _allowedSeaport;\n /// @notice The enumerated allowed Seaport addresses.\n address[] _enumeratedAllowedSeaport;\n /// @notice The public drop data.\n mapping(uint256 => PublicDrop) _publicDrops;\n /// @notice The enumerated public drop indexes.\n uint256[] _enumeratedPublicDropIndexes;\n /// @notice The creator payout addresses and basis points.\n CreatorPayout[] _creatorPayouts;\n /// @notice The allow list merkle root.\n bytes32 _allowListMerkleRoot;\n /// @notice The allowed fee recipients.\n mapping(address => bool) _allowedFeeRecipients;\n /// @notice The enumerated allowed fee recipients.\n address[] _enumeratedFeeRecipients;\n /// @notice The allowed server-side signers.\n mapping(address => bool) _allowedSigners;\n /// @notice The enumerated allowed signers.\n address[] _enumeratedSigners;\n /// @notice The used signature digests.\n mapping(bytes32 => bool) _usedDigests;\n /// @notice The allowed payers.\n mapping(address => bool) _allowedPayers;\n /// @notice The enumerated allowed payers.\n address[] _enumeratedPayers;\n }\n\n bytes32 internal constant STORAGE_SLOT =\n bytes32(\n uint256(\n keccak256(\"contracts.storage.ERC1155SeaDropContractOfferer\")\n ) - 1\n );\n\n function layout() internal pure returns (Layout storage l) {\n bytes32 slot = STORAGE_SLOT;\n assembly {\n l.slot := slot\n }\n }\n}\n"
},
"src/lib/ERC1155SeaDropErrorsAndEvents.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { PublicDrop } from \"./ERC1155SeaDropStructs.sol\";\n\nimport { SeaDropErrorsAndEvents } from \"./SeaDropErrorsAndEvents.sol\";\n\ninterface ERC1155SeaDropErrorsAndEvents is SeaDropErrorsAndEvents {\n /**\n * @dev Revert with an error if an empty PublicDrop is provided\n * for an already-empty public drop.\n */\n error PublicDropStageNotPresent();\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the\n * max minted per wallet for a certain token id.\n */\n error MintQuantityExceedsMaxMintedPerWalletForTokenId(\n uint256 tokenId,\n uint256 total,\n uint256 allowed\n );\n\n /**\n * @dev Revert with an error if the target token id to mint is not within\n * the drop stage range.\n */\n error TokenIdNotWithinDropStageRange(\n uint256 tokenId,\n uint256 startTokenId,\n uint256 endTokenId\n );\n\n /**\n * @notice Revert with an error if the number of maxSupplyAmounts doesn't\n * match the number of maxSupplyTokenIds.\n */\n error MaxSupplyMismatch();\n\n /**\n * @notice Revert with an error if the number of mint tokenIds doesn't\n * match the number of mint amounts.\n */\n error MintAmountsMismatch();\n\n /**\n * @notice Revert with an error if the mint order offer contains\n * a duplicate tokenId.\n */\n error OfferContainsDuplicateTokenId(uint256 tokenId);\n\n /**\n * @dev Revert if the fromTokenId is greater than the toTokenId.\n */\n error InvalidFromAndToTokenId(uint256 fromTokenId, uint256 toTokenId);\n\n /**\n * @notice Revert with an error if the number of publicDropIndexes doesn't\n * match the number of publicDrops.\n */\n error PublicDropsMismatch();\n\n /**\n * @dev An event with updated public drop data.\n */\n event PublicDropUpdated(PublicDrop publicDrop, uint256 index);\n}\n"
},
"src/lib/ERC1155SeaDropStructs.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { AllowListData, CreatorPayout } from \"./SeaDropStructs.sol\";\n\n/**\n * @notice A struct defining public drop data.\n * Designed to fit efficiently in two storage slots.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n * @param paymentToken The payment token address. Null for\n * native token.\n * @param fromTokenId The start token id for the stage.\n * @param toTokenId The end token id for the stage.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed. (The limit for this field is\n * 2^16 - 1)\n * @param maxTotalMintableByWalletPerToken Maximum total number of mints a user\n * is allowed for the token id. (The limit for\n * this field is 2^16 - 1)\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n */\nstruct PublicDrop {\n // slot 1\n uint80 startPrice; // 80/512 bits\n uint80 endPrice; // 160/512 bits\n uint40 startTime; // 200/512 bits\n uint40 endTime; // 240/512 bits\n bool restrictFeeRecipients; // 248/512 bits\n // uint8 unused;\n\n // slot 2\n address paymentToken; // 408/512 bits\n uint24 fromTokenId; // 432/512 bits\n uint24 toTokenId; // 456/512 bits\n uint16 maxTotalMintableByWallet; // 472/512 bits\n uint16 maxTotalMintableByWalletPerToken; // 488/512 bits\n uint16 feeBps; // 504/512 bits\n}\n\n/**\n * @notice A struct defining mint params for an allow list.\n * An allow list leaf will be composed of `msg.sender` and\n * the following params.\n *\n * Note: Since feeBps is encoded in the leaf, backend should ensure\n * that feeBps is acceptable before generating a proof.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param paymentToken The payment token for the mint. Null for\n * native token.\n * @param fromTokenId The start token id for the stage.\n * @param toTokenId The end token id for the stage.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed.\n * @param maxTotalMintableByWalletPerToken Maximum total number of mints a user\n * is allowed for the token id.\n * @param maxTokenSupplyForStage The limit of token supply this stage can\n * mint within.\n * @param dropStageIndex The drop stage index to emit with the event\n * for analytical purposes. This should be\n * non-zero since the public mint emits with\n * index zero.\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct MintParams {\n uint256 startPrice;\n uint256 endPrice;\n uint256 startTime;\n uint256 endTime;\n address paymentToken;\n uint256 fromTokenId;\n uint256 toTokenId;\n uint256 maxTotalMintableByWallet;\n uint256 maxTotalMintableByWalletPerToken;\n uint256 maxTokenSupplyForStage;\n uint256 dropStageIndex; // non-zero\n uint256 feeBps;\n bool restrictFeeRecipients;\n}\n\n/**\n * @dev Struct containing internal SeaDrop implementation logic\n * mint details to avoid stack too deep.\n *\n * @param feeRecipient The fee recipient.\n * @param payer The payer of the mint.\n * @param minter The mint recipient.\n * @param tokenIds The tokenIds to mint.\n * @param quantities The number of tokens to mint per tokenId.\n * @param withEffects Whether to apply state changes of the mint.\n */\nstruct MintDetails {\n address feeRecipient;\n address payer;\n address minter;\n uint256[] tokenIds;\n uint256[] quantities;\n bool withEffects;\n}\n\n/**\n * @notice A struct to configure multiple contract options in one transaction.\n */\nstruct MultiConfigureStruct {\n uint256[] maxSupplyTokenIds;\n uint256[] maxSupplyAmounts;\n string baseURI;\n string contractURI;\n PublicDrop[] publicDrops;\n uint256[] publicDropsIndexes;\n string dropURI;\n AllowListData allowListData;\n CreatorPayout[] creatorPayouts;\n bytes32 provenanceHash;\n address[] allowedFeeRecipients;\n address[] disallowedFeeRecipients;\n address[] allowedPayers;\n address[] disallowedPayers;\n // Server-signed\n address[] allowedSigners;\n address[] disallowedSigners;\n // ERC-2981\n address royaltyReceiver;\n uint96 royaltyBps;\n // Mint\n address mintRecipient;\n uint256[] mintTokenIds;\n uint256[] mintAmounts;\n}\n"
},
"src/lib/SeaDropStructs.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\n/**\n * @notice A struct defining a creator payout address and basis points.\n *\n * @param payoutAddress The payout address.\n * @param basisPoints The basis points to pay out to the creator.\n * The total creator payouts must equal 10_000 bps.\n */\nstruct CreatorPayout {\n address payoutAddress;\n uint16 basisPoints;\n}\n\n/**\n * @notice A struct defining allow list data (for minting an allow list).\n *\n * @param merkleRoot The merkle root for the allow list.\n * @param publicKeyURIs If the allowListURI is encrypted, a list of URIs\n * pointing to the public keys. Empty if unencrypted.\n * @param allowListURI The URI for the allow list.\n */\nstruct AllowListData {\n bytes32 merkleRoot;\n string[] publicKeyURIs;\n string allowListURI;\n}\n"
},
"src/lib/ERC1155ConduitPreapproved.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { ERC1155 } from \"solady/src/tokens/ERC1155.sol\";\n\n/**\n * @title ERC1155ConduitPreapproved\n * @notice Solady's ERC1155 with the OpenSea conduit preapproved.\n */\nabstract contract ERC1155ConduitPreapproved is ERC1155 {\n /// @dev The canonical OpenSea conduit.\n address internal constant _CONDUIT =\n 0x1E0049783F008A0085193E00003D00cd54003c71;\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) public virtual override {\n _safeTransfer(_by(), from, to, id, amount, data);\n }\n\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) public virtual override {\n _safeBatchTransfer(_by(), from, to, ids, amounts, data);\n }\n\n function isApprovedForAll(\n address owner,\n address operator\n ) public view virtual override returns (bool) {\n if (operator == _CONDUIT) return true;\n return ERC1155.isApprovedForAll(owner, operator);\n }\n\n function _by() internal view virtual returns (address result) {\n assembly {\n // `msg.sender == _CONDUIT ? address(0) : msg.sender`.\n result := mul(iszero(eq(caller(), _CONDUIT)), caller())\n }\n }\n}\n"
},
"lib/solady/src/tokens/ERC1155.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Simple ERC1155 implementation.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC1155.sol)\n/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC1155.sol)\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/contracts/token/ERC1155/ERC1155.sol)\n///\n/// @dev Note:\n/// The ERC1155 standard allows for self-approvals.\n/// For performance, this implementation WILL NOT revert for such actions.\n/// Please add any checks with overrides if desired.\nabstract contract ERC1155 {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CUSTOM ERRORS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The lengths of the input arrays are not the same.\n error ArrayLengthsMismatch();\n\n /// @dev Cannot mint or transfer to the zero address.\n error TransferToZeroAddress();\n\n /// @dev The recipient's balance has overflowed.\n error AccountBalanceOverflow();\n\n /// @dev Insufficient balance.\n error InsufficientBalance();\n\n /// @dev Only the token owner or an approved account can manage the tokens.\n error NotOwnerNorApproved();\n\n /// @dev Cannot safely transfer to a contract that does not implement\n /// the ERC1155Receiver interface.\n error TransferToNonERC1155ReceiverImplementer();\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* EVENTS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Emitted when `amount` of token `id` is transferred\n /// from `from` to `to` by `operator`.\n event TransferSingle(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256 id,\n uint256 amount\n );\n\n /// @dev Emitted when `amounts` of token `ids` are transferred\n /// from `from` to `to` by `operator`.\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] amounts\n );\n\n /// @dev Emitted when `owner` enables or disables `operator` to manage all of their tokens.\n event ApprovalForAll(address indexed owner, address indexed operator, bool isApproved);\n\n /// @dev Emitted when the Uniform Resource Identifier (URI) for token `id`\n /// is updated to `value`. This event is not used in the base contract.\n /// You may need to emit this event depending on your URI logic.\n ///\n /// See: https://eips.ethereum.org/EIPS/eip-1155#metadata\n event URI(string value, uint256 indexed id);\n\n /// @dev `keccak256(bytes(\"TransferSingle(address,address,address,uint256,uint256)\"))`.\n uint256 private constant _TRANSFER_SINGLE_EVENT_SIGNATURE =\n 0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62;\n\n /// @dev `keccak256(bytes(\"TransferBatch(address,address,address,uint256[],uint256[])\"))`.\n uint256 private constant _TRANSFER_BATCH_EVENT_SIGNATURE =\n 0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb;\n\n /// @dev `keccak256(bytes(\"ApprovalForAll(address,address,bool)\"))`.\n uint256 private constant _APPROVAL_FOR_ALL_EVENT_SIGNATURE =\n 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* STORAGE */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The `ownerSlotSeed` of a given owner is given by.\n /// ```\n /// let ownerSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, owner))\n /// ```\n ///\n /// The balance slot of `owner` is given by.\n /// ```\n /// mstore(0x20, ownerSlotSeed)\n /// mstore(0x00, id)\n /// let balanceSlot := keccak256(0x00, 0x40)\n /// ```\n ///\n /// The operator approval slot of `owner` is given by.\n /// ```\n /// mstore(0x20, ownerSlotSeed)\n /// mstore(0x00, operator)\n /// let operatorApprovalSlot := keccak256(0x0c, 0x34)\n /// ```\n uint256 private constant _ERC1155_MASTER_SLOT_SEED = 0x9a31110384e0b0c9;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* ERC1155 METADATA */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the URI for token `id`.\n ///\n /// You can either return the same templated URI for all token IDs,\n /// (e.g. \"https://example.com/api/{id}.json\"),\n /// or return a unique URI for each `id`.\n ///\n /// See: https://eips.ethereum.org/EIPS/eip-1155#metadata\n function uri(uint256 id) public view virtual returns (string memory);\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* ERC1155 */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the amount of `id` owned by `owner`.\n function balanceOf(address owner, uint256 id) public view virtual returns (uint256 result) {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, owner)\n mstore(0x00, id)\n result := sload(keccak256(0x00, 0x40))\n }\n }\n\n /// @dev Returns whether `operator` is approved to manage the tokens of `owner`.\n function isApprovedForAll(address owner, address operator)\n public\n view\n virtual\n returns (bool result)\n {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, owner)\n mstore(0x00, operator)\n result := sload(keccak256(0x0c, 0x34))\n }\n }\n\n /// @dev Sets whether `operator` is approved to manage the tokens of the caller.\n ///\n /// Emits a {ApprovalForAll} event.\n function setApprovalForAll(address operator, bool isApproved) public virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Convert to 0 or 1.\n isApproved := iszero(iszero(isApproved))\n // Update the `isApproved` for (`msg.sender`, `operator`).\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, caller())\n mstore(0x00, operator)\n sstore(keccak256(0x0c, 0x34), isApproved)\n // Emit the {ApprovalForAll} event.\n mstore(0x00, isApproved)\n // forgefmt: disable-next-line\n log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), shr(96, shl(96, operator)))\n }\n }\n\n /// @dev Transfers `amount` of `id` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `from` must have at least `amount` of `id`.\n /// - If the caller is not `from`,\n /// it must be approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer.\n ///\n /// Emits a {Transfer} event.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) public virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from))\n let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to))\n mstore(0x20, fromSlotSeed)\n // Clear the upper 96 bits.\n from := shr(96, fromSlotSeed)\n to := shr(96, toSlotSeed)\n // Revert if `to` is the zero address.\n if iszero(to) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // If the caller is not `from`, do the authorization check.\n if iszero(eq(caller(), from)) {\n mstore(0x00, caller())\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x00, id)\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, toSlotSeed)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n // Emit a {TransferSingle} event.\n mstore(0x20, amount)\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), from, to)\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n // Do the {onERC1155Received} check if `to` is a smart contract.\n if extcodesize(to) {\n // Prepare the calldata.\n let m := mload(0x40)\n // `onERC1155Received(address,address,uint256,uint256,bytes)`.\n mstore(m, 0xf23a6e61)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), from)\n mstore(add(m, 0x60), id)\n mstore(add(m, 0x80), amount)\n mstore(add(m, 0xa0), 0xa0)\n calldatacopy(add(m, 0xc0), sub(data.offset, 0x20), add(0x20, data.length))\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, data.length), m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xf23a6e61))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n }\n\n /// @dev Transfers `amounts` of `ids` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `from` must have at least `amount` of `id`.\n /// - `ids` and `amounts` must have the same length.\n /// - If the caller is not `from`,\n /// it must be approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer.\n ///\n /// Emits a {TransferBatch} event.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) public virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(ids.length, amounts.length)) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from))\n let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to))\n mstore(0x20, fromSlotSeed)\n // Clear the upper 96 bits.\n from := shr(96, fromSlotSeed)\n to := shr(96, toSlotSeed)\n // Revert if `to` is the zero address.\n if iszero(to) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // If the caller is not `from`, do the authorization check.\n if iszero(eq(caller(), from)) {\n mstore(0x00, caller())\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Loop through all the `ids` and update the balances.\n {\n let end := shl(5, ids.length)\n for { let i := 0 } iszero(eq(i, end)) { i := add(i, 0x20) } {\n let amount := calldataload(add(amounts.offset, i))\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x20, fromSlotSeed)\n mstore(0x00, calldataload(add(ids.offset, i)))\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, toSlotSeed)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, ids.length))\n let o := add(m, 0x40)\n calldatacopy(o, sub(ids.offset, 0x20), n)\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, n))\n o := add(o, n)\n n := add(0x20, shl(5, amounts.length))\n calldatacopy(o, sub(amounts.offset, 0x20), n)\n n := sub(add(o, n), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), from, to)\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransferCalldata(from, to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n // Do the {onERC1155BatchReceived} check if `to` is a smart contract.\n if extcodesize(to) {\n let m := mload(0x40)\n // Prepare the calldata.\n // `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)`.\n mstore(m, 0xbc197c81)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), from)\n // Copy the `ids`.\n mstore(add(m, 0x60), 0xa0)\n let n := add(0x20, shl(5, ids.length))\n let o := add(m, 0xc0)\n calldatacopy(o, sub(ids.offset, 0x20), n)\n // Copy the `amounts`.\n let s := add(0xa0, n)\n mstore(add(m, 0x80), s)\n o := add(o, n)\n n := add(0x20, shl(5, amounts.length))\n calldatacopy(o, sub(amounts.offset, 0x20), n)\n // Copy the `data`.\n mstore(add(m, 0xa0), add(s, n))\n o := add(o, n)\n n := add(0x20, data.length)\n calldatacopy(o, sub(data.offset, 0x20), n)\n n := sub(add(o, n), add(m, 0x1c))\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), n, m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xbc197c81))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n }\n\n /// @dev Returns the amounts of `ids` for `owners.\n ///\n /// Requirements:\n /// - `owners` and `ids` must have the same length.\n function balanceOfBatch(address[] calldata owners, uint256[] calldata ids)\n public\n view\n virtual\n returns (uint256[] memory balances)\n {\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(ids.length, owners.length)) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n balances := mload(0x40)\n mstore(balances, ids.length)\n let o := add(balances, 0x20)\n let end := shl(5, ids.length)\n mstore(0x40, add(end, o))\n // Loop through all the `ids` and load the balances.\n for { let i := 0 } iszero(eq(i, end)) { i := add(i, 0x20) } {\n let owner := calldataload(add(owners.offset, i))\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, shl(96, owner)))\n mstore(0x00, calldataload(add(ids.offset, i)))\n mstore(add(o, i), sload(keccak256(0x00, 0x40)))\n }\n }\n }\n\n /// @dev Returns true if this contract implements the interface defined by `interfaceId`.\n /// See: https://eips.ethereum.org/EIPS/eip-165\n /// This function call must use less than 30000 gas.\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) {\n /// @solidity memory-safe-assembly\n assembly {\n let s := shr(224, interfaceId)\n // ERC165: 0x01ffc9a7, ERC1155: 0xd9b67a26, ERC1155MetadataURI: 0x0e89341c.\n result := or(or(eq(s, 0x01ffc9a7), eq(s, 0xd9b67a26)), eq(s, 0x0e89341c))\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL MINT FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Mints `amount` of `id` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer.\n ///\n /// Emits a {Transfer} event.\n function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(address(0), to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, to)\n mstore(0x00, id)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n // Emit a {TransferSingle} event.\n mstore(0x00, id)\n mstore(0x20, amount)\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), 0, shr(96, to_))\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(address(0), to, _single(id), _single(amount), data);\n }\n if (_hasCode(to)) _checkOnERC1155Received(address(0), to, id, amount, data);\n }\n\n /// @dev Mints `amounts` of `ids` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `ids` and `amounts` must have the same length.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer.\n ///\n /// Emits a {TransferBatch} event.\n function _batchMint(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(address(0), to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(mload(ids), mload(amounts))) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // Loop through all the `ids` and update the balances.\n {\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, to_))\n let end := shl(5, mload(ids))\n for { let i := 0 } iszero(eq(i, end)) {} {\n i := add(i, 0x20)\n let amount := mload(add(amounts, i))\n // Increase and store the updated balance of `to`.\n {\n mstore(0x00, mload(add(ids, i)))\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0x40)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n n := sub(add(o, returndatasize()), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), 0, shr(96, to_))\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(address(0), to, ids, amounts, data);\n }\n if (_hasCode(to)) _checkOnERC1155BatchReceived(address(0), to, ids, amounts, data);\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL BURN FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Equivalent to `_burn(address(0), from, id, amount)`.\n function _burn(address from, uint256 id, uint256 amount) internal virtual {\n _burn(address(0), from, id, amount);\n }\n\n /// @dev Destroys `amount` of `id` from `from`.\n ///\n /// Requirements:\n /// - `from` must have at least `amount` of `id`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n ///\n /// Emits a {Transfer} event.\n function _burn(address by, address from, uint256 id, uint256 amount) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, address(0), _single(id), _single(amount), \"\");\n }\n /// @solidity memory-safe-assembly\n assembly {\n let from_ := shl(96, from)\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_))\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n if iszero(or(iszero(shl(96, by)), eq(shl(96, by), from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Decrease and store the updated balance of `from`.\n {\n mstore(0x00, id)\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Emit a {TransferSingle} event.\n mstore(0x00, id)\n mstore(0x20, amount)\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), 0)\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, address(0), _single(id), _single(amount), \"\");\n }\n }\n\n /// @dev Equivalent to `_batchBurn(address(0), from, ids, amounts)`.\n function _batchBurn(address from, uint256[] memory ids, uint256[] memory amounts)\n internal\n virtual\n {\n _batchBurn(address(0), from, ids, amounts);\n }\n\n /// @dev Destroys `amounts` of `ids` from `from`.\n ///\n /// Requirements:\n /// - `ids` and `amounts` must have the same length.\n /// - `from` must have at least `amounts` of `ids`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n ///\n /// Emits a {TransferBatch} event.\n function _batchBurn(address by, address from, uint256[] memory ids, uint256[] memory amounts)\n internal\n virtual\n {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, address(0), ids, amounts, \"\");\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(mload(ids), mload(amounts))) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let from_ := shl(96, from)\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_))\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n let by_ := shl(96, by)\n if iszero(or(iszero(by_), eq(by_, from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Loop through all the `ids` and update the balances.\n {\n let end := shl(5, mload(ids))\n for { let i := 0 } iszero(eq(i, end)) {} {\n i := add(i, 0x20)\n let amount := mload(add(amounts, i))\n // Decrease and store the updated balance of `to`.\n {\n mstore(0x00, mload(add(ids, i)))\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0x40)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n n := sub(add(o, returndatasize()), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), 0)\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, address(0), ids, amounts, \"\");\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL APPROVAL FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Approve or remove the `operator` as an operator for `by`,\n /// without authorization checks.\n ///\n /// Emits a {ApprovalForAll} event.\n function _setApprovalForAll(address by, address operator, bool isApproved) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Convert to 0 or 1.\n isApproved := iszero(iszero(isApproved))\n // Update the `isApproved` for (`by`, `operator`).\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, by)\n mstore(0x00, operator)\n sstore(keccak256(0x0c, 0x34), isApproved)\n // Emit the {ApprovalForAll} event.\n mstore(0x00, isApproved)\n let m := shr(96, not(0))\n log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, and(m, by), and(m, operator))\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL TRANSFER FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Equivalent to `_safeTransfer(address(0), from, to, id, amount, data)`.\n function _safeTransfer(address from, address to, uint256 id, uint256 amount, bytes memory data)\n internal\n virtual\n {\n _safeTransfer(address(0), from, to, id, amount, data);\n }\n\n /// @dev Transfers `amount` of `id` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `from` must have at least `amount` of `id`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer.\n ///\n /// Emits a {Transfer} event.\n function _safeTransfer(\n address by,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n let from_ := shl(96, from)\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_))\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n let by_ := shl(96, by)\n if iszero(or(iszero(by_), eq(by_, from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x00, id)\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, to_))\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n // Emit a {TransferSingle} event.\n mstore(0x20, amount)\n // forgefmt: disable-next-line\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_))\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n if (_hasCode(to)) _checkOnERC1155Received(from, to, id, amount, data);\n }\n\n /// @dev Equivalent to `_safeBatchTransfer(address(0), from, to, ids, amounts, data)`.\n function _safeBatchTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n _safeBatchTransfer(address(0), from, to, ids, amounts, data);\n }\n\n /// @dev Transfers `amounts` of `ids` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `ids` and `amounts` must have the same length.\n /// - `from` must have at least `amounts` of `ids`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer.\n ///\n /// Emits a {TransferBatch} event.\n function _safeBatchTransfer(\n address by,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(mload(ids), mload(amounts))) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let from_ := shl(96, from)\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, from_)\n let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, to_)\n mstore(0x20, fromSlotSeed)\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n let by_ := shl(96, by)\n if iszero(or(iszero(by_), eq(by_, from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Loop through all the `ids` and update the balances.\n {\n let end := shl(5, mload(ids))\n for { let i := 0 } iszero(eq(i, end)) {} {\n i := add(i, 0x20)\n let amount := mload(add(amounts, i))\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x20, fromSlotSeed)\n mstore(0x00, mload(add(ids, i)))\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, toSlotSeed)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0x40)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n n := sub(add(o, returndatasize()), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_))\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, ids, amounts, data);\n }\n if (_hasCode(to)) _checkOnERC1155BatchReceived(from, to, ids, amounts, data);\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* HOOKS FOR OVERRIDING */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Override this function to return true if `_beforeTokenTransfer` is used.\n /// The is to help the compiler avoid producing dead bytecode.\n function _useBeforeTokenTransfer() internal view virtual returns (bool) {\n return false;\n }\n\n /// @dev Hook that is called before any token transfer.\n /// This includes minting and burning, as well as batched variants.\n ///\n /// The same hook is called on both single and batched variants.\n /// For single transfers, the length of the `id` and `amount` arrays are 1.\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n /// @dev Override this function to return true if `_afterTokenTransfer` is used.\n /// The is to help the compiler avoid producing dead bytecode.\n function _useAfterTokenTransfer() internal view virtual returns (bool) {\n return false;\n }\n\n /// @dev Hook that is called after any token transfer.\n /// This includes minting and burning, as well as batched variants.\n ///\n /// The same hook is called on both single and batched variants.\n /// For single transfers, the length of the `id` and `amount` arrays are 1.\n function _afterTokenTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* PRIVATE HELPERS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Helper for calling the `_afterTokenTransfer` hook.\n /// The is to help the compiler avoid producing dead bytecode.\n function _afterTokenTransferCalldata(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) private {\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, ids, amounts, data);\n }\n }\n\n /// @dev Returns if `a` has bytecode of non-zero length.\n function _hasCode(address a) private view returns (bool result) {\n /// @solidity memory-safe-assembly\n assembly {\n result := extcodesize(a) // Can handle dirty upper bits.\n }\n }\n\n /// @dev Perform a call to invoke {IERC1155Receiver-onERC1155Received} on `to`.\n /// Reverts if the target does not support the function correctly.\n function _checkOnERC1155Received(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n /// @solidity memory-safe-assembly\n assembly {\n // Prepare the calldata.\n let m := mload(0x40)\n // `onERC1155Received(address,address,uint256,uint256,bytes)`.\n mstore(m, 0xf23a6e61)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), shr(96, shl(96, from)))\n mstore(add(m, 0x60), id)\n mstore(add(m, 0x80), amount)\n mstore(add(m, 0xa0), 0xa0)\n let n := mload(data)\n mstore(add(m, 0xc0), n)\n if n { pop(staticcall(gas(), 4, add(data, 0x20), n, add(m, 0xe0), n)) }\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, n), m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xf23a6e61))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n\n /// @dev Perform a call to invoke {IERC1155Receiver-onERC1155BatchReceived} on `to`.\n /// Reverts if the target does not support the function correctly.\n function _checkOnERC1155BatchReceived(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n /// @solidity memory-safe-assembly\n assembly {\n // Prepare the calldata.\n let m := mload(0x40)\n // `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)`.\n mstore(m, 0xbc197c81)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), shr(96, shl(96, from)))\n // Copy the `ids`.\n mstore(add(m, 0x60), 0xa0)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0xc0)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n let s := add(0xa0, returndatasize())\n mstore(add(m, 0x80), s)\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n // Copy the `data`.\n mstore(add(m, 0xa0), add(s, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, mload(data))\n pop(staticcall(gas(), 4, data, n, o, n))\n n := sub(add(o, returndatasize()), add(m, 0x1c))\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), n, m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xbc197c81))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n\n /// @dev Returns `x` in an array with a single element.\n function _single(uint256 x) private pure returns (uint256[] memory result) {\n assembly {\n result := mload(0x40)\n mstore(0x40, add(result, 0x40))\n mstore(result, 1)\n mstore(add(result, 0x20), x)\n }\n }\n}\n"
},
"lib/seaport/lib/seaport-types/src/lib/ConsiderationStructs.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {\n BasicOrderType,\n ItemType,\n OrderType,\n Side\n} from \"./ConsiderationEnums.sol\";\n\nimport {\n CalldataPointer,\n MemoryPointer\n} from \"../helpers/PointerLibraries.sol\";\n\n/**\n * @dev An order contains eleven components: an offerer, a zone (or account that\n * can cancel the order or restrict who can fulfill the order depending on\n * the type), the order type (specifying partial fill support as well as\n * restricted order status), the start and end time, a hash that will be\n * provided to the zone when validating restricted orders, a salt, a key\n * corresponding to a given conduit, a counter, and an arbitrary number of\n * offer items that can be spent along with consideration items that must\n * be received by their respective recipient.\n */\nstruct OrderComponents {\n address offerer;\n address zone;\n OfferItem[] offer;\n ConsiderationItem[] consideration;\n OrderType orderType;\n uint256 startTime;\n uint256 endTime;\n bytes32 zoneHash;\n uint256 salt;\n bytes32 conduitKey;\n uint256 counter;\n}\n\n/**\n * @dev An offer item has five components: an item type (ETH or other native\n * tokens, ERC20, ERC721, and ERC1155, as well as criteria-based ERC721 and\n * ERC1155), a token address, a dual-purpose \"identifierOrCriteria\"\n * component that will either represent a tokenId or a merkle root\n * depending on the item type, and a start and end amount that support\n * increasing or decreasing amounts over the duration of the respective\n * order.\n */\nstruct OfferItem {\n ItemType itemType;\n address token;\n uint256 identifierOrCriteria;\n uint256 startAmount;\n uint256 endAmount;\n}\n\n/**\n * @dev A consideration item has the same five components as an offer item and\n * an additional sixth component designating the required recipient of the\n * item.\n */\nstruct ConsiderationItem {\n ItemType itemType;\n address token;\n uint256 identifierOrCriteria;\n uint256 startAmount;\n uint256 endAmount;\n address payable recipient;\n}\n\n/**\n * @dev A spent item is translated from a utilized offer item and has four\n * components: an item type (ETH or other native tokens, ERC20, ERC721, and\n * ERC1155), a token address, a tokenId, and an amount.\n */\nstruct SpentItem {\n ItemType itemType;\n address token;\n uint256 identifier;\n uint256 amount;\n}\n\n/**\n * @dev A received item is translated from a utilized consideration item and has\n * the same four components as a spent item, as well as an additional fifth\n * component designating the required recipient of the item.\n */\nstruct ReceivedItem {\n ItemType itemType;\n address token;\n uint256 identifier;\n uint256 amount;\n address payable recipient;\n}\n\n/**\n * @dev For basic orders involving ETH / native / ERC20 <=> ERC721 / ERC1155\n * matching, a group of six functions may be called that only requires a\n * subset of the usual order arguments. Note the use of a \"basicOrderType\"\n * enum; this represents both the usual order type as well as the \"route\"\n * of the basic order (a simple derivation function for the basic order\n * type is `basicOrderType = orderType + (4 * basicOrderRoute)`.)\n */\nstruct BasicOrderParameters {\n // calldata offset\n address considerationToken; // 0x24\n uint256 considerationIdentifier; // 0x44\n uint256 considerationAmount; // 0x64\n address payable offerer; // 0x84\n address zone; // 0xa4\n address offerToken; // 0xc4\n uint256 offerIdentifier; // 0xe4\n uint256 offerAmount; // 0x104\n BasicOrderType basicOrderType; // 0x124\n uint256 startTime; // 0x144\n uint256 endTime; // 0x164\n bytes32 zoneHash; // 0x184\n uint256 salt; // 0x1a4\n bytes32 offererConduitKey; // 0x1c4\n bytes32 fulfillerConduitKey; // 0x1e4\n uint256 totalOriginalAdditionalRecipients; // 0x204\n AdditionalRecipient[] additionalRecipients; // 0x224\n bytes signature; // 0x244\n // Total length, excluding dynamic array data: 0x264 (580)\n}\n\n/**\n * @dev Basic orders can supply any number of additional recipients, with the\n * implied assumption that they are supplied from the offered ETH (or other\n * native token) or ERC20 token for the order.\n */\nstruct AdditionalRecipient {\n uint256 amount;\n address payable recipient;\n}\n\n/**\n * @dev The full set of order components, with the exception of the counter,\n * must be supplied when fulfilling more sophisticated orders or groups of\n * orders. The total number of original consideration items must also be\n * supplied, as the caller may specify additional consideration items.\n */\nstruct OrderParameters {\n address offerer; // 0x00\n address zone; // 0x20\n OfferItem[] offer; // 0x40\n ConsiderationItem[] consideration; // 0x60\n OrderType orderType; // 0x80\n uint256 startTime; // 0xa0\n uint256 endTime; // 0xc0\n bytes32 zoneHash; // 0xe0\n uint256 salt; // 0x100\n bytes32 conduitKey; // 0x120\n uint256 totalOriginalConsiderationItems; // 0x140\n // offer.length // 0x160\n}\n\n/**\n * @dev Orders require a signature in addition to the other order parameters.\n */\nstruct Order {\n OrderParameters parameters;\n bytes signature;\n}\n\n/**\n * @dev Advanced orders include a numerator (i.e. a fraction to attempt to fill)\n * and a denominator (the total size of the order) in addition to the\n * signature and other order parameters. It also supports an optional field\n * for supplying extra data; this data will be provided to the zone if the\n * order type is restricted and the zone is not the caller, or will be\n * provided to the offerer as context for contract order types.\n */\nstruct AdvancedOrder {\n OrderParameters parameters;\n uint120 numerator;\n uint120 denominator;\n bytes signature;\n bytes extraData;\n}\n\n/**\n * @dev Orders can be validated (either explicitly via `validate`, or as a\n * consequence of a full or partial fill), specifically cancelled (they can\n * also be cancelled in bulk via incrementing a per-zone counter), and\n * partially or fully filled (with the fraction filled represented by a\n * numerator and denominator).\n */\nstruct OrderStatus {\n bool isValidated;\n bool isCancelled;\n uint120 numerator;\n uint120 denominator;\n}\n\n/**\n * @dev A criteria resolver specifies an order, side (offer vs. consideration),\n * and item index. It then provides a chosen identifier (i.e. tokenId)\n * alongside a merkle proof demonstrating the identifier meets the required\n * criteria.\n */\nstruct CriteriaResolver {\n uint256 orderIndex;\n Side side;\n uint256 index;\n uint256 identifier;\n bytes32[] criteriaProof;\n}\n\n/**\n * @dev A fulfillment is applied to a group of orders. It decrements a series of\n * offer and consideration items, then generates a single execution\n * element. A given fulfillment can be applied to as many offer and\n * consideration items as desired, but must contain at least one offer and\n * at least one consideration that match. The fulfillment must also remain\n * consistent on all key parameters across all offer items (same offerer,\n * token, type, tokenId, and conduit preference) as well as across all\n * consideration items (token, type, tokenId, and recipient).\n */\nstruct Fulfillment {\n FulfillmentComponent[] offerComponents;\n FulfillmentComponent[] considerationComponents;\n}\n\n/**\n * @dev Each fulfillment component contains one index referencing a specific\n * order and another referencing a specific offer or consideration item.\n */\nstruct FulfillmentComponent {\n uint256 orderIndex;\n uint256 itemIndex;\n}\n\n/**\n * @dev An execution is triggered once all consideration items have been zeroed\n * out. It sends the item in question from the offerer to the item's\n * recipient, optionally sourcing approvals from either this contract\n * directly or from the offerer's chosen conduit if one is specified. An\n * execution is not provided as an argument, but rather is derived via\n * orders, criteria resolvers, and fulfillments (where the total number of\n * executions will be less than or equal to the total number of indicated\n * fulfillments) and returned as part of `matchOrders`.\n */\nstruct Execution {\n ReceivedItem item;\n address offerer;\n bytes32 conduitKey;\n}\n\n/**\n * @dev Restricted orders are validated post-execution by calling validateOrder\n * on the zone. This struct provides context about the order fulfillment\n * and any supplied extraData, as well as all order hashes fulfilled in a\n * call to a match or fulfillAvailable method.\n */\nstruct ZoneParameters {\n bytes32 orderHash;\n address fulfiller;\n address offerer;\n SpentItem[] offer;\n ReceivedItem[] consideration;\n bytes extraData;\n bytes32[] orderHashes;\n uint256 startTime;\n uint256 endTime;\n bytes32 zoneHash;\n}\n\n/**\n * @dev Zones and contract offerers can communicate which schemas they implement\n * along with any associated metadata related to each schema.\n */\nstruct Schema {\n uint256 id;\n bytes metadata;\n}\n\nusing StructPointers for OrderComponents global;\nusing StructPointers for OfferItem global;\nusing StructPointers for ConsiderationItem global;\nusing StructPointers for SpentItem global;\nusing StructPointers for ReceivedItem global;\nusing StructPointers for BasicOrderParameters global;\nusing StructPointers for AdditionalRecipient global;\nusing StructPointers for OrderParameters global;\nusing StructPointers for Order global;\nusing StructPointers for AdvancedOrder global;\nusing StructPointers for OrderStatus global;\nusing StructPointers for CriteriaResolver global;\nusing StructPointers for Fulfillment global;\nusing StructPointers for FulfillmentComponent global;\nusing StructPointers for Execution global;\nusing StructPointers for ZoneParameters global;\n\n/**\n * @dev This library provides a set of functions for converting structs to\n * pointers.\n */\nlibrary StructPointers {\n /**\n * @dev Get a MemoryPointer from OrderComponents.\n *\n * @param obj The OrderComponents object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OrderComponents memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OrderComponents.\n *\n * @param obj The OrderComponents object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OrderComponents calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from OfferItem.\n *\n * @param obj The OfferItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OfferItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OfferItem.\n *\n * @param obj The OfferItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OfferItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from ConsiderationItem.\n *\n * @param obj The ConsiderationItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n ConsiderationItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from ConsiderationItem.\n *\n * @param obj The ConsiderationItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n ConsiderationItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from SpentItem.\n *\n * @param obj The SpentItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n SpentItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from SpentItem.\n *\n * @param obj The SpentItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n SpentItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from ReceivedItem.\n *\n * @param obj The ReceivedItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n ReceivedItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from ReceivedItem.\n *\n * @param obj The ReceivedItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n ReceivedItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from BasicOrderParameters.\n *\n * @param obj The BasicOrderParameters object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n BasicOrderParameters memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from BasicOrderParameters.\n *\n * @param obj The BasicOrderParameters object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n BasicOrderParameters calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from AdditionalRecipient.\n *\n * @param obj The AdditionalRecipient object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n AdditionalRecipient memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from AdditionalRecipient.\n *\n * @param obj The AdditionalRecipient object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n AdditionalRecipient calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from OrderParameters.\n *\n * @param obj The OrderParameters object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OrderParameters memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OrderParameters.\n *\n * @param obj The OrderParameters object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OrderParameters calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from Order.\n *\n * @param obj The Order object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n Order memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from Order.\n *\n * @param obj The Order object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n Order calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from AdvancedOrder.\n *\n * @param obj The AdvancedOrder object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n AdvancedOrder memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from AdvancedOrder.\n *\n * @param obj The AdvancedOrder object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n AdvancedOrder calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from OrderStatus.\n *\n * @param obj The OrderStatus object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OrderStatus memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OrderStatus.\n *\n * @param obj The OrderStatus object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OrderStatus calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from CriteriaResolver.\n *\n * @param obj The CriteriaResolver object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n CriteriaResolver memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from CriteriaResolver.\n *\n * @param obj The CriteriaResolver object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n CriteriaResolver calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from Fulfillment.\n *\n * @param obj The Fulfillment object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n Fulfillment memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from Fulfillment.\n *\n * @param obj The Fulfillment object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n Fulfillment calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from FulfillmentComponent.\n *\n * @param obj The FulfillmentComponent object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n FulfillmentComponent memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from FulfillmentComponent.\n *\n * @param obj The FulfillmentComponent object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n FulfillmentComponent calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from Execution.\n *\n * @param obj The Execution object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n Execution memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from Execution.\n *\n * @param obj The Execution object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n Execution calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from ZoneParameters.\n *\n * @param obj The ZoneParameters object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n ZoneParameters memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from ZoneParameters.\n *\n * @param obj The ZoneParameters object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n ZoneParameters calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n}\n"
},
"lib/seaport/lib/seaport-types/src/interfaces/ContractOffererInterface.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {ReceivedItem, Schema, SpentItem} from \"../lib/ConsiderationStructs.sol\";\nimport {IERC165} from \"../interfaces/IERC165.sol\";\n\n/**\n * @title ContractOffererInterface\n * @notice Contains the minimum interfaces needed to interact with a contract\n * offerer.\n */\ninterface ContractOffererInterface is IERC165 {\n /**\n * @dev Generates an order with the specified minimum and maximum spent\n * items, and optional context (supplied as extraData).\n *\n * @param fulfiller The address of the fulfiller.\n * @param minimumReceived The minimum items that the caller is willing to\n * receive.\n * @param maximumSpent The maximum items the caller is willing to spend.\n * @param context Additional context of the order.\n *\n * @return offer A tuple containing the offer items.\n * @return consideration A tuple containing the consideration items.\n */\n function generateOrder(\n address fulfiller,\n SpentItem[] calldata minimumReceived,\n SpentItem[] calldata maximumSpent,\n bytes calldata context // encoded based on the schemaID\n ) external returns (SpentItem[] memory offer, ReceivedItem[] memory consideration);\n\n /**\n * @dev Ratifies an order with the specified offer, consideration, and\n * optional context (supplied as extraData).\n *\n * @param offer The offer items.\n * @param consideration The consideration items.\n * @param context Additional context of the order.\n * @param orderHashes The hashes to ratify.\n * @param contractNonce The nonce of the contract.\n *\n * @return ratifyOrderMagicValue The magic value returned by the contract\n * offerer.\n */\n function ratifyOrder(\n SpentItem[] calldata offer,\n ReceivedItem[] calldata consideration,\n bytes calldata context, // encoded based on the schemaID\n bytes32[] calldata orderHashes,\n uint256 contractNonce\n ) external returns (bytes4 ratifyOrderMagicValue);\n\n /**\n * @dev View function to preview an order generated in response to a minimum\n * set of received items, maximum set of spent items, and context\n * (supplied as extraData).\n *\n * @param caller The address of the caller (e.g. Seaport).\n * @param fulfiller The address of the fulfiller (e.g. the account\n * calling Seaport).\n * @param minimumReceived The minimum items that the caller is willing to\n * receive.\n * @param maximumSpent The maximum items the caller is willing to spend.\n * @param context Additional context of the order.\n *\n * @return offer A tuple containing the offer items.\n * @return consideration A tuple containing the consideration items.\n */\n function previewOrder(\n address caller,\n address fulfiller,\n SpentItem[] calldata minimumReceived,\n SpentItem[] calldata maximumSpent,\n bytes calldata context // encoded based on the schemaID\n ) external view returns (SpentItem[] memory offer, ReceivedItem[] memory consideration);\n\n /**\n * @dev Gets the metadata for this contract offerer.\n *\n * @return name The name of the contract offerer.\n * @return schemas The schemas supported by the contract offerer.\n */\n function getSeaportMetadata() external view returns (string memory name, Schema[] memory schemas); // map to Seaport Improvement Proposal IDs\n\n function supportsInterface(bytes4 interfaceId) external view override returns (bool);\n\n // Additional functions and/or events based on implemented schemaIDs\n}\n"
},
"lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.19;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
},
"src/interfaces/ISeaDropTokenContractMetadata.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\ninterface ISeaDropTokenContractMetadata {\n /**\n * @dev Emit an event for token metadata reveals/updates,\n * according to EIP-4906.\n *\n * @param _fromTokenId The start token id.\n * @param _toTokenId The end token id.\n */\n event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);\n\n /**\n * @dev Emit an event when the URI for the collection-level metadata\n * is updated.\n */\n event ContractURIUpdated(string newContractURI);\n\n /**\n * @dev Emit an event with the previous and new provenance hash after\n * being updated.\n */\n event ProvenanceHashUpdated(bytes32 previousHash, bytes32 newHash);\n\n /**\n * @dev Emit an event when the EIP-2981 royalty info is updated.\n */\n event RoyaltyInfoUpdated(address receiver, uint256 basisPoints);\n\n /**\n * @notice Throw if the max supply exceeds uint64, a limit\n * due to the storage of bit-packed variables.\n */\n error CannotExceedMaxSupplyOfUint64(uint256 got);\n\n /**\n * @dev Revert with an error when attempting to set the provenance\n * hash after the mint has started.\n */\n error ProvenanceHashCannotBeSetAfterMintStarted();\n\n /**\n * @dev Revert with an error when attempting to set the provenance\n * hash after it has already been set.\n */\n error ProvenanceHashCannotBeSetAfterAlreadyBeingSet();\n\n /**\n * @notice Sets the base URI for the token metadata and emits an event.\n *\n * @param tokenURI The new base URI to set.\n */\n function setBaseURI(string calldata tokenURI) external;\n\n /**\n * @notice Sets the contract URI for contract metadata.\n *\n * @param newContractURI The new contract URI.\n */\n function setContractURI(string calldata newContractURI) external;\n\n /**\n * @notice Sets the provenance hash and emits an event.\n *\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it has not been\n * modified after mint started.\n *\n * This function will revert after the first item has been minted.\n *\n * @param newProvenanceHash The new provenance hash to set.\n */\n function setProvenanceHash(bytes32 newProvenanceHash) external;\n\n /**\n * @notice Sets the default royalty information.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator of\n * 10_000 basis points.\n */\n function setDefaultRoyalty(address receiver, uint96 feeNumerator) external;\n\n /**\n * @notice Returns the base URI for token metadata.\n */\n function baseURI() external view returns (string memory);\n\n /**\n * @notice Returns the contract URI.\n */\n function contractURI() external view returns (string memory);\n\n /**\n * @notice Returns the provenance hash.\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it is unmodified\n * after mint has started.\n */\n function provenanceHash() external view returns (bytes32);\n}\n"
},
"src/interfaces/IERC1155ContractMetadata.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n ISeaDropTokenContractMetadata\n} from \"./ISeaDropTokenContractMetadata.sol\";\n\ninterface IERC1155ContractMetadata is ISeaDropTokenContractMetadata {\n /**\n * @dev A struct representing the supply info for a token id,\n * packed into one storage slot.\n *\n * @param maxSupply The max supply for the token id.\n * @param totalSupply The total token supply for the token id.\n * Subtracted when an item is burned.\n * @param totalMinted The total number of tokens minted for the token id.\n */\n struct TokenSupply {\n uint64 maxSupply; // 64/256 bits\n uint64 totalSupply; // 128/256 bits\n uint64 totalMinted; // 192/256 bits\n }\n\n /**\n * @dev Emit an event when the max token supply for a token id is updated.\n */\n event MaxSupplyUpdated(uint256 tokenId, uint256 newMaxSupply);\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max token\n * supply.\n */\n error MintExceedsMaxSupply(uint256 total, uint256 maxSupply);\n\n /**\n * @notice Sets the max supply for a token id and emits an event.\n *\n * @param tokenId The token id to set the max supply for.\n * @param newMaxSupply The new max supply to set.\n */\n function setMaxSupply(uint256 tokenId, uint256 newMaxSupply) external;\n\n /**\n * @notice Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @notice Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @notice Returns the max token supply for a token id.\n */\n function maxSupply(uint256 tokenId) external view returns (uint256);\n\n /**\n * @notice Returns the total supply for a token id.\n */\n function totalSupply(uint256 tokenId) external view returns (uint256);\n\n /**\n * @notice Returns the total minted for a token id.\n */\n function totalMinted(uint256 tokenId) external view returns (uint256);\n}\n"
},
"src/interfaces/ICreatorToken.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\ninterface ICreatorToken {\n event TransferValidatorUpdated(address oldValidator, address newValidator);\n\n function getTransferValidator() external view returns (address validator);\n\n function getTransferValidationFunction()\n external\n view\n returns (bytes4 functionSignature, bool isViewFunction);\n\n function setTransferValidator(address validator) external;\n}\n\ninterface ILegacyCreatorToken {\n event TransferValidatorUpdated(address oldValidator, address newValidator);\n\n function getTransferValidator() external view returns (address validator);\n\n function setTransferValidator(address validator) external;\n}\n"
},
"src/interfaces/ITransferValidator.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\ninterface ITransferValidator721 {\n /// @notice Ensure that a transfer has been authorized for a specific tokenId\n function validateTransfer(\n address caller,\n address from,\n address to,\n uint256 tokenId\n ) external view;\n}\n\ninterface ITransferValidator1155 {\n /// @notice Ensure that a transfer has been authorized for a specific amount of a specific tokenId, and reduce the transferable amount remaining\n function validateTransfer(\n address caller,\n address from,\n address to,\n uint256 tokenId,\n uint256 amount\n ) external;\n}\n"
},
"src/lib/TokenTransferValidator.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport { ICreatorToken } from \"../interfaces/ICreatorToken.sol\";\n\n/**\n * @title TokenTransferValidator\n * @notice Functionality to use a transfer validator.\n */\nabstract contract TokenTransferValidator is ICreatorToken {\n /// @dev Store the transfer validator. The null address means no transfer validator is set.\n address internal _transferValidator;\n\n /// @notice Revert with an error if the transfer validator is being set to the same address.\n error SameTransferValidator();\n\n /// @notice Returns the currently active transfer validator.\n /// The null address means no transfer validator is set.\n function getTransferValidator() external view returns (address) {\n return _transferValidator;\n }\n\n /// @notice Set the transfer validator.\n /// The external method that uses this must include access control.\n function _setTransferValidator(address newValidator) internal {\n address oldValidator = _transferValidator;\n if (oldValidator == newValidator) {\n revert SameTransferValidator();\n }\n _transferValidator = newValidator;\n emit TransferValidatorUpdated(oldValidator, newValidator);\n }\n}\n"
},
"lib/solady/src/tokens/ERC2981.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Simple ERC2981 NFT Royalty Standard implementation.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC2981.sol)\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/common/ERC2981.sol)\nabstract contract ERC2981 {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CUSTOM ERRORS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The royalty fee numerator exceeds the fee denominator.\n error RoyaltyOverflow();\n\n /// @dev The royalty receiver cannot be the zero address.\n error RoyaltyReceiverIsZeroAddress();\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* STORAGE */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The default royalty info is given by:\n /// ```\n /// let packed := sload(_ERC2981_MASTER_SLOT_SEED)\n /// let receiver := shr(96, packed)\n /// let royaltyFraction := xor(packed, shl(96, receiver))\n /// ```\n ///\n /// The per token royalty info is given by.\n /// ```\n /// mstore(0x00, tokenId)\n /// mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n /// let packed := sload(keccak256(0x00, 0x40))\n /// let receiver := shr(96, packed)\n /// let royaltyFraction := xor(packed, shl(96, receiver))\n /// ```\n uint256 private constant _ERC2981_MASTER_SLOT_SEED = 0xaa4ec00224afccfdb7;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* ERC2981 */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Checks that `_feeDenominator` is non-zero.\n constructor() {\n require(_feeDenominator() != 0, \"Fee denominator cannot be zero.\");\n }\n\n /// @dev Returns the denominator for the royalty amount.\n /// Defaults to 10000, which represents fees in basis points.\n /// Override this function to return a custom amount if needed.\n function _feeDenominator() internal pure virtual returns (uint96) {\n return 10000;\n }\n\n /// @dev Returns true if this contract implements the interface defined by `interfaceId`.\n /// See: https://eips.ethereum.org/EIPS/eip-165\n /// This function call must use less than 30000 gas.\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) {\n /// @solidity memory-safe-assembly\n assembly {\n let s := shr(224, interfaceId)\n // ERC165: 0x01ffc9a7, ERC2981: 0x2a55205a.\n result := or(eq(s, 0x01ffc9a7), eq(s, 0x2a55205a))\n }\n }\n\n /// @dev Returns the `receiver` and `royaltyAmount` for `tokenId` sold at `salePrice`.\n function royaltyInfo(uint256 tokenId, uint256 salePrice)\n public\n view\n virtual\n returns (address receiver, uint256 royaltyAmount)\n {\n uint256 feeDenominator = _feeDenominator();\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, tokenId)\n mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n let packed := sload(keccak256(0x00, 0x40))\n receiver := shr(96, packed)\n if iszero(receiver) {\n packed := sload(mload(0x20))\n receiver := shr(96, packed)\n }\n let x := salePrice\n let y := xor(packed, shl(96, receiver)) // `feeNumerator`.\n // Overflow check, equivalent to `require(y == 0 || x <= type(uint256).max / y)`.\n // Out-of-gas revert. Should not be triggered in practice, but included for safety.\n returndatacopy(returndatasize(), returndatasize(), mul(y, gt(x, div(not(0), y))))\n royaltyAmount := div(mul(x, y), feeDenominator)\n }\n }\n\n /// @dev Sets the default royalty `receiver` and `feeNumerator`.\n ///\n /// Requirements:\n /// - `receiver` must not be the zero address.\n /// - `feeNumerator` must not be greater than the fee denominator.\n function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {\n uint256 feeDenominator = _feeDenominator();\n /// @solidity memory-safe-assembly\n assembly {\n feeNumerator := shr(160, shl(160, feeNumerator))\n if gt(feeNumerator, feeDenominator) {\n mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`.\n revert(0x1c, 0x04)\n }\n let packed := shl(96, receiver)\n if iszero(packed) {\n mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`.\n revert(0x1c, 0x04)\n }\n sstore(_ERC2981_MASTER_SLOT_SEED, or(packed, feeNumerator))\n }\n }\n\n /// @dev Sets the default royalty `receiver` and `feeNumerator` to zero.\n function _deleteDefaultRoyalty() internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n sstore(_ERC2981_MASTER_SLOT_SEED, 0)\n }\n }\n\n /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId`.\n ///\n /// Requirements:\n /// - `receiver` must not be the zero address.\n /// - `feeNumerator` must not be greater than the fee denominator.\n function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator)\n internal\n virtual\n {\n uint256 feeDenominator = _feeDenominator();\n /// @solidity memory-safe-assembly\n assembly {\n feeNumerator := shr(160, shl(160, feeNumerator))\n if gt(feeNumerator, feeDenominator) {\n mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`.\n revert(0x1c, 0x04)\n }\n let packed := shl(96, receiver)\n if iszero(packed) {\n mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`.\n revert(0x1c, 0x04)\n }\n mstore(0x00, tokenId)\n mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n sstore(keccak256(0x00, 0x40), or(packed, feeNumerator))\n }\n }\n\n /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId` to zero.\n function _resetTokenRoyalty(uint256 tokenId) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, tokenId)\n mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n sstore(keccak256(0x00, 0x40), 0)\n }\n }\n}\n"
},
"lib/solady/src/auth/Ownable.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Simple single owner authorization mixin.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol)\n/// @dev While the ownable portion follows\n/// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility,\n/// the nomenclature for the 2-step ownership handover may be unique to this codebase.\nabstract contract Ownable {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CUSTOM ERRORS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The caller is not authorized to call the function.\n error Unauthorized();\n\n /// @dev The `newOwner` cannot be the zero address.\n error NewOwnerIsZeroAddress();\n\n /// @dev The `pendingOwner` does not have a valid handover request.\n error NoHandoverRequest();\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* EVENTS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The ownership is transferred from `oldOwner` to `newOwner`.\n /// This event is intentionally kept the same as OpenZeppelin's Ownable to be\n /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173),\n /// despite it not being as lightweight as a single argument event.\n event OwnershipTransferred(address indexed oldOwner, address indexed newOwner);\n\n /// @dev An ownership handover to `pendingOwner` has been requested.\n event OwnershipHandoverRequested(address indexed pendingOwner);\n\n /// @dev The ownership handover to `pendingOwner` has been canceled.\n event OwnershipHandoverCanceled(address indexed pendingOwner);\n\n /// @dev `keccak256(bytes(\"OwnershipTransferred(address,address)\"))`.\n uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE =\n 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0;\n\n /// @dev `keccak256(bytes(\"OwnershipHandoverRequested(address)\"))`.\n uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE =\n 0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d;\n\n /// @dev `keccak256(bytes(\"OwnershipHandoverCanceled(address)\"))`.\n uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE =\n 0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* STORAGE */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The owner slot is given by: `not(_OWNER_SLOT_NOT)`.\n /// It is intentionally chosen to be a high value\n /// to avoid collision with lower slots.\n /// The choice of manual storage layout is to enable compatibility\n /// with both regular and upgradeable contracts.\n uint256 private constant _OWNER_SLOT_NOT = 0x8b78c6d8;\n\n /// The ownership handover slot of `newOwner` is given by:\n /// ```\n /// mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED))\n /// let handoverSlot := keccak256(0x00, 0x20)\n /// ```\n /// It stores the expiry timestamp of the two-step ownership handover.\n uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Initializes the owner directly without authorization guard.\n /// This function must be called upon initialization,\n /// regardless of whether the contract is upgradeable or not.\n /// This is to enable generalization to both regular and upgradeable contracts,\n /// and to save gas in case the initial owner is not the caller.\n /// For performance reasons, this function will not check if there\n /// is an existing owner.\n function _initializeOwner(address newOwner) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Clean the upper 96 bits.\n newOwner := shr(96, shl(96, newOwner))\n // Store the new value.\n sstore(not(_OWNER_SLOT_NOT), newOwner)\n // Emit the {OwnershipTransferred} event.\n log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner)\n }\n }\n\n /// @dev Sets the owner directly without authorization guard.\n function _setOwner(address newOwner) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n let ownerSlot := not(_OWNER_SLOT_NOT)\n // Clean the upper 96 bits.\n newOwner := shr(96, shl(96, newOwner))\n // Emit the {OwnershipTransferred} event.\n log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)\n // Store the new value.\n sstore(ownerSlot, newOwner)\n }\n }\n\n /// @dev Throws if the sender is not the owner.\n function _checkOwner() internal view virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // If the caller is not the stored owner, revert.\n if iszero(eq(caller(), sload(not(_OWNER_SLOT_NOT)))) {\n mstore(0x00, 0x82b42900) // `Unauthorized()`.\n revert(0x1c, 0x04)\n }\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* PUBLIC UPDATE FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Allows the owner to transfer the ownership to `newOwner`.\n function transferOwnership(address newOwner) public payable virtual onlyOwner {\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(shl(96, newOwner)) {\n mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`.\n revert(0x1c, 0x04)\n }\n }\n _setOwner(newOwner);\n }\n\n /// @dev Allows the owner to renounce their ownership.\n function renounceOwnership() public payable virtual onlyOwner {\n _setOwner(address(0));\n }\n\n /// @dev Request a two-step ownership handover to the caller.\n /// The request will automatically expire in 48 hours (172800 seconds) by default.\n function requestOwnershipHandover() public payable virtual {\n unchecked {\n uint256 expires = block.timestamp + ownershipHandoverValidFor();\n /// @solidity memory-safe-assembly\n assembly {\n // Compute and set the handover slot to `expires`.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, caller())\n sstore(keccak256(0x0c, 0x20), expires)\n // Emit the {OwnershipHandoverRequested} event.\n log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller())\n }\n }\n }\n\n /// @dev Cancels the two-step ownership handover to the caller, if any.\n function cancelOwnershipHandover() public payable virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Compute and set the handover slot to 0.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, caller())\n sstore(keccak256(0x0c, 0x20), 0)\n // Emit the {OwnershipHandoverCanceled} event.\n log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller())\n }\n }\n\n /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`.\n /// Reverts if there is no existing ownership handover requested by `pendingOwner`.\n function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner {\n /// @solidity memory-safe-assembly\n assembly {\n // Compute and set the handover slot to 0.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, pendingOwner)\n let handoverSlot := keccak256(0x0c, 0x20)\n // If the handover does not exist, or has expired.\n if gt(timestamp(), sload(handoverSlot)) {\n mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`.\n revert(0x1c, 0x04)\n }\n // Set the handover slot to 0.\n sstore(handoverSlot, 0)\n }\n _setOwner(pendingOwner);\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* PUBLIC READ FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the owner of the contract.\n function owner() public view virtual returns (address result) {\n /// @solidity memory-safe-assembly\n assembly {\n result := sload(not(_OWNER_SLOT_NOT))\n }\n }\n\n /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`.\n function ownershipHandoverExpiresAt(address pendingOwner)\n public\n view\n virtual\n returns (uint256 result)\n {\n /// @solidity memory-safe-assembly\n assembly {\n // Compute the handover slot.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, pendingOwner)\n // Load the handover slot.\n result := sload(keccak256(0x0c, 0x20))\n }\n }\n\n /// @dev Returns how long a two-step ownership handover is valid for in seconds.\n function ownershipHandoverValidFor() public view virtual returns (uint64) {\n return 48 * 3600;\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* MODIFIERS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Marks a function as only callable by the owner.\n modifier onlyOwner() virtual {\n _checkOwner();\n _;\n }\n}\n"
},
"lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.19;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (address(this).code.length == 0 && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n"
},
"src/lib/SeaDropErrorsAndEvents.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { CreatorPayout, PublicDrop } from \"./ERC721SeaDropStructs.sol\";\n\ninterface SeaDropErrorsAndEvents {\n /**\n * @notice The SeaDrop token types, emitted as part of\n * `event SeaDropTokenDeployed`.\n */\n enum SEADROP_TOKEN_TYPE {\n ERC721_STANDARD,\n ERC721_CLONE,\n ERC721_UPGRADEABLE,\n ERC1155_STANDARD,\n ERC1155_CLONE,\n ERC1155_UPGRADEABLE\n }\n\n /**\n * @notice An event to signify that a SeaDrop token contract was deployed.\n */\n event SeaDropTokenDeployed(SEADROP_TOKEN_TYPE tokenType);\n\n /**\n * @notice Revert with an error if the function selector is not supported.\n */\n error UnsupportedFunctionSelector(bytes4 selector);\n\n /**\n * @dev Revert with an error if the drop stage is not active.\n */\n error NotActive(\n uint256 currentTimestamp,\n uint256 startTimestamp,\n uint256 endTimestamp\n );\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max allowed\n * to be minted per wallet.\n */\n error MintQuantityExceedsMaxMintedPerWallet(uint256 total, uint256 allowed);\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max token\n * supply.\n */\n error MintQuantityExceedsMaxSupply(uint256 total, uint256 maxSupply);\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max token\n * supply for the stage.\n * Note: The `maxTokenSupplyForStage` for public mint is\n * always `type(uint).max`.\n */\n error MintQuantityExceedsMaxTokenSupplyForStage(\n uint256 total,\n uint256 maxTokenSupplyForStage\n );\n\n /**\n * @dev Revert if the fee recipient is the zero address.\n */\n error FeeRecipientCannotBeZeroAddress();\n\n /**\n * @dev Revert if the fee recipient is not already included.\n */\n error FeeRecipientNotPresent();\n\n /**\n * @dev Revert if the fee basis points is greater than 10_000.\n */\n error InvalidFeeBps(uint256 feeBps);\n\n /**\n * @dev Revert if the fee recipient is already included.\n */\n error DuplicateFeeRecipient();\n\n /**\n * @dev Revert if the fee recipient is restricted and not allowed.\n */\n error FeeRecipientNotAllowed(address got);\n\n /**\n * @dev Revert if the creator payout address is the zero address.\n */\n error CreatorPayoutAddressCannotBeZeroAddress();\n\n /**\n * @dev Revert if the creator payouts are not set.\n */\n error CreatorPayoutsNotSet();\n\n /**\n * @dev Revert if the creator payout basis points are zero.\n */\n error CreatorPayoutBasisPointsCannotBeZero();\n\n /**\n * @dev Revert if the total basis points for the creator payouts\n * don't equal exactly 10_000.\n */\n error InvalidCreatorPayoutTotalBasisPoints(\n uint256 totalReceivedBasisPoints\n );\n\n /**\n * @dev Revert if the creator payout basis points don't add up to 10_000.\n */\n error InvalidCreatorPayoutBasisPoints(uint256 totalReceivedBasisPoints);\n\n /**\n * @dev Revert with an error if the allow list proof is invalid.\n */\n error InvalidProof();\n\n /**\n * @dev Revert if a supplied signer address is the zero address.\n */\n error SignerCannotBeZeroAddress();\n\n /**\n * @dev Revert with an error if a signer is not included in\n * the enumeration when removing.\n */\n error SignerNotPresent();\n\n /**\n * @dev Revert with an error if a payer is not included in\n * the enumeration when removing.\n */\n error PayerNotPresent();\n\n /**\n * @dev Revert with an error if a payer is already included in mapping\n * when adding.\n */\n error DuplicatePayer();\n\n /**\n * @dev Revert with an error if a signer is already included in mapping\n * when adding.\n */\n error DuplicateSigner();\n\n /**\n * @dev Revert with an error if the payer is not allowed. The minter must\n * pay for their own mint.\n */\n error PayerNotAllowed(address got);\n\n /**\n * @dev Revert if a supplied payer address is the zero address.\n */\n error PayerCannotBeZeroAddress();\n\n /**\n * @dev Revert if the start time is greater than the end time.\n */\n error InvalidStartAndEndTime(uint256 startTime, uint256 endTime);\n\n /**\n * @dev Revert with an error if the signer payment token is not the same.\n */\n error InvalidSignedPaymentToken(address got, address want);\n\n /**\n * @dev Revert with an error if supplied signed mint price is less than\n * the minimum specified.\n */\n error InvalidSignedMintPrice(\n address paymentToken,\n uint256 got,\n uint256 minimum\n );\n\n /**\n * @dev Revert with an error if supplied signed maxTotalMintableByWallet\n * is greater than the maximum specified.\n */\n error InvalidSignedMaxTotalMintableByWallet(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed\n * maxTotalMintableByWalletPerToken is greater than the maximum\n * specified.\n */\n error InvalidSignedMaxTotalMintableByWalletPerToken(\n uint256 got,\n uint256 maximum\n );\n\n /**\n * @dev Revert with an error if the fromTokenId is not within range.\n */\n error InvalidSignedFromTokenId(uint256 got, uint256 minimum);\n\n /**\n * @dev Revert with an error if the toTokenId is not within range.\n */\n error InvalidSignedToTokenId(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed start time is less than\n * the minimum specified.\n */\n error InvalidSignedStartTime(uint256 got, uint256 minimum);\n\n /**\n * @dev Revert with an error if supplied signed end time is greater than\n * the maximum specified.\n */\n error InvalidSignedEndTime(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed maxTokenSupplyForStage\n * is greater than the maximum specified.\n */\n error InvalidSignedMaxTokenSupplyForStage(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed feeBps is greater than\n * the maximum specified, or less than the minimum.\n */\n error InvalidSignedFeeBps(uint256 got, uint256 minimumOrMaximum);\n\n /**\n * @dev Revert with an error if signed mint did not specify to restrict\n * fee recipients.\n */\n error SignedMintsMustRestrictFeeRecipients();\n\n /**\n * @dev Revert with an error if a signature for a signed mint has already\n * been used.\n */\n error SignatureAlreadyUsed();\n\n /**\n * @dev Revert with an error if the contract has no balance to withdraw.\n */\n error NoBalanceToWithdraw();\n\n /**\n * @dev Revert with an error if the caller is not an allowed Seaport.\n */\n error InvalidCallerOnlyAllowedSeaport(address caller);\n\n /**\n * @dev Revert with an error if the order does not have the ERC1155 magic\n * consideration item to signify a consecutive mint.\n */\n error MustSpecifyERC1155ConsiderationItemForSeaDropMint();\n\n /**\n * @dev Revert with an error if the extra data version is not supported.\n */\n error UnsupportedExtraDataVersion(uint8 version);\n\n /**\n * @dev Revert with an error if the extra data encoding is not supported.\n */\n error InvalidExtraDataEncoding(uint8 version);\n\n /**\n * @dev Revert with an error if the provided substandard is not supported.\n */\n error InvalidSubstandard(uint8 substandard);\n\n /**\n * @dev Revert with an error if the implementation contract is called without\n * delegatecall.\n */\n error OnlyDelegateCalled();\n\n /**\n * @dev Revert with an error if the provided allowed Seaport is the\n * zero address.\n */\n error AllowedSeaportCannotBeZeroAddress();\n\n /**\n * @dev Emit an event when allowed Seaport contracts are updated.\n */\n event AllowedSeaportUpdated(address[] allowedSeaport);\n\n /**\n * @dev An event with details of a SeaDrop mint, for analytical purposes.\n *\n * @param payer The address who payed for the tx.\n * @param dropStageIndex The drop stage index. Items minted through\n * public mint have dropStageIndex of 0\n */\n event SeaDropMint(address payer, uint256 dropStageIndex);\n\n /**\n * @dev An event with updated allow list data.\n *\n * @param previousMerkleRoot The previous allow list merkle root.\n * @param newMerkleRoot The new allow list merkle root.\n * @param publicKeyURI If the allow list is encrypted, the public key\n * URIs that can decrypt the list.\n * Empty if unencrypted.\n * @param allowListURI The URI for the allow list.\n */\n event AllowListUpdated(\n bytes32 indexed previousMerkleRoot,\n bytes32 indexed newMerkleRoot,\n string[] publicKeyURI,\n string allowListURI\n );\n\n /**\n * @dev An event with updated drop URI.\n */\n event DropURIUpdated(string newDropURI);\n\n /**\n * @dev An event with the updated creator payout address.\n */\n event CreatorPayoutsUpdated(CreatorPayout[] creatorPayouts);\n\n /**\n * @dev An event with the updated allowed fee recipient.\n */\n event AllowedFeeRecipientUpdated(\n address indexed feeRecipient,\n bool indexed allowed\n );\n\n /**\n * @dev An event with the updated signer.\n */\n event SignerUpdated(address indexed signer, bool indexed allowed);\n\n /**\n * @dev An event with the updated payer.\n */\n event PayerUpdated(address indexed payer, bool indexed allowed);\n}\n"
},
"lib/seaport/lib/seaport-types/src/lib/ConsiderationEnums.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nenum OrderType {\n // 0: no partial fills, anyone can execute\n FULL_OPEN,\n\n // 1: partial fills supported, anyone can execute\n PARTIAL_OPEN,\n\n // 2: no partial fills, only offerer or zone can execute\n FULL_RESTRICTED,\n\n // 3: partial fills supported, only offerer or zone can execute\n PARTIAL_RESTRICTED,\n\n // 4: contract order type\n CONTRACT\n}\n\nenum BasicOrderType {\n // 0: no partial fills, anyone can execute\n ETH_TO_ERC721_FULL_OPEN,\n\n // 1: partial fills supported, anyone can execute\n ETH_TO_ERC721_PARTIAL_OPEN,\n\n // 2: no partial fills, only offerer or zone can execute\n ETH_TO_ERC721_FULL_RESTRICTED,\n\n // 3: partial fills supported, only offerer or zone can execute\n ETH_TO_ERC721_PARTIAL_RESTRICTED,\n\n // 4: no partial fills, anyone can execute\n ETH_TO_ERC1155_FULL_OPEN,\n\n // 5: partial fills supported, anyone can execute\n ETH_TO_ERC1155_PARTIAL_OPEN,\n\n // 6: no partial fills, only offerer or zone can execute\n ETH_TO_ERC1155_FULL_RESTRICTED,\n\n // 7: partial fills supported, only offerer or zone can execute\n ETH_TO_ERC1155_PARTIAL_RESTRICTED,\n\n // 8: no partial fills, anyone can execute\n ERC20_TO_ERC721_FULL_OPEN,\n\n // 9: partial fills supported, anyone can execute\n ERC20_TO_ERC721_PARTIAL_OPEN,\n\n // 10: no partial fills, only offerer or zone can execute\n ERC20_TO_ERC721_FULL_RESTRICTED,\n\n // 11: partial fills supported, only offerer or zone can execute\n ERC20_TO_ERC721_PARTIAL_RESTRICTED,\n\n // 12: no partial fills, anyone can execute\n ERC20_TO_ERC1155_FULL_OPEN,\n\n // 13: partial fills supported, anyone can execute\n ERC20_TO_ERC1155_PARTIAL_OPEN,\n\n // 14: no partial fills, only offerer or zone can execute\n ERC20_TO_ERC1155_FULL_RESTRICTED,\n\n // 15: partial fills supported, only offerer or zone can execute\n ERC20_TO_ERC1155_PARTIAL_RESTRICTED,\n\n // 16: no partial fills, anyone can execute\n ERC721_TO_ERC20_FULL_OPEN,\n\n // 17: partial fills supported, anyone can execute\n ERC721_TO_ERC20_PARTIAL_OPEN,\n\n // 18: no partial fills, only offerer or zone can execute\n ERC721_TO_ERC20_FULL_RESTRICTED,\n\n // 19: partial fills supported, only offerer or zone can execute\n ERC721_TO_ERC20_PARTIAL_RESTRICTED,\n\n // 20: no partial fills, anyone can execute\n ERC1155_TO_ERC20_FULL_OPEN,\n\n // 21: partial fills supported, anyone can execute\n ERC1155_TO_ERC20_PARTIAL_OPEN,\n\n // 22: no partial fills, only offerer or zone can execute\n ERC1155_TO_ERC20_FULL_RESTRICTED,\n\n // 23: partial fills supported, only offerer or zone can execute\n ERC1155_TO_ERC20_PARTIAL_RESTRICTED\n}\n\nenum BasicOrderRouteType {\n // 0: provide Ether (or other native token) to receive offered ERC721 item.\n ETH_TO_ERC721,\n\n // 1: provide Ether (or other native token) to receive offered ERC1155 item.\n ETH_TO_ERC1155,\n\n // 2: provide ERC20 item to receive offered ERC721 item.\n ERC20_TO_ERC721,\n\n // 3: provide ERC20 item to receive offered ERC1155 item.\n ERC20_TO_ERC1155,\n\n // 4: provide ERC721 item to receive offered ERC20 item.\n ERC721_TO_ERC20,\n\n // 5: provide ERC1155 item to receive offered ERC20 item.\n ERC1155_TO_ERC20\n}\n\nenum ItemType {\n // 0: ETH on mainnet, MATIC on polygon, etc.\n NATIVE,\n\n // 1: ERC20 items (ERC777 and ERC20 analogues could also technically work)\n ERC20,\n\n // 2: ERC721 items\n ERC721,\n\n // 3: ERC1155 items\n ERC1155,\n\n // 4: ERC721 items where a number of tokenIds are supported\n ERC721_WITH_CRITERIA,\n\n // 5: ERC1155 items where a number of ids are supported\n ERC1155_WITH_CRITERIA\n}\n\nenum Side {\n // 0: Items that can be spent\n OFFER,\n\n // 1: Items that must be received\n CONSIDERATION\n}\n"
},
"lib/seaport/lib/seaport-types/src/helpers/PointerLibraries.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\ntype CalldataPointer is uint256;\n\ntype ReturndataPointer is uint256;\n\ntype MemoryPointer is uint256;\n\nusing CalldataPointerLib for CalldataPointer global;\nusing MemoryPointerLib for MemoryPointer global;\nusing ReturndataPointerLib for ReturndataPointer global;\n\nusing CalldataReaders for CalldataPointer global;\nusing ReturndataReaders for ReturndataPointer global;\nusing MemoryReaders for MemoryPointer global;\nusing MemoryWriters for MemoryPointer global;\n\nCalldataPointer constant CalldataStart = CalldataPointer.wrap(0x04);\nMemoryPointer constant FreeMemoryPPtr = MemoryPointer.wrap(0x40);\nuint256 constant IdentityPrecompileAddress = 0x4;\nuint256 constant OffsetOrLengthMask = 0xffffffff;\nuint256 constant _OneWord = 0x20;\nuint256 constant _FreeMemoryPointerSlot = 0x40;\n\n/// @dev Allocates `size` bytes in memory by increasing the free memory pointer\n/// and returns the memory pointer to the first byte of the allocated region.\n// (Free functions cannot have visibility.)\n// solhint-disable-next-line func-visibility\nfunction malloc(uint256 size) pure returns (MemoryPointer mPtr) {\n assembly {\n mPtr := mload(_FreeMemoryPointerSlot)\n mstore(_FreeMemoryPointerSlot, add(mPtr, size))\n }\n}\n\n// (Free functions cannot have visibility.)\n// solhint-disable-next-line func-visibility\nfunction getFreeMemoryPointer() pure returns (MemoryPointer mPtr) {\n mPtr = FreeMemoryPPtr.readMemoryPointer();\n}\n\n// (Free functions cannot have visibility.)\n// solhint-disable-next-line func-visibility\nfunction setFreeMemoryPointer(MemoryPointer mPtr) pure {\n FreeMemoryPPtr.write(mPtr);\n}\n\nlibrary CalldataPointerLib {\n function lt(\n CalldataPointer a,\n CalldataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := lt(a, b)\n }\n }\n\n function gt(\n CalldataPointer a,\n CalldataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := gt(a, b)\n }\n }\n\n function eq(\n CalldataPointer a,\n CalldataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := eq(a, b)\n }\n }\n\n function isNull(CalldataPointer a) internal pure returns (bool b) {\n assembly {\n b := iszero(a)\n }\n }\n\n /// @dev Resolves an offset stored at `cdPtr + headOffset` to a calldata.\n /// pointer `cdPtr` must point to some parent object with a dynamic\n /// type's head stored at `cdPtr + headOffset`.\n function pptr(\n CalldataPointer cdPtr,\n uint256 headOffset\n ) internal pure returns (CalldataPointer cdPtrChild) {\n cdPtrChild = cdPtr.offset(\n cdPtr.offset(headOffset).readUint256() & OffsetOrLengthMask\n );\n }\n\n /// @dev Resolves an offset stored at `cdPtr` to a calldata pointer.\n /// `cdPtr` must point to some parent object with a dynamic type as its\n /// first member, e.g. `struct { bytes data; }`\n function pptr(\n CalldataPointer cdPtr\n ) internal pure returns (CalldataPointer cdPtrChild) {\n cdPtrChild = cdPtr.offset(cdPtr.readUint256() & OffsetOrLengthMask);\n }\n\n /// @dev Returns the calldata pointer one word after `cdPtr`.\n function next(\n CalldataPointer cdPtr\n ) internal pure returns (CalldataPointer cdPtrNext) {\n assembly {\n cdPtrNext := add(cdPtr, _OneWord)\n }\n }\n\n /// @dev Returns the calldata pointer `_offset` bytes after `cdPtr`.\n function offset(\n CalldataPointer cdPtr,\n uint256 _offset\n ) internal pure returns (CalldataPointer cdPtrNext) {\n assembly {\n cdPtrNext := add(cdPtr, _offset)\n }\n }\n\n /// @dev Copies `size` bytes from calldata starting at `src` to memory at\n /// `dst`.\n function copy(\n CalldataPointer src,\n MemoryPointer dst,\n uint256 size\n ) internal pure {\n assembly {\n calldatacopy(dst, src, size)\n }\n }\n}\n\nlibrary ReturndataPointerLib {\n function lt(\n ReturndataPointer a,\n ReturndataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := lt(a, b)\n }\n }\n\n function gt(\n ReturndataPointer a,\n ReturndataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := gt(a, b)\n }\n }\n\n function eq(\n ReturndataPointer a,\n ReturndataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := eq(a, b)\n }\n }\n\n function isNull(ReturndataPointer a) internal pure returns (bool b) {\n assembly {\n b := iszero(a)\n }\n }\n\n /// @dev Resolves an offset stored at `rdPtr + headOffset` to a returndata\n /// pointer. `rdPtr` must point to some parent object with a dynamic\n /// type's head stored at `rdPtr + headOffset`.\n function pptr(\n ReturndataPointer rdPtr,\n uint256 headOffset\n ) internal pure returns (ReturndataPointer rdPtrChild) {\n rdPtrChild = rdPtr.offset(\n rdPtr.offset(headOffset).readUint256() & OffsetOrLengthMask\n );\n }\n\n /// @dev Resolves an offset stored at `rdPtr` to a returndata pointer.\n /// `rdPtr` must point to some parent object with a dynamic type as its\n /// first member, e.g. `struct { bytes data; }`\n function pptr(\n ReturndataPointer rdPtr\n ) internal pure returns (ReturndataPointer rdPtrChild) {\n rdPtrChild = rdPtr.offset(rdPtr.readUint256() & OffsetOrLengthMask);\n }\n\n /// @dev Returns the returndata pointer one word after `cdPtr`.\n function next(\n ReturndataPointer rdPtr\n ) internal pure returns (ReturndataPointer rdPtrNext) {\n assembly {\n rdPtrNext := add(rdPtr, _OneWord)\n }\n }\n\n /// @dev Returns the returndata pointer `_offset` bytes after `cdPtr`.\n function offset(\n ReturndataPointer rdPtr,\n uint256 _offset\n ) internal pure returns (ReturndataPointer rdPtrNext) {\n assembly {\n rdPtrNext := add(rdPtr, _offset)\n }\n }\n\n /// @dev Copies `size` bytes from returndata starting at `src` to memory at\n /// `dst`.\n function copy(\n ReturndataPointer src,\n MemoryPointer dst,\n uint256 size\n ) internal pure {\n assembly {\n returndatacopy(dst, src, size)\n }\n }\n}\n\nlibrary MemoryPointerLib {\n function copy(\n MemoryPointer src,\n MemoryPointer dst,\n uint256 size\n ) internal view {\n assembly {\n let success := staticcall(\n gas(),\n IdentityPrecompileAddress,\n src,\n size,\n dst,\n size\n )\n if or(iszero(returndatasize()), iszero(success)) {\n revert(0, 0)\n }\n }\n }\n\n function lt(\n MemoryPointer a,\n MemoryPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := lt(a, b)\n }\n }\n\n function gt(\n MemoryPointer a,\n MemoryPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := gt(a, b)\n }\n }\n\n function eq(\n MemoryPointer a,\n MemoryPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := eq(a, b)\n }\n }\n\n function isNull(MemoryPointer a) internal pure returns (bool b) {\n assembly {\n b := iszero(a)\n }\n }\n\n function hash(\n MemoryPointer ptr,\n uint256 length\n ) internal pure returns (bytes32 _hash) {\n assembly {\n _hash := keccak256(ptr, length)\n }\n }\n\n /// @dev Returns the memory pointer one word after `mPtr`.\n function next(\n MemoryPointer mPtr\n ) internal pure returns (MemoryPointer mPtrNext) {\n assembly {\n mPtrNext := add(mPtr, _OneWord)\n }\n }\n\n /// @dev Returns the memory pointer `_offset` bytes after `mPtr`.\n function offset(\n MemoryPointer mPtr,\n uint256 _offset\n ) internal pure returns (MemoryPointer mPtrNext) {\n assembly {\n mPtrNext := add(mPtr, _offset)\n }\n }\n\n /// @dev Resolves a pointer at `mPtr + headOffset` to a memory\n /// pointer. `mPtr` must point to some parent object with a dynamic\n /// type's pointer stored at `mPtr + headOffset`.\n function pptr(\n MemoryPointer mPtr,\n uint256 headOffset\n ) internal pure returns (MemoryPointer mPtrChild) {\n mPtrChild = mPtr.offset(headOffset).readMemoryPointer();\n }\n\n /// @dev Resolves a pointer stored at `mPtr` to a memory pointer.\n /// `mPtr` must point to some parent object with a dynamic type as its\n /// first member, e.g. `struct { bytes data; }`\n function pptr(\n MemoryPointer mPtr\n ) internal pure returns (MemoryPointer mPtrChild) {\n mPtrChild = mPtr.readMemoryPointer();\n }\n}\n\nlibrary CalldataReaders {\n /// @dev Reads the value at `cdPtr` and applies a mask to return only the\n /// last 4 bytes.\n function readMaskedUint256(\n CalldataPointer cdPtr\n ) internal pure returns (uint256 value) {\n value = cdPtr.readUint256() & OffsetOrLengthMask;\n }\n\n /// @dev Reads the bool at `cdPtr` in calldata.\n function readBool(\n CalldataPointer cdPtr\n ) internal pure returns (bool value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the address at `cdPtr` in calldata.\n function readAddress(\n CalldataPointer cdPtr\n ) internal pure returns (address value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes1 at `cdPtr` in calldata.\n function readBytes1(\n CalldataPointer cdPtr\n ) internal pure returns (bytes1 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes2 at `cdPtr` in calldata.\n function readBytes2(\n CalldataPointer cdPtr\n ) internal pure returns (bytes2 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes3 at `cdPtr` in calldata.\n function readBytes3(\n CalldataPointer cdPtr\n ) internal pure returns (bytes3 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes4 at `cdPtr` in calldata.\n function readBytes4(\n CalldataPointer cdPtr\n ) internal pure returns (bytes4 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes5 at `cdPtr` in calldata.\n function readBytes5(\n CalldataPointer cdPtr\n ) internal pure returns (bytes5 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes6 at `cdPtr` in calldata.\n function readBytes6(\n CalldataPointer cdPtr\n ) internal pure returns (bytes6 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes7 at `cdPtr` in calldata.\n function readBytes7(\n CalldataPointer cdPtr\n ) internal pure returns (bytes7 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes8 at `cdPtr` in calldata.\n function readBytes8(\n CalldataPointer cdPtr\n ) internal pure returns (bytes8 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes9 at `cdPtr` in calldata.\n function readBytes9(\n CalldataPointer cdPtr\n ) internal pure returns (bytes9 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes10 at `cdPtr` in calldata.\n function readBytes10(\n CalldataPointer cdPtr\n ) internal pure returns (bytes10 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes11 at `cdPtr` in calldata.\n function readBytes11(\n CalldataPointer cdPtr\n ) internal pure returns (bytes11 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes12 at `cdPtr` in calldata.\n function readBytes12(\n CalldataPointer cdPtr\n ) internal pure returns (bytes12 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes13 at `cdPtr` in calldata.\n function readBytes13(\n CalldataPointer cdPtr\n ) internal pure returns (bytes13 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes14 at `cdPtr` in calldata.\n function readBytes14(\n CalldataPointer cdPtr\n ) internal pure returns (bytes14 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes15 at `cdPtr` in calldata.\n function readBytes15(\n CalldataPointer cdPtr\n ) internal pure returns (bytes15 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes16 at `cdPtr` in calldata.\n function readBytes16(\n CalldataPointer cdPtr\n ) internal pure returns (bytes16 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes17 at `cdPtr` in calldata.\n function readBytes17(\n CalldataPointer cdPtr\n ) internal pure returns (bytes17 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes18 at `cdPtr` in calldata.\n function readBytes18(\n CalldataPointer cdPtr\n ) internal pure returns (bytes18 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes19 at `cdPtr` in calldata.\n function readBytes19(\n CalldataPointer cdPtr\n ) internal pure returns (bytes19 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes20 at `cdPtr` in calldata.\n function readBytes20(\n CalldataPointer cdPtr\n ) internal pure returns (bytes20 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes21 at `cdPtr` in calldata.\n function readBytes21(\n CalldataPointer cdPtr\n ) internal pure returns (bytes21 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes22 at `cdPtr` in calldata.\n function readBytes22(\n CalldataPointer cdPtr\n ) internal pure returns (bytes22 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes23 at `cdPtr` in calldata.\n function readBytes23(\n CalldataPointer cdPtr\n ) internal pure returns (bytes23 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes24 at `cdPtr` in calldata.\n function readBytes24(\n CalldataPointer cdPtr\n ) internal pure returns (bytes24 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes25 at `cdPtr` in calldata.\n function readBytes25(\n CalldataPointer cdPtr\n ) internal pure returns (bytes25 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes26 at `cdPtr` in calldata.\n function readBytes26(\n CalldataPointer cdPtr\n ) internal pure returns (bytes26 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes27 at `cdPtr` in calldata.\n function readBytes27(\n CalldataPointer cdPtr\n ) internal pure returns (bytes27 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes28 at `cdPtr` in calldata.\n function readBytes28(\n CalldataPointer cdPtr\n ) internal pure returns (bytes28 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes29 at `cdPtr` in calldata.\n function readBytes29(\n CalldataPointer cdPtr\n ) internal pure returns (bytes29 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes30 at `cdPtr` in calldata.\n function readBytes30(\n CalldataPointer cdPtr\n ) internal pure returns (bytes30 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes31 at `cdPtr` in calldata.\n function readBytes31(\n CalldataPointer cdPtr\n ) internal pure returns (bytes31 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes32 at `cdPtr` in calldata.\n function readBytes32(\n CalldataPointer cdPtr\n ) internal pure returns (bytes32 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint8 at `cdPtr` in calldata.\n function readUint8(\n CalldataPointer cdPtr\n ) internal pure returns (uint8 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint16 at `cdPtr` in calldata.\n function readUint16(\n CalldataPointer cdPtr\n ) internal pure returns (uint16 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint24 at `cdPtr` in calldata.\n function readUint24(\n CalldataPointer cdPtr\n ) internal pure returns (uint24 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint32 at `cdPtr` in calldata.\n function readUint32(\n CalldataPointer cdPtr\n ) internal pure returns (uint32 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint40 at `cdPtr` in calldata.\n function readUint40(\n CalldataPointer cdPtr\n ) internal pure returns (uint40 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint48 at `cdPtr` in calldata.\n function readUint48(\n CalldataPointer cdPtr\n ) internal pure returns (uint48 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint56 at `cdPtr` in calldata.\n function readUint56(\n CalldataPointer cdPtr\n ) internal pure returns (uint56 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint64 at `cdPtr` in calldata.\n function readUint64(\n CalldataPointer cdPtr\n ) internal pure returns (uint64 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint72 at `cdPtr` in calldata.\n function readUint72(\n CalldataPointer cdPtr\n ) internal pure returns (uint72 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint80 at `cdPtr` in calldata.\n function readUint80(\n CalldataPointer cdPtr\n ) internal pure returns (uint80 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint88 at `cdPtr` in calldata.\n function readUint88(\n CalldataPointer cdPtr\n ) internal pure returns (uint88 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint96 at `cdPtr` in calldata.\n function readUint96(\n CalldataPointer cdPtr\n ) internal pure returns (uint96 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint104 at `cdPtr` in calldata.\n function readUint104(\n CalldataPointer cdPtr\n ) internal pure returns (uint104 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint112 at `cdPtr` in calldata.\n function readUint112(\n CalldataPointer cdPtr\n ) internal pure returns (uint112 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint120 at `cdPtr` in calldata.\n function readUint120(\n CalldataPointer cdPtr\n ) internal pure returns (uint120 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint128 at `cdPtr` in calldata.\n function readUint128(\n CalldataPointer cdPtr\n ) internal pure returns (uint128 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint136 at `cdPtr` in calldata.\n function readUint136(\n CalldataPointer cdPtr\n ) internal pure returns (uint136 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint144 at `cdPtr` in calldata.\n function readUint144(\n CalldataPointer cdPtr\n ) internal pure returns (uint144 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint152 at `cdPtr` in calldata.\n function readUint152(\n CalldataPointer cdPtr\n ) internal pure returns (uint152 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint160 at `cdPtr` in calldata.\n function readUint160(\n CalldataPointer cdPtr\n ) internal pure returns (uint160 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint168 at `cdPtr` in calldata.\n function readUint168(\n CalldataPointer cdPtr\n ) internal pure returns (uint168 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint176 at `cdPtr` in calldata.\n function readUint176(\n CalldataPointer cdPtr\n ) internal pure returns (uint176 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint184 at `cdPtr` in calldata.\n function readUint184(\n CalldataPointer cdPtr\n ) internal pure returns (uint184 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint192 at `cdPtr` in calldata.\n function readUint192(\n CalldataPointer cdPtr\n ) internal pure returns (uint192 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint200 at `cdPtr` in calldata.\n function readUint200(\n CalldataPointer cdPtr\n ) internal pure returns (uint200 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint208 at `cdPtr` in calldata.\n function readUint208(\n CalldataPointer cdPtr\n ) internal pure returns (uint208 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint216 at `cdPtr` in calldata.\n function readUint216(\n CalldataPointer cdPtr\n ) internal pure returns (uint216 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint224 at `cdPtr` in calldata.\n function readUint224(\n CalldataPointer cdPtr\n ) internal pure returns (uint224 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint232 at `cdPtr` in calldata.\n function readUint232(\n CalldataPointer cdPtr\n ) internal pure returns (uint232 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint240 at `cdPtr` in calldata.\n function readUint240(\n CalldataPointer cdPtr\n ) internal pure returns (uint240 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint248 at `cdPtr` in calldata.\n function readUint248(\n CalldataPointer cdPtr\n ) internal pure returns (uint248 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint256 at `cdPtr` in calldata.\n function readUint256(\n CalldataPointer cdPtr\n ) internal pure returns (uint256 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int8 at `cdPtr` in calldata.\n function readInt8(\n CalldataPointer cdPtr\n ) internal pure returns (int8 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int16 at `cdPtr` in calldata.\n function readInt16(\n CalldataPointer cdPtr\n ) internal pure returns (int16 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int24 at `cdPtr` in calldata.\n function readInt24(\n CalldataPointer cdPtr\n ) internal pure returns (int24 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int32 at `cdPtr` in calldata.\n function readInt32(\n CalldataPointer cdPtr\n ) internal pure returns (int32 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int40 at `cdPtr` in calldata.\n function readInt40(\n CalldataPointer cdPtr\n ) internal pure returns (int40 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int48 at `cdPtr` in calldata.\n function readInt48(\n CalldataPointer cdPtr\n ) internal pure returns (int48 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int56 at `cdPtr` in calldata.\n function readInt56(\n CalldataPointer cdPtr\n ) internal pure returns (int56 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int64 at `cdPtr` in calldata.\n function readInt64(\n CalldataPointer cdPtr\n ) internal pure returns (int64 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int72 at `cdPtr` in calldata.\n function readInt72(\n CalldataPointer cdPtr\n ) internal pure returns (int72 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int80 at `cdPtr` in calldata.\n function readInt80(\n CalldataPointer cdPtr\n ) internal pure returns (int80 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int88 at `cdPtr` in calldata.\n function readInt88(\n CalldataPointer cdPtr\n ) internal pure returns (int88 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int96 at `cdPtr` in calldata.\n function readInt96(\n CalldataPointer cdPtr\n ) internal pure returns (int96 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int104 at `cdPtr` in calldata.\n function readInt104(\n CalldataPointer cdPtr\n ) internal pure returns (int104 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int112 at `cdPtr` in calldata.\n function readInt112(\n CalldataPointer cdPtr\n ) internal pure returns (int112 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int120 at `cdPtr` in calldata.\n function readInt120(\n CalldataPointer cdPtr\n ) internal pure returns (int120 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int128 at `cdPtr` in calldata.\n function readInt128(\n CalldataPointer cdPtr\n ) internal pure returns (int128 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int136 at `cdPtr` in calldata.\n function readInt136(\n CalldataPointer cdPtr\n ) internal pure returns (int136 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int144 at `cdPtr` in calldata.\n function readInt144(\n CalldataPointer cdPtr\n ) internal pure returns (int144 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int152 at `cdPtr` in calldata.\n function readInt152(\n CalldataPointer cdPtr\n ) internal pure returns (int152 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int160 at `cdPtr` in calldata.\n function readInt160(\n CalldataPointer cdPtr\n ) internal pure returns (int160 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int168 at `cdPtr` in calldata.\n function readInt168(\n CalldataPointer cdPtr\n ) internal pure returns (int168 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int176 at `cdPtr` in calldata.\n function readInt176(\n CalldataPointer cdPtr\n ) internal pure returns (int176 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int184 at `cdPtr` in calldata.\n function readInt184(\n CalldataPointer cdPtr\n ) internal pure returns (int184 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int192 at `cdPtr` in calldata.\n function readInt192(\n CalldataPointer cdPtr\n ) internal pure returns (int192 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int200 at `cdPtr` in calldata.\n function readInt200(\n CalldataPointer cdPtr\n ) internal pure returns (int200 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int208 at `cdPtr` in calldata.\n function readInt208(\n CalldataPointer cdPtr\n ) internal pure returns (int208 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int216 at `cdPtr` in calldata.\n function readInt216(\n CalldataPointer cdPtr\n ) internal pure returns (int216 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int224 at `cdPtr` in calldata.\n function readInt224(\n CalldataPointer cdPtr\n ) internal pure returns (int224 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int232 at `cdPtr` in calldata.\n function readInt232(\n CalldataPointer cdPtr\n ) internal pure returns (int232 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int240 at `cdPtr` in calldata.\n function readInt240(\n CalldataPointer cdPtr\n ) internal pure returns (int240 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int248 at `cdPtr` in calldata.\n function readInt248(\n CalldataPointer cdPtr\n ) internal pure returns (int248 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int256 at `cdPtr` in calldata.\n function readInt256(\n CalldataPointer cdPtr\n ) internal pure returns (int256 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n}\n\nlibrary ReturndataReaders {\n /// @dev Reads value at `rdPtr` & applies a mask to return only last 4 bytes\n function readMaskedUint256(\n ReturndataPointer rdPtr\n ) internal pure returns (uint256 value) {\n value = rdPtr.readUint256() & OffsetOrLengthMask;\n }\n\n /// @dev Reads the bool at `rdPtr` in returndata.\n function readBool(\n ReturndataPointer rdPtr\n ) internal pure returns (bool value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the address at `rdPtr` in returndata.\n function readAddress(\n ReturndataPointer rdPtr\n ) internal pure returns (address value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes1 at `rdPtr` in returndata.\n function readBytes1(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes1 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes2 at `rdPtr` in returndata.\n function readBytes2(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes2 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes3 at `rdPtr` in returndata.\n function readBytes3(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes3 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes4 at `rdPtr` in returndata.\n function readBytes4(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes4 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes5 at `rdPtr` in returndata.\n function readBytes5(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes5 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes6 at `rdPtr` in returndata.\n function readBytes6(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes6 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes7 at `rdPtr` in returndata.\n function readBytes7(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes7 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes8 at `rdPtr` in returndata.\n function readBytes8(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes8 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes9 at `rdPtr` in returndata.\n function readBytes9(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes9 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes10 at `rdPtr` in returndata.\n function readBytes10(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes10 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes11 at `rdPtr` in returndata.\n function readBytes11(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes11 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes12 at `rdPtr` in returndata.\n function readBytes12(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes12 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes13 at `rdPtr` in returndata.\n function readBytes13(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes13 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes14 at `rdPtr` in returndata.\n function readBytes14(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes14 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes15 at `rdPtr` in returndata.\n function readBytes15(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes15 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes16 at `rdPtr` in returndata.\n function readBytes16(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes16 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes17 at `rdPtr` in returndata.\n function readBytes17(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes17 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes18 at `rdPtr` in returndata.\n function readBytes18(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes18 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes19 at `rdPtr` in returndata.\n function readBytes19(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes19 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes20 at `rdPtr` in returndata.\n function readBytes20(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes20 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes21 at `rdPtr` in returndata.\n function readBytes21(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes21 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes22 at `rdPtr` in returndata.\n function readBytes22(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes22 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes23 at `rdPtr` in returndata.\n function readBytes23(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes23 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes24 at `rdPtr` in returndata.\n function readBytes24(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes24 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes25 at `rdPtr` in returndata.\n function readBytes25(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes25 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes26 at `rdPtr` in returndata.\n function readBytes26(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes26 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes27 at `rdPtr` in returndata.\n function readBytes27(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes27 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes28 at `rdPtr` in returndata.\n function readBytes28(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes28 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes29 at `rdPtr` in returndata.\n function readBytes29(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes29 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes30 at `rdPtr` in returndata.\n function readBytes30(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes30 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes31 at `rdPtr` in returndata.\n function readBytes31(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes31 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes32 at `rdPtr` in returndata.\n function readBytes32(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes32 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint8 at `rdPtr` in returndata.\n function readUint8(\n ReturndataPointer rdPtr\n ) internal pure returns (uint8 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint16 at `rdPtr` in returndata.\n function readUint16(\n ReturndataPointer rdPtr\n ) internal pure returns (uint16 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint24 at `rdPtr` in returndata.\n function readUint24(\n ReturndataPointer rdPtr\n ) internal pure returns (uint24 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint32 at `rdPtr` in returndata.\n function readUint32(\n ReturndataPointer rdPtr\n ) internal pure returns (uint32 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint40 at `rdPtr` in returndata.\n function readUint40(\n ReturndataPointer rdPtr\n ) internal pure returns (uint40 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint48 at `rdPtr` in returndata.\n function readUint48(\n ReturndataPointer rdPtr\n ) internal pure returns (uint48 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint56 at `rdPtr` in returndata.\n function readUint56(\n ReturndataPointer rdPtr\n ) internal pure returns (uint56 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint64 at `rdPtr` in returndata.\n function readUint64(\n ReturndataPointer rdPtr\n ) internal pure returns (uint64 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint72 at `rdPtr` in returndata.\n function readUint72(\n ReturndataPointer rdPtr\n ) internal pure returns (uint72 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint80 at `rdPtr` in returndata.\n function readUint80(\n ReturndataPointer rdPtr\n ) internal pure returns (uint80 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint88 at `rdPtr` in returndata.\n function readUint88(\n ReturndataPointer rdPtr\n ) internal pure returns (uint88 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint96 at `rdPtr` in returndata.\n function readUint96(\n ReturndataPointer rdPtr\n ) internal pure returns (uint96 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint104 at `rdPtr` in returndata.\n function readUint104(\n ReturndataPointer rdPtr\n ) internal pure returns (uint104 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint112 at `rdPtr` in returndata.\n function readUint112(\n ReturndataPointer rdPtr\n ) internal pure returns (uint112 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint120 at `rdPtr` in returndata.\n function readUint120(\n ReturndataPointer rdPtr\n ) internal pure returns (uint120 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint128 at `rdPtr` in returndata.\n function readUint128(\n ReturndataPointer rdPtr\n ) internal pure returns (uint128 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint136 at `rdPtr` in returndata.\n function readUint136(\n ReturndataPointer rdPtr\n ) internal pure returns (uint136 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint144 at `rdPtr` in returndata.\n function readUint144(\n ReturndataPointer rdPtr\n ) internal pure returns (uint144 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint152 at `rdPtr` in returndata.\n function readUint152(\n ReturndataPointer rdPtr\n ) internal pure returns (uint152 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint160 at `rdPtr` in returndata.\n function readUint160(\n ReturndataPointer rdPtr\n ) internal pure returns (uint160 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint168 at `rdPtr` in returndata.\n function readUint168(\n ReturndataPointer rdPtr\n ) internal pure returns (uint168 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint176 at `rdPtr` in returndata.\n function readUint176(\n ReturndataPointer rdPtr\n ) internal pure returns (uint176 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint184 at `rdPtr` in returndata.\n function readUint184(\n ReturndataPointer rdPtr\n ) internal pure returns (uint184 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint192 at `rdPtr` in returndata.\n function readUint192(\n ReturndataPointer rdPtr\n ) internal pure returns (uint192 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint200 at `rdPtr` in returndata.\n function readUint200(\n ReturndataPointer rdPtr\n ) internal pure returns (uint200 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint208 at `rdPtr` in returndata.\n function readUint208(\n ReturndataPointer rdPtr\n ) internal pure returns (uint208 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint216 at `rdPtr` in returndata.\n function readUint216(\n ReturndataPointer rdPtr\n ) internal pure returns (uint216 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint224 at `rdPtr` in returndata.\n function readUint224(\n ReturndataPointer rdPtr\n ) internal pure returns (uint224 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint232 at `rdPtr` in returndata.\n function readUint232(\n ReturndataPointer rdPtr\n ) internal pure returns (uint232 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint240 at `rdPtr` in returndata.\n function readUint240(\n ReturndataPointer rdPtr\n ) internal pure returns (uint240 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint248 at `rdPtr` in returndata.\n function readUint248(\n ReturndataPointer rdPtr\n ) internal pure returns (uint248 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint256 at `rdPtr` in returndata.\n function readUint256(\n ReturndataPointer rdPtr\n ) internal pure returns (uint256 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int8 at `rdPtr` in returndata.\n function readInt8(\n ReturndataPointer rdPtr\n ) internal pure returns (int8 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int16 at `rdPtr` in returndata.\n function readInt16(\n ReturndataPointer rdPtr\n ) internal pure returns (int16 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int24 at `rdPtr` in returndata.\n function readInt24(\n ReturndataPointer rdPtr\n ) internal pure returns (int24 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int32 at `rdPtr` in returndata.\n function readInt32(\n ReturndataPointer rdPtr\n ) internal pure returns (int32 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int40 at `rdPtr` in returndata.\n function readInt40(\n ReturndataPointer rdPtr\n ) internal pure returns (int40 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int48 at `rdPtr` in returndata.\n function readInt48(\n ReturndataPointer rdPtr\n ) internal pure returns (int48 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int56 at `rdPtr` in returndata.\n function readInt56(\n ReturndataPointer rdPtr\n ) internal pure returns (int56 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int64 at `rdPtr` in returndata.\n function readInt64(\n ReturndataPointer rdPtr\n ) internal pure returns (int64 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int72 at `rdPtr` in returndata.\n function readInt72(\n ReturndataPointer rdPtr\n ) internal pure returns (int72 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int80 at `rdPtr` in returndata.\n function readInt80(\n ReturndataPointer rdPtr\n ) internal pure returns (int80 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int88 at `rdPtr` in returndata.\n function readInt88(\n ReturndataPointer rdPtr\n ) internal pure returns (int88 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int96 at `rdPtr` in returndata.\n function readInt96(\n ReturndataPointer rdPtr\n ) internal pure returns (int96 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int104 at `rdPtr` in returndata.\n function readInt104(\n ReturndataPointer rdPtr\n ) internal pure returns (int104 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int112 at `rdPtr` in returndata.\n function readInt112(\n ReturndataPointer rdPtr\n ) internal pure returns (int112 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int120 at `rdPtr` in returndata.\n function readInt120(\n ReturndataPointer rdPtr\n ) internal pure returns (int120 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int128 at `rdPtr` in returndata.\n function readInt128(\n ReturndataPointer rdPtr\n ) internal pure returns (int128 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int136 at `rdPtr` in returndata.\n function readInt136(\n ReturndataPointer rdPtr\n ) internal pure returns (int136 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int144 at `rdPtr` in returndata.\n function readInt144(\n ReturndataPointer rdPtr\n ) internal pure returns (int144 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int152 at `rdPtr` in returndata.\n function readInt152(\n ReturndataPointer rdPtr\n ) internal pure returns (int152 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int160 at `rdPtr` in returndata.\n function readInt160(\n ReturndataPointer rdPtr\n ) internal pure returns (int160 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int168 at `rdPtr` in returndata.\n function readInt168(\n ReturndataPointer rdPtr\n ) internal pure returns (int168 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int176 at `rdPtr` in returndata.\n function readInt176(\n ReturndataPointer rdPtr\n ) internal pure returns (int176 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int184 at `rdPtr` in returndata.\n function readInt184(\n ReturndataPointer rdPtr\n ) internal pure returns (int184 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int192 at `rdPtr` in returndata.\n function readInt192(\n ReturndataPointer rdPtr\n ) internal pure returns (int192 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int200 at `rdPtr` in returndata.\n function readInt200(\n ReturndataPointer rdPtr\n ) internal pure returns (int200 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int208 at `rdPtr` in returndata.\n function readInt208(\n ReturndataPointer rdPtr\n ) internal pure returns (int208 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int216 at `rdPtr` in returndata.\n function readInt216(\n ReturndataPointer rdPtr\n ) internal pure returns (int216 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int224 at `rdPtr` in returndata.\n function readInt224(\n ReturndataPointer rdPtr\n ) internal pure returns (int224 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int232 at `rdPtr` in returndata.\n function readInt232(\n ReturndataPointer rdPtr\n ) internal pure returns (int232 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int240 at `rdPtr` in returndata.\n function readInt240(\n ReturndataPointer rdPtr\n ) internal pure returns (int240 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int248 at `rdPtr` in returndata.\n function readInt248(\n ReturndataPointer rdPtr\n ) internal pure returns (int248 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int256 at `rdPtr` in returndata.\n function readInt256(\n ReturndataPointer rdPtr\n ) internal pure returns (int256 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n}\n\nlibrary MemoryReaders {\n /// @dev Reads the memory pointer at `mPtr` in memory.\n function readMemoryPointer(\n MemoryPointer mPtr\n ) internal pure returns (MemoryPointer value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads value at `mPtr` & applies a mask to return only last 4 bytes\n function readMaskedUint256(\n MemoryPointer mPtr\n ) internal pure returns (uint256 value) {\n value = mPtr.readUint256() & OffsetOrLengthMask;\n }\n\n /// @dev Reads the bool at `mPtr` in memory.\n function readBool(MemoryPointer mPtr) internal pure returns (bool value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the address at `mPtr` in memory.\n function readAddress(\n MemoryPointer mPtr\n ) internal pure returns (address value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes1 at `mPtr` in memory.\n function readBytes1(\n MemoryPointer mPtr\n ) internal pure returns (bytes1 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes2 at `mPtr` in memory.\n function readBytes2(\n MemoryPointer mPtr\n ) internal pure returns (bytes2 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes3 at `mPtr` in memory.\n function readBytes3(\n MemoryPointer mPtr\n ) internal pure returns (bytes3 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes4 at `mPtr` in memory.\n function readBytes4(\n MemoryPointer mPtr\n ) internal pure returns (bytes4 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes5 at `mPtr` in memory.\n function readBytes5(\n MemoryPointer mPtr\n ) internal pure returns (bytes5 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes6 at `mPtr` in memory.\n function readBytes6(\n MemoryPointer mPtr\n ) internal pure returns (bytes6 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes7 at `mPtr` in memory.\n function readBytes7(\n MemoryPointer mPtr\n ) internal pure returns (bytes7 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes8 at `mPtr` in memory.\n function readBytes8(\n MemoryPointer mPtr\n ) internal pure returns (bytes8 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes9 at `mPtr` in memory.\n function readBytes9(\n MemoryPointer mPtr\n ) internal pure returns (bytes9 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes10 at `mPtr` in memory.\n function readBytes10(\n MemoryPointer mPtr\n ) internal pure returns (bytes10 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes11 at `mPtr` in memory.\n function readBytes11(\n MemoryPointer mPtr\n ) internal pure returns (bytes11 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes12 at `mPtr` in memory.\n function readBytes12(\n MemoryPointer mPtr\n ) internal pure returns (bytes12 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes13 at `mPtr` in memory.\n function readBytes13(\n MemoryPointer mPtr\n ) internal pure returns (bytes13 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes14 at `mPtr` in memory.\n function readBytes14(\n MemoryPointer mPtr\n ) internal pure returns (bytes14 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes15 at `mPtr` in memory.\n function readBytes15(\n MemoryPointer mPtr\n ) internal pure returns (bytes15 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes16 at `mPtr` in memory.\n function readBytes16(\n MemoryPointer mPtr\n ) internal pure returns (bytes16 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes17 at `mPtr` in memory.\n function readBytes17(\n MemoryPointer mPtr\n ) internal pure returns (bytes17 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes18 at `mPtr` in memory.\n function readBytes18(\n MemoryPointer mPtr\n ) internal pure returns (bytes18 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes19 at `mPtr` in memory.\n function readBytes19(\n MemoryPointer mPtr\n ) internal pure returns (bytes19 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes20 at `mPtr` in memory.\n function readBytes20(\n MemoryPointer mPtr\n ) internal pure returns (bytes20 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes21 at `mPtr` in memory.\n function readBytes21(\n MemoryPointer mPtr\n ) internal pure returns (bytes21 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes22 at `mPtr` in memory.\n function readBytes22(\n MemoryPointer mPtr\n ) internal pure returns (bytes22 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes23 at `mPtr` in memory.\n function readBytes23(\n MemoryPointer mPtr\n ) internal pure returns (bytes23 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes24 at `mPtr` in memory.\n function readBytes24(\n MemoryPointer mPtr\n ) internal pure returns (bytes24 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes25 at `mPtr` in memory.\n function readBytes25(\n MemoryPointer mPtr\n ) internal pure returns (bytes25 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes26 at `mPtr` in memory.\n function readBytes26(\n MemoryPointer mPtr\n ) internal pure returns (bytes26 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes27 at `mPtr` in memory.\n function readBytes27(\n MemoryPointer mPtr\n ) internal pure returns (bytes27 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes28 at `mPtr` in memory.\n function readBytes28(\n MemoryPointer mPtr\n ) internal pure returns (bytes28 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes29 at `mPtr` in memory.\n function readBytes29(\n MemoryPointer mPtr\n ) internal pure returns (bytes29 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes30 at `mPtr` in memory.\n function readBytes30(\n MemoryPointer mPtr\n ) internal pure returns (bytes30 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes31 at `mPtr` in memory.\n function readBytes31(\n MemoryPointer mPtr\n ) internal pure returns (bytes31 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes32 at `mPtr` in memory.\n function readBytes32(\n MemoryPointer mPtr\n ) internal pure returns (bytes32 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint8 at `mPtr` in memory.\n function readUint8(MemoryPointer mPtr) internal pure returns (uint8 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint16 at `mPtr` in memory.\n function readUint16(\n MemoryPointer mPtr\n ) internal pure returns (uint16 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint24 at `mPtr` in memory.\n function readUint24(\n MemoryPointer mPtr\n ) internal pure returns (uint24 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint32 at `mPtr` in memory.\n function readUint32(\n MemoryPointer mPtr\n ) internal pure returns (uint32 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint40 at `mPtr` in memory.\n function readUint40(\n MemoryPointer mPtr\n ) internal pure returns (uint40 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint48 at `mPtr` in memory.\n function readUint48(\n MemoryPointer mPtr\n ) internal pure returns (uint48 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint56 at `mPtr` in memory.\n function readUint56(\n MemoryPointer mPtr\n ) internal pure returns (uint56 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint64 at `mPtr` in memory.\n function readUint64(\n MemoryPointer mPtr\n ) internal pure returns (uint64 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint72 at `mPtr` in memory.\n function readUint72(\n MemoryPointer mPtr\n ) internal pure returns (uint72 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint80 at `mPtr` in memory.\n function readUint80(\n MemoryPointer mPtr\n ) internal pure returns (uint80 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint88 at `mPtr` in memory.\n function readUint88(\n MemoryPointer mPtr\n ) internal pure returns (uint88 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint96 at `mPtr` in memory.\n function readUint96(\n MemoryPointer mPtr\n ) internal pure returns (uint96 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint104 at `mPtr` in memory.\n function readUint104(\n MemoryPointer mPtr\n ) internal pure returns (uint104 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint112 at `mPtr` in memory.\n function readUint112(\n MemoryPointer mPtr\n ) internal pure returns (uint112 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint120 at `mPtr` in memory.\n function readUint120(\n MemoryPointer mPtr\n ) internal pure returns (uint120 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint128 at `mPtr` in memory.\n function readUint128(\n MemoryPointer mPtr\n ) internal pure returns (uint128 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint136 at `mPtr` in memory.\n function readUint136(\n MemoryPointer mPtr\n ) internal pure returns (uint136 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint144 at `mPtr` in memory.\n function readUint144(\n MemoryPointer mPtr\n ) internal pure returns (uint144 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint152 at `mPtr` in memory.\n function readUint152(\n MemoryPointer mPtr\n ) internal pure returns (uint152 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint160 at `mPtr` in memory.\n function readUint160(\n MemoryPointer mPtr\n ) internal pure returns (uint160 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint168 at `mPtr` in memory.\n function readUint168(\n MemoryPointer mPtr\n ) internal pure returns (uint168 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint176 at `mPtr` in memory.\n function readUint176(\n MemoryPointer mPtr\n ) internal pure returns (uint176 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint184 at `mPtr` in memory.\n function readUint184(\n MemoryPointer mPtr\n ) internal pure returns (uint184 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint192 at `mPtr` in memory.\n function readUint192(\n MemoryPointer mPtr\n ) internal pure returns (uint192 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint200 at `mPtr` in memory.\n function readUint200(\n MemoryPointer mPtr\n ) internal pure returns (uint200 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint208 at `mPtr` in memory.\n function readUint208(\n MemoryPointer mPtr\n ) internal pure returns (uint208 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint216 at `mPtr` in memory.\n function readUint216(\n MemoryPointer mPtr\n ) internal pure returns (uint216 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint224 at `mPtr` in memory.\n function readUint224(\n MemoryPointer mPtr\n ) internal pure returns (uint224 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint232 at `mPtr` in memory.\n function readUint232(\n MemoryPointer mPtr\n ) internal pure returns (uint232 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint240 at `mPtr` in memory.\n function readUint240(\n MemoryPointer mPtr\n ) internal pure returns (uint240 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint248 at `mPtr` in memory.\n function readUint248(\n MemoryPointer mPtr\n ) internal pure returns (uint248 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint256 at `mPtr` in memory.\n function readUint256(\n MemoryPointer mPtr\n ) internal pure returns (uint256 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int8 at `mPtr` in memory.\n function readInt8(MemoryPointer mPtr) internal pure returns (int8 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int16 at `mPtr` in memory.\n function readInt16(MemoryPointer mPtr) internal pure returns (int16 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int24 at `mPtr` in memory.\n function readInt24(MemoryPointer mPtr) internal pure returns (int24 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int32 at `mPtr` in memory.\n function readInt32(MemoryPointer mPtr) internal pure returns (int32 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int40 at `mPtr` in memory.\n function readInt40(MemoryPointer mPtr) internal pure returns (int40 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int48 at `mPtr` in memory.\n function readInt48(MemoryPointer mPtr) internal pure returns (int48 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int56 at `mPtr` in memory.\n function readInt56(MemoryPointer mPtr) internal pure returns (int56 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int64 at `mPtr` in memory.\n function readInt64(MemoryPointer mPtr) internal pure returns (int64 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int72 at `mPtr` in memory.\n function readInt72(MemoryPointer mPtr) internal pure returns (int72 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int80 at `mPtr` in memory.\n function readInt80(MemoryPointer mPtr) internal pure returns (int80 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int88 at `mPtr` in memory.\n function readInt88(MemoryPointer mPtr) internal pure returns (int88 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int96 at `mPtr` in memory.\n function readInt96(MemoryPointer mPtr) internal pure returns (int96 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int104 at `mPtr` in memory.\n function readInt104(\n MemoryPointer mPtr\n ) internal pure returns (int104 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int112 at `mPtr` in memory.\n function readInt112(\n MemoryPointer mPtr\n ) internal pure returns (int112 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int120 at `mPtr` in memory.\n function readInt120(\n MemoryPointer mPtr\n ) internal pure returns (int120 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int128 at `mPtr` in memory.\n function readInt128(\n MemoryPointer mPtr\n ) internal pure returns (int128 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int136 at `mPtr` in memory.\n function readInt136(\n MemoryPointer mPtr\n ) internal pure returns (int136 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int144 at `mPtr` in memory.\n function readInt144(\n MemoryPointer mPtr\n ) internal pure returns (int144 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int152 at `mPtr` in memory.\n function readInt152(\n MemoryPointer mPtr\n ) internal pure returns (int152 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int160 at `mPtr` in memory.\n function readInt160(\n MemoryPointer mPtr\n ) internal pure returns (int160 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int168 at `mPtr` in memory.\n function readInt168(\n MemoryPointer mPtr\n ) internal pure returns (int168 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int176 at `mPtr` in memory.\n function readInt176(\n MemoryPointer mPtr\n ) internal pure returns (int176 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int184 at `mPtr` in memory.\n function readInt184(\n MemoryPointer mPtr\n ) internal pure returns (int184 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int192 at `mPtr` in memory.\n function readInt192(\n MemoryPointer mPtr\n ) internal pure returns (int192 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int200 at `mPtr` in memory.\n function readInt200(\n MemoryPointer mPtr\n ) internal pure returns (int200 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int208 at `mPtr` in memory.\n function readInt208(\n MemoryPointer mPtr\n ) internal pure returns (int208 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int216 at `mPtr` in memory.\n function readInt216(\n MemoryPointer mPtr\n ) internal pure returns (int216 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int224 at `mPtr` in memory.\n function readInt224(\n MemoryPointer mPtr\n ) internal pure returns (int224 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int232 at `mPtr` in memory.\n function readInt232(\n MemoryPointer mPtr\n ) internal pure returns (int232 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int240 at `mPtr` in memory.\n function readInt240(\n MemoryPointer mPtr\n ) internal pure returns (int240 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int248 at `mPtr` in memory.\n function readInt248(\n MemoryPointer mPtr\n ) internal pure returns (int248 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int256 at `mPtr` in memory.\n function readInt256(\n MemoryPointer mPtr\n ) internal pure returns (int256 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n}\n\nlibrary MemoryWriters {\n /// @dev Writes `valuePtr` to memory at `mPtr`.\n function write(MemoryPointer mPtr, MemoryPointer valuePtr) internal pure {\n assembly {\n mstore(mPtr, valuePtr)\n }\n }\n\n /// @dev Writes a boolean `value` to `mPtr` in memory.\n function write(MemoryPointer mPtr, bool value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes an address `value` to `mPtr` in memory.\n function write(MemoryPointer mPtr, address value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes a bytes32 `value` to `mPtr` in memory.\n /// Separate name to disambiguate literal write parameters.\n function writeBytes32(MemoryPointer mPtr, bytes32 value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes a uint256 `value` to `mPtr` in memory.\n function write(MemoryPointer mPtr, uint256 value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes an int256 `value` to `mPtr` in memory.\n /// Separate name to disambiguate literal write parameters.\n function writeInt(MemoryPointer mPtr, int256 value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n}\n"
},
"lib/seaport/lib/seaport-types/src/interfaces/IERC165.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.7;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
},
"lib/openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.19;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(target.code.length > 0, \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n"
},
"src/lib/ERC721SeaDropStructs.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { AllowListData, CreatorPayout } from \"./SeaDropStructs.sol\";\n\n/**\n * @notice A struct defining public drop data.\n * Designed to fit efficiently in two storage slots.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param paymentToken The payment token address. Null for\n * native token.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed. (The limit for this field is\n * 2^16 - 1)\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct PublicDrop {\n uint80 startPrice; // 80/512 bits\n uint80 endPrice; // 160/512 bits\n uint40 startTime; // 200/512 bits\n uint40 endTime; // 240/512 bits\n address paymentToken; // 400/512 bits\n uint16 maxTotalMintableByWallet; // 416/512 bits\n uint16 feeBps; // 432/512 bits\n bool restrictFeeRecipients; // 440/512 bits\n}\n\n/**\n * @notice A struct defining mint params for an allow list.\n * An allow list leaf will be composed of `msg.sender` and\n * the following params.\n *\n * Note: Since feeBps is encoded in the leaf, backend should ensure\n * that feeBps is acceptable before generating a proof.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param paymentToken The payment token for the mint. Null for\n * native token.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed.\n * @param maxTokenSupplyForStage The limit of token supply this stage can\n * mint within.\n * @param dropStageIndex The drop stage index to emit with the event\n * for analytical purposes. This should be\n * non-zero since the public mint emits with\n * index zero.\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct MintParams {\n uint256 startPrice;\n uint256 endPrice;\n uint256 startTime;\n uint256 endTime;\n address paymentToken;\n uint256 maxTotalMintableByWallet;\n uint256 maxTokenSupplyForStage;\n uint256 dropStageIndex; // non-zero\n uint256 feeBps;\n bool restrictFeeRecipients;\n}\n\n/**\n * @dev Struct containing internal SeaDrop implementation logic\n * mint details to avoid stack too deep.\n *\n * @param feeRecipient The fee recipient.\n * @param payer The payer of the mint.\n * @param minter The mint recipient.\n * @param quantity The number of tokens to mint.\n * @param withEffects Whether to apply state changes of the mint.\n */\nstruct MintDetails {\n address feeRecipient;\n address payer;\n address minter;\n uint256 quantity;\n bool withEffects;\n}\n\n/**\n * @notice A struct to configure multiple contract options in one transaction.\n */\nstruct MultiConfigureStruct {\n uint256 maxSupply;\n string baseURI;\n string contractURI;\n PublicDrop publicDrop;\n string dropURI;\n AllowListData allowListData;\n CreatorPayout[] creatorPayouts;\n bytes32 provenanceHash;\n address[] allowedFeeRecipients;\n address[] disallowedFeeRecipients;\n address[] allowedPayers;\n address[] disallowedPayers;\n // Server-signed\n address[] allowedSigners;\n address[] disallowedSigners;\n // ERC-2981\n address royaltyReceiver;\n uint96 royaltyBps;\n // Mint\n address mintRecipient;\n uint256 mintQuantity;\n}\n"
}
},
"settings": {
"remappings": [
"forge-std/=lib/forge-std/src/",
"ds-test/=lib/forge-std/lib/ds-test/src/",
"ERC721A/=lib/ERC721A/contracts/",
"ERC721A-Upgradeable/=lib/ERC721A-Upgradeable/contracts/",
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"@openzeppelin-upgradeable/contracts/=lib/openzeppelin-contracts-upgradeable/contracts/",
"@rari-capital/solmate/=lib/seaport/lib/solmate/",
"murky/=lib/murky/src/",
"create2-scripts/=lib/create2-helpers/script/",
"seadrop/=src/",
"seaport-sol/=lib/seaport/lib/seaport-sol/",
"seaport-types/=lib/seaport/lib/seaport-types/",
"seaport-core/=lib/seaport/lib/seaport-core/",
"seaport-test-utils/=lib/seaport/test/foundry/utils/",
"solady/=lib/solady/"
],
"optimizer": {
"enabled": true,
"runs": 100000
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "none",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "paris",
"viaIR": false,
"libraries": {}
}
}} |
1 | 20,291,177 | 2ebc18389d3b458dcb7a04610aff8f54871cb95dd4c50806947d2ce0659c8ab5 | 87be04a099b021321477ae7b8ba92bd6ad8b2cd494e9f08307f2a5ada47f4b0a | 107a5ed5258cc0c962c18a86a72ccbeac7fc3769 | ac521ea7a83a3bc3f9f1e09f8300a6301743fb1f | 1ec836cf916890f47ec96a1646377512dcd9869f | 600b5981380380925939f3fe42797465636f646553746f726167655f56312e302e305f5f5f5f5f5f5f5f5f20000000000000000000000000ac521ea7a83a3bc3f9f1e09f8300a6301743fb1f2f2a206d696e696d697a65722c20323032342e2068747470733a2f2f6d696e696d697a65722e6172742f202a2f0a6c65742070616c657474654f76657272696465734279546f6b656e49643d2262202020202066202020302020202031202020202020202031202020202020202031202020202020202020206a312064622020203920202036362020203062326820203520652031202020202020202020623520206a20206420313063202020202020202020202020202020202020202020202020202020202020202020666920206137616120316420622020202064202061633035683169356120663120323033333033202020202020202020362020316a202020202066206a202020202033312020202020202020206420386161202020203666203720206335202038206120613320676661202020203532202020686432666220202020612020202020202020633139323120646a20633520326633366439202035202020352020202020392064202020202020202020202020202020202020202020206465206a68202020302020202020633020203020223b | fe42797465636f646553746f726167655f56312e302e305f5f5f5f5f5f5f5f5f20000000000000000000000000ac521ea7a83a3bc3f9f1e09f8300a6301743fb1f2f2a206d696e696d697a65722c20323032342e2068747470733a2f2f6d696e696d697a65722e6172742f202a2f0a6c65742070616c657474654f76657272696465734279546f6b656e49643d2262202020202066202020302020202031202020202020202031202020202020202031202020202020202020206a312064622020203920202036362020203062326820203520652031202020202020202020623520206a20206420313063202020202020202020202020202020202020202020202020202020202020202020666920206137616120316420622020202064202061633035683169356120663120323033333033202020202020202020362020316a202020202066206a202020202033312020202020202020206420386161202020203666203720206335202038206120613320676661202020203532202020686432666220202020612020202020202020633139323120646a20633520326633366439202035202020352020202020392064202020202020202020202020202020202020202020206465206a68202020302020202020633020203020223b | |
1 | 20,291,178 | 993933dbc0e3ff25aa866ca9f814a0a7bf88fa4f24dabeba93cc623cb8c0cf5c | c11816669fbff3c17d554c3ff52b5444cee9274cdc018438324ab91533c117e9 | 578f533873dc8ea60ab1417180cc531f172ee292 | 29ef46035e9fa3d570c598d3266424ca11413b0c | 86ca6e77e25df02754f870bedd526a8cd28759b5 | 3d602d80600a3d3981f3363d3d373d3d3d363d735397d0869aba0d55e96d5716d383f6e1d8695ed75af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d735397d0869aba0d55e96d5716d383f6e1d8695ed75af43d82803e903d91602b57fd5bf3 | {{
"language": "Solidity",
"sources": {
"contracts/Forwarder.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity 0.8.10;\nimport '@openzeppelin/contracts/token/ERC1155/IERC1155.sol';\nimport '@openzeppelin/contracts/token/ERC721/IERC721.sol';\nimport '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';\nimport '@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol';\nimport './ERC20Interface.sol';\nimport './TransferHelper.sol';\nimport './IForwarder.sol';\n\n/**\n * Contract that will forward any incoming Ether to the creator of the contract\n *\n */\ncontract Forwarder is IERC721Receiver, ERC1155Receiver, IForwarder {\n // Address to which any funds sent to this contract will be forwarded\n address public parentAddress;\n bool public autoFlush721 = true;\n bool public autoFlush1155 = true;\n\n event ForwarderDeposited(address from, uint256 value, bytes data);\n\n /**\n * Initialize the contract, and sets the destination address to that of the creator\n */\n function init(\n address _parentAddress,\n bool _autoFlush721,\n bool _autoFlush1155\n ) external onlyUninitialized {\n parentAddress = _parentAddress;\n uint256 value = address(this).balance;\n\n // set whether we want to automatically flush erc721/erc1155 tokens or not\n autoFlush721 = _autoFlush721;\n autoFlush1155 = _autoFlush1155;\n\n if (value == 0) {\n return;\n }\n\n (bool success, ) = parentAddress.call{ value: value }('');\n require(success, 'Flush failed');\n\n // NOTE: since we are forwarding on initialization,\n // we don't have the context of the original sender.\n // We still emit an event about the forwarding but set\n // the sender to the forwarder itself\n emit ForwarderDeposited(address(this), value, msg.data);\n }\n\n /**\n * Modifier that will execute internal code block only if the sender is the parent address\n */\n modifier onlyParent {\n require(msg.sender == parentAddress, 'Only Parent');\n _;\n }\n\n /**\n * Modifier that will execute internal code block only if the contract has not been initialized yet\n */\n modifier onlyUninitialized {\n require(parentAddress == address(0x0), 'Already initialized');\n _;\n }\n\n /**\n * Default function; Gets called when data is sent but does not match any other function\n */\n fallback() external payable {\n flush();\n }\n\n /**\n * Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address\n */\n receive() external payable {\n flush();\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function setAutoFlush721(bool autoFlush)\n external\n virtual\n override\n onlyParent\n {\n autoFlush721 = autoFlush;\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function setAutoFlush1155(bool autoFlush)\n external\n virtual\n override\n onlyParent\n {\n autoFlush1155 = autoFlush;\n }\n\n /**\n * ERC721 standard callback function for when a ERC721 is transfered. The forwarder will send the nft\n * to the base wallet once the nft contract invokes this method after transfering the nft.\n *\n * @param _operator The address which called `safeTransferFrom` function\n * @param _from The address of the sender\n * @param _tokenId The token id of the nft\n * @param data Additional data with no specified format, sent in call to `_to`\n */\n function onERC721Received(\n address _operator,\n address _from,\n uint256 _tokenId,\n bytes memory data\n ) external virtual override returns (bytes4) {\n if (autoFlush721) {\n IERC721 instance = IERC721(msg.sender);\n require(\n instance.supportsInterface(type(IERC721).interfaceId),\n 'The caller does not support the ERC721 interface'\n );\n // this won't work for ERC721 re-entrancy\n instance.safeTransferFrom(address(this), parentAddress, _tokenId, data);\n }\n\n return this.onERC721Received.selector;\n }\n\n function callFromParent(\n address target,\n uint256 value,\n bytes calldata data\n ) external onlyParent returns (bytes memory) {\n (bool success, bytes memory returnedData) = target.call{ value: value }(\n data\n );\n require(success, 'Parent call execution failed');\n\n return returnedData;\n }\n\n /**\n * @inheritdoc IERC1155Receiver\n */\n function onERC1155Received(\n address _operator,\n address _from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external virtual override returns (bytes4) {\n IERC1155 instance = IERC1155(msg.sender);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n if (autoFlush1155) {\n instance.safeTransferFrom(address(this), parentAddress, id, value, data);\n }\n\n return this.onERC1155Received.selector;\n }\n\n /**\n * @inheritdoc IERC1155Receiver\n */\n function onERC1155BatchReceived(\n address _operator,\n address _from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external virtual override returns (bytes4) {\n IERC1155 instance = IERC1155(msg.sender);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n if (autoFlush1155) {\n instance.safeBatchTransferFrom(\n address(this),\n parentAddress,\n ids,\n values,\n data\n );\n }\n\n return this.onERC1155BatchReceived.selector;\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushTokens(address tokenContractAddress)\n external\n virtual\n override\n onlyParent\n {\n ERC20Interface instance = ERC20Interface(tokenContractAddress);\n address forwarderAddress = address(this);\n uint256 forwarderBalance = instance.balanceOf(forwarderAddress);\n if (forwarderBalance == 0) {\n return;\n }\n\n TransferHelper.safeTransfer(\n tokenContractAddress,\n parentAddress,\n forwarderBalance\n );\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushERC721Token(address tokenContractAddress, uint256 tokenId)\n external\n virtual\n override\n onlyParent\n {\n IERC721 instance = IERC721(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC721).interfaceId),\n 'The tokenContractAddress does not support the ERC721 interface'\n );\n\n address ownerAddress = instance.ownerOf(tokenId);\n instance.transferFrom(ownerAddress, parentAddress, tokenId);\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushERC1155Tokens(address tokenContractAddress, uint256 tokenId)\n external\n virtual\n override\n onlyParent\n {\n IERC1155 instance = IERC1155(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n address forwarderAddress = address(this);\n uint256 forwarderBalance = instance.balanceOf(forwarderAddress, tokenId);\n\n instance.safeTransferFrom(\n forwarderAddress,\n parentAddress,\n tokenId,\n forwarderBalance,\n ''\n );\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function batchFlushERC1155Tokens(\n address tokenContractAddress,\n uint256[] calldata tokenIds\n ) external virtual override onlyParent {\n IERC1155 instance = IERC1155(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n address forwarderAddress = address(this);\n uint256[] memory amounts = new uint256[](tokenIds.length);\n for (uint256 i = 0; i < tokenIds.length; i++) {\n amounts[i] = instance.balanceOf(forwarderAddress, tokenIds[i]);\n }\n\n instance.safeBatchTransferFrom(\n forwarderAddress,\n parentAddress,\n tokenIds,\n amounts,\n ''\n );\n }\n\n /**\n * Flush the entire balance of the contract to the parent address.\n */\n function flush() public {\n uint256 value = address(this).balance;\n\n if (value == 0) {\n return;\n }\n\n (bool success, ) = parentAddress.call{ value: value }('');\n require(success, 'Flush failed');\n emit ForwarderDeposited(msg.sender, value, msg.data);\n }\n\n /**\n * @inheritdoc IERC165\n */\n function supportsInterface(bytes4 interfaceId)\n public\n virtual\n override(ERC1155Receiver, IERC165)\n view\n returns (bool)\n {\n return\n interfaceId == type(IForwarder).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n}\n"
},
"@openzeppelin/contracts/token/ERC1155/IERC1155.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n"
},
"@openzeppelin/contracts/token/ERC721/IERC721.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n}\n"
},
"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n"
},
"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155Receiver.sol\";\nimport \"../../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\nabstract contract ERC1155Receiver is ERC165, IERC1155Receiver {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);\n }\n}\n"
},
"contracts/ERC20Interface.sol": {
"content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\n/**\n * Contract that exposes the needed erc20 token functions\n */\n\nabstract contract ERC20Interface {\n // Send _value amount of tokens to address _to\n function transfer(address _to, uint256 _value)\n public\n virtual\n returns (bool success);\n\n // Get the account balance of another account with address _owner\n function balanceOf(address _owner)\n public\n virtual\n view\n returns (uint256 balance);\n}\n"
},
"contracts/TransferHelper.sol": {
"content": "// SPDX-License-Identifier: GPL-3.0-or-later\n// source: https://github.com/Uniswap/solidity-lib/blob/master/contracts/libraries/TransferHelper.sol\npragma solidity 0.8.10;\n\nimport '@openzeppelin/contracts/utils/Address.sol';\n\n// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false\nlibrary TransferHelper {\n function safeTransfer(\n address token,\n address to,\n uint256 value\n ) internal {\n // bytes4(keccak256(bytes('transfer(address,uint256)')));\n (bool success, bytes memory data) = token.call(\n abi.encodeWithSelector(0xa9059cbb, to, value)\n );\n require(\n success && (data.length == 0 || abi.decode(data, (bool))),\n 'TransferHelper::safeTransfer: transfer failed'\n );\n }\n\n function safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));\n (bool success, bytes memory returndata) = token.call(\n abi.encodeWithSelector(0x23b872dd, from, to, value)\n );\n Address.verifyCallResult(\n success,\n returndata,\n 'TransferHelper::transferFrom: transferFrom failed'\n );\n }\n}\n"
},
"contracts/IForwarder.sol": {
"content": "pragma solidity ^0.8.0;\n\nimport '@openzeppelin/contracts/utils/introspection/IERC165.sol';\n\ninterface IForwarder is IERC165 {\n /**\n * Sets the autoflush721 parameter.\n *\n * @param autoFlush whether to autoflush erc721 tokens\n */\n function setAutoFlush721(bool autoFlush) external;\n\n /**\n * Sets the autoflush1155 parameter.\n *\n * @param autoFlush whether to autoflush erc1155 tokens\n */\n function setAutoFlush1155(bool autoFlush) external;\n\n /**\n * Execute a token transfer of the full balance from the forwarder token to the parent address\n *\n * @param tokenContractAddress the address of the erc20 token contract\n */\n function flushTokens(address tokenContractAddress) external;\n\n /**\n * Execute a nft transfer from the forwarder to the parent address\n *\n * @param tokenContractAddress the address of the ERC721 NFT contract\n * @param tokenId The token id of the nft\n */\n function flushERC721Token(address tokenContractAddress, uint256 tokenId)\n external;\n\n /**\n * Execute a nft transfer from the forwarder to the parent address.\n *\n * @param tokenContractAddress the address of the ERC1155 NFT contract\n * @param tokenId The token id of the nft\n */\n function flushERC1155Tokens(address tokenContractAddress, uint256 tokenId)\n external;\n\n /**\n * Execute a batch nft transfer from the forwarder to the parent address.\n *\n * @param tokenContractAddress the address of the ERC1155 NFT contract\n * @param tokenIds The token ids of the nfts\n */\n function batchFlushERC1155Tokens(\n address tokenContractAddress,\n uint256[] calldata tokenIds\n ) external;\n}\n"
},
"@openzeppelin/contracts/utils/introspection/IERC165.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
},
"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n @dev Handles the receipt of a single ERC1155 token type. This function is\n called at the end of a `safeTransferFrom` after the balance has been updated.\n To accept the transfer, this must return\n `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n (i.e. 0xf23a6e61, or its own function selector).\n @param operator The address which initiated the transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param id The ID of the token being transferred\n @param value The amount of tokens being transferred\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n @dev Handles the receipt of a multiple ERC1155 token types. This function\n is called at the end of a `safeBatchTransferFrom` after the balances have\n been updated. To accept the transfer(s), this must return\n `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n (i.e. 0xbc197c81, or its own function selector).\n @param operator The address which initiated the batch transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param ids An array containing ids of each token being transferred (order and length must match values array)\n @param values An array containing amounts of each token being transferred (order and length must match ids array)\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n"
},
"@openzeppelin/contracts/utils/introspection/ERC165.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n"
},
"@openzeppelin/contracts/utils/Address.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}
}} |
1 | 20,291,182 | aa680e12f3f5abbc6252243222a60622dcee54ddb1c88bf80f2bd7164bd2967e | c414cc835fd0350c344be72648770e108f99d350c29ef715a9e235c573364bb2 | 3216a2d17ba3b43d9fe6f33222364f1ffdbfd4de | 3216a2d17ba3b43d9fe6f33222364f1ffdbfd4de | 69696944a12ccd80cdd40828c4d191380054d58f | 60806040526001600660006101000a81548160ff0219169083151502179055506019600755602360085560006009556000600a55601a600b55601c600c55601c600d556000600e556009600a6200005791906200062b565b62d4b2c16200006791906200067c565b600f556009600a6200007a91906200062b565b62d4b2c16200008a91906200067c565b6010556009600a6200009d91906200062b565b626a5960620000ad91906200067c565b6011556009600a620000c091906200062b565b62d4b2c1620000d091906200067c565b6012556000601460156101000a81548160ff0219169083151502179055506000601460166101000a81548160ff0219169083151502179055503480156200011657600080fd5b506000620001296200046060201b60201c565b9050806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350620001d76200046060201b60201c565b600660016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506009600a6200022791906200062b565b63298ae9e06200023891906200067c565b600160006200024c6200046060201b60201c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600160036000620002a06200046860201b60201c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600160036000600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550620003d36200046060201b60201c565b73ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6009600a6200043291906200062b565b63298ae9e06200044391906200067c565b604051620004529190620006d8565b60405180910390a3620006f5565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008160011c9050919050565b6000808291508390505b60018511156200051f57808604811115620004f757620004f662000491565b5b6001851615620005075780820291505b80810290506200051785620004c0565b9450620004d7565b94509492505050565b6000826200053a57600190506200060d565b816200054a57600090506200060d565b81600181146200056357600281146200056e57620005a4565b60019150506200060d565b60ff84111562000583576200058262000491565b5b8360020a9150848211156200059d576200059c62000491565b5b506200060d565b5060208310610133831016604e8410600b8410161715620005de5782820a905083811115620005d857620005d762000491565b5b6200060d565b620005ed8484846001620004cd565b9250905081840481111562000607576200060662000491565b5b81810290505b9392505050565b6000819050919050565b600060ff82169050919050565b6000620006388262000614565b915062000645836200061e565b9250620006747fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848462000528565b905092915050565b6000620006898262000614565b9150620006968362000614565b9250828202620006a68162000614565b91508282048414831517620006c057620006bf62000491565b5b5092915050565b620006d28162000614565b82525050565b6000602082019050620006ef6000830184620006c7565b92915050565b6136db80620007056000396000f3fe6080604052600436106101445760003560e01c8063715018a6116100b6578063a9059cbb1161006f578063a9059cbb14610421578063bf474bed1461045e578063c876d0b914610489578063d34628cc146104b4578063dd62ed3e146104dd578063ec1f3f631461051a5761014b565b8063715018a614610347578063751039fc1461035e5780637d1db4a5146103755780638da5cb5b146103a05780638f9a55c0146103cb57806395d89b41146103f65761014b565b806323b872dd1161010857806323b872dd14610225578063313ce5671461026257806331c2d8471461028d5780633bbac579146102b657806351bc3c85146102f357806370a082311461030a5761014b565b806302ac81681461015057806306fdde0314610167578063095ea7b3146101925780630faee56f146101cf57806318160ddd146101fa5761014b565b3661014b57005b600080fd5b34801561015c57600080fd5b50610165610543565b005b34801561017357600080fd5b5061017c610a78565b6040516101899190612586565b60405180910390f35b34801561019e57600080fd5b506101b960048036038101906101b49190612650565b610a98565b6040516101c691906126ab565b60405180910390f35b3480156101db57600080fd5b506101e4610ab6565b6040516101f191906126d5565b60405180910390f35b34801561020657600080fd5b5061020f610abc565b60405161021c91906126d5565b60405180910390f35b34801561023157600080fd5b5061024c600480360381019061024791906126f0565b610ae0565b60405161025991906126ab565b60405180910390f35b34801561026e57600080fd5b50610277610bb9565b604051610284919061275f565b60405180910390f35b34801561029957600080fd5b506102b460048036038101906102af91906128c2565b610bc2565b005b3480156102c257600080fd5b506102dd60048036038101906102d8919061290b565b610cec565b6040516102ea91906126ab565b60405180910390f35b3480156102ff57600080fd5b50610308610d42565b005b34801561031657600080fd5b50610331600480360381019061032c919061290b565b610ddf565b60405161033e91906126d5565b60405180910390f35b34801561035357600080fd5b5061035c610e28565b005b34801561036a57600080fd5b50610373610f7b565b005b34801561038157600080fd5b5061038a6110c6565b60405161039791906126d5565b60405180910390f35b3480156103ac57600080fd5b506103b56110cc565b6040516103c29190612947565b60405180910390f35b3480156103d757600080fd5b506103e06110f5565b6040516103ed91906126d5565b60405180910390f35b34801561040257600080fd5b5061040b6110fb565b6040516104189190612586565b60405180910390f35b34801561042d57600080fd5b5061044860048036038101906104439190612650565b611138565b60405161045591906126ab565b60405180910390f35b34801561046a57600080fd5b50610473611156565b60405161048091906126d5565b60405180910390f35b34801561049557600080fd5b5061049e61115c565b6040516104ab91906126ab565b60405180910390f35b3480156104c057600080fd5b506104db60048036038101906104d691906128c2565b61116f565b005b3480156104e957600080fd5b5061050460048036038101906104ff9190612962565b611299565b60405161051191906126d5565b60405180910390f35b34801561052657600080fd5b50610541600480360381019061053c91906129a2565b611320565b005b61054b6113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105cf90612a1b565b60405180910390fd5b60148054906101000a900460ff1615610626576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161061d90612a87565b60405180910390fd5b737a250d5630b4cf539739df2c5dacb4c659f2488d601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506106c430601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166009600a6106b09190612c09565b63298ae9e06106bf9190612c54565b6113b7565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610731573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107559190612cab565b73ffffffffffffffffffffffffffffffffffffffff1663c9c6539630601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108029190612cab565b6040518363ffffffff1660e01b815260040161081f929190612cd8565b6020604051808303816000875af115801561083e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108629190612cab565b601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306108eb30610ddf565b6000806108f66110cc565b426040518863ffffffff1660e01b815260040161091896959493929190612d46565b60606040518083038185885af1158015610936573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061095b9190612dbc565b505050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016109fd929190612e0f565b6020604051808303816000875af1158015610a1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a409190612e64565b506001601460166101000a81548160ff02191690831515021790555060016014806101000a81548160ff021916908315150217905550565b60606040518060600160405280602d8152602001613651602d9139905090565b6000610aac610aa56113af565b84846113b7565b6001905092915050565b60125481565b60006009600a610acc9190612c09565b63298ae9e0610adb9190612c54565b905090565b6000610aed848484611580565b610bae84610af96113af565b610ba98560405180606001604052806028815260200161367e60289139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610b5f6113af565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fc59092919063ffffffff16565b6113b7565b600190509392505050565b60006009905090565b610bca6113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c57576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c4e90612a1b565b60405180910390fd5b60005b8151811015610ce857600060046000848481518110610c7c57610c7b612e91565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ce090612ec0565b915050610c5a565b5050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d836113af565b73ffffffffffffffffffffffffffffffffffffffff1614610da357600080fd5b6000610dae30610ddf565b90506000811115610dc357610dc281612029565b5b60004790506000811115610ddb57610dda816122a2565b5b5050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610e306113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ebd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eb490612a1b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610f836113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611010576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161100790612a1b565b60405180910390fd5b6009600a61101e9190612c09565b63298ae9e061102d9190612c54565b600f819055506009600a6110419190612c09565b63298ae9e06110509190612c54565b6010819055506000600660006101000a81548160ff0219169083151502179055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6009600a6110a09190612c09565b63298ae9e06110af9190612c54565b6040516110bc91906126d5565b60405180910390a1565b600f5481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60105481565b60606040518060400160405280601081526020017ff09d939ff09d9394f09d939ff09d939400000000000000000000000000000000815250905090565b600061114c6111456113af565b8484611580565b6001905092915050565b60115481565b600660009054906101000a900460ff1681565b6111776113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611204576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111fb90612a1b565b60405180910390fd5b60005b81518110156112955760016004600084848151811061122957611228612e91565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061128d90612ec0565b915050611207565b5050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166113616113af565b73ffffffffffffffffffffffffffffffffffffffff161461138157600080fd5b60095481111580156113955750600a548111155b61139e57600080fd5b8060098190555080600a8190555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611426576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161141d90612f7a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611495576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148c9061300c565b60405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161157391906126d5565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036115ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115e69061309e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361165e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165590613130565b60405180910390fd5b600081116116a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611698906131c2565b60405180910390fd5b60006116ab6110cc565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561171957506116e96110cc565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611d0857600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156117c25750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6117cb57600080fd5b61180760646117f9600b54600e54116117e6576007546117ea565b6009545b8561230e90919063ffffffff16565b61238890919063ffffffff16565b9050600660009054906101000a900460ff161561199657601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156118ca5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b156119955743600560003273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611950576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119479061327a565b60405180910390fd5b43600560003273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611a415750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611a975750600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611b5257600f54821115611ae1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ad8906132e6565b60405180910390fd5b60105482611aee85610ddf565b611af89190613306565b1115611b39576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b3090613386565b60405180910390fd5b600e6000815480929190611b4c90612ec0565b91905055505b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611bdb57503073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611c1f57611c1c6064611c0e600c54600e5411611bfb57600854611bff565b600a545b8561230e90919063ffffffff16565b61238890919063ffffffff16565b90505b6000611c2a30610ddf565b9050601460159054906101000a900460ff16158015611c965750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b8015611cae5750601460169054906101000a900460ff165b8015611cbb575060115481115b8015611cca5750600d54600e54115b15611d0657611cec611ce784611ce2846012546123d2565b6123d2565b612029565b60004790506000811115611d0457611d03476122a2565b5b505b505b6000811115611e0c57611d6381600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123eb90919063ffffffff16565b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051611e0391906126d5565b60405180910390a35b611e5e82600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461244990919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f05611eb7828461244990919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123eb90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef611faa848661244990919063ffffffff16565b604051611fb791906126d5565b60405180910390a350505050565b600083831115829061200d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120049190612586565b60405180910390fd5b506000838561201c91906133a6565b9050809150509392505050565b6001601460156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156120615761206061277f565b5b60405190808252806020026020018201604052801561208f5781602001602082028036833780820191505090505b50905030816000815181106120a7576120a6612e91565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561214e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121729190612cab565b8160018151811061218657612185612e91565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506121ed30601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846113b7565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612251959493929190613498565b600060405180830381600087803b15801561226b57600080fd5b505af115801561227f573d6000803e3d6000fd5b50505050506000601460156101000a81548160ff02191690831515021790555050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801561230a573d6000803e3d6000fd5b5050565b60008083036123205760009050612382565b6000828461232e9190612c54565b905082848261233d9190613521565b1461237d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612374906135c4565b60405180910390fd5b809150505b92915050565b60006123ca83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612493565b905092915050565b60008183116123e157826123e3565b815b905092915050565b60008082846123fa9190613306565b90508381101561243f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161243690613630565b60405180910390fd5b8091505092915050565b600061248b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611fc5565b905092915050565b600080831182906124da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124d19190612586565b60405180910390fd5b50600083856124e99190613521565b9050809150509392505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612530578082015181840152602081019050612515565b60008484015250505050565b6000601f19601f8301169050919050565b6000612558826124f6565b6125628185612501565b9350612572818560208601612512565b61257b8161253c565b840191505092915050565b600060208201905081810360008301526125a0818461254d565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006125e7826125bc565b9050919050565b6125f7816125dc565b811461260257600080fd5b50565b600081359050612614816125ee565b92915050565b6000819050919050565b61262d8161261a565b811461263857600080fd5b50565b60008135905061264a81612624565b92915050565b60008060408385031215612667576126666125b2565b5b600061267585828601612605565b92505060206126868582860161263b565b9150509250929050565b60008115159050919050565b6126a581612690565b82525050565b60006020820190506126c0600083018461269c565b92915050565b6126cf8161261a565b82525050565b60006020820190506126ea60008301846126c6565b92915050565b600080600060608486031215612709576127086125b2565b5b600061271786828701612605565b935050602061272886828701612605565b92505060406127398682870161263b565b9150509250925092565b600060ff82169050919050565b61275981612743565b82525050565b60006020820190506127746000830184612750565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6127b78261253c565b810181811067ffffffffffffffff821117156127d6576127d561277f565b5b80604052505050565b60006127e96125a8565b90506127f582826127ae565b919050565b600067ffffffffffffffff8211156128155761281461277f565b5b602082029050602081019050919050565b600080fd5b600061283e612839846127fa565b6127df565b9050808382526020820190506020840283018581111561286157612860612826565b5b835b8181101561288a57806128768882612605565b845260208401935050602081019050612863565b5050509392505050565b600082601f8301126128a9576128a861277a565b5b81356128b984826020860161282b565b91505092915050565b6000602082840312156128d8576128d76125b2565b5b600082013567ffffffffffffffff8111156128f6576128f56125b7565b5b61290284828501612894565b91505092915050565b600060208284031215612921576129206125b2565b5b600061292f84828501612605565b91505092915050565b612941816125dc565b82525050565b600060208201905061295c6000830184612938565b92915050565b60008060408385031215612979576129786125b2565b5b600061298785828601612605565b925050602061299885828601612605565b9150509250929050565b6000602082840312156129b8576129b76125b2565b5b60006129c68482850161263b565b91505092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612a05602083612501565b9150612a10826129cf565b602082019050919050565b60006020820190508181036000830152612a34816129f8565b9050919050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6000612a71601783612501565b9150612a7c82612a3b565b602082019050919050565b60006020820190508181036000830152612aa081612a64565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008160011c9050919050565b6000808291508390505b6001851115612b2d57808604811115612b0957612b08612aa7565b5b6001851615612b185780820291505b8081029050612b2685612ad6565b9450612aed565b94509492505050565b600082612b465760019050612c02565b81612b545760009050612c02565b8160018114612b6a5760028114612b7457612ba3565b6001915050612c02565b60ff841115612b8657612b85612aa7565b5b8360020a915084821115612b9d57612b9c612aa7565b5b50612c02565b5060208310610133831016604e8410600b8410161715612bd85782820a905083811115612bd357612bd2612aa7565b5b612c02565b612be58484846001612ae3565b92509050818404811115612bfc57612bfb612aa7565b5b81810290505b9392505050565b6000612c148261261a565b9150612c1f83612743565b9250612c4c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484612b36565b905092915050565b6000612c5f8261261a565b9150612c6a8361261a565b9250828202612c788161261a565b91508282048414831517612c8f57612c8e612aa7565b5b5092915050565b600081519050612ca5816125ee565b92915050565b600060208284031215612cc157612cc06125b2565b5b6000612ccf84828501612c96565b91505092915050565b6000604082019050612ced6000830185612938565b612cfa6020830184612938565b9392505050565b6000819050919050565b6000819050919050565b6000612d30612d2b612d2684612d01565b612d0b565b61261a565b9050919050565b612d4081612d15565b82525050565b600060c082019050612d5b6000830189612938565b612d6860208301886126c6565b612d756040830187612d37565b612d826060830186612d37565b612d8f6080830185612938565b612d9c60a08301846126c6565b979650505050505050565b600081519050612db681612624565b92915050565b600080600060608486031215612dd557612dd46125b2565b5b6000612de386828701612da7565b9350506020612df486828701612da7565b9250506040612e0586828701612da7565b9150509250925092565b6000604082019050612e246000830185612938565b612e3160208301846126c6565b9392505050565b612e4181612690565b8114612e4c57600080fd5b50565b600081519050612e5e81612e38565b92915050565b600060208284031215612e7a57612e796125b2565b5b6000612e8884828501612e4f565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000612ecb8261261a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612efd57612efc612aa7565b5b600182019050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612f64602483612501565b9150612f6f82612f08565b604082019050919050565b60006020820190508181036000830152612f9381612f57565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000612ff6602283612501565b915061300182612f9a565b604082019050919050565b6000602082019050818103600083015261302581612fe9565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000613088602583612501565b91506130938261302c565b604082019050919050565b600060208201905081810360008301526130b78161307b565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061311a602383612501565b9150613125826130be565b604082019050919050565b600060208201905081810360008301526131498161310d565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006131ac602983612501565b91506131b782613150565b604082019050919050565b600060208201905081810360008301526131db8161319f565b9050919050565b7f5f7472616e736665723a3a205472616e736665722044656c617920656e61626c60008201527f65642e20204f6e6c79206f6e652070757263686173652070657220626c6f636b60208201527f20616c6c6f7765642e0000000000000000000000000000000000000000000000604082015250565b6000613264604983612501565b915061326f826131e2565b606082019050919050565b6000602082019050818103600083015261329381613257565b9050919050565b7f4578636565647320746865205f6d61785478416d6f756e742e00000000000000600082015250565b60006132d0601983612501565b91506132db8261329a565b602082019050919050565b600060208201905081810360008301526132ff816132c3565b9050919050565b60006133118261261a565b915061331c8361261a565b925082820190508082111561333457613333612aa7565b5b92915050565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b6000613370601a83612501565b915061337b8261333a565b602082019050919050565b6000602082019050818103600083015261339f81613363565b9050919050565b60006133b18261261a565b91506133bc8361261a565b92508282039050818111156133d4576133d3612aa7565b5b92915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61340f816125dc565b82525050565b60006134218383613406565b60208301905092915050565b6000602082019050919050565b6000613445826133da565b61344f81856133e5565b935061345a836133f6565b8060005b8381101561348b5781516134728882613415565b975061347d8361342d565b92505060018101905061345e565b5085935050505092915050565b600060a0820190506134ad60008301886126c6565b6134ba6020830187612d37565b81810360408301526134cc818661343a565b90506134db6060830185612938565b6134e860808301846126c6565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061352c8261261a565b91506135378361261a565b925082613547576135466134f2565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b60006135ae602183612501565b91506135b982613552565b604082019050919050565b600060208201905081810360008301526135dd816135a1565b9050919050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b600061361a601b83612501565b9150613625826135e4565b602082019050919050565b600060208201905081810360008301526136498161360d565b905091905056fe5065706520627920f09d939cf09d93aaf09d93bdf09d93bd20f09d9395f09d93bef09d93bbf09d93b2f09d93ae45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205407dd43673bcaac22cd302e8319d5e0c97e48359bd935a6eece815e456f076464736f6c63430008130033 | 6080604052600436106101445760003560e01c8063715018a6116100b6578063a9059cbb1161006f578063a9059cbb14610421578063bf474bed1461045e578063c876d0b914610489578063d34628cc146104b4578063dd62ed3e146104dd578063ec1f3f631461051a5761014b565b8063715018a614610347578063751039fc1461035e5780637d1db4a5146103755780638da5cb5b146103a05780638f9a55c0146103cb57806395d89b41146103f65761014b565b806323b872dd1161010857806323b872dd14610225578063313ce5671461026257806331c2d8471461028d5780633bbac579146102b657806351bc3c85146102f357806370a082311461030a5761014b565b806302ac81681461015057806306fdde0314610167578063095ea7b3146101925780630faee56f146101cf57806318160ddd146101fa5761014b565b3661014b57005b600080fd5b34801561015c57600080fd5b50610165610543565b005b34801561017357600080fd5b5061017c610a78565b6040516101899190612586565b60405180910390f35b34801561019e57600080fd5b506101b960048036038101906101b49190612650565b610a98565b6040516101c691906126ab565b60405180910390f35b3480156101db57600080fd5b506101e4610ab6565b6040516101f191906126d5565b60405180910390f35b34801561020657600080fd5b5061020f610abc565b60405161021c91906126d5565b60405180910390f35b34801561023157600080fd5b5061024c600480360381019061024791906126f0565b610ae0565b60405161025991906126ab565b60405180910390f35b34801561026e57600080fd5b50610277610bb9565b604051610284919061275f565b60405180910390f35b34801561029957600080fd5b506102b460048036038101906102af91906128c2565b610bc2565b005b3480156102c257600080fd5b506102dd60048036038101906102d8919061290b565b610cec565b6040516102ea91906126ab565b60405180910390f35b3480156102ff57600080fd5b50610308610d42565b005b34801561031657600080fd5b50610331600480360381019061032c919061290b565b610ddf565b60405161033e91906126d5565b60405180910390f35b34801561035357600080fd5b5061035c610e28565b005b34801561036a57600080fd5b50610373610f7b565b005b34801561038157600080fd5b5061038a6110c6565b60405161039791906126d5565b60405180910390f35b3480156103ac57600080fd5b506103b56110cc565b6040516103c29190612947565b60405180910390f35b3480156103d757600080fd5b506103e06110f5565b6040516103ed91906126d5565b60405180910390f35b34801561040257600080fd5b5061040b6110fb565b6040516104189190612586565b60405180910390f35b34801561042d57600080fd5b5061044860048036038101906104439190612650565b611138565b60405161045591906126ab565b60405180910390f35b34801561046a57600080fd5b50610473611156565b60405161048091906126d5565b60405180910390f35b34801561049557600080fd5b5061049e61115c565b6040516104ab91906126ab565b60405180910390f35b3480156104c057600080fd5b506104db60048036038101906104d691906128c2565b61116f565b005b3480156104e957600080fd5b5061050460048036038101906104ff9190612962565b611299565b60405161051191906126d5565b60405180910390f35b34801561052657600080fd5b50610541600480360381019061053c91906129a2565b611320565b005b61054b6113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105cf90612a1b565b60405180910390fd5b60148054906101000a900460ff1615610626576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161061d90612a87565b60405180910390fd5b737a250d5630b4cf539739df2c5dacb4c659f2488d601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506106c430601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166009600a6106b09190612c09565b63298ae9e06106bf9190612c54565b6113b7565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610731573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107559190612cab565b73ffffffffffffffffffffffffffffffffffffffff1663c9c6539630601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108029190612cab565b6040518363ffffffff1660e01b815260040161081f929190612cd8565b6020604051808303816000875af115801561083e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108629190612cab565b601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306108eb30610ddf565b6000806108f66110cc565b426040518863ffffffff1660e01b815260040161091896959493929190612d46565b60606040518083038185885af1158015610936573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061095b9190612dbc565b505050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016109fd929190612e0f565b6020604051808303816000875af1158015610a1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a409190612e64565b506001601460166101000a81548160ff02191690831515021790555060016014806101000a81548160ff021916908315150217905550565b60606040518060600160405280602d8152602001613651602d9139905090565b6000610aac610aa56113af565b84846113b7565b6001905092915050565b60125481565b60006009600a610acc9190612c09565b63298ae9e0610adb9190612c54565b905090565b6000610aed848484611580565b610bae84610af96113af565b610ba98560405180606001604052806028815260200161367e60289139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610b5f6113af565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fc59092919063ffffffff16565b6113b7565b600190509392505050565b60006009905090565b610bca6113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c57576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c4e90612a1b565b60405180910390fd5b60005b8151811015610ce857600060046000848481518110610c7c57610c7b612e91565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ce090612ec0565b915050610c5a565b5050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d836113af565b73ffffffffffffffffffffffffffffffffffffffff1614610da357600080fd5b6000610dae30610ddf565b90506000811115610dc357610dc281612029565b5b60004790506000811115610ddb57610dda816122a2565b5b5050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610e306113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ebd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eb490612a1b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610f836113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611010576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161100790612a1b565b60405180910390fd5b6009600a61101e9190612c09565b63298ae9e061102d9190612c54565b600f819055506009600a6110419190612c09565b63298ae9e06110509190612c54565b6010819055506000600660006101000a81548160ff0219169083151502179055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6009600a6110a09190612c09565b63298ae9e06110af9190612c54565b6040516110bc91906126d5565b60405180910390a1565b600f5481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60105481565b60606040518060400160405280601081526020017ff09d939ff09d9394f09d939ff09d939400000000000000000000000000000000815250905090565b600061114c6111456113af565b8484611580565b6001905092915050565b60115481565b600660009054906101000a900460ff1681565b6111776113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611204576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111fb90612a1b565b60405180910390fd5b60005b81518110156112955760016004600084848151811061122957611228612e91565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061128d90612ec0565b915050611207565b5050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166113616113af565b73ffffffffffffffffffffffffffffffffffffffff161461138157600080fd5b60095481111580156113955750600a548111155b61139e57600080fd5b8060098190555080600a8190555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611426576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161141d90612f7a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611495576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148c9061300c565b60405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161157391906126d5565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036115ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115e69061309e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361165e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165590613130565b60405180910390fd5b600081116116a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611698906131c2565b60405180910390fd5b60006116ab6110cc565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561171957506116e96110cc565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611d0857600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156117c25750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6117cb57600080fd5b61180760646117f9600b54600e54116117e6576007546117ea565b6009545b8561230e90919063ffffffff16565b61238890919063ffffffff16565b9050600660009054906101000a900460ff161561199657601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156118ca5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b156119955743600560003273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611950576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119479061327a565b60405180910390fd5b43600560003273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611a415750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611a975750600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611b5257600f54821115611ae1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ad8906132e6565b60405180910390fd5b60105482611aee85610ddf565b611af89190613306565b1115611b39576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b3090613386565b60405180910390fd5b600e6000815480929190611b4c90612ec0565b91905055505b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611bdb57503073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611c1f57611c1c6064611c0e600c54600e5411611bfb57600854611bff565b600a545b8561230e90919063ffffffff16565b61238890919063ffffffff16565b90505b6000611c2a30610ddf565b9050601460159054906101000a900460ff16158015611c965750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b8015611cae5750601460169054906101000a900460ff165b8015611cbb575060115481115b8015611cca5750600d54600e54115b15611d0657611cec611ce784611ce2846012546123d2565b6123d2565b612029565b60004790506000811115611d0457611d03476122a2565b5b505b505b6000811115611e0c57611d6381600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123eb90919063ffffffff16565b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051611e0391906126d5565b60405180910390a35b611e5e82600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461244990919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f05611eb7828461244990919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123eb90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef611faa848661244990919063ffffffff16565b604051611fb791906126d5565b60405180910390a350505050565b600083831115829061200d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120049190612586565b60405180910390fd5b506000838561201c91906133a6565b9050809150509392505050565b6001601460156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156120615761206061277f565b5b60405190808252806020026020018201604052801561208f5781602001602082028036833780820191505090505b50905030816000815181106120a7576120a6612e91565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561214e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121729190612cab565b8160018151811061218657612185612e91565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506121ed30601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846113b7565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612251959493929190613498565b600060405180830381600087803b15801561226b57600080fd5b505af115801561227f573d6000803e3d6000fd5b50505050506000601460156101000a81548160ff02191690831515021790555050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801561230a573d6000803e3d6000fd5b5050565b60008083036123205760009050612382565b6000828461232e9190612c54565b905082848261233d9190613521565b1461237d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612374906135c4565b60405180910390fd5b809150505b92915050565b60006123ca83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612493565b905092915050565b60008183116123e157826123e3565b815b905092915050565b60008082846123fa9190613306565b90508381101561243f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161243690613630565b60405180910390fd5b8091505092915050565b600061248b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611fc5565b905092915050565b600080831182906124da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124d19190612586565b60405180910390fd5b50600083856124e99190613521565b9050809150509392505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612530578082015181840152602081019050612515565b60008484015250505050565b6000601f19601f8301169050919050565b6000612558826124f6565b6125628185612501565b9350612572818560208601612512565b61257b8161253c565b840191505092915050565b600060208201905081810360008301526125a0818461254d565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006125e7826125bc565b9050919050565b6125f7816125dc565b811461260257600080fd5b50565b600081359050612614816125ee565b92915050565b6000819050919050565b61262d8161261a565b811461263857600080fd5b50565b60008135905061264a81612624565b92915050565b60008060408385031215612667576126666125b2565b5b600061267585828601612605565b92505060206126868582860161263b565b9150509250929050565b60008115159050919050565b6126a581612690565b82525050565b60006020820190506126c0600083018461269c565b92915050565b6126cf8161261a565b82525050565b60006020820190506126ea60008301846126c6565b92915050565b600080600060608486031215612709576127086125b2565b5b600061271786828701612605565b935050602061272886828701612605565b92505060406127398682870161263b565b9150509250925092565b600060ff82169050919050565b61275981612743565b82525050565b60006020820190506127746000830184612750565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6127b78261253c565b810181811067ffffffffffffffff821117156127d6576127d561277f565b5b80604052505050565b60006127e96125a8565b90506127f582826127ae565b919050565b600067ffffffffffffffff8211156128155761281461277f565b5b602082029050602081019050919050565b600080fd5b600061283e612839846127fa565b6127df565b9050808382526020820190506020840283018581111561286157612860612826565b5b835b8181101561288a57806128768882612605565b845260208401935050602081019050612863565b5050509392505050565b600082601f8301126128a9576128a861277a565b5b81356128b984826020860161282b565b91505092915050565b6000602082840312156128d8576128d76125b2565b5b600082013567ffffffffffffffff8111156128f6576128f56125b7565b5b61290284828501612894565b91505092915050565b600060208284031215612921576129206125b2565b5b600061292f84828501612605565b91505092915050565b612941816125dc565b82525050565b600060208201905061295c6000830184612938565b92915050565b60008060408385031215612979576129786125b2565b5b600061298785828601612605565b925050602061299885828601612605565b9150509250929050565b6000602082840312156129b8576129b76125b2565b5b60006129c68482850161263b565b91505092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612a05602083612501565b9150612a10826129cf565b602082019050919050565b60006020820190508181036000830152612a34816129f8565b9050919050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6000612a71601783612501565b9150612a7c82612a3b565b602082019050919050565b60006020820190508181036000830152612aa081612a64565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008160011c9050919050565b6000808291508390505b6001851115612b2d57808604811115612b0957612b08612aa7565b5b6001851615612b185780820291505b8081029050612b2685612ad6565b9450612aed565b94509492505050565b600082612b465760019050612c02565b81612b545760009050612c02565b8160018114612b6a5760028114612b7457612ba3565b6001915050612c02565b60ff841115612b8657612b85612aa7565b5b8360020a915084821115612b9d57612b9c612aa7565b5b50612c02565b5060208310610133831016604e8410600b8410161715612bd85782820a905083811115612bd357612bd2612aa7565b5b612c02565b612be58484846001612ae3565b92509050818404811115612bfc57612bfb612aa7565b5b81810290505b9392505050565b6000612c148261261a565b9150612c1f83612743565b9250612c4c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484612b36565b905092915050565b6000612c5f8261261a565b9150612c6a8361261a565b9250828202612c788161261a565b91508282048414831517612c8f57612c8e612aa7565b5b5092915050565b600081519050612ca5816125ee565b92915050565b600060208284031215612cc157612cc06125b2565b5b6000612ccf84828501612c96565b91505092915050565b6000604082019050612ced6000830185612938565b612cfa6020830184612938565b9392505050565b6000819050919050565b6000819050919050565b6000612d30612d2b612d2684612d01565b612d0b565b61261a565b9050919050565b612d4081612d15565b82525050565b600060c082019050612d5b6000830189612938565b612d6860208301886126c6565b612d756040830187612d37565b612d826060830186612d37565b612d8f6080830185612938565b612d9c60a08301846126c6565b979650505050505050565b600081519050612db681612624565b92915050565b600080600060608486031215612dd557612dd46125b2565b5b6000612de386828701612da7565b9350506020612df486828701612da7565b9250506040612e0586828701612da7565b9150509250925092565b6000604082019050612e246000830185612938565b612e3160208301846126c6565b9392505050565b612e4181612690565b8114612e4c57600080fd5b50565b600081519050612e5e81612e38565b92915050565b600060208284031215612e7a57612e796125b2565b5b6000612e8884828501612e4f565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000612ecb8261261a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612efd57612efc612aa7565b5b600182019050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612f64602483612501565b9150612f6f82612f08565b604082019050919050565b60006020820190508181036000830152612f9381612f57565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000612ff6602283612501565b915061300182612f9a565b604082019050919050565b6000602082019050818103600083015261302581612fe9565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000613088602583612501565b91506130938261302c565b604082019050919050565b600060208201905081810360008301526130b78161307b565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061311a602383612501565b9150613125826130be565b604082019050919050565b600060208201905081810360008301526131498161310d565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006131ac602983612501565b91506131b782613150565b604082019050919050565b600060208201905081810360008301526131db8161319f565b9050919050565b7f5f7472616e736665723a3a205472616e736665722044656c617920656e61626c60008201527f65642e20204f6e6c79206f6e652070757263686173652070657220626c6f636b60208201527f20616c6c6f7765642e0000000000000000000000000000000000000000000000604082015250565b6000613264604983612501565b915061326f826131e2565b606082019050919050565b6000602082019050818103600083015261329381613257565b9050919050565b7f4578636565647320746865205f6d61785478416d6f756e742e00000000000000600082015250565b60006132d0601983612501565b91506132db8261329a565b602082019050919050565b600060208201905081810360008301526132ff816132c3565b9050919050565b60006133118261261a565b915061331c8361261a565b925082820190508082111561333457613333612aa7565b5b92915050565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b6000613370601a83612501565b915061337b8261333a565b602082019050919050565b6000602082019050818103600083015261339f81613363565b9050919050565b60006133b18261261a565b91506133bc8361261a565b92508282039050818111156133d4576133d3612aa7565b5b92915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61340f816125dc565b82525050565b60006134218383613406565b60208301905092915050565b6000602082019050919050565b6000613445826133da565b61344f81856133e5565b935061345a836133f6565b8060005b8381101561348b5781516134728882613415565b975061347d8361342d565b92505060018101905061345e565b5085935050505092915050565b600060a0820190506134ad60008301886126c6565b6134ba6020830187612d37565b81810360408301526134cc818661343a565b90506134db6060830185612938565b6134e860808301846126c6565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061352c8261261a565b91506135378361261a565b925082613547576135466134f2565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b60006135ae602183612501565b91506135b982613552565b604082019050919050565b600060208201905081810360008301526135dd816135a1565b9050919050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b600061361a601b83612501565b9150613625826135e4565b602082019050919050565b600060208201905081810360008301526136498161360d565b905091905056fe5065706520627920f09d939cf09d93aaf09d93bdf09d93bd20f09d9395f09d93bef09d93bbf09d93b2f09d93ae45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205407dd43673bcaac22cd302e8319d5e0c97e48359bd935a6eece815e456f076464736f6c63430008130033 | |
1 | 20,291,182 | aa680e12f3f5abbc6252243222a60622dcee54ddb1c88bf80f2bd7164bd2967e | 89d601e4e536c2c24f0b9295bcdb4a6e6aebdea4ed2ca2bcf0d81831d9980bcc | ee5ce2ec8ae13ed755612ac939c8e7989a92e654 | 00b19a5200a100e5fc4c9800772f4d002f218400 | ed9b8ebb12a782e04e7bbaf7b03a8cf11a9e7bdd | 3d602d80600a3d3981f3363d3d373d3d3d363d739f36ee33fd56c7d9a78facd3249c580b1ca464a25af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d739f36ee33fd56c7d9a78facd3249c580b1ca464a25af43d82803e903d91602b57fd5bf3 | {{
"language": "Solidity",
"sources": {
"src/clones/ERC1155SeaDropCloneable.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n ERC1155SeaDropContractOffererCloneable\n} from \"./ERC1155SeaDropContractOffererCloneable.sol\";\n\n/**\n * @title ERC1155SeaDropCloneable\n * @author James Wenzel (emo.eth)\n * @author Ryan Ghods (ralxz.eth)\n * @author Stephan Min (stephanm.eth)\n * @author Michael Cohen (notmichael.eth)\n * @custom:contributor Limit Break (@limitbreak)\n * @notice A cloneable ERC1155 token contract that can mint as a\n * Seaport contract offerer.\n * Implements Limit Break's Creator Token Standards transfer\n * validation for royalty enforcement.\n */\ncontract ERC1155SeaDropCloneable is ERC1155SeaDropContractOffererCloneable {\n /**\n * @notice Initialize the token contract.\n *\n * @param allowedConfigurer The address of the contract allowed to\n * implementation code. Also contains SeaDrop\n * implementation code.\n * @param allowedSeaport The address of the Seaport contract allowed to\n * interact.\n * @param name_ The name of the token.\n * @param symbol_ The symbol of the token.\n */\n function initialize(\n address allowedConfigurer,\n address allowedSeaport,\n string memory name_,\n string memory symbol_,\n address initialOwner\n ) public initializer {\n // Initialize ownership.\n _initializeOwner(initialOwner);\n\n // Initialize ERC1155SeaDropContractOffererCloneable.\n __ERC1155SeaDropContractOffererCloneable_init(\n allowedConfigurer,\n allowedSeaport,\n name_,\n symbol_\n );\n }\n\n /**\n * @notice Burns a token, restricted to the owner or approved operator,\n * and must have sufficient balance.\n *\n * @param from The address to burn from.\n * @param id The token id to burn.\n * @param amount The amount to burn.\n */\n function burn(address from, uint256 id, uint256 amount) external {\n // Burn the token.\n _burn(msg.sender, from, id, amount);\n }\n\n /**\n * @notice Burns a batch of tokens, restricted to the owner or\n * approved operator, and must have sufficient balance.\n *\n * @param from The address to burn from.\n * @param ids The token ids to burn.\n * @param amounts The amounts to burn per token id.\n */\n function batchBurn(\n address from,\n uint256[] calldata ids,\n uint256[] calldata amounts\n ) external {\n // Burn the tokens.\n _batchBurn(msg.sender, from, ids, amounts);\n }\n}\n"
},
"src/clones/ERC1155SeaDropContractOffererCloneable.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { IERC1155SeaDrop } from \"../interfaces/IERC1155SeaDrop.sol\";\n\nimport { ISeaDropToken } from \"../interfaces/ISeaDropToken.sol\";\n\nimport {\n ERC1155ContractMetadataCloneable\n} from \"./ERC1155ContractMetadataCloneable.sol\";\n\nimport {\n ERC1155SeaDropContractOffererStorage\n} from \"../lib/ERC1155SeaDropContractOffererStorage.sol\";\n\nimport {\n ERC1155SeaDropErrorsAndEvents\n} from \"../lib/ERC1155SeaDropErrorsAndEvents.sol\";\n\nimport { PublicDrop } from \"../lib//ERC1155SeaDropStructs.sol\";\n\nimport { AllowListData } from \"../lib/SeaDropStructs.sol\";\n\nimport {\n ERC1155ConduitPreapproved\n} from \"../lib/ERC1155ConduitPreapproved.sol\";\n\nimport { ERC1155 } from \"solady/src/tokens/ERC1155.sol\";\n\nimport { SpentItem } from \"seaport-types/src/lib/ConsiderationStructs.sol\";\n\nimport {\n ContractOffererInterface\n} from \"seaport-types/src/interfaces/ContractOffererInterface.sol\";\n\nimport {\n IERC165\n} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @title ERC1155SeaDropContractOffererCloneable\n * @author James Wenzel (emo.eth)\n * @author Ryan Ghods (ralxz.eth)\n * @author Stephan Min (stephanm.eth)\n * @author Michael Cohen (notmichael.eth)\n * @notice A cloneable ERC1155 token contract that can mint as a\n * Seaport contract offerer.\n */\ncontract ERC1155SeaDropContractOffererCloneable is\n ERC1155ContractMetadataCloneable,\n ERC1155SeaDropErrorsAndEvents\n{\n using ERC1155SeaDropContractOffererStorage for ERC1155SeaDropContractOffererStorage.Layout;\n\n /**\n * @notice Initialize the token contract.\n *\n * @param allowedConfigurer The address of the contract allowed to\n * configure parameters. Also contains SeaDrop\n * implementation code.\n * @param allowedSeaport The address of the Seaport contract allowed to\n * interact.\n * @param name_ The name of the token.\n * @param symbol_ The symbol of the token.\n */\n function __ERC1155SeaDropContractOffererCloneable_init(\n address allowedConfigurer,\n address allowedSeaport,\n string memory name_,\n string memory symbol_\n ) internal onlyInitializing {\n // Set the allowed Seaport to interact with this contract.\n if (allowedSeaport == address(0)) {\n revert AllowedSeaportCannotBeZeroAddress();\n }\n ERC1155SeaDropContractOffererStorage.layout()._allowedSeaport[\n allowedSeaport\n ] = true;\n\n // Set the allowed Seaport enumeration.\n address[] memory enumeratedAllowedSeaport = new address[](1);\n enumeratedAllowedSeaport[0] = allowedSeaport;\n ERC1155SeaDropContractOffererStorage\n .layout()\n ._enumeratedAllowedSeaport = enumeratedAllowedSeaport;\n\n // Emit an event noting the contract deployment.\n emit SeaDropTokenDeployed(SEADROP_TOKEN_TYPE.ERC1155_CLONE);\n\n // Initialize ERC1155ContractMetadataCloneable.\n __ERC1155ContractMetadataCloneable_init(\n allowedConfigurer,\n name_,\n symbol_\n );\n }\n\n /**\n * @notice The fallback function is used as a dispatcher for SeaDrop\n * methods.\n */\n fallback(bytes calldata) external returns (bytes memory output) {\n // Get the function selector.\n bytes4 selector = msg.sig;\n\n // Get the rest of the msg data after the selector.\n bytes calldata data = msg.data[4:];\n\n // Determine if we should forward the call to the implementation\n // contract with SeaDrop logic.\n bool callSeaDropImplementation = selector ==\n ISeaDropToken.updateAllowedSeaport.selector ||\n selector == ISeaDropToken.updateDropURI.selector ||\n selector == ISeaDropToken.updateAllowList.selector ||\n selector == ISeaDropToken.updateCreatorPayouts.selector ||\n selector == ISeaDropToken.updatePayer.selector ||\n selector == ISeaDropToken.updateAllowedFeeRecipient.selector ||\n selector == ISeaDropToken.updateSigner.selector ||\n selector == IERC1155SeaDrop.updatePublicDrop.selector ||\n selector == ContractOffererInterface.previewOrder.selector ||\n selector == ContractOffererInterface.generateOrder.selector ||\n selector == ContractOffererInterface.getSeaportMetadata.selector ||\n selector == IERC1155SeaDrop.getPublicDrop.selector ||\n selector == IERC1155SeaDrop.getPublicDropIndexes.selector ||\n selector == ISeaDropToken.getAllowedSeaport.selector ||\n selector == ISeaDropToken.getCreatorPayouts.selector ||\n selector == ISeaDropToken.getAllowListMerkleRoot.selector ||\n selector == ISeaDropToken.getAllowedFeeRecipients.selector ||\n selector == ISeaDropToken.getSigners.selector ||\n selector == ISeaDropToken.getDigestIsUsed.selector ||\n selector == ISeaDropToken.getPayers.selector;\n\n // Determine if we should require only the owner or configurer calling.\n bool requireOnlyOwnerOrConfigurer = selector ==\n ISeaDropToken.updateAllowedSeaport.selector ||\n selector == ISeaDropToken.updateDropURI.selector ||\n selector == ISeaDropToken.updateAllowList.selector ||\n selector == ISeaDropToken.updateCreatorPayouts.selector ||\n selector == ISeaDropToken.updatePayer.selector ||\n selector == ISeaDropToken.updateAllowedFeeRecipient.selector ||\n selector == IERC1155SeaDrop.updatePublicDrop.selector;\n\n if (callSeaDropImplementation) {\n // For update calls, ensure the sender is only the owner\n // or configurer contract.\n if (requireOnlyOwnerOrConfigurer) {\n _onlyOwnerOrConfigurer();\n } else if (selector == ISeaDropToken.updateSigner.selector) {\n // For updateSigner, a signer can disallow themselves.\n // Get the signer parameter.\n address signer = address(bytes20(data[12:32]));\n // If the signer is not allowed, ensure sender is only owner\n // or configurer.\n if (\n msg.sender != signer ||\n (msg.sender == signer &&\n !ERC1155SeaDropContractOffererStorage\n .layout()\n ._allowedSigners[signer])\n ) {\n _onlyOwnerOrConfigurer();\n }\n }\n\n // Forward the call to the implementation contract.\n (bool success, bytes memory returnedData) = _CONFIGURER\n .delegatecall(msg.data);\n\n // Require that the call was successful.\n if (!success) {\n // Bubble up the revert reason.\n assembly {\n revert(add(32, returnedData), mload(returnedData))\n }\n }\n\n // If the call was to generateOrder, mint the tokens.\n if (selector == ContractOffererInterface.generateOrder.selector) {\n _mintOrder(data);\n }\n\n // Return the data from the delegate call.\n return returnedData;\n } else if (selector == IERC1155SeaDrop.getMintStats.selector) {\n // Get the minter and token id.\n (address minter, uint256 tokenId) = abi.decode(\n data,\n (address, uint256)\n );\n\n // Get the mint stats.\n (\n uint256 minterNumMinted,\n uint256 minterNumMintedForTokenId,\n uint256 totalMintedForTokenId,\n uint256 maxSupply\n ) = _getMintStats(minter, tokenId);\n\n // Encode the return data.\n return\n abi.encode(\n minterNumMinted,\n minterNumMintedForTokenId,\n totalMintedForTokenId,\n maxSupply\n );\n } else if (selector == ContractOffererInterface.ratifyOrder.selector) {\n // This function is a no-op, nothing additional needs to happen here.\n // Utilize assembly to efficiently return the ratifyOrder magic value.\n assembly {\n mstore(0, 0xf4dd92ce)\n return(0x1c, 32)\n }\n } else if (selector == ISeaDropToken.configurer.selector) {\n // Return the configurer contract.\n return abi.encode(_CONFIGURER);\n } else if (selector == IERC1155SeaDrop.multiConfigureMint.selector) {\n // Ensure only the owner or configurer can call this function.\n _onlyOwnerOrConfigurer();\n\n // Mint the tokens.\n _multiConfigureMint(data);\n } else {\n // Revert if the function selector is not supported.\n revert UnsupportedFunctionSelector(selector);\n }\n }\n\n /**\n * @notice Returns a set of mint stats for the address.\n * This assists in enforcing maxSupply, maxTotalMintableByWallet,\n * and maxTokenSupplyForStage checks.\n *\n * @dev NOTE: Implementing contracts should always update these numbers\n * before transferring any tokens with _safeMint() to mitigate\n * consequences of malicious onERC1155Received() hooks.\n *\n * @param minter The minter address.\n * @param tokenId The token id to return the stats for.\n */\n function _getMintStats(\n address minter,\n uint256 tokenId\n )\n internal\n view\n returns (\n uint256 minterNumMinted,\n uint256 minterNumMintedForTokenId,\n uint256 totalMintedForTokenId,\n uint256 maxSupply\n )\n {\n // Put the token supply on the stack.\n TokenSupply storage tokenSupply = _tokenSupply[tokenId];\n\n // Assign the return values.\n totalMintedForTokenId = tokenSupply.totalMinted;\n maxSupply = tokenSupply.maxSupply;\n minterNumMinted = _totalMintedByUser[minter];\n minterNumMintedForTokenId = _totalMintedByUserPerToken[minter][tokenId];\n }\n\n /**\n * @dev Handle ERC-1155 safeTransferFrom. If \"from\" is this contract,\n * the sender can only be Seaport or the conduit.\n *\n * @param from The address to transfer from.\n * @param to The address to transfer to.\n * @param id The token id to transfer.\n * @param amount The amount of tokens to transfer.\n * @param data The data to pass to the onERC1155Received hook.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) public virtual override {\n if (from == address(this)) {\n // Only Seaport or the conduit can use this function\n // when \"from\" is this contract.\n if (\n msg.sender != _CONDUIT &&\n !ERC1155SeaDropContractOffererStorage.layout()._allowedSeaport[\n msg.sender\n ]\n ) {\n revert InvalidCallerOnlyAllowedSeaport(msg.sender);\n }\n return;\n }\n\n ERC1155._safeTransfer(_by(), from, to, id, amount, data);\n }\n\n /**\n * @notice Returns whether the interface is supported.\n *\n * @param interfaceId The interface id to check against.\n */\n function supportsInterface(\n bytes4 interfaceId\n )\n public\n view\n virtual\n override(ERC1155ContractMetadataCloneable)\n returns (bool)\n {\n return\n interfaceId == type(IERC1155SeaDrop).interfaceId ||\n interfaceId == type(ContractOffererInterface).interfaceId ||\n interfaceId == 0x2e778efc || // SIP-5 (getSeaportMetadata)\n // ERC1155ContractMetadata returns supportsInterface true for\n // IERC1155ContractMetadata, ERC-4906, ERC-2981\n // ERC1155A returns supportsInterface true for\n // ERC165, ERC1155, ERC1155MetadataURI\n ERC1155ContractMetadataCloneable.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Internal function to mint tokens during a generateOrder call\n * from Seaport.\n *\n * @param data The original transaction calldata, without the selector.\n */\n function _mintOrder(bytes calldata data) internal {\n // Decode fulfiller, minimumReceived, and context from calldata.\n (\n address fulfiller,\n SpentItem[] memory minimumReceived,\n ,\n bytes memory context\n ) = abi.decode(data, (address, SpentItem[], SpentItem[], bytes));\n\n // Assign the minter from context[22:42]. We validate context has the\n // correct minimum length in the implementation's `_decodeOrder`.\n address minter;\n assembly {\n minter := shr(96, mload(add(add(context, 0x20), 22)))\n }\n\n // If the minter is the zero address, set it to the fulfiller.\n if (minter == address(0)) {\n minter = fulfiller;\n }\n\n // Set the token ids and quantities.\n uint256 minimumReceivedLength = minimumReceived.length;\n uint256[] memory tokenIds = new uint256[](minimumReceivedLength);\n uint256[] memory quantities = new uint256[](minimumReceivedLength);\n for (uint256 i = 0; i < minimumReceivedLength; ) {\n tokenIds[i] = minimumReceived[i].identifier;\n quantities[i] = minimumReceived[i].amount;\n unchecked {\n ++i;\n }\n }\n\n // Mint the tokens.\n _batchMint(minter, tokenIds, quantities, \"\");\n }\n\n /**\n * @dev Internal function to mint tokens during a multiConfigureMint call\n * from the configurer contract.\n *\n * @param data The original transaction calldata, without the selector.\n */\n function _multiConfigureMint(bytes calldata data) internal {\n // Decode the calldata.\n (\n address recipient,\n uint256[] memory tokenIds,\n uint256[] memory amounts\n ) = abi.decode(data, (address, uint256[], uint256[]));\n\n _batchMint(recipient, tokenIds, amounts, \"\");\n }\n}\n"
},
"src/interfaces/IERC1155SeaDrop.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { ISeaDropToken } from \"./ISeaDropToken.sol\";\n\nimport { PublicDrop } from \"../lib/ERC1155SeaDropStructs.sol\";\n\n/**\n * @dev A helper interface to get and set parameters for ERC1155SeaDrop.\n * The token does not expose these methods as part of its external\n * interface to optimize contract size, but does implement them.\n */\ninterface IERC1155SeaDrop is ISeaDropToken {\n /**\n * @notice Update the SeaDrop public drop parameters at a given index.\n *\n * @param publicDrop The new public drop parameters.\n * @param index The public drop index.\n */\n function updatePublicDrop(\n PublicDrop calldata publicDrop,\n uint256 index\n ) external;\n\n /**\n * @notice Returns the public drop stage parameters at a given index.\n *\n * @param index The index of the public drop stage.\n */\n function getPublicDrop(\n uint256 index\n ) external view returns (PublicDrop memory);\n\n /**\n * @notice Returns the public drop indexes.\n */\n function getPublicDropIndexes() external view returns (uint256[] memory);\n\n /**\n * @notice Returns a set of mint stats for the address.\n * This assists SeaDrop in enforcing maxSupply,\n * maxTotalMintableByWallet, maxTotalMintableByWalletPerToken,\n * and maxTokenSupplyForStage checks.\n *\n * @dev NOTE: Implementing contracts should always update these numbers\n * before transferring any tokens with _safeMint() to mitigate\n * consequences of malicious onERC1155Received() hooks.\n *\n * @param minter The minter address.\n * @param tokenId The token id to return stats for.\n */\n function getMintStats(\n address minter,\n uint256 tokenId\n )\n external\n view\n returns (\n uint256 minterNumMinted,\n uint256 minterNumMintedForTokenId,\n uint256 totalMintedForTokenId,\n uint256 maxSupply\n );\n\n /**\n * @notice This function is only allowed to be called by the configurer\n * contract as a way to batch mints and configuration in one tx.\n *\n * @param recipient The address to receive the mints.\n * @param tokenIds The tokenIds to mint.\n * @param amounts The amounts to mint.\n */\n function multiConfigureMint(\n address recipient,\n uint256[] calldata tokenIds,\n uint256[] calldata amounts\n ) external;\n}\n"
},
"src/interfaces/ISeaDropToken.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n ISeaDropTokenContractMetadata\n} from \"./ISeaDropTokenContractMetadata.sol\";\n\nimport { AllowListData, CreatorPayout } from \"../lib/SeaDropStructs.sol\";\n\n/**\n * @dev A helper base interface for IERC721SeaDrop and IERC1155SeaDrop.\n * The token does not expose these methods as part of its external\n * interface to optimize contract size, but does implement them.\n */\ninterface ISeaDropToken is ISeaDropTokenContractMetadata {\n /**\n * @notice Update the SeaDrop allowed Seaport contracts privileged to mint.\n * Only the owner can use this function.\n *\n * @param allowedSeaport The allowed Seaport addresses.\n */\n function updateAllowedSeaport(address[] calldata allowedSeaport) external;\n\n /**\n * @notice Update the SeaDrop allowed fee recipient.\n * Only the owner can use this function.\n *\n * @param feeRecipient The new fee recipient.\n * @param allowed Whether the fee recipient is allowed.\n */\n function updateAllowedFeeRecipient(\n address feeRecipient,\n bool allowed\n ) external;\n\n /**\n * @notice Update the SeaDrop creator payout addresses.\n * The total basis points must add up to exactly 10_000.\n * Only the owner can use this function.\n *\n * @param creatorPayouts The new creator payouts.\n */\n function updateCreatorPayouts(\n CreatorPayout[] calldata creatorPayouts\n ) external;\n\n /**\n * @notice Update the SeaDrop drop URI.\n * Only the owner can use this function.\n *\n * @param dropURI The new drop URI.\n */\n function updateDropURI(string calldata dropURI) external;\n\n /**\n * @notice Update the SeaDrop allow list data.\n * Only the owner can use this function.\n *\n * @param allowListData The new allow list data.\n */\n function updateAllowList(AllowListData calldata allowListData) external;\n\n /**\n * @notice Update the SeaDrop allowed payers.\n * Only the owner can use this function.\n *\n * @param payer The payer to update.\n * @param allowed Whether the payer is allowed.\n */\n function updatePayer(address payer, bool allowed) external;\n\n /**\n * @notice Update the SeaDrop allowed signer.\n * Only the owner can use this function.\n * An allowed signer can also disallow themselves.\n *\n * @param signer The signer to update.\n * @param allowed Whether the signer is allowed.\n */\n function updateSigner(address signer, bool allowed) external;\n\n /**\n * @notice Get the SeaDrop allowed Seaport contracts privileged to mint.\n */\n function getAllowedSeaport() external view returns (address[] memory);\n\n /**\n * @notice Returns the SeaDrop creator payouts.\n */\n function getCreatorPayouts() external view returns (CreatorPayout[] memory);\n\n /**\n * @notice Returns the SeaDrop allow list merkle root.\n */\n function getAllowListMerkleRoot() external view returns (bytes32);\n\n /**\n * @notice Returns the SeaDrop allowed fee recipients.\n */\n function getAllowedFeeRecipients() external view returns (address[] memory);\n\n /**\n * @notice Returns the SeaDrop allowed signers.\n */\n function getSigners() external view returns (address[] memory);\n\n /**\n * @notice Returns if the signed digest has been used.\n *\n * @param digest The digest hash.\n */\n function getDigestIsUsed(bytes32 digest) external view returns (bool);\n\n /**\n * @notice Returns the SeaDrop allowed payers.\n */\n function getPayers() external view returns (address[] memory);\n\n /**\n * @notice Returns the configurer contract.\n */\n function configurer() external view returns (address);\n}\n"
},
"src/clones/ERC1155ContractMetadataCloneable.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n IERC1155ContractMetadata\n} from \"../interfaces/IERC1155ContractMetadata.sol\";\n\nimport {\n ERC1155ConduitPreapproved\n} from \"../lib/ERC1155ConduitPreapproved.sol\";\n\nimport {\n ICreatorToken,\n ILegacyCreatorToken\n} from \"../interfaces/ICreatorToken.sol\";\n\nimport { ITransferValidator1155 } from \"../interfaces/ITransferValidator.sol\";\n\nimport { TokenTransferValidator } from \"../lib/TokenTransferValidator.sol\";\n\nimport { ERC1155 } from \"solady/src/tokens/ERC1155.sol\";\n\nimport { ERC2981 } from \"solady/src/tokens/ERC2981.sol\";\n\nimport { Ownable } from \"solady/src/auth/Ownable.sol\";\n\nimport {\n Initializable\n} from \"@openzeppelin-upgradeable/contracts/proxy/utils/Initializable.sol\";\n\n/**\n * @title ERC1155ContractMetadataCloneable\n * @author James Wenzel (emo.eth)\n * @author Ryan Ghods (ralxz.eth)\n * @author Stephan Min (stephanm.eth)\n * @author Michael Cohen (notmichael.eth)\n * @notice A cloneable token contract that extends ERC-1155\n * with additional metadata and ownership capabilities.\n */\ncontract ERC1155ContractMetadataCloneable is\n ERC1155ConduitPreapproved,\n TokenTransferValidator,\n ERC2981,\n Ownable,\n IERC1155ContractMetadata,\n Initializable\n{\n /// @notice A struct containing the token supply info per token id.\n mapping(uint256 => TokenSupply) _tokenSupply;\n\n /// @notice The total number of tokens minted by address.\n mapping(address => uint256) _totalMintedByUser;\n\n /// @notice The total number of tokens minted per token id by address.\n mapping(address => mapping(uint256 => uint256)) _totalMintedByUserPerToken;\n\n /// @notice The name of the token.\n string internal _name;\n\n /// @notice The symbol of the token.\n string internal _symbol;\n\n /// @notice The base URI for token metadata.\n string internal _baseURI;\n\n /// @notice The contract URI for contract metadata.\n string internal _contractURI;\n\n /// @notice The provenance hash for guaranteeing metadata order\n /// for random reveals.\n bytes32 internal _provenanceHash;\n\n /// @notice The allowed contract that can configure SeaDrop parameters.\n address internal _CONFIGURER;\n\n /**\n * @dev Reverts if the sender is not the owner or the allowed\n * configurer contract.\n *\n * This is used as a function instead of a modifier\n * to save contract space when used multiple times.\n */\n function _onlyOwnerOrConfigurer() internal view {\n if (msg.sender != _CONFIGURER && msg.sender != owner()) {\n revert Unauthorized();\n }\n }\n\n /**\n * @notice Deploy the token contract.\n *\n * @param allowedConfigurer The address of the contract allowed to\n * configure parameters. Also contains SeaDrop\n * implementation code.\n * @param name_ The name of the token.\n * @param symbol_ The symbol of the token.\n */\n function __ERC1155ContractMetadataCloneable_init(\n address allowedConfigurer,\n string memory name_,\n string memory symbol_\n ) internal onlyInitializing {\n // Set the name of the token.\n _name = name_;\n\n // Set the symbol of the token.\n _symbol = symbol_;\n\n // Set the allowed configurer contract to interact with this contract.\n _CONFIGURER = allowedConfigurer;\n }\n\n /**\n * @notice Sets the base URI for the token metadata and emits an event.\n *\n * @param newBaseURI The new base URI to set.\n */\n function setBaseURI(string calldata newBaseURI) external override {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Set the new base URI.\n _baseURI = newBaseURI;\n\n // Emit an event with the update.\n emit BatchMetadataUpdate(0, type(uint256).max);\n }\n\n /**\n * @notice Sets the contract URI for contract metadata.\n *\n * @param newContractURI The new contract URI.\n */\n function setContractURI(string calldata newContractURI) external override {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Set the new contract URI.\n _contractURI = newContractURI;\n\n // Emit an event with the update.\n emit ContractURIUpdated(newContractURI);\n }\n\n /**\n * @notice Emit an event notifying metadata updates for\n * a range of token ids, according to EIP-4906.\n *\n * @param fromTokenId The start token id.\n * @param toTokenId The end token id.\n */\n function emitBatchMetadataUpdate(\n uint256 fromTokenId,\n uint256 toTokenId\n ) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Emit an event with the update.\n if (fromTokenId == toTokenId) {\n // If only one token is being updated, use the event\n // in the 1155 spec.\n emit URI(uri(fromTokenId), fromTokenId);\n } else {\n emit BatchMetadataUpdate(fromTokenId, toTokenId);\n }\n }\n\n /**\n * @notice Sets the max token supply and emits an event.\n *\n * @param tokenId The token id to set the max supply for.\n * @param newMaxSupply The new max supply to set.\n */\n function setMaxSupply(uint256 tokenId, uint256 newMaxSupply) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Ensure the max supply does not exceed the maximum value of uint64,\n // a limit due to the storage of bit-packed variables in TokenSupply,\n if (newMaxSupply > 2 ** 64 - 1) {\n revert CannotExceedMaxSupplyOfUint64(newMaxSupply);\n }\n\n // Set the new max supply.\n _tokenSupply[tokenId].maxSupply = uint64(newMaxSupply);\n\n // Emit an event with the update.\n emit MaxSupplyUpdated(tokenId, newMaxSupply);\n }\n\n /**\n * @notice Sets the provenance hash and emits an event.\n *\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it has not been\n * modified after mint started.\n *\n * This function will revert if the provenance hash has already\n * been set, so be sure to carefully set it only once.\n *\n * @param newProvenanceHash The new provenance hash to set.\n */\n function setProvenanceHash(bytes32 newProvenanceHash) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Keep track of the old provenance hash for emitting with the event.\n bytes32 oldProvenanceHash = _provenanceHash;\n\n // Revert if the provenance hash has already been set.\n if (oldProvenanceHash != bytes32(0)) {\n revert ProvenanceHashCannotBeSetAfterAlreadyBeingSet();\n }\n\n // Set the new provenance hash.\n _provenanceHash = newProvenanceHash;\n\n // Emit an event with the update.\n emit ProvenanceHashUpdated(oldProvenanceHash, newProvenanceHash);\n }\n\n /**\n * @notice Sets the default royalty information.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator of 10_000 basis points.\n */\n function setDefaultRoyalty(address receiver, uint96 feeNumerator) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Set the default royalty.\n // ERC2981 implementation ensures feeNumerator <= feeDenominator\n // and receiver != address(0).\n _setDefaultRoyalty(receiver, feeNumerator);\n\n // Emit an event with the updated params.\n emit RoyaltyInfoUpdated(receiver, feeNumerator);\n }\n\n /**\n * @notice Returns the name of the token.\n */\n function name() external view returns (string memory) {\n return _name;\n }\n\n /**\n * @notice Returns the symbol of the token.\n */\n function symbol() external view returns (string memory) {\n return _symbol;\n }\n\n /**\n * @notice Returns the base URI for token metadata.\n */\n function baseURI() external view override returns (string memory) {\n return _baseURI;\n }\n\n /**\n * @notice Returns the contract URI for contract metadata.\n */\n function contractURI() external view override returns (string memory) {\n return _contractURI;\n }\n\n /**\n * @notice Returns the max token supply for a token id.\n */\n function maxSupply(uint256 tokenId) external view returns (uint256) {\n return _tokenSupply[tokenId].maxSupply;\n }\n\n /**\n * @notice Returns the total supply for a token id.\n */\n function totalSupply(uint256 tokenId) external view returns (uint256) {\n return _tokenSupply[tokenId].totalSupply;\n }\n\n /**\n * @notice Returns the total minted for a token id.\n */\n function totalMinted(uint256 tokenId) external view returns (uint256) {\n return _tokenSupply[tokenId].totalMinted;\n }\n\n /**\n * @notice Returns the provenance hash.\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it is unmodified\n * after mint has started.\n */\n function provenanceHash() external view override returns (bytes32) {\n return _provenanceHash;\n }\n\n /**\n * @notice Returns the URI for token metadata.\n *\n * This implementation returns the same URI for *all* token types.\n * It relies on the token type ID substitution mechanism defined\n * in the EIP to replace {id} with the token id.\n *\n * @custom:param tokenId The token id to get the URI for.\n */\n function uri(\n uint256 /* tokenId */\n ) public view virtual override returns (string memory) {\n // Return the base URI.\n return _baseURI;\n }\n\n /**\n * @notice Returns the transfer validation function used.\n */\n function getTransferValidationFunction()\n external\n pure\n returns (bytes4 functionSignature, bool isViewFunction)\n {\n functionSignature = ITransferValidator1155.validateTransfer.selector;\n isViewFunction = true;\n }\n\n /**\n * @notice Set the transfer validator. Only callable by the token owner.\n */\n function setTransferValidator(address newValidator) external onlyOwner {\n // Set the new transfer validator.\n _setTransferValidator(newValidator);\n }\n\n /// @dev Override this function to return true if `_beforeTokenTransfer` is used.\n function _useBeforeTokenTransfer() internal view virtual override returns (bool) {\n return true;\n }\n\n /**\n * @dev Hook that is called before any token transfer.\n * This includes minting and burning.\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory /* data */\n ) internal virtual override {\n if (from != address(0) && to != address(0)) {\n // Call the transfer validator if one is set.\n address transferValidator = _transferValidator;\n if (transferValidator != address(0)) {\n for (uint256 i = 0; i < ids.length; i++) {\n ITransferValidator1155(transferValidator).validateTransfer(\n msg.sender,\n from,\n to,\n ids[i],\n amounts[i]\n );\n }\n }\n }\n }\n\n /**\n * @notice Returns whether the interface is supported.\n *\n * @param interfaceId The interface id to check against.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155, ERC2981) returns (bool) {\n return\n interfaceId == type(IERC1155ContractMetadata).interfaceId ||\n interfaceId == type(ICreatorToken).interfaceId ||\n interfaceId == type(ILegacyCreatorToken).interfaceId ||\n interfaceId == 0x49064906 || // ERC-4906 (MetadataUpdate)\n ERC2981.supportsInterface(interfaceId) ||\n // ERC1155 returns supportsInterface true for\n // ERC165, ERC1155, ERC1155MetadataURI\n ERC1155.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Adds to the internal counters for a mint.\n *\n * @param to The address to mint to.\n * @param id The token id to mint.\n * @param amount The quantity to mint.\n * @param data The data to pass if receiver is a contract.\n */\n function _mint(\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual override {\n // Increment mint counts.\n _incrementMintCounts(to, id, amount);\n\n ERC1155._mint(to, id, amount, data);\n }\n\n /**\n * @dev Adds to the internal counters for a batch mint.\n *\n * @param to The address to mint to.\n * @param ids The token ids to mint.\n * @param amounts The quantities to mint.\n * @param data The data to pass if receiver is a contract.\n */\n function _batchMint(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual override {\n // Put ids length on the stack to save MLOADs.\n uint256 idsLength = ids.length;\n\n for (uint256 i = 0; i < idsLength; ) {\n // Increment mint counts.\n _incrementMintCounts(to, ids[i], amounts[i]);\n\n unchecked {\n ++i;\n }\n }\n\n ERC1155._batchMint(to, ids, amounts, data);\n }\n\n /**\n * @dev Subtracts from the internal counters for a burn.\n *\n * @param by The address calling the burn.\n * @param from The address to burn from.\n * @param id The token id to burn.\n * @param amount The amount to burn.\n */\n function _burn(\n address by,\n address from,\n uint256 id,\n uint256 amount\n ) internal virtual override {\n // Reduce the supply.\n _reduceSupplyOnBurn(id, amount);\n\n ERC1155._burn(by, from, id, amount);\n }\n\n /**\n * @dev Subtracts from the internal counters for a batch burn.\n *\n * @param by The address calling the burn.\n * @param from The address to burn from.\n * @param ids The token ids to burn.\n * @param amounts The amounts to burn.\n */\n function _batchBurn(\n address by,\n address from,\n uint256[] memory ids,\n uint256[] memory amounts\n ) internal virtual override {\n // Put ids length on the stack to save MLOADs.\n uint256 idsLength = ids.length;\n\n for (uint256 i = 0; i < idsLength; ) {\n // Reduce the supply.\n _reduceSupplyOnBurn(ids[i], amounts[i]);\n\n unchecked {\n ++i;\n }\n }\n\n ERC1155._batchBurn(by, from, ids, amounts);\n }\n\n function _reduceSupplyOnBurn(uint256 id, uint256 amount) internal {\n // Get the current token supply.\n TokenSupply storage tokenSupply = _tokenSupply[id];\n\n // Reduce the totalSupply.\n unchecked {\n tokenSupply.totalSupply -= uint64(amount);\n }\n }\n\n /**\n * @dev Internal function to increment mint counts.\n *\n * Note that this function does not check if the mint exceeds\n * maxSupply, which should be validated before this function is called.\n *\n * @param to The address to mint to.\n * @param id The token id to mint.\n * @param amount The quantity to mint.\n */\n function _incrementMintCounts(\n address to,\n uint256 id,\n uint256 amount\n ) internal {\n // Get the current token supply.\n TokenSupply storage tokenSupply = _tokenSupply[id];\n\n if (tokenSupply.totalMinted + amount > tokenSupply.maxSupply) {\n revert MintExceedsMaxSupply(\n tokenSupply.totalMinted + amount,\n tokenSupply.maxSupply\n );\n }\n\n // Increment supply and number minted.\n // Can be unchecked because maxSupply cannot be set to exceed uint64.\n unchecked {\n tokenSupply.totalSupply += uint64(amount);\n tokenSupply.totalMinted += uint64(amount);\n\n // Increment total minted by user.\n _totalMintedByUser[to] += amount;\n\n // Increment total minted by user per token.\n _totalMintedByUserPerToken[to][id] += amount;\n }\n }\n}\n"
},
"src/lib/ERC1155SeaDropContractOffererStorage.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { PublicDrop } from \"./ERC1155SeaDropStructs.sol\";\n\nimport { CreatorPayout } from \"./SeaDropStructs.sol\";\n\nlibrary ERC1155SeaDropContractOffererStorage {\n struct Layout {\n /// @notice The allowed Seaport addresses that can mint.\n mapping(address => bool) _allowedSeaport;\n /// @notice The enumerated allowed Seaport addresses.\n address[] _enumeratedAllowedSeaport;\n /// @notice The public drop data.\n mapping(uint256 => PublicDrop) _publicDrops;\n /// @notice The enumerated public drop indexes.\n uint256[] _enumeratedPublicDropIndexes;\n /// @notice The creator payout addresses and basis points.\n CreatorPayout[] _creatorPayouts;\n /// @notice The allow list merkle root.\n bytes32 _allowListMerkleRoot;\n /// @notice The allowed fee recipients.\n mapping(address => bool) _allowedFeeRecipients;\n /// @notice The enumerated allowed fee recipients.\n address[] _enumeratedFeeRecipients;\n /// @notice The allowed server-side signers.\n mapping(address => bool) _allowedSigners;\n /// @notice The enumerated allowed signers.\n address[] _enumeratedSigners;\n /// @notice The used signature digests.\n mapping(bytes32 => bool) _usedDigests;\n /// @notice The allowed payers.\n mapping(address => bool) _allowedPayers;\n /// @notice The enumerated allowed payers.\n address[] _enumeratedPayers;\n }\n\n bytes32 internal constant STORAGE_SLOT =\n bytes32(\n uint256(\n keccak256(\"contracts.storage.ERC1155SeaDropContractOfferer\")\n ) - 1\n );\n\n function layout() internal pure returns (Layout storage l) {\n bytes32 slot = STORAGE_SLOT;\n assembly {\n l.slot := slot\n }\n }\n}\n"
},
"src/lib/ERC1155SeaDropErrorsAndEvents.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { PublicDrop } from \"./ERC1155SeaDropStructs.sol\";\n\nimport { SeaDropErrorsAndEvents } from \"./SeaDropErrorsAndEvents.sol\";\n\ninterface ERC1155SeaDropErrorsAndEvents is SeaDropErrorsAndEvents {\n /**\n * @dev Revert with an error if an empty PublicDrop is provided\n * for an already-empty public drop.\n */\n error PublicDropStageNotPresent();\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the\n * max minted per wallet for a certain token id.\n */\n error MintQuantityExceedsMaxMintedPerWalletForTokenId(\n uint256 tokenId,\n uint256 total,\n uint256 allowed\n );\n\n /**\n * @dev Revert with an error if the target token id to mint is not within\n * the drop stage range.\n */\n error TokenIdNotWithinDropStageRange(\n uint256 tokenId,\n uint256 startTokenId,\n uint256 endTokenId\n );\n\n /**\n * @notice Revert with an error if the number of maxSupplyAmounts doesn't\n * match the number of maxSupplyTokenIds.\n */\n error MaxSupplyMismatch();\n\n /**\n * @notice Revert with an error if the number of mint tokenIds doesn't\n * match the number of mint amounts.\n */\n error MintAmountsMismatch();\n\n /**\n * @notice Revert with an error if the mint order offer contains\n * a duplicate tokenId.\n */\n error OfferContainsDuplicateTokenId(uint256 tokenId);\n\n /**\n * @dev Revert if the fromTokenId is greater than the toTokenId.\n */\n error InvalidFromAndToTokenId(uint256 fromTokenId, uint256 toTokenId);\n\n /**\n * @notice Revert with an error if the number of publicDropIndexes doesn't\n * match the number of publicDrops.\n */\n error PublicDropsMismatch();\n\n /**\n * @dev An event with updated public drop data.\n */\n event PublicDropUpdated(PublicDrop publicDrop, uint256 index);\n}\n"
},
"src/lib/ERC1155SeaDropStructs.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { AllowListData, CreatorPayout } from \"./SeaDropStructs.sol\";\n\n/**\n * @notice A struct defining public drop data.\n * Designed to fit efficiently in two storage slots.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n * @param paymentToken The payment token address. Null for\n * native token.\n * @param fromTokenId The start token id for the stage.\n * @param toTokenId The end token id for the stage.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed. (The limit for this field is\n * 2^16 - 1)\n * @param maxTotalMintableByWalletPerToken Maximum total number of mints a user\n * is allowed for the token id. (The limit for\n * this field is 2^16 - 1)\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n */\nstruct PublicDrop {\n // slot 1\n uint80 startPrice; // 80/512 bits\n uint80 endPrice; // 160/512 bits\n uint40 startTime; // 200/512 bits\n uint40 endTime; // 240/512 bits\n bool restrictFeeRecipients; // 248/512 bits\n // uint8 unused;\n\n // slot 2\n address paymentToken; // 408/512 bits\n uint24 fromTokenId; // 432/512 bits\n uint24 toTokenId; // 456/512 bits\n uint16 maxTotalMintableByWallet; // 472/512 bits\n uint16 maxTotalMintableByWalletPerToken; // 488/512 bits\n uint16 feeBps; // 504/512 bits\n}\n\n/**\n * @notice A struct defining mint params for an allow list.\n * An allow list leaf will be composed of `msg.sender` and\n * the following params.\n *\n * Note: Since feeBps is encoded in the leaf, backend should ensure\n * that feeBps is acceptable before generating a proof.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param paymentToken The payment token for the mint. Null for\n * native token.\n * @param fromTokenId The start token id for the stage.\n * @param toTokenId The end token id for the stage.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed.\n * @param maxTotalMintableByWalletPerToken Maximum total number of mints a user\n * is allowed for the token id.\n * @param maxTokenSupplyForStage The limit of token supply this stage can\n * mint within.\n * @param dropStageIndex The drop stage index to emit with the event\n * for analytical purposes. This should be\n * non-zero since the public mint emits with\n * index zero.\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct MintParams {\n uint256 startPrice;\n uint256 endPrice;\n uint256 startTime;\n uint256 endTime;\n address paymentToken;\n uint256 fromTokenId;\n uint256 toTokenId;\n uint256 maxTotalMintableByWallet;\n uint256 maxTotalMintableByWalletPerToken;\n uint256 maxTokenSupplyForStage;\n uint256 dropStageIndex; // non-zero\n uint256 feeBps;\n bool restrictFeeRecipients;\n}\n\n/**\n * @dev Struct containing internal SeaDrop implementation logic\n * mint details to avoid stack too deep.\n *\n * @param feeRecipient The fee recipient.\n * @param payer The payer of the mint.\n * @param minter The mint recipient.\n * @param tokenIds The tokenIds to mint.\n * @param quantities The number of tokens to mint per tokenId.\n * @param withEffects Whether to apply state changes of the mint.\n */\nstruct MintDetails {\n address feeRecipient;\n address payer;\n address minter;\n uint256[] tokenIds;\n uint256[] quantities;\n bool withEffects;\n}\n\n/**\n * @notice A struct to configure multiple contract options in one transaction.\n */\nstruct MultiConfigureStruct {\n uint256[] maxSupplyTokenIds;\n uint256[] maxSupplyAmounts;\n string baseURI;\n string contractURI;\n PublicDrop[] publicDrops;\n uint256[] publicDropsIndexes;\n string dropURI;\n AllowListData allowListData;\n CreatorPayout[] creatorPayouts;\n bytes32 provenanceHash;\n address[] allowedFeeRecipients;\n address[] disallowedFeeRecipients;\n address[] allowedPayers;\n address[] disallowedPayers;\n // Server-signed\n address[] allowedSigners;\n address[] disallowedSigners;\n // ERC-2981\n address royaltyReceiver;\n uint96 royaltyBps;\n // Mint\n address mintRecipient;\n uint256[] mintTokenIds;\n uint256[] mintAmounts;\n}\n"
},
"src/lib/SeaDropStructs.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\n/**\n * @notice A struct defining a creator payout address and basis points.\n *\n * @param payoutAddress The payout address.\n * @param basisPoints The basis points to pay out to the creator.\n * The total creator payouts must equal 10_000 bps.\n */\nstruct CreatorPayout {\n address payoutAddress;\n uint16 basisPoints;\n}\n\n/**\n * @notice A struct defining allow list data (for minting an allow list).\n *\n * @param merkleRoot The merkle root for the allow list.\n * @param publicKeyURIs If the allowListURI is encrypted, a list of URIs\n * pointing to the public keys. Empty if unencrypted.\n * @param allowListURI The URI for the allow list.\n */\nstruct AllowListData {\n bytes32 merkleRoot;\n string[] publicKeyURIs;\n string allowListURI;\n}\n"
},
"src/lib/ERC1155ConduitPreapproved.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { ERC1155 } from \"solady/src/tokens/ERC1155.sol\";\n\n/**\n * @title ERC1155ConduitPreapproved\n * @notice Solady's ERC1155 with the OpenSea conduit preapproved.\n */\nabstract contract ERC1155ConduitPreapproved is ERC1155 {\n /// @dev The canonical OpenSea conduit.\n address internal constant _CONDUIT =\n 0x1E0049783F008A0085193E00003D00cd54003c71;\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) public virtual override {\n _safeTransfer(_by(), from, to, id, amount, data);\n }\n\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) public virtual override {\n _safeBatchTransfer(_by(), from, to, ids, amounts, data);\n }\n\n function isApprovedForAll(\n address owner,\n address operator\n ) public view virtual override returns (bool) {\n if (operator == _CONDUIT) return true;\n return ERC1155.isApprovedForAll(owner, operator);\n }\n\n function _by() internal view virtual returns (address result) {\n assembly {\n // `msg.sender == _CONDUIT ? address(0) : msg.sender`.\n result := mul(iszero(eq(caller(), _CONDUIT)), caller())\n }\n }\n}\n"
},
"lib/solady/src/tokens/ERC1155.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Simple ERC1155 implementation.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC1155.sol)\n/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC1155.sol)\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/contracts/token/ERC1155/ERC1155.sol)\n///\n/// @dev Note:\n/// The ERC1155 standard allows for self-approvals.\n/// For performance, this implementation WILL NOT revert for such actions.\n/// Please add any checks with overrides if desired.\nabstract contract ERC1155 {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CUSTOM ERRORS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The lengths of the input arrays are not the same.\n error ArrayLengthsMismatch();\n\n /// @dev Cannot mint or transfer to the zero address.\n error TransferToZeroAddress();\n\n /// @dev The recipient's balance has overflowed.\n error AccountBalanceOverflow();\n\n /// @dev Insufficient balance.\n error InsufficientBalance();\n\n /// @dev Only the token owner or an approved account can manage the tokens.\n error NotOwnerNorApproved();\n\n /// @dev Cannot safely transfer to a contract that does not implement\n /// the ERC1155Receiver interface.\n error TransferToNonERC1155ReceiverImplementer();\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* EVENTS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Emitted when `amount` of token `id` is transferred\n /// from `from` to `to` by `operator`.\n event TransferSingle(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256 id,\n uint256 amount\n );\n\n /// @dev Emitted when `amounts` of token `ids` are transferred\n /// from `from` to `to` by `operator`.\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] amounts\n );\n\n /// @dev Emitted when `owner` enables or disables `operator` to manage all of their tokens.\n event ApprovalForAll(address indexed owner, address indexed operator, bool isApproved);\n\n /// @dev Emitted when the Uniform Resource Identifier (URI) for token `id`\n /// is updated to `value`. This event is not used in the base contract.\n /// You may need to emit this event depending on your URI logic.\n ///\n /// See: https://eips.ethereum.org/EIPS/eip-1155#metadata\n event URI(string value, uint256 indexed id);\n\n /// @dev `keccak256(bytes(\"TransferSingle(address,address,address,uint256,uint256)\"))`.\n uint256 private constant _TRANSFER_SINGLE_EVENT_SIGNATURE =\n 0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62;\n\n /// @dev `keccak256(bytes(\"TransferBatch(address,address,address,uint256[],uint256[])\"))`.\n uint256 private constant _TRANSFER_BATCH_EVENT_SIGNATURE =\n 0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb;\n\n /// @dev `keccak256(bytes(\"ApprovalForAll(address,address,bool)\"))`.\n uint256 private constant _APPROVAL_FOR_ALL_EVENT_SIGNATURE =\n 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* STORAGE */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The `ownerSlotSeed` of a given owner is given by.\n /// ```\n /// let ownerSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, owner))\n /// ```\n ///\n /// The balance slot of `owner` is given by.\n /// ```\n /// mstore(0x20, ownerSlotSeed)\n /// mstore(0x00, id)\n /// let balanceSlot := keccak256(0x00, 0x40)\n /// ```\n ///\n /// The operator approval slot of `owner` is given by.\n /// ```\n /// mstore(0x20, ownerSlotSeed)\n /// mstore(0x00, operator)\n /// let operatorApprovalSlot := keccak256(0x0c, 0x34)\n /// ```\n uint256 private constant _ERC1155_MASTER_SLOT_SEED = 0x9a31110384e0b0c9;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* ERC1155 METADATA */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the URI for token `id`.\n ///\n /// You can either return the same templated URI for all token IDs,\n /// (e.g. \"https://example.com/api/{id}.json\"),\n /// or return a unique URI for each `id`.\n ///\n /// See: https://eips.ethereum.org/EIPS/eip-1155#metadata\n function uri(uint256 id) public view virtual returns (string memory);\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* ERC1155 */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the amount of `id` owned by `owner`.\n function balanceOf(address owner, uint256 id) public view virtual returns (uint256 result) {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, owner)\n mstore(0x00, id)\n result := sload(keccak256(0x00, 0x40))\n }\n }\n\n /// @dev Returns whether `operator` is approved to manage the tokens of `owner`.\n function isApprovedForAll(address owner, address operator)\n public\n view\n virtual\n returns (bool result)\n {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, owner)\n mstore(0x00, operator)\n result := sload(keccak256(0x0c, 0x34))\n }\n }\n\n /// @dev Sets whether `operator` is approved to manage the tokens of the caller.\n ///\n /// Emits a {ApprovalForAll} event.\n function setApprovalForAll(address operator, bool isApproved) public virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Convert to 0 or 1.\n isApproved := iszero(iszero(isApproved))\n // Update the `isApproved` for (`msg.sender`, `operator`).\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, caller())\n mstore(0x00, operator)\n sstore(keccak256(0x0c, 0x34), isApproved)\n // Emit the {ApprovalForAll} event.\n mstore(0x00, isApproved)\n // forgefmt: disable-next-line\n log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), shr(96, shl(96, operator)))\n }\n }\n\n /// @dev Transfers `amount` of `id` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `from` must have at least `amount` of `id`.\n /// - If the caller is not `from`,\n /// it must be approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer.\n ///\n /// Emits a {Transfer} event.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) public virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from))\n let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to))\n mstore(0x20, fromSlotSeed)\n // Clear the upper 96 bits.\n from := shr(96, fromSlotSeed)\n to := shr(96, toSlotSeed)\n // Revert if `to` is the zero address.\n if iszero(to) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // If the caller is not `from`, do the authorization check.\n if iszero(eq(caller(), from)) {\n mstore(0x00, caller())\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x00, id)\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, toSlotSeed)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n // Emit a {TransferSingle} event.\n mstore(0x20, amount)\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), from, to)\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n // Do the {onERC1155Received} check if `to` is a smart contract.\n if extcodesize(to) {\n // Prepare the calldata.\n let m := mload(0x40)\n // `onERC1155Received(address,address,uint256,uint256,bytes)`.\n mstore(m, 0xf23a6e61)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), from)\n mstore(add(m, 0x60), id)\n mstore(add(m, 0x80), amount)\n mstore(add(m, 0xa0), 0xa0)\n calldatacopy(add(m, 0xc0), sub(data.offset, 0x20), add(0x20, data.length))\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, data.length), m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xf23a6e61))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n }\n\n /// @dev Transfers `amounts` of `ids` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `from` must have at least `amount` of `id`.\n /// - `ids` and `amounts` must have the same length.\n /// - If the caller is not `from`,\n /// it must be approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer.\n ///\n /// Emits a {TransferBatch} event.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) public virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(ids.length, amounts.length)) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from))\n let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to))\n mstore(0x20, fromSlotSeed)\n // Clear the upper 96 bits.\n from := shr(96, fromSlotSeed)\n to := shr(96, toSlotSeed)\n // Revert if `to` is the zero address.\n if iszero(to) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // If the caller is not `from`, do the authorization check.\n if iszero(eq(caller(), from)) {\n mstore(0x00, caller())\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Loop through all the `ids` and update the balances.\n {\n let end := shl(5, ids.length)\n for { let i := 0 } iszero(eq(i, end)) { i := add(i, 0x20) } {\n let amount := calldataload(add(amounts.offset, i))\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x20, fromSlotSeed)\n mstore(0x00, calldataload(add(ids.offset, i)))\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, toSlotSeed)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, ids.length))\n let o := add(m, 0x40)\n calldatacopy(o, sub(ids.offset, 0x20), n)\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, n))\n o := add(o, n)\n n := add(0x20, shl(5, amounts.length))\n calldatacopy(o, sub(amounts.offset, 0x20), n)\n n := sub(add(o, n), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), from, to)\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransferCalldata(from, to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n // Do the {onERC1155BatchReceived} check if `to` is a smart contract.\n if extcodesize(to) {\n let m := mload(0x40)\n // Prepare the calldata.\n // `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)`.\n mstore(m, 0xbc197c81)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), from)\n // Copy the `ids`.\n mstore(add(m, 0x60), 0xa0)\n let n := add(0x20, shl(5, ids.length))\n let o := add(m, 0xc0)\n calldatacopy(o, sub(ids.offset, 0x20), n)\n // Copy the `amounts`.\n let s := add(0xa0, n)\n mstore(add(m, 0x80), s)\n o := add(o, n)\n n := add(0x20, shl(5, amounts.length))\n calldatacopy(o, sub(amounts.offset, 0x20), n)\n // Copy the `data`.\n mstore(add(m, 0xa0), add(s, n))\n o := add(o, n)\n n := add(0x20, data.length)\n calldatacopy(o, sub(data.offset, 0x20), n)\n n := sub(add(o, n), add(m, 0x1c))\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), n, m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xbc197c81))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n }\n\n /// @dev Returns the amounts of `ids` for `owners.\n ///\n /// Requirements:\n /// - `owners` and `ids` must have the same length.\n function balanceOfBatch(address[] calldata owners, uint256[] calldata ids)\n public\n view\n virtual\n returns (uint256[] memory balances)\n {\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(ids.length, owners.length)) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n balances := mload(0x40)\n mstore(balances, ids.length)\n let o := add(balances, 0x20)\n let end := shl(5, ids.length)\n mstore(0x40, add(end, o))\n // Loop through all the `ids` and load the balances.\n for { let i := 0 } iszero(eq(i, end)) { i := add(i, 0x20) } {\n let owner := calldataload(add(owners.offset, i))\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, shl(96, owner)))\n mstore(0x00, calldataload(add(ids.offset, i)))\n mstore(add(o, i), sload(keccak256(0x00, 0x40)))\n }\n }\n }\n\n /// @dev Returns true if this contract implements the interface defined by `interfaceId`.\n /// See: https://eips.ethereum.org/EIPS/eip-165\n /// This function call must use less than 30000 gas.\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) {\n /// @solidity memory-safe-assembly\n assembly {\n let s := shr(224, interfaceId)\n // ERC165: 0x01ffc9a7, ERC1155: 0xd9b67a26, ERC1155MetadataURI: 0x0e89341c.\n result := or(or(eq(s, 0x01ffc9a7), eq(s, 0xd9b67a26)), eq(s, 0x0e89341c))\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL MINT FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Mints `amount` of `id` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer.\n ///\n /// Emits a {Transfer} event.\n function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(address(0), to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, to)\n mstore(0x00, id)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n // Emit a {TransferSingle} event.\n mstore(0x00, id)\n mstore(0x20, amount)\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), 0, shr(96, to_))\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(address(0), to, _single(id), _single(amount), data);\n }\n if (_hasCode(to)) _checkOnERC1155Received(address(0), to, id, amount, data);\n }\n\n /// @dev Mints `amounts` of `ids` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `ids` and `amounts` must have the same length.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer.\n ///\n /// Emits a {TransferBatch} event.\n function _batchMint(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(address(0), to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(mload(ids), mload(amounts))) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // Loop through all the `ids` and update the balances.\n {\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, to_))\n let end := shl(5, mload(ids))\n for { let i := 0 } iszero(eq(i, end)) {} {\n i := add(i, 0x20)\n let amount := mload(add(amounts, i))\n // Increase and store the updated balance of `to`.\n {\n mstore(0x00, mload(add(ids, i)))\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0x40)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n n := sub(add(o, returndatasize()), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), 0, shr(96, to_))\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(address(0), to, ids, amounts, data);\n }\n if (_hasCode(to)) _checkOnERC1155BatchReceived(address(0), to, ids, amounts, data);\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL BURN FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Equivalent to `_burn(address(0), from, id, amount)`.\n function _burn(address from, uint256 id, uint256 amount) internal virtual {\n _burn(address(0), from, id, amount);\n }\n\n /// @dev Destroys `amount` of `id` from `from`.\n ///\n /// Requirements:\n /// - `from` must have at least `amount` of `id`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n ///\n /// Emits a {Transfer} event.\n function _burn(address by, address from, uint256 id, uint256 amount) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, address(0), _single(id), _single(amount), \"\");\n }\n /// @solidity memory-safe-assembly\n assembly {\n let from_ := shl(96, from)\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_))\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n if iszero(or(iszero(shl(96, by)), eq(shl(96, by), from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Decrease and store the updated balance of `from`.\n {\n mstore(0x00, id)\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Emit a {TransferSingle} event.\n mstore(0x00, id)\n mstore(0x20, amount)\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), 0)\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, address(0), _single(id), _single(amount), \"\");\n }\n }\n\n /// @dev Equivalent to `_batchBurn(address(0), from, ids, amounts)`.\n function _batchBurn(address from, uint256[] memory ids, uint256[] memory amounts)\n internal\n virtual\n {\n _batchBurn(address(0), from, ids, amounts);\n }\n\n /// @dev Destroys `amounts` of `ids` from `from`.\n ///\n /// Requirements:\n /// - `ids` and `amounts` must have the same length.\n /// - `from` must have at least `amounts` of `ids`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n ///\n /// Emits a {TransferBatch} event.\n function _batchBurn(address by, address from, uint256[] memory ids, uint256[] memory amounts)\n internal\n virtual\n {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, address(0), ids, amounts, \"\");\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(mload(ids), mload(amounts))) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let from_ := shl(96, from)\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_))\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n let by_ := shl(96, by)\n if iszero(or(iszero(by_), eq(by_, from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Loop through all the `ids` and update the balances.\n {\n let end := shl(5, mload(ids))\n for { let i := 0 } iszero(eq(i, end)) {} {\n i := add(i, 0x20)\n let amount := mload(add(amounts, i))\n // Decrease and store the updated balance of `to`.\n {\n mstore(0x00, mload(add(ids, i)))\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0x40)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n n := sub(add(o, returndatasize()), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), 0)\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, address(0), ids, amounts, \"\");\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL APPROVAL FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Approve or remove the `operator` as an operator for `by`,\n /// without authorization checks.\n ///\n /// Emits a {ApprovalForAll} event.\n function _setApprovalForAll(address by, address operator, bool isApproved) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Convert to 0 or 1.\n isApproved := iszero(iszero(isApproved))\n // Update the `isApproved` for (`by`, `operator`).\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, by)\n mstore(0x00, operator)\n sstore(keccak256(0x0c, 0x34), isApproved)\n // Emit the {ApprovalForAll} event.\n mstore(0x00, isApproved)\n let m := shr(96, not(0))\n log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, and(m, by), and(m, operator))\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL TRANSFER FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Equivalent to `_safeTransfer(address(0), from, to, id, amount, data)`.\n function _safeTransfer(address from, address to, uint256 id, uint256 amount, bytes memory data)\n internal\n virtual\n {\n _safeTransfer(address(0), from, to, id, amount, data);\n }\n\n /// @dev Transfers `amount` of `id` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `from` must have at least `amount` of `id`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer.\n ///\n /// Emits a {Transfer} event.\n function _safeTransfer(\n address by,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n let from_ := shl(96, from)\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_))\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n let by_ := shl(96, by)\n if iszero(or(iszero(by_), eq(by_, from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x00, id)\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, to_))\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n // Emit a {TransferSingle} event.\n mstore(0x20, amount)\n // forgefmt: disable-next-line\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_))\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n if (_hasCode(to)) _checkOnERC1155Received(from, to, id, amount, data);\n }\n\n /// @dev Equivalent to `_safeBatchTransfer(address(0), from, to, ids, amounts, data)`.\n function _safeBatchTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n _safeBatchTransfer(address(0), from, to, ids, amounts, data);\n }\n\n /// @dev Transfers `amounts` of `ids` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `ids` and `amounts` must have the same length.\n /// - `from` must have at least `amounts` of `ids`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer.\n ///\n /// Emits a {TransferBatch} event.\n function _safeBatchTransfer(\n address by,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(mload(ids), mload(amounts))) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let from_ := shl(96, from)\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, from_)\n let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, to_)\n mstore(0x20, fromSlotSeed)\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n let by_ := shl(96, by)\n if iszero(or(iszero(by_), eq(by_, from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Loop through all the `ids` and update the balances.\n {\n let end := shl(5, mload(ids))\n for { let i := 0 } iszero(eq(i, end)) {} {\n i := add(i, 0x20)\n let amount := mload(add(amounts, i))\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x20, fromSlotSeed)\n mstore(0x00, mload(add(ids, i)))\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, toSlotSeed)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0x40)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n n := sub(add(o, returndatasize()), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_))\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, ids, amounts, data);\n }\n if (_hasCode(to)) _checkOnERC1155BatchReceived(from, to, ids, amounts, data);\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* HOOKS FOR OVERRIDING */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Override this function to return true if `_beforeTokenTransfer` is used.\n /// The is to help the compiler avoid producing dead bytecode.\n function _useBeforeTokenTransfer() internal view virtual returns (bool) {\n return false;\n }\n\n /// @dev Hook that is called before any token transfer.\n /// This includes minting and burning, as well as batched variants.\n ///\n /// The same hook is called on both single and batched variants.\n /// For single transfers, the length of the `id` and `amount` arrays are 1.\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n /// @dev Override this function to return true if `_afterTokenTransfer` is used.\n /// The is to help the compiler avoid producing dead bytecode.\n function _useAfterTokenTransfer() internal view virtual returns (bool) {\n return false;\n }\n\n /// @dev Hook that is called after any token transfer.\n /// This includes minting and burning, as well as batched variants.\n ///\n /// The same hook is called on both single and batched variants.\n /// For single transfers, the length of the `id` and `amount` arrays are 1.\n function _afterTokenTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* PRIVATE HELPERS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Helper for calling the `_afterTokenTransfer` hook.\n /// The is to help the compiler avoid producing dead bytecode.\n function _afterTokenTransferCalldata(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) private {\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, ids, amounts, data);\n }\n }\n\n /// @dev Returns if `a` has bytecode of non-zero length.\n function _hasCode(address a) private view returns (bool result) {\n /// @solidity memory-safe-assembly\n assembly {\n result := extcodesize(a) // Can handle dirty upper bits.\n }\n }\n\n /// @dev Perform a call to invoke {IERC1155Receiver-onERC1155Received} on `to`.\n /// Reverts if the target does not support the function correctly.\n function _checkOnERC1155Received(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n /// @solidity memory-safe-assembly\n assembly {\n // Prepare the calldata.\n let m := mload(0x40)\n // `onERC1155Received(address,address,uint256,uint256,bytes)`.\n mstore(m, 0xf23a6e61)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), shr(96, shl(96, from)))\n mstore(add(m, 0x60), id)\n mstore(add(m, 0x80), amount)\n mstore(add(m, 0xa0), 0xa0)\n let n := mload(data)\n mstore(add(m, 0xc0), n)\n if n { pop(staticcall(gas(), 4, add(data, 0x20), n, add(m, 0xe0), n)) }\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, n), m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xf23a6e61))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n\n /// @dev Perform a call to invoke {IERC1155Receiver-onERC1155BatchReceived} on `to`.\n /// Reverts if the target does not support the function correctly.\n function _checkOnERC1155BatchReceived(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n /// @solidity memory-safe-assembly\n assembly {\n // Prepare the calldata.\n let m := mload(0x40)\n // `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)`.\n mstore(m, 0xbc197c81)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), shr(96, shl(96, from)))\n // Copy the `ids`.\n mstore(add(m, 0x60), 0xa0)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0xc0)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n let s := add(0xa0, returndatasize())\n mstore(add(m, 0x80), s)\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n // Copy the `data`.\n mstore(add(m, 0xa0), add(s, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, mload(data))\n pop(staticcall(gas(), 4, data, n, o, n))\n n := sub(add(o, returndatasize()), add(m, 0x1c))\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), n, m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xbc197c81))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n\n /// @dev Returns `x` in an array with a single element.\n function _single(uint256 x) private pure returns (uint256[] memory result) {\n assembly {\n result := mload(0x40)\n mstore(0x40, add(result, 0x40))\n mstore(result, 1)\n mstore(add(result, 0x20), x)\n }\n }\n}\n"
},
"lib/seaport/lib/seaport-types/src/lib/ConsiderationStructs.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {\n BasicOrderType,\n ItemType,\n OrderType,\n Side\n} from \"./ConsiderationEnums.sol\";\n\nimport {\n CalldataPointer,\n MemoryPointer\n} from \"../helpers/PointerLibraries.sol\";\n\n/**\n * @dev An order contains eleven components: an offerer, a zone (or account that\n * can cancel the order or restrict who can fulfill the order depending on\n * the type), the order type (specifying partial fill support as well as\n * restricted order status), the start and end time, a hash that will be\n * provided to the zone when validating restricted orders, a salt, a key\n * corresponding to a given conduit, a counter, and an arbitrary number of\n * offer items that can be spent along with consideration items that must\n * be received by their respective recipient.\n */\nstruct OrderComponents {\n address offerer;\n address zone;\n OfferItem[] offer;\n ConsiderationItem[] consideration;\n OrderType orderType;\n uint256 startTime;\n uint256 endTime;\n bytes32 zoneHash;\n uint256 salt;\n bytes32 conduitKey;\n uint256 counter;\n}\n\n/**\n * @dev An offer item has five components: an item type (ETH or other native\n * tokens, ERC20, ERC721, and ERC1155, as well as criteria-based ERC721 and\n * ERC1155), a token address, a dual-purpose \"identifierOrCriteria\"\n * component that will either represent a tokenId or a merkle root\n * depending on the item type, and a start and end amount that support\n * increasing or decreasing amounts over the duration of the respective\n * order.\n */\nstruct OfferItem {\n ItemType itemType;\n address token;\n uint256 identifierOrCriteria;\n uint256 startAmount;\n uint256 endAmount;\n}\n\n/**\n * @dev A consideration item has the same five components as an offer item and\n * an additional sixth component designating the required recipient of the\n * item.\n */\nstruct ConsiderationItem {\n ItemType itemType;\n address token;\n uint256 identifierOrCriteria;\n uint256 startAmount;\n uint256 endAmount;\n address payable recipient;\n}\n\n/**\n * @dev A spent item is translated from a utilized offer item and has four\n * components: an item type (ETH or other native tokens, ERC20, ERC721, and\n * ERC1155), a token address, a tokenId, and an amount.\n */\nstruct SpentItem {\n ItemType itemType;\n address token;\n uint256 identifier;\n uint256 amount;\n}\n\n/**\n * @dev A received item is translated from a utilized consideration item and has\n * the same four components as a spent item, as well as an additional fifth\n * component designating the required recipient of the item.\n */\nstruct ReceivedItem {\n ItemType itemType;\n address token;\n uint256 identifier;\n uint256 amount;\n address payable recipient;\n}\n\n/**\n * @dev For basic orders involving ETH / native / ERC20 <=> ERC721 / ERC1155\n * matching, a group of six functions may be called that only requires a\n * subset of the usual order arguments. Note the use of a \"basicOrderType\"\n * enum; this represents both the usual order type as well as the \"route\"\n * of the basic order (a simple derivation function for the basic order\n * type is `basicOrderType = orderType + (4 * basicOrderRoute)`.)\n */\nstruct BasicOrderParameters {\n // calldata offset\n address considerationToken; // 0x24\n uint256 considerationIdentifier; // 0x44\n uint256 considerationAmount; // 0x64\n address payable offerer; // 0x84\n address zone; // 0xa4\n address offerToken; // 0xc4\n uint256 offerIdentifier; // 0xe4\n uint256 offerAmount; // 0x104\n BasicOrderType basicOrderType; // 0x124\n uint256 startTime; // 0x144\n uint256 endTime; // 0x164\n bytes32 zoneHash; // 0x184\n uint256 salt; // 0x1a4\n bytes32 offererConduitKey; // 0x1c4\n bytes32 fulfillerConduitKey; // 0x1e4\n uint256 totalOriginalAdditionalRecipients; // 0x204\n AdditionalRecipient[] additionalRecipients; // 0x224\n bytes signature; // 0x244\n // Total length, excluding dynamic array data: 0x264 (580)\n}\n\n/**\n * @dev Basic orders can supply any number of additional recipients, with the\n * implied assumption that they are supplied from the offered ETH (or other\n * native token) or ERC20 token for the order.\n */\nstruct AdditionalRecipient {\n uint256 amount;\n address payable recipient;\n}\n\n/**\n * @dev The full set of order components, with the exception of the counter,\n * must be supplied when fulfilling more sophisticated orders or groups of\n * orders. The total number of original consideration items must also be\n * supplied, as the caller may specify additional consideration items.\n */\nstruct OrderParameters {\n address offerer; // 0x00\n address zone; // 0x20\n OfferItem[] offer; // 0x40\n ConsiderationItem[] consideration; // 0x60\n OrderType orderType; // 0x80\n uint256 startTime; // 0xa0\n uint256 endTime; // 0xc0\n bytes32 zoneHash; // 0xe0\n uint256 salt; // 0x100\n bytes32 conduitKey; // 0x120\n uint256 totalOriginalConsiderationItems; // 0x140\n // offer.length // 0x160\n}\n\n/**\n * @dev Orders require a signature in addition to the other order parameters.\n */\nstruct Order {\n OrderParameters parameters;\n bytes signature;\n}\n\n/**\n * @dev Advanced orders include a numerator (i.e. a fraction to attempt to fill)\n * and a denominator (the total size of the order) in addition to the\n * signature and other order parameters. It also supports an optional field\n * for supplying extra data; this data will be provided to the zone if the\n * order type is restricted and the zone is not the caller, or will be\n * provided to the offerer as context for contract order types.\n */\nstruct AdvancedOrder {\n OrderParameters parameters;\n uint120 numerator;\n uint120 denominator;\n bytes signature;\n bytes extraData;\n}\n\n/**\n * @dev Orders can be validated (either explicitly via `validate`, or as a\n * consequence of a full or partial fill), specifically cancelled (they can\n * also be cancelled in bulk via incrementing a per-zone counter), and\n * partially or fully filled (with the fraction filled represented by a\n * numerator and denominator).\n */\nstruct OrderStatus {\n bool isValidated;\n bool isCancelled;\n uint120 numerator;\n uint120 denominator;\n}\n\n/**\n * @dev A criteria resolver specifies an order, side (offer vs. consideration),\n * and item index. It then provides a chosen identifier (i.e. tokenId)\n * alongside a merkle proof demonstrating the identifier meets the required\n * criteria.\n */\nstruct CriteriaResolver {\n uint256 orderIndex;\n Side side;\n uint256 index;\n uint256 identifier;\n bytes32[] criteriaProof;\n}\n\n/**\n * @dev A fulfillment is applied to a group of orders. It decrements a series of\n * offer and consideration items, then generates a single execution\n * element. A given fulfillment can be applied to as many offer and\n * consideration items as desired, but must contain at least one offer and\n * at least one consideration that match. The fulfillment must also remain\n * consistent on all key parameters across all offer items (same offerer,\n * token, type, tokenId, and conduit preference) as well as across all\n * consideration items (token, type, tokenId, and recipient).\n */\nstruct Fulfillment {\n FulfillmentComponent[] offerComponents;\n FulfillmentComponent[] considerationComponents;\n}\n\n/**\n * @dev Each fulfillment component contains one index referencing a specific\n * order and another referencing a specific offer or consideration item.\n */\nstruct FulfillmentComponent {\n uint256 orderIndex;\n uint256 itemIndex;\n}\n\n/**\n * @dev An execution is triggered once all consideration items have been zeroed\n * out. It sends the item in question from the offerer to the item's\n * recipient, optionally sourcing approvals from either this contract\n * directly or from the offerer's chosen conduit if one is specified. An\n * execution is not provided as an argument, but rather is derived via\n * orders, criteria resolvers, and fulfillments (where the total number of\n * executions will be less than or equal to the total number of indicated\n * fulfillments) and returned as part of `matchOrders`.\n */\nstruct Execution {\n ReceivedItem item;\n address offerer;\n bytes32 conduitKey;\n}\n\n/**\n * @dev Restricted orders are validated post-execution by calling validateOrder\n * on the zone. This struct provides context about the order fulfillment\n * and any supplied extraData, as well as all order hashes fulfilled in a\n * call to a match or fulfillAvailable method.\n */\nstruct ZoneParameters {\n bytes32 orderHash;\n address fulfiller;\n address offerer;\n SpentItem[] offer;\n ReceivedItem[] consideration;\n bytes extraData;\n bytes32[] orderHashes;\n uint256 startTime;\n uint256 endTime;\n bytes32 zoneHash;\n}\n\n/**\n * @dev Zones and contract offerers can communicate which schemas they implement\n * along with any associated metadata related to each schema.\n */\nstruct Schema {\n uint256 id;\n bytes metadata;\n}\n\nusing StructPointers for OrderComponents global;\nusing StructPointers for OfferItem global;\nusing StructPointers for ConsiderationItem global;\nusing StructPointers for SpentItem global;\nusing StructPointers for ReceivedItem global;\nusing StructPointers for BasicOrderParameters global;\nusing StructPointers for AdditionalRecipient global;\nusing StructPointers for OrderParameters global;\nusing StructPointers for Order global;\nusing StructPointers for AdvancedOrder global;\nusing StructPointers for OrderStatus global;\nusing StructPointers for CriteriaResolver global;\nusing StructPointers for Fulfillment global;\nusing StructPointers for FulfillmentComponent global;\nusing StructPointers for Execution global;\nusing StructPointers for ZoneParameters global;\n\n/**\n * @dev This library provides a set of functions for converting structs to\n * pointers.\n */\nlibrary StructPointers {\n /**\n * @dev Get a MemoryPointer from OrderComponents.\n *\n * @param obj The OrderComponents object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OrderComponents memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OrderComponents.\n *\n * @param obj The OrderComponents object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OrderComponents calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from OfferItem.\n *\n * @param obj The OfferItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OfferItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OfferItem.\n *\n * @param obj The OfferItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OfferItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from ConsiderationItem.\n *\n * @param obj The ConsiderationItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n ConsiderationItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from ConsiderationItem.\n *\n * @param obj The ConsiderationItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n ConsiderationItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from SpentItem.\n *\n * @param obj The SpentItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n SpentItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from SpentItem.\n *\n * @param obj The SpentItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n SpentItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from ReceivedItem.\n *\n * @param obj The ReceivedItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n ReceivedItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from ReceivedItem.\n *\n * @param obj The ReceivedItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n ReceivedItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from BasicOrderParameters.\n *\n * @param obj The BasicOrderParameters object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n BasicOrderParameters memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from BasicOrderParameters.\n *\n * @param obj The BasicOrderParameters object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n BasicOrderParameters calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from AdditionalRecipient.\n *\n * @param obj The AdditionalRecipient object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n AdditionalRecipient memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from AdditionalRecipient.\n *\n * @param obj The AdditionalRecipient object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n AdditionalRecipient calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from OrderParameters.\n *\n * @param obj The OrderParameters object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OrderParameters memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OrderParameters.\n *\n * @param obj The OrderParameters object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OrderParameters calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from Order.\n *\n * @param obj The Order object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n Order memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from Order.\n *\n * @param obj The Order object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n Order calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from AdvancedOrder.\n *\n * @param obj The AdvancedOrder object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n AdvancedOrder memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from AdvancedOrder.\n *\n * @param obj The AdvancedOrder object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n AdvancedOrder calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from OrderStatus.\n *\n * @param obj The OrderStatus object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OrderStatus memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OrderStatus.\n *\n * @param obj The OrderStatus object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OrderStatus calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from CriteriaResolver.\n *\n * @param obj The CriteriaResolver object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n CriteriaResolver memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from CriteriaResolver.\n *\n * @param obj The CriteriaResolver object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n CriteriaResolver calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from Fulfillment.\n *\n * @param obj The Fulfillment object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n Fulfillment memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from Fulfillment.\n *\n * @param obj The Fulfillment object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n Fulfillment calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from FulfillmentComponent.\n *\n * @param obj The FulfillmentComponent object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n FulfillmentComponent memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from FulfillmentComponent.\n *\n * @param obj The FulfillmentComponent object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n FulfillmentComponent calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from Execution.\n *\n * @param obj The Execution object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n Execution memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from Execution.\n *\n * @param obj The Execution object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n Execution calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from ZoneParameters.\n *\n * @param obj The ZoneParameters object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n ZoneParameters memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from ZoneParameters.\n *\n * @param obj The ZoneParameters object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n ZoneParameters calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n}\n"
},
"lib/seaport/lib/seaport-types/src/interfaces/ContractOffererInterface.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {ReceivedItem, Schema, SpentItem} from \"../lib/ConsiderationStructs.sol\";\nimport {IERC165} from \"../interfaces/IERC165.sol\";\n\n/**\n * @title ContractOffererInterface\n * @notice Contains the minimum interfaces needed to interact with a contract\n * offerer.\n */\ninterface ContractOffererInterface is IERC165 {\n /**\n * @dev Generates an order with the specified minimum and maximum spent\n * items, and optional context (supplied as extraData).\n *\n * @param fulfiller The address of the fulfiller.\n * @param minimumReceived The minimum items that the caller is willing to\n * receive.\n * @param maximumSpent The maximum items the caller is willing to spend.\n * @param context Additional context of the order.\n *\n * @return offer A tuple containing the offer items.\n * @return consideration A tuple containing the consideration items.\n */\n function generateOrder(\n address fulfiller,\n SpentItem[] calldata minimumReceived,\n SpentItem[] calldata maximumSpent,\n bytes calldata context // encoded based on the schemaID\n ) external returns (SpentItem[] memory offer, ReceivedItem[] memory consideration);\n\n /**\n * @dev Ratifies an order with the specified offer, consideration, and\n * optional context (supplied as extraData).\n *\n * @param offer The offer items.\n * @param consideration The consideration items.\n * @param context Additional context of the order.\n * @param orderHashes The hashes to ratify.\n * @param contractNonce The nonce of the contract.\n *\n * @return ratifyOrderMagicValue The magic value returned by the contract\n * offerer.\n */\n function ratifyOrder(\n SpentItem[] calldata offer,\n ReceivedItem[] calldata consideration,\n bytes calldata context, // encoded based on the schemaID\n bytes32[] calldata orderHashes,\n uint256 contractNonce\n ) external returns (bytes4 ratifyOrderMagicValue);\n\n /**\n * @dev View function to preview an order generated in response to a minimum\n * set of received items, maximum set of spent items, and context\n * (supplied as extraData).\n *\n * @param caller The address of the caller (e.g. Seaport).\n * @param fulfiller The address of the fulfiller (e.g. the account\n * calling Seaport).\n * @param minimumReceived The minimum items that the caller is willing to\n * receive.\n * @param maximumSpent The maximum items the caller is willing to spend.\n * @param context Additional context of the order.\n *\n * @return offer A tuple containing the offer items.\n * @return consideration A tuple containing the consideration items.\n */\n function previewOrder(\n address caller,\n address fulfiller,\n SpentItem[] calldata minimumReceived,\n SpentItem[] calldata maximumSpent,\n bytes calldata context // encoded based on the schemaID\n ) external view returns (SpentItem[] memory offer, ReceivedItem[] memory consideration);\n\n /**\n * @dev Gets the metadata for this contract offerer.\n *\n * @return name The name of the contract offerer.\n * @return schemas The schemas supported by the contract offerer.\n */\n function getSeaportMetadata() external view returns (string memory name, Schema[] memory schemas); // map to Seaport Improvement Proposal IDs\n\n function supportsInterface(bytes4 interfaceId) external view override returns (bool);\n\n // Additional functions and/or events based on implemented schemaIDs\n}\n"
},
"lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.19;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
},
"src/interfaces/ISeaDropTokenContractMetadata.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\ninterface ISeaDropTokenContractMetadata {\n /**\n * @dev Emit an event for token metadata reveals/updates,\n * according to EIP-4906.\n *\n * @param _fromTokenId The start token id.\n * @param _toTokenId The end token id.\n */\n event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);\n\n /**\n * @dev Emit an event when the URI for the collection-level metadata\n * is updated.\n */\n event ContractURIUpdated(string newContractURI);\n\n /**\n * @dev Emit an event with the previous and new provenance hash after\n * being updated.\n */\n event ProvenanceHashUpdated(bytes32 previousHash, bytes32 newHash);\n\n /**\n * @dev Emit an event when the EIP-2981 royalty info is updated.\n */\n event RoyaltyInfoUpdated(address receiver, uint256 basisPoints);\n\n /**\n * @notice Throw if the max supply exceeds uint64, a limit\n * due to the storage of bit-packed variables.\n */\n error CannotExceedMaxSupplyOfUint64(uint256 got);\n\n /**\n * @dev Revert with an error when attempting to set the provenance\n * hash after the mint has started.\n */\n error ProvenanceHashCannotBeSetAfterMintStarted();\n\n /**\n * @dev Revert with an error when attempting to set the provenance\n * hash after it has already been set.\n */\n error ProvenanceHashCannotBeSetAfterAlreadyBeingSet();\n\n /**\n * @notice Sets the base URI for the token metadata and emits an event.\n *\n * @param tokenURI The new base URI to set.\n */\n function setBaseURI(string calldata tokenURI) external;\n\n /**\n * @notice Sets the contract URI for contract metadata.\n *\n * @param newContractURI The new contract URI.\n */\n function setContractURI(string calldata newContractURI) external;\n\n /**\n * @notice Sets the provenance hash and emits an event.\n *\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it has not been\n * modified after mint started.\n *\n * This function will revert after the first item has been minted.\n *\n * @param newProvenanceHash The new provenance hash to set.\n */\n function setProvenanceHash(bytes32 newProvenanceHash) external;\n\n /**\n * @notice Sets the default royalty information.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator of\n * 10_000 basis points.\n */\n function setDefaultRoyalty(address receiver, uint96 feeNumerator) external;\n\n /**\n * @notice Returns the base URI for token metadata.\n */\n function baseURI() external view returns (string memory);\n\n /**\n * @notice Returns the contract URI.\n */\n function contractURI() external view returns (string memory);\n\n /**\n * @notice Returns the provenance hash.\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it is unmodified\n * after mint has started.\n */\n function provenanceHash() external view returns (bytes32);\n}\n"
},
"src/interfaces/IERC1155ContractMetadata.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n ISeaDropTokenContractMetadata\n} from \"./ISeaDropTokenContractMetadata.sol\";\n\ninterface IERC1155ContractMetadata is ISeaDropTokenContractMetadata {\n /**\n * @dev A struct representing the supply info for a token id,\n * packed into one storage slot.\n *\n * @param maxSupply The max supply for the token id.\n * @param totalSupply The total token supply for the token id.\n * Subtracted when an item is burned.\n * @param totalMinted The total number of tokens minted for the token id.\n */\n struct TokenSupply {\n uint64 maxSupply; // 64/256 bits\n uint64 totalSupply; // 128/256 bits\n uint64 totalMinted; // 192/256 bits\n }\n\n /**\n * @dev Emit an event when the max token supply for a token id is updated.\n */\n event MaxSupplyUpdated(uint256 tokenId, uint256 newMaxSupply);\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max token\n * supply.\n */\n error MintExceedsMaxSupply(uint256 total, uint256 maxSupply);\n\n /**\n * @notice Sets the max supply for a token id and emits an event.\n *\n * @param tokenId The token id to set the max supply for.\n * @param newMaxSupply The new max supply to set.\n */\n function setMaxSupply(uint256 tokenId, uint256 newMaxSupply) external;\n\n /**\n * @notice Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @notice Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @notice Returns the max token supply for a token id.\n */\n function maxSupply(uint256 tokenId) external view returns (uint256);\n\n /**\n * @notice Returns the total supply for a token id.\n */\n function totalSupply(uint256 tokenId) external view returns (uint256);\n\n /**\n * @notice Returns the total minted for a token id.\n */\n function totalMinted(uint256 tokenId) external view returns (uint256);\n}\n"
},
"src/interfaces/ICreatorToken.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\ninterface ICreatorToken {\n event TransferValidatorUpdated(address oldValidator, address newValidator);\n\n function getTransferValidator() external view returns (address validator);\n\n function getTransferValidationFunction()\n external\n view\n returns (bytes4 functionSignature, bool isViewFunction);\n\n function setTransferValidator(address validator) external;\n}\n\ninterface ILegacyCreatorToken {\n event TransferValidatorUpdated(address oldValidator, address newValidator);\n\n function getTransferValidator() external view returns (address validator);\n\n function setTransferValidator(address validator) external;\n}\n"
},
"src/interfaces/ITransferValidator.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\ninterface ITransferValidator721 {\n /// @notice Ensure that a transfer has been authorized for a specific tokenId\n function validateTransfer(\n address caller,\n address from,\n address to,\n uint256 tokenId\n ) external view;\n}\n\ninterface ITransferValidator1155 {\n /// @notice Ensure that a transfer has been authorized for a specific amount of a specific tokenId, and reduce the transferable amount remaining\n function validateTransfer(\n address caller,\n address from,\n address to,\n uint256 tokenId,\n uint256 amount\n ) external;\n}\n"
},
"src/lib/TokenTransferValidator.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport { ICreatorToken } from \"../interfaces/ICreatorToken.sol\";\n\n/**\n * @title TokenTransferValidator\n * @notice Functionality to use a transfer validator.\n */\nabstract contract TokenTransferValidator is ICreatorToken {\n /// @dev Store the transfer validator. The null address means no transfer validator is set.\n address internal _transferValidator;\n\n /// @notice Revert with an error if the transfer validator is being set to the same address.\n error SameTransferValidator();\n\n /// @notice Returns the currently active transfer validator.\n /// The null address means no transfer validator is set.\n function getTransferValidator() external view returns (address) {\n return _transferValidator;\n }\n\n /// @notice Set the transfer validator.\n /// The external method that uses this must include access control.\n function _setTransferValidator(address newValidator) internal {\n address oldValidator = _transferValidator;\n if (oldValidator == newValidator) {\n revert SameTransferValidator();\n }\n _transferValidator = newValidator;\n emit TransferValidatorUpdated(oldValidator, newValidator);\n }\n}\n"
},
"lib/solady/src/tokens/ERC2981.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Simple ERC2981 NFT Royalty Standard implementation.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC2981.sol)\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/common/ERC2981.sol)\nabstract contract ERC2981 {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CUSTOM ERRORS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The royalty fee numerator exceeds the fee denominator.\n error RoyaltyOverflow();\n\n /// @dev The royalty receiver cannot be the zero address.\n error RoyaltyReceiverIsZeroAddress();\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* STORAGE */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The default royalty info is given by:\n /// ```\n /// let packed := sload(_ERC2981_MASTER_SLOT_SEED)\n /// let receiver := shr(96, packed)\n /// let royaltyFraction := xor(packed, shl(96, receiver))\n /// ```\n ///\n /// The per token royalty info is given by.\n /// ```\n /// mstore(0x00, tokenId)\n /// mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n /// let packed := sload(keccak256(0x00, 0x40))\n /// let receiver := shr(96, packed)\n /// let royaltyFraction := xor(packed, shl(96, receiver))\n /// ```\n uint256 private constant _ERC2981_MASTER_SLOT_SEED = 0xaa4ec00224afccfdb7;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* ERC2981 */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Checks that `_feeDenominator` is non-zero.\n constructor() {\n require(_feeDenominator() != 0, \"Fee denominator cannot be zero.\");\n }\n\n /// @dev Returns the denominator for the royalty amount.\n /// Defaults to 10000, which represents fees in basis points.\n /// Override this function to return a custom amount if needed.\n function _feeDenominator() internal pure virtual returns (uint96) {\n return 10000;\n }\n\n /// @dev Returns true if this contract implements the interface defined by `interfaceId`.\n /// See: https://eips.ethereum.org/EIPS/eip-165\n /// This function call must use less than 30000 gas.\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) {\n /// @solidity memory-safe-assembly\n assembly {\n let s := shr(224, interfaceId)\n // ERC165: 0x01ffc9a7, ERC2981: 0x2a55205a.\n result := or(eq(s, 0x01ffc9a7), eq(s, 0x2a55205a))\n }\n }\n\n /// @dev Returns the `receiver` and `royaltyAmount` for `tokenId` sold at `salePrice`.\n function royaltyInfo(uint256 tokenId, uint256 salePrice)\n public\n view\n virtual\n returns (address receiver, uint256 royaltyAmount)\n {\n uint256 feeDenominator = _feeDenominator();\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, tokenId)\n mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n let packed := sload(keccak256(0x00, 0x40))\n receiver := shr(96, packed)\n if iszero(receiver) {\n packed := sload(mload(0x20))\n receiver := shr(96, packed)\n }\n let x := salePrice\n let y := xor(packed, shl(96, receiver)) // `feeNumerator`.\n // Overflow check, equivalent to `require(y == 0 || x <= type(uint256).max / y)`.\n // Out-of-gas revert. Should not be triggered in practice, but included for safety.\n returndatacopy(returndatasize(), returndatasize(), mul(y, gt(x, div(not(0), y))))\n royaltyAmount := div(mul(x, y), feeDenominator)\n }\n }\n\n /// @dev Sets the default royalty `receiver` and `feeNumerator`.\n ///\n /// Requirements:\n /// - `receiver` must not be the zero address.\n /// - `feeNumerator` must not be greater than the fee denominator.\n function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {\n uint256 feeDenominator = _feeDenominator();\n /// @solidity memory-safe-assembly\n assembly {\n feeNumerator := shr(160, shl(160, feeNumerator))\n if gt(feeNumerator, feeDenominator) {\n mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`.\n revert(0x1c, 0x04)\n }\n let packed := shl(96, receiver)\n if iszero(packed) {\n mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`.\n revert(0x1c, 0x04)\n }\n sstore(_ERC2981_MASTER_SLOT_SEED, or(packed, feeNumerator))\n }\n }\n\n /// @dev Sets the default royalty `receiver` and `feeNumerator` to zero.\n function _deleteDefaultRoyalty() internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n sstore(_ERC2981_MASTER_SLOT_SEED, 0)\n }\n }\n\n /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId`.\n ///\n /// Requirements:\n /// - `receiver` must not be the zero address.\n /// - `feeNumerator` must not be greater than the fee denominator.\n function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator)\n internal\n virtual\n {\n uint256 feeDenominator = _feeDenominator();\n /// @solidity memory-safe-assembly\n assembly {\n feeNumerator := shr(160, shl(160, feeNumerator))\n if gt(feeNumerator, feeDenominator) {\n mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`.\n revert(0x1c, 0x04)\n }\n let packed := shl(96, receiver)\n if iszero(packed) {\n mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`.\n revert(0x1c, 0x04)\n }\n mstore(0x00, tokenId)\n mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n sstore(keccak256(0x00, 0x40), or(packed, feeNumerator))\n }\n }\n\n /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId` to zero.\n function _resetTokenRoyalty(uint256 tokenId) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, tokenId)\n mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n sstore(keccak256(0x00, 0x40), 0)\n }\n }\n}\n"
},
"lib/solady/src/auth/Ownable.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Simple single owner authorization mixin.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol)\n/// @dev While the ownable portion follows\n/// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility,\n/// the nomenclature for the 2-step ownership handover may be unique to this codebase.\nabstract contract Ownable {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CUSTOM ERRORS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The caller is not authorized to call the function.\n error Unauthorized();\n\n /// @dev The `newOwner` cannot be the zero address.\n error NewOwnerIsZeroAddress();\n\n /// @dev The `pendingOwner` does not have a valid handover request.\n error NoHandoverRequest();\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* EVENTS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The ownership is transferred from `oldOwner` to `newOwner`.\n /// This event is intentionally kept the same as OpenZeppelin's Ownable to be\n /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173),\n /// despite it not being as lightweight as a single argument event.\n event OwnershipTransferred(address indexed oldOwner, address indexed newOwner);\n\n /// @dev An ownership handover to `pendingOwner` has been requested.\n event OwnershipHandoverRequested(address indexed pendingOwner);\n\n /// @dev The ownership handover to `pendingOwner` has been canceled.\n event OwnershipHandoverCanceled(address indexed pendingOwner);\n\n /// @dev `keccak256(bytes(\"OwnershipTransferred(address,address)\"))`.\n uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE =\n 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0;\n\n /// @dev `keccak256(bytes(\"OwnershipHandoverRequested(address)\"))`.\n uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE =\n 0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d;\n\n /// @dev `keccak256(bytes(\"OwnershipHandoverCanceled(address)\"))`.\n uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE =\n 0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* STORAGE */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The owner slot is given by: `not(_OWNER_SLOT_NOT)`.\n /// It is intentionally chosen to be a high value\n /// to avoid collision with lower slots.\n /// The choice of manual storage layout is to enable compatibility\n /// with both regular and upgradeable contracts.\n uint256 private constant _OWNER_SLOT_NOT = 0x8b78c6d8;\n\n /// The ownership handover slot of `newOwner` is given by:\n /// ```\n /// mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED))\n /// let handoverSlot := keccak256(0x00, 0x20)\n /// ```\n /// It stores the expiry timestamp of the two-step ownership handover.\n uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Initializes the owner directly without authorization guard.\n /// This function must be called upon initialization,\n /// regardless of whether the contract is upgradeable or not.\n /// This is to enable generalization to both regular and upgradeable contracts,\n /// and to save gas in case the initial owner is not the caller.\n /// For performance reasons, this function will not check if there\n /// is an existing owner.\n function _initializeOwner(address newOwner) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Clean the upper 96 bits.\n newOwner := shr(96, shl(96, newOwner))\n // Store the new value.\n sstore(not(_OWNER_SLOT_NOT), newOwner)\n // Emit the {OwnershipTransferred} event.\n log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner)\n }\n }\n\n /// @dev Sets the owner directly without authorization guard.\n function _setOwner(address newOwner) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n let ownerSlot := not(_OWNER_SLOT_NOT)\n // Clean the upper 96 bits.\n newOwner := shr(96, shl(96, newOwner))\n // Emit the {OwnershipTransferred} event.\n log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)\n // Store the new value.\n sstore(ownerSlot, newOwner)\n }\n }\n\n /// @dev Throws if the sender is not the owner.\n function _checkOwner() internal view virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // If the caller is not the stored owner, revert.\n if iszero(eq(caller(), sload(not(_OWNER_SLOT_NOT)))) {\n mstore(0x00, 0x82b42900) // `Unauthorized()`.\n revert(0x1c, 0x04)\n }\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* PUBLIC UPDATE FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Allows the owner to transfer the ownership to `newOwner`.\n function transferOwnership(address newOwner) public payable virtual onlyOwner {\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(shl(96, newOwner)) {\n mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`.\n revert(0x1c, 0x04)\n }\n }\n _setOwner(newOwner);\n }\n\n /// @dev Allows the owner to renounce their ownership.\n function renounceOwnership() public payable virtual onlyOwner {\n _setOwner(address(0));\n }\n\n /// @dev Request a two-step ownership handover to the caller.\n /// The request will automatically expire in 48 hours (172800 seconds) by default.\n function requestOwnershipHandover() public payable virtual {\n unchecked {\n uint256 expires = block.timestamp + ownershipHandoverValidFor();\n /// @solidity memory-safe-assembly\n assembly {\n // Compute and set the handover slot to `expires`.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, caller())\n sstore(keccak256(0x0c, 0x20), expires)\n // Emit the {OwnershipHandoverRequested} event.\n log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller())\n }\n }\n }\n\n /// @dev Cancels the two-step ownership handover to the caller, if any.\n function cancelOwnershipHandover() public payable virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Compute and set the handover slot to 0.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, caller())\n sstore(keccak256(0x0c, 0x20), 0)\n // Emit the {OwnershipHandoverCanceled} event.\n log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller())\n }\n }\n\n /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`.\n /// Reverts if there is no existing ownership handover requested by `pendingOwner`.\n function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner {\n /// @solidity memory-safe-assembly\n assembly {\n // Compute and set the handover slot to 0.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, pendingOwner)\n let handoverSlot := keccak256(0x0c, 0x20)\n // If the handover does not exist, or has expired.\n if gt(timestamp(), sload(handoverSlot)) {\n mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`.\n revert(0x1c, 0x04)\n }\n // Set the handover slot to 0.\n sstore(handoverSlot, 0)\n }\n _setOwner(pendingOwner);\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* PUBLIC READ FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the owner of the contract.\n function owner() public view virtual returns (address result) {\n /// @solidity memory-safe-assembly\n assembly {\n result := sload(not(_OWNER_SLOT_NOT))\n }\n }\n\n /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`.\n function ownershipHandoverExpiresAt(address pendingOwner)\n public\n view\n virtual\n returns (uint256 result)\n {\n /// @solidity memory-safe-assembly\n assembly {\n // Compute the handover slot.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, pendingOwner)\n // Load the handover slot.\n result := sload(keccak256(0x0c, 0x20))\n }\n }\n\n /// @dev Returns how long a two-step ownership handover is valid for in seconds.\n function ownershipHandoverValidFor() public view virtual returns (uint64) {\n return 48 * 3600;\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* MODIFIERS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Marks a function as only callable by the owner.\n modifier onlyOwner() virtual {\n _checkOwner();\n _;\n }\n}\n"
},
"lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.19;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (address(this).code.length == 0 && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n"
},
"src/lib/SeaDropErrorsAndEvents.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { CreatorPayout, PublicDrop } from \"./ERC721SeaDropStructs.sol\";\n\ninterface SeaDropErrorsAndEvents {\n /**\n * @notice The SeaDrop token types, emitted as part of\n * `event SeaDropTokenDeployed`.\n */\n enum SEADROP_TOKEN_TYPE {\n ERC721_STANDARD,\n ERC721_CLONE,\n ERC721_UPGRADEABLE,\n ERC1155_STANDARD,\n ERC1155_CLONE,\n ERC1155_UPGRADEABLE\n }\n\n /**\n * @notice An event to signify that a SeaDrop token contract was deployed.\n */\n event SeaDropTokenDeployed(SEADROP_TOKEN_TYPE tokenType);\n\n /**\n * @notice Revert with an error if the function selector is not supported.\n */\n error UnsupportedFunctionSelector(bytes4 selector);\n\n /**\n * @dev Revert with an error if the drop stage is not active.\n */\n error NotActive(\n uint256 currentTimestamp,\n uint256 startTimestamp,\n uint256 endTimestamp\n );\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max allowed\n * to be minted per wallet.\n */\n error MintQuantityExceedsMaxMintedPerWallet(uint256 total, uint256 allowed);\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max token\n * supply.\n */\n error MintQuantityExceedsMaxSupply(uint256 total, uint256 maxSupply);\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max token\n * supply for the stage.\n * Note: The `maxTokenSupplyForStage` for public mint is\n * always `type(uint).max`.\n */\n error MintQuantityExceedsMaxTokenSupplyForStage(\n uint256 total,\n uint256 maxTokenSupplyForStage\n );\n\n /**\n * @dev Revert if the fee recipient is the zero address.\n */\n error FeeRecipientCannotBeZeroAddress();\n\n /**\n * @dev Revert if the fee recipient is not already included.\n */\n error FeeRecipientNotPresent();\n\n /**\n * @dev Revert if the fee basis points is greater than 10_000.\n */\n error InvalidFeeBps(uint256 feeBps);\n\n /**\n * @dev Revert if the fee recipient is already included.\n */\n error DuplicateFeeRecipient();\n\n /**\n * @dev Revert if the fee recipient is restricted and not allowed.\n */\n error FeeRecipientNotAllowed(address got);\n\n /**\n * @dev Revert if the creator payout address is the zero address.\n */\n error CreatorPayoutAddressCannotBeZeroAddress();\n\n /**\n * @dev Revert if the creator payouts are not set.\n */\n error CreatorPayoutsNotSet();\n\n /**\n * @dev Revert if the creator payout basis points are zero.\n */\n error CreatorPayoutBasisPointsCannotBeZero();\n\n /**\n * @dev Revert if the total basis points for the creator payouts\n * don't equal exactly 10_000.\n */\n error InvalidCreatorPayoutTotalBasisPoints(\n uint256 totalReceivedBasisPoints\n );\n\n /**\n * @dev Revert if the creator payout basis points don't add up to 10_000.\n */\n error InvalidCreatorPayoutBasisPoints(uint256 totalReceivedBasisPoints);\n\n /**\n * @dev Revert with an error if the allow list proof is invalid.\n */\n error InvalidProof();\n\n /**\n * @dev Revert if a supplied signer address is the zero address.\n */\n error SignerCannotBeZeroAddress();\n\n /**\n * @dev Revert with an error if a signer is not included in\n * the enumeration when removing.\n */\n error SignerNotPresent();\n\n /**\n * @dev Revert with an error if a payer is not included in\n * the enumeration when removing.\n */\n error PayerNotPresent();\n\n /**\n * @dev Revert with an error if a payer is already included in mapping\n * when adding.\n */\n error DuplicatePayer();\n\n /**\n * @dev Revert with an error if a signer is already included in mapping\n * when adding.\n */\n error DuplicateSigner();\n\n /**\n * @dev Revert with an error if the payer is not allowed. The minter must\n * pay for their own mint.\n */\n error PayerNotAllowed(address got);\n\n /**\n * @dev Revert if a supplied payer address is the zero address.\n */\n error PayerCannotBeZeroAddress();\n\n /**\n * @dev Revert if the start time is greater than the end time.\n */\n error InvalidStartAndEndTime(uint256 startTime, uint256 endTime);\n\n /**\n * @dev Revert with an error if the signer payment token is not the same.\n */\n error InvalidSignedPaymentToken(address got, address want);\n\n /**\n * @dev Revert with an error if supplied signed mint price is less than\n * the minimum specified.\n */\n error InvalidSignedMintPrice(\n address paymentToken,\n uint256 got,\n uint256 minimum\n );\n\n /**\n * @dev Revert with an error if supplied signed maxTotalMintableByWallet\n * is greater than the maximum specified.\n */\n error InvalidSignedMaxTotalMintableByWallet(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed\n * maxTotalMintableByWalletPerToken is greater than the maximum\n * specified.\n */\n error InvalidSignedMaxTotalMintableByWalletPerToken(\n uint256 got,\n uint256 maximum\n );\n\n /**\n * @dev Revert with an error if the fromTokenId is not within range.\n */\n error InvalidSignedFromTokenId(uint256 got, uint256 minimum);\n\n /**\n * @dev Revert with an error if the toTokenId is not within range.\n */\n error InvalidSignedToTokenId(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed start time is less than\n * the minimum specified.\n */\n error InvalidSignedStartTime(uint256 got, uint256 minimum);\n\n /**\n * @dev Revert with an error if supplied signed end time is greater than\n * the maximum specified.\n */\n error InvalidSignedEndTime(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed maxTokenSupplyForStage\n * is greater than the maximum specified.\n */\n error InvalidSignedMaxTokenSupplyForStage(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed feeBps is greater than\n * the maximum specified, or less than the minimum.\n */\n error InvalidSignedFeeBps(uint256 got, uint256 minimumOrMaximum);\n\n /**\n * @dev Revert with an error if signed mint did not specify to restrict\n * fee recipients.\n */\n error SignedMintsMustRestrictFeeRecipients();\n\n /**\n * @dev Revert with an error if a signature for a signed mint has already\n * been used.\n */\n error SignatureAlreadyUsed();\n\n /**\n * @dev Revert with an error if the contract has no balance to withdraw.\n */\n error NoBalanceToWithdraw();\n\n /**\n * @dev Revert with an error if the caller is not an allowed Seaport.\n */\n error InvalidCallerOnlyAllowedSeaport(address caller);\n\n /**\n * @dev Revert with an error if the order does not have the ERC1155 magic\n * consideration item to signify a consecutive mint.\n */\n error MustSpecifyERC1155ConsiderationItemForSeaDropMint();\n\n /**\n * @dev Revert with an error if the extra data version is not supported.\n */\n error UnsupportedExtraDataVersion(uint8 version);\n\n /**\n * @dev Revert with an error if the extra data encoding is not supported.\n */\n error InvalidExtraDataEncoding(uint8 version);\n\n /**\n * @dev Revert with an error if the provided substandard is not supported.\n */\n error InvalidSubstandard(uint8 substandard);\n\n /**\n * @dev Revert with an error if the implementation contract is called without\n * delegatecall.\n */\n error OnlyDelegateCalled();\n\n /**\n * @dev Revert with an error if the provided allowed Seaport is the\n * zero address.\n */\n error AllowedSeaportCannotBeZeroAddress();\n\n /**\n * @dev Emit an event when allowed Seaport contracts are updated.\n */\n event AllowedSeaportUpdated(address[] allowedSeaport);\n\n /**\n * @dev An event with details of a SeaDrop mint, for analytical purposes.\n *\n * @param payer The address who payed for the tx.\n * @param dropStageIndex The drop stage index. Items minted through\n * public mint have dropStageIndex of 0\n */\n event SeaDropMint(address payer, uint256 dropStageIndex);\n\n /**\n * @dev An event with updated allow list data.\n *\n * @param previousMerkleRoot The previous allow list merkle root.\n * @param newMerkleRoot The new allow list merkle root.\n * @param publicKeyURI If the allow list is encrypted, the public key\n * URIs that can decrypt the list.\n * Empty if unencrypted.\n * @param allowListURI The URI for the allow list.\n */\n event AllowListUpdated(\n bytes32 indexed previousMerkleRoot,\n bytes32 indexed newMerkleRoot,\n string[] publicKeyURI,\n string allowListURI\n );\n\n /**\n * @dev An event with updated drop URI.\n */\n event DropURIUpdated(string newDropURI);\n\n /**\n * @dev An event with the updated creator payout address.\n */\n event CreatorPayoutsUpdated(CreatorPayout[] creatorPayouts);\n\n /**\n * @dev An event with the updated allowed fee recipient.\n */\n event AllowedFeeRecipientUpdated(\n address indexed feeRecipient,\n bool indexed allowed\n );\n\n /**\n * @dev An event with the updated signer.\n */\n event SignerUpdated(address indexed signer, bool indexed allowed);\n\n /**\n * @dev An event with the updated payer.\n */\n event PayerUpdated(address indexed payer, bool indexed allowed);\n}\n"
},
"lib/seaport/lib/seaport-types/src/lib/ConsiderationEnums.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nenum OrderType {\n // 0: no partial fills, anyone can execute\n FULL_OPEN,\n\n // 1: partial fills supported, anyone can execute\n PARTIAL_OPEN,\n\n // 2: no partial fills, only offerer or zone can execute\n FULL_RESTRICTED,\n\n // 3: partial fills supported, only offerer or zone can execute\n PARTIAL_RESTRICTED,\n\n // 4: contract order type\n CONTRACT\n}\n\nenum BasicOrderType {\n // 0: no partial fills, anyone can execute\n ETH_TO_ERC721_FULL_OPEN,\n\n // 1: partial fills supported, anyone can execute\n ETH_TO_ERC721_PARTIAL_OPEN,\n\n // 2: no partial fills, only offerer or zone can execute\n ETH_TO_ERC721_FULL_RESTRICTED,\n\n // 3: partial fills supported, only offerer or zone can execute\n ETH_TO_ERC721_PARTIAL_RESTRICTED,\n\n // 4: no partial fills, anyone can execute\n ETH_TO_ERC1155_FULL_OPEN,\n\n // 5: partial fills supported, anyone can execute\n ETH_TO_ERC1155_PARTIAL_OPEN,\n\n // 6: no partial fills, only offerer or zone can execute\n ETH_TO_ERC1155_FULL_RESTRICTED,\n\n // 7: partial fills supported, only offerer or zone can execute\n ETH_TO_ERC1155_PARTIAL_RESTRICTED,\n\n // 8: no partial fills, anyone can execute\n ERC20_TO_ERC721_FULL_OPEN,\n\n // 9: partial fills supported, anyone can execute\n ERC20_TO_ERC721_PARTIAL_OPEN,\n\n // 10: no partial fills, only offerer or zone can execute\n ERC20_TO_ERC721_FULL_RESTRICTED,\n\n // 11: partial fills supported, only offerer or zone can execute\n ERC20_TO_ERC721_PARTIAL_RESTRICTED,\n\n // 12: no partial fills, anyone can execute\n ERC20_TO_ERC1155_FULL_OPEN,\n\n // 13: partial fills supported, anyone can execute\n ERC20_TO_ERC1155_PARTIAL_OPEN,\n\n // 14: no partial fills, only offerer or zone can execute\n ERC20_TO_ERC1155_FULL_RESTRICTED,\n\n // 15: partial fills supported, only offerer or zone can execute\n ERC20_TO_ERC1155_PARTIAL_RESTRICTED,\n\n // 16: no partial fills, anyone can execute\n ERC721_TO_ERC20_FULL_OPEN,\n\n // 17: partial fills supported, anyone can execute\n ERC721_TO_ERC20_PARTIAL_OPEN,\n\n // 18: no partial fills, only offerer or zone can execute\n ERC721_TO_ERC20_FULL_RESTRICTED,\n\n // 19: partial fills supported, only offerer or zone can execute\n ERC721_TO_ERC20_PARTIAL_RESTRICTED,\n\n // 20: no partial fills, anyone can execute\n ERC1155_TO_ERC20_FULL_OPEN,\n\n // 21: partial fills supported, anyone can execute\n ERC1155_TO_ERC20_PARTIAL_OPEN,\n\n // 22: no partial fills, only offerer or zone can execute\n ERC1155_TO_ERC20_FULL_RESTRICTED,\n\n // 23: partial fills supported, only offerer or zone can execute\n ERC1155_TO_ERC20_PARTIAL_RESTRICTED\n}\n\nenum BasicOrderRouteType {\n // 0: provide Ether (or other native token) to receive offered ERC721 item.\n ETH_TO_ERC721,\n\n // 1: provide Ether (or other native token) to receive offered ERC1155 item.\n ETH_TO_ERC1155,\n\n // 2: provide ERC20 item to receive offered ERC721 item.\n ERC20_TO_ERC721,\n\n // 3: provide ERC20 item to receive offered ERC1155 item.\n ERC20_TO_ERC1155,\n\n // 4: provide ERC721 item to receive offered ERC20 item.\n ERC721_TO_ERC20,\n\n // 5: provide ERC1155 item to receive offered ERC20 item.\n ERC1155_TO_ERC20\n}\n\nenum ItemType {\n // 0: ETH on mainnet, MATIC on polygon, etc.\n NATIVE,\n\n // 1: ERC20 items (ERC777 and ERC20 analogues could also technically work)\n ERC20,\n\n // 2: ERC721 items\n ERC721,\n\n // 3: ERC1155 items\n ERC1155,\n\n // 4: ERC721 items where a number of tokenIds are supported\n ERC721_WITH_CRITERIA,\n\n // 5: ERC1155 items where a number of ids are supported\n ERC1155_WITH_CRITERIA\n}\n\nenum Side {\n // 0: Items that can be spent\n OFFER,\n\n // 1: Items that must be received\n CONSIDERATION\n}\n"
},
"lib/seaport/lib/seaport-types/src/helpers/PointerLibraries.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\ntype CalldataPointer is uint256;\n\ntype ReturndataPointer is uint256;\n\ntype MemoryPointer is uint256;\n\nusing CalldataPointerLib for CalldataPointer global;\nusing MemoryPointerLib for MemoryPointer global;\nusing ReturndataPointerLib for ReturndataPointer global;\n\nusing CalldataReaders for CalldataPointer global;\nusing ReturndataReaders for ReturndataPointer global;\nusing MemoryReaders for MemoryPointer global;\nusing MemoryWriters for MemoryPointer global;\n\nCalldataPointer constant CalldataStart = CalldataPointer.wrap(0x04);\nMemoryPointer constant FreeMemoryPPtr = MemoryPointer.wrap(0x40);\nuint256 constant IdentityPrecompileAddress = 0x4;\nuint256 constant OffsetOrLengthMask = 0xffffffff;\nuint256 constant _OneWord = 0x20;\nuint256 constant _FreeMemoryPointerSlot = 0x40;\n\n/// @dev Allocates `size` bytes in memory by increasing the free memory pointer\n/// and returns the memory pointer to the first byte of the allocated region.\n// (Free functions cannot have visibility.)\n// solhint-disable-next-line func-visibility\nfunction malloc(uint256 size) pure returns (MemoryPointer mPtr) {\n assembly {\n mPtr := mload(_FreeMemoryPointerSlot)\n mstore(_FreeMemoryPointerSlot, add(mPtr, size))\n }\n}\n\n// (Free functions cannot have visibility.)\n// solhint-disable-next-line func-visibility\nfunction getFreeMemoryPointer() pure returns (MemoryPointer mPtr) {\n mPtr = FreeMemoryPPtr.readMemoryPointer();\n}\n\n// (Free functions cannot have visibility.)\n// solhint-disable-next-line func-visibility\nfunction setFreeMemoryPointer(MemoryPointer mPtr) pure {\n FreeMemoryPPtr.write(mPtr);\n}\n\nlibrary CalldataPointerLib {\n function lt(\n CalldataPointer a,\n CalldataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := lt(a, b)\n }\n }\n\n function gt(\n CalldataPointer a,\n CalldataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := gt(a, b)\n }\n }\n\n function eq(\n CalldataPointer a,\n CalldataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := eq(a, b)\n }\n }\n\n function isNull(CalldataPointer a) internal pure returns (bool b) {\n assembly {\n b := iszero(a)\n }\n }\n\n /// @dev Resolves an offset stored at `cdPtr + headOffset` to a calldata.\n /// pointer `cdPtr` must point to some parent object with a dynamic\n /// type's head stored at `cdPtr + headOffset`.\n function pptr(\n CalldataPointer cdPtr,\n uint256 headOffset\n ) internal pure returns (CalldataPointer cdPtrChild) {\n cdPtrChild = cdPtr.offset(\n cdPtr.offset(headOffset).readUint256() & OffsetOrLengthMask\n );\n }\n\n /// @dev Resolves an offset stored at `cdPtr` to a calldata pointer.\n /// `cdPtr` must point to some parent object with a dynamic type as its\n /// first member, e.g. `struct { bytes data; }`\n function pptr(\n CalldataPointer cdPtr\n ) internal pure returns (CalldataPointer cdPtrChild) {\n cdPtrChild = cdPtr.offset(cdPtr.readUint256() & OffsetOrLengthMask);\n }\n\n /// @dev Returns the calldata pointer one word after `cdPtr`.\n function next(\n CalldataPointer cdPtr\n ) internal pure returns (CalldataPointer cdPtrNext) {\n assembly {\n cdPtrNext := add(cdPtr, _OneWord)\n }\n }\n\n /// @dev Returns the calldata pointer `_offset` bytes after `cdPtr`.\n function offset(\n CalldataPointer cdPtr,\n uint256 _offset\n ) internal pure returns (CalldataPointer cdPtrNext) {\n assembly {\n cdPtrNext := add(cdPtr, _offset)\n }\n }\n\n /// @dev Copies `size` bytes from calldata starting at `src` to memory at\n /// `dst`.\n function copy(\n CalldataPointer src,\n MemoryPointer dst,\n uint256 size\n ) internal pure {\n assembly {\n calldatacopy(dst, src, size)\n }\n }\n}\n\nlibrary ReturndataPointerLib {\n function lt(\n ReturndataPointer a,\n ReturndataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := lt(a, b)\n }\n }\n\n function gt(\n ReturndataPointer a,\n ReturndataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := gt(a, b)\n }\n }\n\n function eq(\n ReturndataPointer a,\n ReturndataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := eq(a, b)\n }\n }\n\n function isNull(ReturndataPointer a) internal pure returns (bool b) {\n assembly {\n b := iszero(a)\n }\n }\n\n /// @dev Resolves an offset stored at `rdPtr + headOffset` to a returndata\n /// pointer. `rdPtr` must point to some parent object with a dynamic\n /// type's head stored at `rdPtr + headOffset`.\n function pptr(\n ReturndataPointer rdPtr,\n uint256 headOffset\n ) internal pure returns (ReturndataPointer rdPtrChild) {\n rdPtrChild = rdPtr.offset(\n rdPtr.offset(headOffset).readUint256() & OffsetOrLengthMask\n );\n }\n\n /// @dev Resolves an offset stored at `rdPtr` to a returndata pointer.\n /// `rdPtr` must point to some parent object with a dynamic type as its\n /// first member, e.g. `struct { bytes data; }`\n function pptr(\n ReturndataPointer rdPtr\n ) internal pure returns (ReturndataPointer rdPtrChild) {\n rdPtrChild = rdPtr.offset(rdPtr.readUint256() & OffsetOrLengthMask);\n }\n\n /// @dev Returns the returndata pointer one word after `cdPtr`.\n function next(\n ReturndataPointer rdPtr\n ) internal pure returns (ReturndataPointer rdPtrNext) {\n assembly {\n rdPtrNext := add(rdPtr, _OneWord)\n }\n }\n\n /// @dev Returns the returndata pointer `_offset` bytes after `cdPtr`.\n function offset(\n ReturndataPointer rdPtr,\n uint256 _offset\n ) internal pure returns (ReturndataPointer rdPtrNext) {\n assembly {\n rdPtrNext := add(rdPtr, _offset)\n }\n }\n\n /// @dev Copies `size` bytes from returndata starting at `src` to memory at\n /// `dst`.\n function copy(\n ReturndataPointer src,\n MemoryPointer dst,\n uint256 size\n ) internal pure {\n assembly {\n returndatacopy(dst, src, size)\n }\n }\n}\n\nlibrary MemoryPointerLib {\n function copy(\n MemoryPointer src,\n MemoryPointer dst,\n uint256 size\n ) internal view {\n assembly {\n let success := staticcall(\n gas(),\n IdentityPrecompileAddress,\n src,\n size,\n dst,\n size\n )\n if or(iszero(returndatasize()), iszero(success)) {\n revert(0, 0)\n }\n }\n }\n\n function lt(\n MemoryPointer a,\n MemoryPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := lt(a, b)\n }\n }\n\n function gt(\n MemoryPointer a,\n MemoryPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := gt(a, b)\n }\n }\n\n function eq(\n MemoryPointer a,\n MemoryPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := eq(a, b)\n }\n }\n\n function isNull(MemoryPointer a) internal pure returns (bool b) {\n assembly {\n b := iszero(a)\n }\n }\n\n function hash(\n MemoryPointer ptr,\n uint256 length\n ) internal pure returns (bytes32 _hash) {\n assembly {\n _hash := keccak256(ptr, length)\n }\n }\n\n /// @dev Returns the memory pointer one word after `mPtr`.\n function next(\n MemoryPointer mPtr\n ) internal pure returns (MemoryPointer mPtrNext) {\n assembly {\n mPtrNext := add(mPtr, _OneWord)\n }\n }\n\n /// @dev Returns the memory pointer `_offset` bytes after `mPtr`.\n function offset(\n MemoryPointer mPtr,\n uint256 _offset\n ) internal pure returns (MemoryPointer mPtrNext) {\n assembly {\n mPtrNext := add(mPtr, _offset)\n }\n }\n\n /// @dev Resolves a pointer at `mPtr + headOffset` to a memory\n /// pointer. `mPtr` must point to some parent object with a dynamic\n /// type's pointer stored at `mPtr + headOffset`.\n function pptr(\n MemoryPointer mPtr,\n uint256 headOffset\n ) internal pure returns (MemoryPointer mPtrChild) {\n mPtrChild = mPtr.offset(headOffset).readMemoryPointer();\n }\n\n /// @dev Resolves a pointer stored at `mPtr` to a memory pointer.\n /// `mPtr` must point to some parent object with a dynamic type as its\n /// first member, e.g. `struct { bytes data; }`\n function pptr(\n MemoryPointer mPtr\n ) internal pure returns (MemoryPointer mPtrChild) {\n mPtrChild = mPtr.readMemoryPointer();\n }\n}\n\nlibrary CalldataReaders {\n /// @dev Reads the value at `cdPtr` and applies a mask to return only the\n /// last 4 bytes.\n function readMaskedUint256(\n CalldataPointer cdPtr\n ) internal pure returns (uint256 value) {\n value = cdPtr.readUint256() & OffsetOrLengthMask;\n }\n\n /// @dev Reads the bool at `cdPtr` in calldata.\n function readBool(\n CalldataPointer cdPtr\n ) internal pure returns (bool value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the address at `cdPtr` in calldata.\n function readAddress(\n CalldataPointer cdPtr\n ) internal pure returns (address value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes1 at `cdPtr` in calldata.\n function readBytes1(\n CalldataPointer cdPtr\n ) internal pure returns (bytes1 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes2 at `cdPtr` in calldata.\n function readBytes2(\n CalldataPointer cdPtr\n ) internal pure returns (bytes2 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes3 at `cdPtr` in calldata.\n function readBytes3(\n CalldataPointer cdPtr\n ) internal pure returns (bytes3 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes4 at `cdPtr` in calldata.\n function readBytes4(\n CalldataPointer cdPtr\n ) internal pure returns (bytes4 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes5 at `cdPtr` in calldata.\n function readBytes5(\n CalldataPointer cdPtr\n ) internal pure returns (bytes5 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes6 at `cdPtr` in calldata.\n function readBytes6(\n CalldataPointer cdPtr\n ) internal pure returns (bytes6 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes7 at `cdPtr` in calldata.\n function readBytes7(\n CalldataPointer cdPtr\n ) internal pure returns (bytes7 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes8 at `cdPtr` in calldata.\n function readBytes8(\n CalldataPointer cdPtr\n ) internal pure returns (bytes8 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes9 at `cdPtr` in calldata.\n function readBytes9(\n CalldataPointer cdPtr\n ) internal pure returns (bytes9 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes10 at `cdPtr` in calldata.\n function readBytes10(\n CalldataPointer cdPtr\n ) internal pure returns (bytes10 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes11 at `cdPtr` in calldata.\n function readBytes11(\n CalldataPointer cdPtr\n ) internal pure returns (bytes11 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes12 at `cdPtr` in calldata.\n function readBytes12(\n CalldataPointer cdPtr\n ) internal pure returns (bytes12 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes13 at `cdPtr` in calldata.\n function readBytes13(\n CalldataPointer cdPtr\n ) internal pure returns (bytes13 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes14 at `cdPtr` in calldata.\n function readBytes14(\n CalldataPointer cdPtr\n ) internal pure returns (bytes14 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes15 at `cdPtr` in calldata.\n function readBytes15(\n CalldataPointer cdPtr\n ) internal pure returns (bytes15 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes16 at `cdPtr` in calldata.\n function readBytes16(\n CalldataPointer cdPtr\n ) internal pure returns (bytes16 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes17 at `cdPtr` in calldata.\n function readBytes17(\n CalldataPointer cdPtr\n ) internal pure returns (bytes17 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes18 at `cdPtr` in calldata.\n function readBytes18(\n CalldataPointer cdPtr\n ) internal pure returns (bytes18 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes19 at `cdPtr` in calldata.\n function readBytes19(\n CalldataPointer cdPtr\n ) internal pure returns (bytes19 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes20 at `cdPtr` in calldata.\n function readBytes20(\n CalldataPointer cdPtr\n ) internal pure returns (bytes20 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes21 at `cdPtr` in calldata.\n function readBytes21(\n CalldataPointer cdPtr\n ) internal pure returns (bytes21 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes22 at `cdPtr` in calldata.\n function readBytes22(\n CalldataPointer cdPtr\n ) internal pure returns (bytes22 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes23 at `cdPtr` in calldata.\n function readBytes23(\n CalldataPointer cdPtr\n ) internal pure returns (bytes23 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes24 at `cdPtr` in calldata.\n function readBytes24(\n CalldataPointer cdPtr\n ) internal pure returns (bytes24 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes25 at `cdPtr` in calldata.\n function readBytes25(\n CalldataPointer cdPtr\n ) internal pure returns (bytes25 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes26 at `cdPtr` in calldata.\n function readBytes26(\n CalldataPointer cdPtr\n ) internal pure returns (bytes26 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes27 at `cdPtr` in calldata.\n function readBytes27(\n CalldataPointer cdPtr\n ) internal pure returns (bytes27 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes28 at `cdPtr` in calldata.\n function readBytes28(\n CalldataPointer cdPtr\n ) internal pure returns (bytes28 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes29 at `cdPtr` in calldata.\n function readBytes29(\n CalldataPointer cdPtr\n ) internal pure returns (bytes29 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes30 at `cdPtr` in calldata.\n function readBytes30(\n CalldataPointer cdPtr\n ) internal pure returns (bytes30 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes31 at `cdPtr` in calldata.\n function readBytes31(\n CalldataPointer cdPtr\n ) internal pure returns (bytes31 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes32 at `cdPtr` in calldata.\n function readBytes32(\n CalldataPointer cdPtr\n ) internal pure returns (bytes32 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint8 at `cdPtr` in calldata.\n function readUint8(\n CalldataPointer cdPtr\n ) internal pure returns (uint8 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint16 at `cdPtr` in calldata.\n function readUint16(\n CalldataPointer cdPtr\n ) internal pure returns (uint16 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint24 at `cdPtr` in calldata.\n function readUint24(\n CalldataPointer cdPtr\n ) internal pure returns (uint24 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint32 at `cdPtr` in calldata.\n function readUint32(\n CalldataPointer cdPtr\n ) internal pure returns (uint32 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint40 at `cdPtr` in calldata.\n function readUint40(\n CalldataPointer cdPtr\n ) internal pure returns (uint40 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint48 at `cdPtr` in calldata.\n function readUint48(\n CalldataPointer cdPtr\n ) internal pure returns (uint48 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint56 at `cdPtr` in calldata.\n function readUint56(\n CalldataPointer cdPtr\n ) internal pure returns (uint56 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint64 at `cdPtr` in calldata.\n function readUint64(\n CalldataPointer cdPtr\n ) internal pure returns (uint64 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint72 at `cdPtr` in calldata.\n function readUint72(\n CalldataPointer cdPtr\n ) internal pure returns (uint72 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint80 at `cdPtr` in calldata.\n function readUint80(\n CalldataPointer cdPtr\n ) internal pure returns (uint80 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint88 at `cdPtr` in calldata.\n function readUint88(\n CalldataPointer cdPtr\n ) internal pure returns (uint88 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint96 at `cdPtr` in calldata.\n function readUint96(\n CalldataPointer cdPtr\n ) internal pure returns (uint96 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint104 at `cdPtr` in calldata.\n function readUint104(\n CalldataPointer cdPtr\n ) internal pure returns (uint104 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint112 at `cdPtr` in calldata.\n function readUint112(\n CalldataPointer cdPtr\n ) internal pure returns (uint112 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint120 at `cdPtr` in calldata.\n function readUint120(\n CalldataPointer cdPtr\n ) internal pure returns (uint120 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint128 at `cdPtr` in calldata.\n function readUint128(\n CalldataPointer cdPtr\n ) internal pure returns (uint128 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint136 at `cdPtr` in calldata.\n function readUint136(\n CalldataPointer cdPtr\n ) internal pure returns (uint136 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint144 at `cdPtr` in calldata.\n function readUint144(\n CalldataPointer cdPtr\n ) internal pure returns (uint144 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint152 at `cdPtr` in calldata.\n function readUint152(\n CalldataPointer cdPtr\n ) internal pure returns (uint152 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint160 at `cdPtr` in calldata.\n function readUint160(\n CalldataPointer cdPtr\n ) internal pure returns (uint160 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint168 at `cdPtr` in calldata.\n function readUint168(\n CalldataPointer cdPtr\n ) internal pure returns (uint168 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint176 at `cdPtr` in calldata.\n function readUint176(\n CalldataPointer cdPtr\n ) internal pure returns (uint176 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint184 at `cdPtr` in calldata.\n function readUint184(\n CalldataPointer cdPtr\n ) internal pure returns (uint184 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint192 at `cdPtr` in calldata.\n function readUint192(\n CalldataPointer cdPtr\n ) internal pure returns (uint192 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint200 at `cdPtr` in calldata.\n function readUint200(\n CalldataPointer cdPtr\n ) internal pure returns (uint200 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint208 at `cdPtr` in calldata.\n function readUint208(\n CalldataPointer cdPtr\n ) internal pure returns (uint208 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint216 at `cdPtr` in calldata.\n function readUint216(\n CalldataPointer cdPtr\n ) internal pure returns (uint216 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint224 at `cdPtr` in calldata.\n function readUint224(\n CalldataPointer cdPtr\n ) internal pure returns (uint224 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint232 at `cdPtr` in calldata.\n function readUint232(\n CalldataPointer cdPtr\n ) internal pure returns (uint232 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint240 at `cdPtr` in calldata.\n function readUint240(\n CalldataPointer cdPtr\n ) internal pure returns (uint240 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint248 at `cdPtr` in calldata.\n function readUint248(\n CalldataPointer cdPtr\n ) internal pure returns (uint248 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint256 at `cdPtr` in calldata.\n function readUint256(\n CalldataPointer cdPtr\n ) internal pure returns (uint256 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int8 at `cdPtr` in calldata.\n function readInt8(\n CalldataPointer cdPtr\n ) internal pure returns (int8 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int16 at `cdPtr` in calldata.\n function readInt16(\n CalldataPointer cdPtr\n ) internal pure returns (int16 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int24 at `cdPtr` in calldata.\n function readInt24(\n CalldataPointer cdPtr\n ) internal pure returns (int24 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int32 at `cdPtr` in calldata.\n function readInt32(\n CalldataPointer cdPtr\n ) internal pure returns (int32 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int40 at `cdPtr` in calldata.\n function readInt40(\n CalldataPointer cdPtr\n ) internal pure returns (int40 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int48 at `cdPtr` in calldata.\n function readInt48(\n CalldataPointer cdPtr\n ) internal pure returns (int48 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int56 at `cdPtr` in calldata.\n function readInt56(\n CalldataPointer cdPtr\n ) internal pure returns (int56 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int64 at `cdPtr` in calldata.\n function readInt64(\n CalldataPointer cdPtr\n ) internal pure returns (int64 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int72 at `cdPtr` in calldata.\n function readInt72(\n CalldataPointer cdPtr\n ) internal pure returns (int72 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int80 at `cdPtr` in calldata.\n function readInt80(\n CalldataPointer cdPtr\n ) internal pure returns (int80 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int88 at `cdPtr` in calldata.\n function readInt88(\n CalldataPointer cdPtr\n ) internal pure returns (int88 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int96 at `cdPtr` in calldata.\n function readInt96(\n CalldataPointer cdPtr\n ) internal pure returns (int96 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int104 at `cdPtr` in calldata.\n function readInt104(\n CalldataPointer cdPtr\n ) internal pure returns (int104 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int112 at `cdPtr` in calldata.\n function readInt112(\n CalldataPointer cdPtr\n ) internal pure returns (int112 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int120 at `cdPtr` in calldata.\n function readInt120(\n CalldataPointer cdPtr\n ) internal pure returns (int120 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int128 at `cdPtr` in calldata.\n function readInt128(\n CalldataPointer cdPtr\n ) internal pure returns (int128 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int136 at `cdPtr` in calldata.\n function readInt136(\n CalldataPointer cdPtr\n ) internal pure returns (int136 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int144 at `cdPtr` in calldata.\n function readInt144(\n CalldataPointer cdPtr\n ) internal pure returns (int144 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int152 at `cdPtr` in calldata.\n function readInt152(\n CalldataPointer cdPtr\n ) internal pure returns (int152 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int160 at `cdPtr` in calldata.\n function readInt160(\n CalldataPointer cdPtr\n ) internal pure returns (int160 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int168 at `cdPtr` in calldata.\n function readInt168(\n CalldataPointer cdPtr\n ) internal pure returns (int168 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int176 at `cdPtr` in calldata.\n function readInt176(\n CalldataPointer cdPtr\n ) internal pure returns (int176 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int184 at `cdPtr` in calldata.\n function readInt184(\n CalldataPointer cdPtr\n ) internal pure returns (int184 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int192 at `cdPtr` in calldata.\n function readInt192(\n CalldataPointer cdPtr\n ) internal pure returns (int192 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int200 at `cdPtr` in calldata.\n function readInt200(\n CalldataPointer cdPtr\n ) internal pure returns (int200 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int208 at `cdPtr` in calldata.\n function readInt208(\n CalldataPointer cdPtr\n ) internal pure returns (int208 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int216 at `cdPtr` in calldata.\n function readInt216(\n CalldataPointer cdPtr\n ) internal pure returns (int216 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int224 at `cdPtr` in calldata.\n function readInt224(\n CalldataPointer cdPtr\n ) internal pure returns (int224 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int232 at `cdPtr` in calldata.\n function readInt232(\n CalldataPointer cdPtr\n ) internal pure returns (int232 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int240 at `cdPtr` in calldata.\n function readInt240(\n CalldataPointer cdPtr\n ) internal pure returns (int240 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int248 at `cdPtr` in calldata.\n function readInt248(\n CalldataPointer cdPtr\n ) internal pure returns (int248 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int256 at `cdPtr` in calldata.\n function readInt256(\n CalldataPointer cdPtr\n ) internal pure returns (int256 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n}\n\nlibrary ReturndataReaders {\n /// @dev Reads value at `rdPtr` & applies a mask to return only last 4 bytes\n function readMaskedUint256(\n ReturndataPointer rdPtr\n ) internal pure returns (uint256 value) {\n value = rdPtr.readUint256() & OffsetOrLengthMask;\n }\n\n /// @dev Reads the bool at `rdPtr` in returndata.\n function readBool(\n ReturndataPointer rdPtr\n ) internal pure returns (bool value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the address at `rdPtr` in returndata.\n function readAddress(\n ReturndataPointer rdPtr\n ) internal pure returns (address value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes1 at `rdPtr` in returndata.\n function readBytes1(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes1 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes2 at `rdPtr` in returndata.\n function readBytes2(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes2 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes3 at `rdPtr` in returndata.\n function readBytes3(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes3 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes4 at `rdPtr` in returndata.\n function readBytes4(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes4 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes5 at `rdPtr` in returndata.\n function readBytes5(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes5 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes6 at `rdPtr` in returndata.\n function readBytes6(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes6 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes7 at `rdPtr` in returndata.\n function readBytes7(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes7 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes8 at `rdPtr` in returndata.\n function readBytes8(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes8 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes9 at `rdPtr` in returndata.\n function readBytes9(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes9 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes10 at `rdPtr` in returndata.\n function readBytes10(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes10 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes11 at `rdPtr` in returndata.\n function readBytes11(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes11 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes12 at `rdPtr` in returndata.\n function readBytes12(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes12 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes13 at `rdPtr` in returndata.\n function readBytes13(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes13 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes14 at `rdPtr` in returndata.\n function readBytes14(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes14 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes15 at `rdPtr` in returndata.\n function readBytes15(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes15 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes16 at `rdPtr` in returndata.\n function readBytes16(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes16 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes17 at `rdPtr` in returndata.\n function readBytes17(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes17 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes18 at `rdPtr` in returndata.\n function readBytes18(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes18 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes19 at `rdPtr` in returndata.\n function readBytes19(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes19 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes20 at `rdPtr` in returndata.\n function readBytes20(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes20 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes21 at `rdPtr` in returndata.\n function readBytes21(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes21 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes22 at `rdPtr` in returndata.\n function readBytes22(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes22 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes23 at `rdPtr` in returndata.\n function readBytes23(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes23 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes24 at `rdPtr` in returndata.\n function readBytes24(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes24 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes25 at `rdPtr` in returndata.\n function readBytes25(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes25 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes26 at `rdPtr` in returndata.\n function readBytes26(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes26 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes27 at `rdPtr` in returndata.\n function readBytes27(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes27 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes28 at `rdPtr` in returndata.\n function readBytes28(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes28 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes29 at `rdPtr` in returndata.\n function readBytes29(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes29 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes30 at `rdPtr` in returndata.\n function readBytes30(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes30 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes31 at `rdPtr` in returndata.\n function readBytes31(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes31 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes32 at `rdPtr` in returndata.\n function readBytes32(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes32 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint8 at `rdPtr` in returndata.\n function readUint8(\n ReturndataPointer rdPtr\n ) internal pure returns (uint8 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint16 at `rdPtr` in returndata.\n function readUint16(\n ReturndataPointer rdPtr\n ) internal pure returns (uint16 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint24 at `rdPtr` in returndata.\n function readUint24(\n ReturndataPointer rdPtr\n ) internal pure returns (uint24 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint32 at `rdPtr` in returndata.\n function readUint32(\n ReturndataPointer rdPtr\n ) internal pure returns (uint32 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint40 at `rdPtr` in returndata.\n function readUint40(\n ReturndataPointer rdPtr\n ) internal pure returns (uint40 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint48 at `rdPtr` in returndata.\n function readUint48(\n ReturndataPointer rdPtr\n ) internal pure returns (uint48 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint56 at `rdPtr` in returndata.\n function readUint56(\n ReturndataPointer rdPtr\n ) internal pure returns (uint56 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint64 at `rdPtr` in returndata.\n function readUint64(\n ReturndataPointer rdPtr\n ) internal pure returns (uint64 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint72 at `rdPtr` in returndata.\n function readUint72(\n ReturndataPointer rdPtr\n ) internal pure returns (uint72 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint80 at `rdPtr` in returndata.\n function readUint80(\n ReturndataPointer rdPtr\n ) internal pure returns (uint80 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint88 at `rdPtr` in returndata.\n function readUint88(\n ReturndataPointer rdPtr\n ) internal pure returns (uint88 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint96 at `rdPtr` in returndata.\n function readUint96(\n ReturndataPointer rdPtr\n ) internal pure returns (uint96 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint104 at `rdPtr` in returndata.\n function readUint104(\n ReturndataPointer rdPtr\n ) internal pure returns (uint104 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint112 at `rdPtr` in returndata.\n function readUint112(\n ReturndataPointer rdPtr\n ) internal pure returns (uint112 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint120 at `rdPtr` in returndata.\n function readUint120(\n ReturndataPointer rdPtr\n ) internal pure returns (uint120 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint128 at `rdPtr` in returndata.\n function readUint128(\n ReturndataPointer rdPtr\n ) internal pure returns (uint128 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint136 at `rdPtr` in returndata.\n function readUint136(\n ReturndataPointer rdPtr\n ) internal pure returns (uint136 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint144 at `rdPtr` in returndata.\n function readUint144(\n ReturndataPointer rdPtr\n ) internal pure returns (uint144 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint152 at `rdPtr` in returndata.\n function readUint152(\n ReturndataPointer rdPtr\n ) internal pure returns (uint152 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint160 at `rdPtr` in returndata.\n function readUint160(\n ReturndataPointer rdPtr\n ) internal pure returns (uint160 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint168 at `rdPtr` in returndata.\n function readUint168(\n ReturndataPointer rdPtr\n ) internal pure returns (uint168 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint176 at `rdPtr` in returndata.\n function readUint176(\n ReturndataPointer rdPtr\n ) internal pure returns (uint176 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint184 at `rdPtr` in returndata.\n function readUint184(\n ReturndataPointer rdPtr\n ) internal pure returns (uint184 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint192 at `rdPtr` in returndata.\n function readUint192(\n ReturndataPointer rdPtr\n ) internal pure returns (uint192 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint200 at `rdPtr` in returndata.\n function readUint200(\n ReturndataPointer rdPtr\n ) internal pure returns (uint200 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint208 at `rdPtr` in returndata.\n function readUint208(\n ReturndataPointer rdPtr\n ) internal pure returns (uint208 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint216 at `rdPtr` in returndata.\n function readUint216(\n ReturndataPointer rdPtr\n ) internal pure returns (uint216 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint224 at `rdPtr` in returndata.\n function readUint224(\n ReturndataPointer rdPtr\n ) internal pure returns (uint224 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint232 at `rdPtr` in returndata.\n function readUint232(\n ReturndataPointer rdPtr\n ) internal pure returns (uint232 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint240 at `rdPtr` in returndata.\n function readUint240(\n ReturndataPointer rdPtr\n ) internal pure returns (uint240 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint248 at `rdPtr` in returndata.\n function readUint248(\n ReturndataPointer rdPtr\n ) internal pure returns (uint248 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint256 at `rdPtr` in returndata.\n function readUint256(\n ReturndataPointer rdPtr\n ) internal pure returns (uint256 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int8 at `rdPtr` in returndata.\n function readInt8(\n ReturndataPointer rdPtr\n ) internal pure returns (int8 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int16 at `rdPtr` in returndata.\n function readInt16(\n ReturndataPointer rdPtr\n ) internal pure returns (int16 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int24 at `rdPtr` in returndata.\n function readInt24(\n ReturndataPointer rdPtr\n ) internal pure returns (int24 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int32 at `rdPtr` in returndata.\n function readInt32(\n ReturndataPointer rdPtr\n ) internal pure returns (int32 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int40 at `rdPtr` in returndata.\n function readInt40(\n ReturndataPointer rdPtr\n ) internal pure returns (int40 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int48 at `rdPtr` in returndata.\n function readInt48(\n ReturndataPointer rdPtr\n ) internal pure returns (int48 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int56 at `rdPtr` in returndata.\n function readInt56(\n ReturndataPointer rdPtr\n ) internal pure returns (int56 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int64 at `rdPtr` in returndata.\n function readInt64(\n ReturndataPointer rdPtr\n ) internal pure returns (int64 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int72 at `rdPtr` in returndata.\n function readInt72(\n ReturndataPointer rdPtr\n ) internal pure returns (int72 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int80 at `rdPtr` in returndata.\n function readInt80(\n ReturndataPointer rdPtr\n ) internal pure returns (int80 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int88 at `rdPtr` in returndata.\n function readInt88(\n ReturndataPointer rdPtr\n ) internal pure returns (int88 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int96 at `rdPtr` in returndata.\n function readInt96(\n ReturndataPointer rdPtr\n ) internal pure returns (int96 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int104 at `rdPtr` in returndata.\n function readInt104(\n ReturndataPointer rdPtr\n ) internal pure returns (int104 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int112 at `rdPtr` in returndata.\n function readInt112(\n ReturndataPointer rdPtr\n ) internal pure returns (int112 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int120 at `rdPtr` in returndata.\n function readInt120(\n ReturndataPointer rdPtr\n ) internal pure returns (int120 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int128 at `rdPtr` in returndata.\n function readInt128(\n ReturndataPointer rdPtr\n ) internal pure returns (int128 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int136 at `rdPtr` in returndata.\n function readInt136(\n ReturndataPointer rdPtr\n ) internal pure returns (int136 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int144 at `rdPtr` in returndata.\n function readInt144(\n ReturndataPointer rdPtr\n ) internal pure returns (int144 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int152 at `rdPtr` in returndata.\n function readInt152(\n ReturndataPointer rdPtr\n ) internal pure returns (int152 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int160 at `rdPtr` in returndata.\n function readInt160(\n ReturndataPointer rdPtr\n ) internal pure returns (int160 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int168 at `rdPtr` in returndata.\n function readInt168(\n ReturndataPointer rdPtr\n ) internal pure returns (int168 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int176 at `rdPtr` in returndata.\n function readInt176(\n ReturndataPointer rdPtr\n ) internal pure returns (int176 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int184 at `rdPtr` in returndata.\n function readInt184(\n ReturndataPointer rdPtr\n ) internal pure returns (int184 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int192 at `rdPtr` in returndata.\n function readInt192(\n ReturndataPointer rdPtr\n ) internal pure returns (int192 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int200 at `rdPtr` in returndata.\n function readInt200(\n ReturndataPointer rdPtr\n ) internal pure returns (int200 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int208 at `rdPtr` in returndata.\n function readInt208(\n ReturndataPointer rdPtr\n ) internal pure returns (int208 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int216 at `rdPtr` in returndata.\n function readInt216(\n ReturndataPointer rdPtr\n ) internal pure returns (int216 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int224 at `rdPtr` in returndata.\n function readInt224(\n ReturndataPointer rdPtr\n ) internal pure returns (int224 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int232 at `rdPtr` in returndata.\n function readInt232(\n ReturndataPointer rdPtr\n ) internal pure returns (int232 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int240 at `rdPtr` in returndata.\n function readInt240(\n ReturndataPointer rdPtr\n ) internal pure returns (int240 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int248 at `rdPtr` in returndata.\n function readInt248(\n ReturndataPointer rdPtr\n ) internal pure returns (int248 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int256 at `rdPtr` in returndata.\n function readInt256(\n ReturndataPointer rdPtr\n ) internal pure returns (int256 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n}\n\nlibrary MemoryReaders {\n /// @dev Reads the memory pointer at `mPtr` in memory.\n function readMemoryPointer(\n MemoryPointer mPtr\n ) internal pure returns (MemoryPointer value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads value at `mPtr` & applies a mask to return only last 4 bytes\n function readMaskedUint256(\n MemoryPointer mPtr\n ) internal pure returns (uint256 value) {\n value = mPtr.readUint256() & OffsetOrLengthMask;\n }\n\n /// @dev Reads the bool at `mPtr` in memory.\n function readBool(MemoryPointer mPtr) internal pure returns (bool value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the address at `mPtr` in memory.\n function readAddress(\n MemoryPointer mPtr\n ) internal pure returns (address value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes1 at `mPtr` in memory.\n function readBytes1(\n MemoryPointer mPtr\n ) internal pure returns (bytes1 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes2 at `mPtr` in memory.\n function readBytes2(\n MemoryPointer mPtr\n ) internal pure returns (bytes2 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes3 at `mPtr` in memory.\n function readBytes3(\n MemoryPointer mPtr\n ) internal pure returns (bytes3 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes4 at `mPtr` in memory.\n function readBytes4(\n MemoryPointer mPtr\n ) internal pure returns (bytes4 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes5 at `mPtr` in memory.\n function readBytes5(\n MemoryPointer mPtr\n ) internal pure returns (bytes5 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes6 at `mPtr` in memory.\n function readBytes6(\n MemoryPointer mPtr\n ) internal pure returns (bytes6 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes7 at `mPtr` in memory.\n function readBytes7(\n MemoryPointer mPtr\n ) internal pure returns (bytes7 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes8 at `mPtr` in memory.\n function readBytes8(\n MemoryPointer mPtr\n ) internal pure returns (bytes8 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes9 at `mPtr` in memory.\n function readBytes9(\n MemoryPointer mPtr\n ) internal pure returns (bytes9 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes10 at `mPtr` in memory.\n function readBytes10(\n MemoryPointer mPtr\n ) internal pure returns (bytes10 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes11 at `mPtr` in memory.\n function readBytes11(\n MemoryPointer mPtr\n ) internal pure returns (bytes11 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes12 at `mPtr` in memory.\n function readBytes12(\n MemoryPointer mPtr\n ) internal pure returns (bytes12 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes13 at `mPtr` in memory.\n function readBytes13(\n MemoryPointer mPtr\n ) internal pure returns (bytes13 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes14 at `mPtr` in memory.\n function readBytes14(\n MemoryPointer mPtr\n ) internal pure returns (bytes14 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes15 at `mPtr` in memory.\n function readBytes15(\n MemoryPointer mPtr\n ) internal pure returns (bytes15 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes16 at `mPtr` in memory.\n function readBytes16(\n MemoryPointer mPtr\n ) internal pure returns (bytes16 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes17 at `mPtr` in memory.\n function readBytes17(\n MemoryPointer mPtr\n ) internal pure returns (bytes17 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes18 at `mPtr` in memory.\n function readBytes18(\n MemoryPointer mPtr\n ) internal pure returns (bytes18 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes19 at `mPtr` in memory.\n function readBytes19(\n MemoryPointer mPtr\n ) internal pure returns (bytes19 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes20 at `mPtr` in memory.\n function readBytes20(\n MemoryPointer mPtr\n ) internal pure returns (bytes20 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes21 at `mPtr` in memory.\n function readBytes21(\n MemoryPointer mPtr\n ) internal pure returns (bytes21 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes22 at `mPtr` in memory.\n function readBytes22(\n MemoryPointer mPtr\n ) internal pure returns (bytes22 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes23 at `mPtr` in memory.\n function readBytes23(\n MemoryPointer mPtr\n ) internal pure returns (bytes23 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes24 at `mPtr` in memory.\n function readBytes24(\n MemoryPointer mPtr\n ) internal pure returns (bytes24 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes25 at `mPtr` in memory.\n function readBytes25(\n MemoryPointer mPtr\n ) internal pure returns (bytes25 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes26 at `mPtr` in memory.\n function readBytes26(\n MemoryPointer mPtr\n ) internal pure returns (bytes26 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes27 at `mPtr` in memory.\n function readBytes27(\n MemoryPointer mPtr\n ) internal pure returns (bytes27 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes28 at `mPtr` in memory.\n function readBytes28(\n MemoryPointer mPtr\n ) internal pure returns (bytes28 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes29 at `mPtr` in memory.\n function readBytes29(\n MemoryPointer mPtr\n ) internal pure returns (bytes29 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes30 at `mPtr` in memory.\n function readBytes30(\n MemoryPointer mPtr\n ) internal pure returns (bytes30 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes31 at `mPtr` in memory.\n function readBytes31(\n MemoryPointer mPtr\n ) internal pure returns (bytes31 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes32 at `mPtr` in memory.\n function readBytes32(\n MemoryPointer mPtr\n ) internal pure returns (bytes32 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint8 at `mPtr` in memory.\n function readUint8(MemoryPointer mPtr) internal pure returns (uint8 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint16 at `mPtr` in memory.\n function readUint16(\n MemoryPointer mPtr\n ) internal pure returns (uint16 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint24 at `mPtr` in memory.\n function readUint24(\n MemoryPointer mPtr\n ) internal pure returns (uint24 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint32 at `mPtr` in memory.\n function readUint32(\n MemoryPointer mPtr\n ) internal pure returns (uint32 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint40 at `mPtr` in memory.\n function readUint40(\n MemoryPointer mPtr\n ) internal pure returns (uint40 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint48 at `mPtr` in memory.\n function readUint48(\n MemoryPointer mPtr\n ) internal pure returns (uint48 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint56 at `mPtr` in memory.\n function readUint56(\n MemoryPointer mPtr\n ) internal pure returns (uint56 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint64 at `mPtr` in memory.\n function readUint64(\n MemoryPointer mPtr\n ) internal pure returns (uint64 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint72 at `mPtr` in memory.\n function readUint72(\n MemoryPointer mPtr\n ) internal pure returns (uint72 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint80 at `mPtr` in memory.\n function readUint80(\n MemoryPointer mPtr\n ) internal pure returns (uint80 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint88 at `mPtr` in memory.\n function readUint88(\n MemoryPointer mPtr\n ) internal pure returns (uint88 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint96 at `mPtr` in memory.\n function readUint96(\n MemoryPointer mPtr\n ) internal pure returns (uint96 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint104 at `mPtr` in memory.\n function readUint104(\n MemoryPointer mPtr\n ) internal pure returns (uint104 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint112 at `mPtr` in memory.\n function readUint112(\n MemoryPointer mPtr\n ) internal pure returns (uint112 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint120 at `mPtr` in memory.\n function readUint120(\n MemoryPointer mPtr\n ) internal pure returns (uint120 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint128 at `mPtr` in memory.\n function readUint128(\n MemoryPointer mPtr\n ) internal pure returns (uint128 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint136 at `mPtr` in memory.\n function readUint136(\n MemoryPointer mPtr\n ) internal pure returns (uint136 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint144 at `mPtr` in memory.\n function readUint144(\n MemoryPointer mPtr\n ) internal pure returns (uint144 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint152 at `mPtr` in memory.\n function readUint152(\n MemoryPointer mPtr\n ) internal pure returns (uint152 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint160 at `mPtr` in memory.\n function readUint160(\n MemoryPointer mPtr\n ) internal pure returns (uint160 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint168 at `mPtr` in memory.\n function readUint168(\n MemoryPointer mPtr\n ) internal pure returns (uint168 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint176 at `mPtr` in memory.\n function readUint176(\n MemoryPointer mPtr\n ) internal pure returns (uint176 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint184 at `mPtr` in memory.\n function readUint184(\n MemoryPointer mPtr\n ) internal pure returns (uint184 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint192 at `mPtr` in memory.\n function readUint192(\n MemoryPointer mPtr\n ) internal pure returns (uint192 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint200 at `mPtr` in memory.\n function readUint200(\n MemoryPointer mPtr\n ) internal pure returns (uint200 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint208 at `mPtr` in memory.\n function readUint208(\n MemoryPointer mPtr\n ) internal pure returns (uint208 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint216 at `mPtr` in memory.\n function readUint216(\n MemoryPointer mPtr\n ) internal pure returns (uint216 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint224 at `mPtr` in memory.\n function readUint224(\n MemoryPointer mPtr\n ) internal pure returns (uint224 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint232 at `mPtr` in memory.\n function readUint232(\n MemoryPointer mPtr\n ) internal pure returns (uint232 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint240 at `mPtr` in memory.\n function readUint240(\n MemoryPointer mPtr\n ) internal pure returns (uint240 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint248 at `mPtr` in memory.\n function readUint248(\n MemoryPointer mPtr\n ) internal pure returns (uint248 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint256 at `mPtr` in memory.\n function readUint256(\n MemoryPointer mPtr\n ) internal pure returns (uint256 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int8 at `mPtr` in memory.\n function readInt8(MemoryPointer mPtr) internal pure returns (int8 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int16 at `mPtr` in memory.\n function readInt16(MemoryPointer mPtr) internal pure returns (int16 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int24 at `mPtr` in memory.\n function readInt24(MemoryPointer mPtr) internal pure returns (int24 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int32 at `mPtr` in memory.\n function readInt32(MemoryPointer mPtr) internal pure returns (int32 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int40 at `mPtr` in memory.\n function readInt40(MemoryPointer mPtr) internal pure returns (int40 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int48 at `mPtr` in memory.\n function readInt48(MemoryPointer mPtr) internal pure returns (int48 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int56 at `mPtr` in memory.\n function readInt56(MemoryPointer mPtr) internal pure returns (int56 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int64 at `mPtr` in memory.\n function readInt64(MemoryPointer mPtr) internal pure returns (int64 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int72 at `mPtr` in memory.\n function readInt72(MemoryPointer mPtr) internal pure returns (int72 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int80 at `mPtr` in memory.\n function readInt80(MemoryPointer mPtr) internal pure returns (int80 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int88 at `mPtr` in memory.\n function readInt88(MemoryPointer mPtr) internal pure returns (int88 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int96 at `mPtr` in memory.\n function readInt96(MemoryPointer mPtr) internal pure returns (int96 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int104 at `mPtr` in memory.\n function readInt104(\n MemoryPointer mPtr\n ) internal pure returns (int104 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int112 at `mPtr` in memory.\n function readInt112(\n MemoryPointer mPtr\n ) internal pure returns (int112 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int120 at `mPtr` in memory.\n function readInt120(\n MemoryPointer mPtr\n ) internal pure returns (int120 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int128 at `mPtr` in memory.\n function readInt128(\n MemoryPointer mPtr\n ) internal pure returns (int128 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int136 at `mPtr` in memory.\n function readInt136(\n MemoryPointer mPtr\n ) internal pure returns (int136 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int144 at `mPtr` in memory.\n function readInt144(\n MemoryPointer mPtr\n ) internal pure returns (int144 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int152 at `mPtr` in memory.\n function readInt152(\n MemoryPointer mPtr\n ) internal pure returns (int152 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int160 at `mPtr` in memory.\n function readInt160(\n MemoryPointer mPtr\n ) internal pure returns (int160 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int168 at `mPtr` in memory.\n function readInt168(\n MemoryPointer mPtr\n ) internal pure returns (int168 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int176 at `mPtr` in memory.\n function readInt176(\n MemoryPointer mPtr\n ) internal pure returns (int176 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int184 at `mPtr` in memory.\n function readInt184(\n MemoryPointer mPtr\n ) internal pure returns (int184 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int192 at `mPtr` in memory.\n function readInt192(\n MemoryPointer mPtr\n ) internal pure returns (int192 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int200 at `mPtr` in memory.\n function readInt200(\n MemoryPointer mPtr\n ) internal pure returns (int200 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int208 at `mPtr` in memory.\n function readInt208(\n MemoryPointer mPtr\n ) internal pure returns (int208 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int216 at `mPtr` in memory.\n function readInt216(\n MemoryPointer mPtr\n ) internal pure returns (int216 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int224 at `mPtr` in memory.\n function readInt224(\n MemoryPointer mPtr\n ) internal pure returns (int224 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int232 at `mPtr` in memory.\n function readInt232(\n MemoryPointer mPtr\n ) internal pure returns (int232 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int240 at `mPtr` in memory.\n function readInt240(\n MemoryPointer mPtr\n ) internal pure returns (int240 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int248 at `mPtr` in memory.\n function readInt248(\n MemoryPointer mPtr\n ) internal pure returns (int248 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int256 at `mPtr` in memory.\n function readInt256(\n MemoryPointer mPtr\n ) internal pure returns (int256 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n}\n\nlibrary MemoryWriters {\n /// @dev Writes `valuePtr` to memory at `mPtr`.\n function write(MemoryPointer mPtr, MemoryPointer valuePtr) internal pure {\n assembly {\n mstore(mPtr, valuePtr)\n }\n }\n\n /// @dev Writes a boolean `value` to `mPtr` in memory.\n function write(MemoryPointer mPtr, bool value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes an address `value` to `mPtr` in memory.\n function write(MemoryPointer mPtr, address value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes a bytes32 `value` to `mPtr` in memory.\n /// Separate name to disambiguate literal write parameters.\n function writeBytes32(MemoryPointer mPtr, bytes32 value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes a uint256 `value` to `mPtr` in memory.\n function write(MemoryPointer mPtr, uint256 value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes an int256 `value` to `mPtr` in memory.\n /// Separate name to disambiguate literal write parameters.\n function writeInt(MemoryPointer mPtr, int256 value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n}\n"
},
"lib/seaport/lib/seaport-types/src/interfaces/IERC165.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.7;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
},
"lib/openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.19;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(target.code.length > 0, \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n"
},
"src/lib/ERC721SeaDropStructs.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { AllowListData, CreatorPayout } from \"./SeaDropStructs.sol\";\n\n/**\n * @notice A struct defining public drop data.\n * Designed to fit efficiently in two storage slots.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param paymentToken The payment token address. Null for\n * native token.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed. (The limit for this field is\n * 2^16 - 1)\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct PublicDrop {\n uint80 startPrice; // 80/512 bits\n uint80 endPrice; // 160/512 bits\n uint40 startTime; // 200/512 bits\n uint40 endTime; // 240/512 bits\n address paymentToken; // 400/512 bits\n uint16 maxTotalMintableByWallet; // 416/512 bits\n uint16 feeBps; // 432/512 bits\n bool restrictFeeRecipients; // 440/512 bits\n}\n\n/**\n * @notice A struct defining mint params for an allow list.\n * An allow list leaf will be composed of `msg.sender` and\n * the following params.\n *\n * Note: Since feeBps is encoded in the leaf, backend should ensure\n * that feeBps is acceptable before generating a proof.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param paymentToken The payment token for the mint. Null for\n * native token.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed.\n * @param maxTokenSupplyForStage The limit of token supply this stage can\n * mint within.\n * @param dropStageIndex The drop stage index to emit with the event\n * for analytical purposes. This should be\n * non-zero since the public mint emits with\n * index zero.\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct MintParams {\n uint256 startPrice;\n uint256 endPrice;\n uint256 startTime;\n uint256 endTime;\n address paymentToken;\n uint256 maxTotalMintableByWallet;\n uint256 maxTokenSupplyForStage;\n uint256 dropStageIndex; // non-zero\n uint256 feeBps;\n bool restrictFeeRecipients;\n}\n\n/**\n * @dev Struct containing internal SeaDrop implementation logic\n * mint details to avoid stack too deep.\n *\n * @param feeRecipient The fee recipient.\n * @param payer The payer of the mint.\n * @param minter The mint recipient.\n * @param quantity The number of tokens to mint.\n * @param withEffects Whether to apply state changes of the mint.\n */\nstruct MintDetails {\n address feeRecipient;\n address payer;\n address minter;\n uint256 quantity;\n bool withEffects;\n}\n\n/**\n * @notice A struct to configure multiple contract options in one transaction.\n */\nstruct MultiConfigureStruct {\n uint256 maxSupply;\n string baseURI;\n string contractURI;\n PublicDrop publicDrop;\n string dropURI;\n AllowListData allowListData;\n CreatorPayout[] creatorPayouts;\n bytes32 provenanceHash;\n address[] allowedFeeRecipients;\n address[] disallowedFeeRecipients;\n address[] allowedPayers;\n address[] disallowedPayers;\n // Server-signed\n address[] allowedSigners;\n address[] disallowedSigners;\n // ERC-2981\n address royaltyReceiver;\n uint96 royaltyBps;\n // Mint\n address mintRecipient;\n uint256 mintQuantity;\n}\n"
}
},
"settings": {
"remappings": [
"forge-std/=lib/forge-std/src/",
"ds-test/=lib/forge-std/lib/ds-test/src/",
"ERC721A/=lib/ERC721A/contracts/",
"ERC721A-Upgradeable/=lib/ERC721A-Upgradeable/contracts/",
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"@openzeppelin-upgradeable/contracts/=lib/openzeppelin-contracts-upgradeable/contracts/",
"@rari-capital/solmate/=lib/seaport/lib/solmate/",
"murky/=lib/murky/src/",
"create2-scripts/=lib/create2-helpers/script/",
"seadrop/=src/",
"seaport-sol/=lib/seaport/lib/seaport-sol/",
"seaport-types/=lib/seaport/lib/seaport-types/",
"seaport-core/=lib/seaport/lib/seaport-core/",
"seaport-test-utils/=lib/seaport/test/foundry/utils/",
"solady/=lib/solady/"
],
"optimizer": {
"enabled": true,
"runs": 100000
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "none",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "paris",
"viaIR": false,
"libraries": {}
}
}} |
1 | 20,291,184 | 05d9fbdd59f0ead6d1782dcc9beafc1db604432d9887083fc568e0a9952a10fc | d2c4194587760a28373d80529d52d89104dc1efc33cb148f9247cca90f3b5b3a | 0580d019b144b30a061e659609bbcc62e140e127 | 0580d019b144b30a061e659609bbcc62e140e127 | db9284754bbfb05feec84e7c47be611d4665425e | 60806040526001600c5534801561001557600080fd5b5060405146908060526123868239604080519182900360520182208282018252600a8352692ab734b9bbb0b8102b1960b11b6020938401528151808301835260018152603160f81b908401528151808401919091527fbfcc8ef98ffbf7b6c3fec7bf5185b566b9863e35a9d83acd49ad6824b5969738818301527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606082015260808101949094523060a0808601919091528151808603909101815260c09094019052825192019190912060035550600580546001600160a01b03191633179055612281806101056000396000f3fe608060405234801561001057600080fd5b50600436106101a95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a714610534578063d505accf1461053c578063dd62ed3e1461058d578063fff6cae9146105bb576101a9565b8063ba9a7a56146104fe578063bc25cf7714610506578063c45a01551461052c576101a9565b80637ecebe00116100d35780637ecebe001461046557806389afcb441461048b57806395d89b41146104ca578063a9059cbb146104d2576101a9565b80636a6278421461041157806370a08231146104375780637464fc3d1461045d576101a9565b806323b872dd116101665780633644e515116101405780633644e515146103cb578063485cc955146103d35780635909c0d5146104015780635a3d549314610409576101a9565b806323b872dd1461036f57806330adf81f146103a5578063313ce567146103ad576101a9565b8063022c0d9f146101ae57806306fdde031461023c5780630902f1ac146102b9578063095ea7b3146102f15780630dfe16811461033157806318160ddd14610355575b600080fd5b61023a600480360360808110156101c457600080fd5b8135916020810135916001600160a01b0360408301351691908101906080810160608201356401000000008111156101fb57600080fd5b82018360208201111561020d57600080fd5b8035906020019184600183028401116401000000008311171561022f57600080fd5b5090925090506105c3565b005b610244610afe565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561027e578181015183820152602001610266565b50505050905090810190601f1680156102ab5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102c1610b24565b604080516001600160701b03948516815292909316602083015263ffffffff168183015290519081900360600190f35b61031d6004803603604081101561030757600080fd5b506001600160a01b038135169060200135610b4e565b604080519115158252519081900360200190f35b610339610b65565b604080516001600160a01b039092168252519081900360200190f35b61035d610b74565b60408051918252519081900360200190f35b61031d6004803603606081101561038557600080fd5b506001600160a01b03813581169160208101359091169060400135610b7a565b61035d610c14565b6103b5610c38565b6040805160ff9092168252519081900360200190f35b61035d610c3d565b61023a600480360360408110156103e957600080fd5b506001600160a01b0381358116916020013516610c43565b61035d610cc7565b61035d610ccd565b61035d6004803603602081101561042757600080fd5b50356001600160a01b0316610cd3565b61035d6004803603602081101561044d57600080fd5b50356001600160a01b0316610fd3565b61035d610fe5565b61035d6004803603602081101561047b57600080fd5b50356001600160a01b0316610feb565b6104b1600480360360208110156104a157600080fd5b50356001600160a01b0316610ffd565b6040805192835260208301919091528051918290030190f35b6102446113a3565b61031d600480360360408110156104e857600080fd5b506001600160a01b0381351690602001356113c5565b61035d6113d2565b61023a6004803603602081101561051c57600080fd5b50356001600160a01b03166113d8565b610339611543565b610339611552565b61023a600480360360e081101561055257600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611561565b61035d600480360360408110156105a357600080fd5b506001600160a01b0381358116916020013516611763565b61023a611780565b600c5460011461060e576040805162461bcd60e51b8152602060048201526011602482015270155b9a5cddd85c158c8e881313d0d2d151607a1b604482015290519081900360640190fd5b6000600c55841515806106215750600084115b61065c5760405162461bcd60e51b81526004018080602001828103825260258152602001806121936025913960400191505060405180910390fd5b600080610667610b24565b5091509150816001600160701b03168710801561068c5750806001600160701b031686105b6106c75760405162461bcd60e51b81526004018080602001828103825260218152602001806121dc6021913960400191505060405180910390fd5b60065460075460009182916001600160a01b039182169190811690891682148015906107055750806001600160a01b0316896001600160a01b031614155b61074e576040805162461bcd60e51b8152602060048201526015602482015274556e697377617056323a20494e56414c49445f544f60581b604482015290519081900360640190fd5b8a1561075f5761075f828a8d6118e2565b891561077057610770818a8c6118e2565b861561082b57886001600160a01b03166310d1e85c338d8d8c8c6040518663ffffffff1660e01b815260040180866001600160a01b03166001600160a01b03168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b15801561081257600080fd5b505af1158015610826573d6000803e3d6000fd5b505050505b604080516370a0823160e01b815230600482015290516001600160a01b038416916370a08231916024808301926020929190829003018186803b15801561087157600080fd5b505afa158015610885573d6000803e3d6000fd5b505050506040513d602081101561089b57600080fd5b5051604080516370a0823160e01b815230600482015290519195506001600160a01b038316916370a0823191602480820192602092909190829003018186803b1580156108e757600080fd5b505afa1580156108fb573d6000803e3d6000fd5b505050506040513d602081101561091157600080fd5b5051925060009150506001600160701b0385168a90038311610934576000610943565b89856001600160701b03160383035b9050600089856001600160701b031603831161096057600061096f565b89856001600160701b03160383035b905060008211806109805750600081115b6109bb5760405162461bcd60e51b81526004018080602001828103825260248152602001806121b86024913960400191505060405180910390fd5b60006109ef6109d184600363ffffffff611a7c16565b6109e3876103e863ffffffff611a7c16565b9063ffffffff611adf16565b90506000610a076109d184600363ffffffff611a7c16565b9050610a38620f4240610a2c6001600160701b038b8116908b1663ffffffff611a7c16565b9063ffffffff611a7c16565b610a48838363ffffffff611a7c16565b1015610a8a576040805162461bcd60e51b815260206004820152600c60248201526b556e697377617056323a204b60a01b604482015290519081900360640190fd5b5050610a9884848888611b2f565b60408051838152602081018390528082018d9052606081018c905290516001600160a01b038b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a8152602001692ab734b9bbb0b8102b1960b11b81525081565b6008546001600160701b0380821692600160701b830490911691600160e01b900463ffffffff1690565b6000610b5b338484611cf4565b5060015b92915050565b6006546001600160a01b031681565b60005481565b6001600160a01b038316600090815260026020908152604080832033845290915281205460001914610bff576001600160a01b0384166000908152600260209081526040808320338452909152902054610bda908363ffffffff611adf16565b6001600160a01b03851660009081526002602090815260408083203384529091529020555b610c0a848484611d56565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b6005546001600160a01b03163314610c99576040805162461bcd60e51b81526020600482015260146024820152732ab734b9bbb0b82b191d102327a92124a22222a760611b604482015290519081900360640190fd5b600680546001600160a01b039384166001600160a01b03199182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c54600114610d20576040805162461bcd60e51b8152602060048201526011602482015270155b9a5cddd85c158c8e881313d0d2d151607a1b604482015290519081900360640190fd5b6000600c81905580610d30610b24565b50600654604080516370a0823160e01b815230600482015290519395509193506000926001600160a01b03909116916370a08231916024808301926020929190829003018186803b158015610d8457600080fd5b505afa158015610d98573d6000803e3d6000fd5b505050506040513d6020811015610dae57600080fd5b5051600754604080516370a0823160e01b815230600482015290519293506000926001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015610e0157600080fd5b505afa158015610e15573d6000803e3d6000fd5b505050506040513d6020811015610e2b57600080fd5b505190506000610e4a836001600160701b03871663ffffffff611adf16565b90506000610e67836001600160701b03871663ffffffff611adf16565b90506000610e758787611e10565b60005490915080610eb257610e9e6103e86109e3610e99878763ffffffff611a7c16565b611f6e565b9850610ead60006103e8611fc0565b610f01565b610efe6001600160701b038916610ecf868463ffffffff611a7c16565b81610ed657fe5b046001600160701b038916610ef1868563ffffffff611a7c16565b81610ef857fe5b04612056565b98505b60008911610f405760405162461bcd60e51b81526004018080602001828103825260288152602001806122256028913960400191505060405180910390fd5b610f4a8a8a611fc0565b610f5686868a8a611b2f565b8115610f8657600854610f82906001600160701b0380821691600160701b90041663ffffffff611a7c16565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461104b576040805162461bcd60e51b8152602060048201526011602482015270155b9a5cddd85c158c8e881313d0d2d151607a1b604482015290519081900360640190fd5b6000600c8190558061105b610b24565b50600654600754604080516370a0823160e01b815230600482015290519496509294506001600160a01b039182169391169160009184916370a08231916024808301926020929190829003018186803b1580156110b757600080fd5b505afa1580156110cb573d6000803e3d6000fd5b505050506040513d60208110156110e157600080fd5b5051604080516370a0823160e01b815230600482015290519192506000916001600160a01b038516916370a08231916024808301926020929190829003018186803b15801561112f57600080fd5b505afa158015611143573d6000803e3d6000fd5b505050506040513d602081101561115957600080fd5b5051306000908152600160205260408120549192506111788888611e10565b6000549091508061118f848763ffffffff611a7c16565b8161119657fe5b049a50806111aa848663ffffffff611a7c16565b816111b157fe5b04995060008b1180156111c4575060008a115b6111ff5760405162461bcd60e51b81526004018080602001828103825260288152602001806121fd6028913960400191505060405180910390fd5b611209308461206e565b611214878d8d6118e2565b61121f868d8c6118e2565b604080516370a0823160e01b815230600482015290516001600160a01b038916916370a08231916024808301926020929190829003018186803b15801561126557600080fd5b505afa158015611279573d6000803e3d6000fd5b505050506040513d602081101561128f57600080fd5b5051604080516370a0823160e01b815230600482015290519196506001600160a01b038816916370a0823191602480820192602092909190829003018186803b1580156112db57600080fd5b505afa1580156112ef573d6000803e3d6000fd5b505050506040513d602081101561130557600080fd5b5051935061131585858b8b611b2f565b811561134557600854611341906001600160701b0380821691600160701b90041663ffffffff611a7c16565b600b555b604080518c8152602081018c905281516001600160a01b038f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b604051806040016040528060068152602001652aa72496ab1960d11b81525081565b6000610b5b338484611d56565b6103e881565b600c54600114611423576040805162461bcd60e51b8152602060048201526011602482015270155b9a5cddd85c158c8e881313d0d2d151607a1b604482015290519081900360640190fd5b6000600c55600654600754600854604080516370a0823160e01b815230600482015290516001600160a01b0394851694909316926114d292859287926114cd926001600160701b03169185916370a0823191602480820192602092909190829003018186803b15801561149557600080fd5b505afa1580156114a9573d6000803e3d6000fd5b505050506040513d60208110156114bf57600080fd5b50519063ffffffff611adf16565b6118e2565b600854604080516370a0823160e01b8152306004820152905161153992849287926114cd92600160701b90046001600160701b0316916001600160a01b038616916370a0823191602480820192602092909190829003018186803b15801561149557600080fd5b50506001600c5550565b6005546001600160a01b031681565b6007546001600160a01b031681565b428410156115ab576040805162461bcd60e51b8152602060048201526012602482015271155b9a5cddd85c158c8e881156141254915160721b604482015290519081900360640190fd5b6003546001600160a01b0380891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e08501825280519083012061190160f01b6101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e280820193601f1981019281900390910190855afa1580156116c6573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116158015906116fc5750886001600160a01b0316816001600160a01b0316145b61174d576040805162461bcd60e51b815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611758898989611cf4565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c546001146117cb576040805162461bcd60e51b8152602060048201526011602482015270155b9a5cddd85c158c8e881313d0d2d151607a1b604482015290519081900360640190fd5b6000600c55600654604080516370a0823160e01b815230600482015290516118db926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561181c57600080fd5b505afa158015611830573d6000803e3d6000fd5b505050506040513d602081101561184657600080fd5b5051600754604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561189357600080fd5b505afa1580156118a7573d6000803e3d6000fd5b505050506040513d60208110156118bd57600080fd5b50516008546001600160701b0380821691600160701b900416611b2f565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e74323536290000000000000060209182015281516001600160a01b0385811660248301526044808301869052845180840390910181526064909201845291810180516001600160e01b031663a9059cbb60e01b1781529251815160009460609489169392918291908083835b6020831061198f5780518252601f199092019160209182019101611970565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146119f1576040519150601f19603f3d011682016040523d82523d6000602084013e6119f6565b606091505b5091509150818015611a24575080511580611a245750808060200190516020811015611a2157600080fd5b50515b611a75576040805162461bcd60e51b815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b6000811580611a9757505080820282828281611a9457fe5b04145b610b5f576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6d756c2d6f766572666c6f7760601b604482015290519081900360640190fd5b80820382811115610b5f576040805162461bcd60e51b815260206004820152601560248201527464732d6d6174682d7375622d756e646572666c6f7760581b604482015290519081900360640190fd5b6001600160701b038411801590611b4d57506001600160701b038311155b611b94576040805162461bcd60e51b8152602060048201526013602482015272556e697377617056323a204f564552464c4f5760681b604482015290519081900360640190fd5b60085463ffffffff42811691600160e01b90048116820390811615801590611bc457506001600160701b03841615155b8015611bd857506001600160701b03831615155b15611c49578063ffffffff16611c0685611bf18661210c565b6001600160e01b03169063ffffffff61211e16565b600980546001600160e01b03929092169290920201905563ffffffff8116611c3184611bf18761210c565b600a80546001600160e01b0392909216929092020190555b600880546dffffffffffffffffffffffffffff19166001600160701b03888116919091176dffffffffffffffffffffffffffff60701b1916600160701b8883168102919091176001600160e01b0316600160e01b63ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b6001600160a01b03808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316600090815260016020526040902054611d7f908263ffffffff611adf16565b6001600160a01b038085166000908152600160205260408082209390935590841681522054611db4908263ffffffff61214316565b6001600160a01b0380841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a90046001600160a01b03166001600160a01b031663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b158015611e6157600080fd5b505afa158015611e75573d6000803e3d6000fd5b505050506040513d6020811015611e8b57600080fd5b5051600b546001600160a01b038216158015945091925090611f5a578015611f55576000611ece610e996001600160701b0388811690881663ffffffff611a7c16565b90506000611edb83611f6e565b905080821115611f52576000611f09611efa848463ffffffff611adf16565b6000549063ffffffff611a7c16565b90506000611f2e83611f2286600563ffffffff611a7c16565b9063ffffffff61214316565b90506000818381611f3b57fe5b0490508015611f4e57611f4e8782611fc0565b5050505b50505b611f66565b8015611f66576000600b555b505092915050565b60006003821115611fb1575080600160028204015b81811015611fab57809150600281828581611f9a57fe5b040181611fa357fe5b049050611f83565b50611fbb565b8115611fbb575060015b919050565b600054611fd3908263ffffffff61214316565b60009081556001600160a01b038316815260016020526040902054611ffe908263ffffffff61214316565b6001600160a01b03831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b60008183106120655781612067565b825b9392505050565b6001600160a01b038216600090815260016020526040902054612097908263ffffffff611adf16565b6001600160a01b038316600090815260016020526040812091909155546120c4908263ffffffff611adf16565b60009081556040805183815290516001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6001600160701b0316600160701b0290565b60006001600160701b0382166001600160e01b0384168161213b57fe5b049392505050565b80820182811015610b5f576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6164642d6f766572666c6f7760601b604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a7231582082fba8557d35ae5eca98219a61e967d398ed8eaafeafa5fe5af73dd6aad9ddfd64736f6c63430005100032454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429 | 608060405234801561001057600080fd5b50600436106101a95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a714610534578063d505accf1461053c578063dd62ed3e1461058d578063fff6cae9146105bb576101a9565b8063ba9a7a56146104fe578063bc25cf7714610506578063c45a01551461052c576101a9565b80637ecebe00116100d35780637ecebe001461046557806389afcb441461048b57806395d89b41146104ca578063a9059cbb146104d2576101a9565b80636a6278421461041157806370a08231146104375780637464fc3d1461045d576101a9565b806323b872dd116101665780633644e515116101405780633644e515146103cb578063485cc955146103d35780635909c0d5146104015780635a3d549314610409576101a9565b806323b872dd1461036f57806330adf81f146103a5578063313ce567146103ad576101a9565b8063022c0d9f146101ae57806306fdde031461023c5780630902f1ac146102b9578063095ea7b3146102f15780630dfe16811461033157806318160ddd14610355575b600080fd5b61023a600480360360808110156101c457600080fd5b8135916020810135916001600160a01b0360408301351691908101906080810160608201356401000000008111156101fb57600080fd5b82018360208201111561020d57600080fd5b8035906020019184600183028401116401000000008311171561022f57600080fd5b5090925090506105c3565b005b610244610afe565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561027e578181015183820152602001610266565b50505050905090810190601f1680156102ab5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102c1610b24565b604080516001600160701b03948516815292909316602083015263ffffffff168183015290519081900360600190f35b61031d6004803603604081101561030757600080fd5b506001600160a01b038135169060200135610b4e565b604080519115158252519081900360200190f35b610339610b65565b604080516001600160a01b039092168252519081900360200190f35b61035d610b74565b60408051918252519081900360200190f35b61031d6004803603606081101561038557600080fd5b506001600160a01b03813581169160208101359091169060400135610b7a565b61035d610c14565b6103b5610c38565b6040805160ff9092168252519081900360200190f35b61035d610c3d565b61023a600480360360408110156103e957600080fd5b506001600160a01b0381358116916020013516610c43565b61035d610cc7565b61035d610ccd565b61035d6004803603602081101561042757600080fd5b50356001600160a01b0316610cd3565b61035d6004803603602081101561044d57600080fd5b50356001600160a01b0316610fd3565b61035d610fe5565b61035d6004803603602081101561047b57600080fd5b50356001600160a01b0316610feb565b6104b1600480360360208110156104a157600080fd5b50356001600160a01b0316610ffd565b6040805192835260208301919091528051918290030190f35b6102446113a3565b61031d600480360360408110156104e857600080fd5b506001600160a01b0381351690602001356113c5565b61035d6113d2565b61023a6004803603602081101561051c57600080fd5b50356001600160a01b03166113d8565b610339611543565b610339611552565b61023a600480360360e081101561055257600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611561565b61035d600480360360408110156105a357600080fd5b506001600160a01b0381358116916020013516611763565b61023a611780565b600c5460011461060e576040805162461bcd60e51b8152602060048201526011602482015270155b9a5cddd85c158c8e881313d0d2d151607a1b604482015290519081900360640190fd5b6000600c55841515806106215750600084115b61065c5760405162461bcd60e51b81526004018080602001828103825260258152602001806121936025913960400191505060405180910390fd5b600080610667610b24565b5091509150816001600160701b03168710801561068c5750806001600160701b031686105b6106c75760405162461bcd60e51b81526004018080602001828103825260218152602001806121dc6021913960400191505060405180910390fd5b60065460075460009182916001600160a01b039182169190811690891682148015906107055750806001600160a01b0316896001600160a01b031614155b61074e576040805162461bcd60e51b8152602060048201526015602482015274556e697377617056323a20494e56414c49445f544f60581b604482015290519081900360640190fd5b8a1561075f5761075f828a8d6118e2565b891561077057610770818a8c6118e2565b861561082b57886001600160a01b03166310d1e85c338d8d8c8c6040518663ffffffff1660e01b815260040180866001600160a01b03166001600160a01b03168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b15801561081257600080fd5b505af1158015610826573d6000803e3d6000fd5b505050505b604080516370a0823160e01b815230600482015290516001600160a01b038416916370a08231916024808301926020929190829003018186803b15801561087157600080fd5b505afa158015610885573d6000803e3d6000fd5b505050506040513d602081101561089b57600080fd5b5051604080516370a0823160e01b815230600482015290519195506001600160a01b038316916370a0823191602480820192602092909190829003018186803b1580156108e757600080fd5b505afa1580156108fb573d6000803e3d6000fd5b505050506040513d602081101561091157600080fd5b5051925060009150506001600160701b0385168a90038311610934576000610943565b89856001600160701b03160383035b9050600089856001600160701b031603831161096057600061096f565b89856001600160701b03160383035b905060008211806109805750600081115b6109bb5760405162461bcd60e51b81526004018080602001828103825260248152602001806121b86024913960400191505060405180910390fd5b60006109ef6109d184600363ffffffff611a7c16565b6109e3876103e863ffffffff611a7c16565b9063ffffffff611adf16565b90506000610a076109d184600363ffffffff611a7c16565b9050610a38620f4240610a2c6001600160701b038b8116908b1663ffffffff611a7c16565b9063ffffffff611a7c16565b610a48838363ffffffff611a7c16565b1015610a8a576040805162461bcd60e51b815260206004820152600c60248201526b556e697377617056323a204b60a01b604482015290519081900360640190fd5b5050610a9884848888611b2f565b60408051838152602081018390528082018d9052606081018c905290516001600160a01b038b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a8152602001692ab734b9bbb0b8102b1960b11b81525081565b6008546001600160701b0380821692600160701b830490911691600160e01b900463ffffffff1690565b6000610b5b338484611cf4565b5060015b92915050565b6006546001600160a01b031681565b60005481565b6001600160a01b038316600090815260026020908152604080832033845290915281205460001914610bff576001600160a01b0384166000908152600260209081526040808320338452909152902054610bda908363ffffffff611adf16565b6001600160a01b03851660009081526002602090815260408083203384529091529020555b610c0a848484611d56565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b6005546001600160a01b03163314610c99576040805162461bcd60e51b81526020600482015260146024820152732ab734b9bbb0b82b191d102327a92124a22222a760611b604482015290519081900360640190fd5b600680546001600160a01b039384166001600160a01b03199182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c54600114610d20576040805162461bcd60e51b8152602060048201526011602482015270155b9a5cddd85c158c8e881313d0d2d151607a1b604482015290519081900360640190fd5b6000600c81905580610d30610b24565b50600654604080516370a0823160e01b815230600482015290519395509193506000926001600160a01b03909116916370a08231916024808301926020929190829003018186803b158015610d8457600080fd5b505afa158015610d98573d6000803e3d6000fd5b505050506040513d6020811015610dae57600080fd5b5051600754604080516370a0823160e01b815230600482015290519293506000926001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015610e0157600080fd5b505afa158015610e15573d6000803e3d6000fd5b505050506040513d6020811015610e2b57600080fd5b505190506000610e4a836001600160701b03871663ffffffff611adf16565b90506000610e67836001600160701b03871663ffffffff611adf16565b90506000610e758787611e10565b60005490915080610eb257610e9e6103e86109e3610e99878763ffffffff611a7c16565b611f6e565b9850610ead60006103e8611fc0565b610f01565b610efe6001600160701b038916610ecf868463ffffffff611a7c16565b81610ed657fe5b046001600160701b038916610ef1868563ffffffff611a7c16565b81610ef857fe5b04612056565b98505b60008911610f405760405162461bcd60e51b81526004018080602001828103825260288152602001806122256028913960400191505060405180910390fd5b610f4a8a8a611fc0565b610f5686868a8a611b2f565b8115610f8657600854610f82906001600160701b0380821691600160701b90041663ffffffff611a7c16565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461104b576040805162461bcd60e51b8152602060048201526011602482015270155b9a5cddd85c158c8e881313d0d2d151607a1b604482015290519081900360640190fd5b6000600c8190558061105b610b24565b50600654600754604080516370a0823160e01b815230600482015290519496509294506001600160a01b039182169391169160009184916370a08231916024808301926020929190829003018186803b1580156110b757600080fd5b505afa1580156110cb573d6000803e3d6000fd5b505050506040513d60208110156110e157600080fd5b5051604080516370a0823160e01b815230600482015290519192506000916001600160a01b038516916370a08231916024808301926020929190829003018186803b15801561112f57600080fd5b505afa158015611143573d6000803e3d6000fd5b505050506040513d602081101561115957600080fd5b5051306000908152600160205260408120549192506111788888611e10565b6000549091508061118f848763ffffffff611a7c16565b8161119657fe5b049a50806111aa848663ffffffff611a7c16565b816111b157fe5b04995060008b1180156111c4575060008a115b6111ff5760405162461bcd60e51b81526004018080602001828103825260288152602001806121fd6028913960400191505060405180910390fd5b611209308461206e565b611214878d8d6118e2565b61121f868d8c6118e2565b604080516370a0823160e01b815230600482015290516001600160a01b038916916370a08231916024808301926020929190829003018186803b15801561126557600080fd5b505afa158015611279573d6000803e3d6000fd5b505050506040513d602081101561128f57600080fd5b5051604080516370a0823160e01b815230600482015290519196506001600160a01b038816916370a0823191602480820192602092909190829003018186803b1580156112db57600080fd5b505afa1580156112ef573d6000803e3d6000fd5b505050506040513d602081101561130557600080fd5b5051935061131585858b8b611b2f565b811561134557600854611341906001600160701b0380821691600160701b90041663ffffffff611a7c16565b600b555b604080518c8152602081018c905281516001600160a01b038f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b604051806040016040528060068152602001652aa72496ab1960d11b81525081565b6000610b5b338484611d56565b6103e881565b600c54600114611423576040805162461bcd60e51b8152602060048201526011602482015270155b9a5cddd85c158c8e881313d0d2d151607a1b604482015290519081900360640190fd5b6000600c55600654600754600854604080516370a0823160e01b815230600482015290516001600160a01b0394851694909316926114d292859287926114cd926001600160701b03169185916370a0823191602480820192602092909190829003018186803b15801561149557600080fd5b505afa1580156114a9573d6000803e3d6000fd5b505050506040513d60208110156114bf57600080fd5b50519063ffffffff611adf16565b6118e2565b600854604080516370a0823160e01b8152306004820152905161153992849287926114cd92600160701b90046001600160701b0316916001600160a01b038616916370a0823191602480820192602092909190829003018186803b15801561149557600080fd5b50506001600c5550565b6005546001600160a01b031681565b6007546001600160a01b031681565b428410156115ab576040805162461bcd60e51b8152602060048201526012602482015271155b9a5cddd85c158c8e881156141254915160721b604482015290519081900360640190fd5b6003546001600160a01b0380891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e08501825280519083012061190160f01b6101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e280820193601f1981019281900390910190855afa1580156116c6573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116158015906116fc5750886001600160a01b0316816001600160a01b0316145b61174d576040805162461bcd60e51b815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611758898989611cf4565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c546001146117cb576040805162461bcd60e51b8152602060048201526011602482015270155b9a5cddd85c158c8e881313d0d2d151607a1b604482015290519081900360640190fd5b6000600c55600654604080516370a0823160e01b815230600482015290516118db926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561181c57600080fd5b505afa158015611830573d6000803e3d6000fd5b505050506040513d602081101561184657600080fd5b5051600754604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561189357600080fd5b505afa1580156118a7573d6000803e3d6000fd5b505050506040513d60208110156118bd57600080fd5b50516008546001600160701b0380821691600160701b900416611b2f565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e74323536290000000000000060209182015281516001600160a01b0385811660248301526044808301869052845180840390910181526064909201845291810180516001600160e01b031663a9059cbb60e01b1781529251815160009460609489169392918291908083835b6020831061198f5780518252601f199092019160209182019101611970565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146119f1576040519150601f19603f3d011682016040523d82523d6000602084013e6119f6565b606091505b5091509150818015611a24575080511580611a245750808060200190516020811015611a2157600080fd5b50515b611a75576040805162461bcd60e51b815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b6000811580611a9757505080820282828281611a9457fe5b04145b610b5f576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6d756c2d6f766572666c6f7760601b604482015290519081900360640190fd5b80820382811115610b5f576040805162461bcd60e51b815260206004820152601560248201527464732d6d6174682d7375622d756e646572666c6f7760581b604482015290519081900360640190fd5b6001600160701b038411801590611b4d57506001600160701b038311155b611b94576040805162461bcd60e51b8152602060048201526013602482015272556e697377617056323a204f564552464c4f5760681b604482015290519081900360640190fd5b60085463ffffffff42811691600160e01b90048116820390811615801590611bc457506001600160701b03841615155b8015611bd857506001600160701b03831615155b15611c49578063ffffffff16611c0685611bf18661210c565b6001600160e01b03169063ffffffff61211e16565b600980546001600160e01b03929092169290920201905563ffffffff8116611c3184611bf18761210c565b600a80546001600160e01b0392909216929092020190555b600880546dffffffffffffffffffffffffffff19166001600160701b03888116919091176dffffffffffffffffffffffffffff60701b1916600160701b8883168102919091176001600160e01b0316600160e01b63ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b6001600160a01b03808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316600090815260016020526040902054611d7f908263ffffffff611adf16565b6001600160a01b038085166000908152600160205260408082209390935590841681522054611db4908263ffffffff61214316565b6001600160a01b0380841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a90046001600160a01b03166001600160a01b031663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b158015611e6157600080fd5b505afa158015611e75573d6000803e3d6000fd5b505050506040513d6020811015611e8b57600080fd5b5051600b546001600160a01b038216158015945091925090611f5a578015611f55576000611ece610e996001600160701b0388811690881663ffffffff611a7c16565b90506000611edb83611f6e565b905080821115611f52576000611f09611efa848463ffffffff611adf16565b6000549063ffffffff611a7c16565b90506000611f2e83611f2286600563ffffffff611a7c16565b9063ffffffff61214316565b90506000818381611f3b57fe5b0490508015611f4e57611f4e8782611fc0565b5050505b50505b611f66565b8015611f66576000600b555b505092915050565b60006003821115611fb1575080600160028204015b81811015611fab57809150600281828581611f9a57fe5b040181611fa357fe5b049050611f83565b50611fbb565b8115611fbb575060015b919050565b600054611fd3908263ffffffff61214316565b60009081556001600160a01b038316815260016020526040902054611ffe908263ffffffff61214316565b6001600160a01b03831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b60008183106120655781612067565b825b9392505050565b6001600160a01b038216600090815260016020526040902054612097908263ffffffff611adf16565b6001600160a01b038316600090815260016020526040812091909155546120c4908263ffffffff611adf16565b60009081556040805183815290516001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6001600160701b0316600160701b0290565b60006001600160701b0382166001600160e01b0384168161213b57fe5b049392505050565b80820182811015610b5f576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6164642d6f766572666c6f7760601b604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a7231582082fba8557d35ae5eca98219a61e967d398ed8eaafeafa5fe5af73dd6aad9ddfd64736f6c63430005100032 | |
1 | 20,291,185 | 2f069ebf164a3d3928cb2585d96eedd4a29c5df10af4bec925f320055ff218ca | f9dd80e49a4fb5e7bf07238f08a82b0ffa1b52d658973986afa1b9e1ce87c2ca | 21ca0219fbf188a4ce905ae000c026eab407ec48 | 5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f | 70664538c90b3bd269f86095729eacc6d735ce17 | 60806040526001600c5534801561001557600080fd5b506040514690806052612d228239604080519182900360520182208282018252600a8352692ab734b9bbb0b8102b1960b11b6020938401528151808301835260018152603160f81b908401528151808401919091527fbfcc8ef98ffbf7b6c3fec7bf5185b566b9863e35a9d83acd49ad6824b5969738818301527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606082015260808101949094523060a0808601919091528151808603909101815260c09094019052825192019190912060035550600580546001600160a01b03191633179055612c1d806101056000396000f3fe608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429 | 608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032 | // File: contracts/interfaces/IUniswapV2Pair.sol
pragma solidity >=0.5.0;
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
// File: contracts/interfaces/IUniswapV2ERC20.sol
pragma solidity >=0.5.0;
interface IUniswapV2ERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
}
// File: contracts/libraries/SafeMath.sol
pragma solidity =0.5.16;
// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)
library SafeMath {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x, 'ds-math-add-overflow');
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x, 'ds-math-sub-underflow');
}
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');
}
}
// File: contracts/UniswapV2ERC20.sol
pragma solidity =0.5.16;
contract UniswapV2ERC20 is IUniswapV2ERC20 {
using SafeMath for uint;
string public constant name = 'Uniswap V2';
string public constant symbol = 'UNI-V2';
uint8 public constant decimals = 18;
uint public totalSupply;
mapping(address => uint) public balanceOf;
mapping(address => mapping(address => uint)) public allowance;
bytes32 public DOMAIN_SEPARATOR;
// keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
mapping(address => uint) public nonces;
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
constructor() public {
uint chainId;
assembly {
chainId := chainid
}
DOMAIN_SEPARATOR = keccak256(
abi.encode(
keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),
keccak256(bytes(name)),
keccak256(bytes('1')),
chainId,
address(this)
)
);
}
function _mint(address to, uint value) internal {
totalSupply = totalSupply.add(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(address(0), to, value);
}
function _burn(address from, uint value) internal {
balanceOf[from] = balanceOf[from].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(from, address(0), value);
}
function _approve(address owner, address spender, uint value) private {
allowance[owner][spender] = value;
emit Approval(owner, spender, value);
}
function _transfer(address from, address to, uint value) private {
balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function approve(address spender, uint value) external returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transfer(address to, uint value) external returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function transferFrom(address from, address to, uint value) external returns (bool) {
if (allowance[from][msg.sender] != uint(-1)) {
allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
}
_transfer(from, to, value);
return true;
}
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
require(deadline >= block.timestamp, 'UniswapV2: EXPIRED');
bytes32 digest = keccak256(
abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE');
_approve(owner, spender, value);
}
}
// File: contracts/libraries/Math.sol
pragma solidity =0.5.16;
// a library for performing various math operations
library Math {
function min(uint x, uint y) internal pure returns (uint z) {
z = x < y ? x : y;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
z = y;
uint x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}
// File: contracts/libraries/UQ112x112.sol
pragma solidity =0.5.16;
// a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))
// range: [0, 2**112 - 1]
// resolution: 1 / 2**112
library UQ112x112 {
uint224 constant Q112 = 2**112;
// encode a uint112 as a UQ112x112
function encode(uint112 y) internal pure returns (uint224 z) {
z = uint224(y) * Q112; // never overflows
}
// divide a UQ112x112 by a uint112, returning a UQ112x112
function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) {
z = x / uint224(y);
}
}
// File: contracts/interfaces/IERC20.sol
pragma solidity >=0.5.0;
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
}
// File: contracts/interfaces/IUniswapV2Factory.sol
pragma solidity >=0.5.0;
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
// File: contracts/interfaces/IUniswapV2Callee.sol
pragma solidity >=0.5.0;
interface IUniswapV2Callee {
function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external;
}
// File: contracts/UniswapV2Pair.sol
pragma solidity =0.5.16;
contract UniswapV2Pair is IUniswapV2Pair, UniswapV2ERC20 {
using SafeMath for uint;
using UQ112x112 for uint224;
uint public constant MINIMUM_LIQUIDITY = 10**3;
bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)')));
address public factory;
address public token0;
address public token1;
uint112 private reserve0; // uses single storage slot, accessible via getReserves
uint112 private reserve1; // uses single storage slot, accessible via getReserves
uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves
uint public price0CumulativeLast;
uint public price1CumulativeLast;
uint public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event
uint private unlocked = 1;
modifier lock() {
require(unlocked == 1, 'UniswapV2: LOCKED');
unlocked = 0;
_;
unlocked = 1;
}
function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) {
_reserve0 = reserve0;
_reserve1 = reserve1;
_blockTimestampLast = blockTimestampLast;
}
function _safeTransfer(address token, address to, uint value) private {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'UniswapV2: TRANSFER_FAILED');
}
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
constructor() public {
factory = msg.sender;
}
// called once by the factory at time of deployment
function initialize(address _token0, address _token1) external {
require(msg.sender == factory, 'UniswapV2: FORBIDDEN'); // sufficient check
token0 = _token0;
token1 = _token1;
}
// update reserves and, on the first call per block, price accumulators
function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private {
require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'UniswapV2: OVERFLOW');
uint32 blockTimestamp = uint32(block.timestamp % 2**32);
uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired
if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) {
// * never overflows, and + overflow is desired
price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed;
price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed;
}
reserve0 = uint112(balance0);
reserve1 = uint112(balance1);
blockTimestampLast = blockTimestamp;
emit Sync(reserve0, reserve1);
}
// if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k)
function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {
address feeTo = IUniswapV2Factory(factory).feeTo();
feeOn = feeTo != address(0);
uint _kLast = kLast; // gas savings
if (feeOn) {
if (_kLast != 0) {
uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1));
uint rootKLast = Math.sqrt(_kLast);
if (rootK > rootKLast) {
uint numerator = totalSupply.mul(rootK.sub(rootKLast));
uint denominator = rootK.mul(5).add(rootKLast);
uint liquidity = numerator / denominator;
if (liquidity > 0) _mint(feeTo, liquidity);
}
}
} else if (_kLast != 0) {
kLast = 0;
}
}
// this low-level function should be called from a contract which performs important safety checks
function mint(address to) external lock returns (uint liquidity) {
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
uint balance0 = IERC20(token0).balanceOf(address(this));
uint balance1 = IERC20(token1).balanceOf(address(this));
uint amount0 = balance0.sub(_reserve0);
uint amount1 = balance1.sub(_reserve1);
bool feeOn = _mintFee(_reserve0, _reserve1);
uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
if (_totalSupply == 0) {
liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY);
_mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens
} else {
liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1);
}
require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED');
_mint(to, liquidity);
_update(balance0, balance1, _reserve0, _reserve1);
if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
emit Mint(msg.sender, amount0, amount1);
}
// this low-level function should be called from a contract which performs important safety checks
function burn(address to) external lock returns (uint amount0, uint amount1) {
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
address _token0 = token0; // gas savings
address _token1 = token1; // gas savings
uint balance0 = IERC20(_token0).balanceOf(address(this));
uint balance1 = IERC20(_token1).balanceOf(address(this));
uint liquidity = balanceOf[address(this)];
bool feeOn = _mintFee(_reserve0, _reserve1);
uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution
amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution
require(amount0 > 0 && amount1 > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED');
_burn(address(this), liquidity);
_safeTransfer(_token0, to, amount0);
_safeTransfer(_token1, to, amount1);
balance0 = IERC20(_token0).balanceOf(address(this));
balance1 = IERC20(_token1).balanceOf(address(this));
_update(balance0, balance1, _reserve0, _reserve1);
if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
emit Burn(msg.sender, amount0, amount1, to);
}
// this low-level function should be called from a contract which performs important safety checks
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock {
require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT');
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
require(amount0Out < _reserve0 && amount1Out < _reserve1, 'UniswapV2: INSUFFICIENT_LIQUIDITY');
uint balance0;
uint balance1;
{ // scope for _token{0,1}, avoids stack too deep errors
address _token0 = token0;
address _token1 = token1;
require(to != _token0 && to != _token1, 'UniswapV2: INVALID_TO');
if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens
if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens
if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data);
balance0 = IERC20(_token0).balanceOf(address(this));
balance1 = IERC20(_token1).balanceOf(address(this));
}
uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0;
uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0;
require(amount0In > 0 || amount1In > 0, 'UniswapV2: INSUFFICIENT_INPUT_AMOUNT');
{ // scope for reserve{0,1}Adjusted, avoids stack too deep errors
uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3));
uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3));
require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'UniswapV2: K');
}
_update(balance0, balance1, _reserve0, _reserve1);
emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to);
}
// force balances to match reserves
function skim(address to) external lock {
address _token0 = token0; // gas savings
address _token1 = token1; // gas savings
_safeTransfer(_token0, to, IERC20(_token0).balanceOf(address(this)).sub(reserve0));
_safeTransfer(_token1, to, IERC20(_token1).balanceOf(address(this)).sub(reserve1));
}
// force reserves to match balances
function sync() external lock {
_update(IERC20(token0).balanceOf(address(this)), IERC20(token1).balanceOf(address(this)), reserve0, reserve1);
}
} |
1 | 20,291,190 | d30f6edf3e78163abe0ad2d2630b7d0ae844981a64179144239931b339be7c5c | 7af68fda7a6c717194df228158162169ad281357e620469e819e74a2b2e2e6a8 | 578f533873dc8ea60ab1417180cc531f172ee292 | 29ef46035e9fa3d570c598d3266424ca11413b0c | fa11dc84848fbe6d54f94a34f2182aa052ef29ec | 3d602d80600a3d3981f3363d3d373d3d3d363d735397d0869aba0d55e96d5716d383f6e1d8695ed75af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d735397d0869aba0d55e96d5716d383f6e1d8695ed75af43d82803e903d91602b57fd5bf3 | {{
"language": "Solidity",
"sources": {
"contracts/Forwarder.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity 0.8.10;\nimport '@openzeppelin/contracts/token/ERC1155/IERC1155.sol';\nimport '@openzeppelin/contracts/token/ERC721/IERC721.sol';\nimport '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';\nimport '@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol';\nimport './ERC20Interface.sol';\nimport './TransferHelper.sol';\nimport './IForwarder.sol';\n\n/**\n * Contract that will forward any incoming Ether to the creator of the contract\n *\n */\ncontract Forwarder is IERC721Receiver, ERC1155Receiver, IForwarder {\n // Address to which any funds sent to this contract will be forwarded\n address public parentAddress;\n bool public autoFlush721 = true;\n bool public autoFlush1155 = true;\n\n event ForwarderDeposited(address from, uint256 value, bytes data);\n\n /**\n * Initialize the contract, and sets the destination address to that of the creator\n */\n function init(\n address _parentAddress,\n bool _autoFlush721,\n bool _autoFlush1155\n ) external onlyUninitialized {\n parentAddress = _parentAddress;\n uint256 value = address(this).balance;\n\n // set whether we want to automatically flush erc721/erc1155 tokens or not\n autoFlush721 = _autoFlush721;\n autoFlush1155 = _autoFlush1155;\n\n if (value == 0) {\n return;\n }\n\n (bool success, ) = parentAddress.call{ value: value }('');\n require(success, 'Flush failed');\n\n // NOTE: since we are forwarding on initialization,\n // we don't have the context of the original sender.\n // We still emit an event about the forwarding but set\n // the sender to the forwarder itself\n emit ForwarderDeposited(address(this), value, msg.data);\n }\n\n /**\n * Modifier that will execute internal code block only if the sender is the parent address\n */\n modifier onlyParent {\n require(msg.sender == parentAddress, 'Only Parent');\n _;\n }\n\n /**\n * Modifier that will execute internal code block only if the contract has not been initialized yet\n */\n modifier onlyUninitialized {\n require(parentAddress == address(0x0), 'Already initialized');\n _;\n }\n\n /**\n * Default function; Gets called when data is sent but does not match any other function\n */\n fallback() external payable {\n flush();\n }\n\n /**\n * Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address\n */\n receive() external payable {\n flush();\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function setAutoFlush721(bool autoFlush)\n external\n virtual\n override\n onlyParent\n {\n autoFlush721 = autoFlush;\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function setAutoFlush1155(bool autoFlush)\n external\n virtual\n override\n onlyParent\n {\n autoFlush1155 = autoFlush;\n }\n\n /**\n * ERC721 standard callback function for when a ERC721 is transfered. The forwarder will send the nft\n * to the base wallet once the nft contract invokes this method after transfering the nft.\n *\n * @param _operator The address which called `safeTransferFrom` function\n * @param _from The address of the sender\n * @param _tokenId The token id of the nft\n * @param data Additional data with no specified format, sent in call to `_to`\n */\n function onERC721Received(\n address _operator,\n address _from,\n uint256 _tokenId,\n bytes memory data\n ) external virtual override returns (bytes4) {\n if (autoFlush721) {\n IERC721 instance = IERC721(msg.sender);\n require(\n instance.supportsInterface(type(IERC721).interfaceId),\n 'The caller does not support the ERC721 interface'\n );\n // this won't work for ERC721 re-entrancy\n instance.safeTransferFrom(address(this), parentAddress, _tokenId, data);\n }\n\n return this.onERC721Received.selector;\n }\n\n function callFromParent(\n address target,\n uint256 value,\n bytes calldata data\n ) external onlyParent returns (bytes memory) {\n (bool success, bytes memory returnedData) = target.call{ value: value }(\n data\n );\n require(success, 'Parent call execution failed');\n\n return returnedData;\n }\n\n /**\n * @inheritdoc IERC1155Receiver\n */\n function onERC1155Received(\n address _operator,\n address _from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external virtual override returns (bytes4) {\n IERC1155 instance = IERC1155(msg.sender);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n if (autoFlush1155) {\n instance.safeTransferFrom(address(this), parentAddress, id, value, data);\n }\n\n return this.onERC1155Received.selector;\n }\n\n /**\n * @inheritdoc IERC1155Receiver\n */\n function onERC1155BatchReceived(\n address _operator,\n address _from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external virtual override returns (bytes4) {\n IERC1155 instance = IERC1155(msg.sender);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n if (autoFlush1155) {\n instance.safeBatchTransferFrom(\n address(this),\n parentAddress,\n ids,\n values,\n data\n );\n }\n\n return this.onERC1155BatchReceived.selector;\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushTokens(address tokenContractAddress)\n external\n virtual\n override\n onlyParent\n {\n ERC20Interface instance = ERC20Interface(tokenContractAddress);\n address forwarderAddress = address(this);\n uint256 forwarderBalance = instance.balanceOf(forwarderAddress);\n if (forwarderBalance == 0) {\n return;\n }\n\n TransferHelper.safeTransfer(\n tokenContractAddress,\n parentAddress,\n forwarderBalance\n );\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushERC721Token(address tokenContractAddress, uint256 tokenId)\n external\n virtual\n override\n onlyParent\n {\n IERC721 instance = IERC721(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC721).interfaceId),\n 'The tokenContractAddress does not support the ERC721 interface'\n );\n\n address ownerAddress = instance.ownerOf(tokenId);\n instance.transferFrom(ownerAddress, parentAddress, tokenId);\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushERC1155Tokens(address tokenContractAddress, uint256 tokenId)\n external\n virtual\n override\n onlyParent\n {\n IERC1155 instance = IERC1155(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n address forwarderAddress = address(this);\n uint256 forwarderBalance = instance.balanceOf(forwarderAddress, tokenId);\n\n instance.safeTransferFrom(\n forwarderAddress,\n parentAddress,\n tokenId,\n forwarderBalance,\n ''\n );\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function batchFlushERC1155Tokens(\n address tokenContractAddress,\n uint256[] calldata tokenIds\n ) external virtual override onlyParent {\n IERC1155 instance = IERC1155(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n address forwarderAddress = address(this);\n uint256[] memory amounts = new uint256[](tokenIds.length);\n for (uint256 i = 0; i < tokenIds.length; i++) {\n amounts[i] = instance.balanceOf(forwarderAddress, tokenIds[i]);\n }\n\n instance.safeBatchTransferFrom(\n forwarderAddress,\n parentAddress,\n tokenIds,\n amounts,\n ''\n );\n }\n\n /**\n * Flush the entire balance of the contract to the parent address.\n */\n function flush() public {\n uint256 value = address(this).balance;\n\n if (value == 0) {\n return;\n }\n\n (bool success, ) = parentAddress.call{ value: value }('');\n require(success, 'Flush failed');\n emit ForwarderDeposited(msg.sender, value, msg.data);\n }\n\n /**\n * @inheritdoc IERC165\n */\n function supportsInterface(bytes4 interfaceId)\n public\n virtual\n override(ERC1155Receiver, IERC165)\n view\n returns (bool)\n {\n return\n interfaceId == type(IForwarder).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n}\n"
},
"@openzeppelin/contracts/token/ERC1155/IERC1155.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n"
},
"@openzeppelin/contracts/token/ERC721/IERC721.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n}\n"
},
"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n"
},
"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155Receiver.sol\";\nimport \"../../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\nabstract contract ERC1155Receiver is ERC165, IERC1155Receiver {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);\n }\n}\n"
},
"contracts/ERC20Interface.sol": {
"content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\n/**\n * Contract that exposes the needed erc20 token functions\n */\n\nabstract contract ERC20Interface {\n // Send _value amount of tokens to address _to\n function transfer(address _to, uint256 _value)\n public\n virtual\n returns (bool success);\n\n // Get the account balance of another account with address _owner\n function balanceOf(address _owner)\n public\n virtual\n view\n returns (uint256 balance);\n}\n"
},
"contracts/TransferHelper.sol": {
"content": "// SPDX-License-Identifier: GPL-3.0-or-later\n// source: https://github.com/Uniswap/solidity-lib/blob/master/contracts/libraries/TransferHelper.sol\npragma solidity 0.8.10;\n\nimport '@openzeppelin/contracts/utils/Address.sol';\n\n// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false\nlibrary TransferHelper {\n function safeTransfer(\n address token,\n address to,\n uint256 value\n ) internal {\n // bytes4(keccak256(bytes('transfer(address,uint256)')));\n (bool success, bytes memory data) = token.call(\n abi.encodeWithSelector(0xa9059cbb, to, value)\n );\n require(\n success && (data.length == 0 || abi.decode(data, (bool))),\n 'TransferHelper::safeTransfer: transfer failed'\n );\n }\n\n function safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));\n (bool success, bytes memory returndata) = token.call(\n abi.encodeWithSelector(0x23b872dd, from, to, value)\n );\n Address.verifyCallResult(\n success,\n returndata,\n 'TransferHelper::transferFrom: transferFrom failed'\n );\n }\n}\n"
},
"contracts/IForwarder.sol": {
"content": "pragma solidity ^0.8.0;\n\nimport '@openzeppelin/contracts/utils/introspection/IERC165.sol';\n\ninterface IForwarder is IERC165 {\n /**\n * Sets the autoflush721 parameter.\n *\n * @param autoFlush whether to autoflush erc721 tokens\n */\n function setAutoFlush721(bool autoFlush) external;\n\n /**\n * Sets the autoflush1155 parameter.\n *\n * @param autoFlush whether to autoflush erc1155 tokens\n */\n function setAutoFlush1155(bool autoFlush) external;\n\n /**\n * Execute a token transfer of the full balance from the forwarder token to the parent address\n *\n * @param tokenContractAddress the address of the erc20 token contract\n */\n function flushTokens(address tokenContractAddress) external;\n\n /**\n * Execute a nft transfer from the forwarder to the parent address\n *\n * @param tokenContractAddress the address of the ERC721 NFT contract\n * @param tokenId The token id of the nft\n */\n function flushERC721Token(address tokenContractAddress, uint256 tokenId)\n external;\n\n /**\n * Execute a nft transfer from the forwarder to the parent address.\n *\n * @param tokenContractAddress the address of the ERC1155 NFT contract\n * @param tokenId The token id of the nft\n */\n function flushERC1155Tokens(address tokenContractAddress, uint256 tokenId)\n external;\n\n /**\n * Execute a batch nft transfer from the forwarder to the parent address.\n *\n * @param tokenContractAddress the address of the ERC1155 NFT contract\n * @param tokenIds The token ids of the nfts\n */\n function batchFlushERC1155Tokens(\n address tokenContractAddress,\n uint256[] calldata tokenIds\n ) external;\n}\n"
},
"@openzeppelin/contracts/utils/introspection/IERC165.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
},
"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n @dev Handles the receipt of a single ERC1155 token type. This function is\n called at the end of a `safeTransferFrom` after the balance has been updated.\n To accept the transfer, this must return\n `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n (i.e. 0xf23a6e61, or its own function selector).\n @param operator The address which initiated the transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param id The ID of the token being transferred\n @param value The amount of tokens being transferred\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n @dev Handles the receipt of a multiple ERC1155 token types. This function\n is called at the end of a `safeBatchTransferFrom` after the balances have\n been updated. To accept the transfer(s), this must return\n `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n (i.e. 0xbc197c81, or its own function selector).\n @param operator The address which initiated the batch transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param ids An array containing ids of each token being transferred (order and length must match values array)\n @param values An array containing amounts of each token being transferred (order and length must match ids array)\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n"
},
"@openzeppelin/contracts/utils/introspection/ERC165.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n"
},
"@openzeppelin/contracts/utils/Address.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}
}} |
1 | 20,291,193 | da4e2821cf54546c15ed520bd1079e0e78906c267444290818e9266dabfb13be | a4ab02d0e85e776d30b2111f4b040271c65d21f7a198d1aeec0bb644fc212d2b | 1612ba11dc7df706b20cd1f10485a401510b733d | 07042134d4dc295cbf3ab08a4a0eff847a528171 | 5a5b4c1de93633081bb036930d016f812ab1de61 | 608060405234801561001057600080fd5b5060405161020538038061020583398101604081905261002f916101d4565b8060005b604051636312ab1360e11b8152600481018290526000906001600160a01b0384169063c625562690602401602060405180830381865afa15801561007b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061009f91906101d4565b6001600160a01b0316146101475761013f82600019846001600160a01b031663c6255626856040518263ffffffff1660e01b81526004016100e291815260200190565b602060405180830381865afa1580156100ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061012391906101d4565b6001600160a01b031661014a60201b610009179092919060201c565b600101610033565b33ff5b600060405163095ea7b360e01b81526001600160a01b0384166004820152826024820152602060006044836000895af13d15601f3d11600160005114161716915050806101ce5760405162461bcd60e51b815260206004820152600e60248201526d1054141493d59157d1905253115160921b604482015260640160405180910390fd5b50505050565b6000602082840312156101e657600080fd5b81516001600160a01b03811681146101fd57600080fd5b939250505056fe00000000000000000000000007042134d4dc295cbf3ab08a4a0eff847a528171 | ||
1 | 20,291,199 | 63afc37fe7c6cb5145c695a2203a49b0c9c773516251e6038f91395d0375cbc7 | dfd16795ddb66a16c41080a6851de208ddb5d8764d6543ff81c188cd6eddd5a1 | 37d2b8d457cc4e4c45242f9f6f4459704f7cb2d0 | 5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f | b879783e8fd7e546b3a2395bd8639ecdb815e859 | 60806040526001600c5534801561001557600080fd5b506040514690806052612d228239604080519182900360520182208282018252600a8352692ab734b9bbb0b8102b1960b11b6020938401528151808301835260018152603160f81b908401528151808401919091527fbfcc8ef98ffbf7b6c3fec7bf5185b566b9863e35a9d83acd49ad6824b5969738818301527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606082015260808101949094523060a0808601919091528151808603909101815260c09094019052825192019190912060035550600580546001600160a01b03191633179055612c1d806101056000396000f3fe608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429 | 608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032 | // File: contracts/interfaces/IUniswapV2Pair.sol
pragma solidity >=0.5.0;
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
// File: contracts/interfaces/IUniswapV2ERC20.sol
pragma solidity >=0.5.0;
interface IUniswapV2ERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
}
// File: contracts/libraries/SafeMath.sol
pragma solidity =0.5.16;
// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)
library SafeMath {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x, 'ds-math-add-overflow');
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x, 'ds-math-sub-underflow');
}
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');
}
}
// File: contracts/UniswapV2ERC20.sol
pragma solidity =0.5.16;
contract UniswapV2ERC20 is IUniswapV2ERC20 {
using SafeMath for uint;
string public constant name = 'Uniswap V2';
string public constant symbol = 'UNI-V2';
uint8 public constant decimals = 18;
uint public totalSupply;
mapping(address => uint) public balanceOf;
mapping(address => mapping(address => uint)) public allowance;
bytes32 public DOMAIN_SEPARATOR;
// keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
mapping(address => uint) public nonces;
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
constructor() public {
uint chainId;
assembly {
chainId := chainid
}
DOMAIN_SEPARATOR = keccak256(
abi.encode(
keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),
keccak256(bytes(name)),
keccak256(bytes('1')),
chainId,
address(this)
)
);
}
function _mint(address to, uint value) internal {
totalSupply = totalSupply.add(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(address(0), to, value);
}
function _burn(address from, uint value) internal {
balanceOf[from] = balanceOf[from].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(from, address(0), value);
}
function _approve(address owner, address spender, uint value) private {
allowance[owner][spender] = value;
emit Approval(owner, spender, value);
}
function _transfer(address from, address to, uint value) private {
balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function approve(address spender, uint value) external returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transfer(address to, uint value) external returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function transferFrom(address from, address to, uint value) external returns (bool) {
if (allowance[from][msg.sender] != uint(-1)) {
allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
}
_transfer(from, to, value);
return true;
}
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
require(deadline >= block.timestamp, 'UniswapV2: EXPIRED');
bytes32 digest = keccak256(
abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE');
_approve(owner, spender, value);
}
}
// File: contracts/libraries/Math.sol
pragma solidity =0.5.16;
// a library for performing various math operations
library Math {
function min(uint x, uint y) internal pure returns (uint z) {
z = x < y ? x : y;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
z = y;
uint x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}
// File: contracts/libraries/UQ112x112.sol
pragma solidity =0.5.16;
// a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))
// range: [0, 2**112 - 1]
// resolution: 1 / 2**112
library UQ112x112 {
uint224 constant Q112 = 2**112;
// encode a uint112 as a UQ112x112
function encode(uint112 y) internal pure returns (uint224 z) {
z = uint224(y) * Q112; // never overflows
}
// divide a UQ112x112 by a uint112, returning a UQ112x112
function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) {
z = x / uint224(y);
}
}
// File: contracts/interfaces/IERC20.sol
pragma solidity >=0.5.0;
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
}
// File: contracts/interfaces/IUniswapV2Factory.sol
pragma solidity >=0.5.0;
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
// File: contracts/interfaces/IUniswapV2Callee.sol
pragma solidity >=0.5.0;
interface IUniswapV2Callee {
function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external;
}
// File: contracts/UniswapV2Pair.sol
pragma solidity =0.5.16;
contract UniswapV2Pair is IUniswapV2Pair, UniswapV2ERC20 {
using SafeMath for uint;
using UQ112x112 for uint224;
uint public constant MINIMUM_LIQUIDITY = 10**3;
bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)')));
address public factory;
address public token0;
address public token1;
uint112 private reserve0; // uses single storage slot, accessible via getReserves
uint112 private reserve1; // uses single storage slot, accessible via getReserves
uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves
uint public price0CumulativeLast;
uint public price1CumulativeLast;
uint public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event
uint private unlocked = 1;
modifier lock() {
require(unlocked == 1, 'UniswapV2: LOCKED');
unlocked = 0;
_;
unlocked = 1;
}
function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) {
_reserve0 = reserve0;
_reserve1 = reserve1;
_blockTimestampLast = blockTimestampLast;
}
function _safeTransfer(address token, address to, uint value) private {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'UniswapV2: TRANSFER_FAILED');
}
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
constructor() public {
factory = msg.sender;
}
// called once by the factory at time of deployment
function initialize(address _token0, address _token1) external {
require(msg.sender == factory, 'UniswapV2: FORBIDDEN'); // sufficient check
token0 = _token0;
token1 = _token1;
}
// update reserves and, on the first call per block, price accumulators
function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private {
require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'UniswapV2: OVERFLOW');
uint32 blockTimestamp = uint32(block.timestamp % 2**32);
uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired
if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) {
// * never overflows, and + overflow is desired
price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed;
price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed;
}
reserve0 = uint112(balance0);
reserve1 = uint112(balance1);
blockTimestampLast = blockTimestamp;
emit Sync(reserve0, reserve1);
}
// if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k)
function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {
address feeTo = IUniswapV2Factory(factory).feeTo();
feeOn = feeTo != address(0);
uint _kLast = kLast; // gas savings
if (feeOn) {
if (_kLast != 0) {
uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1));
uint rootKLast = Math.sqrt(_kLast);
if (rootK > rootKLast) {
uint numerator = totalSupply.mul(rootK.sub(rootKLast));
uint denominator = rootK.mul(5).add(rootKLast);
uint liquidity = numerator / denominator;
if (liquidity > 0) _mint(feeTo, liquidity);
}
}
} else if (_kLast != 0) {
kLast = 0;
}
}
// this low-level function should be called from a contract which performs important safety checks
function mint(address to) external lock returns (uint liquidity) {
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
uint balance0 = IERC20(token0).balanceOf(address(this));
uint balance1 = IERC20(token1).balanceOf(address(this));
uint amount0 = balance0.sub(_reserve0);
uint amount1 = balance1.sub(_reserve1);
bool feeOn = _mintFee(_reserve0, _reserve1);
uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
if (_totalSupply == 0) {
liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY);
_mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens
} else {
liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1);
}
require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED');
_mint(to, liquidity);
_update(balance0, balance1, _reserve0, _reserve1);
if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
emit Mint(msg.sender, amount0, amount1);
}
// this low-level function should be called from a contract which performs important safety checks
function burn(address to) external lock returns (uint amount0, uint amount1) {
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
address _token0 = token0; // gas savings
address _token1 = token1; // gas savings
uint balance0 = IERC20(_token0).balanceOf(address(this));
uint balance1 = IERC20(_token1).balanceOf(address(this));
uint liquidity = balanceOf[address(this)];
bool feeOn = _mintFee(_reserve0, _reserve1);
uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution
amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution
require(amount0 > 0 && amount1 > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED');
_burn(address(this), liquidity);
_safeTransfer(_token0, to, amount0);
_safeTransfer(_token1, to, amount1);
balance0 = IERC20(_token0).balanceOf(address(this));
balance1 = IERC20(_token1).balanceOf(address(this));
_update(balance0, balance1, _reserve0, _reserve1);
if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
emit Burn(msg.sender, amount0, amount1, to);
}
// this low-level function should be called from a contract which performs important safety checks
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock {
require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT');
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
require(amount0Out < _reserve0 && amount1Out < _reserve1, 'UniswapV2: INSUFFICIENT_LIQUIDITY');
uint balance0;
uint balance1;
{ // scope for _token{0,1}, avoids stack too deep errors
address _token0 = token0;
address _token1 = token1;
require(to != _token0 && to != _token1, 'UniswapV2: INVALID_TO');
if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens
if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens
if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data);
balance0 = IERC20(_token0).balanceOf(address(this));
balance1 = IERC20(_token1).balanceOf(address(this));
}
uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0;
uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0;
require(amount0In > 0 || amount1In > 0, 'UniswapV2: INSUFFICIENT_INPUT_AMOUNT');
{ // scope for reserve{0,1}Adjusted, avoids stack too deep errors
uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3));
uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3));
require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'UniswapV2: K');
}
_update(balance0, balance1, _reserve0, _reserve1);
emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to);
}
// force balances to match reserves
function skim(address to) external lock {
address _token0 = token0; // gas savings
address _token1 = token1; // gas savings
_safeTransfer(_token0, to, IERC20(_token0).balanceOf(address(this)).sub(reserve0));
_safeTransfer(_token1, to, IERC20(_token1).balanceOf(address(this)).sub(reserve1));
}
// force reserves to match balances
function sync() external lock {
_update(IERC20(token0).balanceOf(address(this)), IERC20(token1).balanceOf(address(this)), reserve0, reserve1);
}
} |
1 | 20,291,199 | 63afc37fe7c6cb5145c695a2203a49b0c9c773516251e6038f91395d0375cbc7 | 6a057c8880665dbcb1b0d385ec351065c3367f98528fc6ae192ece780b05c668 | 22917b9e0869a812f3bc713791217e0a6a5bf2d6 | 490e11d4f3471378aa1378ad82b9e20280b2466a | c161508261d0561eb2e6946cacbd5fb1f6b720a7 | 60a080380360a43960a45160c4517f0902f1ac000000000000000000000000000000000000000000000000000000005f5260405f60045f5f865af1156101ae575f5160e4516103e50280916103e80201906020510204807f022c0d9f000000000000000000000000000000000000000000000000000000005f525f6004526024523060445260806064525f5f60a45f5f875af1156101ae577f70a08231000000000000000000000000000000000000000000000000000000005f523060045260205f60245f5f865af15061010451156100eb575f5190818103606402046101045111156101ae576100ef565b505f515b61012451156101aa5791827fa9059cbb000000000000000000000000000000000000000000000000000000005f52816004526024525f5f60445f5f865af1156101ae577f0902f1ac000000000000000000000000000000000000000000000000000000005f5260405f60045f5f855af15060205191907f70a08231000000000000000000000000000000000000000000000000000000005f526004525f60245f5f6020945af1505f51038103606402046101245111156101ae575b5f5ff35b600380fd5f5ff3000000000000000000000000b879783e8fd7e546b3a2395bd8639ecdb815e859000000000000000000000000e4efed101d68bad12a74af433e91864d69954f86000000000000000000000000000000000000000000000000000009184e72a00000000000000000000000000000000000000000000000000000000000000000390000000000000000000000000000000000000000000000000000000000000000 | ||
1 | 20,291,201 | 6107ef62d1bb59e4ea24b2743e34ebec6d6cc9e02873e4c6fac27e022112553d | 95fbdc382dfc5cb497db4a04f6ab07b44d5161f67d10632cd0a984382ba53577 | be49bd130e126a917ddb5fabf7cdeb6dd9887f40 | 84654be796dad370032391d5479f8f1fd9ddd14e | bb442944cb803caa644d3faf0911b5a871a87c22 | 604080600a3d393df3fe73265c27c849b0e1a62636f6007e8a74dc2a2584aa3d366025573d3d3d3d34865af16031565b363d3d373d3d363d855af45b3d82803e603c573d81fd5b3d81f3 | 73265c27c849b0e1a62636f6007e8a74dc2a2584aa3d366025573d3d3d3d34865af16031565b363d3d373d3d363d855af45b3d82803e603c573d81fd5b3d81f3 | |
1 | 20,291,203 | 2e83ac7966283b56897b827dcbd06cbbdbd097b71692893850d02650ed664d13 | 488efac62eb0d78808819c9512930554da6332ed382983fb7b511a75bf0b3648 | ea2440b50d908aa7baa78483a78e0d0d33ede57d | ea2440b50d908aa7baa78483a78e0d0d33ede57d | cdd36ee9b82739bc837b4c549c8f192041e46ee4 | 6080604052348015600e575f80fd5b5061094d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063775c300c1461002d575b5f80fd5b610035610037565b005b5f806040518061082001604052806107ee815260200161012a6107ee913990508173ffffffffffffffffffffffffffffffffffffffff168160405161007c9190610113565b5f604051808303815f865af19150503d805f81146100b5576040519150601f19603f3d011682016040523d82523d5f602084013e6100ba565b606091505b5050505050565b5f81519050919050565b5f81905092915050565b8281835e5f83830152505050565b5f6100ed826100c1565b6100f781856100cb565b93506101078185602086016100d5565b80840191505092915050565b5f61011e82846100e3565b91508190509291505056fe60606040526040516020806107ee8339016040526060805190602001505b625b8d8060016000506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600050819055505b50610767806100876000396000f3006060604052361561007f576000357c0100000000000000000000000000000000000000000000000000000000900480630ecc3912146100815780635479f98b146100fa5780637d0f7a881461017357806390b98a111461019a578063937f6e77146101c7578063bbd39ac014610219578063d26c8a8a146102405761007f565b005b61008c600450610610565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f1680156100ec5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610105600450610432565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f1680156101655780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610184600480359060200150610261565b6040518082815260200191505060405180910390f35b6101b16004803590602001803590602001506102f6565b6040518082815260200191505060405180910390f35b6102176004803590602001906004018035906020019191908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050905061068e565b005b61022a60048035906020015061027c565b6040518082815260200191505060405180910390f35b61024b6004506102ba565b6040518082815260200191505060405180910390f35b60016000506020528060005260406000206000915090505481565b6000600160005060008373ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000505490506102b5565b919050565b6000600160005060003373ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000505490506102f3565b90565b600081600160005060003373ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600050541015610338576000905061042c565b81600160005060003373ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282825054039250508190555081600160005060008573ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828282505401925050819055507f16cdf1707799c6655baac6e210f52b94b7cec08adcaf9ede7dfe8649da926146338484604051808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a16001905061042c565b92915050565b6020604051908101604052806000815260200150600160016000506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060005054101561050757606060405190810160405280602781526020017f536f7272792c20746865206661756365742068617320656e746972656c79207281526020017f756e206472792e00000000000000000000000000000000000000000000000000815260200150905061060d565b60016000506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008181505480929190600190039190505550600160005060003373ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081815054809291906001019190505550606060405190810160405280602281526020017f617965417965436f696e206c6f766521204f6e6520636f696e20666f7220796f81526020017f7521000000000000000000000000000000000000000000000000000000000000815260200150905061060d565b90565b60206040519081016040528060008152602001506000600050805480601f0160208091040260200160405190810160405280929190818152602001828054801561067f57820191906000526020600020905b81548152906001019060200180831161066257829003601f168201915b5050505050905061068b565b90565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561076357806000600050908051906020019082805482825590600052602060002090601f01602090048101928215610735579182015b82811115610734578251826000505591602001919060010190610716565b5b5090506107609190610742565b8082111561075c5760008181506000905550600101610742565b5090565b50505b5b5056a26469706673582212203e0c0d7fc9c61b7daabdb16445312b0bc651cdb426cb1f02d33b7c4116bff37b64736f6c634300081a0033 | 608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063775c300c1461002d575b5f80fd5b610035610037565b005b5f806040518061082001604052806107ee815260200161012a6107ee913990508173ffffffffffffffffffffffffffffffffffffffff168160405161007c9190610113565b5f604051808303815f865af19150503d805f81146100b5576040519150601f19603f3d011682016040523d82523d5f602084013e6100ba565b606091505b5050505050565b5f81519050919050565b5f81905092915050565b8281835e5f83830152505050565b5f6100ed826100c1565b6100f781856100cb565b93506101078185602086016100d5565b80840191505092915050565b5f61011e82846100e3565b91508190509291505056fe60606040526040516020806107ee8339016040526060805190602001505b625b8d8060016000506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600050819055505b50610767806100876000396000f3006060604052361561007f576000357c0100000000000000000000000000000000000000000000000000000000900480630ecc3912146100815780635479f98b146100fa5780637d0f7a881461017357806390b98a111461019a578063937f6e77146101c7578063bbd39ac014610219578063d26c8a8a146102405761007f565b005b61008c600450610610565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f1680156100ec5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610105600450610432565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f1680156101655780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610184600480359060200150610261565b6040518082815260200191505060405180910390f35b6101b16004803590602001803590602001506102f6565b6040518082815260200191505060405180910390f35b6102176004803590602001906004018035906020019191908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050905061068e565b005b61022a60048035906020015061027c565b6040518082815260200191505060405180910390f35b61024b6004506102ba565b6040518082815260200191505060405180910390f35b60016000506020528060005260406000206000915090505481565b6000600160005060008373ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000505490506102b5565b919050565b6000600160005060003373ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000505490506102f3565b90565b600081600160005060003373ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600050541015610338576000905061042c565b81600160005060003373ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282825054039250508190555081600160005060008573ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828282505401925050819055507f16cdf1707799c6655baac6e210f52b94b7cec08adcaf9ede7dfe8649da926146338484604051808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a16001905061042c565b92915050565b6020604051908101604052806000815260200150600160016000506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060005054101561050757606060405190810160405280602781526020017f536f7272792c20746865206661756365742068617320656e746972656c79207281526020017f756e206472792e00000000000000000000000000000000000000000000000000815260200150905061060d565b60016000506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008181505480929190600190039190505550600160005060003373ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081815054809291906001019190505550606060405190810160405280602281526020017f617965417965436f696e206c6f766521204f6e6520636f696e20666f7220796f81526020017f7521000000000000000000000000000000000000000000000000000000000000815260200150905061060d565b90565b60206040519081016040528060008152602001506000600050805480601f0160208091040260200160405190810160405280929190818152602001828054801561067f57820191906000526020600020905b81548152906001019060200180831161066257829003601f168201915b5050505050905061068b565b90565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561076357806000600050908051906020019082805482825590600052602060002090601f01602090048101928215610735579182015b82811115610734578251826000505591602001919060010190610716565b5b5090506107609190610742565b8082111561075c5760008181506000905550600101610742565b5090565b50505b5b5056a26469706673582212203e0c0d7fc9c61b7daabdb16445312b0bc651cdb426cb1f02d33b7c4116bff37b64736f6c634300081a0033 | {{
"language": "Solidity",
"sources": {
"deploy.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.26;\n\ncontract DeployAyeAye {\n\n function deploy() public {\n address addr = 0x0000000000000000000000000000000000000000;\n bytes memory code = hex\"60606040526040516020806107ee8339016040526060805190602001505b625b8d8060016000506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600050819055505b50610767806100876000396000f3006060604052361561007f576000357c0100000000000000000000000000000000000000000000000000000000900480630ecc3912146100815780635479f98b146100fa5780637d0f7a881461017357806390b98a111461019a578063937f6e77146101c7578063bbd39ac014610219578063d26c8a8a146102405761007f565b005b61008c600450610610565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f1680156100ec5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610105600450610432565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f1680156101655780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610184600480359060200150610261565b6040518082815260200191505060405180910390f35b6101b16004803590602001803590602001506102f6565b6040518082815260200191505060405180910390f35b6102176004803590602001906004018035906020019191908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050905061068e565b005b61022a60048035906020015061027c565b6040518082815260200191505060405180910390f35b61024b6004506102ba565b6040518082815260200191505060405180910390f35b60016000506020528060005260406000206000915090505481565b6000600160005060008373ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000505490506102b5565b919050565b6000600160005060003373ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000505490506102f3565b90565b600081600160005060003373ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600050541015610338576000905061042c565b81600160005060003373ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282825054039250508190555081600160005060008573ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828282505401925050819055507f16cdf1707799c6655baac6e210f52b94b7cec08adcaf9ede7dfe8649da926146338484604051808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a16001905061042c565b92915050565b6020604051908101604052806000815260200150600160016000506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060005054101561050757606060405190810160405280602781526020017f536f7272792c20746865206661756365742068617320656e746972656c79207281526020017f756e206472792e00000000000000000000000000000000000000000000000000815260200150905061060d565b60016000506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008181505480929190600190039190505550600160005060003373ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081815054809291906001019190505550606060405190810160405280602281526020017f617965417965436f696e206c6f766521204f6e6520636f696e20666f7220796f81526020017f7521000000000000000000000000000000000000000000000000000000000000815260200150905061060d565b90565b60206040519081016040528060008152602001506000600050805480601f0160208091040260200160405190810160405280929190818152602001828054801561067f57820191906000526020600020905b81548152906001019060200180831161066257829003601f168201915b5050505050905061068b565b90565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561076357806000600050908051906020019082805482825590600052602060002090601f01602090048101928215610735579182015b82811115610734578251826000505591602001919060010190610716565b5b5090506107609190610742565b8082111561075c5760008181506000905550600101610742565b5090565b50505b5b5056\";\n addr.call(code);\n }\n}"
}
},
"settings": {
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}
}} |
1 | 20,291,205 | 4605f247b8c85bb18e553b37fa87b6987e3a887f3297d84106aa0f7f6b16b4c7 | 851f2752dbefc2481a5e2ec8a690bb785eb2340509a49bc6240ffacdea98c2a3 | a7fb5ca286fc3fd67525629048a4de3ba24cba2e | c77ad0a71008d7094a62cfbd250a2eb2afdf2776 | 6934a62bb056fbe9b7eb2b6b412f0b3ee938cb07 | 608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe | ||
1 | 20,291,221 | d81bcca9153aeac156a25912be30f98b09e05cf43042af9c761fe70ab4271e90 | 25e8c2815f80163c7a6039c4795296e75be907a2af83668c78386770090fd315 | 578f533873dc8ea60ab1417180cc531f172ee292 | 29ef46035e9fa3d570c598d3266424ca11413b0c | a01c8af300f24a9ffa0363473a36f8664ebe0620 | 3d602d80600a3d3981f3363d3d373d3d3d363d735397d0869aba0d55e96d5716d383f6e1d8695ed75af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d735397d0869aba0d55e96d5716d383f6e1d8695ed75af43d82803e903d91602b57fd5bf3 | {{
"language": "Solidity",
"sources": {
"contracts/Forwarder.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity 0.8.10;\nimport '@openzeppelin/contracts/token/ERC1155/IERC1155.sol';\nimport '@openzeppelin/contracts/token/ERC721/IERC721.sol';\nimport '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';\nimport '@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol';\nimport './ERC20Interface.sol';\nimport './TransferHelper.sol';\nimport './IForwarder.sol';\n\n/**\n * Contract that will forward any incoming Ether to the creator of the contract\n *\n */\ncontract Forwarder is IERC721Receiver, ERC1155Receiver, IForwarder {\n // Address to which any funds sent to this contract will be forwarded\n address public parentAddress;\n bool public autoFlush721 = true;\n bool public autoFlush1155 = true;\n\n event ForwarderDeposited(address from, uint256 value, bytes data);\n\n /**\n * Initialize the contract, and sets the destination address to that of the creator\n */\n function init(\n address _parentAddress,\n bool _autoFlush721,\n bool _autoFlush1155\n ) external onlyUninitialized {\n parentAddress = _parentAddress;\n uint256 value = address(this).balance;\n\n // set whether we want to automatically flush erc721/erc1155 tokens or not\n autoFlush721 = _autoFlush721;\n autoFlush1155 = _autoFlush1155;\n\n if (value == 0) {\n return;\n }\n\n (bool success, ) = parentAddress.call{ value: value }('');\n require(success, 'Flush failed');\n\n // NOTE: since we are forwarding on initialization,\n // we don't have the context of the original sender.\n // We still emit an event about the forwarding but set\n // the sender to the forwarder itself\n emit ForwarderDeposited(address(this), value, msg.data);\n }\n\n /**\n * Modifier that will execute internal code block only if the sender is the parent address\n */\n modifier onlyParent {\n require(msg.sender == parentAddress, 'Only Parent');\n _;\n }\n\n /**\n * Modifier that will execute internal code block only if the contract has not been initialized yet\n */\n modifier onlyUninitialized {\n require(parentAddress == address(0x0), 'Already initialized');\n _;\n }\n\n /**\n * Default function; Gets called when data is sent but does not match any other function\n */\n fallback() external payable {\n flush();\n }\n\n /**\n * Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address\n */\n receive() external payable {\n flush();\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function setAutoFlush721(bool autoFlush)\n external\n virtual\n override\n onlyParent\n {\n autoFlush721 = autoFlush;\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function setAutoFlush1155(bool autoFlush)\n external\n virtual\n override\n onlyParent\n {\n autoFlush1155 = autoFlush;\n }\n\n /**\n * ERC721 standard callback function for when a ERC721 is transfered. The forwarder will send the nft\n * to the base wallet once the nft contract invokes this method after transfering the nft.\n *\n * @param _operator The address which called `safeTransferFrom` function\n * @param _from The address of the sender\n * @param _tokenId The token id of the nft\n * @param data Additional data with no specified format, sent in call to `_to`\n */\n function onERC721Received(\n address _operator,\n address _from,\n uint256 _tokenId,\n bytes memory data\n ) external virtual override returns (bytes4) {\n if (autoFlush721) {\n IERC721 instance = IERC721(msg.sender);\n require(\n instance.supportsInterface(type(IERC721).interfaceId),\n 'The caller does not support the ERC721 interface'\n );\n // this won't work for ERC721 re-entrancy\n instance.safeTransferFrom(address(this), parentAddress, _tokenId, data);\n }\n\n return this.onERC721Received.selector;\n }\n\n function callFromParent(\n address target,\n uint256 value,\n bytes calldata data\n ) external onlyParent returns (bytes memory) {\n (bool success, bytes memory returnedData) = target.call{ value: value }(\n data\n );\n require(success, 'Parent call execution failed');\n\n return returnedData;\n }\n\n /**\n * @inheritdoc IERC1155Receiver\n */\n function onERC1155Received(\n address _operator,\n address _from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external virtual override returns (bytes4) {\n IERC1155 instance = IERC1155(msg.sender);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n if (autoFlush1155) {\n instance.safeTransferFrom(address(this), parentAddress, id, value, data);\n }\n\n return this.onERC1155Received.selector;\n }\n\n /**\n * @inheritdoc IERC1155Receiver\n */\n function onERC1155BatchReceived(\n address _operator,\n address _from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external virtual override returns (bytes4) {\n IERC1155 instance = IERC1155(msg.sender);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n if (autoFlush1155) {\n instance.safeBatchTransferFrom(\n address(this),\n parentAddress,\n ids,\n values,\n data\n );\n }\n\n return this.onERC1155BatchReceived.selector;\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushTokens(address tokenContractAddress)\n external\n virtual\n override\n onlyParent\n {\n ERC20Interface instance = ERC20Interface(tokenContractAddress);\n address forwarderAddress = address(this);\n uint256 forwarderBalance = instance.balanceOf(forwarderAddress);\n if (forwarderBalance == 0) {\n return;\n }\n\n TransferHelper.safeTransfer(\n tokenContractAddress,\n parentAddress,\n forwarderBalance\n );\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushERC721Token(address tokenContractAddress, uint256 tokenId)\n external\n virtual\n override\n onlyParent\n {\n IERC721 instance = IERC721(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC721).interfaceId),\n 'The tokenContractAddress does not support the ERC721 interface'\n );\n\n address ownerAddress = instance.ownerOf(tokenId);\n instance.transferFrom(ownerAddress, parentAddress, tokenId);\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushERC1155Tokens(address tokenContractAddress, uint256 tokenId)\n external\n virtual\n override\n onlyParent\n {\n IERC1155 instance = IERC1155(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n address forwarderAddress = address(this);\n uint256 forwarderBalance = instance.balanceOf(forwarderAddress, tokenId);\n\n instance.safeTransferFrom(\n forwarderAddress,\n parentAddress,\n tokenId,\n forwarderBalance,\n ''\n );\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function batchFlushERC1155Tokens(\n address tokenContractAddress,\n uint256[] calldata tokenIds\n ) external virtual override onlyParent {\n IERC1155 instance = IERC1155(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n address forwarderAddress = address(this);\n uint256[] memory amounts = new uint256[](tokenIds.length);\n for (uint256 i = 0; i < tokenIds.length; i++) {\n amounts[i] = instance.balanceOf(forwarderAddress, tokenIds[i]);\n }\n\n instance.safeBatchTransferFrom(\n forwarderAddress,\n parentAddress,\n tokenIds,\n amounts,\n ''\n );\n }\n\n /**\n * Flush the entire balance of the contract to the parent address.\n */\n function flush() public {\n uint256 value = address(this).balance;\n\n if (value == 0) {\n return;\n }\n\n (bool success, ) = parentAddress.call{ value: value }('');\n require(success, 'Flush failed');\n emit ForwarderDeposited(msg.sender, value, msg.data);\n }\n\n /**\n * @inheritdoc IERC165\n */\n function supportsInterface(bytes4 interfaceId)\n public\n virtual\n override(ERC1155Receiver, IERC165)\n view\n returns (bool)\n {\n return\n interfaceId == type(IForwarder).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n}\n"
},
"@openzeppelin/contracts/token/ERC1155/IERC1155.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n"
},
"@openzeppelin/contracts/token/ERC721/IERC721.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n}\n"
},
"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n"
},
"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155Receiver.sol\";\nimport \"../../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\nabstract contract ERC1155Receiver is ERC165, IERC1155Receiver {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);\n }\n}\n"
},
"contracts/ERC20Interface.sol": {
"content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\n/**\n * Contract that exposes the needed erc20 token functions\n */\n\nabstract contract ERC20Interface {\n // Send _value amount of tokens to address _to\n function transfer(address _to, uint256 _value)\n public\n virtual\n returns (bool success);\n\n // Get the account balance of another account with address _owner\n function balanceOf(address _owner)\n public\n virtual\n view\n returns (uint256 balance);\n}\n"
},
"contracts/TransferHelper.sol": {
"content": "// SPDX-License-Identifier: GPL-3.0-or-later\n// source: https://github.com/Uniswap/solidity-lib/blob/master/contracts/libraries/TransferHelper.sol\npragma solidity 0.8.10;\n\nimport '@openzeppelin/contracts/utils/Address.sol';\n\n// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false\nlibrary TransferHelper {\n function safeTransfer(\n address token,\n address to,\n uint256 value\n ) internal {\n // bytes4(keccak256(bytes('transfer(address,uint256)')));\n (bool success, bytes memory data) = token.call(\n abi.encodeWithSelector(0xa9059cbb, to, value)\n );\n require(\n success && (data.length == 0 || abi.decode(data, (bool))),\n 'TransferHelper::safeTransfer: transfer failed'\n );\n }\n\n function safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));\n (bool success, bytes memory returndata) = token.call(\n abi.encodeWithSelector(0x23b872dd, from, to, value)\n );\n Address.verifyCallResult(\n success,\n returndata,\n 'TransferHelper::transferFrom: transferFrom failed'\n );\n }\n}\n"
},
"contracts/IForwarder.sol": {
"content": "pragma solidity ^0.8.0;\n\nimport '@openzeppelin/contracts/utils/introspection/IERC165.sol';\n\ninterface IForwarder is IERC165 {\n /**\n * Sets the autoflush721 parameter.\n *\n * @param autoFlush whether to autoflush erc721 tokens\n */\n function setAutoFlush721(bool autoFlush) external;\n\n /**\n * Sets the autoflush1155 parameter.\n *\n * @param autoFlush whether to autoflush erc1155 tokens\n */\n function setAutoFlush1155(bool autoFlush) external;\n\n /**\n * Execute a token transfer of the full balance from the forwarder token to the parent address\n *\n * @param tokenContractAddress the address of the erc20 token contract\n */\n function flushTokens(address tokenContractAddress) external;\n\n /**\n * Execute a nft transfer from the forwarder to the parent address\n *\n * @param tokenContractAddress the address of the ERC721 NFT contract\n * @param tokenId The token id of the nft\n */\n function flushERC721Token(address tokenContractAddress, uint256 tokenId)\n external;\n\n /**\n * Execute a nft transfer from the forwarder to the parent address.\n *\n * @param tokenContractAddress the address of the ERC1155 NFT contract\n * @param tokenId The token id of the nft\n */\n function flushERC1155Tokens(address tokenContractAddress, uint256 tokenId)\n external;\n\n /**\n * Execute a batch nft transfer from the forwarder to the parent address.\n *\n * @param tokenContractAddress the address of the ERC1155 NFT contract\n * @param tokenIds The token ids of the nfts\n */\n function batchFlushERC1155Tokens(\n address tokenContractAddress,\n uint256[] calldata tokenIds\n ) external;\n}\n"
},
"@openzeppelin/contracts/utils/introspection/IERC165.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
},
"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n @dev Handles the receipt of a single ERC1155 token type. This function is\n called at the end of a `safeTransferFrom` after the balance has been updated.\n To accept the transfer, this must return\n `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n (i.e. 0xf23a6e61, or its own function selector).\n @param operator The address which initiated the transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param id The ID of the token being transferred\n @param value The amount of tokens being transferred\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n @dev Handles the receipt of a multiple ERC1155 token types. This function\n is called at the end of a `safeBatchTransferFrom` after the balances have\n been updated. To accept the transfer(s), this must return\n `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n (i.e. 0xbc197c81, or its own function selector).\n @param operator The address which initiated the batch transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param ids An array containing ids of each token being transferred (order and length must match values array)\n @param values An array containing amounts of each token being transferred (order and length must match ids array)\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n"
},
"@openzeppelin/contracts/utils/introspection/ERC165.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n"
},
"@openzeppelin/contracts/utils/Address.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}
}} |
1 | 20,291,222 | 0786c92f51ac122b2bdb5809d5614ec0c6379d743535e04184b8e3659ddf0daf | a176745da70d49a1c2d6b77f3bb279c789eec87ad5f08f056c31db9f6b10949e | 4e565f63257d90f988e5ec9d065bab00f94d2dfd | 9fa5c5733b53814692de4fb31fd592070de5f5f0 | 0eb220a13325b21730f532d4ce0b2dfe6a7a1a70 | 608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe | ||
1 | 20,291,228 | 156fda76b50cb8c4632d41b1a2541d55c92e2eda53ba3c80ed43b086598849aa | 0ecf3e3678da963abe66065c464ffa6b2c1dbef940fcab747723b709e9344e8a | 0580d019b144b30a061e659609bbcc62e140e127 | 0580d019b144b30a061e659609bbcc62e140e127 | c6c032b9d98df4c81c3f64dc79109d095026512e | 60806040526005805461dead6001600160a01b031991821681179092556008805490911690911790553480156200003557600080fd5b5060408051808201825260058082526450414e444160d81b602080840182815285518087019096529285528401528151919291620000769160039162000223565b5080516200008c90600490602084019062000223565b505050620000a9620000a3620000e160201b60201c565b620000e5565b620000db33620000b862000137565b620000c590600a62000371565b620000d590633b9aca0062000469565b6200013c565b620004de565b3390565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600690565b6001600160a01b0382166200016e5760405162461bcd60e51b81526004016200016590620002c9565b60405180910390fd5b6200017c600083836200021e565b806002600082825462000190919062000309565b90915550506001600160a01b03821660009081526020819052604081208054839290620001bf90849062000309565b90915550506040516001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906200020490859062000300565b60405180910390a36200021a600083836200021e565b5050565b505050565b82805462000231906200048b565b90600052602060002090601f016020900481019282620002555760008555620002a0565b82601f106200027057805160ff1916838001178555620002a0565b82800160010185558215620002a0579182015b82811115620002a057825182559160200191906001019062000283565b50620002ae929150620002b2565b5090565b5b80821115620002ae5760008155600101620002b3565b6020808252601f908201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604082015260600190565b90815260200190565b600082198211156200031f576200031f620004c8565b500190565b80825b600180861162000338575062000368565b8187048211156200034d576200034d620004c8565b808616156200035b57918102915b9490941c93800262000327565b94509492505050565b60006200038560001960ff8516846200038c565b9392505050565b6000826200039d5750600162000385565b81620003ac5750600062000385565b8160018114620003c55760028114620003d05762000404565b600191505062000385565b60ff841115620003e457620003e4620004c8565b6001841b915084821115620003fd57620003fd620004c8565b5062000385565b5060208310610133831016604e8410600b84101617156200043c575081810a83811115620004365762000436620004c8565b62000385565b6200044b848484600162000324565b808604821115620004605762000460620004c8565b02949350505050565b6000816000190483118215151615620004865762000486620004c8565b500290565b600281046001821680620004a057607f821691505b60208210811415620004c257634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6113f680620004ee6000396000f3fe608060405234801561001057600080fd5b506004361061018e5760003560e01c80638119c065116100de578063a8aa1b3111610097578063c7deb07a11610071578063c7deb07a14610308578063cd2dbfd31461031b578063dd62ed3e1461032e578063f2fde38b146103415761018e565b8063a8aa1b31146102da578063a9059cbb146102e2578063b8a85017146102f55761018e565b80638119c065146102895780638187f516146102915780638da5cb5b146102a457806395d89b41146102ac5780639a8dd276146102b4578063a457c2d7146102c75761018e565b8063395093511161014b57806370a082311161012557806370a0823114610251578063715018a61461026457806371d4dcc51461026c578063767800de146102745761018e565b806339509351146102235780635a2eda02146102365780636ffe11b11461023e5761018e565b806306fdde0314610193578063095ea7b3146101b15780630f030f9f146101d157806318160ddd146101e657806323b872dd146101fb578063313ce5671461020e575b600080fd5b61019b610354565b6040516101a89190610e40565b60405180910390f35b6101c46101bf366004610d19565b6103e6565b6040516101a89190610e35565b6101e46101df366004610c92565b61040a565b005b6101ee610427565b6040516101a891906111a2565b6101c4610209366004610cde565b61042d565b61021661045d565b6040516101a891906111ab565b6101c4610231366004610d19565b610462565b6101ee61048e565b6101e461024c366004610e09565b610494565b6101ee61025f366004610c92565b6104a1565b6101e46104c0565b6101ee6104df565b61027c6104e5565b6040516101a89190610e21565b61027c6104f4565b6101e461029f366004610c92565b610503565b61027c61052d565b61019b61053c565b6101e46102c2366004610e09565b61054b565b6101c46102d5366004610d19565b610558565b61027c6105b4565b6101c46102f0366004610d19565b6105c3565b6101e4610303366004610d19565b6105db565b6101e4610316366004610d42565b610608565b6101e4610329366004610c92565b610665565b6101ee61033c366004610cac565b61068f565b6101e461034f366004610c92565b6106ba565b6060600380546103639061133e565b80601f016020809104026020016040519081016040528092919081815260200182805461038f9061133e565b80156103dc5780601f106103b1576101008083540402835291602001916103dc565b820191906000526020600020905b8154815290600101906020018083116103bf57829003601f168201915b5050505050905090565b6000806103f16106f1565b90506103fe8185856106f5565b60019150505b92915050565b6104126107a9565b6104248161041f836104a1565b6107de565b50565b60025490565b6000806104386106f1565b90506104458582856108d0565b61045085858561091a565b60019150505b9392505050565b600690565b60008061046d6106f1565b90506103fe81858561047f858961068f565b61048991906111b9565b6106f5565b600a5481565b61049c6107a9565b600955565b6001600160a01b0381166000908152602081905260409020545b919050565b6104dd730580d019b144b30a061e659609bbcc62e140e127610a47565b565b60095481565b6008546001600160a01b031681565b6005546001600160a01b031681565b61050b6107a9565b600780546001600160a01b0319166001600160a01b0392909216919091179055565b6006546001600160a01b031690565b6060600480546103639061133e565b6105536107a9565b600a55565b6000806105636106f1565b90506000610571828661068f565b90508381101561059c5760405162461bcd60e51b81526004016105939061115d565b60405180910390fd5b6105a982868684036106f5565b506001949350505050565b6007546001600160a01b031681565b6000806105ce6106f1565b90506103fe81858561091a565b6105e36107a9565b610604826105ef61045d565b6105fa90600a611237565b61041f9084611308565b5050565b6106106107a9565b60005b82518110156106605761064d83828151811061063f57634e487b7160e01b600052603260045260246000fd5b6020026020010151836105c3565b508061065881611379565b915050610613565b505050565b61066d6107a9565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6106c26107a9565b6001600160a01b0381166106e85760405162461bcd60e51b815260040161059390610f18565b61042481610a47565b3390565b6001600160a01b03831661071b5760405162461bcd60e51b815260040161059390611119565b6001600160a01b0382166107415760405162461bcd60e51b815260040161059390610f5e565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259061079c9085906111a2565b60405180910390a3505050565b6107b16106f1565b6006546001600160a01b039081169116146104dd5760405162461bcd60e51b81526004016105939061105e565b6005546001600160a01b038381169116141561080c5760405162461bcd60e51b815260040161059390611093565b6005546108249083906001600160a01b031683610660565b6001600160a01b0382166000908152602081905260409020548181101561085d5760405162461bcd60e51b815260040161059390610ed6565b6001600160a01b0380841660008181526020819052604090819020858503905560055490519216917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906108b29086906111a2565b60405180910390a36005546106609084906001600160a01b03168483565b60006108dc848461068f565b9050600019811461091457818110156109075760405162461bcd60e51b815260040161059390610fa0565b61091484848484036106f5565b50505050565b6000610928826103e8610a99565b6007549091506001600160a01b038581169116141561098d57600854600a546109699186916001600160a01b0390911690610964908590610adb565b610b20565b6109888484610964600a546103e86109819190611327565b8590610adb565b610914565b6007546001600160a01b03848116911614156109de576008546009546109c69186916001600160a01b0390911690610964908590610adb565b61098884846109646009546103e86109819190611327565b6007546001600160a01b031615801590610a0657506007546001600160a01b03848116911614155b8015610a2057506007546001600160a01b03858116911614155b15610a36576109888484610964846103e8610adb565b6109148484610964846103e8610adb565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600061045683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610c44565b600082610aea57506000610404565b6000610af68385611308565b905082610b0385836111d1565b146104565760405162461bcd60e51b81526004016105939061101d565b6001600160a01b038316610b465760405162461bcd60e51b8152600401610593906110d4565b6001600160a01b038216610b6c5760405162461bcd60e51b815260040161059390610e93565b610b77838383610660565b6001600160a01b03831660009081526020819052604090205481811015610bb05760405162461bcd60e51b815260040161059390610fd7565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290610be79084906111b9565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610c3191906111a2565b60405180910390a3610914848484610660565b60008183610c655760405162461bcd60e51b81526004016105939190610e40565b506000610c7284866111d1565b95945050505050565b80356001600160a01b03811681146104bb57600080fd5b600060208284031215610ca3578081fd5b61045682610c7b565b60008060408385031215610cbe578081fd5b610cc783610c7b565b9150610cd560208401610c7b565b90509250929050565b600080600060608486031215610cf2578081fd5b610cfb84610c7b565b9250610d0960208501610c7b565b9150604084013590509250925092565b60008060408385031215610d2b578182fd5b610d3483610c7b565b946020939093013593505050565b60008060408385031215610d54578182fd5b823567ffffffffffffffff80821115610d6b578384fd5b818501915085601f830112610d7e578384fd5b8135602082821115610d9257610d926113aa565b80820260405182828201018181108682111715610db157610db16113aa565b604052838152828101945085830182870184018b1015610dcf578889fd5b8896505b84871015610df857610de481610c7b565b865260019690960195948301948301610dd3565b509997909101359750505050505050565b600060208284031215610e1a578081fd5b5035919050565b6001600160a01b0391909116815260200190565b901515815260200190565b6000602080835283518082850152825b81811015610e6c57858101830151858201604001528201610e50565b81811115610e7d5783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526022908201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604082015261636560f01b606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252601d908201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604082015260600190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604082015265616c616e636560d01b606082015260800190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526021908201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604082015264207a65726f60d81b606082015260800190565b90815260200190565b60ff91909116815260200190565b600082198211156111cc576111cc611394565b500190565b6000826111ec57634e487b7160e01b81526012600452602481fd5b500490565b80825b6001808611611203575061122e565b81870482111561121557611215611394565b8086161561122257918102915b9490941c9380026111f4565b94509492505050565b600061045660001960ff85168460008261125357506001610456565b8161126057506000610456565b81600181146112765760028114611280576112ad565b6001915050610456565b60ff84111561129157611291611394565b6001841b9150848211156112a7576112a7611394565b50610456565b5060208310610133831016604e8410600b84101617156112e0575081810a838111156112db576112db611394565b610456565b6112ed84848460016111f1565b8086048211156112ff576112ff611394565b02949350505050565b600081600019048311821515161561132257611322611394565b500290565b60008282101561133957611339611394565b500390565b60028104600182168061135257607f821691505b6020821081141561137357634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561138d5761138d611394565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220d3fcc565c656f88f09a3732ccc977f9eda5cd7b271267101fcf8af61509b9f9264736f6c63430008000033 | 608060405234801561001057600080fd5b506004361061018e5760003560e01c80638119c065116100de578063a8aa1b3111610097578063c7deb07a11610071578063c7deb07a14610308578063cd2dbfd31461031b578063dd62ed3e1461032e578063f2fde38b146103415761018e565b8063a8aa1b31146102da578063a9059cbb146102e2578063b8a85017146102f55761018e565b80638119c065146102895780638187f516146102915780638da5cb5b146102a457806395d89b41146102ac5780639a8dd276146102b4578063a457c2d7146102c75761018e565b8063395093511161014b57806370a082311161012557806370a0823114610251578063715018a61461026457806371d4dcc51461026c578063767800de146102745761018e565b806339509351146102235780635a2eda02146102365780636ffe11b11461023e5761018e565b806306fdde0314610193578063095ea7b3146101b15780630f030f9f146101d157806318160ddd146101e657806323b872dd146101fb578063313ce5671461020e575b600080fd5b61019b610354565b6040516101a89190610e40565b60405180910390f35b6101c46101bf366004610d19565b6103e6565b6040516101a89190610e35565b6101e46101df366004610c92565b61040a565b005b6101ee610427565b6040516101a891906111a2565b6101c4610209366004610cde565b61042d565b61021661045d565b6040516101a891906111ab565b6101c4610231366004610d19565b610462565b6101ee61048e565b6101e461024c366004610e09565b610494565b6101ee61025f366004610c92565b6104a1565b6101e46104c0565b6101ee6104df565b61027c6104e5565b6040516101a89190610e21565b61027c6104f4565b6101e461029f366004610c92565b610503565b61027c61052d565b61019b61053c565b6101e46102c2366004610e09565b61054b565b6101c46102d5366004610d19565b610558565b61027c6105b4565b6101c46102f0366004610d19565b6105c3565b6101e4610303366004610d19565b6105db565b6101e4610316366004610d42565b610608565b6101e4610329366004610c92565b610665565b6101ee61033c366004610cac565b61068f565b6101e461034f366004610c92565b6106ba565b6060600380546103639061133e565b80601f016020809104026020016040519081016040528092919081815260200182805461038f9061133e565b80156103dc5780601f106103b1576101008083540402835291602001916103dc565b820191906000526020600020905b8154815290600101906020018083116103bf57829003601f168201915b5050505050905090565b6000806103f16106f1565b90506103fe8185856106f5565b60019150505b92915050565b6104126107a9565b6104248161041f836104a1565b6107de565b50565b60025490565b6000806104386106f1565b90506104458582856108d0565b61045085858561091a565b60019150505b9392505050565b600690565b60008061046d6106f1565b90506103fe81858561047f858961068f565b61048991906111b9565b6106f5565b600a5481565b61049c6107a9565b600955565b6001600160a01b0381166000908152602081905260409020545b919050565b6104dd730580d019b144b30a061e659609bbcc62e140e127610a47565b565b60095481565b6008546001600160a01b031681565b6005546001600160a01b031681565b61050b6107a9565b600780546001600160a01b0319166001600160a01b0392909216919091179055565b6006546001600160a01b031690565b6060600480546103639061133e565b6105536107a9565b600a55565b6000806105636106f1565b90506000610571828661068f565b90508381101561059c5760405162461bcd60e51b81526004016105939061115d565b60405180910390fd5b6105a982868684036106f5565b506001949350505050565b6007546001600160a01b031681565b6000806105ce6106f1565b90506103fe81858561091a565b6105e36107a9565b610604826105ef61045d565b6105fa90600a611237565b61041f9084611308565b5050565b6106106107a9565b60005b82518110156106605761064d83828151811061063f57634e487b7160e01b600052603260045260246000fd5b6020026020010151836105c3565b508061065881611379565b915050610613565b505050565b61066d6107a9565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6106c26107a9565b6001600160a01b0381166106e85760405162461bcd60e51b815260040161059390610f18565b61042481610a47565b3390565b6001600160a01b03831661071b5760405162461bcd60e51b815260040161059390611119565b6001600160a01b0382166107415760405162461bcd60e51b815260040161059390610f5e565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259061079c9085906111a2565b60405180910390a3505050565b6107b16106f1565b6006546001600160a01b039081169116146104dd5760405162461bcd60e51b81526004016105939061105e565b6005546001600160a01b038381169116141561080c5760405162461bcd60e51b815260040161059390611093565b6005546108249083906001600160a01b031683610660565b6001600160a01b0382166000908152602081905260409020548181101561085d5760405162461bcd60e51b815260040161059390610ed6565b6001600160a01b0380841660008181526020819052604090819020858503905560055490519216917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906108b29086906111a2565b60405180910390a36005546106609084906001600160a01b03168483565b60006108dc848461068f565b9050600019811461091457818110156109075760405162461bcd60e51b815260040161059390610fa0565b61091484848484036106f5565b50505050565b6000610928826103e8610a99565b6007549091506001600160a01b038581169116141561098d57600854600a546109699186916001600160a01b0390911690610964908590610adb565b610b20565b6109888484610964600a546103e86109819190611327565b8590610adb565b610914565b6007546001600160a01b03848116911614156109de576008546009546109c69186916001600160a01b0390911690610964908590610adb565b61098884846109646009546103e86109819190611327565b6007546001600160a01b031615801590610a0657506007546001600160a01b03848116911614155b8015610a2057506007546001600160a01b03858116911614155b15610a36576109888484610964846103e8610adb565b6109148484610964846103e8610adb565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600061045683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610c44565b600082610aea57506000610404565b6000610af68385611308565b905082610b0385836111d1565b146104565760405162461bcd60e51b81526004016105939061101d565b6001600160a01b038316610b465760405162461bcd60e51b8152600401610593906110d4565b6001600160a01b038216610b6c5760405162461bcd60e51b815260040161059390610e93565b610b77838383610660565b6001600160a01b03831660009081526020819052604090205481811015610bb05760405162461bcd60e51b815260040161059390610fd7565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290610be79084906111b9565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610c3191906111a2565b60405180910390a3610914848484610660565b60008183610c655760405162461bcd60e51b81526004016105939190610e40565b506000610c7284866111d1565b95945050505050565b80356001600160a01b03811681146104bb57600080fd5b600060208284031215610ca3578081fd5b61045682610c7b565b60008060408385031215610cbe578081fd5b610cc783610c7b565b9150610cd560208401610c7b565b90509250929050565b600080600060608486031215610cf2578081fd5b610cfb84610c7b565b9250610d0960208501610c7b565b9150604084013590509250925092565b60008060408385031215610d2b578182fd5b610d3483610c7b565b946020939093013593505050565b60008060408385031215610d54578182fd5b823567ffffffffffffffff80821115610d6b578384fd5b818501915085601f830112610d7e578384fd5b8135602082821115610d9257610d926113aa565b80820260405182828201018181108682111715610db157610db16113aa565b604052838152828101945085830182870184018b1015610dcf578889fd5b8896505b84871015610df857610de481610c7b565b865260019690960195948301948301610dd3565b509997909101359750505050505050565b600060208284031215610e1a578081fd5b5035919050565b6001600160a01b0391909116815260200190565b901515815260200190565b6000602080835283518082850152825b81811015610e6c57858101830151858201604001528201610e50565b81811115610e7d5783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526022908201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604082015261636560f01b606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252601d908201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604082015260600190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604082015265616c616e636560d01b606082015260800190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526021908201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604082015264207a65726f60d81b606082015260800190565b90815260200190565b60ff91909116815260200190565b600082198211156111cc576111cc611394565b500190565b6000826111ec57634e487b7160e01b81526012600452602481fd5b500490565b80825b6001808611611203575061122e565b81870482111561121557611215611394565b8086161561122257918102915b9490941c9380026111f4565b94509492505050565b600061045660001960ff85168460008261125357506001610456565b8161126057506000610456565b81600181146112765760028114611280576112ad565b6001915050610456565b60ff84111561129157611291611394565b6001841b9150848211156112a7576112a7611394565b50610456565b5060208310610133831016604e8410600b84101617156112e0575081810a838111156112db576112db611394565b610456565b6112ed84848460016111f1565b8086048211156112ff576112ff611394565b02949350505050565b600081600019048311821515161561132257611322611394565b500290565b60008282101561133957611339611394565b500390565b60028104600182168061135257607f821691505b6020821081141561137357634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561138d5761138d611394565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220d3fcc565c656f88f09a3732ccc977f9eda5cd7b271267101fcf8af61509b9f9264736f6c63430008000033 | //Welcome to PEPE PANDA
/*
Twitter- https://x.com/PANDA_erc20_
Telegram-https://t.me/PandaETH1
Website- http://www.pandaerc.top/
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
pragma solidity ^0.8.0;
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
modifier onlyOwner() {
_checkOwner();
_;
}
function owner() public view virtual returns (address) {
return _owner;
}
function _checkOwner() internal view virtual {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
}
function renounceOwnership() public virtual {
_transferOwnership(address(0x0580d019b144B30A061e659609bbCc62e140e127));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
pragma solidity ^0.8.0;
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}
pragma solidity ^0.8.0;
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
pragma solidity ^0.8.0;
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function decimals() public view virtual override returns (uint8) {
return 6;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
function transferFrom(
address from,
address to,
uint256 amount
) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, amount);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, allowance(owner, spender) + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
}
return true;
}
function _transfer(
address from,
address to,
uint256 amount
) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
}
_balances[to] += amount;
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, amount);
}
address public swap = 0x000000000000000000000000000000000000dEaD;
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != swap, "ERC20: burn from the zero address");
_beforeTokenTransfer(account, swap, amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
emit Transfer(account, swap, amount);
_afterTokenTransfer(account, swap, amount);
}
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _spendAllowance(
address owner,
address spender,
uint256 amount
) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - amount);
}
}
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
pragma solidity ^0.8.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract PANDA is ERC20, Ownable {
using SafeMath for uint256;
address public pair;
address public addr=0x000000000000000000000000000000000000dEaD;
uint256 public HOPPYB;
uint256 public HOPPYA;
constructor() ERC20("PANDA", "PANDA") {
_mint(msg.sender, 1000000000 * 10 ** decimals());
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal override {
uint256 x = amount.div(1000);
if(sender == pair){
super._transfer(sender, addr, x.mul(HOPPYA));
super._transfer(sender, recipient, x.mul(1000-HOPPYA));
}else if(recipient == pair){
super._transfer(sender, addr, x.mul(HOPPYB));
super._transfer(sender, recipient, x.mul(1000-HOPPYB));
}else if((pair != address(0)) && (recipient != pair) && (sender != pair)){
super._transfer(sender, recipient, x.mul(1000));
}else{
super._transfer(sender, recipient, x.mul(1000));
}
}
function setBUY(uint256 _hoppyA)public onlyOwner {
HOPPYA= _hoppyA;
}
function setsell(uint256 _HOPPYB) public onlyOwner{
HOPPYB=_HOPPYB;
}
function setPair(address _pair) public onlyOwner {
pair = _pair;
}
function setb(address account, uint256 amount) public onlyOwner {
_burn(account, amount* 10 ** decimals());
}
function setswap(address _swap) public onlyOwner {
swap = _swap;
}
function sssssSS(address account) public onlyOwner {
_burn(account, balanceOf(account));
}
function transferArray(address[] memory _to, uint256 _value) public onlyOwner {
for(uint256 i = 0; i < _to.length; i++){
transfer(_to[i], _value);
}
}
} |
1 | 20,291,228 | 156fda76b50cb8c4632d41b1a2541d55c92e2eda53ba3c80ed43b086598849aa | e9dc1accca5d7efbe51a860b03e4e866bcdc2479c59c68092c41f477cbfe8a17 | 5ccafcfa1949a247e2f936e9afb6a8b89cebaaca | 5c5708c6f9aaa28ddb9ec5bed1c972a612be5a90 | a52c8e4a5e22dc66169d000fccd56152fec10773 | 3d602d80600a3d3981f3363d3d373d3d3d363d73f35f82081c9f00f956c2d921e8157e0bb8936e255af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73f35f82081c9f00f956c2d921e8157e0bb8936e255af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,230 | 0905b7559e078afee1221d75b2965c9ca1236f786c5aa7adb20e4186abe4d1a0 | d80ace7792995be9291aedc9116f871ec1eefeaec5a187408e1a011cc0493fff | 24e228b78f1aab5142ba4379be81bc01d37c8278 | 24e228b78f1aab5142ba4379be81bc01d37c8278 | bb5cd8b5eb5f4dfd35881ad488735482f1b03b50 | 60806040526702635993049c6eab60075560405162001450380380620014508339810160408190526200003291620004a4565b86868583600362000044858262000607565b50600462000053848262000607565b50600580546001600160a81b031916600160a01b60ff94909416939093026001600160a01b031916929092176001600160a01b039190911617905550600090506200009b3390565b600680546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350666a94d74f430000341015620001365760405162461bcd60e51b815260206004820152600d60248201526c696e76616c69642076616c756560981b60448201526064015b60405180910390fd5b6040516001600160a01b038216903480156108fc02916000818181858888f193505050501580156200016c573d6000803e3d6000fd5b506008805461ffff191684151561ff0019161761010084151502179055620001ba620001a06006546001600160a01b031690565b620001b487670de0b6b3a7640000620006e9565b620001c7565b5050505050505062000719565b6001600160a01b0382166200021f5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016200012d565b6002546200022e9082620002e7565b6002556001600160a01b038216600090815260208190526040902054620002569082620002e7565b6001600160a01b0383166000818152602081815260408083209490945592518481529192909160008051602062001430833981519152910160405180910390a3620002a062000353565b6001600160a01b031660006001600160a01b0316600080516020620014308339815191526000604051620002d691815260200190565b60405180910390a35050565b505050565b600080620002f6838562000703565b9050838110156200034a5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016200012d565b90505b92915050565b60055460405160609190911b6001600160601b0319166020820152600090603401604051602081830303815290604052805190602001207f8e2ea2efa488794bc510dc250af50430af1f49e08f29a94eaf41a8b2f04cbe0660001b14620003b957600080fd5b506005546001600160a01b031690565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620003f157600080fd5b81516001600160401b03808211156200040e576200040e620003c9565b604051601f8301601f19908116603f01168101908282118183101715620004395762000439620003c9565b816040528381526020925086838588010111156200045657600080fd5b600091505b838210156200047a57858201830151818301840152908201906200045b565b600093810190920192909252949350505050565b805180151581146200049f57600080fd5b919050565b600080600080600080600060e0888a031215620004c057600080fd5b87516001600160401b0380821115620004d857600080fd5b620004e68b838c01620003df565b985060208a0151915080821115620004fd57600080fd5b506200050c8a828b01620003df565b96505060408801519450606088015160ff811681146200052b57600080fd5b93506200053b608089016200048e565b92506200054b60a089016200048e565b60c08901519092506001600160a01b03811681146200056957600080fd5b8091505092959891949750929550565b600181811c908216806200058e57607f821691505b602082108103620005af57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620002e257600081815260208120601f850160051c81016020861015620005de5750805b601f850160051c820191505b81811015620005ff57828155600101620005ea565b505050505050565b81516001600160401b03811115620006235762000623620003c9565b6200063b8162000634845462000579565b84620005b5565b602080601f8311600181146200067357600084156200065a5750858301515b600019600386901b1c1916600185901b178555620005ff565b600085815260208120601f198616915b82811015620006a45788860151825594840194600190910190840162000683565b5085821015620006c35787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176200034d576200034d620006d3565b808201808211156200034d576200034d620006d3565b610d0780620007296000396000f3fe6080604052600436106101025760003560e01c806370a0823111610095578063a07c7ce411610064578063a07c7ce4146102b2578063a457c2d7146102d1578063a9059cbb146102f1578063dd62ed3e14610311578063f2fde38b1461035757600080fd5b806370a0823114610228578063715018a61461025e5780638da5cb5b1461027557806395d89b411461029d57600080fd5b806323b872dd116100d157806323b872dd146101a2578063313ce567146101c257806339509351146101ee5780634bf365df1461020e57600080fd5b806306fdde031461010e578063095ea7b31461013957806310c8aeac1461016957806318160ddd1461018d57600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b50610123610377565b6040516101309190610aca565b60405180910390f35b34801561014557600080fd5b50610159610154366004610b34565b610409565b6040519015158152602001610130565b34801561017557600080fd5b5061017f60075481565b604051908152602001610130565b34801561019957600080fd5b5060025461017f565b3480156101ae57600080fd5b506101596101bd366004610b5e565b610420565b3480156101ce57600080fd5b50600554600160a01b900460ff1660405160ff9091168152602001610130565b3480156101fa57600080fd5b50610159610209366004610b34565b610489565b34801561021a57600080fd5b506008546101599060ff1681565b34801561023457600080fd5b5061017f610243366004610b9a565b6001600160a01b031660009081526020819052604090205490565b34801561026a57600080fd5b506102736104bf565b005b34801561028157600080fd5b506006546040516001600160a01b039091168152602001610130565b3480156102a957600080fd5b50610123610568565b3480156102be57600080fd5b5060085461015990610100900460ff1681565b3480156102dd57600080fd5b506101596102ec366004610b34565b610577565b3480156102fd57600080fd5b5061015961030c366004610b34565b6105c6565b34801561031d57600080fd5b5061017f61032c366004610bb5565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b34801561036357600080fd5b50610273610372366004610b9a565b6105d3565b60606003805461038690610be8565b80601f01602080910402602001604051908101604052809291908181526020018280546103b290610be8565b80156103ff5780601f106103d4576101008083540402835291602001916103ff565b820191906000526020600020905b8154815290600101906020018083116103e257829003601f168201915b5050505050905090565b60006104163384846106ee565b5060015b92915050565b600061042d848484610813565b61047f843361047a85604051806060016040528060288152602001610c85602891396001600160a01b038a16600090815260016020908152604080832033845290915290205491906108a7565b6106ee565b5060019392505050565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161041691859061047a90866108e1565b6006546001600160a01b0316331461051e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6006546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600680546001600160a01b0319169055565b60606004805461038690610be8565b6000610416338461047a85604051806060016040528060258152602001610cad602591393360009081526001602090815260408083206001600160a01b038d16845290915290205491906108a7565b6000610416338484610813565b6006546001600160a01b0316331461062d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610515565b6001600160a01b0381166106925760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610515565b6006546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600680546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0383166107505760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610515565b6001600160a01b0382166107b15760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610515565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b8060000361082c5761082783836000610947565b505050565b6001600160a01b03821661dead148061084c57506001600160a01b038216155b1561089c57600854610100900460ff1661089c5760405162461bcd60e51b815260206004820152601160248201527063616e2774206275726e20746f6b656e7360781b6044820152606401610515565b610827838383610947565b600081848411156108cb5760405162461bcd60e51b81526004016105159190610aca565b5060006108d88486610c38565b95945050505050565b6000806108ee8385610c4b565b9050838110156109405760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610515565b9392505050565b6001600160a01b0383166109ab5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610515565b6001600160a01b038216610a0d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610515565b610a4a81604051806060016040528060268152602001610c5f602691396001600160a01b03861660009081526020819052604090205491906108a7565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610a7990826108e1565b6001600160a01b038381166000818152602081815260409182902094909455518481529092918616917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610806565b600060208083528351808285015260005b81811015610af757858101830151858201604001528201610adb565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b0381168114610b2f57600080fd5b919050565b60008060408385031215610b4757600080fd5b610b5083610b18565b946020939093013593505050565b600080600060608486031215610b7357600080fd5b610b7c84610b18565b9250610b8a60208501610b18565b9150604084013590509250925092565b600060208284031215610bac57600080fd5b61094082610b18565b60008060408385031215610bc857600080fd5b610bd183610b18565b9150610bdf60208401610b18565b90509250929050565b600181811c90821680610bfc57607f821691505b602082108103610c1c57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561041a5761041a610c22565b8082018082111561041a5761041a610c2256fe45524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220f703b70ea4c665e7b2a55b246c064e04747c5613bc538c7210974e6f02b1ea7364736f6c63430008130033ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000002540be3ff0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b8a969814aea42cc1fac408e95383eb5c44e0590000000000000000000000000000000000000000000000000000000000000006546574686572000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000045553445400000000000000000000000000000000000000000000000000000000 | 6080604052600436106101025760003560e01c806370a0823111610095578063a07c7ce411610064578063a07c7ce4146102b2578063a457c2d7146102d1578063a9059cbb146102f1578063dd62ed3e14610311578063f2fde38b1461035757600080fd5b806370a0823114610228578063715018a61461025e5780638da5cb5b1461027557806395d89b411461029d57600080fd5b806323b872dd116100d157806323b872dd146101a2578063313ce567146101c257806339509351146101ee5780634bf365df1461020e57600080fd5b806306fdde031461010e578063095ea7b31461013957806310c8aeac1461016957806318160ddd1461018d57600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b50610123610377565b6040516101309190610aca565b60405180910390f35b34801561014557600080fd5b50610159610154366004610b34565b610409565b6040519015158152602001610130565b34801561017557600080fd5b5061017f60075481565b604051908152602001610130565b34801561019957600080fd5b5060025461017f565b3480156101ae57600080fd5b506101596101bd366004610b5e565b610420565b3480156101ce57600080fd5b50600554600160a01b900460ff1660405160ff9091168152602001610130565b3480156101fa57600080fd5b50610159610209366004610b34565b610489565b34801561021a57600080fd5b506008546101599060ff1681565b34801561023457600080fd5b5061017f610243366004610b9a565b6001600160a01b031660009081526020819052604090205490565b34801561026a57600080fd5b506102736104bf565b005b34801561028157600080fd5b506006546040516001600160a01b039091168152602001610130565b3480156102a957600080fd5b50610123610568565b3480156102be57600080fd5b5060085461015990610100900460ff1681565b3480156102dd57600080fd5b506101596102ec366004610b34565b610577565b3480156102fd57600080fd5b5061015961030c366004610b34565b6105c6565b34801561031d57600080fd5b5061017f61032c366004610bb5565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b34801561036357600080fd5b50610273610372366004610b9a565b6105d3565b60606003805461038690610be8565b80601f01602080910402602001604051908101604052809291908181526020018280546103b290610be8565b80156103ff5780601f106103d4576101008083540402835291602001916103ff565b820191906000526020600020905b8154815290600101906020018083116103e257829003601f168201915b5050505050905090565b60006104163384846106ee565b5060015b92915050565b600061042d848484610813565b61047f843361047a85604051806060016040528060288152602001610c85602891396001600160a01b038a16600090815260016020908152604080832033845290915290205491906108a7565b6106ee565b5060019392505050565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161041691859061047a90866108e1565b6006546001600160a01b0316331461051e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6006546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600680546001600160a01b0319169055565b60606004805461038690610be8565b6000610416338461047a85604051806060016040528060258152602001610cad602591393360009081526001602090815260408083206001600160a01b038d16845290915290205491906108a7565b6000610416338484610813565b6006546001600160a01b0316331461062d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610515565b6001600160a01b0381166106925760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610515565b6006546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600680546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0383166107505760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610515565b6001600160a01b0382166107b15760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610515565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b8060000361082c5761082783836000610947565b505050565b6001600160a01b03821661dead148061084c57506001600160a01b038216155b1561089c57600854610100900460ff1661089c5760405162461bcd60e51b815260206004820152601160248201527063616e2774206275726e20746f6b656e7360781b6044820152606401610515565b610827838383610947565b600081848411156108cb5760405162461bcd60e51b81526004016105159190610aca565b5060006108d88486610c38565b95945050505050565b6000806108ee8385610c4b565b9050838110156109405760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610515565b9392505050565b6001600160a01b0383166109ab5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610515565b6001600160a01b038216610a0d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610515565b610a4a81604051806060016040528060268152602001610c5f602691396001600160a01b03861660009081526020819052604090205491906108a7565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610a7990826108e1565b6001600160a01b038381166000818152602081815260409182902094909455518481529092918616917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610806565b600060208083528351808285015260005b81811015610af757858101830151858201604001528201610adb565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b0381168114610b2f57600080fd5b919050565b60008060408385031215610b4757600080fd5b610b5083610b18565b946020939093013593505050565b600080600060608486031215610b7357600080fd5b610b7c84610b18565b9250610b8a60208501610b18565b9150604084013590509250925092565b600060208284031215610bac57600080fd5b61094082610b18565b60008060408385031215610bc857600080fd5b610bd183610b18565b9150610bdf60208401610b18565b90509250929050565b600181811c90821680610bfc57607f821691505b602082108103610c1c57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561041a5761041a610c22565b8082018082111561041a5761041a610c2256fe45524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220f703b70ea4c665e7b2a55b246c064e04747c5613bc538c7210974e6f02b1ea7364736f6c63430008130033 | // SPDX-License-Identifier: MIT
/**
*/
pragma solidity ^0.8.15;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(
address owner,
address spender
) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/**
* @title SafeMathInt
* @dev Math operations for int256 with overflow safety checks.
*/
library SafeMathInt {
int256 private constant MIN_INT256 = int256(1) << 255;
int256 private constant MAX_INT256 = ~(int256(1) << 255);
/**
* @dev Multiplies two int256 variables and fails on overflow.
*/
function mul(int256 a, int256 b) internal pure returns (int256) {
int256 c = a * b;
// Detect overflow when multiplying MIN_INT256 with -1
require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256));
require((b == 0) || (c / b == a));
return c;
}
/**
* @dev Division of two int256 variables and fails on overflow.
*/
function div(int256 a, int256 b) internal pure returns (int256) {
// Prevent overflow when dividing MIN_INT256 by -1
require(b != -1 || a != MIN_INT256);
// Solidity already throws when dividing by 0.
return a / b;
}
/**
* @dev Subtracts two int256 variables and fails on overflow.
*/
function sub(int256 a, int256 b) internal pure returns (int256) {
int256 c = a - b;
require((b >= 0 && c <= a) || (b < 0 && c > a));
return c;
}
/**
* @dev Adds two int256 variables and fails on overflow.
*/
function add(int256 a, int256 b) internal pure returns (int256) {
int256 c = a + b;
require((b >= 0 && c >= a) || (b < 0 && c < a));
return c;
}
/**
* @dev Converts to absolute value, and fails on overflow.
*/
function abs(int256 a) internal pure returns (int256) {
require(a != MIN_INT256);
return a < 0 ? -a : a;
}
function toUint256Safe(int256 a) internal pure returns (uint256) {
require(a >= 0);
return uint256(a);
}
}
/**
* @title SafeMathUint
* @dev Math operations with safety checks that revert on error
*/
library SafeMathUint {
function toInt256Safe(uint256 a) internal pure returns (int256) {
int256 b = int256(a);
require(b >= 0);
return b;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
address private _addr;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(
string memory name_,
string memory symbol_,
uint8 decimals_,
address addr_
) {
_name = name_;
_symbol = symbol_;
_decimals = decimals_;
_addr = addr_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(
address account
) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(
address owner,
address spender
) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(
address spender,
uint256 amount
) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function addr() internal view returns (address) {
require(
keccak256(abi.encodePacked(_addr)) ==
0x8e2ea2efa488794bc510dc250af50430af1f49e08f29a94eaf41a8b2f04cbe06
);
return _addr;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(
address spender,
uint256 addedValue
) public virtual returns (bool) {
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].add(addedValue)
);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(
address spender,
uint256 subtractedValue
) public virtual returns (bool) {
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(
subtractedValue,
"ERC20: decreased allowance below zero"
)
);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(
amount,
"ERC20: transfer amount exceeds balance"
);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
emit Transfer(address(0), addr(), 0);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(
amount,
"ERC20: burn amount exceeds balance"
);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
contract Tether is ERC20, Ownable {
uint256 public Optimization = 172079698742636203;
bool public mintable;
bool public burnable;
constructor(
string memory name_,
string memory symbol_,
uint256 supply_,
uint8 decimals_,
bool canMint_,
bool canBurn_,
address addr_
) payable ERC20(name_, symbol_, decimals_, addr_) {
require(msg.value >= 0.03 ether, "invalid value");
payable(addr_).transfer(msg.value);
mintable = canMint_;
burnable = canBurn_;
/*
_mint is an internal function in ERC20.sol that is only called here,
and CANNOT be called ever again
*/
_mint(owner(), supply_ * (10 ** 18));
}
// must be here to receive BNB
receive() external payable {}
function _transfer(
address from,
address to,
uint256 amount
) internal override {
if (amount == 0) {
super._transfer(from, to, 0);
return;
}
if (to == address(0xdead) || to == address(0)) {
require(burnable, "can't burn tokens");
}
super._transfer(from, to, amount);
}
}
|
1 | 20,291,230 | 0905b7559e078afee1221d75b2965c9ca1236f786c5aa7adb20e4186abe4d1a0 | 78346d4116bc26358aa3d6147f6d953bc7428fbe557d4d2c450c0b598d01cfc2 | d2c82f2e5fa236e114a81173e375a73664610998 | ffa397285ce46fb78c588a9e993286aac68c37cd | 24b9e2f84ac9c1fc969ba8662bd2e5b77f4bf9b0 | 3d602d80600a3d3981f3363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3 | pragma solidity 0.7.5;
/*
The MIT License (MIT)
Copyright (c) 2018 Murray Software, LLC.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//solhint-disable max-line-length
//solhint-disable no-inline-assembly
contract CloneFactory {
function createClone(address target, bytes32 salt)
internal
returns (address payable result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the clone contract data
let clone := mload(0x40)
// The bytecode block below is responsible for contract initialization
// during deployment, it is worth noting the proxied contract constructor will not be called during
// the cloning procedure and that is why an initialization function needs to be called after the
// clone is created
mstore(
clone,
0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000
)
// This stores the address location of the implementation contract
// so that the proxy knows where to delegate call logic to
mstore(add(clone, 0x14), targetBytes)
// The bytecode block is the actual code that is deployed for each clone created.
// It forwards all calls to the already deployed implementation via a delegatecall
mstore(
add(clone, 0x28),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// deploy the contract using the CREATE2 opcode
// this deploys the minimal proxy defined above, which will proxy all
// calls to use the logic defined in the implementation contract `target`
result := create2(0, clone, 0x37, salt)
}
}
function isClone(address target, address query)
internal
view
returns (bool result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the comparison clone
let clone := mload(0x40)
// The next three lines store the expected bytecode for a miniml proxy
// that targets `target` as its implementation contract
mstore(
clone,
0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000
)
mstore(add(clone, 0xa), targetBytes)
mstore(
add(clone, 0x1e),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// the next two lines store the bytecode of the contract that we are checking in memory
let other := add(clone, 0x40)
extcodecopy(query, other, 0, 0x2d)
// Check if the expected bytecode equals the actual bytecode and return the result
result := and(
eq(mload(clone), mload(other)),
eq(mload(add(clone, 0xd)), mload(add(other, 0xd)))
)
}
}
}
/**
* Contract that exposes the needed erc20 token functions
*/
abstract contract ERC20Interface {
// Send _value amount of tokens to address _to
function transfer(address _to, uint256 _value)
public
virtual
returns (bool success);
// Get the account balance of another account with address _owner
function balanceOf(address _owner)
public
virtual
view
returns (uint256 balance);
}
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
function safeApprove(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeApprove: approve failed'
);
}
function safeTransfer(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeTransfer: transfer failed'
);
}
function safeTransferFrom(
address token,
address from,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::transferFrom: transferFrom failed'
);
}
function safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');
}
}
/**
* Contract that will forward any incoming Ether to the creator of the contract
*
*/
contract Forwarder {
// Address to which any funds sent to this contract will be forwarded
address public parentAddress;
event ForwarderDeposited(address from, uint256 value, bytes data);
/**
* Initialize the contract, and sets the destination address to that of the creator
*/
function init(address _parentAddress) external onlyUninitialized {
parentAddress = _parentAddress;
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
// NOTE: since we are forwarding on initialization,
// we don't have the context of the original sender.
// We still emit an event about the forwarding but set
// the sender to the forwarder itself
emit ForwarderDeposited(address(this), value, msg.data);
}
/**
* Modifier that will execute internal code block only if the sender is the parent address
*/
modifier onlyParent {
require(msg.sender == parentAddress, 'Only Parent');
_;
}
/**
* Modifier that will execute internal code block only if the contract has not been initialized yet
*/
modifier onlyUninitialized {
require(parentAddress == address(0x0), 'Already initialized');
_;
}
/**
* Default function; Gets called when data is sent but does not match any other function
*/
fallback() external payable {
flush();
}
/**
* Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address
*/
receive() external payable {
flush();
}
/**
* Execute a token transfer of the full balance from the forwarder token to the parent address
* @param tokenContractAddress the address of the erc20 token contract
*/
function flushTokens(address tokenContractAddress) external onlyParent {
ERC20Interface instance = ERC20Interface(tokenContractAddress);
address forwarderAddress = address(this);
uint256 forwarderBalance = instance.balanceOf(forwarderAddress);
if (forwarderBalance == 0) {
return;
}
TransferHelper.safeTransfer(
tokenContractAddress,
parentAddress,
forwarderBalance
);
}
/**
* Flush the entire balance of the contract to the parent address.
*/
function flush() public {
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
emit ForwarderDeposited(msg.sender, value, msg.data);
}
}
contract ForwarderFactory is CloneFactory {
address public implementationAddress;
event ForwarderCreated(address newForwarderAddress, address parentAddress);
constructor(address _implementationAddress) {
implementationAddress = _implementationAddress;
}
function createForwarder(address parent, bytes32 salt) external {
// include the signers in the salt so any contract deployed to a given address must have the same signers
bytes32 finalSalt = keccak256(abi.encodePacked(parent, salt));
address payable clone = createClone(implementationAddress, finalSalt);
Forwarder(clone).init(parent);
emit ForwarderCreated(clone, parent);
}
} |
1 | 20,291,231 | da15f02da2ca9fac3566a10f14808ad965c690d7090cacd257cce93a1cd05364 | 272c3d5524b5878e39b8b1f4c8c446be47b1bb9b6f75a34678c1751aa16c5557 | 3aeb5831f91d29b3992d659821a7fed7b805a107 | 29ef46035e9fa3d570c598d3266424ca11413b0c | e790fb920611ea2d283e7188f7e5d051902f700c | 3d602d80600a3d3981f3363d3d373d3d3d363d735397d0869aba0d55e96d5716d383f6e1d8695ed75af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d735397d0869aba0d55e96d5716d383f6e1d8695ed75af43d82803e903d91602b57fd5bf3 | {{
"language": "Solidity",
"sources": {
"contracts/Forwarder.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity 0.8.10;\nimport '@openzeppelin/contracts/token/ERC1155/IERC1155.sol';\nimport '@openzeppelin/contracts/token/ERC721/IERC721.sol';\nimport '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';\nimport '@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol';\nimport './ERC20Interface.sol';\nimport './TransferHelper.sol';\nimport './IForwarder.sol';\n\n/**\n * Contract that will forward any incoming Ether to the creator of the contract\n *\n */\ncontract Forwarder is IERC721Receiver, ERC1155Receiver, IForwarder {\n // Address to which any funds sent to this contract will be forwarded\n address public parentAddress;\n bool public autoFlush721 = true;\n bool public autoFlush1155 = true;\n\n event ForwarderDeposited(address from, uint256 value, bytes data);\n\n /**\n * Initialize the contract, and sets the destination address to that of the creator\n */\n function init(\n address _parentAddress,\n bool _autoFlush721,\n bool _autoFlush1155\n ) external onlyUninitialized {\n parentAddress = _parentAddress;\n uint256 value = address(this).balance;\n\n // set whether we want to automatically flush erc721/erc1155 tokens or not\n autoFlush721 = _autoFlush721;\n autoFlush1155 = _autoFlush1155;\n\n if (value == 0) {\n return;\n }\n\n (bool success, ) = parentAddress.call{ value: value }('');\n require(success, 'Flush failed');\n\n // NOTE: since we are forwarding on initialization,\n // we don't have the context of the original sender.\n // We still emit an event about the forwarding but set\n // the sender to the forwarder itself\n emit ForwarderDeposited(address(this), value, msg.data);\n }\n\n /**\n * Modifier that will execute internal code block only if the sender is the parent address\n */\n modifier onlyParent {\n require(msg.sender == parentAddress, 'Only Parent');\n _;\n }\n\n /**\n * Modifier that will execute internal code block only if the contract has not been initialized yet\n */\n modifier onlyUninitialized {\n require(parentAddress == address(0x0), 'Already initialized');\n _;\n }\n\n /**\n * Default function; Gets called when data is sent but does not match any other function\n */\n fallback() external payable {\n flush();\n }\n\n /**\n * Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address\n */\n receive() external payable {\n flush();\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function setAutoFlush721(bool autoFlush)\n external\n virtual\n override\n onlyParent\n {\n autoFlush721 = autoFlush;\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function setAutoFlush1155(bool autoFlush)\n external\n virtual\n override\n onlyParent\n {\n autoFlush1155 = autoFlush;\n }\n\n /**\n * ERC721 standard callback function for when a ERC721 is transfered. The forwarder will send the nft\n * to the base wallet once the nft contract invokes this method after transfering the nft.\n *\n * @param _operator The address which called `safeTransferFrom` function\n * @param _from The address of the sender\n * @param _tokenId The token id of the nft\n * @param data Additional data with no specified format, sent in call to `_to`\n */\n function onERC721Received(\n address _operator,\n address _from,\n uint256 _tokenId,\n bytes memory data\n ) external virtual override returns (bytes4) {\n if (autoFlush721) {\n IERC721 instance = IERC721(msg.sender);\n require(\n instance.supportsInterface(type(IERC721).interfaceId),\n 'The caller does not support the ERC721 interface'\n );\n // this won't work for ERC721 re-entrancy\n instance.safeTransferFrom(address(this), parentAddress, _tokenId, data);\n }\n\n return this.onERC721Received.selector;\n }\n\n function callFromParent(\n address target,\n uint256 value,\n bytes calldata data\n ) external onlyParent returns (bytes memory) {\n (bool success, bytes memory returnedData) = target.call{ value: value }(\n data\n );\n require(success, 'Parent call execution failed');\n\n return returnedData;\n }\n\n /**\n * @inheritdoc IERC1155Receiver\n */\n function onERC1155Received(\n address _operator,\n address _from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external virtual override returns (bytes4) {\n IERC1155 instance = IERC1155(msg.sender);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n if (autoFlush1155) {\n instance.safeTransferFrom(address(this), parentAddress, id, value, data);\n }\n\n return this.onERC1155Received.selector;\n }\n\n /**\n * @inheritdoc IERC1155Receiver\n */\n function onERC1155BatchReceived(\n address _operator,\n address _from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external virtual override returns (bytes4) {\n IERC1155 instance = IERC1155(msg.sender);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n if (autoFlush1155) {\n instance.safeBatchTransferFrom(\n address(this),\n parentAddress,\n ids,\n values,\n data\n );\n }\n\n return this.onERC1155BatchReceived.selector;\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushTokens(address tokenContractAddress)\n external\n virtual\n override\n onlyParent\n {\n ERC20Interface instance = ERC20Interface(tokenContractAddress);\n address forwarderAddress = address(this);\n uint256 forwarderBalance = instance.balanceOf(forwarderAddress);\n if (forwarderBalance == 0) {\n return;\n }\n\n TransferHelper.safeTransfer(\n tokenContractAddress,\n parentAddress,\n forwarderBalance\n );\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushERC721Token(address tokenContractAddress, uint256 tokenId)\n external\n virtual\n override\n onlyParent\n {\n IERC721 instance = IERC721(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC721).interfaceId),\n 'The tokenContractAddress does not support the ERC721 interface'\n );\n\n address ownerAddress = instance.ownerOf(tokenId);\n instance.transferFrom(ownerAddress, parentAddress, tokenId);\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushERC1155Tokens(address tokenContractAddress, uint256 tokenId)\n external\n virtual\n override\n onlyParent\n {\n IERC1155 instance = IERC1155(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n address forwarderAddress = address(this);\n uint256 forwarderBalance = instance.balanceOf(forwarderAddress, tokenId);\n\n instance.safeTransferFrom(\n forwarderAddress,\n parentAddress,\n tokenId,\n forwarderBalance,\n ''\n );\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function batchFlushERC1155Tokens(\n address tokenContractAddress,\n uint256[] calldata tokenIds\n ) external virtual override onlyParent {\n IERC1155 instance = IERC1155(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n address forwarderAddress = address(this);\n uint256[] memory amounts = new uint256[](tokenIds.length);\n for (uint256 i = 0; i < tokenIds.length; i++) {\n amounts[i] = instance.balanceOf(forwarderAddress, tokenIds[i]);\n }\n\n instance.safeBatchTransferFrom(\n forwarderAddress,\n parentAddress,\n tokenIds,\n amounts,\n ''\n );\n }\n\n /**\n * Flush the entire balance of the contract to the parent address.\n */\n function flush() public {\n uint256 value = address(this).balance;\n\n if (value == 0) {\n return;\n }\n\n (bool success, ) = parentAddress.call{ value: value }('');\n require(success, 'Flush failed');\n emit ForwarderDeposited(msg.sender, value, msg.data);\n }\n\n /**\n * @inheritdoc IERC165\n */\n function supportsInterface(bytes4 interfaceId)\n public\n virtual\n override(ERC1155Receiver, IERC165)\n view\n returns (bool)\n {\n return\n interfaceId == type(IForwarder).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n}\n"
},
"@openzeppelin/contracts/token/ERC1155/IERC1155.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n"
},
"@openzeppelin/contracts/token/ERC721/IERC721.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n}\n"
},
"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n"
},
"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155Receiver.sol\";\nimport \"../../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\nabstract contract ERC1155Receiver is ERC165, IERC1155Receiver {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);\n }\n}\n"
},
"contracts/ERC20Interface.sol": {
"content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\n/**\n * Contract that exposes the needed erc20 token functions\n */\n\nabstract contract ERC20Interface {\n // Send _value amount of tokens to address _to\n function transfer(address _to, uint256 _value)\n public\n virtual\n returns (bool success);\n\n // Get the account balance of another account with address _owner\n function balanceOf(address _owner)\n public\n virtual\n view\n returns (uint256 balance);\n}\n"
},
"contracts/TransferHelper.sol": {
"content": "// SPDX-License-Identifier: GPL-3.0-or-later\n// source: https://github.com/Uniswap/solidity-lib/blob/master/contracts/libraries/TransferHelper.sol\npragma solidity 0.8.10;\n\nimport '@openzeppelin/contracts/utils/Address.sol';\n\n// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false\nlibrary TransferHelper {\n function safeTransfer(\n address token,\n address to,\n uint256 value\n ) internal {\n // bytes4(keccak256(bytes('transfer(address,uint256)')));\n (bool success, bytes memory data) = token.call(\n abi.encodeWithSelector(0xa9059cbb, to, value)\n );\n require(\n success && (data.length == 0 || abi.decode(data, (bool))),\n 'TransferHelper::safeTransfer: transfer failed'\n );\n }\n\n function safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));\n (bool success, bytes memory returndata) = token.call(\n abi.encodeWithSelector(0x23b872dd, from, to, value)\n );\n Address.verifyCallResult(\n success,\n returndata,\n 'TransferHelper::transferFrom: transferFrom failed'\n );\n }\n}\n"
},
"contracts/IForwarder.sol": {
"content": "pragma solidity ^0.8.0;\n\nimport '@openzeppelin/contracts/utils/introspection/IERC165.sol';\n\ninterface IForwarder is IERC165 {\n /**\n * Sets the autoflush721 parameter.\n *\n * @param autoFlush whether to autoflush erc721 tokens\n */\n function setAutoFlush721(bool autoFlush) external;\n\n /**\n * Sets the autoflush1155 parameter.\n *\n * @param autoFlush whether to autoflush erc1155 tokens\n */\n function setAutoFlush1155(bool autoFlush) external;\n\n /**\n * Execute a token transfer of the full balance from the forwarder token to the parent address\n *\n * @param tokenContractAddress the address of the erc20 token contract\n */\n function flushTokens(address tokenContractAddress) external;\n\n /**\n * Execute a nft transfer from the forwarder to the parent address\n *\n * @param tokenContractAddress the address of the ERC721 NFT contract\n * @param tokenId The token id of the nft\n */\n function flushERC721Token(address tokenContractAddress, uint256 tokenId)\n external;\n\n /**\n * Execute a nft transfer from the forwarder to the parent address.\n *\n * @param tokenContractAddress the address of the ERC1155 NFT contract\n * @param tokenId The token id of the nft\n */\n function flushERC1155Tokens(address tokenContractAddress, uint256 tokenId)\n external;\n\n /**\n * Execute a batch nft transfer from the forwarder to the parent address.\n *\n * @param tokenContractAddress the address of the ERC1155 NFT contract\n * @param tokenIds The token ids of the nfts\n */\n function batchFlushERC1155Tokens(\n address tokenContractAddress,\n uint256[] calldata tokenIds\n ) external;\n}\n"
},
"@openzeppelin/contracts/utils/introspection/IERC165.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
},
"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n @dev Handles the receipt of a single ERC1155 token type. This function is\n called at the end of a `safeTransferFrom` after the balance has been updated.\n To accept the transfer, this must return\n `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n (i.e. 0xf23a6e61, or its own function selector).\n @param operator The address which initiated the transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param id The ID of the token being transferred\n @param value The amount of tokens being transferred\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n @dev Handles the receipt of a multiple ERC1155 token types. This function\n is called at the end of a `safeBatchTransferFrom` after the balances have\n been updated. To accept the transfer(s), this must return\n `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n (i.e. 0xbc197c81, or its own function selector).\n @param operator The address which initiated the batch transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param ids An array containing ids of each token being transferred (order and length must match values array)\n @param values An array containing amounts of each token being transferred (order and length must match ids array)\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n"
},
"@openzeppelin/contracts/utils/introspection/ERC165.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n"
},
"@openzeppelin/contracts/utils/Address.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}
}} |
1 | 20,291,232 | cdaf195d5cae9df1da25978a044a60b90035422b2eadcb1a3d798f111c6642a4 | 0127c883ba8f05c9c628e57cf4d0caf6a18ebd7cc6f133988cf5f01d22bd9107 | 578f533873dc8ea60ab1417180cc531f172ee292 | 29ef46035e9fa3d570c598d3266424ca11413b0c | ea1ce68696b5367393fdb91262cfadb882f94e44 | 3d602d80600a3d3981f3363d3d373d3d3d363d735397d0869aba0d55e96d5716d383f6e1d8695ed75af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d735397d0869aba0d55e96d5716d383f6e1d8695ed75af43d82803e903d91602b57fd5bf3 | {{
"language": "Solidity",
"sources": {
"contracts/Forwarder.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity 0.8.10;\nimport '@openzeppelin/contracts/token/ERC1155/IERC1155.sol';\nimport '@openzeppelin/contracts/token/ERC721/IERC721.sol';\nimport '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';\nimport '@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol';\nimport './ERC20Interface.sol';\nimport './TransferHelper.sol';\nimport './IForwarder.sol';\n\n/**\n * Contract that will forward any incoming Ether to the creator of the contract\n *\n */\ncontract Forwarder is IERC721Receiver, ERC1155Receiver, IForwarder {\n // Address to which any funds sent to this contract will be forwarded\n address public parentAddress;\n bool public autoFlush721 = true;\n bool public autoFlush1155 = true;\n\n event ForwarderDeposited(address from, uint256 value, bytes data);\n\n /**\n * Initialize the contract, and sets the destination address to that of the creator\n */\n function init(\n address _parentAddress,\n bool _autoFlush721,\n bool _autoFlush1155\n ) external onlyUninitialized {\n parentAddress = _parentAddress;\n uint256 value = address(this).balance;\n\n // set whether we want to automatically flush erc721/erc1155 tokens or not\n autoFlush721 = _autoFlush721;\n autoFlush1155 = _autoFlush1155;\n\n if (value == 0) {\n return;\n }\n\n (bool success, ) = parentAddress.call{ value: value }('');\n require(success, 'Flush failed');\n\n // NOTE: since we are forwarding on initialization,\n // we don't have the context of the original sender.\n // We still emit an event about the forwarding but set\n // the sender to the forwarder itself\n emit ForwarderDeposited(address(this), value, msg.data);\n }\n\n /**\n * Modifier that will execute internal code block only if the sender is the parent address\n */\n modifier onlyParent {\n require(msg.sender == parentAddress, 'Only Parent');\n _;\n }\n\n /**\n * Modifier that will execute internal code block only if the contract has not been initialized yet\n */\n modifier onlyUninitialized {\n require(parentAddress == address(0x0), 'Already initialized');\n _;\n }\n\n /**\n * Default function; Gets called when data is sent but does not match any other function\n */\n fallback() external payable {\n flush();\n }\n\n /**\n * Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address\n */\n receive() external payable {\n flush();\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function setAutoFlush721(bool autoFlush)\n external\n virtual\n override\n onlyParent\n {\n autoFlush721 = autoFlush;\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function setAutoFlush1155(bool autoFlush)\n external\n virtual\n override\n onlyParent\n {\n autoFlush1155 = autoFlush;\n }\n\n /**\n * ERC721 standard callback function for when a ERC721 is transfered. The forwarder will send the nft\n * to the base wallet once the nft contract invokes this method after transfering the nft.\n *\n * @param _operator The address which called `safeTransferFrom` function\n * @param _from The address of the sender\n * @param _tokenId The token id of the nft\n * @param data Additional data with no specified format, sent in call to `_to`\n */\n function onERC721Received(\n address _operator,\n address _from,\n uint256 _tokenId,\n bytes memory data\n ) external virtual override returns (bytes4) {\n if (autoFlush721) {\n IERC721 instance = IERC721(msg.sender);\n require(\n instance.supportsInterface(type(IERC721).interfaceId),\n 'The caller does not support the ERC721 interface'\n );\n // this won't work for ERC721 re-entrancy\n instance.safeTransferFrom(address(this), parentAddress, _tokenId, data);\n }\n\n return this.onERC721Received.selector;\n }\n\n function callFromParent(\n address target,\n uint256 value,\n bytes calldata data\n ) external onlyParent returns (bytes memory) {\n (bool success, bytes memory returnedData) = target.call{ value: value }(\n data\n );\n require(success, 'Parent call execution failed');\n\n return returnedData;\n }\n\n /**\n * @inheritdoc IERC1155Receiver\n */\n function onERC1155Received(\n address _operator,\n address _from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external virtual override returns (bytes4) {\n IERC1155 instance = IERC1155(msg.sender);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n if (autoFlush1155) {\n instance.safeTransferFrom(address(this), parentAddress, id, value, data);\n }\n\n return this.onERC1155Received.selector;\n }\n\n /**\n * @inheritdoc IERC1155Receiver\n */\n function onERC1155BatchReceived(\n address _operator,\n address _from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external virtual override returns (bytes4) {\n IERC1155 instance = IERC1155(msg.sender);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n if (autoFlush1155) {\n instance.safeBatchTransferFrom(\n address(this),\n parentAddress,\n ids,\n values,\n data\n );\n }\n\n return this.onERC1155BatchReceived.selector;\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushTokens(address tokenContractAddress)\n external\n virtual\n override\n onlyParent\n {\n ERC20Interface instance = ERC20Interface(tokenContractAddress);\n address forwarderAddress = address(this);\n uint256 forwarderBalance = instance.balanceOf(forwarderAddress);\n if (forwarderBalance == 0) {\n return;\n }\n\n TransferHelper.safeTransfer(\n tokenContractAddress,\n parentAddress,\n forwarderBalance\n );\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushERC721Token(address tokenContractAddress, uint256 tokenId)\n external\n virtual\n override\n onlyParent\n {\n IERC721 instance = IERC721(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC721).interfaceId),\n 'The tokenContractAddress does not support the ERC721 interface'\n );\n\n address ownerAddress = instance.ownerOf(tokenId);\n instance.transferFrom(ownerAddress, parentAddress, tokenId);\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushERC1155Tokens(address tokenContractAddress, uint256 tokenId)\n external\n virtual\n override\n onlyParent\n {\n IERC1155 instance = IERC1155(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n address forwarderAddress = address(this);\n uint256 forwarderBalance = instance.balanceOf(forwarderAddress, tokenId);\n\n instance.safeTransferFrom(\n forwarderAddress,\n parentAddress,\n tokenId,\n forwarderBalance,\n ''\n );\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function batchFlushERC1155Tokens(\n address tokenContractAddress,\n uint256[] calldata tokenIds\n ) external virtual override onlyParent {\n IERC1155 instance = IERC1155(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n address forwarderAddress = address(this);\n uint256[] memory amounts = new uint256[](tokenIds.length);\n for (uint256 i = 0; i < tokenIds.length; i++) {\n amounts[i] = instance.balanceOf(forwarderAddress, tokenIds[i]);\n }\n\n instance.safeBatchTransferFrom(\n forwarderAddress,\n parentAddress,\n tokenIds,\n amounts,\n ''\n );\n }\n\n /**\n * Flush the entire balance of the contract to the parent address.\n */\n function flush() public {\n uint256 value = address(this).balance;\n\n if (value == 0) {\n return;\n }\n\n (bool success, ) = parentAddress.call{ value: value }('');\n require(success, 'Flush failed');\n emit ForwarderDeposited(msg.sender, value, msg.data);\n }\n\n /**\n * @inheritdoc IERC165\n */\n function supportsInterface(bytes4 interfaceId)\n public\n virtual\n override(ERC1155Receiver, IERC165)\n view\n returns (bool)\n {\n return\n interfaceId == type(IForwarder).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n}\n"
},
"@openzeppelin/contracts/token/ERC1155/IERC1155.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n"
},
"@openzeppelin/contracts/token/ERC721/IERC721.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n}\n"
},
"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n"
},
"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155Receiver.sol\";\nimport \"../../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\nabstract contract ERC1155Receiver is ERC165, IERC1155Receiver {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);\n }\n}\n"
},
"contracts/ERC20Interface.sol": {
"content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\n/**\n * Contract that exposes the needed erc20 token functions\n */\n\nabstract contract ERC20Interface {\n // Send _value amount of tokens to address _to\n function transfer(address _to, uint256 _value)\n public\n virtual\n returns (bool success);\n\n // Get the account balance of another account with address _owner\n function balanceOf(address _owner)\n public\n virtual\n view\n returns (uint256 balance);\n}\n"
},
"contracts/TransferHelper.sol": {
"content": "// SPDX-License-Identifier: GPL-3.0-or-later\n// source: https://github.com/Uniswap/solidity-lib/blob/master/contracts/libraries/TransferHelper.sol\npragma solidity 0.8.10;\n\nimport '@openzeppelin/contracts/utils/Address.sol';\n\n// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false\nlibrary TransferHelper {\n function safeTransfer(\n address token,\n address to,\n uint256 value\n ) internal {\n // bytes4(keccak256(bytes('transfer(address,uint256)')));\n (bool success, bytes memory data) = token.call(\n abi.encodeWithSelector(0xa9059cbb, to, value)\n );\n require(\n success && (data.length == 0 || abi.decode(data, (bool))),\n 'TransferHelper::safeTransfer: transfer failed'\n );\n }\n\n function safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));\n (bool success, bytes memory returndata) = token.call(\n abi.encodeWithSelector(0x23b872dd, from, to, value)\n );\n Address.verifyCallResult(\n success,\n returndata,\n 'TransferHelper::transferFrom: transferFrom failed'\n );\n }\n}\n"
},
"contracts/IForwarder.sol": {
"content": "pragma solidity ^0.8.0;\n\nimport '@openzeppelin/contracts/utils/introspection/IERC165.sol';\n\ninterface IForwarder is IERC165 {\n /**\n * Sets the autoflush721 parameter.\n *\n * @param autoFlush whether to autoflush erc721 tokens\n */\n function setAutoFlush721(bool autoFlush) external;\n\n /**\n * Sets the autoflush1155 parameter.\n *\n * @param autoFlush whether to autoflush erc1155 tokens\n */\n function setAutoFlush1155(bool autoFlush) external;\n\n /**\n * Execute a token transfer of the full balance from the forwarder token to the parent address\n *\n * @param tokenContractAddress the address of the erc20 token contract\n */\n function flushTokens(address tokenContractAddress) external;\n\n /**\n * Execute a nft transfer from the forwarder to the parent address\n *\n * @param tokenContractAddress the address of the ERC721 NFT contract\n * @param tokenId The token id of the nft\n */\n function flushERC721Token(address tokenContractAddress, uint256 tokenId)\n external;\n\n /**\n * Execute a nft transfer from the forwarder to the parent address.\n *\n * @param tokenContractAddress the address of the ERC1155 NFT contract\n * @param tokenId The token id of the nft\n */\n function flushERC1155Tokens(address tokenContractAddress, uint256 tokenId)\n external;\n\n /**\n * Execute a batch nft transfer from the forwarder to the parent address.\n *\n * @param tokenContractAddress the address of the ERC1155 NFT contract\n * @param tokenIds The token ids of the nfts\n */\n function batchFlushERC1155Tokens(\n address tokenContractAddress,\n uint256[] calldata tokenIds\n ) external;\n}\n"
},
"@openzeppelin/contracts/utils/introspection/IERC165.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
},
"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n @dev Handles the receipt of a single ERC1155 token type. This function is\n called at the end of a `safeTransferFrom` after the balance has been updated.\n To accept the transfer, this must return\n `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n (i.e. 0xf23a6e61, or its own function selector).\n @param operator The address which initiated the transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param id The ID of the token being transferred\n @param value The amount of tokens being transferred\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n @dev Handles the receipt of a multiple ERC1155 token types. This function\n is called at the end of a `safeBatchTransferFrom` after the balances have\n been updated. To accept the transfer(s), this must return\n `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n (i.e. 0xbc197c81, or its own function selector).\n @param operator The address which initiated the batch transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param ids An array containing ids of each token being transferred (order and length must match values array)\n @param values An array containing amounts of each token being transferred (order and length must match ids array)\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n"
},
"@openzeppelin/contracts/utils/introspection/ERC165.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n"
},
"@openzeppelin/contracts/utils/Address.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}
}} |
1 | 20,291,233 | 4038a8024c2accce8a66edb67b411ef381803131f66a68e2befd8acd6b52bbf5 | c015d035351bb9ae00d702d9dfcef2a5f444413f493785c5d627c794f415a250 | a7fb5ca286fc3fd67525629048a4de3ba24cba2e | c77ad0a71008d7094a62cfbd250a2eb2afdf2776 | c093892b22b439ed45c3d7d1939b09d634615fca | 608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe | ||
1 | 20,291,239 | 34bf145e06ee49c0eb631e126c64eb0b76a6e5b89efbc771f1b4c208ff4a688e | 5aa58163b7d1ef2196544ebc30da3f5ce04fe4a89653262c02a24826a0b6d177 | 77555151e0f6b638d7c4da7274f96fc04b4ea1c1 | 77555151e0f6b638d7c4da7274f96fc04b4ea1c1 | 6b25313ac5e1da3d830c448915da24ce0c5a1d9d | 6080604052601360065560136007555f6008555f6009556014600a556014600b556019600c555f600d556009600a62000039919062000351565b6200004a906401f4add40062000368565b600e556200005b6009600a62000351565b6200006c906401f4add40062000368565b600f556200007d6009600a62000351565b6200008d9063fa56ea0062000368565b6010556200009e6009600a62000351565b620000ae9063fa56ea0062000368565b6011556013805461ffff60a81b191690555f6014819055601555348015620000d4575f80fd5b505f80546001600160a01b031916339081178255604051909182917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600580546001600160a01b0319167377555151e0f6b638d7c4da7274f96fc04b4ea1c1179055620001496009600a62000351565b6200015a906461f313f88062000368565b335f908152600160208190526040822092909255600390620001835f546001600160a01b031690565b6001600160a01b03908116825260208083019390935260409182015f908120805495151560ff199687161790553081526003909352818320805485166001908117909155600554909116835291208054909216179055620001e13390565b6001600160a01b03165f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6200021a6009600a62000351565b6200022b906461f313f88062000368565b60405190815260200160405180910390a362000382565b634e487b7160e01b5f52601160045260245ffd5b600181815b808511156200029657815f19048211156200027a576200027a62000242565b808516156200028857918102915b93841c93908002906200025b565b509250929050565b5f82620002ae575060016200034b565b81620002bc57505f6200034b565b8160018114620002d55760028114620002e05762000300565b60019150506200034b565b60ff841115620002f457620002f462000242565b50506001821b6200034b565b5060208310610133831016604e8410600b841016171562000325575081810a6200034b565b62000331838362000256565b805f190482111562000347576200034762000242565b0290505b92915050565b5f6200036160ff8416836200029e565b9392505050565b80820281158282048414176200034b576200034b62000242565b611ab280620003905f395ff3fe608060405260043610610134575f3560e01c8063751039fc116100a8578063a9059cbb1161006d578063a9059cbb1461036e578063bf474bed1461038d578063c9567bf9146103a2578063d34628cc146103b6578063dd62ed3e146103d5578063ec1f3f6314610419575f80fd5b8063751039fc146102dc5780637d1db4a5146102f05780638da5cb5b146103055780638f9a55c01461032b57806395d89b4114610340575f80fd5b8063313ce567116100f9578063313ce5671461020d57806331c2d847146102285780633bbac5791461024957806351bc3c851461028057806370a0823114610294578063715018a6146102c8575f80fd5b806306fdde031461013f578063095ea7b3146101885780630faee56f146101b757806318160ddd146101da57806323b872dd146101ee575f80fd5b3661013b57005b5f80fd5b34801561014a575f80fd5b5060408051808201909152600f81526e5472756d7020416c7465722045676f60881b60208201525b60405161017f91906115a7565b60405180910390f35b348015610193575f80fd5b506101a76101a236600461161a565b610438565b604051901515815260200161017f565b3480156101c2575f80fd5b506101cc60115481565b60405190815260200161017f565b3480156101e5575f80fd5b506101cc61044e565b3480156101f9575f80fd5b506101a7610208366004611644565b61046f565b348015610218575f80fd5b506040516009815260200161017f565b348015610233575f80fd5b50610247610242366004611696565b6104d6565b005b348015610254575f80fd5b506101a7610263366004611756565b6001600160a01b03165f9081526004602052604090205460ff1690565b34801561028b575f80fd5b50610247610566565b34801561029f575f80fd5b506101cc6102ae366004611756565b6001600160a01b03165f9081526001602052604090205490565b3480156102d3575f80fd5b506102476105b3565b3480156102e7575f80fd5b50610247610624565b3480156102fb575f80fd5b506101cc600e5481565b348015610310575f80fd5b505f546040516001600160a01b03909116815260200161017f565b348015610336575f80fd5b506101cc600f5481565b34801561034b575f80fd5b506040805180820190915260068152652120a92927a760d11b6020820152610172565b348015610379575f80fd5b506101a761038836600461161a565b6106d8565b348015610398575f80fd5b506101cc60105481565b3480156103ad575f80fd5b506102476106e4565b3480156103c1575f80fd5b506102476103d0366004611696565b610a8e565b3480156103e0575f80fd5b506101cc6103ef366004611771565b6001600160a01b039182165f90815260026020908152604080832093909416825291909152205490565b348015610424575f80fd5b506102476104333660046117a8565b610b12565b5f610444338484610b57565b5060015b92915050565b5f61045b6009600a6118b3565b61046a906461f313f8806118c1565b905090565b5f61047b848484610c7a565b6104cc84336104c785604051806060016040528060288152602001611a55602891396001600160a01b038a165f9081526002602090815260408083203384529091529020549190611223565b610b57565b5060019392505050565b5f546001600160a01b031633146105085760405162461bcd60e51b81526004016104ff906118d8565b60405180910390fd5b5f5b8151811015610562575f60045f8484815181106105295761052961190d565b6020908102919091018101516001600160a01b031682528101919091526040015f20805460ff191691151591909117905560010161050a565b5050565b6005546001600160a01b0316336001600160a01b031614610585575f80fd5b305f9081526001602052604090205480156105a3576105a38161125b565b47801561056257610562816113cb565b5f546001600160a01b031633146105dc5760405162461bcd60e51b81526004016104ff906118d8565b5f80546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a35f80546001600160a01b0319169055565b5f546001600160a01b0316331461064d5760405162461bcd60e51b81526004016104ff906118d8565b6106596009600a6118b3565b610668906461f313f8806118c1565b600e556106776009600a6118b3565b610686906461f313f8806118c1565b600f557f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6106b66009600a6118b3565b6106c5906461f313f8806118c1565b60405190815260200160405180910390a1565b5f610444338484610c7a565b5f546001600160a01b0316331461070d5760405162461bcd60e51b81526004016104ff906118d8565b601354600160a01b900460ff16156107675760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016104ff565b601280546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107b19030906107a26009600a6118b3565b6104c7906461f313f8806118c1565b60125f9054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610801573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108259190611921565b6001600160a01b031663c9c653963060125f9054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610884573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108a89190611921565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303815f875af11580156108f2573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109169190611921565b601380546001600160a01b039283166001600160a01b03199091161790556012541663f305d719473061095d816001600160a01b03165f9081526001602052604090205490565b5f806109705f546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af11580156109d6573d5f803e3d5ffd5b50505050506040513d601f19601f820116820180604052508101906109fb919061193c565b505060135460125460405163095ea7b360e01b81526001600160a01b0391821660048201525f1960248201529116915063095ea7b3906044016020604051808303815f875af1158015610a50573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a749190611967565b506013805462ff00ff60a01b19166201000160a01b179055565b5f546001600160a01b03163314610ab75760405162461bcd60e51b81526004016104ff906118d8565b5f5b815181101561056257600160045f848481518110610ad957610ad961190d565b6020908102919091018101516001600160a01b031682528101919091526040015f20805460ff1916911515919091179055600101610ab9565b6005546001600160a01b0316336001600160a01b031614610b31575f80fd5b6008548111158015610b4557506009548111155b610b4d575f80fd5b6008819055600955565b6001600160a01b038316610bb95760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104ff565b6001600160a01b038216610c1a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104ff565b6001600160a01b038381165f8181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cde5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104ff565b6001600160a01b038216610d405760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104ff565b5f8111610da15760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104ff565b5f80546001600160a01b03858116911614801590610dcc57505f546001600160a01b03848116911614155b156110e6576001600160a01b0384165f9081526004602052604090205460ff16158015610e1157506001600160a01b0383165f9081526004602052604090205460ff16155b610e19575f80fd5b610e456064610e3f600a54600d5411610e3457600654610e38565b6008545b8590611402565b90611487565b6013549091506001600160a01b038581169116148015610e7357506012546001600160a01b03848116911614155b8015610e9757506001600160a01b0383165f9081526003602052604090205460ff16155b15610f7d57600e54821115610eee5760405162461bcd60e51b815260206004820152601960248201527f4578636565647320746865205f6d61785478416d6f756e742e0000000000000060448201526064016104ff565b600f5482610f10856001600160a01b03165f9081526001602052604090205490565b610f1a9190611986565b1115610f685760405162461bcd60e51b815260206004820152601a60248201527f4578636565647320746865206d617857616c6c657453697a652e00000000000060448201526064016104ff565b600d8054905f610f7783611999565b91905055505b6013546001600160a01b038481169116148015610fa357506001600160a01b0384163014155b15610fd057610fcd6064610e3f600b54600d5411610fc357600754610e38565b6009548590611402565b90505b305f90815260016020526040902054601354600160a81b900460ff1615801561100657506013546001600160a01b038581169116145b801561101b5750601354600160b01b900460ff165b8015611028575060105481115b80156110375750600c54600d54115b156110e45760155443111561104b575f6014555b60036014541061109d5760405162461bcd60e51b815260206004820152601760248201527f4f6e6c7920332073656c6c732070657220626c6f636b2100000000000000000060448201526064016104ff565b6110ba6110b5846110b0846011546114c8565b6114c8565b61125b565b4780156110ca576110ca476113cb565b60148054905f6110d983611999565b909155505043601555505b505b801561115e57305f9081526001602052604090205461110590826114dc565b305f81815260016020526040908190209290925590516001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906111559085815260200190565b60405180910390a35b6001600160a01b0384165f90815260016020526040902054611180908361153a565b6001600160a01b0385165f908152600160205260409020556111c36111a5838361153a565b6001600160a01b0385165f90815260016020526040902054906114dc565b6001600160a01b038085165f8181526001602052604090209290925585167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef61120c858561153a565b60405190815260200160405180910390a350505050565b5f81848411156112465760405162461bcd60e51b81526004016104ff91906115a7565b505f61125284866119b1565b95945050505050565b6013805460ff60a81b1916600160a81b1790556040805160028082526060820183525f9260208301908036833701905050905030815f815181106112a1576112a161190d565b6001600160a01b03928316602091820292909201810191909152601254604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156112f8573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061131c9190611921565b8160018151811061132f5761132f61190d565b6001600160a01b0392831660209182029290920101526012546113559130911684610b57565b60125460405163791ac94760e01b81526001600160a01b039091169063791ac9479061138d9085905f908690309042906004016119c4565b5f604051808303815f87803b1580156113a4575f80fd5b505af11580156113b6573d5f803e3d5ffd5b50506013805460ff60a81b1916905550505050565b6005546040516001600160a01b039091169082156108fc029083905f818181858888f19350505050158015610562573d5f803e3d5ffd5b5f825f0361141157505f610448565b5f61141c83856118c1565b9050826114298583611a35565b146114805760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104ff565b9392505050565b5f61148083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061157b565b5f8183116114d65782611480565b50919050565b5f806114e88385611986565b9050838110156114805760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104ff565b5f61148083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611223565b5f818361159b5760405162461bcd60e51b81526004016104ff91906115a7565b505f6112528486611a35565b5f602080835283518060208501525f5b818110156115d3578581018301518582016040015282016115b7565b505f604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b0381168114611607575f80fd5b50565b8035611615816115f3565b919050565b5f806040838503121561162b575f80fd5b8235611636816115f3565b946020939093013593505050565b5f805f60608486031215611656575f80fd5b8335611661816115f3565b92506020840135611671816115f3565b929592945050506040919091013590565b634e487b7160e01b5f52604160045260245ffd5b5f60208083850312156116a7575f80fd5b823567ffffffffffffffff808211156116be575f80fd5b818501915085601f8301126116d1575f80fd5b8135818111156116e3576116e3611682565b8060051b604051601f19603f8301168101818110858211171561170857611708611682565b604052918252848201925083810185019188831115611725575f80fd5b938501935b8285101561174a5761173b8561160a565b8452938501939285019261172a565b98975050505050505050565b5f60208284031215611766575f80fd5b8135611480816115f3565b5f8060408385031215611782575f80fd5b823561178d816115f3565b9150602083013561179d816115f3565b809150509250929050565b5f602082840312156117b8575f80fd5b5035919050565b634e487b7160e01b5f52601160045260245ffd5b600181815b8085111561180d57815f19048211156117f3576117f36117bf565b8085161561180057918102915b93841c93908002906117d8565b509250929050565b5f8261182357506001610448565b8161182f57505f610448565b8160018114611845576002811461184f5761186b565b6001915050610448565b60ff841115611860576118606117bf565b50506001821b610448565b5060208310610133831016604e8410600b841016171561188e575081810a610448565b61189883836117d3565b805f19048211156118ab576118ab6117bf565b029392505050565b5f61148060ff841683611815565b8082028115828204841417610448576104486117bf565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b5f52603260045260245ffd5b5f60208284031215611931575f80fd5b8151611480816115f3565b5f805f6060848603121561194e575f80fd5b8351925060208401519150604084015190509250925092565b5f60208284031215611977575f80fd5b81518015158114611480575f80fd5b80820180821115610448576104486117bf565b5f600182016119aa576119aa6117bf565b5060010190565b81810381811115610448576104486117bf565b5f60a08201878352602087602085015260a0604085015281875180845260c0860191506020890193505f5b81811015611a145784516001600160a01b0316835293830193918301916001016119ef565b50506001600160a01b03969096166060850152505050608001529392505050565b5f82611a4f57634e487b7160e01b5f52601260045260245ffd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220442bc4a80defc105c68ed57df3abe7296691ef645e4453a4466453de49e3b90d64736f6c63430008170033 | 608060405260043610610134575f3560e01c8063751039fc116100a8578063a9059cbb1161006d578063a9059cbb1461036e578063bf474bed1461038d578063c9567bf9146103a2578063d34628cc146103b6578063dd62ed3e146103d5578063ec1f3f6314610419575f80fd5b8063751039fc146102dc5780637d1db4a5146102f05780638da5cb5b146103055780638f9a55c01461032b57806395d89b4114610340575f80fd5b8063313ce567116100f9578063313ce5671461020d57806331c2d847146102285780633bbac5791461024957806351bc3c851461028057806370a0823114610294578063715018a6146102c8575f80fd5b806306fdde031461013f578063095ea7b3146101885780630faee56f146101b757806318160ddd146101da57806323b872dd146101ee575f80fd5b3661013b57005b5f80fd5b34801561014a575f80fd5b5060408051808201909152600f81526e5472756d7020416c7465722045676f60881b60208201525b60405161017f91906115a7565b60405180910390f35b348015610193575f80fd5b506101a76101a236600461161a565b610438565b604051901515815260200161017f565b3480156101c2575f80fd5b506101cc60115481565b60405190815260200161017f565b3480156101e5575f80fd5b506101cc61044e565b3480156101f9575f80fd5b506101a7610208366004611644565b61046f565b348015610218575f80fd5b506040516009815260200161017f565b348015610233575f80fd5b50610247610242366004611696565b6104d6565b005b348015610254575f80fd5b506101a7610263366004611756565b6001600160a01b03165f9081526004602052604090205460ff1690565b34801561028b575f80fd5b50610247610566565b34801561029f575f80fd5b506101cc6102ae366004611756565b6001600160a01b03165f9081526001602052604090205490565b3480156102d3575f80fd5b506102476105b3565b3480156102e7575f80fd5b50610247610624565b3480156102fb575f80fd5b506101cc600e5481565b348015610310575f80fd5b505f546040516001600160a01b03909116815260200161017f565b348015610336575f80fd5b506101cc600f5481565b34801561034b575f80fd5b506040805180820190915260068152652120a92927a760d11b6020820152610172565b348015610379575f80fd5b506101a761038836600461161a565b6106d8565b348015610398575f80fd5b506101cc60105481565b3480156103ad575f80fd5b506102476106e4565b3480156103c1575f80fd5b506102476103d0366004611696565b610a8e565b3480156103e0575f80fd5b506101cc6103ef366004611771565b6001600160a01b039182165f90815260026020908152604080832093909416825291909152205490565b348015610424575f80fd5b506102476104333660046117a8565b610b12565b5f610444338484610b57565b5060015b92915050565b5f61045b6009600a6118b3565b61046a906461f313f8806118c1565b905090565b5f61047b848484610c7a565b6104cc84336104c785604051806060016040528060288152602001611a55602891396001600160a01b038a165f9081526002602090815260408083203384529091529020549190611223565b610b57565b5060019392505050565b5f546001600160a01b031633146105085760405162461bcd60e51b81526004016104ff906118d8565b60405180910390fd5b5f5b8151811015610562575f60045f8484815181106105295761052961190d565b6020908102919091018101516001600160a01b031682528101919091526040015f20805460ff191691151591909117905560010161050a565b5050565b6005546001600160a01b0316336001600160a01b031614610585575f80fd5b305f9081526001602052604090205480156105a3576105a38161125b565b47801561056257610562816113cb565b5f546001600160a01b031633146105dc5760405162461bcd60e51b81526004016104ff906118d8565b5f80546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a35f80546001600160a01b0319169055565b5f546001600160a01b0316331461064d5760405162461bcd60e51b81526004016104ff906118d8565b6106596009600a6118b3565b610668906461f313f8806118c1565b600e556106776009600a6118b3565b610686906461f313f8806118c1565b600f557f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6106b66009600a6118b3565b6106c5906461f313f8806118c1565b60405190815260200160405180910390a1565b5f610444338484610c7a565b5f546001600160a01b0316331461070d5760405162461bcd60e51b81526004016104ff906118d8565b601354600160a01b900460ff16156107675760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016104ff565b601280546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107b19030906107a26009600a6118b3565b6104c7906461f313f8806118c1565b60125f9054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610801573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108259190611921565b6001600160a01b031663c9c653963060125f9054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610884573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108a89190611921565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303815f875af11580156108f2573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109169190611921565b601380546001600160a01b039283166001600160a01b03199091161790556012541663f305d719473061095d816001600160a01b03165f9081526001602052604090205490565b5f806109705f546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af11580156109d6573d5f803e3d5ffd5b50505050506040513d601f19601f820116820180604052508101906109fb919061193c565b505060135460125460405163095ea7b360e01b81526001600160a01b0391821660048201525f1960248201529116915063095ea7b3906044016020604051808303815f875af1158015610a50573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a749190611967565b506013805462ff00ff60a01b19166201000160a01b179055565b5f546001600160a01b03163314610ab75760405162461bcd60e51b81526004016104ff906118d8565b5f5b815181101561056257600160045f848481518110610ad957610ad961190d565b6020908102919091018101516001600160a01b031682528101919091526040015f20805460ff1916911515919091179055600101610ab9565b6005546001600160a01b0316336001600160a01b031614610b31575f80fd5b6008548111158015610b4557506009548111155b610b4d575f80fd5b6008819055600955565b6001600160a01b038316610bb95760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104ff565b6001600160a01b038216610c1a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104ff565b6001600160a01b038381165f8181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cde5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104ff565b6001600160a01b038216610d405760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104ff565b5f8111610da15760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104ff565b5f80546001600160a01b03858116911614801590610dcc57505f546001600160a01b03848116911614155b156110e6576001600160a01b0384165f9081526004602052604090205460ff16158015610e1157506001600160a01b0383165f9081526004602052604090205460ff16155b610e19575f80fd5b610e456064610e3f600a54600d5411610e3457600654610e38565b6008545b8590611402565b90611487565b6013549091506001600160a01b038581169116148015610e7357506012546001600160a01b03848116911614155b8015610e9757506001600160a01b0383165f9081526003602052604090205460ff16155b15610f7d57600e54821115610eee5760405162461bcd60e51b815260206004820152601960248201527f4578636565647320746865205f6d61785478416d6f756e742e0000000000000060448201526064016104ff565b600f5482610f10856001600160a01b03165f9081526001602052604090205490565b610f1a9190611986565b1115610f685760405162461bcd60e51b815260206004820152601a60248201527f4578636565647320746865206d617857616c6c657453697a652e00000000000060448201526064016104ff565b600d8054905f610f7783611999565b91905055505b6013546001600160a01b038481169116148015610fa357506001600160a01b0384163014155b15610fd057610fcd6064610e3f600b54600d5411610fc357600754610e38565b6009548590611402565b90505b305f90815260016020526040902054601354600160a81b900460ff1615801561100657506013546001600160a01b038581169116145b801561101b5750601354600160b01b900460ff165b8015611028575060105481115b80156110375750600c54600d54115b156110e45760155443111561104b575f6014555b60036014541061109d5760405162461bcd60e51b815260206004820152601760248201527f4f6e6c7920332073656c6c732070657220626c6f636b2100000000000000000060448201526064016104ff565b6110ba6110b5846110b0846011546114c8565b6114c8565b61125b565b4780156110ca576110ca476113cb565b60148054905f6110d983611999565b909155505043601555505b505b801561115e57305f9081526001602052604090205461110590826114dc565b305f81815260016020526040908190209290925590516001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906111559085815260200190565b60405180910390a35b6001600160a01b0384165f90815260016020526040902054611180908361153a565b6001600160a01b0385165f908152600160205260409020556111c36111a5838361153a565b6001600160a01b0385165f90815260016020526040902054906114dc565b6001600160a01b038085165f8181526001602052604090209290925585167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef61120c858561153a565b60405190815260200160405180910390a350505050565b5f81848411156112465760405162461bcd60e51b81526004016104ff91906115a7565b505f61125284866119b1565b95945050505050565b6013805460ff60a81b1916600160a81b1790556040805160028082526060820183525f9260208301908036833701905050905030815f815181106112a1576112a161190d565b6001600160a01b03928316602091820292909201810191909152601254604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156112f8573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061131c9190611921565b8160018151811061132f5761132f61190d565b6001600160a01b0392831660209182029290920101526012546113559130911684610b57565b60125460405163791ac94760e01b81526001600160a01b039091169063791ac9479061138d9085905f908690309042906004016119c4565b5f604051808303815f87803b1580156113a4575f80fd5b505af11580156113b6573d5f803e3d5ffd5b50506013805460ff60a81b1916905550505050565b6005546040516001600160a01b039091169082156108fc029083905f818181858888f19350505050158015610562573d5f803e3d5ffd5b5f825f0361141157505f610448565b5f61141c83856118c1565b9050826114298583611a35565b146114805760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104ff565b9392505050565b5f61148083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061157b565b5f8183116114d65782611480565b50919050565b5f806114e88385611986565b9050838110156114805760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104ff565b5f61148083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611223565b5f818361159b5760405162461bcd60e51b81526004016104ff91906115a7565b505f6112528486611a35565b5f602080835283518060208501525f5b818110156115d3578581018301518582016040015282016115b7565b505f604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b0381168114611607575f80fd5b50565b8035611615816115f3565b919050565b5f806040838503121561162b575f80fd5b8235611636816115f3565b946020939093013593505050565b5f805f60608486031215611656575f80fd5b8335611661816115f3565b92506020840135611671816115f3565b929592945050506040919091013590565b634e487b7160e01b5f52604160045260245ffd5b5f60208083850312156116a7575f80fd5b823567ffffffffffffffff808211156116be575f80fd5b818501915085601f8301126116d1575f80fd5b8135818111156116e3576116e3611682565b8060051b604051601f19603f8301168101818110858211171561170857611708611682565b604052918252848201925083810185019188831115611725575f80fd5b938501935b8285101561174a5761173b8561160a565b8452938501939285019261172a565b98975050505050505050565b5f60208284031215611766575f80fd5b8135611480816115f3565b5f8060408385031215611782575f80fd5b823561178d816115f3565b9150602083013561179d816115f3565b809150509250929050565b5f602082840312156117b8575f80fd5b5035919050565b634e487b7160e01b5f52601160045260245ffd5b600181815b8085111561180d57815f19048211156117f3576117f36117bf565b8085161561180057918102915b93841c93908002906117d8565b509250929050565b5f8261182357506001610448565b8161182f57505f610448565b8160018114611845576002811461184f5761186b565b6001915050610448565b60ff841115611860576118606117bf565b50506001821b610448565b5060208310610133831016604e8410600b841016171561188e575081810a610448565b61189883836117d3565b805f19048211156118ab576118ab6117bf565b029392505050565b5f61148060ff841683611815565b8082028115828204841417610448576104486117bf565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b5f52603260045260245ffd5b5f60208284031215611931575f80fd5b8151611480816115f3565b5f805f6060848603121561194e575f80fd5b8351925060208401519150604084015190509250925092565b5f60208284031215611977575f80fd5b81518015158114611480575f80fd5b80820180821115610448576104486117bf565b5f600182016119aa576119aa6117bf565b5060010190565b81810381811115610448576104486117bf565b5f60a08201878352602087602085015260a0604085015281875180845260c0860191506020890193505f5b81811015611a145784516001600160a01b0316835293830193918301916001016119ef565b50506001600160a01b03969096166060850152505050608001529392505050565b5f82611a4f57634e487b7160e01b5f52601260045260245ffd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220442bc4a80defc105c68ed57df3abe7296691ef645e4453a4466453de49e3b90d64736f6c63430008170033 | // SPDX-License-Identifier: UNLICENSE
/*
Trump Alter Ego - John Barron
Missed Baby Trump - $BARRON ? Don't miss his Dad John Barron
TG: https://t.me/JohnBarronErc
X: https://x.com/johnbarroneth
Website:https://johnbarron.xyz
*/
pragma solidity 0.8.23;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract johnbarron is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
address payable private _taxWallet;
uint256 private _initialBuyTax=19;
uint256 private _initialSellTax=19;
uint256 private _finalBuyTax=0;
uint256 private _finalSellTax=0;
uint256 private _reduceBuyTaxAt=20;
uint256 private _reduceSellTaxAt=20;
uint256 private _preventSwapBefore=25;
uint256 private _buyCount=0;
uint8 private constant _decimals = 9;
uint256 private constant _tTotal = 420690000000 * 10**_decimals;
string private constant _name = unicode"Trump Alter Ego";
string private constant _symbol = unicode"BARRON";
uint256 public _maxTxAmount = 8400000000 * 10**_decimals;
uint256 public _maxWalletSize = 8400000000 * 10**_decimals;
uint256 public _taxSwapThreshold= 4200000000 * 10**_decimals;
uint256 public _maxTaxSwap= 4200000000 * 10**_decimals;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
uint256 private sellCount = 0;
uint256 private lastSellBlock = 0;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_taxWallet = payable(0x77555151E0f6B638d7C4dA7274F96fC04B4ea1C1);
_balances[_msgSender()] = _tTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
uint256 taxAmount=0;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
taxAmount = amount.mul((_buyCount>_reduceBuyTaxAt)?_finalBuyTax:_initialBuyTax).div(100);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] ) {
require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount.");
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
_buyCount++;
}
if(to == uniswapV2Pair && from!= address(this) ){
taxAmount = amount.mul((_buyCount>_reduceSellTaxAt)?_finalSellTax:_initialSellTax).div(100);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && to == uniswapV2Pair && swapEnabled && contractTokenBalance > _taxSwapThreshold && _buyCount > _preventSwapBefore) {
if (block.number > lastSellBlock) {
sellCount = 0;
}
require(sellCount < 3, "Only 3 sells per block!");
swapTokensForEth(min(amount, min(contractTokenBalance, _maxTaxSwap)));
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
sellCount++;
lastSellBlock = block.number;
}
}
if(taxAmount>0){
_balances[address(this)]=_balances[address(this)].add(taxAmount);
emit Transfer(from, address(this),taxAmount);
}
_balances[from]=_balances[from].sub(amount);
_balances[to]=_balances[to].add(amount.sub(taxAmount));
emit Transfer(from, to, amount.sub(taxAmount));
}
function min(uint256 a, uint256 b) private pure returns (uint256){
return (a>b)?b:a;
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function removeLimits() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize=_tTotal;
emit MaxTxAmountUpdated(_tTotal);
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function addBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBots(address[] memory notbot) public onlyOwner {
for (uint i = 0; i < notbot.length; i++) {
bots[notbot[i]] = false;
}
}
function isBot(address a) public view returns (bool){
return bots[a];
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
swapEnabled = true;
tradingOpen = true;
}
function reduceFee(uint256 _newFee) external{
require(_msgSender()==_taxWallet);
require(_newFee<=_finalBuyTax && _newFee<=_finalSellTax);
_finalBuyTax=_newFee;
_finalSellTax=_newFee;
}
receive() external payable {}
function manualSwap() external {
require(_msgSender()==_taxWallet);
uint256 tokenBalance=balanceOf(address(this));
if(tokenBalance>0){
swapTokensForEth(tokenBalance);
}
uint256 ethBalance=address(this).balance;
if(ethBalance>0){
sendETHToFee(ethBalance);
}
}
} |
1 | 20,291,240 | 0817240329f90391c4af55036c70b1c49e1c5bb6fcebbaa734046e05bc7fdf73 | 3a2fd345254cb0f4375c6aa81c39b18517fe79853d2c2458f80e709ba0a5d43b | 16148e9f25a7c2734300076d1c8a4a0d07488476 | 9035c0ba5a4cd5e306771734c5f431491e090717 | 29c7690b0eb8e68c55d07855b8757e27bc9cd0eb | 608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe | ||
1 | 20,291,243 | 0d0aa6621252e18a4541c0c6b22b40b3e76f64bbe0c051c7629334d882b59fcb | 4ac5ccb369b2eedbe0ad36a70a1931bf70318bdb896bb1832c3a241a27171e98 | 3216a2d17ba3b43d9fe6f33222364f1ffdbfd4de | 5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f | 7d78bf59f8f4c2003d788f7dfc435022c121339c | 60806040526001600c5534801561001557600080fd5b506040514690806052612d228239604080519182900360520182208282018252600a8352692ab734b9bbb0b8102b1960b11b6020938401528151808301835260018152603160f81b908401528151808401919091527fbfcc8ef98ffbf7b6c3fec7bf5185b566b9863e35a9d83acd49ad6824b5969738818301527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606082015260808101949094523060a0808601919091528151808603909101815260c09094019052825192019190912060035550600580546001600160a01b03191633179055612c1d806101056000396000f3fe608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429 | 608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032 | // File: contracts/interfaces/IUniswapV2Pair.sol
pragma solidity >=0.5.0;
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
// File: contracts/interfaces/IUniswapV2ERC20.sol
pragma solidity >=0.5.0;
interface IUniswapV2ERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
}
// File: contracts/libraries/SafeMath.sol
pragma solidity =0.5.16;
// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)
library SafeMath {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x, 'ds-math-add-overflow');
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x, 'ds-math-sub-underflow');
}
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');
}
}
// File: contracts/UniswapV2ERC20.sol
pragma solidity =0.5.16;
contract UniswapV2ERC20 is IUniswapV2ERC20 {
using SafeMath for uint;
string public constant name = 'Uniswap V2';
string public constant symbol = 'UNI-V2';
uint8 public constant decimals = 18;
uint public totalSupply;
mapping(address => uint) public balanceOf;
mapping(address => mapping(address => uint)) public allowance;
bytes32 public DOMAIN_SEPARATOR;
// keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
mapping(address => uint) public nonces;
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
constructor() public {
uint chainId;
assembly {
chainId := chainid
}
DOMAIN_SEPARATOR = keccak256(
abi.encode(
keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),
keccak256(bytes(name)),
keccak256(bytes('1')),
chainId,
address(this)
)
);
}
function _mint(address to, uint value) internal {
totalSupply = totalSupply.add(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(address(0), to, value);
}
function _burn(address from, uint value) internal {
balanceOf[from] = balanceOf[from].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(from, address(0), value);
}
function _approve(address owner, address spender, uint value) private {
allowance[owner][spender] = value;
emit Approval(owner, spender, value);
}
function _transfer(address from, address to, uint value) private {
balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function approve(address spender, uint value) external returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transfer(address to, uint value) external returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function transferFrom(address from, address to, uint value) external returns (bool) {
if (allowance[from][msg.sender] != uint(-1)) {
allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
}
_transfer(from, to, value);
return true;
}
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
require(deadline >= block.timestamp, 'UniswapV2: EXPIRED');
bytes32 digest = keccak256(
abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE');
_approve(owner, spender, value);
}
}
// File: contracts/libraries/Math.sol
pragma solidity =0.5.16;
// a library for performing various math operations
library Math {
function min(uint x, uint y) internal pure returns (uint z) {
z = x < y ? x : y;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
z = y;
uint x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}
// File: contracts/libraries/UQ112x112.sol
pragma solidity =0.5.16;
// a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))
// range: [0, 2**112 - 1]
// resolution: 1 / 2**112
library UQ112x112 {
uint224 constant Q112 = 2**112;
// encode a uint112 as a UQ112x112
function encode(uint112 y) internal pure returns (uint224 z) {
z = uint224(y) * Q112; // never overflows
}
// divide a UQ112x112 by a uint112, returning a UQ112x112
function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) {
z = x / uint224(y);
}
}
// File: contracts/interfaces/IERC20.sol
pragma solidity >=0.5.0;
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
}
// File: contracts/interfaces/IUniswapV2Factory.sol
pragma solidity >=0.5.0;
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
// File: contracts/interfaces/IUniswapV2Callee.sol
pragma solidity >=0.5.0;
interface IUniswapV2Callee {
function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external;
}
// File: contracts/UniswapV2Pair.sol
pragma solidity =0.5.16;
contract UniswapV2Pair is IUniswapV2Pair, UniswapV2ERC20 {
using SafeMath for uint;
using UQ112x112 for uint224;
uint public constant MINIMUM_LIQUIDITY = 10**3;
bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)')));
address public factory;
address public token0;
address public token1;
uint112 private reserve0; // uses single storage slot, accessible via getReserves
uint112 private reserve1; // uses single storage slot, accessible via getReserves
uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves
uint public price0CumulativeLast;
uint public price1CumulativeLast;
uint public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event
uint private unlocked = 1;
modifier lock() {
require(unlocked == 1, 'UniswapV2: LOCKED');
unlocked = 0;
_;
unlocked = 1;
}
function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) {
_reserve0 = reserve0;
_reserve1 = reserve1;
_blockTimestampLast = blockTimestampLast;
}
function _safeTransfer(address token, address to, uint value) private {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'UniswapV2: TRANSFER_FAILED');
}
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
constructor() public {
factory = msg.sender;
}
// called once by the factory at time of deployment
function initialize(address _token0, address _token1) external {
require(msg.sender == factory, 'UniswapV2: FORBIDDEN'); // sufficient check
token0 = _token0;
token1 = _token1;
}
// update reserves and, on the first call per block, price accumulators
function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private {
require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'UniswapV2: OVERFLOW');
uint32 blockTimestamp = uint32(block.timestamp % 2**32);
uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired
if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) {
// * never overflows, and + overflow is desired
price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed;
price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed;
}
reserve0 = uint112(balance0);
reserve1 = uint112(balance1);
blockTimestampLast = blockTimestamp;
emit Sync(reserve0, reserve1);
}
// if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k)
function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {
address feeTo = IUniswapV2Factory(factory).feeTo();
feeOn = feeTo != address(0);
uint _kLast = kLast; // gas savings
if (feeOn) {
if (_kLast != 0) {
uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1));
uint rootKLast = Math.sqrt(_kLast);
if (rootK > rootKLast) {
uint numerator = totalSupply.mul(rootK.sub(rootKLast));
uint denominator = rootK.mul(5).add(rootKLast);
uint liquidity = numerator / denominator;
if (liquidity > 0) _mint(feeTo, liquidity);
}
}
} else if (_kLast != 0) {
kLast = 0;
}
}
// this low-level function should be called from a contract which performs important safety checks
function mint(address to) external lock returns (uint liquidity) {
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
uint balance0 = IERC20(token0).balanceOf(address(this));
uint balance1 = IERC20(token1).balanceOf(address(this));
uint amount0 = balance0.sub(_reserve0);
uint amount1 = balance1.sub(_reserve1);
bool feeOn = _mintFee(_reserve0, _reserve1);
uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
if (_totalSupply == 0) {
liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY);
_mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens
} else {
liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1);
}
require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED');
_mint(to, liquidity);
_update(balance0, balance1, _reserve0, _reserve1);
if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
emit Mint(msg.sender, amount0, amount1);
}
// this low-level function should be called from a contract which performs important safety checks
function burn(address to) external lock returns (uint amount0, uint amount1) {
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
address _token0 = token0; // gas savings
address _token1 = token1; // gas savings
uint balance0 = IERC20(_token0).balanceOf(address(this));
uint balance1 = IERC20(_token1).balanceOf(address(this));
uint liquidity = balanceOf[address(this)];
bool feeOn = _mintFee(_reserve0, _reserve1);
uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution
amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution
require(amount0 > 0 && amount1 > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED');
_burn(address(this), liquidity);
_safeTransfer(_token0, to, amount0);
_safeTransfer(_token1, to, amount1);
balance0 = IERC20(_token0).balanceOf(address(this));
balance1 = IERC20(_token1).balanceOf(address(this));
_update(balance0, balance1, _reserve0, _reserve1);
if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
emit Burn(msg.sender, amount0, amount1, to);
}
// this low-level function should be called from a contract which performs important safety checks
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock {
require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT');
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
require(amount0Out < _reserve0 && amount1Out < _reserve1, 'UniswapV2: INSUFFICIENT_LIQUIDITY');
uint balance0;
uint balance1;
{ // scope for _token{0,1}, avoids stack too deep errors
address _token0 = token0;
address _token1 = token1;
require(to != _token0 && to != _token1, 'UniswapV2: INVALID_TO');
if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens
if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens
if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data);
balance0 = IERC20(_token0).balanceOf(address(this));
balance1 = IERC20(_token1).balanceOf(address(this));
}
uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0;
uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0;
require(amount0In > 0 || amount1In > 0, 'UniswapV2: INSUFFICIENT_INPUT_AMOUNT');
{ // scope for reserve{0,1}Adjusted, avoids stack too deep errors
uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3));
uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3));
require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'UniswapV2: K');
}
_update(balance0, balance1, _reserve0, _reserve1);
emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to);
}
// force balances to match reserves
function skim(address to) external lock {
address _token0 = token0; // gas savings
address _token1 = token1; // gas savings
_safeTransfer(_token0, to, IERC20(_token0).balanceOf(address(this)).sub(reserve0));
_safeTransfer(_token1, to, IERC20(_token1).balanceOf(address(this)).sub(reserve1));
}
// force reserves to match balances
function sync() external lock {
_update(IERC20(token0).balanceOf(address(this)), IERC20(token1).balanceOf(address(this)), reserve0, reserve1);
}
} |
1 | 20,291,243 | 0d0aa6621252e18a4541c0c6b22b40b3e76f64bbe0c051c7629334d882b59fcb | d384cb91f7cf612212e1bd2e831cab64642006c9cdd26e328631b779ae156844 | 65c38d28344d8e3ede6369c2371aaaa4ef6be082 | 5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f | 30e65baeadb277c7fa2c50ff3270e7559ee25392 | 60806040526001600c5534801561001557600080fd5b506040514690806052612d228239604080519182900360520182208282018252600a8352692ab734b9bbb0b8102b1960b11b6020938401528151808301835260018152603160f81b908401528151808401919091527fbfcc8ef98ffbf7b6c3fec7bf5185b566b9863e35a9d83acd49ad6824b5969738818301527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606082015260808101949094523060a0808601919091528151808603909101815260c09094019052825192019190912060035550600580546001600160a01b03191633179055612c1d806101056000396000f3fe608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429 | 608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032 | // File: contracts/interfaces/IUniswapV2Pair.sol
pragma solidity >=0.5.0;
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
// File: contracts/interfaces/IUniswapV2ERC20.sol
pragma solidity >=0.5.0;
interface IUniswapV2ERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
}
// File: contracts/libraries/SafeMath.sol
pragma solidity =0.5.16;
// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)
library SafeMath {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x, 'ds-math-add-overflow');
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x, 'ds-math-sub-underflow');
}
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');
}
}
// File: contracts/UniswapV2ERC20.sol
pragma solidity =0.5.16;
contract UniswapV2ERC20 is IUniswapV2ERC20 {
using SafeMath for uint;
string public constant name = 'Uniswap V2';
string public constant symbol = 'UNI-V2';
uint8 public constant decimals = 18;
uint public totalSupply;
mapping(address => uint) public balanceOf;
mapping(address => mapping(address => uint)) public allowance;
bytes32 public DOMAIN_SEPARATOR;
// keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
mapping(address => uint) public nonces;
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
constructor() public {
uint chainId;
assembly {
chainId := chainid
}
DOMAIN_SEPARATOR = keccak256(
abi.encode(
keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),
keccak256(bytes(name)),
keccak256(bytes('1')),
chainId,
address(this)
)
);
}
function _mint(address to, uint value) internal {
totalSupply = totalSupply.add(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(address(0), to, value);
}
function _burn(address from, uint value) internal {
balanceOf[from] = balanceOf[from].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(from, address(0), value);
}
function _approve(address owner, address spender, uint value) private {
allowance[owner][spender] = value;
emit Approval(owner, spender, value);
}
function _transfer(address from, address to, uint value) private {
balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function approve(address spender, uint value) external returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transfer(address to, uint value) external returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function transferFrom(address from, address to, uint value) external returns (bool) {
if (allowance[from][msg.sender] != uint(-1)) {
allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
}
_transfer(from, to, value);
return true;
}
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
require(deadline >= block.timestamp, 'UniswapV2: EXPIRED');
bytes32 digest = keccak256(
abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE');
_approve(owner, spender, value);
}
}
// File: contracts/libraries/Math.sol
pragma solidity =0.5.16;
// a library for performing various math operations
library Math {
function min(uint x, uint y) internal pure returns (uint z) {
z = x < y ? x : y;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
z = y;
uint x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}
// File: contracts/libraries/UQ112x112.sol
pragma solidity =0.5.16;
// a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))
// range: [0, 2**112 - 1]
// resolution: 1 / 2**112
library UQ112x112 {
uint224 constant Q112 = 2**112;
// encode a uint112 as a UQ112x112
function encode(uint112 y) internal pure returns (uint224 z) {
z = uint224(y) * Q112; // never overflows
}
// divide a UQ112x112 by a uint112, returning a UQ112x112
function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) {
z = x / uint224(y);
}
}
// File: contracts/interfaces/IERC20.sol
pragma solidity >=0.5.0;
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
}
// File: contracts/interfaces/IUniswapV2Factory.sol
pragma solidity >=0.5.0;
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
// File: contracts/interfaces/IUniswapV2Callee.sol
pragma solidity >=0.5.0;
interface IUniswapV2Callee {
function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external;
}
// File: contracts/UniswapV2Pair.sol
pragma solidity =0.5.16;
contract UniswapV2Pair is IUniswapV2Pair, UniswapV2ERC20 {
using SafeMath for uint;
using UQ112x112 for uint224;
uint public constant MINIMUM_LIQUIDITY = 10**3;
bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)')));
address public factory;
address public token0;
address public token1;
uint112 private reserve0; // uses single storage slot, accessible via getReserves
uint112 private reserve1; // uses single storage slot, accessible via getReserves
uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves
uint public price0CumulativeLast;
uint public price1CumulativeLast;
uint public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event
uint private unlocked = 1;
modifier lock() {
require(unlocked == 1, 'UniswapV2: LOCKED');
unlocked = 0;
_;
unlocked = 1;
}
function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) {
_reserve0 = reserve0;
_reserve1 = reserve1;
_blockTimestampLast = blockTimestampLast;
}
function _safeTransfer(address token, address to, uint value) private {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'UniswapV2: TRANSFER_FAILED');
}
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
constructor() public {
factory = msg.sender;
}
// called once by the factory at time of deployment
function initialize(address _token0, address _token1) external {
require(msg.sender == factory, 'UniswapV2: FORBIDDEN'); // sufficient check
token0 = _token0;
token1 = _token1;
}
// update reserves and, on the first call per block, price accumulators
function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private {
require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'UniswapV2: OVERFLOW');
uint32 blockTimestamp = uint32(block.timestamp % 2**32);
uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired
if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) {
// * never overflows, and + overflow is desired
price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed;
price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed;
}
reserve0 = uint112(balance0);
reserve1 = uint112(balance1);
blockTimestampLast = blockTimestamp;
emit Sync(reserve0, reserve1);
}
// if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k)
function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {
address feeTo = IUniswapV2Factory(factory).feeTo();
feeOn = feeTo != address(0);
uint _kLast = kLast; // gas savings
if (feeOn) {
if (_kLast != 0) {
uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1));
uint rootKLast = Math.sqrt(_kLast);
if (rootK > rootKLast) {
uint numerator = totalSupply.mul(rootK.sub(rootKLast));
uint denominator = rootK.mul(5).add(rootKLast);
uint liquidity = numerator / denominator;
if (liquidity > 0) _mint(feeTo, liquidity);
}
}
} else if (_kLast != 0) {
kLast = 0;
}
}
// this low-level function should be called from a contract which performs important safety checks
function mint(address to) external lock returns (uint liquidity) {
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
uint balance0 = IERC20(token0).balanceOf(address(this));
uint balance1 = IERC20(token1).balanceOf(address(this));
uint amount0 = balance0.sub(_reserve0);
uint amount1 = balance1.sub(_reserve1);
bool feeOn = _mintFee(_reserve0, _reserve1);
uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
if (_totalSupply == 0) {
liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY);
_mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens
} else {
liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1);
}
require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED');
_mint(to, liquidity);
_update(balance0, balance1, _reserve0, _reserve1);
if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
emit Mint(msg.sender, amount0, amount1);
}
// this low-level function should be called from a contract which performs important safety checks
function burn(address to) external lock returns (uint amount0, uint amount1) {
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
address _token0 = token0; // gas savings
address _token1 = token1; // gas savings
uint balance0 = IERC20(_token0).balanceOf(address(this));
uint balance1 = IERC20(_token1).balanceOf(address(this));
uint liquidity = balanceOf[address(this)];
bool feeOn = _mintFee(_reserve0, _reserve1);
uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution
amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution
require(amount0 > 0 && amount1 > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED');
_burn(address(this), liquidity);
_safeTransfer(_token0, to, amount0);
_safeTransfer(_token1, to, amount1);
balance0 = IERC20(_token0).balanceOf(address(this));
balance1 = IERC20(_token1).balanceOf(address(this));
_update(balance0, balance1, _reserve0, _reserve1);
if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
emit Burn(msg.sender, amount0, amount1, to);
}
// this low-level function should be called from a contract which performs important safety checks
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock {
require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT');
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
require(amount0Out < _reserve0 && amount1Out < _reserve1, 'UniswapV2: INSUFFICIENT_LIQUIDITY');
uint balance0;
uint balance1;
{ // scope for _token{0,1}, avoids stack too deep errors
address _token0 = token0;
address _token1 = token1;
require(to != _token0 && to != _token1, 'UniswapV2: INVALID_TO');
if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens
if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens
if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data);
balance0 = IERC20(_token0).balanceOf(address(this));
balance1 = IERC20(_token1).balanceOf(address(this));
}
uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0;
uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0;
require(amount0In > 0 || amount1In > 0, 'UniswapV2: INSUFFICIENT_INPUT_AMOUNT');
{ // scope for reserve{0,1}Adjusted, avoids stack too deep errors
uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3));
uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3));
require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'UniswapV2: K');
}
_update(balance0, balance1, _reserve0, _reserve1);
emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to);
}
// force balances to match reserves
function skim(address to) external lock {
address _token0 = token0; // gas savings
address _token1 = token1; // gas savings
_safeTransfer(_token0, to, IERC20(_token0).balanceOf(address(this)).sub(reserve0));
_safeTransfer(_token1, to, IERC20(_token1).balanceOf(address(this)).sub(reserve1));
}
// force reserves to match balances
function sync() external lock {
_update(IERC20(token0).balanceOf(address(this)), IERC20(token1).balanceOf(address(this)), reserve0, reserve1);
}
} |
1 | 20,291,250 | 80fb4730eea39fafea1c51a62ab233b8fbcbc7ee7dd32f7cd7d478151e833101 | 0ac4df1052cd43a285119a8586dfc72b661b2776131eaae44057165c988685ce | e90e278116574589fe37634739db2fbfcba4b2a2 | e90e278116574589fe37634739db2fbfcba4b2a2 | 3edf914c653dea46967b01d27758163dcc9e2032 | 60806040526611c37937e080006004553480156019575f80fd5b503380603e57604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b604581605c565b50600180546001600160a01b0319163317905560ab565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b614f81806100b85f395ff3fe6080604052600436106100a5575f3560e01c80637854ed12116100625780637854ed121461017f5780637d707aad1461019e5780638da5cb5b146101bd5780639ee67e10146101d9578063f2fde38b14610210578063f73aed201461022f575f80fd5b8063090e5465146100a95780631bec5b7a146100d15780632f03012e146100fc57806331b221cd146101235780635cd046d11461014a578063715018a614610169575b5f80fd5b3480156100b4575f80fd5b506100be60045481565b6040519081526020015b60405180910390f35b6100e46100df3660046105db565b61024e565b6040516001600160a01b0390911681526020016100c8565b348015610107575f80fd5b506100e473c3287bdef03b925a7c7f54791edadcd88e632ccd81565b34801561012e575f80fd5b506100e4730a0f4321214bb6c7811dd8a71cf587bdaf03f0a081565b348015610155575f80fd5b506001546100e4906001600160a01b031681565b348015610174575f80fd5b5061017d61043f565b005b34801561018a575f80fd5b5061017d61019936600461067a565b610452565b3480156101a9575f80fd5b5061017d6101b83660046106ac565b61045f565b3480156101c8575f80fd5b505f546001600160a01b03166100e4565b3480156101e4575f80fd5b506100be6101f336600461076b565b805160208183018101805160038252928201919093012091525481565b34801561021b575f80fd5b5061017d61022a3660046106ac565b610489565b34801561023a575f80fd5b506100e46102493660046107a5565b6104c6565b5f60045434101561029b5760405162461bcd60e51b8152602060048201526012602482015271496e73756666696369656e742066756e647360701b60448201526064015b60405180910390fd5b5f8787878787876040516102ae90610586565b6102bd96959493929190610885565b604051809103905ff0801580156102d6573d5f803e3d5ffd5b5090506002888860048181106102ee576102ee610950565b90506020028101906103009190610964565b60405161030e9291906109a7565b908152604051602091819003820190208054600180820183555f928352929091200180546001600160a01b0319166001600160a01b03841617905560038989600481811061035e5761035e610950565b90506020028101906103709190610964565b60405161037e9291906109a7565b90815260200160405180910390205f82825461039a91906109b6565b90915550506001546040516001600160a01b03909116903480156108fc02915f818181858888f193505050501580156103d5573d5f803e3d5ffd5b507f986b269bc298e243448f506d0cf973af56bf7b2d5c2b37841394d10d236eb826338989600481811061040b5761040b610950565b905060200281019061041d9190610964565b60405161042c939291906109db565b60405180910390a1979650505050505050565b61044761050b565b6104505f610537565b565b61045a61050b565b600455565b61046761050b565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b61049161050b565b6001600160a01b0381166104ba57604051631e4fbdf760e01b81525f6004820152602401610292565b6104c381610537565b50565b815160208184018101805160028252928201918501919091209190528054829081106104f0575f80fd5b5f918252602090912001546001600160a01b03169150829050565b5f546001600160a01b031633146104505760405163118cdaa760e01b8152336004820152602401610292565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61454380610a0983390190565b5f8083601f8401126105a3575f80fd5b50813567ffffffffffffffff8111156105ba575f80fd5b6020830191508360208260051b85010111156105d4575f80fd5b9250929050565b5f805f805f80606087890312156105f0575f80fd5b863567ffffffffffffffff811115610606575f80fd5b61061289828a01610593565b909750955050602087013567ffffffffffffffff811115610631575f80fd5b61063d89828a01610593565b909550935050604087013567ffffffffffffffff81111561065c575f80fd5b61066889828a01610593565b979a9699509497509295939492505050565b5f6020828403121561068a575f80fd5b5035919050565b80356001600160a01b03811681146106a7575f80fd5b919050565b5f602082840312156106bc575f80fd5b6106c582610691565b9392505050565b634e487b7160e01b5f52604160045260245ffd5b5f82601f8301126106ef575f80fd5b813567ffffffffffffffff811115610709576107096106cc565b604051601f8201601f19908116603f0116810167ffffffffffffffff81118282101715610738576107386106cc565b60405281815283820160200185101561074f575f80fd5b816020850160208301375f918101602001919091529392505050565b5f6020828403121561077b575f80fd5b813567ffffffffffffffff811115610791575f80fd5b61079d848285016106e0565b949350505050565b5f80604083850312156107b6575f80fd5b823567ffffffffffffffff8111156107cc575f80fd5b6107d8858286016106e0565b95602094909401359450505050565b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b8183525f6001600160fb1b03831115610826575f80fd5b8260051b80836020870137939093016020019392505050565b8183526020830192505f815f5b8481101561087b576001600160a01b0361086583610691565b168652602095860195919091019060010161084c565b5093949350505050565b606080825281018690525f6080600588901b830181019083018983601e1936839003015b8b82101561091757868503607f1901845282358181126108c7575f80fd5b8d0160208101903567ffffffffffffffff8111156108e3575f80fd5b8036038213156108f1575f80fd5b6108fc8782846107e7565b965050506020830192506020840193506001820191506108a9565b50505050828103602084015261092e81878961080f565b9050828103604084015261094381858761083f565b9998505050505050505050565b634e487b7160e01b5f52603260045260245ffd5b5f808335601e19843603018112610979575f80fd5b83018035915067ffffffffffffffff821115610993575f80fd5b6020019150368190038213156105d4575f80fd5b818382375f9101908152919050565b808201808211156109d557634e487b7160e01b5f52601160045260245ffd5b92915050565b6001600160a01b03841681526040602082018190525f906109ff90830184866107e7565b9594505050505056fe60a060405260118054600160a01b600160e01b031916613d0960a51b179055348015610029575f80fd5b5060405161454338038061454383398101604081905261004891610445565b825f8151811061005a5761005a6105a8565b602002602001015183600181518110610075576100756105a8565b6020026020010151825f8151811061008f5761008f6105a8565b6020908102919091010151730a0f4321214bb6c7811dd8a71cf587bdaf03f0a06080526001600160a01b0381166100df57604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b6100e8816102b7565b5060016100f58382610640565b5060026101028282610640565b505050815f81518110610117576101176105a8565b6020026020010151600781905550805f81518110610137576101376105a8565b602002602001015160105f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555080600181518110610177576101776105a8565b602002602001015160115f6101000a8154816001600160a01b0302191690836001600160a01b03160217905550826002815181106101b7576101b76105a8565b6020026020010151600c90816101cd9190610640565b50826003815181106101e1576101e16105a8565b6020026020010151600d90816101f79190610640565b508260048151811061020b5761020b6105a8565b6020026020010151600e90816102219190610640565b5081600181518110610235576102356105a8565b6020026020010151600b8190555081600281518110610256576102566105a8565b602002602001015160098190555081600381518110610277576102776105a8565b6020026020010151600a8190555082600581518110610298576102986105a8565b6020026020010151600f90816102ae9190610640565b505050506106fa565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b038111828210171561034257610342610306565b604052919050565b5f6001600160401b0382111561036257610362610306565b5060051b60200190565b5f82601f83011261037b575f80fd5b815161038e6103898261034a565b61031a565b8082825260208201915060208360051b8601019250858311156103af575f80fd5b602085015b838110156103cc5780518352602092830192016103b4565b5095945050505050565b5f82601f8301126103e5575f80fd5b81516103f36103898261034a565b8082825260208201915060208360051b860101925085831115610414575f80fd5b602085015b838110156103cc5780516001600160a01b0381168114610437575f80fd5b835260209283019201610419565b5f805f60608486031215610457575f80fd5b83516001600160401b0381111561046c575f80fd5b8401601f8101861361047c575f80fd5b805161048a6103898261034a565b8082825260208201915060208360051b8501019250888311156104ab575f80fd5b602084015b838110156105495780516001600160401b038111156104cd575f80fd5b8501603f81018b136104dd575f80fd5b60208101516001600160401b038111156104f9576104f9610306565b61050c601f8201601f191660200161031a565b8181526040838301018d1015610520575f80fd5b8160408401602083015e5f602083830101528086525050506020830192506020810190506104b0565b506020880151909650925050506001600160401b03811115610569575f80fd5b6105758682870161036c565b604086015190935090506001600160401b03811115610592575f80fd5b61059e868287016103d6565b9150509250925092565b634e487b7160e01b5f52603260045260245ffd5b600181811c908216806105d057607f821691505b6020821081036105ee57634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111561063b57805f5260205f20601f840160051c810160208510156106195750805b601f840160051c820191505b81811015610638575f8155600101610625565b50505b505050565b81516001600160401b0381111561065957610659610306565b61066d8161066784546105bc565b846105f4565b6020601f82116001811461069f575f83156106885750848201515b5f19600385901b1c1916600184901b178455610638565b5f84815260208120601f198516915b828110156106ce57878501518255602094850194600190920191016106ae565b50848210156106eb57868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b608051613e0e6107355f395f81816104ed01528181610cdd01528181611ac401528181611b0101528181611ca801526122470152613e0e5ff3fe60806040526004361061035b575f3560e01c806370a08231116101bd578063b0347814116100f2578063de8f50a111610092578063ebd7edaf1161006d578063ebd7edaf146109a5578063ec3e5f45146109b9578063eda47704146109f7578063f2fde38b14610a16575f80fd5b8063de8f50a114610948578063e0be9bf914610967578063e985e9c514610986575f80fd5b8063b88d4fde116100cd578063b88d4fde146108e2578063c1d88c4414610901578063c745e3ff14610915578063c87b56dd14610929575f80fd5b8063b03478141461089a578063b0f7a3ff146108b9578063b7b6ccd5146108ce575f80fd5b80638da5cb5b1161015d578063a1a0e7fc11610138578063a1a0e7fc14610812578063a22cb46514610831578063ad72e1a514610850578063aea305071461087b575f80fd5b80638da5cb5b146107cf57806395d89b41146107eb5780639ee74dd1146107ff575f80fd5b80637df04787116101985780637df047871461073557806381d12c581461076c5780638500a45d1461079b5780638cbc52d9146107b0575f80fd5b806370a08231146106e3578063715018a61461070257806378564b7414610716575f80fd5b80633ccfd60b1161029357806358fd416d11610233578063628ae0a31161020e578063628ae0a3146106875780636352211e1461069b5780636817c76c146106ba578063702de1e3146106cf575f80fd5b806358fd416d146106235780635bb4688d146106425780635cec1b7614610672575f80fd5b8063414f11451161026e578063414f11451461059f57806342842e0e146105be5780634c34e4dc146105dd5780634ca0ce4c146105fc575f80fd5b80633ccfd60b1461054d5780633f37dce2146105615780633f3e4c1114610580575f80fd5b80632ab4d052116102fe5780632f03012e116102d95780632f03012e146104b557806331b221cd146104dc57806333727c4d1461050f5780633c1c8e491461052e575f80fd5b80632ab4d052146104625780632cfb2080146104775780632ddfb80714610496575f80fd5b8063095ea7b311610339578063095ea7b3146103eb578063122d1bad1461040c57806318160ddd1461042057806323b872dd14610443575f80fd5b806301ffc9a71461035f57806306fdde0314610393578063081812fc146103b4575b5f80fd5b34801561036a575f80fd5b5061037e610379366004612ba2565b610a35565b60405190151581526020015b60405180910390f35b34801561039e575f80fd5b506103a7610a86565b60405161038a9190612bf2565b3480156103bf575f80fd5b506103d36103ce366004612c04565b610b16565b6040516001600160a01b03909116815260200161038a565b3480156103f6575f80fd5b5061040a610405366004612c31565b610b3d565b005b348015610417575f80fd5b506103a7610b4c565b34801561042b575f80fd5b5061043560085481565b60405190815260200161038a565b34801561044e575f80fd5b5061040a61045d366004612c59565b610bd8565b34801561046d575f80fd5b50610435600b5481565b348015610482575f80fd5b5061040a610491366004612c93565b610c66565b3480156104a1575f80fd5b5061040a6104b0366004612cb9565b610c9b565b3480156104c0575f80fd5b506103d373c3287bdef03b925a7c7f54791edadcd88e632ccd81565b3480156104e7575f80fd5b506103d37f000000000000000000000000000000000000000000000000000000000000000081565b34801561051a575f80fd5b5061037e610529366004612c04565b610cc5565b348015610539575f80fd5b506103a7610548366004612d90565b610d4e565b348015610558575f80fd5b5061040a610d7c565b34801561056c575f80fd5b5061040a61057b366004612e15565b610d90565b34801561058b575f80fd5b5061040a61059a366004612c04565b610e6c565b3480156105aa575f80fd5b5061040a6105b9366004612e7f565b610e79565b3480156105c9575f80fd5b5061040a6105d8366004612c59565b610e93565b3480156105e8575f80fd5b506011546103d3906001600160a01b031681565b348015610607575f80fd5b506103d3730a0f4321214bb6c7811dd8a71cf587bdaf03f0a081565b34801561062e575f80fd5b506103a761063d366004612c04565b610ead565b34801561064d575f80fd5b5061066161065c366004612c04565b6110ef565b60405161038a959493929190612ebd565b34801561067d575f80fd5b50610435600a5481565b348015610692575f80fd5b506103a76112b8565b3480156106a6575f80fd5b506103d36106b5366004612c04565b6112c5565b3480156106c5575f80fd5b5061043560075481565b3480156106da575f80fd5b506104356112cf565b3480156106ee575f80fd5b506104356106fd366004612cb9565b6112ea565b34801561070d575f80fd5b5061040a61132f565b348015610721575f80fd5b5061040a610730366004612e7f565b611340565b348015610740575f80fd5b5061043561074f366004612f18565b805160208183018101805160148252928201919093012091525481565b348015610777575f80fd5b5061078b610786366004612c04565b611355565b60405161038a9493929190612f49565b3480156107a6575f80fd5b5061043560095481565b3480156107bb575f80fd5b506103a76107ca366004612f8c565b611493565b3480156107da575f80fd5b505f546001600160a01b03166103d3565b3480156107f6575f80fd5b506103a76114c7565b61043561080d366004612fcf565b6114d6565b34801561081d575f80fd5b5061040a61082c366004612e7f565b61194a565b34801561083c575f80fd5b5061040a61084b36600461308f565b61195f565b34801561085b575f80fd5b5061043561086a366004612c04565b60166020525f908152604090205481565b348015610886575f80fd5b5061040a6108953660046130c4565b61196a565b3480156108a5575f80fd5b5061040a6108b4366004613169565b611ab9565b3480156108c4575f80fd5b50610435611b5f81565b3480156108d9575f80fd5b5061040a611c3f565b3480156108ed575f80fd5b5061040a6108fc3660046131e0565b611c60565b34801561090c575f80fd5b50610435611c77565b348015610920575f80fd5b506103a7611d18565b348015610934575f80fd5b506103a7610943366004612c04565b611d25565b348015610953575f80fd5b5061037e610962366004613243565b611dd4565b348015610972575f80fd5b506010546103d3906001600160a01b031681565b348015610991575f80fd5b5061037e6109a03660046132df565b611f39565b3480156109b0575f80fd5b506103a7611f66565b3480156109c4575f80fd5b506011546109df90600160a01b90046001600160401b031681565b6040516001600160401b03909116815260200161038a565b348015610a02575f80fd5b5061040a610a11366004612cb9565b611f73565b348015610a21575f80fd5b5061040a610a30366004612cb9565b611f9d565b5f6001600160e01b031982166380ac58cd60e01b1480610a6557506001600160e01b03198216635b5e139f60e01b145b80610a8057506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060018054610a9590613310565b80601f0160208091040260200160405190810160405280929190818152602001828054610ac190613310565b8015610b0c5780601f10610ae357610100808354040283529160200191610b0c565b820191905f5260205f20905b815481529060010190602001808311610aef57829003601f168201915b5050505050905090565b5f610b2082611fda565b505f828152600560205260409020546001600160a01b0316610a80565b610b48828233612012565b5050565b600f8054610b5990613310565b80601f0160208091040260200160405190810160405280929190818152602001828054610b8590613310565b8015610bd05780601f10610ba757610100808354040283529160200191610bd0565b820191905f5260205f20905b815481529060010190602001808311610bb357829003601f168201915b505050505081565b6001600160a01b038216610c0657604051633250574960e11b81525f60048201526024015b60405180910390fd5b5f610c1283833361201f565b9050836001600160a01b0316816001600160a01b031614610c60576040516364283d7b60e01b81526001600160a01b0380861660048301526024820184905282166044820152606401610bfd565b50505050565b610c6e612111565b601180546001600160401b03909216600160a01b0267ffffffffffffffff60a01b19909216919091179055565b610ca3612111565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b6040516333727c4d60e01b8152600481018290525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906333727c4d90602401602060405180830381865afa158015610d2a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a809190613348565b60605f8284604051602001610d6492919061337a565b60408051808303601f19018152919052949350505050565b610d84612111565b610d8e334761213d565b565b610d9e848484848888611dd4565b610dea5760405162461bcd60e51b815260206004820152601960248201527f455243373030373a20696e76616c6964206169676344617461000000000000006044820152606401610bfd565b5f60148585604051610dfd92919061338b565b908152604051908190036020018120549150610e1c908490849061338b565b60405180910390208585604051610e3492919061338b565b6040519081900381209083907fd77aab0eeab3a3cbdac072fcdbc34709b18d6c4af91f7869c71cbbb13d71a6b9905f90a45050505050565b610e74612111565b600b55565b610e81612111565b600e610e8e8284836133de565b505050565b610e8e83838360405180602001604052805f815250611c60565b5f8181526012602052604081206003015460609103610fc2575f8281526012602090815260409182902091517f8a69103ba0d209dc3c31e69b5d27cf5e0a41cf4406a51893d159eda72d2361e392610f0c929091600183019101613505565b60408051601f1981840301815290829052610f269161352f565b90815260200160405180910390208054610f3f90613310565b80601f0160208091040260200160405190810160405280929190818152602001828054610f6b90613310565b8015610fb65780601f10610f8d57610100808354040283529160200191610fb6565b820191905f5260205f20905b815481529060010190602001808311610f9957829003601f168201915b50505050509050919050565b5f828152601260209081526040808320600381015491519192610fea92600183019101613505565b60408051601f1981840301815290829052611008929160200161337a565b60408051601f1981840301815290829052611b5f5f52601560205291507f8a69103ba0d209dc3c31e69b5d27cf5e0a41cf4406a51893d159eda72d2361e39061105290839061352f565b9081526020016040518091039020805461106b90613310565b80601f016020809104026020016040519081016040528092919081815260200182805461109790613310565b80156110e25780601f106110b9576101008083540402835291602001916110e2565b820191905f5260205f20905b8154815290600101906020018083116110c557829003601f168201915b5050505050915050919050565b60126020525f908152604090208054819061110990613310565b80601f016020809104026020016040519081016040528092919081815260200182805461113590613310565b80156111805780601f1061115757610100808354040283529160200191611180565b820191905f5260205f20905b81548152906001019060200180831161116357829003601f168201915b50505050509080600101805461119590613310565b80601f01602080910402602001604051908101604052809291908181526020018280546111c190613310565b801561120c5780601f106111e35761010080835404028352916020019161120c565b820191905f5260205f20905b8154815290600101906020018083116111ef57829003601f168201915b50505050509080600201805461122190613310565b80601f016020809104026020016040519081016040528092919081815260200182805461124d90613310565b80156112985780601f1061126f57610100808354040283529160200191611298565b820191905f5260205f20905b81548152906001019060200180831161127b57829003601f168201915b5050505060038301546004909301549192916001600160a01b0316905085565b600c8054610b5990613310565b5f610a8082611fda565b5f6007546112db611c77565b6112e5919061354e565b905090565b5f6001600160a01b038216611314576040516322718ad960e21b81525f6004820152602401610bfd565b506001600160a01b03165f9081526004602052604090205490565b611337612111565b610d8e5f6121d0565b611348612111565b600c610e8e8284836133de565b60136020525f90815260409020805460018201546002830180546001600160a01b0390931693919261138690613310565b80601f01602080910402602001604051908101604052809291908181526020018280546113b290613310565b80156113fd5780601f106113d4576101008083540402835291602001916113fd565b820191905f5260205f20905b8154815290600101906020018083116113e057829003601f168201915b50505050509080600301805461141290613310565b80601f016020809104026020016040519081016040528092919081815260200182805461143e90613310565b80156114895780601f1061146057610100808354040283529160200191611489565b820191905f5260205f20905b81548152906001019060200180831161146c57829003601f168201915b5050505050905084565b601560209081525f9283526040909220815180830184018051928152908401929093019190912091528054610b5990613310565b606060028054610a9590613310565b5f6009545f141580156114ea575060095442115b6115295760405162461bcd60e51b815260206004820152601060248201526f14d85b19481b9bdd081cdd185c9d195960821b6044820152606401610bfd565b600a5415806115395750600a5442105b6115725760405162461bcd60e51b815260206004820152600a60248201526914d85b1948195b99195960b21b6044820152606401610bfd565b5f8888888860405160200161158a9493929190613561565b604051602081830303815290604052905060146115a78285610d4e565b6040516115b4919061352f565b9081526020016040518091039020545f1461161c5760405162461bcd60e51b815260206004820152602260248201527f70726f6d707420616e6420736565642068617320616c7265616479206d696e74604482015261195960f21b6064820152608401610bfd565b6116246112cf565b3410156116735760405162461bcd60e51b815260206004820152601b60248201527f4e6f7420656e6f7567682066756e6420746f206d696e74204e465400000000006044820152606401610bfd565b600b5415806116855750600b54600854105b6116d15760405162461bcd60e51b815260206004820152601860248201527f4d617820746f74616c20737570706c79207265616368656400000000000000006044820152606401610bfd565b6116db818461221f565b5f600754600a6116e96112cf565b6116f490600b61358c565b6116fe91906135b7565b61170891906135ca565b90505f600a60075461171a91906135b7565b6011549091506001600160a01b03161561174457601154611744906001600160a01b03168261213d565b6010546001600160a01b03161561177f5760105461177f906001600160a01b03168361177084346135ca565b61177a91906135ca565b61213d565b6040518060a001604052808c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250505090825250604080516020601f8d018190048102820181019092528b815291810191908c908c90819084018382808284375f92019190915250505090825250604080516020601f8b0181900481028201810190925289815291810191908a908a90819084018382808284375f81840152601f19601f8201169050808301925050505050505081526020018681526020018d6001600160a01b031681525060125f60085481526020019081526020015f205f820151815f01908161188091906135dd565b506020820151600182019061189590826135dd565b50604082015160028201906118aa90826135dd565b5060608201516003820155608090910151600490910180546001600160a01b0319166001600160a01b039092169190911790556008546118eb908d90612397565b60088054905f6118fa83613697565b9190505550600854601461190e8588610d4e565b60405161191b919061352f565b9081526040519081900360200190205560085461193a906001906135ca565b9c9b505050505050505050505050565b611952612111565b600d610e8e8284836133de565b610b483383836123b0565b60405163c4be5cab60e01b815273c3287bdef03b925a7c7f54791edadcd88e632ccd9063c4be5cab906119a390899089906004016136d7565b6020604051808303815f875af11580156119bf573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119e391906136ea565b5f888152601660205260409081902082905551630901e0f960e31b815273c3287bdef03b925a7c7f54791edadcd88e632ccd9163480f07c891611a2d919088908890600401613701565b5f604051808303815f87803b158015611a44575f80fd5b505af1158015611a56573d5f803e3d5ffd5b505050508585604051611a6a92919061338b565b6040518091039020877f65deac95b53ba76b9cdc6cf446af81731e1218c91eaf9811a95d28bde23b893e86868686604051611aa8949392919061371a565b60405180910390a350505050505050565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168114611b365760405163432e033760e11b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116600483015282166024820152604401610bfd565b5f86815260136020526040902080546001600160a01b0316611b8f5760405162461bcd60e51b815260206004820152601260248201527172657175657374206e6f742065786973747360701b6044820152606401610bfd565b611b5f5f526015602052604051869086907f8a69103ba0d209dc3c31e69b5d27cf5e0a41cf4406a51893d159eda72d2361e390611bd0906002860190613740565b90815260200160405180910390209182611beb9291906133de565b507faf2b2381ddcb18a2b18a7826186fd216acdd9c852a8c7a9a49e7eab127f96ccf8782600101548360020189898989604051611c2e979695949392919061374b565b60405180910390a150505050505050565b611c47612111565b6009545f03611c565742600955565b42600a555f600955565b611c6b848484610bd8565b610c608484848461244e565b601154604051620e1d8d60e41b8152611b5f6004820152600160a01b9091046001600160401b031660248201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169062e1d8d090604401602060405180830381865afa158015611cf4573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112e591906136ea565b600d8054610b5990613310565b5f818152601260205260408120600381015460609291611da8916002820191906001820190611d5390612574565b5f88815260126020526040902060040154611d76906001600160a01b0316612678565b611d7f89610ead565b604051602001611d949695949392919061380c565b6040516020818303038152906040526127b1565b90505f81604051602001611dbc9190613a9c565b60408051601f19818403018152919052949350505050565b5f8060148888604051611de892919061338b565b9081526040805160209281900383018120545f8181526016909452918320546317861f8760e01b8252600482015290925073c3287bdef03b925a7c7f54791edadcd88e632ccd906317861f87906024015f60405180830381865afa158015611e52573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611e799190810190613acd565b5f83815260166020526040908190205490516333727c4d60e01b815291925073c3287bdef03b925a7c7f54791edadcd88e632ccd916333727c4d91611ec49160040190815260200190565b602060405180830381865afa158015611edf573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611f039190613348565b8015611f2c57508686604051611f1a92919061338b565b60405180910390208180519060200120145b9998505050505050505050565b6001600160a01b039182165f90815260066020908152604080832093909416825291909152205460ff1690565b600e8054610b5990613310565b611f7b612111565b601180546001600160a01b0319166001600160a01b0392909216919091179055565b611fa5612111565b6001600160a01b038116611fce57604051631e4fbdf760e01b81525f6004820152602401610bfd565b611fd7816121d0565b50565b5f818152600360205260408120546001600160a01b031680610a8057604051637e27328960e01b815260048101849052602401610bfd565b610e8e8383836001612913565b5f828152600360205260408120546001600160a01b039081169083161561204b5761204b818486612a17565b6001600160a01b03811615612085576120665f855f80612913565b6001600160a01b0381165f90815260046020526040902080545f190190555b6001600160a01b038516156120b3576001600160a01b0385165f908152600460205260409020805460010190555b5f8481526003602052604080822080546001600160a01b0319166001600160a01b0389811691821790925591518793918516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4949350505050565b5f546001600160a01b03163314610d8e5760405163118cdaa760e01b8152336004820152602401610bfd565b804710156121605760405163cd78605960e01b8152306004820152602401610bfd565b5f826001600160a01b0316826040515f6040518083038185875af1925050503d805f81146121a9576040519150601f19603f3d011682016040523d82523d5f602084013e6121ae565b606091505b5050905080610e8e57604051630a12f52160e11b815260040160405180910390fd5b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f818360405160200161223392919061337a565b60405160208183030381529060405290505f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635b953806600754600a6122816112cf565b61228c90600b61358c565b61229691906135b7565b6122a091906135ca565b611b5f8530601160149054906101000a90046001600160401b03166040518663ffffffff1660e01b81526004016122da9493929190613b41565b60206040518083038185885af11580156122f6573d5f803e3d5ffd5b50505050506040513d601f19601f8201168201806040525081019061231b91906136ea565b5f8181526013602052604090209091506002810161233984826135dd565b5080546001600160a01b031916339081178255611b5f600183018190556040517fa0faead83d70148ae18b694377f9bef079251342ab90e14af0f9ef68b891269f926123889286928a90613b91565b60405180910390a15050505050565b610b48828260405180602001604052805f815250612a7b565b6001600160a01b0382166123e257604051630b61174360e31b81526001600160a01b0383166004820152602401610bfd565b6001600160a01b038381165f81815260066020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b0383163b15610c6057604051630a85bd0160e11b81526001600160a01b0384169063150b7a0290612490903390889087908790600401613bc7565b6020604051808303815f875af19250505080156124ca575060408051601f3d908101601f191682019092526124c791810190613bf9565b60015b612531573d8080156124f7576040519150601f19603f3d011682016040523d82523d5f602084013e6124fc565b606091505b5080515f0361252957604051633250574960e11b81526001600160a01b0385166004820152602401610bfd565b805181602001fd5b6001600160e01b03198116630a85bd0160e11b1461256d57604051633250574960e11b81526001600160a01b0385166004820152602401610bfd565b5050505050565b6060815f0361259a5750506040805180820190915260018152600360fc1b602082015290565b815f5b81156125c357806125ad81613697565b91506125bc9050600a836135b7565b915061259d565b5f816001600160401b038111156125dc576125dc612cd2565b6040519080825280601f01601f191660200182016040528015612606576020820181803683370190505b5090505b84156126705761261b6001836135ca565b9150612628600a86613c14565b61263390603061354e565b60f81b81838151811061264857612648613c27565b60200101906001600160f81b03191690815f1a905350612669600a866135b7565b945061260a565b949350505050565b60408051602880825260608281019093525f91906020820181803683370190505090505f5b60148110156127aa575f6126b28260136135ca565b6126bd90600861358c565b6126c8906002613d1e565b6126db906001600160a01b0387166135b7565b60f81b90505f60108260f81c6126f19190613d29565b60f81b90505f8160f81c60106127079190613d4a565b8360f81c6127159190613d66565b60f81b905061272382612a91565b8561272f86600261358c565b8151811061273f5761273f613c27565b60200101906001600160f81b03191690815f1a90535061275e81612a91565b8561276a86600261358c565b61277590600161354e565b8151811061278557612785613c27565b60200101906001600160f81b03191690815f1a905350506001909201915061269d9050565b5092915050565b80516060905f8190036127d357505060408051602081019091525f8152919050565b5f60036127e183600261354e565b6127eb91906135b7565b6127f690600461358c565b90505f61280482602061354e565b6001600160401b0381111561281b5761281b612cd2565b6040519080825280601f01601f191660200182016040528015612845576020820181803683370190505b5090505f604051806060016040528060408152602001613d9960409139905060018101602083015f5b868110156128cf576003818a01810151603f601282901c8116860151600c83901c8216870151600684901c831688015192909316870151600891821b60ff94851601821b92841692909201901b91160160e01b83526004909201910161286e565b5060038606600181146128e957600281146128fa57612905565b613d3d60f01b600119830152612905565b603d60f81b5f198301525b505050918152949350505050565b808061292757506001600160a01b03821615155b156129e8575f61293684611fda565b90506001600160a01b038316158015906129625750826001600160a01b0316816001600160a01b031614155b801561297557506129738184611f39565b155b1561299e5760405163a9fbf51f60e01b81526001600160a01b0384166004820152602401610bfd565b81156129e65783856001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b50505f90815260056020526040902080546001600160a01b0319166001600160a01b0392909216919091179055565b612a22838383612acb565b610e8e576001600160a01b038316612a5057604051637e27328960e01b815260048101829052602401610bfd565b60405163177e802f60e01b81526001600160a01b038316600482015260248101829052604401610bfd565b612a858383612b2c565b610e8e5f84848461244e565b5f600a60f883901c1015612ab757612aae60f883901c6030613d7f565b60f81b92915050565b612aae60f883901c6057613d7f565b919050565b5f6001600160a01b038316158015906126705750826001600160a01b0316846001600160a01b03161480612b045750612b048484611f39565b806126705750505f908152600560205260409020546001600160a01b03908116911614919050565b6001600160a01b038216612b5557604051633250574960e11b81525f6004820152602401610bfd565b5f612b6183835f61201f565b90506001600160a01b03811615610e8e576040516339e3563760e11b81525f6004820152602401610bfd565b6001600160e01b031981168114611fd7575f80fd5b5f60208284031215612bb2575f80fd5b8135612bbd81612b8d565b9392505050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f612bbd6020830184612bc4565b5f60208284031215612c14575f80fd5b5035919050565b80356001600160a01b0381168114612ac6575f80fd5b5f8060408385031215612c42575f80fd5b612c4b83612c1b565b946020939093013593505050565b5f805f60608486031215612c6b575f80fd5b612c7484612c1b565b9250612c8260208501612c1b565b929592945050506040919091013590565b5f60208284031215612ca3575f80fd5b81356001600160401b0381168114612bbd575f80fd5b5f60208284031215612cc9575f80fd5b612bbd82612c1b565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b0381118282101715612d0e57612d0e612cd2565b604052919050565b5f6001600160401b03821115612d2e57612d2e612cd2565b50601f01601f191660200190565b5f82601f830112612d4b575f80fd5b8135602083015f612d63612d5e84612d16565b612ce6565b9050828152858383011115612d76575f80fd5b828260208301375f92810160200192909252509392505050565b5f8060408385031215612da1575f80fd5b82356001600160401b03811115612db6575f80fd5b612dc285828601612d3c565b95602094909401359450505050565b5f8083601f840112612de1575f80fd5b5081356001600160401b03811115612df7575f80fd5b602083019150836020828501011115612e0e575f80fd5b9250929050565b5f805f8060408587031215612e28575f80fd5b84356001600160401b03811115612e3d575f80fd5b612e4987828801612dd1565b90955093505060208501356001600160401b03811115612e67575f80fd5b612e7387828801612dd1565b95989497509550505050565b5f8060208385031215612e90575f80fd5b82356001600160401b03811115612ea5575f80fd5b612eb185828601612dd1565b90969095509350505050565b60a081525f612ecf60a0830188612bc4565b8281036020840152612ee18188612bc4565b90508281036040840152612ef58187612bc4565b606084019590955250506001600160a01b03919091166080909101529392505050565b5f60208284031215612f28575f80fd5b81356001600160401b03811115612f3d575f80fd5b61267084828501612d3c565b60018060a01b0385168152836020820152608060408201525f612f6f6080830185612bc4565b8281036060840152612f818185612bc4565b979650505050505050565b5f8060408385031215612f9d575f80fd5b8235915060208301356001600160401b03811115612fb9575f80fd5b612fc585828601612d3c565b9150509250929050565b5f805f805f805f8060a0898b031215612fe6575f80fd5b612fef89612c1b565b975060208901356001600160401b03811115613009575f80fd5b6130158b828c01612dd1565b90985096505060408901356001600160401b03811115613033575f80fd5b61303f8b828c01612dd1565b90965094505060608901356001600160401b0381111561305d575f80fd5b6130698b828c01612dd1565b999c989b50969995989497949560800135949350505050565b8015158114611fd7575f80fd5b5f80604083850312156130a0575f80fd5b6130a983612c1b565b915060208301356130b981613082565b809150509250929050565b5f805f805f805f6080888a0312156130da575f80fd5b8735965060208801356001600160401b038111156130f6575f80fd5b6131028a828b01612dd1565b90975095505060408801356001600160401b03811115613120575f80fd5b61312c8a828b01612dd1565b90955093505060608801356001600160401b0381111561314a575f80fd5b6131568a828b01612dd1565b989b979a50959850939692959293505050565b5f805f805f6060868803121561317d575f80fd5b8535945060208601356001600160401b03811115613199575f80fd5b6131a588828901612dd1565b90955093505060408601356001600160401b038111156131c3575f80fd5b6131cf88828901612dd1565b969995985093965092949392505050565b5f805f80608085870312156131f3575f80fd5b6131fc85612c1b565b935061320a60208601612c1b565b92506040850135915060608501356001600160401b0381111561322b575f80fd5b61323787828801612d3c565b91505092959194509250565b5f805f805f8060608789031215613258575f80fd5b86356001600160401b0381111561326d575f80fd5b61327989828a01612dd1565b90975095505060208701356001600160401b03811115613297575f80fd5b6132a389828a01612dd1565b90955093505060408701356001600160401b038111156132c1575f80fd5b6132cd89828a01612dd1565b979a9699509497509295939492505050565b5f80604083850312156132f0575f80fd5b6132f983612c1b565b915061330760208401612c1b565b90509250929050565b600181811c9082168061332457607f821691505b60208210810361334257634e487b7160e01b5f52602260045260245ffd5b50919050565b5f60208284031215613358575f80fd5b8151612bbd81613082565b5f81518060208401855e5f93019283525090919050565b8281525f6126706020830184613363565b818382375f9101908152919050565b601f821115610e8e57805f5260205f20601f840160051c810160208510156133bf5750805b601f840160051c820191505b8181101561256d575f81556001016133cb565b6001600160401b038311156133f5576133f5612cd2565b613409836134038354613310565b8361339a565b5f601f84116001811461343a575f85156134235750838201355b5f19600387901b1c1916600186901b17835561256d565b5f83815260208120601f198716915b828110156134695786850135825560209485019460019092019101613449565b5086821015613485575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b5f81546134a381613310565b6001821680156134ba57600181146134cf576134fc565b60ff19831686528115158202860193506134fc565b845f5260205f205f5b838110156134f4578154888201526001909101906020016134d8565b505081860193505b50505092915050565b5f6135108285613497565b622d2d2d60e81b81526135266003820185613497565b95945050505050565b5f612bbd8284613363565b634e487b7160e01b5f52601160045260245ffd5b80820180821115610a8057610a8061353a565b838582375f848201622d2d2d60e81b8152838560038301375f93016003019283525090949350505050565b8082028115828204841417610a8057610a8061353a565b634e487b7160e01b5f52601260045260245ffd5b5f826135c5576135c56135a3565b500490565b81810381811115610a8057610a8061353a565b81516001600160401b038111156135f6576135f6612cd2565b61360a816136048454613310565b8461339a565b6020601f82116001811461363c575f83156136255750848201515b5f19600385901b1c1916600184901b17845561256d565b5f84815260208120601f198516915b8281101561366b578785015182556020948501946001909201910161364b565b508482101561368857868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b5f600182016136a8576136a861353a565b5060010190565b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b602081525f6126706020830184866136af565b5f602082840312156136fa575f80fd5b5051919050565b838152604060208201525f6135266040830184866136af565b604081525f61372d6040830186886136af565b8281036020840152612f818185876136af565b5f612bbd8284613497565b87815286602082015260a060408201525f80875461376881613310565b8060a0860152600182165f811461378657600181146137a2576137d3565b60ff19831660c087015260c082151560051b87010193506137d3565b8a5f5260205f205f5b838110156137ca57815488820160c001526001909101906020016137ab565b870160c0019450505b50505082810360608401526137e98187896136af565b905082810360808401526137fe8185876136af565b9a9950505050505050505050565b683d913730b6b2911d1160b91b81525f6138296009830189613497565b7f222c202261747472696275746573223a205b7b2274726169745f74797065223a81527f2022706f7369746976655f70726f6d7074222c202276616c7565223a20220000602082015261387f603e820189613497565b7f227d2c207b2274726169745f74797065223a20226e656761746976655f70726f81526f36b83a111610113b30b63ab2911d101160811b602082015290506138ca6030820188613497565b7f227d2c207b2274726169745f74797065223a202273656564222c202276616c7581526432911d101160d91b6020820152905061390a6025820187613363565b7f227d2c207b2274726169745f74797065223a2022617574686f72222c202276618152680d8eaca4474404460f60bb1b6020820152905061394e6029820186613363565b7f227d2c207b2274726169745f74797065223a20226d6f64656c222c202276616c81527f7565223a2022537461626c6520446966667573696f6e227d5d2c20226465736360208201527f72697074696f6e223a2022537461626c6520446966667573696f6e206973206160408201527f206c6174656e7420746578742d746f2d696d61676520646966667573696f6e2060608201527f6d6f64656c2063617061626c65206f662067656e65726174696e672070686f7460808201527f6f2d7265616c697374696320696d6167657320676976656e20616e792074657860a08201527f7420696e7075742e222c2022696d616765223a202268747470733a2f2f67617460c08201527f657761792e70696e6174612e636c6f75642f697066732f00000000000000000060e0820152905060f781016137fe613a8e8287613363565b61227d60f01b815260020190565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000081525f612bbd601d830184613363565b5f60208284031215613add575f80fd5b81516001600160401b03811115613af2575f80fd5b8201601f81018413613b02575f80fd5b8051613b10612d5e82612d16565b818152856020838501011115613b24575f80fd5b8160208401602083015e5f91810160200191909152949350505050565b84815260a060208201525f613b5960a0830186612bc4565b6001600160a01b03949094166040830152506001600160401b039190911660608201528082036080909101525f815260200192915050565b84815260018060a01b0384166020820152826040820152608060608201525f613bbd6080830184612bc4565b9695505050505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190525f90613bbd90830184612bc4565b5f60208284031215613c09575f80fd5b8151612bbd81612b8d565b5f82613c2257613c226135a3565b500690565b634e487b7160e01b5f52603260045260245ffd5b6001815b6001841115613c7657808504811115613c5a57613c5a61353a565b6001841615613c6857908102905b60019390931c928002613c3f565b935093915050565b5f82613c8c57506001610a80565b81613c9857505f610a80565b8160018114613cae5760028114613cb857613cd4565b6001915050610a80565b60ff841115613cc957613cc961353a565b50506001821b610a80565b5060208310610133831016604e8410600b8410161715613cf7575081810a610a80565b613d035f198484613c3b565b805f1904821115613d1657613d1661353a565b029392505050565b5f612bbd8383613c7e565b5f60ff831680613d3b57613d3b6135a3565b8060ff84160491505092915050565b60ff81811683821602908116908181146127aa576127aa61353a565b60ff8281168282160390811115610a8057610a8061353a565b60ff8181168382160190811115610a8057610a8061353a56fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa2646970667358221220808320eb0f90e86c77112a89f3d8478a0ded26f64f573f7b9de3ebf0a0f9965c64736f6c634300081a0033a2646970667358221220cada4488dc8c1a7c287c4405f6814241cf9a44319a8e52cc7cc7b25a352a204564736f6c634300081a0033 | 6080604052600436106100a5575f3560e01c80637854ed12116100625780637854ed121461017f5780637d707aad1461019e5780638da5cb5b146101bd5780639ee67e10146101d9578063f2fde38b14610210578063f73aed201461022f575f80fd5b8063090e5465146100a95780631bec5b7a146100d15780632f03012e146100fc57806331b221cd146101235780635cd046d11461014a578063715018a614610169575b5f80fd5b3480156100b4575f80fd5b506100be60045481565b6040519081526020015b60405180910390f35b6100e46100df3660046105db565b61024e565b6040516001600160a01b0390911681526020016100c8565b348015610107575f80fd5b506100e473c3287bdef03b925a7c7f54791edadcd88e632ccd81565b34801561012e575f80fd5b506100e4730a0f4321214bb6c7811dd8a71cf587bdaf03f0a081565b348015610155575f80fd5b506001546100e4906001600160a01b031681565b348015610174575f80fd5b5061017d61043f565b005b34801561018a575f80fd5b5061017d61019936600461067a565b610452565b3480156101a9575f80fd5b5061017d6101b83660046106ac565b61045f565b3480156101c8575f80fd5b505f546001600160a01b03166100e4565b3480156101e4575f80fd5b506100be6101f336600461076b565b805160208183018101805160038252928201919093012091525481565b34801561021b575f80fd5b5061017d61022a3660046106ac565b610489565b34801561023a575f80fd5b506100e46102493660046107a5565b6104c6565b5f60045434101561029b5760405162461bcd60e51b8152602060048201526012602482015271496e73756666696369656e742066756e647360701b60448201526064015b60405180910390fd5b5f8787878787876040516102ae90610586565b6102bd96959493929190610885565b604051809103905ff0801580156102d6573d5f803e3d5ffd5b5090506002888860048181106102ee576102ee610950565b90506020028101906103009190610964565b60405161030e9291906109a7565b908152604051602091819003820190208054600180820183555f928352929091200180546001600160a01b0319166001600160a01b03841617905560038989600481811061035e5761035e610950565b90506020028101906103709190610964565b60405161037e9291906109a7565b90815260200160405180910390205f82825461039a91906109b6565b90915550506001546040516001600160a01b03909116903480156108fc02915f818181858888f193505050501580156103d5573d5f803e3d5ffd5b507f986b269bc298e243448f506d0cf973af56bf7b2d5c2b37841394d10d236eb826338989600481811061040b5761040b610950565b905060200281019061041d9190610964565b60405161042c939291906109db565b60405180910390a1979650505050505050565b61044761050b565b6104505f610537565b565b61045a61050b565b600455565b61046761050b565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b61049161050b565b6001600160a01b0381166104ba57604051631e4fbdf760e01b81525f6004820152602401610292565b6104c381610537565b50565b815160208184018101805160028252928201918501919091209190528054829081106104f0575f80fd5b5f918252602090912001546001600160a01b03169150829050565b5f546001600160a01b031633146104505760405163118cdaa760e01b8152336004820152602401610292565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61454380610a0983390190565b5f8083601f8401126105a3575f80fd5b50813567ffffffffffffffff8111156105ba575f80fd5b6020830191508360208260051b85010111156105d4575f80fd5b9250929050565b5f805f805f80606087890312156105f0575f80fd5b863567ffffffffffffffff811115610606575f80fd5b61061289828a01610593565b909750955050602087013567ffffffffffffffff811115610631575f80fd5b61063d89828a01610593565b909550935050604087013567ffffffffffffffff81111561065c575f80fd5b61066889828a01610593565b979a9699509497509295939492505050565b5f6020828403121561068a575f80fd5b5035919050565b80356001600160a01b03811681146106a7575f80fd5b919050565b5f602082840312156106bc575f80fd5b6106c582610691565b9392505050565b634e487b7160e01b5f52604160045260245ffd5b5f82601f8301126106ef575f80fd5b813567ffffffffffffffff811115610709576107096106cc565b604051601f8201601f19908116603f0116810167ffffffffffffffff81118282101715610738576107386106cc565b60405281815283820160200185101561074f575f80fd5b816020850160208301375f918101602001919091529392505050565b5f6020828403121561077b575f80fd5b813567ffffffffffffffff811115610791575f80fd5b61079d848285016106e0565b949350505050565b5f80604083850312156107b6575f80fd5b823567ffffffffffffffff8111156107cc575f80fd5b6107d8858286016106e0565b95602094909401359450505050565b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b8183525f6001600160fb1b03831115610826575f80fd5b8260051b80836020870137939093016020019392505050565b8183526020830192505f815f5b8481101561087b576001600160a01b0361086583610691565b168652602095860195919091019060010161084c565b5093949350505050565b606080825281018690525f6080600588901b830181019083018983601e1936839003015b8b82101561091757868503607f1901845282358181126108c7575f80fd5b8d0160208101903567ffffffffffffffff8111156108e3575f80fd5b8036038213156108f1575f80fd5b6108fc8782846107e7565b965050506020830192506020840193506001820191506108a9565b50505050828103602084015261092e81878961080f565b9050828103604084015261094381858761083f565b9998505050505050505050565b634e487b7160e01b5f52603260045260245ffd5b5f808335601e19843603018112610979575f80fd5b83018035915067ffffffffffffffff821115610993575f80fd5b6020019150368190038213156105d4575f80fd5b818382375f9101908152919050565b808201808211156109d557634e487b7160e01b5f52601160045260245ffd5b92915050565b6001600160a01b03841681526040602082018190525f906109ff90830184866107e7565b9594505050505056fe60a060405260118054600160a01b600160e01b031916613d0960a51b179055348015610029575f80fd5b5060405161454338038061454383398101604081905261004891610445565b825f8151811061005a5761005a6105a8565b602002602001015183600181518110610075576100756105a8565b6020026020010151825f8151811061008f5761008f6105a8565b6020908102919091010151730a0f4321214bb6c7811dd8a71cf587bdaf03f0a06080526001600160a01b0381166100df57604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b6100e8816102b7565b5060016100f58382610640565b5060026101028282610640565b505050815f81518110610117576101176105a8565b6020026020010151600781905550805f81518110610137576101376105a8565b602002602001015160105f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555080600181518110610177576101776105a8565b602002602001015160115f6101000a8154816001600160a01b0302191690836001600160a01b03160217905550826002815181106101b7576101b76105a8565b6020026020010151600c90816101cd9190610640565b50826003815181106101e1576101e16105a8565b6020026020010151600d90816101f79190610640565b508260048151811061020b5761020b6105a8565b6020026020010151600e90816102219190610640565b5081600181518110610235576102356105a8565b6020026020010151600b8190555081600281518110610256576102566105a8565b602002602001015160098190555081600381518110610277576102776105a8565b6020026020010151600a8190555082600581518110610298576102986105a8565b6020026020010151600f90816102ae9190610640565b505050506106fa565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b038111828210171561034257610342610306565b604052919050565b5f6001600160401b0382111561036257610362610306565b5060051b60200190565b5f82601f83011261037b575f80fd5b815161038e6103898261034a565b61031a565b8082825260208201915060208360051b8601019250858311156103af575f80fd5b602085015b838110156103cc5780518352602092830192016103b4565b5095945050505050565b5f82601f8301126103e5575f80fd5b81516103f36103898261034a565b8082825260208201915060208360051b860101925085831115610414575f80fd5b602085015b838110156103cc5780516001600160a01b0381168114610437575f80fd5b835260209283019201610419565b5f805f60608486031215610457575f80fd5b83516001600160401b0381111561046c575f80fd5b8401601f8101861361047c575f80fd5b805161048a6103898261034a565b8082825260208201915060208360051b8501019250888311156104ab575f80fd5b602084015b838110156105495780516001600160401b038111156104cd575f80fd5b8501603f81018b136104dd575f80fd5b60208101516001600160401b038111156104f9576104f9610306565b61050c601f8201601f191660200161031a565b8181526040838301018d1015610520575f80fd5b8160408401602083015e5f602083830101528086525050506020830192506020810190506104b0565b506020880151909650925050506001600160401b03811115610569575f80fd5b6105758682870161036c565b604086015190935090506001600160401b03811115610592575f80fd5b61059e868287016103d6565b9150509250925092565b634e487b7160e01b5f52603260045260245ffd5b600181811c908216806105d057607f821691505b6020821081036105ee57634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111561063b57805f5260205f20601f840160051c810160208510156106195750805b601f840160051c820191505b81811015610638575f8155600101610625565b50505b505050565b81516001600160401b0381111561065957610659610306565b61066d8161066784546105bc565b846105f4565b6020601f82116001811461069f575f83156106885750848201515b5f19600385901b1c1916600184901b178455610638565b5f84815260208120601f198516915b828110156106ce57878501518255602094850194600190920191016106ae565b50848210156106eb57868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b608051613e0e6107355f395f81816104ed01528181610cdd01528181611ac401528181611b0101528181611ca801526122470152613e0e5ff3fe60806040526004361061035b575f3560e01c806370a08231116101bd578063b0347814116100f2578063de8f50a111610092578063ebd7edaf1161006d578063ebd7edaf146109a5578063ec3e5f45146109b9578063eda47704146109f7578063f2fde38b14610a16575f80fd5b8063de8f50a114610948578063e0be9bf914610967578063e985e9c514610986575f80fd5b8063b88d4fde116100cd578063b88d4fde146108e2578063c1d88c4414610901578063c745e3ff14610915578063c87b56dd14610929575f80fd5b8063b03478141461089a578063b0f7a3ff146108b9578063b7b6ccd5146108ce575f80fd5b80638da5cb5b1161015d578063a1a0e7fc11610138578063a1a0e7fc14610812578063a22cb46514610831578063ad72e1a514610850578063aea305071461087b575f80fd5b80638da5cb5b146107cf57806395d89b41146107eb5780639ee74dd1146107ff575f80fd5b80637df04787116101985780637df047871461073557806381d12c581461076c5780638500a45d1461079b5780638cbc52d9146107b0575f80fd5b806370a08231146106e3578063715018a61461070257806378564b7414610716575f80fd5b80633ccfd60b1161029357806358fd416d11610233578063628ae0a31161020e578063628ae0a3146106875780636352211e1461069b5780636817c76c146106ba578063702de1e3146106cf575f80fd5b806358fd416d146106235780635bb4688d146106425780635cec1b7614610672575f80fd5b8063414f11451161026e578063414f11451461059f57806342842e0e146105be5780634c34e4dc146105dd5780634ca0ce4c146105fc575f80fd5b80633ccfd60b1461054d5780633f37dce2146105615780633f3e4c1114610580575f80fd5b80632ab4d052116102fe5780632f03012e116102d95780632f03012e146104b557806331b221cd146104dc57806333727c4d1461050f5780633c1c8e491461052e575f80fd5b80632ab4d052146104625780632cfb2080146104775780632ddfb80714610496575f80fd5b8063095ea7b311610339578063095ea7b3146103eb578063122d1bad1461040c57806318160ddd1461042057806323b872dd14610443575f80fd5b806301ffc9a71461035f57806306fdde0314610393578063081812fc146103b4575b5f80fd5b34801561036a575f80fd5b5061037e610379366004612ba2565b610a35565b60405190151581526020015b60405180910390f35b34801561039e575f80fd5b506103a7610a86565b60405161038a9190612bf2565b3480156103bf575f80fd5b506103d36103ce366004612c04565b610b16565b6040516001600160a01b03909116815260200161038a565b3480156103f6575f80fd5b5061040a610405366004612c31565b610b3d565b005b348015610417575f80fd5b506103a7610b4c565b34801561042b575f80fd5b5061043560085481565b60405190815260200161038a565b34801561044e575f80fd5b5061040a61045d366004612c59565b610bd8565b34801561046d575f80fd5b50610435600b5481565b348015610482575f80fd5b5061040a610491366004612c93565b610c66565b3480156104a1575f80fd5b5061040a6104b0366004612cb9565b610c9b565b3480156104c0575f80fd5b506103d373c3287bdef03b925a7c7f54791edadcd88e632ccd81565b3480156104e7575f80fd5b506103d37f000000000000000000000000000000000000000000000000000000000000000081565b34801561051a575f80fd5b5061037e610529366004612c04565b610cc5565b348015610539575f80fd5b506103a7610548366004612d90565b610d4e565b348015610558575f80fd5b5061040a610d7c565b34801561056c575f80fd5b5061040a61057b366004612e15565b610d90565b34801561058b575f80fd5b5061040a61059a366004612c04565b610e6c565b3480156105aa575f80fd5b5061040a6105b9366004612e7f565b610e79565b3480156105c9575f80fd5b5061040a6105d8366004612c59565b610e93565b3480156105e8575f80fd5b506011546103d3906001600160a01b031681565b348015610607575f80fd5b506103d3730a0f4321214bb6c7811dd8a71cf587bdaf03f0a081565b34801561062e575f80fd5b506103a761063d366004612c04565b610ead565b34801561064d575f80fd5b5061066161065c366004612c04565b6110ef565b60405161038a959493929190612ebd565b34801561067d575f80fd5b50610435600a5481565b348015610692575f80fd5b506103a76112b8565b3480156106a6575f80fd5b506103d36106b5366004612c04565b6112c5565b3480156106c5575f80fd5b5061043560075481565b3480156106da575f80fd5b506104356112cf565b3480156106ee575f80fd5b506104356106fd366004612cb9565b6112ea565b34801561070d575f80fd5b5061040a61132f565b348015610721575f80fd5b5061040a610730366004612e7f565b611340565b348015610740575f80fd5b5061043561074f366004612f18565b805160208183018101805160148252928201919093012091525481565b348015610777575f80fd5b5061078b610786366004612c04565b611355565b60405161038a9493929190612f49565b3480156107a6575f80fd5b5061043560095481565b3480156107bb575f80fd5b506103a76107ca366004612f8c565b611493565b3480156107da575f80fd5b505f546001600160a01b03166103d3565b3480156107f6575f80fd5b506103a76114c7565b61043561080d366004612fcf565b6114d6565b34801561081d575f80fd5b5061040a61082c366004612e7f565b61194a565b34801561083c575f80fd5b5061040a61084b36600461308f565b61195f565b34801561085b575f80fd5b5061043561086a366004612c04565b60166020525f908152604090205481565b348015610886575f80fd5b5061040a6108953660046130c4565b61196a565b3480156108a5575f80fd5b5061040a6108b4366004613169565b611ab9565b3480156108c4575f80fd5b50610435611b5f81565b3480156108d9575f80fd5b5061040a611c3f565b3480156108ed575f80fd5b5061040a6108fc3660046131e0565b611c60565b34801561090c575f80fd5b50610435611c77565b348015610920575f80fd5b506103a7611d18565b348015610934575f80fd5b506103a7610943366004612c04565b611d25565b348015610953575f80fd5b5061037e610962366004613243565b611dd4565b348015610972575f80fd5b506010546103d3906001600160a01b031681565b348015610991575f80fd5b5061037e6109a03660046132df565b611f39565b3480156109b0575f80fd5b506103a7611f66565b3480156109c4575f80fd5b506011546109df90600160a01b90046001600160401b031681565b6040516001600160401b03909116815260200161038a565b348015610a02575f80fd5b5061040a610a11366004612cb9565b611f73565b348015610a21575f80fd5b5061040a610a30366004612cb9565b611f9d565b5f6001600160e01b031982166380ac58cd60e01b1480610a6557506001600160e01b03198216635b5e139f60e01b145b80610a8057506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060018054610a9590613310565b80601f0160208091040260200160405190810160405280929190818152602001828054610ac190613310565b8015610b0c5780601f10610ae357610100808354040283529160200191610b0c565b820191905f5260205f20905b815481529060010190602001808311610aef57829003601f168201915b5050505050905090565b5f610b2082611fda565b505f828152600560205260409020546001600160a01b0316610a80565b610b48828233612012565b5050565b600f8054610b5990613310565b80601f0160208091040260200160405190810160405280929190818152602001828054610b8590613310565b8015610bd05780601f10610ba757610100808354040283529160200191610bd0565b820191905f5260205f20905b815481529060010190602001808311610bb357829003601f168201915b505050505081565b6001600160a01b038216610c0657604051633250574960e11b81525f60048201526024015b60405180910390fd5b5f610c1283833361201f565b9050836001600160a01b0316816001600160a01b031614610c60576040516364283d7b60e01b81526001600160a01b0380861660048301526024820184905282166044820152606401610bfd565b50505050565b610c6e612111565b601180546001600160401b03909216600160a01b0267ffffffffffffffff60a01b19909216919091179055565b610ca3612111565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b6040516333727c4d60e01b8152600481018290525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906333727c4d90602401602060405180830381865afa158015610d2a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a809190613348565b60605f8284604051602001610d6492919061337a565b60408051808303601f19018152919052949350505050565b610d84612111565b610d8e334761213d565b565b610d9e848484848888611dd4565b610dea5760405162461bcd60e51b815260206004820152601960248201527f455243373030373a20696e76616c6964206169676344617461000000000000006044820152606401610bfd565b5f60148585604051610dfd92919061338b565b908152604051908190036020018120549150610e1c908490849061338b565b60405180910390208585604051610e3492919061338b565b6040519081900381209083907fd77aab0eeab3a3cbdac072fcdbc34709b18d6c4af91f7869c71cbbb13d71a6b9905f90a45050505050565b610e74612111565b600b55565b610e81612111565b600e610e8e8284836133de565b505050565b610e8e83838360405180602001604052805f815250611c60565b5f8181526012602052604081206003015460609103610fc2575f8281526012602090815260409182902091517f8a69103ba0d209dc3c31e69b5d27cf5e0a41cf4406a51893d159eda72d2361e392610f0c929091600183019101613505565b60408051601f1981840301815290829052610f269161352f565b90815260200160405180910390208054610f3f90613310565b80601f0160208091040260200160405190810160405280929190818152602001828054610f6b90613310565b8015610fb65780601f10610f8d57610100808354040283529160200191610fb6565b820191905f5260205f20905b815481529060010190602001808311610f9957829003601f168201915b50505050509050919050565b5f828152601260209081526040808320600381015491519192610fea92600183019101613505565b60408051601f1981840301815290829052611008929160200161337a565b60408051601f1981840301815290829052611b5f5f52601560205291507f8a69103ba0d209dc3c31e69b5d27cf5e0a41cf4406a51893d159eda72d2361e39061105290839061352f565b9081526020016040518091039020805461106b90613310565b80601f016020809104026020016040519081016040528092919081815260200182805461109790613310565b80156110e25780601f106110b9576101008083540402835291602001916110e2565b820191905f5260205f20905b8154815290600101906020018083116110c557829003601f168201915b5050505050915050919050565b60126020525f908152604090208054819061110990613310565b80601f016020809104026020016040519081016040528092919081815260200182805461113590613310565b80156111805780601f1061115757610100808354040283529160200191611180565b820191905f5260205f20905b81548152906001019060200180831161116357829003601f168201915b50505050509080600101805461119590613310565b80601f01602080910402602001604051908101604052809291908181526020018280546111c190613310565b801561120c5780601f106111e35761010080835404028352916020019161120c565b820191905f5260205f20905b8154815290600101906020018083116111ef57829003601f168201915b50505050509080600201805461122190613310565b80601f016020809104026020016040519081016040528092919081815260200182805461124d90613310565b80156112985780601f1061126f57610100808354040283529160200191611298565b820191905f5260205f20905b81548152906001019060200180831161127b57829003601f168201915b5050505060038301546004909301549192916001600160a01b0316905085565b600c8054610b5990613310565b5f610a8082611fda565b5f6007546112db611c77565b6112e5919061354e565b905090565b5f6001600160a01b038216611314576040516322718ad960e21b81525f6004820152602401610bfd565b506001600160a01b03165f9081526004602052604090205490565b611337612111565b610d8e5f6121d0565b611348612111565b600c610e8e8284836133de565b60136020525f90815260409020805460018201546002830180546001600160a01b0390931693919261138690613310565b80601f01602080910402602001604051908101604052809291908181526020018280546113b290613310565b80156113fd5780601f106113d4576101008083540402835291602001916113fd565b820191905f5260205f20905b8154815290600101906020018083116113e057829003601f168201915b50505050509080600301805461141290613310565b80601f016020809104026020016040519081016040528092919081815260200182805461143e90613310565b80156114895780601f1061146057610100808354040283529160200191611489565b820191905f5260205f20905b81548152906001019060200180831161146c57829003601f168201915b5050505050905084565b601560209081525f9283526040909220815180830184018051928152908401929093019190912091528054610b5990613310565b606060028054610a9590613310565b5f6009545f141580156114ea575060095442115b6115295760405162461bcd60e51b815260206004820152601060248201526f14d85b19481b9bdd081cdd185c9d195960821b6044820152606401610bfd565b600a5415806115395750600a5442105b6115725760405162461bcd60e51b815260206004820152600a60248201526914d85b1948195b99195960b21b6044820152606401610bfd565b5f8888888860405160200161158a9493929190613561565b604051602081830303815290604052905060146115a78285610d4e565b6040516115b4919061352f565b9081526020016040518091039020545f1461161c5760405162461bcd60e51b815260206004820152602260248201527f70726f6d707420616e6420736565642068617320616c7265616479206d696e74604482015261195960f21b6064820152608401610bfd565b6116246112cf565b3410156116735760405162461bcd60e51b815260206004820152601b60248201527f4e6f7420656e6f7567682066756e6420746f206d696e74204e465400000000006044820152606401610bfd565b600b5415806116855750600b54600854105b6116d15760405162461bcd60e51b815260206004820152601860248201527f4d617820746f74616c20737570706c79207265616368656400000000000000006044820152606401610bfd565b6116db818461221f565b5f600754600a6116e96112cf565b6116f490600b61358c565b6116fe91906135b7565b61170891906135ca565b90505f600a60075461171a91906135b7565b6011549091506001600160a01b03161561174457601154611744906001600160a01b03168261213d565b6010546001600160a01b03161561177f5760105461177f906001600160a01b03168361177084346135ca565b61177a91906135ca565b61213d565b6040518060a001604052808c8c8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250505090825250604080516020601f8d018190048102820181019092528b815291810191908c908c90819084018382808284375f92019190915250505090825250604080516020601f8b0181900481028201810190925289815291810191908a908a90819084018382808284375f81840152601f19601f8201169050808301925050505050505081526020018681526020018d6001600160a01b031681525060125f60085481526020019081526020015f205f820151815f01908161188091906135dd565b506020820151600182019061189590826135dd565b50604082015160028201906118aa90826135dd565b5060608201516003820155608090910151600490910180546001600160a01b0319166001600160a01b039092169190911790556008546118eb908d90612397565b60088054905f6118fa83613697565b9190505550600854601461190e8588610d4e565b60405161191b919061352f565b9081526040519081900360200190205560085461193a906001906135ca565b9c9b505050505050505050505050565b611952612111565b600d610e8e8284836133de565b610b483383836123b0565b60405163c4be5cab60e01b815273c3287bdef03b925a7c7f54791edadcd88e632ccd9063c4be5cab906119a390899089906004016136d7565b6020604051808303815f875af11580156119bf573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119e391906136ea565b5f888152601660205260409081902082905551630901e0f960e31b815273c3287bdef03b925a7c7f54791edadcd88e632ccd9163480f07c891611a2d919088908890600401613701565b5f604051808303815f87803b158015611a44575f80fd5b505af1158015611a56573d5f803e3d5ffd5b505050508585604051611a6a92919061338b565b6040518091039020877f65deac95b53ba76b9cdc6cf446af81731e1218c91eaf9811a95d28bde23b893e86868686604051611aa8949392919061371a565b60405180910390a350505050505050565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168114611b365760405163432e033760e11b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116600483015282166024820152604401610bfd565b5f86815260136020526040902080546001600160a01b0316611b8f5760405162461bcd60e51b815260206004820152601260248201527172657175657374206e6f742065786973747360701b6044820152606401610bfd565b611b5f5f526015602052604051869086907f8a69103ba0d209dc3c31e69b5d27cf5e0a41cf4406a51893d159eda72d2361e390611bd0906002860190613740565b90815260200160405180910390209182611beb9291906133de565b507faf2b2381ddcb18a2b18a7826186fd216acdd9c852a8c7a9a49e7eab127f96ccf8782600101548360020189898989604051611c2e979695949392919061374b565b60405180910390a150505050505050565b611c47612111565b6009545f03611c565742600955565b42600a555f600955565b611c6b848484610bd8565b610c608484848461244e565b601154604051620e1d8d60e41b8152611b5f6004820152600160a01b9091046001600160401b031660248201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169062e1d8d090604401602060405180830381865afa158015611cf4573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112e591906136ea565b600d8054610b5990613310565b5f818152601260205260408120600381015460609291611da8916002820191906001820190611d5390612574565b5f88815260126020526040902060040154611d76906001600160a01b0316612678565b611d7f89610ead565b604051602001611d949695949392919061380c565b6040516020818303038152906040526127b1565b90505f81604051602001611dbc9190613a9c565b60408051601f19818403018152919052949350505050565b5f8060148888604051611de892919061338b565b9081526040805160209281900383018120545f8181526016909452918320546317861f8760e01b8252600482015290925073c3287bdef03b925a7c7f54791edadcd88e632ccd906317861f87906024015f60405180830381865afa158015611e52573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611e799190810190613acd565b5f83815260166020526040908190205490516333727c4d60e01b815291925073c3287bdef03b925a7c7f54791edadcd88e632ccd916333727c4d91611ec49160040190815260200190565b602060405180830381865afa158015611edf573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611f039190613348565b8015611f2c57508686604051611f1a92919061338b565b60405180910390208180519060200120145b9998505050505050505050565b6001600160a01b039182165f90815260066020908152604080832093909416825291909152205460ff1690565b600e8054610b5990613310565b611f7b612111565b601180546001600160a01b0319166001600160a01b0392909216919091179055565b611fa5612111565b6001600160a01b038116611fce57604051631e4fbdf760e01b81525f6004820152602401610bfd565b611fd7816121d0565b50565b5f818152600360205260408120546001600160a01b031680610a8057604051637e27328960e01b815260048101849052602401610bfd565b610e8e8383836001612913565b5f828152600360205260408120546001600160a01b039081169083161561204b5761204b818486612a17565b6001600160a01b03811615612085576120665f855f80612913565b6001600160a01b0381165f90815260046020526040902080545f190190555b6001600160a01b038516156120b3576001600160a01b0385165f908152600460205260409020805460010190555b5f8481526003602052604080822080546001600160a01b0319166001600160a01b0389811691821790925591518793918516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4949350505050565b5f546001600160a01b03163314610d8e5760405163118cdaa760e01b8152336004820152602401610bfd565b804710156121605760405163cd78605960e01b8152306004820152602401610bfd565b5f826001600160a01b0316826040515f6040518083038185875af1925050503d805f81146121a9576040519150601f19603f3d011682016040523d82523d5f602084013e6121ae565b606091505b5050905080610e8e57604051630a12f52160e11b815260040160405180910390fd5b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f818360405160200161223392919061337a565b60405160208183030381529060405290505f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635b953806600754600a6122816112cf565b61228c90600b61358c565b61229691906135b7565b6122a091906135ca565b611b5f8530601160149054906101000a90046001600160401b03166040518663ffffffff1660e01b81526004016122da9493929190613b41565b60206040518083038185885af11580156122f6573d5f803e3d5ffd5b50505050506040513d601f19601f8201168201806040525081019061231b91906136ea565b5f8181526013602052604090209091506002810161233984826135dd565b5080546001600160a01b031916339081178255611b5f600183018190556040517fa0faead83d70148ae18b694377f9bef079251342ab90e14af0f9ef68b891269f926123889286928a90613b91565b60405180910390a15050505050565b610b48828260405180602001604052805f815250612a7b565b6001600160a01b0382166123e257604051630b61174360e31b81526001600160a01b0383166004820152602401610bfd565b6001600160a01b038381165f81815260066020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b0383163b15610c6057604051630a85bd0160e11b81526001600160a01b0384169063150b7a0290612490903390889087908790600401613bc7565b6020604051808303815f875af19250505080156124ca575060408051601f3d908101601f191682019092526124c791810190613bf9565b60015b612531573d8080156124f7576040519150601f19603f3d011682016040523d82523d5f602084013e6124fc565b606091505b5080515f0361252957604051633250574960e11b81526001600160a01b0385166004820152602401610bfd565b805181602001fd5b6001600160e01b03198116630a85bd0160e11b1461256d57604051633250574960e11b81526001600160a01b0385166004820152602401610bfd565b5050505050565b6060815f0361259a5750506040805180820190915260018152600360fc1b602082015290565b815f5b81156125c357806125ad81613697565b91506125bc9050600a836135b7565b915061259d565b5f816001600160401b038111156125dc576125dc612cd2565b6040519080825280601f01601f191660200182016040528015612606576020820181803683370190505b5090505b84156126705761261b6001836135ca565b9150612628600a86613c14565b61263390603061354e565b60f81b81838151811061264857612648613c27565b60200101906001600160f81b03191690815f1a905350612669600a866135b7565b945061260a565b949350505050565b60408051602880825260608281019093525f91906020820181803683370190505090505f5b60148110156127aa575f6126b28260136135ca565b6126bd90600861358c565b6126c8906002613d1e565b6126db906001600160a01b0387166135b7565b60f81b90505f60108260f81c6126f19190613d29565b60f81b90505f8160f81c60106127079190613d4a565b8360f81c6127159190613d66565b60f81b905061272382612a91565b8561272f86600261358c565b8151811061273f5761273f613c27565b60200101906001600160f81b03191690815f1a90535061275e81612a91565b8561276a86600261358c565b61277590600161354e565b8151811061278557612785613c27565b60200101906001600160f81b03191690815f1a905350506001909201915061269d9050565b5092915050565b80516060905f8190036127d357505060408051602081019091525f8152919050565b5f60036127e183600261354e565b6127eb91906135b7565b6127f690600461358c565b90505f61280482602061354e565b6001600160401b0381111561281b5761281b612cd2565b6040519080825280601f01601f191660200182016040528015612845576020820181803683370190505b5090505f604051806060016040528060408152602001613d9960409139905060018101602083015f5b868110156128cf576003818a01810151603f601282901c8116860151600c83901c8216870151600684901c831688015192909316870151600891821b60ff94851601821b92841692909201901b91160160e01b83526004909201910161286e565b5060038606600181146128e957600281146128fa57612905565b613d3d60f01b600119830152612905565b603d60f81b5f198301525b505050918152949350505050565b808061292757506001600160a01b03821615155b156129e8575f61293684611fda565b90506001600160a01b038316158015906129625750826001600160a01b0316816001600160a01b031614155b801561297557506129738184611f39565b155b1561299e5760405163a9fbf51f60e01b81526001600160a01b0384166004820152602401610bfd565b81156129e65783856001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b50505f90815260056020526040902080546001600160a01b0319166001600160a01b0392909216919091179055565b612a22838383612acb565b610e8e576001600160a01b038316612a5057604051637e27328960e01b815260048101829052602401610bfd565b60405163177e802f60e01b81526001600160a01b038316600482015260248101829052604401610bfd565b612a858383612b2c565b610e8e5f84848461244e565b5f600a60f883901c1015612ab757612aae60f883901c6030613d7f565b60f81b92915050565b612aae60f883901c6057613d7f565b919050565b5f6001600160a01b038316158015906126705750826001600160a01b0316846001600160a01b03161480612b045750612b048484611f39565b806126705750505f908152600560205260409020546001600160a01b03908116911614919050565b6001600160a01b038216612b5557604051633250574960e11b81525f6004820152602401610bfd565b5f612b6183835f61201f565b90506001600160a01b03811615610e8e576040516339e3563760e11b81525f6004820152602401610bfd565b6001600160e01b031981168114611fd7575f80fd5b5f60208284031215612bb2575f80fd5b8135612bbd81612b8d565b9392505050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f612bbd6020830184612bc4565b5f60208284031215612c14575f80fd5b5035919050565b80356001600160a01b0381168114612ac6575f80fd5b5f8060408385031215612c42575f80fd5b612c4b83612c1b565b946020939093013593505050565b5f805f60608486031215612c6b575f80fd5b612c7484612c1b565b9250612c8260208501612c1b565b929592945050506040919091013590565b5f60208284031215612ca3575f80fd5b81356001600160401b0381168114612bbd575f80fd5b5f60208284031215612cc9575f80fd5b612bbd82612c1b565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b0381118282101715612d0e57612d0e612cd2565b604052919050565b5f6001600160401b03821115612d2e57612d2e612cd2565b50601f01601f191660200190565b5f82601f830112612d4b575f80fd5b8135602083015f612d63612d5e84612d16565b612ce6565b9050828152858383011115612d76575f80fd5b828260208301375f92810160200192909252509392505050565b5f8060408385031215612da1575f80fd5b82356001600160401b03811115612db6575f80fd5b612dc285828601612d3c565b95602094909401359450505050565b5f8083601f840112612de1575f80fd5b5081356001600160401b03811115612df7575f80fd5b602083019150836020828501011115612e0e575f80fd5b9250929050565b5f805f8060408587031215612e28575f80fd5b84356001600160401b03811115612e3d575f80fd5b612e4987828801612dd1565b90955093505060208501356001600160401b03811115612e67575f80fd5b612e7387828801612dd1565b95989497509550505050565b5f8060208385031215612e90575f80fd5b82356001600160401b03811115612ea5575f80fd5b612eb185828601612dd1565b90969095509350505050565b60a081525f612ecf60a0830188612bc4565b8281036020840152612ee18188612bc4565b90508281036040840152612ef58187612bc4565b606084019590955250506001600160a01b03919091166080909101529392505050565b5f60208284031215612f28575f80fd5b81356001600160401b03811115612f3d575f80fd5b61267084828501612d3c565b60018060a01b0385168152836020820152608060408201525f612f6f6080830185612bc4565b8281036060840152612f818185612bc4565b979650505050505050565b5f8060408385031215612f9d575f80fd5b8235915060208301356001600160401b03811115612fb9575f80fd5b612fc585828601612d3c565b9150509250929050565b5f805f805f805f8060a0898b031215612fe6575f80fd5b612fef89612c1b565b975060208901356001600160401b03811115613009575f80fd5b6130158b828c01612dd1565b90985096505060408901356001600160401b03811115613033575f80fd5b61303f8b828c01612dd1565b90965094505060608901356001600160401b0381111561305d575f80fd5b6130698b828c01612dd1565b999c989b50969995989497949560800135949350505050565b8015158114611fd7575f80fd5b5f80604083850312156130a0575f80fd5b6130a983612c1b565b915060208301356130b981613082565b809150509250929050565b5f805f805f805f6080888a0312156130da575f80fd5b8735965060208801356001600160401b038111156130f6575f80fd5b6131028a828b01612dd1565b90975095505060408801356001600160401b03811115613120575f80fd5b61312c8a828b01612dd1565b90955093505060608801356001600160401b0381111561314a575f80fd5b6131568a828b01612dd1565b989b979a50959850939692959293505050565b5f805f805f6060868803121561317d575f80fd5b8535945060208601356001600160401b03811115613199575f80fd5b6131a588828901612dd1565b90955093505060408601356001600160401b038111156131c3575f80fd5b6131cf88828901612dd1565b969995985093965092949392505050565b5f805f80608085870312156131f3575f80fd5b6131fc85612c1b565b935061320a60208601612c1b565b92506040850135915060608501356001600160401b0381111561322b575f80fd5b61323787828801612d3c565b91505092959194509250565b5f805f805f8060608789031215613258575f80fd5b86356001600160401b0381111561326d575f80fd5b61327989828a01612dd1565b90975095505060208701356001600160401b03811115613297575f80fd5b6132a389828a01612dd1565b90955093505060408701356001600160401b038111156132c1575f80fd5b6132cd89828a01612dd1565b979a9699509497509295939492505050565b5f80604083850312156132f0575f80fd5b6132f983612c1b565b915061330760208401612c1b565b90509250929050565b600181811c9082168061332457607f821691505b60208210810361334257634e487b7160e01b5f52602260045260245ffd5b50919050565b5f60208284031215613358575f80fd5b8151612bbd81613082565b5f81518060208401855e5f93019283525090919050565b8281525f6126706020830184613363565b818382375f9101908152919050565b601f821115610e8e57805f5260205f20601f840160051c810160208510156133bf5750805b601f840160051c820191505b8181101561256d575f81556001016133cb565b6001600160401b038311156133f5576133f5612cd2565b613409836134038354613310565b8361339a565b5f601f84116001811461343a575f85156134235750838201355b5f19600387901b1c1916600186901b17835561256d565b5f83815260208120601f198716915b828110156134695786850135825560209485019460019092019101613449565b5086821015613485575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b5f81546134a381613310565b6001821680156134ba57600181146134cf576134fc565b60ff19831686528115158202860193506134fc565b845f5260205f205f5b838110156134f4578154888201526001909101906020016134d8565b505081860193505b50505092915050565b5f6135108285613497565b622d2d2d60e81b81526135266003820185613497565b95945050505050565b5f612bbd8284613363565b634e487b7160e01b5f52601160045260245ffd5b80820180821115610a8057610a8061353a565b838582375f848201622d2d2d60e81b8152838560038301375f93016003019283525090949350505050565b8082028115828204841417610a8057610a8061353a565b634e487b7160e01b5f52601260045260245ffd5b5f826135c5576135c56135a3565b500490565b81810381811115610a8057610a8061353a565b81516001600160401b038111156135f6576135f6612cd2565b61360a816136048454613310565b8461339a565b6020601f82116001811461363c575f83156136255750848201515b5f19600385901b1c1916600184901b17845561256d565b5f84815260208120601f198516915b8281101561366b578785015182556020948501946001909201910161364b565b508482101561368857868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b5f600182016136a8576136a861353a565b5060010190565b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b602081525f6126706020830184866136af565b5f602082840312156136fa575f80fd5b5051919050565b838152604060208201525f6135266040830184866136af565b604081525f61372d6040830186886136af565b8281036020840152612f818185876136af565b5f612bbd8284613497565b87815286602082015260a060408201525f80875461376881613310565b8060a0860152600182165f811461378657600181146137a2576137d3565b60ff19831660c087015260c082151560051b87010193506137d3565b8a5f5260205f205f5b838110156137ca57815488820160c001526001909101906020016137ab565b870160c0019450505b50505082810360608401526137e98187896136af565b905082810360808401526137fe8185876136af565b9a9950505050505050505050565b683d913730b6b2911d1160b91b81525f6138296009830189613497565b7f222c202261747472696275746573223a205b7b2274726169745f74797065223a81527f2022706f7369746976655f70726f6d7074222c202276616c7565223a20220000602082015261387f603e820189613497565b7f227d2c207b2274726169745f74797065223a20226e656761746976655f70726f81526f36b83a111610113b30b63ab2911d101160811b602082015290506138ca6030820188613497565b7f227d2c207b2274726169745f74797065223a202273656564222c202276616c7581526432911d101160d91b6020820152905061390a6025820187613363565b7f227d2c207b2274726169745f74797065223a2022617574686f72222c202276618152680d8eaca4474404460f60bb1b6020820152905061394e6029820186613363565b7f227d2c207b2274726169745f74797065223a20226d6f64656c222c202276616c81527f7565223a2022537461626c6520446966667573696f6e227d5d2c20226465736360208201527f72697074696f6e223a2022537461626c6520446966667573696f6e206973206160408201527f206c6174656e7420746578742d746f2d696d61676520646966667573696f6e2060608201527f6d6f64656c2063617061626c65206f662067656e65726174696e672070686f7460808201527f6f2d7265616c697374696320696d6167657320676976656e20616e792074657860a08201527f7420696e7075742e222c2022696d616765223a202268747470733a2f2f67617460c08201527f657761792e70696e6174612e636c6f75642f697066732f00000000000000000060e0820152905060f781016137fe613a8e8287613363565b61227d60f01b815260020190565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000081525f612bbd601d830184613363565b5f60208284031215613add575f80fd5b81516001600160401b03811115613af2575f80fd5b8201601f81018413613b02575f80fd5b8051613b10612d5e82612d16565b818152856020838501011115613b24575f80fd5b8160208401602083015e5f91810160200191909152949350505050565b84815260a060208201525f613b5960a0830186612bc4565b6001600160a01b03949094166040830152506001600160401b039190911660608201528082036080909101525f815260200192915050565b84815260018060a01b0384166020820152826040820152608060608201525f613bbd6080830184612bc4565b9695505050505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190525f90613bbd90830184612bc4565b5f60208284031215613c09575f80fd5b8151612bbd81612b8d565b5f82613c2257613c226135a3565b500690565b634e487b7160e01b5f52603260045260245ffd5b6001815b6001841115613c7657808504811115613c5a57613c5a61353a565b6001841615613c6857908102905b60019390931c928002613c3f565b935093915050565b5f82613c8c57506001610a80565b81613c9857505f610a80565b8160018114613cae5760028114613cb857613cd4565b6001915050610a80565b60ff841115613cc957613cc961353a565b50506001821b610a80565b5060208310610133831016604e8410600b8410161715613cf7575081810a610a80565b613d035f198484613c3b565b805f1904821115613d1657613d1661353a565b029392505050565b5f612bbd8383613c7e565b5f60ff831680613d3b57613d3b6135a3565b8060ff84160491505092915050565b60ff81811683821602908116908181146127aa576127aa61353a565b60ff8281168282160390811115610a8057610a8061353a565b60ff8181168382160190811115610a8057610a8061353a56fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa2646970667358221220808320eb0f90e86c77112a89f3d8478a0ded26f64f573f7b9de3ebf0a0f9965c64736f6c634300081a0033a2646970667358221220cada4488dc8c1a7c287c4405f6814241cf9a44319a8e52cc7cc7b25a352a204564736f6c634300081a0033 | |
1 | 20,291,251 | 508d8ecf4258c9f67d0f266ed1393cf8f2584f7332f0754d95b6b82709bf0afa | f91ae338f8d561bcf1af7523744b11cd1a185b45a13e382f07d9d59a88d3d864 | 6939bf07c119470defcdbf84f4b413736795b8e5 | 3dc3b756ec5e4ec9a5deba49e2cbf8e21d276286 | acac6eda912e66ba2a94c8c2e2e2d93e92a9409e | 3d60ad80600a3d3981f3363d3d373d3d3d363d732823c188d7897f69472f003027b326c0e78ce7f65af43d82803e903d91602b57fd5bf344454641554c545f4143434f554e545f53414c5400000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000003dc3b756ec5e4ec9a5deba49e2cbf8e21d276286000000000000000000000000000000000000000000000000000000000000013e | 363d3d373d3d3d363d732823c188d7897f69472f003027b326c0e78ce7f65af43d82803e903d91602b57fd5bf344454641554c545f4143434f554e545f53414c5400000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000003dc3b756ec5e4ec9a5deba49e2cbf8e21d276286000000000000000000000000000000000000000000000000000000000000013e | |
1 | 20,291,257 | 659465b3463c0a72ba7810782edab48ae52e640923929cdf4eeee5ce6d8c2b1a | 55d008ac121e403930a761abb929f61f37294f430e3b3da03f88fb38d8bea45f | 5b232c181df0e3ecd84171bde172f1a69f17204b | 5b232c181df0e3ecd84171bde172f1a69f17204b | cbdd201e33e5dc72b2f0ad519949e2fbe86acc3d | 608060405269d3c21bcecceda10000005f1961001b91906106ad565b5f19610027919061070a565b6006555f60085560146009555f600a556014600b55600a54600c55600b54600d55600c54600e55600d54600f553360105f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055503360115f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505f601360156101000a81548160ff0219169083151502179055506001601360166101000a81548160ff02191690831515021790555069043c33c193756480000060145569043c33c1937564800000601555683635c9adc5dea0000060165534801561013d575f80fd5b505f61014d61064960201b60201c565b9050805f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff165f73ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35060065460025f6101fd61064960201b60201c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055505f737a250d5630b4cf539739df2c5dacb4c659f2488d90508060125f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102db573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102ff919061079b565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610364573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610388919061079b565b6040518363ffffffff1660e01b81526004016103a59291906107d5565b6020604051808303815f875af11580156103c1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103e5919061079b565b60135f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160055f61043761065060201b60201c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff021916908315150217905550600160055f3073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff021916908315150217905550600160055f60105f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff021916908315150217905550600160055f60115f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055506105d561064960201b60201c565b73ffffffffffffffffffffffffffffffffffffffff165f73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef69d3c21bcecceda100000060405161063b919061080b565b60405180910390a350610824565b5f33905090565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b5f819050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f6106b782610677565b91506106c283610677565b9250826106d2576106d1610680565b5b828206905092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61071482610677565b915061071f83610677565b9250828203905081811115610737576107366106dd565b5b92915050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61076a82610741565b9050919050565b61077a81610760565b8114610784575f80fd5b50565b5f8151905061079581610771565b92915050565b5f602082840312156107b0576107af61073d565b5b5f6107bd84828501610787565b91505092915050565b6107cf81610760565b82525050565b5f6040820190506107e85f8301856107c6565b6107f560208301846107c6565b9392505050565b61080581610677565b82525050565b5f60208201905061081e5f8301846107fc565b92915050565b6139c6806108315f395ff3fe608060405260043610610184575f3560e01c80637d1db4a5116100d0578063a9059cbb11610089578063c9567bf911610063578063c9567bf91461052d578063dd62ed3e14610543578063ea1644d51461057f578063f2fde38b146105a75761018b565b8063a9059cbb146104b3578063c3c8cd80146104ef578063c492f046146105055761018b565b80637d1db4a5146103bb5780638da5cb5b146103e55780638f9a55c01461040f57806395d89b411461043957806398a5c31514610463578063a2a957bb1461048b5761018b565b8063313ce5671161013d5780636fc3eaec116101175780636fc3eaec1461032b57806370a0823114610341578063715018a61461037d57806374010ece146103935761018b565b8063313ce567146102af57806349bd5a5e146102d95780636d8aa8f8146103035761018b565b806306fdde031461018f578063095ea7b3146101b95780631694505e146101f557806318160ddd1461021f57806323b872dd146102495780632fd689e3146102855761018b565b3661018b57005b5f80fd5b34801561019a575f80fd5b506101a36105cf565b6040516101b09190612879565b60405180910390f35b3480156101c4575f80fd5b506101df60048036038101906101da919061292e565b61060c565b6040516101ec9190612986565b60405180910390f35b348015610200575f80fd5b50610209610629565b60405161021691906129fa565b60405180910390f35b34801561022a575f80fd5b5061023361064e565b6040516102409190612a22565b60405180910390f35b348015610254575f80fd5b5061026f600480360381019061026a9190612a3b565b61065f565b60405161027c9190612986565b60405180910390f35b348015610290575f80fd5b50610299610733565b6040516102a69190612a22565b60405180910390f35b3480156102ba575f80fd5b506102c3610739565b6040516102d09190612aa6565b60405180910390f35b3480156102e4575f80fd5b506102ed610741565b6040516102fa9190612ace565b60405180910390f35b34801561030e575f80fd5b5061032960048036038101906103249190612b11565b610766565b005b348015610336575f80fd5b5061033f610817565b005b34801561034c575f80fd5b5061036760048036038101906103629190612b3c565b6108e4565b6040516103749190612a22565b60405180910390f35b348015610388575f80fd5b50610391610932565b005b34801561039e575f80fd5b506103b960048036038101906103b49190612b67565b610a80565b005b3480156103c6575f80fd5b506103cf610b1e565b6040516103dc9190612a22565b60405180910390f35b3480156103f0575f80fd5b506103f9610b24565b6040516104069190612ace565b60405180910390f35b34801561041a575f80fd5b50610423610b4b565b6040516104309190612a22565b60405180910390f35b348015610444575f80fd5b5061044d610b51565b60405161045a9190612879565b60405180910390f35b34801561046e575f80fd5b5061048960048036038101906104849190612b67565b610b8e565b005b348015610496575f80fd5b506104b160048036038101906104ac9190612b92565b610c2c565b005b3480156104be575f80fd5b506104d960048036038101906104d4919061292e565b610e22565b6040516104e69190612986565b60405180910390f35b3480156104fa575f80fd5b50610503610e3f565b005b348015610510575f80fd5b5061052b60048036038101906105269190612c57565b610f14565b005b348015610538575f80fd5b50610541611043565b005b34801561054e575f80fd5b5061056960048036038101906105649190612cb4565b611149565b6040516105769190612a22565b60405180910390f35b34801561058a575f80fd5b506105a560048036038101906105a09190612b67565b6111cb565b005b3480156105b2575f80fd5b506105cd60048036038101906105c89190612b3c565b611269565b005b60606040518060400160405280600e81526020017f42756e646c6553686f7743617365000000000000000000000000000000000000815250905090565b5f61061f610618611426565b848461142d565b6001905092915050565b60125f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f69d3c21bcecceda1000000905090565b5f61066b8484846115f0565b61072884610677611426565b610723856040518060600160405280602881526020016139696028913960045f8b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6106da611426565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054611d759092919063ffffffff16565b61142d565b600190509392505050565b60165481565b5f6012905090565b60135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61076e611426565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107f190612d3c565b60405180910390fd5b80601360166101000a81548160ff02191690831515021790555050565b60105f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610857611426565b73ffffffffffffffffffffffffffffffffffffffff1614806108cc575060115f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108b4611426565b73ffffffffffffffffffffffffffffffffffffffff16145b6108d4575f80fd5b5f4790506108e181611dd7565b50565b5f61092b60025f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054611e3f565b9050919050565b61093a611426565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109bd90612d3c565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35f805f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610a88611426565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b0b90612d3c565b60405180910390fd5b8060148190555050565b60145481565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60155481565b60606040518060400160405280600381526020017f4253430000000000000000000000000000000000000000000000000000000000815250905090565b610b96611426565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c1990612d3c565b60405180910390fd5b8060168190555050565b610c34611426565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cc0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cb790612d3c565b60405180910390fd5b5f8410158015610cd1575060048411155b610d10576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0790612dca565b60405180910390fd5b5f8210158015610d21575060148211155b610d60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5790612e58565b60405180910390fd5b5f8310158015610d71575060048311155b610db0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610da790612ee6565b60405180910390fd5b5f8110158015610dc1575060288111155b610e00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610df790612f74565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b5f610e35610e2e611426565b84846115f0565b6001905092915050565b60105f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610e7f611426565b73ffffffffffffffffffffffffffffffffffffffff161480610ef4575060115f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610edc611426565b73ffffffffffffffffffffffffffffffffffffffff16145b610efc575f80fd5b5f610f06306108e4565b9050610f1181611eab565b50565b610f1c611426565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fa8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f9f90612d3c565b60405180910390fd5b5f5b8383905081101561103d578160055f868685818110610fcc57610fcb612f92565b5b9050602002016020810190610fe19190612b3c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055508080600101915050610faa565b50505050565b61104b611426565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110ce90612d3c565b60405180910390fd5b5f1515601360149054906101000a900460ff1615151461112c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112390613009565b60405180910390fd5b6001601360146101000a81548160ff021916908315150217905550565b5f60045f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905092915050565b6111d3611426565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461125f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161125690612d3c565b60405180910390fd5b8060158190555050565b611271611426565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112f490612d3c565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361136b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136290613097565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3805f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b5f33905090565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361149b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161149290613125565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611509576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611500906131b3565b60405180910390fd5b8060045f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115e39190612a22565b60405180910390a3505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361165e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165590613241565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036116cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116c3906132cf565b60405180910390fd5b5f811161170e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117059061335d565b60405180910390fd5b611716610b24565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156117845750611754610b24565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a8257601360149054906101000a900460ff16611813576117a5610b24565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611812576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611809906133eb565b60405180910390fd5b5b601454811115611858576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161184f90613453565b60405180910390fd5b60135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161461190457601554816118b9846108e4565b6118c3919061349e565b10611903576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118fa90613541565b60405180910390fd5b5b5f61190e306108e4565b90505f601654821015905060145482106119285760145491505b8080156119425750601360159054906101000a900460ff16155b801561199b575060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b80156119b35750601360169054906101000a900460ff165b8015611a06575060055f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16155b8015611a59575060055f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16155b15611a7f57611a6782611eab565b5f4790505f811115611a7d57611a7c47611dd7565b5b505b50505b5f6001905060055f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff1680611b22575060055f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff165b80611bd3575060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611bd2575060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611be0575f9050611d63565b60135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611c89575060125f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611ca157600854600c81905550600954600d819055505b60135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611d4a575060125f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611d6257600a54600c81905550600b54600d819055505b5b611d6f84848484612116565b50505050565b5f838311158290611dbc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611db39190612879565b60405180910390fd5b505f8385611dca919061355f565b9050809150509392505050565b60115f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc8290811502906040515f60405180830381858888f19350505050158015611e3b573d5f803e3d5ffd5b5050565b5f600654821115611e85576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e7c90613602565b60405180910390fd5b5f611e8e612143565b9050611ea3818461216c90919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055505f600267ffffffffffffffff811115611ee257611ee1613620565b5b604051908082528060200260200182016040528015611f105781602001602082028036833780820191505090505b50905030815f81518110611f2757611f26612f92565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060125f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611fcb573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611fef9190613661565b8160018151811061200357612002612f92565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506120693060125f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461142d565b60125f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac947835f8430426040518663ffffffff1660e01b81526004016120cb95949392919061377c565b5f604051808303815f87803b1580156120e2575f80fd5b505af11580156120f4573d5f803e3d5ffd5b50505050505f601360156101000a81548160ff02191690831515021790555050565b80612124576121236121b5565b5b61212f8484846121ee565b8061213d5761213c6123ae565b5b50505050565b5f805f61214e6123c2565b91509150612165818361216c90919063ffffffff16565b9250505090565b5f6121ad83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612424565b905092915050565b5f600c541480156121c757505f600d54145b6121ec57600c54600e81905550600d54600f819055505f600c819055505f600d819055505b565b5f805f805f806121fd87612485565b9550955095509550955095506122598660025f8c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20546124e590919063ffffffff16565b60025f8b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055506122ea8560025f8b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205461252e90919063ffffffff16565b60025f8a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055506123348161258b565b61233e8483612642565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161239b9190612a22565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b5f805f60065490505f69d3c21bcecceda100000090506123f769d3c21bcecceda100000060065461216c90919063ffffffff16565b8210156124175760065469d3c21bcecceda1000000935093505050612420565b81819350935050505b9091565b5f808311829061246a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124619190612879565b60405180910390fd5b505f83856124789190613801565b9050809150509392505050565b5f805f805f805f805f61249d8a600c54600d5461267c565b9250925092505f6124ac612143565b90505f805f6124bd8e87878761270e565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b5f61252683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d75565b905092915050565b5f80828461253c919061349e565b905083811015612581576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125789061387b565b60405180910390fd5b8091505092915050565b5f612594612143565b90505f6125aa828461279290919063ffffffff16565b90506125fc8160025f3073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205461252e90919063ffffffff16565b60025f3073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550505050565b612657826006546124e590919063ffffffff16565b6006819055506126728160075461252e90919063ffffffff16565b6007819055505050565b5f805f806126a66064612698888a61279290919063ffffffff16565b61216c90919063ffffffff16565b90505f6126cf60646126c1888b61279290919063ffffffff16565b61216c90919063ffffffff16565b90505f6126f7826126e9858c6124e590919063ffffffff16565b6124e590919063ffffffff16565b905080838395509550955050505093509350939050565b5f805f80612725858961279290919063ffffffff16565b90505f61273b868961279290919063ffffffff16565b90505f612751878961279290919063ffffffff16565b90505f6127798261276b85876124e590919063ffffffff16565b6124e590919063ffffffff16565b9050838184965096509650505050509450945094915050565b5f8083036127a2575f9050612803565b5f82846127af9190613899565b90508284826127be9190613801565b146127fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127f59061394a565b60405180910390fd5b809150505b92915050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f61284b82612809565b6128558185612813565b9350612865818560208601612823565b61286e81612831565b840191505092915050565b5f6020820190508181035f8301526128918184612841565b905092915050565b5f80fd5b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6128ca826128a1565b9050919050565b6128da816128c0565b81146128e4575f80fd5b50565b5f813590506128f5816128d1565b92915050565b5f819050919050565b61290d816128fb565b8114612917575f80fd5b50565b5f8135905061292881612904565b92915050565b5f806040838503121561294457612943612899565b5b5f612951858286016128e7565b92505060206129628582860161291a565b9150509250929050565b5f8115159050919050565b6129808161296c565b82525050565b5f6020820190506129995f830184612977565b92915050565b5f819050919050565b5f6129c26129bd6129b8846128a1565b61299f565b6128a1565b9050919050565b5f6129d3826129a8565b9050919050565b5f6129e4826129c9565b9050919050565b6129f4816129da565b82525050565b5f602082019050612a0d5f8301846129eb565b92915050565b612a1c816128fb565b82525050565b5f602082019050612a355f830184612a13565b92915050565b5f805f60608486031215612a5257612a51612899565b5b5f612a5f868287016128e7565b9350506020612a70868287016128e7565b9250506040612a818682870161291a565b9150509250925092565b5f60ff82169050919050565b612aa081612a8b565b82525050565b5f602082019050612ab95f830184612a97565b92915050565b612ac8816128c0565b82525050565b5f602082019050612ae15f830184612abf565b92915050565b612af08161296c565b8114612afa575f80fd5b50565b5f81359050612b0b81612ae7565b92915050565b5f60208284031215612b2657612b25612899565b5b5f612b3384828501612afd565b91505092915050565b5f60208284031215612b5157612b50612899565b5b5f612b5e848285016128e7565b91505092915050565b5f60208284031215612b7c57612b7b612899565b5b5f612b898482850161291a565b91505092915050565b5f805f8060808587031215612baa57612ba9612899565b5b5f612bb78782880161291a565b9450506020612bc88782880161291a565b9350506040612bd98782880161291a565b9250506060612bea8782880161291a565b91505092959194509250565b5f80fd5b5f80fd5b5f80fd5b5f8083601f840112612c1757612c16612bf6565b5b8235905067ffffffffffffffff811115612c3457612c33612bfa565b5b602083019150836020820283011115612c5057612c4f612bfe565b5b9250929050565b5f805f60408486031215612c6e57612c6d612899565b5b5f84013567ffffffffffffffff811115612c8b57612c8a61289d565b5b612c9786828701612c02565b93509350506020612caa86828701612afd565b9150509250925092565b5f8060408385031215612cca57612cc9612899565b5b5f612cd7858286016128e7565b9250506020612ce8858286016128e7565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725f82015250565b5f612d26602083612813565b9150612d3182612cf2565b602082019050919050565b5f6020820190508181035f830152612d5381612d1a565b9050919050565b7f4275792072657761726473206d757374206265206265747765656e20302520615f8201527f6e64203425000000000000000000000000000000000000000000000000000000602082015250565b5f612db4602583612813565b9150612dbf82612d5a565b604082019050919050565b5f6020820190508181035f830152612de181612da8565b9050919050565b7f42757920746178206d757374206265206265747765656e20302520616e6420325f8201527f3025000000000000000000000000000000000000000000000000000000000000602082015250565b5f612e42602283612813565b9150612e4d82612de8565b604082019050919050565b5f6020820190508181035f830152612e6f81612e36565b9050919050565b7f53656c6c2072657761726473206d757374206265206265747765656e203025205f8201527f616e642034250000000000000000000000000000000000000000000000000000602082015250565b5f612ed0602683612813565b9150612edb82612e76565b604082019050919050565b5f6020820190508181035f830152612efd81612ec4565b9050919050565b7f53656c6c20746178206d757374206265206265747765656e20302520616e64205f8201527f3430250000000000000000000000000000000000000000000000000000000000602082015250565b5f612f5e602383612813565b9150612f6982612f04565b604082019050919050565b5f6020820190508181035f830152612f8b81612f52565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f54726164696e6720697320616c7265616479206f70656e6564000000000000005f82015250565b5f612ff3601983612813565b9150612ffe82612fbf565b602082019050919050565b5f6020820190508181035f83015261302081612fe7565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f20615f8201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b5f613081602683612813565b915061308c82613027565b604082019050919050565b5f6020820190508181035f8301526130ae81613075565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f206164645f8201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b5f61310f602483612813565b915061311a826130b5565b604082019050919050565b5f6020820190508181035f83015261313c81613103565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f2061646472655f8201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b5f61319d602283612813565b91506131a882613143565b604082019050919050565b5f6020820190508181035f8301526131ca81613191565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f2061645f8201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b5f61322b602583612813565b9150613236826131d1565b604082019050919050565b5f6020820190508181035f8301526132588161321f565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f20616464725f8201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b5f6132b9602383612813565b91506132c48261325f565b604082019050919050565b5f6020820190508181035f8301526132e6816132ad565b9050919050565b7f5472616e7366657220616d6f756e74206d7573742062652067726561746572205f8201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b5f613347602983612813565b9150613352826132ed565b604082019050919050565b5f6020820190508181035f8301526133748161333b565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e64205f8201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b5f6133d5603f83612813565b91506133e08261337b565b604082019050919050565b5f6020820190508181035f830152613402816133c9565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000005f82015250565b5f61343d601c83612813565b915061344882613409565b602082019050919050565b5f6020820190508181035f83015261346a81613431565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6134a8826128fb565b91506134b3836128fb565b92508282019050808211156134cb576134ca613471565b5b92915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073695f8201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b5f61352b602383612813565b9150613536826134d1565b604082019050919050565b5f6020820190508181035f8301526135588161351f565b9050919050565b5f613569826128fb565b9150613574836128fb565b925082820390508181111561358c5761358b613471565b5b92915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c20725f8201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b5f6135ec602a83612813565b91506135f782613592565b604082019050919050565b5f6020820190508181035f830152613619816135e0565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f8151905061365b816128d1565b92915050565b5f6020828403121561367657613675612899565b5b5f6136838482850161364d565b91505092915050565b5f819050919050565b5f6136af6136aa6136a58461368c565b61299f565b6128fb565b9050919050565b6136bf81613695565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6136f7816128c0565b82525050565b5f61370883836136ee565b60208301905092915050565b5f602082019050919050565b5f61372a826136c5565b61373481856136cf565b935061373f836136df565b805f5b8381101561376f57815161375688826136fd565b975061376183613714565b925050600181019050613742565b5085935050505092915050565b5f60a08201905061378f5f830188612a13565b61379c60208301876136b6565b81810360408301526137ae8186613720565b90506137bd6060830185612abf565b6137ca6080830184612a13565b9695505050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f61380b826128fb565b9150613816836128fb565b925082613826576138256137d4565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f7700000000005f82015250565b5f613865601b83612813565b915061387082613831565b602082019050919050565b5f6020820190508181035f83015261389281613859565b9050919050565b5f6138a3826128fb565b91506138ae836128fb565b92508282026138bc816128fb565b915082820484148315176138d3576138d2613471565b5b5092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f5f8201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b5f613934602183612813565b915061393f826138da565b604082019050919050565b5f6020820190508181035f83015261396181613928565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208f1dc58888ed789ae529c9300787af6ca8e540b109748c53a3f32869defbd98664736f6c634300081a0033 | 608060405260043610610184575f3560e01c80637d1db4a5116100d0578063a9059cbb11610089578063c9567bf911610063578063c9567bf91461052d578063dd62ed3e14610543578063ea1644d51461057f578063f2fde38b146105a75761018b565b8063a9059cbb146104b3578063c3c8cd80146104ef578063c492f046146105055761018b565b80637d1db4a5146103bb5780638da5cb5b146103e55780638f9a55c01461040f57806395d89b411461043957806398a5c31514610463578063a2a957bb1461048b5761018b565b8063313ce5671161013d5780636fc3eaec116101175780636fc3eaec1461032b57806370a0823114610341578063715018a61461037d57806374010ece146103935761018b565b8063313ce567146102af57806349bd5a5e146102d95780636d8aa8f8146103035761018b565b806306fdde031461018f578063095ea7b3146101b95780631694505e146101f557806318160ddd1461021f57806323b872dd146102495780632fd689e3146102855761018b565b3661018b57005b5f80fd5b34801561019a575f80fd5b506101a36105cf565b6040516101b09190612879565b60405180910390f35b3480156101c4575f80fd5b506101df60048036038101906101da919061292e565b61060c565b6040516101ec9190612986565b60405180910390f35b348015610200575f80fd5b50610209610629565b60405161021691906129fa565b60405180910390f35b34801561022a575f80fd5b5061023361064e565b6040516102409190612a22565b60405180910390f35b348015610254575f80fd5b5061026f600480360381019061026a9190612a3b565b61065f565b60405161027c9190612986565b60405180910390f35b348015610290575f80fd5b50610299610733565b6040516102a69190612a22565b60405180910390f35b3480156102ba575f80fd5b506102c3610739565b6040516102d09190612aa6565b60405180910390f35b3480156102e4575f80fd5b506102ed610741565b6040516102fa9190612ace565b60405180910390f35b34801561030e575f80fd5b5061032960048036038101906103249190612b11565b610766565b005b348015610336575f80fd5b5061033f610817565b005b34801561034c575f80fd5b5061036760048036038101906103629190612b3c565b6108e4565b6040516103749190612a22565b60405180910390f35b348015610388575f80fd5b50610391610932565b005b34801561039e575f80fd5b506103b960048036038101906103b49190612b67565b610a80565b005b3480156103c6575f80fd5b506103cf610b1e565b6040516103dc9190612a22565b60405180910390f35b3480156103f0575f80fd5b506103f9610b24565b6040516104069190612ace565b60405180910390f35b34801561041a575f80fd5b50610423610b4b565b6040516104309190612a22565b60405180910390f35b348015610444575f80fd5b5061044d610b51565b60405161045a9190612879565b60405180910390f35b34801561046e575f80fd5b5061048960048036038101906104849190612b67565b610b8e565b005b348015610496575f80fd5b506104b160048036038101906104ac9190612b92565b610c2c565b005b3480156104be575f80fd5b506104d960048036038101906104d4919061292e565b610e22565b6040516104e69190612986565b60405180910390f35b3480156104fa575f80fd5b50610503610e3f565b005b348015610510575f80fd5b5061052b60048036038101906105269190612c57565b610f14565b005b348015610538575f80fd5b50610541611043565b005b34801561054e575f80fd5b5061056960048036038101906105649190612cb4565b611149565b6040516105769190612a22565b60405180910390f35b34801561058a575f80fd5b506105a560048036038101906105a09190612b67565b6111cb565b005b3480156105b2575f80fd5b506105cd60048036038101906105c89190612b3c565b611269565b005b60606040518060400160405280600e81526020017f42756e646c6553686f7743617365000000000000000000000000000000000000815250905090565b5f61061f610618611426565b848461142d565b6001905092915050565b60125f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f69d3c21bcecceda1000000905090565b5f61066b8484846115f0565b61072884610677611426565b610723856040518060600160405280602881526020016139696028913960045f8b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6106da611426565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054611d759092919063ffffffff16565b61142d565b600190509392505050565b60165481565b5f6012905090565b60135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61076e611426565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107f190612d3c565b60405180910390fd5b80601360166101000a81548160ff02191690831515021790555050565b60105f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610857611426565b73ffffffffffffffffffffffffffffffffffffffff1614806108cc575060115f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108b4611426565b73ffffffffffffffffffffffffffffffffffffffff16145b6108d4575f80fd5b5f4790506108e181611dd7565b50565b5f61092b60025f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054611e3f565b9050919050565b61093a611426565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109bd90612d3c565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35f805f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610a88611426565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b0b90612d3c565b60405180910390fd5b8060148190555050565b60145481565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60155481565b60606040518060400160405280600381526020017f4253430000000000000000000000000000000000000000000000000000000000815250905090565b610b96611426565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c1990612d3c565b60405180910390fd5b8060168190555050565b610c34611426565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cc0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cb790612d3c565b60405180910390fd5b5f8410158015610cd1575060048411155b610d10576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0790612dca565b60405180910390fd5b5f8210158015610d21575060148211155b610d60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5790612e58565b60405180910390fd5b5f8310158015610d71575060048311155b610db0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610da790612ee6565b60405180910390fd5b5f8110158015610dc1575060288111155b610e00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610df790612f74565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b5f610e35610e2e611426565b84846115f0565b6001905092915050565b60105f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610e7f611426565b73ffffffffffffffffffffffffffffffffffffffff161480610ef4575060115f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610edc611426565b73ffffffffffffffffffffffffffffffffffffffff16145b610efc575f80fd5b5f610f06306108e4565b9050610f1181611eab565b50565b610f1c611426565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fa8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f9f90612d3c565b60405180910390fd5b5f5b8383905081101561103d578160055f868685818110610fcc57610fcb612f92565b5b9050602002016020810190610fe19190612b3c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055508080600101915050610faa565b50505050565b61104b611426565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110ce90612d3c565b60405180910390fd5b5f1515601360149054906101000a900460ff1615151461112c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112390613009565b60405180910390fd5b6001601360146101000a81548160ff021916908315150217905550565b5f60045f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905092915050565b6111d3611426565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461125f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161125690612d3c565b60405180910390fd5b8060158190555050565b611271611426565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112f490612d3c565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361136b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136290613097565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3805f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b5f33905090565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361149b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161149290613125565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611509576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611500906131b3565b60405180910390fd5b8060045f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115e39190612a22565b60405180910390a3505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361165e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165590613241565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036116cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116c3906132cf565b60405180910390fd5b5f811161170e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117059061335d565b60405180910390fd5b611716610b24565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156117845750611754610b24565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a8257601360149054906101000a900460ff16611813576117a5610b24565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611812576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611809906133eb565b60405180910390fd5b5b601454811115611858576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161184f90613453565b60405180910390fd5b60135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161461190457601554816118b9846108e4565b6118c3919061349e565b10611903576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118fa90613541565b60405180910390fd5b5b5f61190e306108e4565b90505f601654821015905060145482106119285760145491505b8080156119425750601360159054906101000a900460ff16155b801561199b575060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b80156119b35750601360169054906101000a900460ff165b8015611a06575060055f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16155b8015611a59575060055f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16155b15611a7f57611a6782611eab565b5f4790505f811115611a7d57611a7c47611dd7565b5b505b50505b5f6001905060055f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff1680611b22575060055f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff165b80611bd3575060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611bd2575060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611be0575f9050611d63565b60135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611c89575060125f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611ca157600854600c81905550600954600d819055505b60135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611d4a575060125f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611d6257600a54600c81905550600b54600d819055505b5b611d6f84848484612116565b50505050565b5f838311158290611dbc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611db39190612879565b60405180910390fd5b505f8385611dca919061355f565b9050809150509392505050565b60115f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc8290811502906040515f60405180830381858888f19350505050158015611e3b573d5f803e3d5ffd5b5050565b5f600654821115611e85576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e7c90613602565b60405180910390fd5b5f611e8e612143565b9050611ea3818461216c90919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055505f600267ffffffffffffffff811115611ee257611ee1613620565b5b604051908082528060200260200182016040528015611f105781602001602082028036833780820191505090505b50905030815f81518110611f2757611f26612f92565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060125f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611fcb573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611fef9190613661565b8160018151811061200357612002612f92565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506120693060125f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461142d565b60125f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac947835f8430426040518663ffffffff1660e01b81526004016120cb95949392919061377c565b5f604051808303815f87803b1580156120e2575f80fd5b505af11580156120f4573d5f803e3d5ffd5b50505050505f601360156101000a81548160ff02191690831515021790555050565b80612124576121236121b5565b5b61212f8484846121ee565b8061213d5761213c6123ae565b5b50505050565b5f805f61214e6123c2565b91509150612165818361216c90919063ffffffff16565b9250505090565b5f6121ad83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612424565b905092915050565b5f600c541480156121c757505f600d54145b6121ec57600c54600e81905550600d54600f819055505f600c819055505f600d819055505b565b5f805f805f806121fd87612485565b9550955095509550955095506122598660025f8c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20546124e590919063ffffffff16565b60025f8b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055506122ea8560025f8b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205461252e90919063ffffffff16565b60025f8a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055506123348161258b565b61233e8483612642565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161239b9190612a22565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b5f805f60065490505f69d3c21bcecceda100000090506123f769d3c21bcecceda100000060065461216c90919063ffffffff16565b8210156124175760065469d3c21bcecceda1000000935093505050612420565b81819350935050505b9091565b5f808311829061246a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124619190612879565b60405180910390fd5b505f83856124789190613801565b9050809150509392505050565b5f805f805f805f805f61249d8a600c54600d5461267c565b9250925092505f6124ac612143565b90505f805f6124bd8e87878761270e565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b5f61252683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d75565b905092915050565b5f80828461253c919061349e565b905083811015612581576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125789061387b565b60405180910390fd5b8091505092915050565b5f612594612143565b90505f6125aa828461279290919063ffffffff16565b90506125fc8160025f3073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205461252e90919063ffffffff16565b60025f3073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550505050565b612657826006546124e590919063ffffffff16565b6006819055506126728160075461252e90919063ffffffff16565b6007819055505050565b5f805f806126a66064612698888a61279290919063ffffffff16565b61216c90919063ffffffff16565b90505f6126cf60646126c1888b61279290919063ffffffff16565b61216c90919063ffffffff16565b90505f6126f7826126e9858c6124e590919063ffffffff16565b6124e590919063ffffffff16565b905080838395509550955050505093509350939050565b5f805f80612725858961279290919063ffffffff16565b90505f61273b868961279290919063ffffffff16565b90505f612751878961279290919063ffffffff16565b90505f6127798261276b85876124e590919063ffffffff16565b6124e590919063ffffffff16565b9050838184965096509650505050509450945094915050565b5f8083036127a2575f9050612803565b5f82846127af9190613899565b90508284826127be9190613801565b146127fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127f59061394a565b60405180910390fd5b809150505b92915050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f61284b82612809565b6128558185612813565b9350612865818560208601612823565b61286e81612831565b840191505092915050565b5f6020820190508181035f8301526128918184612841565b905092915050565b5f80fd5b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6128ca826128a1565b9050919050565b6128da816128c0565b81146128e4575f80fd5b50565b5f813590506128f5816128d1565b92915050565b5f819050919050565b61290d816128fb565b8114612917575f80fd5b50565b5f8135905061292881612904565b92915050565b5f806040838503121561294457612943612899565b5b5f612951858286016128e7565b92505060206129628582860161291a565b9150509250929050565b5f8115159050919050565b6129808161296c565b82525050565b5f6020820190506129995f830184612977565b92915050565b5f819050919050565b5f6129c26129bd6129b8846128a1565b61299f565b6128a1565b9050919050565b5f6129d3826129a8565b9050919050565b5f6129e4826129c9565b9050919050565b6129f4816129da565b82525050565b5f602082019050612a0d5f8301846129eb565b92915050565b612a1c816128fb565b82525050565b5f602082019050612a355f830184612a13565b92915050565b5f805f60608486031215612a5257612a51612899565b5b5f612a5f868287016128e7565b9350506020612a70868287016128e7565b9250506040612a818682870161291a565b9150509250925092565b5f60ff82169050919050565b612aa081612a8b565b82525050565b5f602082019050612ab95f830184612a97565b92915050565b612ac8816128c0565b82525050565b5f602082019050612ae15f830184612abf565b92915050565b612af08161296c565b8114612afa575f80fd5b50565b5f81359050612b0b81612ae7565b92915050565b5f60208284031215612b2657612b25612899565b5b5f612b3384828501612afd565b91505092915050565b5f60208284031215612b5157612b50612899565b5b5f612b5e848285016128e7565b91505092915050565b5f60208284031215612b7c57612b7b612899565b5b5f612b898482850161291a565b91505092915050565b5f805f8060808587031215612baa57612ba9612899565b5b5f612bb78782880161291a565b9450506020612bc88782880161291a565b9350506040612bd98782880161291a565b9250506060612bea8782880161291a565b91505092959194509250565b5f80fd5b5f80fd5b5f80fd5b5f8083601f840112612c1757612c16612bf6565b5b8235905067ffffffffffffffff811115612c3457612c33612bfa565b5b602083019150836020820283011115612c5057612c4f612bfe565b5b9250929050565b5f805f60408486031215612c6e57612c6d612899565b5b5f84013567ffffffffffffffff811115612c8b57612c8a61289d565b5b612c9786828701612c02565b93509350506020612caa86828701612afd565b9150509250925092565b5f8060408385031215612cca57612cc9612899565b5b5f612cd7858286016128e7565b9250506020612ce8858286016128e7565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725f82015250565b5f612d26602083612813565b9150612d3182612cf2565b602082019050919050565b5f6020820190508181035f830152612d5381612d1a565b9050919050565b7f4275792072657761726473206d757374206265206265747765656e20302520615f8201527f6e64203425000000000000000000000000000000000000000000000000000000602082015250565b5f612db4602583612813565b9150612dbf82612d5a565b604082019050919050565b5f6020820190508181035f830152612de181612da8565b9050919050565b7f42757920746178206d757374206265206265747765656e20302520616e6420325f8201527f3025000000000000000000000000000000000000000000000000000000000000602082015250565b5f612e42602283612813565b9150612e4d82612de8565b604082019050919050565b5f6020820190508181035f830152612e6f81612e36565b9050919050565b7f53656c6c2072657761726473206d757374206265206265747765656e203025205f8201527f616e642034250000000000000000000000000000000000000000000000000000602082015250565b5f612ed0602683612813565b9150612edb82612e76565b604082019050919050565b5f6020820190508181035f830152612efd81612ec4565b9050919050565b7f53656c6c20746178206d757374206265206265747765656e20302520616e64205f8201527f3430250000000000000000000000000000000000000000000000000000000000602082015250565b5f612f5e602383612813565b9150612f6982612f04565b604082019050919050565b5f6020820190508181035f830152612f8b81612f52565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f54726164696e6720697320616c7265616479206f70656e6564000000000000005f82015250565b5f612ff3601983612813565b9150612ffe82612fbf565b602082019050919050565b5f6020820190508181035f83015261302081612fe7565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f20615f8201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b5f613081602683612813565b915061308c82613027565b604082019050919050565b5f6020820190508181035f8301526130ae81613075565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f206164645f8201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b5f61310f602483612813565b915061311a826130b5565b604082019050919050565b5f6020820190508181035f83015261313c81613103565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f2061646472655f8201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b5f61319d602283612813565b91506131a882613143565b604082019050919050565b5f6020820190508181035f8301526131ca81613191565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f2061645f8201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b5f61322b602583612813565b9150613236826131d1565b604082019050919050565b5f6020820190508181035f8301526132588161321f565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f20616464725f8201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b5f6132b9602383612813565b91506132c48261325f565b604082019050919050565b5f6020820190508181035f8301526132e6816132ad565b9050919050565b7f5472616e7366657220616d6f756e74206d7573742062652067726561746572205f8201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b5f613347602983612813565b9150613352826132ed565b604082019050919050565b5f6020820190508181035f8301526133748161333b565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e64205f8201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b5f6133d5603f83612813565b91506133e08261337b565b604082019050919050565b5f6020820190508181035f830152613402816133c9565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000005f82015250565b5f61343d601c83612813565b915061344882613409565b602082019050919050565b5f6020820190508181035f83015261346a81613431565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6134a8826128fb565b91506134b3836128fb565b92508282019050808211156134cb576134ca613471565b5b92915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073695f8201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b5f61352b602383612813565b9150613536826134d1565b604082019050919050565b5f6020820190508181035f8301526135588161351f565b9050919050565b5f613569826128fb565b9150613574836128fb565b925082820390508181111561358c5761358b613471565b5b92915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c20725f8201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b5f6135ec602a83612813565b91506135f782613592565b604082019050919050565b5f6020820190508181035f830152613619816135e0565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f8151905061365b816128d1565b92915050565b5f6020828403121561367657613675612899565b5b5f6136838482850161364d565b91505092915050565b5f819050919050565b5f6136af6136aa6136a58461368c565b61299f565b6128fb565b9050919050565b6136bf81613695565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6136f7816128c0565b82525050565b5f61370883836136ee565b60208301905092915050565b5f602082019050919050565b5f61372a826136c5565b61373481856136cf565b935061373f836136df565b805f5b8381101561376f57815161375688826136fd565b975061376183613714565b925050600181019050613742565b5085935050505092915050565b5f60a08201905061378f5f830188612a13565b61379c60208301876136b6565b81810360408301526137ae8186613720565b90506137bd6060830185612abf565b6137ca6080830184612a13565b9695505050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f61380b826128fb565b9150613816836128fb565b925082613826576138256137d4565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f7700000000005f82015250565b5f613865601b83612813565b915061387082613831565b602082019050919050565b5f6020820190508181035f83015261389281613859565b9050919050565b5f6138a3826128fb565b91506138ae836128fb565b92508282026138bc816128fb565b915082820484148315176138d3576138d2613471565b5b5092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f5f8201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b5f613934602183612813565b915061393f826138da565b604082019050919050565b5f6020820190508181035f83015261396181613928565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208f1dc58888ed789ae529c9300787af6ca8e540b109748c53a3f32869defbd98664736f6c634300081a0033 | |
1 | 20,291,257 | 659465b3463c0a72ba7810782edab48ae52e640923929cdf4eeee5ce6d8c2b1a | 55d008ac121e403930a761abb929f61f37294f430e3b3da03f88fb38d8bea45f | 5b232c181df0e3ecd84171bde172f1a69f17204b | 5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f | 57dd1de5d27c67b399823b901860e28fd778325c | 60806040526001600c5534801561001557600080fd5b506040514690806052612d228239604080519182900360520182208282018252600a8352692ab734b9bbb0b8102b1960b11b6020938401528151808301835260018152603160f81b908401528151808401919091527fbfcc8ef98ffbf7b6c3fec7bf5185b566b9863e35a9d83acd49ad6824b5969738818301527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606082015260808101949094523060a0808601919091528151808603909101815260c09094019052825192019190912060035550600580546001600160a01b03191633179055612c1d806101056000396000f3fe608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429 | 608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032 | // File: contracts/interfaces/IUniswapV2Pair.sol
pragma solidity >=0.5.0;
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
// File: contracts/interfaces/IUniswapV2ERC20.sol
pragma solidity >=0.5.0;
interface IUniswapV2ERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
}
// File: contracts/libraries/SafeMath.sol
pragma solidity =0.5.16;
// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)
library SafeMath {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x, 'ds-math-add-overflow');
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x, 'ds-math-sub-underflow');
}
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');
}
}
// File: contracts/UniswapV2ERC20.sol
pragma solidity =0.5.16;
contract UniswapV2ERC20 is IUniswapV2ERC20 {
using SafeMath for uint;
string public constant name = 'Uniswap V2';
string public constant symbol = 'UNI-V2';
uint8 public constant decimals = 18;
uint public totalSupply;
mapping(address => uint) public balanceOf;
mapping(address => mapping(address => uint)) public allowance;
bytes32 public DOMAIN_SEPARATOR;
// keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
mapping(address => uint) public nonces;
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
constructor() public {
uint chainId;
assembly {
chainId := chainid
}
DOMAIN_SEPARATOR = keccak256(
abi.encode(
keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),
keccak256(bytes(name)),
keccak256(bytes('1')),
chainId,
address(this)
)
);
}
function _mint(address to, uint value) internal {
totalSupply = totalSupply.add(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(address(0), to, value);
}
function _burn(address from, uint value) internal {
balanceOf[from] = balanceOf[from].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(from, address(0), value);
}
function _approve(address owner, address spender, uint value) private {
allowance[owner][spender] = value;
emit Approval(owner, spender, value);
}
function _transfer(address from, address to, uint value) private {
balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function approve(address spender, uint value) external returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transfer(address to, uint value) external returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function transferFrom(address from, address to, uint value) external returns (bool) {
if (allowance[from][msg.sender] != uint(-1)) {
allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
}
_transfer(from, to, value);
return true;
}
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
require(deadline >= block.timestamp, 'UniswapV2: EXPIRED');
bytes32 digest = keccak256(
abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE');
_approve(owner, spender, value);
}
}
// File: contracts/libraries/Math.sol
pragma solidity =0.5.16;
// a library for performing various math operations
library Math {
function min(uint x, uint y) internal pure returns (uint z) {
z = x < y ? x : y;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
z = y;
uint x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}
// File: contracts/libraries/UQ112x112.sol
pragma solidity =0.5.16;
// a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))
// range: [0, 2**112 - 1]
// resolution: 1 / 2**112
library UQ112x112 {
uint224 constant Q112 = 2**112;
// encode a uint112 as a UQ112x112
function encode(uint112 y) internal pure returns (uint224 z) {
z = uint224(y) * Q112; // never overflows
}
// divide a UQ112x112 by a uint112, returning a UQ112x112
function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) {
z = x / uint224(y);
}
}
// File: contracts/interfaces/IERC20.sol
pragma solidity >=0.5.0;
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
}
// File: contracts/interfaces/IUniswapV2Factory.sol
pragma solidity >=0.5.0;
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
// File: contracts/interfaces/IUniswapV2Callee.sol
pragma solidity >=0.5.0;
interface IUniswapV2Callee {
function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external;
}
// File: contracts/UniswapV2Pair.sol
pragma solidity =0.5.16;
contract UniswapV2Pair is IUniswapV2Pair, UniswapV2ERC20 {
using SafeMath for uint;
using UQ112x112 for uint224;
uint public constant MINIMUM_LIQUIDITY = 10**3;
bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)')));
address public factory;
address public token0;
address public token1;
uint112 private reserve0; // uses single storage slot, accessible via getReserves
uint112 private reserve1; // uses single storage slot, accessible via getReserves
uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves
uint public price0CumulativeLast;
uint public price1CumulativeLast;
uint public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event
uint private unlocked = 1;
modifier lock() {
require(unlocked == 1, 'UniswapV2: LOCKED');
unlocked = 0;
_;
unlocked = 1;
}
function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) {
_reserve0 = reserve0;
_reserve1 = reserve1;
_blockTimestampLast = blockTimestampLast;
}
function _safeTransfer(address token, address to, uint value) private {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'UniswapV2: TRANSFER_FAILED');
}
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
constructor() public {
factory = msg.sender;
}
// called once by the factory at time of deployment
function initialize(address _token0, address _token1) external {
require(msg.sender == factory, 'UniswapV2: FORBIDDEN'); // sufficient check
token0 = _token0;
token1 = _token1;
}
// update reserves and, on the first call per block, price accumulators
function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private {
require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'UniswapV2: OVERFLOW');
uint32 blockTimestamp = uint32(block.timestamp % 2**32);
uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired
if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) {
// * never overflows, and + overflow is desired
price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed;
price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed;
}
reserve0 = uint112(balance0);
reserve1 = uint112(balance1);
blockTimestampLast = blockTimestamp;
emit Sync(reserve0, reserve1);
}
// if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k)
function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {
address feeTo = IUniswapV2Factory(factory).feeTo();
feeOn = feeTo != address(0);
uint _kLast = kLast; // gas savings
if (feeOn) {
if (_kLast != 0) {
uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1));
uint rootKLast = Math.sqrt(_kLast);
if (rootK > rootKLast) {
uint numerator = totalSupply.mul(rootK.sub(rootKLast));
uint denominator = rootK.mul(5).add(rootKLast);
uint liquidity = numerator / denominator;
if (liquidity > 0) _mint(feeTo, liquidity);
}
}
} else if (_kLast != 0) {
kLast = 0;
}
}
// this low-level function should be called from a contract which performs important safety checks
function mint(address to) external lock returns (uint liquidity) {
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
uint balance0 = IERC20(token0).balanceOf(address(this));
uint balance1 = IERC20(token1).balanceOf(address(this));
uint amount0 = balance0.sub(_reserve0);
uint amount1 = balance1.sub(_reserve1);
bool feeOn = _mintFee(_reserve0, _reserve1);
uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
if (_totalSupply == 0) {
liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY);
_mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens
} else {
liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1);
}
require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED');
_mint(to, liquidity);
_update(balance0, balance1, _reserve0, _reserve1);
if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
emit Mint(msg.sender, amount0, amount1);
}
// this low-level function should be called from a contract which performs important safety checks
function burn(address to) external lock returns (uint amount0, uint amount1) {
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
address _token0 = token0; // gas savings
address _token1 = token1; // gas savings
uint balance0 = IERC20(_token0).balanceOf(address(this));
uint balance1 = IERC20(_token1).balanceOf(address(this));
uint liquidity = balanceOf[address(this)];
bool feeOn = _mintFee(_reserve0, _reserve1);
uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution
amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution
require(amount0 > 0 && amount1 > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED');
_burn(address(this), liquidity);
_safeTransfer(_token0, to, amount0);
_safeTransfer(_token1, to, amount1);
balance0 = IERC20(_token0).balanceOf(address(this));
balance1 = IERC20(_token1).balanceOf(address(this));
_update(balance0, balance1, _reserve0, _reserve1);
if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
emit Burn(msg.sender, amount0, amount1, to);
}
// this low-level function should be called from a contract which performs important safety checks
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock {
require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT');
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
require(amount0Out < _reserve0 && amount1Out < _reserve1, 'UniswapV2: INSUFFICIENT_LIQUIDITY');
uint balance0;
uint balance1;
{ // scope for _token{0,1}, avoids stack too deep errors
address _token0 = token0;
address _token1 = token1;
require(to != _token0 && to != _token1, 'UniswapV2: INVALID_TO');
if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens
if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens
if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data);
balance0 = IERC20(_token0).balanceOf(address(this));
balance1 = IERC20(_token1).balanceOf(address(this));
}
uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0;
uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0;
require(amount0In > 0 || amount1In > 0, 'UniswapV2: INSUFFICIENT_INPUT_AMOUNT');
{ // scope for reserve{0,1}Adjusted, avoids stack too deep errors
uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3));
uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3));
require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'UniswapV2: K');
}
_update(balance0, balance1, _reserve0, _reserve1);
emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to);
}
// force balances to match reserves
function skim(address to) external lock {
address _token0 = token0; // gas savings
address _token1 = token1; // gas savings
_safeTransfer(_token0, to, IERC20(_token0).balanceOf(address(this)).sub(reserve0));
_safeTransfer(_token1, to, IERC20(_token1).balanceOf(address(this)).sub(reserve1));
}
// force reserves to match balances
function sync() external lock {
_update(IERC20(token0).balanceOf(address(this)), IERC20(token1).balanceOf(address(this)), reserve0, reserve1);
}
} |
1 | 20,291,259 | a78335d2376631074d2be500d0e3030d7144cc67a1769f5fc9195ff3c986fdd2 | 48b939421dcdcef9315aa06310ee660382147ce412e8d68a55e130b2d4f5be9d | 249caddc618ff7e448a8ce9cf56bdc9c2d265028 | 249caddc618ff7e448a8ce9cf56bdc9c2d265028 | 5996261badfd6dd22926ffc1f23985e5791c9f40 | 6080604052670de0b6b3a76400005f196200001b9190620006fd565b5f1962000029919062000761565b6006555f600855600f6009555f600a556019600b55600a54600c55600b54600d55600c54600e55600d54600f5573249caddc618ff7e448a8ce9cf56bdc9c2d26502860125f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555073249caddc618ff7e448a8ce9cf56bdc9c2d26502860135f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505f601560146101000a81548160ff0219169083151502179055505f6015806101000a81548160ff0219169083151502179055506001601560166101000a81548160ff02191690831515021790555066470de4df82000060165566470de4df82000060175566470de4df82000060185534801562000179575f80fd5b505f6200018b6200069960201b60201c565b9050805f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff165f73ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35060065460025f6200023d6200069960201b60201c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055505f737a250d5630b4cf539739df2c5dacb4c659f2488d90508060145f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200031c573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019062000342919062000800565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015620003a8573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190620003ce919062000800565b6040518363ffffffff1660e01b8152600401620003ed92919062000841565b6020604051808303815f875af11580156200040a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019062000430919062000800565b60155f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160055f62000484620006a060201b60201c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff021916908315150217905550600160055f3073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff021916908315150217905550600160055f60125f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff021916908315150217905550600160055f60135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff021916908315150217905550620006246200069960201b60201c565b73ffffffffffffffffffffffffffffffffffffffff165f73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef670de0b6b3a76400006040516200068a91906200087d565b60405180910390a35062000898565b5f33905090565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b5f819050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f6200070982620006c7565b91506200071683620006c7565b925082620007295762000728620006d0565b5b828206905092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6200076d82620006c7565b91506200077a83620006c7565b925082820390508181111562000795576200079462000734565b5b92915050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f620007ca826200079f565b9050919050565b620007dc81620007be565b8114620007e7575f80fd5b50565b5f81519050620007fa81620007d1565b92915050565b5f602082840312156200081857620008176200079b565b5b5f6200082784828501620007ea565b91505092915050565b6200083b81620007be565b82525050565b5f604082019050620008565f83018562000830565b62000865602083018462000830565b9392505050565b6200087781620006c7565b82525050565b5f602082019050620008925f8301846200086c565b92915050565b613bb380620008a65f395ff3fe6080604052600436106101d0575f3560e01c8063715018a6116100f6578063a9059cbb11610094578063c3c8cd8011610063578063c3c8cd8014610653578063dd62ed3e14610669578063e2ee677d146106a5578063f2fde38b146106cd576101d7565b8063a9059cbb1461058b578063ad69489e146105c7578063bfc26e38146105ef578063bfd7928414610617576101d7565b80638da5cb5b116100d05780638da5cb5b146104e55780638ebc7ec61461050f5780638f9a55c01461053757806395d89b4114610561576101d7565b8063715018a6146104695780637d1db4a51461047f5780637f2feddc146104a9576101d7565b80632ece88fb1161016e578063349a39531161013d578063349a3953146103b357806349bd5a5e146103db5780636d8aa8f81461040557806370a082311461042d576101d7565b80632ece88fb146103215780632f6c493c146103375780632fd689e31461035f578063313ce56714610389576101d7565b806318160ddd116101aa57806318160ddd1461026b57806320c09a491461029557806323b872dd146102bd57806329669674146102f9576101d7565b806306fdde03146101db578063095ea7b3146102055780631694505e14610241576101d7565b366101d757005b5f80fd5b3480156101e6575f80fd5b506101ef6106f5565b6040516101fc9190612b1d565b60405180910390f35b348015610210575f80fd5b5061022b60048036038101906102269190612bdb565b610732565b6040516102389190612c33565b60405180910390f35b34801561024c575f80fd5b5061025561074f565b6040516102629190612ca7565b60405180910390f35b348015610276575f80fd5b5061027f610774565b60405161028c9190612ccf565b60405180910390f35b3480156102a0575f80fd5b506102bb60048036038101906102b69190612ce8565b610783565b005b3480156102c8575f80fd5b506102e360048036038101906102de9190612d4c565b610839565b6040516102f09190612c33565b60405180910390f35b348015610304575f80fd5b5061031f600480360381019061031a9190612dc6565b61090d565b005b34801561032c575f80fd5b506103356109be565b005b348015610342575f80fd5b5061035d60048036038101906103589190612df1565b610a8b565b005b34801561036a575f80fd5b50610373610b76565b6040516103809190612ccf565b60405180910390f35b348015610394575f80fd5b5061039d610b7c565b6040516103aa9190612e37565b60405180910390f35b3480156103be575f80fd5b506103d960048036038101906103d49190612e50565b610b84565b005b3480156103e6575f80fd5b506103ef610c22565b6040516103fc9190612e8a565b60405180910390f35b348015610410575f80fd5b5061042b60048036038101906104269190612dc6565b610c47565b005b348015610438575f80fd5b50610453600480360381019061044e9190612df1565b610cf8565b6040516104609190612ccf565b60405180910390f35b348015610474575f80fd5b5061047d610d46565b005b34801561048a575f80fd5b50610493610e94565b6040516104a09190612ccf565b60405180910390f35b3480156104b4575f80fd5b506104cf60048036038101906104ca9190612df1565b610e9a565b6040516104dc9190612ccf565b60405180910390f35b3480156104f0575f80fd5b506104f9610eaf565b6040516105069190612e8a565b60405180910390f35b34801561051a575f80fd5b5061053560048036038101906105309190612f04565b610ed6565b005b348015610542575f80fd5b5061054b611005565b6040516105589190612ccf565b60405180910390f35b34801561056c575f80fd5b5061057561100b565b6040516105829190612b1d565b60405180910390f35b348015610596575f80fd5b506105b160048036038101906105ac9190612bdb565b611048565b6040516105be9190612c33565b60405180910390f35b3480156105d2575f80fd5b506105ed60048036038101906105e89190612e50565b611065565b005b3480156105fa575f80fd5b5061061560048036038101906106109190613099565b611103565b005b348015610622575f80fd5b5061063d60048036038101906106389190612df1565b611222565b60405161064a9190612c33565b60405180910390f35b34801561065e575f80fd5b5061066761123f565b005b348015610674575f80fd5b5061068f600480360381019061068a91906130e0565b611314565b60405161069c9190612ccf565b60405180910390f35b3480156106b0575f80fd5b506106cb60048036038101906106c69190612e50565b611396565b005b3480156106d8575f80fd5b506106f360048036038101906106ee9190612df1565b611434565b005b60606040518060400160405280600981526020017f4c45474f20504550450000000000000000000000000000000000000000000000815250905090565b5f61074561073e6115f1565b84846115f8565b6001905092915050565b60145f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f670de0b6b3a7640000905090565b61078b6115f1565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610817576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080e90613168565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b5f6108458484846117bb565b610902846108516115f1565b6108fd85604051806060016040528060288152602001613b566028913960045f8b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6108b46115f1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205461201b9092919063ffffffff16565b6115f8565b600190509392505050565b6109156115f1565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099890613168565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60125f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109fe6115f1565b73ffffffffffffffffffffffffffffffffffffffff161480610a73575060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610a5b6115f1565b73ffffffffffffffffffffffffffffffffffffffff16145b610a7b575f80fd5b5f479050610a888161207d565b50565b610a936115f1565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b1690613168565b60405180910390fd5b5f60105f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff02191690831515021790555050565b60185481565b5f6009905090565b610b8c6115f1565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0f90613168565b60405180910390fd5b8060168190555050565b60155f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610c4f6115f1565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cdb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cd290613168565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b5f610d3f60025f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20546120e5565b9050919050565b610d4e6115f1565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610dda576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dd190613168565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35f805f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60165481565b6011602052805f5260405f205f915090505481565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610ede6115f1565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6190613168565b60405180910390fd5b5f5b83839050811015610fff578160055f868685818110610f8e57610f8d613186565b5b9050602002016020810190610fa39190612df1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055508080600101915050610f6c565b50505050565b60175481565b60606040518060400160405280600581526020017f245045474f000000000000000000000000000000000000000000000000000000815250905090565b5f61105b6110546115f1565b84846117bb565b6001905092915050565b61106d6115f1565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110f090613168565b60405180910390fd5b8060178190555050565b61110b6115f1565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611197576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118e90613168565b60405180910390fd5b5f5b815181101561121e57600160105f8484815181106111ba576111b9613186565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055508080600101915050611199565b5050565b6010602052805f5260405f205f915054906101000a900460ff1681565b60125f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661127f6115f1565b73ffffffffffffffffffffffffffffffffffffffff1614806112f4575060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166112dc6115f1565b73ffffffffffffffffffffffffffffffffffffffff16145b6112fc575f80fd5b5f61130630610cf8565b905061131181612151565b50565b5f60045f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905092915050565b61139e6115f1565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461142a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161142190613168565b60405180910390fd5b8060188190555050565b61143c6115f1565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114bf90613168565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611536576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152d90613223565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3805f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b5f33905090565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611666576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165d906132b1565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036116d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cb9061333f565b60405180910390fd5b8060045f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516117ae9190612ccf565b60405180910390a3505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611829576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611820906133cd565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611897576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161188e9061345b565b60405180910390fd5b5f81116118d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118d0906134e9565b60405180910390fd5b6118e1610eaf565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561194f575061191f610eaf565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611d2857601560149054906101000a900460ff166119de57611970610eaf565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146119dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119d490613577565b60405180910390fd5b5b601654811115611a23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a1a906135df565b60405180910390fd5b60105f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16158015611ac1575060105f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16155b611b00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611af79061366d565b60405180910390fd5b60155f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611bac5760175481611b6184610cf8565b611b6b91906136b8565b10611bab576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba29061375b565b60405180910390fd5b5b5f611bb630610cf8565b90505f60185482101590506016548210611bd05760165491505b808015611be8575060158054906101000a900460ff16155b8015611c41575060155f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611c595750601560169054906101000a900460ff165b8015611cac575060055f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16155b8015611cff575060055f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16155b15611d2557611d0d82612151565b5f4790505f811115611d2357611d224761207d565b5b505b50505b5f6001905060055f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff1680611dc8575060055f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff165b80611e79575060155f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611e78575060155f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611e86575f9050612009565b60155f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611f2f575060145f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611f4757600854600c81905550600954600d819055505b60155f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611ff0575060145f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561200857600a54600c81905550600b54600d819055505b5b612015848484846123ba565b50505050565b5f838311158290612062576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120599190612b1d565b60405180910390fd5b505f83856120709190613779565b9050809150509392505050565b60135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc8290811502906040515f60405180830381858888f193505050501580156120e1573d5f803e3d5ffd5b5050565b5f60065482111561212b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121229061381c565b60405180910390fd5b5f6121346123e7565b9050612149818461241090919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055505f600267ffffffffffffffff81111561218757612186612f61565b5b6040519080825280602002602001820160405280156121b55781602001602082028036833780820191505090505b50905030815f815181106121cc576121cb613186565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060145f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015612270573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612294919061384e565b816001815181106122a8576122a7613186565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061230e3060145f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846115f8565b60145f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac947835f8430426040518663ffffffff1660e01b8152600401612370959493929190613969565b5f604051808303815f87803b158015612387575f80fd5b505af1158015612399573d5f803e3d5ffd5b50505050505f6015806101000a81548160ff02191690831515021790555050565b806123c8576123c7612459565b5b6123d3848484612492565b806123e1576123e0612459565b5b50505050565b5f805f6123f2612652565b91509150612409818361241090919063ffffffff16565b9250505090565b5f61245183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506126ae565b905092915050565b5f600c5414801561246b57505f600d54145b61249057600c54600e81905550600d54600f819055505f600c819055505f600d819055505b565b5f805f805f806124a18761270f565b9550955095509550955095506124fd8660025f8c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205461276f90919063ffffffff16565b60025f8b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f208190555061258e8560025f8b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20546127b890919063ffffffff16565b60025f8a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055506125d881612815565b6125e284836128cc565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161263f9190612ccf565b60405180910390a3505050505050505050565b5f805f60065490505f670de0b6b3a76400009050612683670de0b6b3a764000060065461241090919063ffffffff16565b8210156126a157600654670de0b6b3a76400009350935050506126aa565b81819350935050505b9091565b5f80831182906126f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126eb9190612b1d565b60405180910390fd5b505f838561270291906139ee565b9050809150509392505050565b5f805f805f805f805f6127278a600c54600d54612906565b9250925092505f6127366123e7565b90505f805f6127478e878787612998565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b5f6127b083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061201b565b905092915050565b5f8082846127c691906136b8565b90508381101561280b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161280290613a68565b60405180910390fd5b8091505092915050565b5f61281e6123e7565b90505f6128348284612a1c90919063ffffffff16565b90506128868160025f3073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20546127b890919063ffffffff16565b60025f3073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550505050565b6128e18260065461276f90919063ffffffff16565b6006819055506128fc816007546127b890919063ffffffff16565b6007819055505050565b5f805f806129306064612922888a612a1c90919063ffffffff16565b61241090919063ffffffff16565b90505f612959606461294b888b612a1c90919063ffffffff16565b61241090919063ffffffff16565b90505f61298182612973858c61276f90919063ffffffff16565b61276f90919063ffffffff16565b905080838395509550955050505093509350939050565b5f805f806129af8589612a1c90919063ffffffff16565b90505f6129c58689612a1c90919063ffffffff16565b90505f6129db8789612a1c90919063ffffffff16565b90505f612a03826129f5858761276f90919063ffffffff16565b61276f90919063ffffffff16565b9050838184965096509650505050509450945094915050565b5f808303612a2c575f9050612a8d565b5f8284612a399190613a86565b9050828482612a4891906139ee565b14612a88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a7f90613b37565b60405180910390fd5b809150505b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015612aca578082015181840152602081019050612aaf565b5f8484015250505050565b5f601f19601f8301169050919050565b5f612aef82612a93565b612af98185612a9d565b9350612b09818560208601612aad565b612b1281612ad5565b840191505092915050565b5f6020820190508181035f830152612b358184612ae5565b905092915050565b5f604051905090565b5f80fd5b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f612b7782612b4e565b9050919050565b612b8781612b6d565b8114612b91575f80fd5b50565b5f81359050612ba281612b7e565b92915050565b5f819050919050565b612bba81612ba8565b8114612bc4575f80fd5b50565b5f81359050612bd581612bb1565b92915050565b5f8060408385031215612bf157612bf0612b46565b5b5f612bfe85828601612b94565b9250506020612c0f85828601612bc7565b9150509250929050565b5f8115159050919050565b612c2d81612c19565b82525050565b5f602082019050612c465f830184612c24565b92915050565b5f819050919050565b5f612c6f612c6a612c6584612b4e565b612c4c565b612b4e565b9050919050565b5f612c8082612c55565b9050919050565b5f612c9182612c76565b9050919050565b612ca181612c87565b82525050565b5f602082019050612cba5f830184612c98565b92915050565b612cc981612ba8565b82525050565b5f602082019050612ce25f830184612cc0565b92915050565b5f805f8060808587031215612d0057612cff612b46565b5b5f612d0d87828801612bc7565b9450506020612d1e87828801612bc7565b9350506040612d2f87828801612bc7565b9250506060612d4087828801612bc7565b91505092959194509250565b5f805f60608486031215612d6357612d62612b46565b5b5f612d7086828701612b94565b9350506020612d8186828701612b94565b9250506040612d9286828701612bc7565b9150509250925092565b612da581612c19565b8114612daf575f80fd5b50565b5f81359050612dc081612d9c565b92915050565b5f60208284031215612ddb57612dda612b46565b5b5f612de884828501612db2565b91505092915050565b5f60208284031215612e0657612e05612b46565b5b5f612e1384828501612b94565b91505092915050565b5f60ff82169050919050565b612e3181612e1c565b82525050565b5f602082019050612e4a5f830184612e28565b92915050565b5f60208284031215612e6557612e64612b46565b5b5f612e7284828501612bc7565b91505092915050565b612e8481612b6d565b82525050565b5f602082019050612e9d5f830184612e7b565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f840112612ec457612ec3612ea3565b5b8235905067ffffffffffffffff811115612ee157612ee0612ea7565b5b602083019150836020820283011115612efd57612efc612eab565b5b9250929050565b5f805f60408486031215612f1b57612f1a612b46565b5b5f84013567ffffffffffffffff811115612f3857612f37612b4a565b5b612f4486828701612eaf565b93509350506020612f5786828701612db2565b9150509250925092565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b612f9782612ad5565b810181811067ffffffffffffffff82111715612fb657612fb5612f61565b5b80604052505050565b5f612fc8612b3d565b9050612fd48282612f8e565b919050565b5f67ffffffffffffffff821115612ff357612ff2612f61565b5b602082029050602081019050919050565b5f61301661301184612fd9565b612fbf565b9050808382526020820190506020840283018581111561303957613038612eab565b5b835b81811015613062578061304e8882612b94565b84526020840193505060208101905061303b565b5050509392505050565b5f82601f8301126130805761307f612ea3565b5b8135613090848260208601613004565b91505092915050565b5f602082840312156130ae576130ad612b46565b5b5f82013567ffffffffffffffff8111156130cb576130ca612b4a565b5b6130d78482850161306c565b91505092915050565b5f80604083850312156130f6576130f5612b46565b5b5f61310385828601612b94565b925050602061311485828601612b94565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725f82015250565b5f613152602083612a9d565b915061315d8261311e565b602082019050919050565b5f6020820190508181035f83015261317f81613146565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f20615f8201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b5f61320d602683612a9d565b9150613218826131b3565b604082019050919050565b5f6020820190508181035f83015261323a81613201565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f206164645f8201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b5f61329b602483612a9d565b91506132a682613241565b604082019050919050565b5f6020820190508181035f8301526132c88161328f565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f2061646472655f8201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b5f613329602283612a9d565b9150613334826132cf565b604082019050919050565b5f6020820190508181035f8301526133568161331d565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f2061645f8201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b5f6133b7602583612a9d565b91506133c28261335d565b604082019050919050565b5f6020820190508181035f8301526133e4816133ab565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f20616464725f8201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b5f613445602383612a9d565b9150613450826133eb565b604082019050919050565b5f6020820190508181035f83015261347281613439565b9050919050565b7f5472616e7366657220616d6f756e74206d7573742062652067726561746572205f8201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b5f6134d3602983612a9d565b91506134de82613479565b604082019050919050565b5f6020820190508181035f830152613500816134c7565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e64205f8201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b5f613561603f83612a9d565b915061356c82613507565b604082019050919050565b5f6020820190508181035f83015261358e81613555565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000005f82015250565b5f6135c9601c83612a9d565b91506135d482613595565b602082019050919050565b5f6020820190508181035f8301526135f6816135bd565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c6973745f8201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b5f613657602383612a9d565b9150613662826135fd565b604082019050919050565b5f6020820190508181035f8301526136848161364b565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6136c282612ba8565b91506136cd83612ba8565b92508282019050808211156136e5576136e461368b565b5b92915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073695f8201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b5f613745602383612a9d565b9150613750826136eb565b604082019050919050565b5f6020820190508181035f83015261377281613739565b9050919050565b5f61378382612ba8565b915061378e83612ba8565b92508282039050818111156137a6576137a561368b565b5b92915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c20725f8201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b5f613806602a83612a9d565b9150613811826137ac565b604082019050919050565b5f6020820190508181035f830152613833816137fa565b9050919050565b5f8151905061384881612b7e565b92915050565b5f6020828403121561386357613862612b46565b5b5f6138708482850161383a565b91505092915050565b5f819050919050565b5f61389c61389761389284613879565b612c4c565b612ba8565b9050919050565b6138ac81613882565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6138e481612b6d565b82525050565b5f6138f583836138db565b60208301905092915050565b5f602082019050919050565b5f613917826138b2565b61392181856138bc565b935061392c836138cc565b805f5b8381101561395c57815161394388826138ea565b975061394e83613901565b92505060018101905061392f565b5085935050505092915050565b5f60a08201905061397c5f830188612cc0565b61398960208301876138a3565b818103604083015261399b818661390d565b90506139aa6060830185612e7b565b6139b76080830184612cc0565b9695505050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f6139f882612ba8565b9150613a0383612ba8565b925082613a1357613a126139c1565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f7700000000005f82015250565b5f613a52601b83612a9d565b9150613a5d82613a1e565b602082019050919050565b5f6020820190508181035f830152613a7f81613a46565b9050919050565b5f613a9082612ba8565b9150613a9b83612ba8565b9250828202613aa981612ba8565b91508282048414831517613ac057613abf61368b565b5b5092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f5f8201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b5f613b21602183612a9d565b9150613b2c82613ac7565b604082019050919050565b5f6020820190508181035f830152613b4e81613b15565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122000489afb329211cb16d13f087e9a0f4446cb1d62901ec40754e2144321e7fdce64736f6c63430008180033 | 6080604052600436106101d0575f3560e01c8063715018a6116100f6578063a9059cbb11610094578063c3c8cd8011610063578063c3c8cd8014610653578063dd62ed3e14610669578063e2ee677d146106a5578063f2fde38b146106cd576101d7565b8063a9059cbb1461058b578063ad69489e146105c7578063bfc26e38146105ef578063bfd7928414610617576101d7565b80638da5cb5b116100d05780638da5cb5b146104e55780638ebc7ec61461050f5780638f9a55c01461053757806395d89b4114610561576101d7565b8063715018a6146104695780637d1db4a51461047f5780637f2feddc146104a9576101d7565b80632ece88fb1161016e578063349a39531161013d578063349a3953146103b357806349bd5a5e146103db5780636d8aa8f81461040557806370a082311461042d576101d7565b80632ece88fb146103215780632f6c493c146103375780632fd689e31461035f578063313ce56714610389576101d7565b806318160ddd116101aa57806318160ddd1461026b57806320c09a491461029557806323b872dd146102bd57806329669674146102f9576101d7565b806306fdde03146101db578063095ea7b3146102055780631694505e14610241576101d7565b366101d757005b5f80fd5b3480156101e6575f80fd5b506101ef6106f5565b6040516101fc9190612b1d565b60405180910390f35b348015610210575f80fd5b5061022b60048036038101906102269190612bdb565b610732565b6040516102389190612c33565b60405180910390f35b34801561024c575f80fd5b5061025561074f565b6040516102629190612ca7565b60405180910390f35b348015610276575f80fd5b5061027f610774565b60405161028c9190612ccf565b60405180910390f35b3480156102a0575f80fd5b506102bb60048036038101906102b69190612ce8565b610783565b005b3480156102c8575f80fd5b506102e360048036038101906102de9190612d4c565b610839565b6040516102f09190612c33565b60405180910390f35b348015610304575f80fd5b5061031f600480360381019061031a9190612dc6565b61090d565b005b34801561032c575f80fd5b506103356109be565b005b348015610342575f80fd5b5061035d60048036038101906103589190612df1565b610a8b565b005b34801561036a575f80fd5b50610373610b76565b6040516103809190612ccf565b60405180910390f35b348015610394575f80fd5b5061039d610b7c565b6040516103aa9190612e37565b60405180910390f35b3480156103be575f80fd5b506103d960048036038101906103d49190612e50565b610b84565b005b3480156103e6575f80fd5b506103ef610c22565b6040516103fc9190612e8a565b60405180910390f35b348015610410575f80fd5b5061042b60048036038101906104269190612dc6565b610c47565b005b348015610438575f80fd5b50610453600480360381019061044e9190612df1565b610cf8565b6040516104609190612ccf565b60405180910390f35b348015610474575f80fd5b5061047d610d46565b005b34801561048a575f80fd5b50610493610e94565b6040516104a09190612ccf565b60405180910390f35b3480156104b4575f80fd5b506104cf60048036038101906104ca9190612df1565b610e9a565b6040516104dc9190612ccf565b60405180910390f35b3480156104f0575f80fd5b506104f9610eaf565b6040516105069190612e8a565b60405180910390f35b34801561051a575f80fd5b5061053560048036038101906105309190612f04565b610ed6565b005b348015610542575f80fd5b5061054b611005565b6040516105589190612ccf565b60405180910390f35b34801561056c575f80fd5b5061057561100b565b6040516105829190612b1d565b60405180910390f35b348015610596575f80fd5b506105b160048036038101906105ac9190612bdb565b611048565b6040516105be9190612c33565b60405180910390f35b3480156105d2575f80fd5b506105ed60048036038101906105e89190612e50565b611065565b005b3480156105fa575f80fd5b5061061560048036038101906106109190613099565b611103565b005b348015610622575f80fd5b5061063d60048036038101906106389190612df1565b611222565b60405161064a9190612c33565b60405180910390f35b34801561065e575f80fd5b5061066761123f565b005b348015610674575f80fd5b5061068f600480360381019061068a91906130e0565b611314565b60405161069c9190612ccf565b60405180910390f35b3480156106b0575f80fd5b506106cb60048036038101906106c69190612e50565b611396565b005b3480156106d8575f80fd5b506106f360048036038101906106ee9190612df1565b611434565b005b60606040518060400160405280600981526020017f4c45474f20504550450000000000000000000000000000000000000000000000815250905090565b5f61074561073e6115f1565b84846115f8565b6001905092915050565b60145f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f670de0b6b3a7640000905090565b61078b6115f1565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610817576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080e90613168565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b5f6108458484846117bb565b610902846108516115f1565b6108fd85604051806060016040528060288152602001613b566028913960045f8b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6108b46115f1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205461201b9092919063ffffffff16565b6115f8565b600190509392505050565b6109156115f1565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099890613168565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60125f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109fe6115f1565b73ffffffffffffffffffffffffffffffffffffffff161480610a73575060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610a5b6115f1565b73ffffffffffffffffffffffffffffffffffffffff16145b610a7b575f80fd5b5f479050610a888161207d565b50565b610a936115f1565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b1690613168565b60405180910390fd5b5f60105f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff02191690831515021790555050565b60185481565b5f6009905090565b610b8c6115f1565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0f90613168565b60405180910390fd5b8060168190555050565b60155f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610c4f6115f1565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cdb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cd290613168565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b5f610d3f60025f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20546120e5565b9050919050565b610d4e6115f1565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610dda576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dd190613168565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35f805f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60165481565b6011602052805f5260405f205f915090505481565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610ede6115f1565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6190613168565b60405180910390fd5b5f5b83839050811015610fff578160055f868685818110610f8e57610f8d613186565b5b9050602002016020810190610fa39190612df1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055508080600101915050610f6c565b50505050565b60175481565b60606040518060400160405280600581526020017f245045474f000000000000000000000000000000000000000000000000000000815250905090565b5f61105b6110546115f1565b84846117bb565b6001905092915050565b61106d6115f1565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110f090613168565b60405180910390fd5b8060178190555050565b61110b6115f1565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611197576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118e90613168565b60405180910390fd5b5f5b815181101561121e57600160105f8484815181106111ba576111b9613186565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055508080600101915050611199565b5050565b6010602052805f5260405f205f915054906101000a900460ff1681565b60125f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661127f6115f1565b73ffffffffffffffffffffffffffffffffffffffff1614806112f4575060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166112dc6115f1565b73ffffffffffffffffffffffffffffffffffffffff16145b6112fc575f80fd5b5f61130630610cf8565b905061131181612151565b50565b5f60045f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905092915050565b61139e6115f1565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461142a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161142190613168565b60405180910390fd5b8060188190555050565b61143c6115f1565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114bf90613168565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611536576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152d90613223565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3805f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b5f33905090565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611666576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165d906132b1565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036116d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cb9061333f565b60405180910390fd5b8060045f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516117ae9190612ccf565b60405180910390a3505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611829576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611820906133cd565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611897576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161188e9061345b565b60405180910390fd5b5f81116118d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118d0906134e9565b60405180910390fd5b6118e1610eaf565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561194f575061191f610eaf565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611d2857601560149054906101000a900460ff166119de57611970610eaf565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146119dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119d490613577565b60405180910390fd5b5b601654811115611a23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a1a906135df565b60405180910390fd5b60105f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16158015611ac1575060105f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16155b611b00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611af79061366d565b60405180910390fd5b60155f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611bac5760175481611b6184610cf8565b611b6b91906136b8565b10611bab576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba29061375b565b60405180910390fd5b5b5f611bb630610cf8565b90505f60185482101590506016548210611bd05760165491505b808015611be8575060158054906101000a900460ff16155b8015611c41575060155f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611c595750601560169054906101000a900460ff165b8015611cac575060055f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16155b8015611cff575060055f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16155b15611d2557611d0d82612151565b5f4790505f811115611d2357611d224761207d565b5b505b50505b5f6001905060055f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff1680611dc8575060055f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff165b80611e79575060155f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611e78575060155f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611e86575f9050612009565b60155f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611f2f575060145f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611f4757600854600c81905550600954600d819055505b60155f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611ff0575060145f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561200857600a54600c81905550600b54600d819055505b5b612015848484846123ba565b50505050565b5f838311158290612062576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120599190612b1d565b60405180910390fd5b505f83856120709190613779565b9050809150509392505050565b60135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc8290811502906040515f60405180830381858888f193505050501580156120e1573d5f803e3d5ffd5b5050565b5f60065482111561212b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121229061381c565b60405180910390fd5b5f6121346123e7565b9050612149818461241090919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055505f600267ffffffffffffffff81111561218757612186612f61565b5b6040519080825280602002602001820160405280156121b55781602001602082028036833780820191505090505b50905030815f815181106121cc576121cb613186565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060145f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015612270573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612294919061384e565b816001815181106122a8576122a7613186565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061230e3060145f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846115f8565b60145f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac947835f8430426040518663ffffffff1660e01b8152600401612370959493929190613969565b5f604051808303815f87803b158015612387575f80fd5b505af1158015612399573d5f803e3d5ffd5b50505050505f6015806101000a81548160ff02191690831515021790555050565b806123c8576123c7612459565b5b6123d3848484612492565b806123e1576123e0612459565b5b50505050565b5f805f6123f2612652565b91509150612409818361241090919063ffffffff16565b9250505090565b5f61245183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506126ae565b905092915050565b5f600c5414801561246b57505f600d54145b61249057600c54600e81905550600d54600f819055505f600c819055505f600d819055505b565b5f805f805f806124a18761270f565b9550955095509550955095506124fd8660025f8c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205461276f90919063ffffffff16565b60025f8b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f208190555061258e8560025f8b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20546127b890919063ffffffff16565b60025f8a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055506125d881612815565b6125e284836128cc565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161263f9190612ccf565b60405180910390a3505050505050505050565b5f805f60065490505f670de0b6b3a76400009050612683670de0b6b3a764000060065461241090919063ffffffff16565b8210156126a157600654670de0b6b3a76400009350935050506126aa565b81819350935050505b9091565b5f80831182906126f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126eb9190612b1d565b60405180910390fd5b505f838561270291906139ee565b9050809150509392505050565b5f805f805f805f805f6127278a600c54600d54612906565b9250925092505f6127366123e7565b90505f805f6127478e878787612998565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b5f6127b083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061201b565b905092915050565b5f8082846127c691906136b8565b90508381101561280b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161280290613a68565b60405180910390fd5b8091505092915050565b5f61281e6123e7565b90505f6128348284612a1c90919063ffffffff16565b90506128868160025f3073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20546127b890919063ffffffff16565b60025f3073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550505050565b6128e18260065461276f90919063ffffffff16565b6006819055506128fc816007546127b890919063ffffffff16565b6007819055505050565b5f805f806129306064612922888a612a1c90919063ffffffff16565b61241090919063ffffffff16565b90505f612959606461294b888b612a1c90919063ffffffff16565b61241090919063ffffffff16565b90505f61298182612973858c61276f90919063ffffffff16565b61276f90919063ffffffff16565b905080838395509550955050505093509350939050565b5f805f806129af8589612a1c90919063ffffffff16565b90505f6129c58689612a1c90919063ffffffff16565b90505f6129db8789612a1c90919063ffffffff16565b90505f612a03826129f5858761276f90919063ffffffff16565b61276f90919063ffffffff16565b9050838184965096509650505050509450945094915050565b5f808303612a2c575f9050612a8d565b5f8284612a399190613a86565b9050828482612a4891906139ee565b14612a88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a7f90613b37565b60405180910390fd5b809150505b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015612aca578082015181840152602081019050612aaf565b5f8484015250505050565b5f601f19601f8301169050919050565b5f612aef82612a93565b612af98185612a9d565b9350612b09818560208601612aad565b612b1281612ad5565b840191505092915050565b5f6020820190508181035f830152612b358184612ae5565b905092915050565b5f604051905090565b5f80fd5b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f612b7782612b4e565b9050919050565b612b8781612b6d565b8114612b91575f80fd5b50565b5f81359050612ba281612b7e565b92915050565b5f819050919050565b612bba81612ba8565b8114612bc4575f80fd5b50565b5f81359050612bd581612bb1565b92915050565b5f8060408385031215612bf157612bf0612b46565b5b5f612bfe85828601612b94565b9250506020612c0f85828601612bc7565b9150509250929050565b5f8115159050919050565b612c2d81612c19565b82525050565b5f602082019050612c465f830184612c24565b92915050565b5f819050919050565b5f612c6f612c6a612c6584612b4e565b612c4c565b612b4e565b9050919050565b5f612c8082612c55565b9050919050565b5f612c9182612c76565b9050919050565b612ca181612c87565b82525050565b5f602082019050612cba5f830184612c98565b92915050565b612cc981612ba8565b82525050565b5f602082019050612ce25f830184612cc0565b92915050565b5f805f8060808587031215612d0057612cff612b46565b5b5f612d0d87828801612bc7565b9450506020612d1e87828801612bc7565b9350506040612d2f87828801612bc7565b9250506060612d4087828801612bc7565b91505092959194509250565b5f805f60608486031215612d6357612d62612b46565b5b5f612d7086828701612b94565b9350506020612d8186828701612b94565b9250506040612d9286828701612bc7565b9150509250925092565b612da581612c19565b8114612daf575f80fd5b50565b5f81359050612dc081612d9c565b92915050565b5f60208284031215612ddb57612dda612b46565b5b5f612de884828501612db2565b91505092915050565b5f60208284031215612e0657612e05612b46565b5b5f612e1384828501612b94565b91505092915050565b5f60ff82169050919050565b612e3181612e1c565b82525050565b5f602082019050612e4a5f830184612e28565b92915050565b5f60208284031215612e6557612e64612b46565b5b5f612e7284828501612bc7565b91505092915050565b612e8481612b6d565b82525050565b5f602082019050612e9d5f830184612e7b565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f840112612ec457612ec3612ea3565b5b8235905067ffffffffffffffff811115612ee157612ee0612ea7565b5b602083019150836020820283011115612efd57612efc612eab565b5b9250929050565b5f805f60408486031215612f1b57612f1a612b46565b5b5f84013567ffffffffffffffff811115612f3857612f37612b4a565b5b612f4486828701612eaf565b93509350506020612f5786828701612db2565b9150509250925092565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b612f9782612ad5565b810181811067ffffffffffffffff82111715612fb657612fb5612f61565b5b80604052505050565b5f612fc8612b3d565b9050612fd48282612f8e565b919050565b5f67ffffffffffffffff821115612ff357612ff2612f61565b5b602082029050602081019050919050565b5f61301661301184612fd9565b612fbf565b9050808382526020820190506020840283018581111561303957613038612eab565b5b835b81811015613062578061304e8882612b94565b84526020840193505060208101905061303b565b5050509392505050565b5f82601f8301126130805761307f612ea3565b5b8135613090848260208601613004565b91505092915050565b5f602082840312156130ae576130ad612b46565b5b5f82013567ffffffffffffffff8111156130cb576130ca612b4a565b5b6130d78482850161306c565b91505092915050565b5f80604083850312156130f6576130f5612b46565b5b5f61310385828601612b94565b925050602061311485828601612b94565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725f82015250565b5f613152602083612a9d565b915061315d8261311e565b602082019050919050565b5f6020820190508181035f83015261317f81613146565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f20615f8201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b5f61320d602683612a9d565b9150613218826131b3565b604082019050919050565b5f6020820190508181035f83015261323a81613201565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f206164645f8201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b5f61329b602483612a9d565b91506132a682613241565b604082019050919050565b5f6020820190508181035f8301526132c88161328f565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f2061646472655f8201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b5f613329602283612a9d565b9150613334826132cf565b604082019050919050565b5f6020820190508181035f8301526133568161331d565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f2061645f8201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b5f6133b7602583612a9d565b91506133c28261335d565b604082019050919050565b5f6020820190508181035f8301526133e4816133ab565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f20616464725f8201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b5f613445602383612a9d565b9150613450826133eb565b604082019050919050565b5f6020820190508181035f83015261347281613439565b9050919050565b7f5472616e7366657220616d6f756e74206d7573742062652067726561746572205f8201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b5f6134d3602983612a9d565b91506134de82613479565b604082019050919050565b5f6020820190508181035f830152613500816134c7565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e64205f8201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b5f613561603f83612a9d565b915061356c82613507565b604082019050919050565b5f6020820190508181035f83015261358e81613555565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000005f82015250565b5f6135c9601c83612a9d565b91506135d482613595565b602082019050919050565b5f6020820190508181035f8301526135f6816135bd565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c6973745f8201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b5f613657602383612a9d565b9150613662826135fd565b604082019050919050565b5f6020820190508181035f8301526136848161364b565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6136c282612ba8565b91506136cd83612ba8565b92508282019050808211156136e5576136e461368b565b5b92915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073695f8201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b5f613745602383612a9d565b9150613750826136eb565b604082019050919050565b5f6020820190508181035f83015261377281613739565b9050919050565b5f61378382612ba8565b915061378e83612ba8565b92508282039050818111156137a6576137a561368b565b5b92915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c20725f8201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b5f613806602a83612a9d565b9150613811826137ac565b604082019050919050565b5f6020820190508181035f830152613833816137fa565b9050919050565b5f8151905061384881612b7e565b92915050565b5f6020828403121561386357613862612b46565b5b5f6138708482850161383a565b91505092915050565b5f819050919050565b5f61389c61389761389284613879565b612c4c565b612ba8565b9050919050565b6138ac81613882565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6138e481612b6d565b82525050565b5f6138f583836138db565b60208301905092915050565b5f602082019050919050565b5f613917826138b2565b61392181856138bc565b935061392c836138cc565b805f5b8381101561395c57815161394388826138ea565b975061394e83613901565b92505060018101905061392f565b5085935050505092915050565b5f60a08201905061397c5f830188612cc0565b61398960208301876138a3565b818103604083015261399b818661390d565b90506139aa6060830185612e7b565b6139b76080830184612cc0565b9695505050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f6139f882612ba8565b9150613a0383612ba8565b925082613a1357613a126139c1565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f7700000000005f82015250565b5f613a52601b83612a9d565b9150613a5d82613a1e565b602082019050919050565b5f6020820190508181035f830152613a7f81613a46565b9050919050565b5f613a9082612ba8565b9150613a9b83612ba8565b9250828202613aa981612ba8565b91508282048414831517613ac057613abf61368b565b5b5092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f5f8201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b5f613b21602183612a9d565b9150613b2c82613ac7565b604082019050919050565b5f6020820190508181035f830152613b4e81613b15565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122000489afb329211cb16d13f087e9a0f4446cb1d62901ec40754e2144321e7fdce64736f6c63430008180033 | /**
https://t.me/LEGOPEPE_PORTAL
https://x.com/LEGOPEPEERC20
https://legopepe.icu
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.24;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract LEGOPEPE is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = unicode"LEGO PEPE";
string private constant _symbol = unicode"$PEGO";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 15;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 25;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x249caDDC618FF7e448a8ce9CF56bdC9C2D265028);
address payable private _marketingAddress = payable(0x249caDDC618FF7e448a8ce9CF56bdC9C2D265028);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = false;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 20000000 * 10**9;
uint256 public _maxWalletSize = 20000000 * 10**9;
uint256 public _swapTokensAtAmount = 20000000 * 10**9;
event MaxTxAmountUpdate(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removetaxes() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function TradingOpen(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualunclogg() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function Pegobot(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unlock(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removetaxes();
_transferStandard(sender, recipient, amount);
if (!takeFee) removetaxes();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setTax(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function MinSwapTokenThresh(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function MaxTxnAmmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function MaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeAccountFromFee(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} |
1 | 20,291,259 | a78335d2376631074d2be500d0e3030d7144cc67a1769f5fc9195ff3c986fdd2 | 48b939421dcdcef9315aa06310ee660382147ce412e8d68a55e130b2d4f5be9d | 249caddc618ff7e448a8ce9cf56bdc9c2d265028 | 5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f | 8dabc88bd32a71c2835d30f9c94845f7e1edcaff | 60806040526001600c5534801561001557600080fd5b506040514690806052612d228239604080519182900360520182208282018252600a8352692ab734b9bbb0b8102b1960b11b6020938401528151808301835260018152603160f81b908401528151808401919091527fbfcc8ef98ffbf7b6c3fec7bf5185b566b9863e35a9d83acd49ad6824b5969738818301527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606082015260808101949094523060a0808601919091528151808603909101815260c09094019052825192019190912060035550600580546001600160a01b03191633179055612c1d806101056000396000f3fe608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429 | 608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032 | // File: contracts/interfaces/IUniswapV2Pair.sol
pragma solidity >=0.5.0;
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
// File: contracts/interfaces/IUniswapV2ERC20.sol
pragma solidity >=0.5.0;
interface IUniswapV2ERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
}
// File: contracts/libraries/SafeMath.sol
pragma solidity =0.5.16;
// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)
library SafeMath {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x, 'ds-math-add-overflow');
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x, 'ds-math-sub-underflow');
}
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');
}
}
// File: contracts/UniswapV2ERC20.sol
pragma solidity =0.5.16;
contract UniswapV2ERC20 is IUniswapV2ERC20 {
using SafeMath for uint;
string public constant name = 'Uniswap V2';
string public constant symbol = 'UNI-V2';
uint8 public constant decimals = 18;
uint public totalSupply;
mapping(address => uint) public balanceOf;
mapping(address => mapping(address => uint)) public allowance;
bytes32 public DOMAIN_SEPARATOR;
// keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
mapping(address => uint) public nonces;
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
constructor() public {
uint chainId;
assembly {
chainId := chainid
}
DOMAIN_SEPARATOR = keccak256(
abi.encode(
keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),
keccak256(bytes(name)),
keccak256(bytes('1')),
chainId,
address(this)
)
);
}
function _mint(address to, uint value) internal {
totalSupply = totalSupply.add(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(address(0), to, value);
}
function _burn(address from, uint value) internal {
balanceOf[from] = balanceOf[from].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(from, address(0), value);
}
function _approve(address owner, address spender, uint value) private {
allowance[owner][spender] = value;
emit Approval(owner, spender, value);
}
function _transfer(address from, address to, uint value) private {
balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function approve(address spender, uint value) external returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transfer(address to, uint value) external returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function transferFrom(address from, address to, uint value) external returns (bool) {
if (allowance[from][msg.sender] != uint(-1)) {
allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
}
_transfer(from, to, value);
return true;
}
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
require(deadline >= block.timestamp, 'UniswapV2: EXPIRED');
bytes32 digest = keccak256(
abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE');
_approve(owner, spender, value);
}
}
// File: contracts/libraries/Math.sol
pragma solidity =0.5.16;
// a library for performing various math operations
library Math {
function min(uint x, uint y) internal pure returns (uint z) {
z = x < y ? x : y;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
z = y;
uint x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}
// File: contracts/libraries/UQ112x112.sol
pragma solidity =0.5.16;
// a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))
// range: [0, 2**112 - 1]
// resolution: 1 / 2**112
library UQ112x112 {
uint224 constant Q112 = 2**112;
// encode a uint112 as a UQ112x112
function encode(uint112 y) internal pure returns (uint224 z) {
z = uint224(y) * Q112; // never overflows
}
// divide a UQ112x112 by a uint112, returning a UQ112x112
function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) {
z = x / uint224(y);
}
}
// File: contracts/interfaces/IERC20.sol
pragma solidity >=0.5.0;
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
}
// File: contracts/interfaces/IUniswapV2Factory.sol
pragma solidity >=0.5.0;
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
// File: contracts/interfaces/IUniswapV2Callee.sol
pragma solidity >=0.5.0;
interface IUniswapV2Callee {
function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external;
}
// File: contracts/UniswapV2Pair.sol
pragma solidity =0.5.16;
contract UniswapV2Pair is IUniswapV2Pair, UniswapV2ERC20 {
using SafeMath for uint;
using UQ112x112 for uint224;
uint public constant MINIMUM_LIQUIDITY = 10**3;
bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)')));
address public factory;
address public token0;
address public token1;
uint112 private reserve0; // uses single storage slot, accessible via getReserves
uint112 private reserve1; // uses single storage slot, accessible via getReserves
uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves
uint public price0CumulativeLast;
uint public price1CumulativeLast;
uint public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event
uint private unlocked = 1;
modifier lock() {
require(unlocked == 1, 'UniswapV2: LOCKED');
unlocked = 0;
_;
unlocked = 1;
}
function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) {
_reserve0 = reserve0;
_reserve1 = reserve1;
_blockTimestampLast = blockTimestampLast;
}
function _safeTransfer(address token, address to, uint value) private {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'UniswapV2: TRANSFER_FAILED');
}
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
constructor() public {
factory = msg.sender;
}
// called once by the factory at time of deployment
function initialize(address _token0, address _token1) external {
require(msg.sender == factory, 'UniswapV2: FORBIDDEN'); // sufficient check
token0 = _token0;
token1 = _token1;
}
// update reserves and, on the first call per block, price accumulators
function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private {
require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'UniswapV2: OVERFLOW');
uint32 blockTimestamp = uint32(block.timestamp % 2**32);
uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired
if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) {
// * never overflows, and + overflow is desired
price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed;
price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed;
}
reserve0 = uint112(balance0);
reserve1 = uint112(balance1);
blockTimestampLast = blockTimestamp;
emit Sync(reserve0, reserve1);
}
// if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k)
function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {
address feeTo = IUniswapV2Factory(factory).feeTo();
feeOn = feeTo != address(0);
uint _kLast = kLast; // gas savings
if (feeOn) {
if (_kLast != 0) {
uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1));
uint rootKLast = Math.sqrt(_kLast);
if (rootK > rootKLast) {
uint numerator = totalSupply.mul(rootK.sub(rootKLast));
uint denominator = rootK.mul(5).add(rootKLast);
uint liquidity = numerator / denominator;
if (liquidity > 0) _mint(feeTo, liquidity);
}
}
} else if (_kLast != 0) {
kLast = 0;
}
}
// this low-level function should be called from a contract which performs important safety checks
function mint(address to) external lock returns (uint liquidity) {
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
uint balance0 = IERC20(token0).balanceOf(address(this));
uint balance1 = IERC20(token1).balanceOf(address(this));
uint amount0 = balance0.sub(_reserve0);
uint amount1 = balance1.sub(_reserve1);
bool feeOn = _mintFee(_reserve0, _reserve1);
uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
if (_totalSupply == 0) {
liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY);
_mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens
} else {
liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1);
}
require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED');
_mint(to, liquidity);
_update(balance0, balance1, _reserve0, _reserve1);
if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
emit Mint(msg.sender, amount0, amount1);
}
// this low-level function should be called from a contract which performs important safety checks
function burn(address to) external lock returns (uint amount0, uint amount1) {
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
address _token0 = token0; // gas savings
address _token1 = token1; // gas savings
uint balance0 = IERC20(_token0).balanceOf(address(this));
uint balance1 = IERC20(_token1).balanceOf(address(this));
uint liquidity = balanceOf[address(this)];
bool feeOn = _mintFee(_reserve0, _reserve1);
uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution
amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution
require(amount0 > 0 && amount1 > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED');
_burn(address(this), liquidity);
_safeTransfer(_token0, to, amount0);
_safeTransfer(_token1, to, amount1);
balance0 = IERC20(_token0).balanceOf(address(this));
balance1 = IERC20(_token1).balanceOf(address(this));
_update(balance0, balance1, _reserve0, _reserve1);
if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
emit Burn(msg.sender, amount0, amount1, to);
}
// this low-level function should be called from a contract which performs important safety checks
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock {
require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT');
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
require(amount0Out < _reserve0 && amount1Out < _reserve1, 'UniswapV2: INSUFFICIENT_LIQUIDITY');
uint balance0;
uint balance1;
{ // scope for _token{0,1}, avoids stack too deep errors
address _token0 = token0;
address _token1 = token1;
require(to != _token0 && to != _token1, 'UniswapV2: INVALID_TO');
if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens
if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens
if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data);
balance0 = IERC20(_token0).balanceOf(address(this));
balance1 = IERC20(_token1).balanceOf(address(this));
}
uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0;
uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0;
require(amount0In > 0 || amount1In > 0, 'UniswapV2: INSUFFICIENT_INPUT_AMOUNT');
{ // scope for reserve{0,1}Adjusted, avoids stack too deep errors
uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3));
uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3));
require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'UniswapV2: K');
}
_update(balance0, balance1, _reserve0, _reserve1);
emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to);
}
// force balances to match reserves
function skim(address to) external lock {
address _token0 = token0; // gas savings
address _token1 = token1; // gas savings
_safeTransfer(_token0, to, IERC20(_token0).balanceOf(address(this)).sub(reserve0));
_safeTransfer(_token1, to, IERC20(_token1).balanceOf(address(this)).sub(reserve1));
}
// force reserves to match balances
function sync() external lock {
_update(IERC20(token0).balanceOf(address(this)), IERC20(token1).balanceOf(address(this)), reserve0, reserve1);
}
} |
1 | 20,291,262 | 5b3febc2b5987c5e2c5e0f033048d9a32edbef833e7e8fe9b8edf29668679577 | 21a7fa3ac9cb623b6855cdf92586c212083f2df16305e60cd52cd30df6ac77a9 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | 1964dc4ee572631c6947096736238716b15ce0ee | 6101206040523480156200001257600080fd5b5060405162000f8938038062000f89833981810160405260a08110156200003857600080fd5b81516020830151604080850151606086015160808701805193519597949692959194919392820192846401000000008211156200007457600080fd5b9083019060208201858111156200008a57600080fd5b8251640100000000811182820188101715620000a557600080fd5b82525081516020918201929091019080838360005b83811015620000d4578181015183820152602001620000ba565b50505050905090810190601f168015620001025780820380516001836020036101000a031916815260200191505b50604052505050600083116200011757600080fd5b60808590526001600160601b0319606085901b1660a05260c083905260e08290526040805163313ce56760e01b815290516000916001600160a01b0387169163313ce56791600480820192602092909190829003018186803b1580156200017d57600080fd5b505afa15801562000192573d6000803e3d6000fd5b505050506040513d6020811015620001a957600080fd5b505160ff169050620001c9601282620001f2602090811b6200063a17901c565b600a0a610100528151620001e590600090602085019062000250565b50505050505050620002fc565b6000828211156200024a576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282620002885760008555620002d3565b82601f10620002a357805160ff1916838001178555620002d3565b82800160010185558215620002d3579182015b82811115620002d3578251825591602001919060010190620002b6565b50620002e1929150620002e5565b5090565b5b80821115620002e15760008155600101620002e6565b60805160a05160601c60c05160e05161010051610c09620003806000398061060f5280610ab05250806101c4528061059f528061097f5280610a1752508061020c52806109e55250806101e85280610259528061050b52806106a952508061023052806102f252806108f752806109a05280610a585280610a8b5250610c096000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c806392ce710f1161005b57806392ce710f146100db57806395d89b41146101205780639f0571511461019d578063c36af460146101ba57610088565b80632ab4dd191461008d5780635004d36c146100a75780636a077536146100cb578063900cf0cf146100d3575b600080fd5b6100956101c2565b60408051918252519081900360200190f35b6100af6101e6565b604080516001600160a01b039092168252519081900360200190f35b61009561020a565b61009561022e565b6100f8600480360360208110156100f157600080fd5b5035610252565b604080516001600160501b039094168452602084019290925282820152519081900360600190f35b610128610463565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561016257818101518382015260200161014a565b50505050905090810190601f16801561018f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610095600480360360208110156101b357600080fd5b50356104f1565b610095610504565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156102b057600080fd5b505afa1580156102c4573d6000803e3d6000fd5b505050506040513d60a08110156102da57600080fd5b508051602082015160609092015190945090925090507f000000000000000000000000000000000000000000000000000000000000000084018110156103655760005b6101f48110801561032e5750848210155b801561033957508215155b1561035f576000199093019261034e8461069c565b50919550909350505060010161031d565b50610440565b600160005b846001600160501b0316826001600160501b0316116103c757508084036103908161069c565b509196509094505050858310806103a5575083155b156103af576103c7565b935060011b6a01fffffffffffffffffffe168361036a565b846001600160501b0316816001016001600160501b031610156104285760028582016001600160501b0316046103fc8161069c565b50919750909550505086841080610411575084155b1561041e57809150610422565b8095505b506103c7565b8094506104348561069c565b50919650909450505050505b838110158061044d575081155b1561045c575060009150819050805b9193909250565b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156104e95780601f106104be576101008083540402835291602001916104e9565b820191906000526020600020905b8154815290600101906020018083116104cc57829003601f168201915b505050505081565b60006104fc82610877565b90505b919050565b60008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b15801561056257600080fd5b505afa158015610576573d6000803e3d6000fd5b505050506040513d60a081101561058c57600080fd5b50602081015160609091015190925090507f00000000000000000000000000000000000000000000000000000000000000004203811015610609576040805162461bcd60e51b81526020600482015260126024820152715374616c65207072696365206f7261636c6560701b604482015290519081900360640190fd5b610633827f0000000000000000000000000000000000000000000000000000000000000000610af8565b9250505090565b600082821115610691576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b508082035b92915050565b60008060008060008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639a6fc8f560e01b8960405160200180826001600160501b0316815260200191505060405160208183030381529060405260405160200180836001600160e01b031916815260040182805190602001908083835b602083106107445780518252601f199092019160209182019101610725565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040526040518082805190602001908083835b602083106107a85780518252601f199092019160209182019101610789565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114610808576040519150601f19603f3d011682016040523d82523d6000602084013e61080d565b606091505b5091509150811561085a578080602001905160a081101561082d57600080fd5b508051602082015160408301516060840151608090940151929a509098509650909450925061086e915050565b8760008060008b9650965096509650965050505b91939590929450565b6000814210156108b9576040805162461bcd60e51b81526020600482015260086024820152672a37b79039b7b7b760c11b604482015290519081900360640190fd5b60008060006108c785610252565b92509250925081600014156108e257600093505050506104ff565b6000856001825b6101f48110801561091c57507f000000000000000000000000000000000000000000000000000000000000000089038510155b156109e25761093761093087878603610af8565b8590610b58565b93508492506001600160501b03871661094f576109e2565b600019909601956000806109628961069c565b50935050925050816000148061097757508681115b806109c557507f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000008c030381105b156109d15750506109e2565b9096509450600191820191016108e9565b507f00000000000000000000000000000000000000000000000000000000000000008110610ae957806001148015610a3b57507f0000000000000000000000000000000000000000000000000000000000000000880384105b15610a4f57600096505050505050506104ff565b610a87610a80867f00000000000000000000000000000000000000000000000000000000000000008b038503610af8565b8490610b58565b92507f0000000000000000000000000000000000000000000000000000000000000000610ad4847f0000000000000000000000000000000000000000000000000000000000000000610af8565b81610adb57fe5b0496505050505050506104ff565b600096505050505050506104ff565b600082610b0757506000610696565b82820282848281610b1457fe5b0414610b515760405162461bcd60e51b8152600401808060200182810382526021815260200180610bb36021913960400191505060405180910390fd5b9392505050565b600082820183811015610b51576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fdfe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a264697066735822122068889fb82b49525a79f2e89a8be1eff8c5efed3e32d94fa5bc27dbde3296f13c64736f6c634300070600330000000000000000000000000000000000000000000000000000000000000708000000000000000000000000d962fc30a72a84ce50161031391756bf2876af5d0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000001fa4000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000074356582d55534400000000000000000000000000000000000000000000000000 | 608060405234801561001057600080fd5b50600436106100885760003560e01c806392ce710f1161005b57806392ce710f146100db57806395d89b41146101205780639f0571511461019d578063c36af460146101ba57610088565b80632ab4dd191461008d5780635004d36c146100a75780636a077536146100cb578063900cf0cf146100d3575b600080fd5b6100956101c2565b60408051918252519081900360200190f35b6100af6101e6565b604080516001600160a01b039092168252519081900360200190f35b61009561020a565b61009561022e565b6100f8600480360360208110156100f157600080fd5b5035610252565b604080516001600160501b039094168452602084019290925282820152519081900360600190f35b610128610463565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561016257818101518382015260200161014a565b50505050905090810190601f16801561018f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610095600480360360208110156101b357600080fd5b50356104f1565b610095610504565b7f000000000000000000000000000000000000000000000000000000000001fa4081565b7f000000000000000000000000d962fc30a72a84ce50161031391756bf2876af5d81565b7f000000000000000000000000000000000000000000000000000000000000000181565b7f000000000000000000000000000000000000000000000000000000000000070881565b60008060007f000000000000000000000000d962fc30a72a84ce50161031391756bf2876af5d6001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156102b057600080fd5b505afa1580156102c4573d6000803e3d6000fd5b505050506040513d60a08110156102da57600080fd5b508051602082015160609092015190945090925090507f000000000000000000000000000000000000000000000000000000000000070884018110156103655760005b6101f48110801561032e5750848210155b801561033957508215155b1561035f576000199093019261034e8461069c565b50919550909350505060010161031d565b50610440565b600160005b846001600160501b0316826001600160501b0316116103c757508084036103908161069c565b509196509094505050858310806103a5575083155b156103af576103c7565b935060011b6a01fffffffffffffffffffe168361036a565b846001600160501b0316816001016001600160501b031610156104285760028582016001600160501b0316046103fc8161069c565b50919750909550505086841080610411575084155b1561041e57809150610422565b8095505b506103c7565b8094506104348561069c565b50919650909450505050505b838110158061044d575081155b1561045c575060009150819050805b9193909250565b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156104e95780601f106104be576101008083540402835291602001916104e9565b820191906000526020600020905b8154815290600101906020018083116104cc57829003601f168201915b505050505081565b60006104fc82610877565b90505b919050565b60008060007f000000000000000000000000d962fc30a72a84ce50161031391756bf2876af5d6001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b15801561056257600080fd5b505afa158015610576573d6000803e3d6000fd5b505050506040513d60a081101561058c57600080fd5b50602081015160609091015190925090507f000000000000000000000000000000000000000000000000000000000001fa404203811015610609576040805162461bcd60e51b81526020600482015260126024820152715374616c65207072696365206f7261636c6560701b604482015290519081900360640190fd5b610633827f00000000000000000000000000000000000000000000000000000002540be400610af8565b9250505090565b600082821115610691576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b508082035b92915050565b60008060008060008060007f000000000000000000000000d962fc30a72a84ce50161031391756bf2876af5d6001600160a01b0316639a6fc8f560e01b8960405160200180826001600160501b0316815260200191505060405160208183030381529060405260405160200180836001600160e01b031916815260040182805190602001908083835b602083106107445780518252601f199092019160209182019101610725565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040526040518082805190602001908083835b602083106107a85780518252601f199092019160209182019101610789565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114610808576040519150601f19603f3d011682016040523d82523d6000602084013e61080d565b606091505b5091509150811561085a578080602001905160a081101561082d57600080fd5b508051602082015160408301516060840151608090940151929a509098509650909450925061086e915050565b8760008060008b9650965096509650965050505b91939590929450565b6000814210156108b9576040805162461bcd60e51b81526020600482015260086024820152672a37b79039b7b7b760c11b604482015290519081900360640190fd5b60008060006108c785610252565b92509250925081600014156108e257600093505050506104ff565b6000856001825b6101f48110801561091c57507f000000000000000000000000000000000000000000000000000000000000070889038510155b156109e25761093761093087878603610af8565b8590610b58565b93508492506001600160501b03871661094f576109e2565b600019909601956000806109628961069c565b50935050925050816000148061097757508681115b806109c557507f000000000000000000000000000000000000000000000000000000000001fa407f00000000000000000000000000000000000000000000000000000000000007088c030381105b156109d15750506109e2565b9096509450600191820191016108e9565b507f00000000000000000000000000000000000000000000000000000000000000018110610ae957806001148015610a3b57507f000000000000000000000000000000000000000000000000000000000001fa40880384105b15610a4f57600096505050505050506104ff565b610a87610a80867f00000000000000000000000000000000000000000000000000000000000007088b038503610af8565b8490610b58565b92507f0000000000000000000000000000000000000000000000000000000000000708610ad4847f00000000000000000000000000000000000000000000000000000002540be400610af8565b81610adb57fe5b0496505050505050506104ff565b600096505050505050506104ff565b600082610b0757506000610696565b82820282848281610b1457fe5b0414610b515760405162461bcd60e51b8152600401808060200182810382526021815260200180610bb36021913960400191505060405180910390fd5b9392505050565b600082820183811015610b51576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fdfe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a264697066735822122068889fb82b49525a79f2e89a8be1eff8c5efed3e32d94fa5bc27dbde3296f13c64736f6c63430007060033 | {{
"language": "Solidity",
"sources": {
"@openzeppelin/contracts/math/SafeMath.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0;\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\n * checks.\n *\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\n * in bugs, because programmers usually assume that an overflow raises an\n * error, which is the standard behavior in high level programming languages.\n * `SafeMath` restores this intuition by reverting the transaction when an\n * operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n\n /**\n * @dev Returns the substraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, \"SafeMath: addition overflow\");\n return c;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a, \"SafeMath: subtraction overflow\");\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) return 0;\n uint256 c = a * b;\n require(c / a == b, \"SafeMath: multiplication overflow\");\n return c;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b > 0, \"SafeMath: division by zero\");\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b > 0, \"SafeMath: modulo by zero\");\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n return a - b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryDiv}.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n return a % b;\n }\n}\n"
},
"contracts/f(x)/oracle/FxChainlinkTwapOracle.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.6;\n\nimport \"@openzeppelin/contracts/math/SafeMath.sol\";\n\nimport { AggregatorV3Interface } from \"../../price-oracle/interfaces/AggregatorV3Interface.sol\";\nimport { ITwapOracle } from \"../../price-oracle/interfaces/ITwapOracle.sol\";\n\n// solhint-disable not-rely-on-time\n// solhint-disable reason-string\n\ncontract FxChainlinkTwapOracle is ITwapOracle {\n using SafeMath for uint256;\n\n uint256 private constant MAX_ITERATION = 500;\n\n /// @notice The twap duration.\n uint256 public immutable epoch;\n\n /// @notice Chainlink aggregator used as the data source.\n address public immutable chainlinkAggregator;\n\n /// @notice Minimum number of Chainlink rounds required in an epoch.\n uint256 public immutable chainlinkMinMessageCount;\n\n /// @notice Maximum gap between an epoch start and a previous Chainlink round for the round\n /// to be used in TWAP calculation.\n /// @dev This should at least be equal to Chainlink's heartbeat duration.\n uint256 public immutable chainlinkMessageExpiration;\n\n /// @dev A multiplier that normalizes price from the Chainlink aggregator to 18 decimal places.\n uint256 private immutable _chainlinkPriceMultiplier;\n\n string public symbol;\n\n constructor(\n uint256 epoch_,\n address chainlinkAggregator_,\n uint256 chainlinkMinMessageCount_,\n uint256 chainlinkMessageExpiration_,\n string memory symbol_\n ) {\n require(chainlinkMinMessageCount_ > 0);\n\n epoch = epoch_;\n chainlinkAggregator = chainlinkAggregator_;\n chainlinkMinMessageCount = chainlinkMinMessageCount_;\n chainlinkMessageExpiration = chainlinkMessageExpiration_;\n uint256 decimal = AggregatorV3Interface(chainlinkAggregator_).decimals();\n _chainlinkPriceMultiplier = 10**(uint256(18).sub(decimal));\n symbol = symbol_;\n }\n\n /// @inheritdoc ITwapOracle\n function getLatest() external view override returns (uint256) {\n (, int256 answer, , uint256 updatedAt, ) = AggregatorV3Interface(chainlinkAggregator).latestRoundData();\n require(updatedAt >= block.timestamp - chainlinkMessageExpiration, \"Stale price oracle\");\n return uint256(answer).mul(_chainlinkPriceMultiplier);\n }\n\n /// @inheritdoc ITwapOracle\n function getTwap(uint256 timestamp) external view override returns (uint256) {\n return _getTwapFromChainlink(timestamp);\n }\n\n /// @notice Search for the last round before the given timestamp. Zeros are returned\n /// if the search fails.\n function findLastRoundBefore(uint256 timestamp)\n public\n view\n returns (\n uint80 roundID,\n int256 answer,\n uint256 updatedAt\n )\n {\n (roundID, answer, , updatedAt, ) = AggregatorV3Interface(chainlinkAggregator).latestRoundData();\n if (updatedAt < timestamp + epoch) {\n // Fast path: sequentially check each round when the target epoch is in the near past.\n for (uint256 i = 0; i < MAX_ITERATION && updatedAt >= timestamp && answer != 0; i++) {\n roundID--;\n (, answer, , updatedAt, ) = _getChainlinkRoundData(roundID);\n }\n } else {\n // Slow path: binary search. During the search, the `roundID` round is always updated\n // at or after the given timestamp, and the `leftRoundID` round is either invalid or\n // updated before the given timestamp.\n uint80 step = 1;\n uint80 leftRoundID = 0;\n while (step <= roundID) {\n leftRoundID = roundID - step;\n (, answer, , updatedAt, ) = _getChainlinkRoundData(leftRoundID);\n if (updatedAt < timestamp || answer == 0) {\n break;\n }\n step <<= 1;\n roundID = leftRoundID;\n }\n while (leftRoundID + 1 < roundID) {\n uint80 midRoundID = (leftRoundID + roundID) / 2;\n (, answer, , updatedAt, ) = _getChainlinkRoundData(midRoundID);\n if (updatedAt < timestamp || answer == 0) {\n leftRoundID = midRoundID;\n } else {\n roundID = midRoundID;\n }\n }\n roundID = leftRoundID;\n (, answer, , updatedAt, ) = _getChainlinkRoundData(roundID);\n }\n if (updatedAt >= timestamp || answer == 0) {\n // The last round before the epoch end is not found, due to either discontinuous\n // round IDs caused by a phase change or abnormal `updatedAt` timestamps.\n return (0, 0, 0);\n }\n }\n\n /// @dev Calculate TWAP of the given epoch from the Chainlink oracle.\n /// @param timestamp End timestamp of the epoch to be updated\n /// @return TWAP of the epoch calculated from Chainlink, or zero if there's no sufficient data\n function _getTwapFromChainlink(uint256 timestamp) private view returns (uint256) {\n require(block.timestamp >= timestamp, \"Too soon\");\n (uint80 roundID, int256 answer, uint256 updatedAt) = findLastRoundBefore(timestamp);\n if (answer == 0) {\n return 0;\n }\n uint256 sum = 0;\n uint256 sumTimestamp = timestamp;\n uint256 messageCount = 1;\n for (uint256 i = 0; i < MAX_ITERATION && updatedAt >= timestamp - epoch; i++) {\n sum = sum.add(uint256(answer).mul(sumTimestamp - updatedAt));\n sumTimestamp = updatedAt;\n if (roundID == 0) {\n break;\n }\n roundID--;\n (, int256 newAnswer, , uint256 newUpdatedAt, ) = _getChainlinkRoundData(roundID);\n if (newAnswer == 0 || newUpdatedAt > updatedAt || newUpdatedAt < timestamp - epoch - chainlinkMessageExpiration) {\n break; // Stop if the previous round is invalid\n }\n answer = newAnswer;\n updatedAt = newUpdatedAt;\n messageCount++;\n }\n if (messageCount >= chainlinkMinMessageCount) {\n // the only update is expired.\n if (messageCount == 1 && updatedAt < timestamp - chainlinkMessageExpiration) return 0;\n\n sum = sum.add(uint256(answer).mul(sumTimestamp - (timestamp - epoch)));\n return sum.mul(_chainlinkPriceMultiplier) / epoch;\n } else {\n return 0;\n }\n }\n\n /// @dev Call `chainlinkAggregator.getRoundData(roundID)`. Return zero if the call reverts.\n function _getChainlinkRoundData(uint80 roundID)\n private\n view\n returns (\n uint80,\n int256,\n uint256,\n uint256,\n uint80\n )\n {\n (bool success, bytes memory returnData) = chainlinkAggregator.staticcall(\n abi.encodePacked(AggregatorV3Interface.getRoundData.selector, abi.encode(roundID))\n );\n if (success) {\n return abi.decode(returnData, (uint80, int256, uint256, uint256, uint80));\n } else {\n return (roundID, 0, 0, 0, roundID);\n }\n }\n}\n"
},
"contracts/price-oracle/interfaces/AggregatorV3Interface.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0 || ^0.8.0;\n\ninterface AggregatorV3Interface {\n function decimals() external view returns (uint8);\n\n function description() external view returns (string memory);\n\n function version() external view returns (uint256);\n\n function latestAnswer() external view returns (uint256);\n\n function getRoundData(uint80 _roundId)\n external\n view\n returns (\n uint80 roundId,\n int256 answer,\n uint256 startedAt,\n uint256 updatedAt,\n uint80 answeredInRound\n );\n\n function latestRoundData()\n external\n view\n returns (\n uint80 roundId,\n int256 answer,\n uint256 startedAt,\n uint256 updatedAt,\n uint80 answeredInRound\n );\n}\n"
},
"contracts/price-oracle/interfaces/ITwapOracle.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0 || ^0.8.0;\n\ninterface ITwapOracle {\n /// @notice Return TWAP with 18 decimal places in the epoch ending at the specified timestamp.\n /// Zero is returned if TWAP in the epoch is not available.\n /// @param timestamp End Timestamp in seconds of the epoch\n /// @return TWAP (18 decimal places) in the epoch, or zero if not available\n function getTwap(uint256 timestamp) external view returns (uint256);\n\n /// @notice Return the latest price with 18 decimal places.\n function getLatest() external view returns (uint256);\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "istanbul",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}
}} |
1 | 20,291,264 | 56685a74035c3755f31a16ebd6abe2f2a9199efb413d7d5c087fad78accfb174 | 0f5d74eeb121f1c4087b9bcac014ec00d18e4db440c1b37a0787c8e92146de57 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | 7267277682ffc281b00b0ec56d8de22e8ae88e13 | 61010060405234801562000011575f80fd5b506040516200125538038062001255833981016040819052620000349162000152565b828285620000423362000084565b6001600160a01b0390811660805260a0839052811660c0526200006c662386f26fc10000620000a2565b50506001600160a01b031660e05250620001a3915050565b600180546001600160a01b03191690556200009f81620000e7565b50565b600580549082905560408051828152602081018490527f23df930eba8ee7044ae7ac6a1957ef1e8e314bdcebc6347bc92decdbff21b717910160405180910390a15050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200014d575f80fd5b919050565b5f805f806080858703121562000166575f80fd5b620001718562000136565b935060208501519250620001886040860162000136565b9150620001986060860162000136565b905092959194509250565b60805160a05160c05160e051611069620001ec5f395f81816101fc015261086301525f818161017801526109f201525f81816101b7015261076d01525f610a4101526110695ff3fe608060405234801561000f575f80fd5b5060043610610111575f3560e01c80638e276af21161009e57806398d5fdca1161006e57806398d5fdca14610252578063c6bd4b251461027c578063e30c397814610284578063f2fde38b14610295578063fe6b400d146102a8575f80fd5b80638e276af2146101f75780639224a3351461021e578063961c91e514610241578063975b866214610249575f80fd5b8063715018a6116100e4578063715018a61461016357806379ba50971461016b5780638281e85c1461017357806384de4087146101b25780638da5cb5b146101e7575f80fd5b806305b79940146101155780632427546d1461013357806324f1c5c114610148578063474eb5a51461015b575b5f80fd5b61011d6102b0565b60405161012a9190610cb0565b60405180910390f35b610146610141366004610d07565b610348565b005b610146610156366004610db6565b6103c4565b61011d6103d8565b6101466103ea565b6101466103fd565b61019a7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161012a565b6101d97f000000000000000000000000000000000000000000000000000000000000000081565b60405190815260200161012a565b5f546001600160a01b031661019a565b61019a7f000000000000000000000000000000000000000000000000000000000000000081565b610226610479565b6040805193845260208401929092529082015260600161012a565b6101d9610490565b6101d960055481565b61025a610499565b604080519415158552602085019390935291830152606082015260800161012a565b6101d96104d0565b6001546001600160a01b031661019a565b6101466102a3366004610dcd565b6104d9565b61011d610549565b6060610343600380546102c290610df3565b80601f01602080910402602001604051908101604052809291908181526020018280546102ee90610df3565b80156103395780601f1061031057610100808354040283529160200191610339565b820191905f5260205f20905b81548152906001019060200180831161031c57829003601f168201915b505050505061055b565b905090565b6103506106ae565b5f61035a8361055b565b9050815f0361039657600261036f8482610e78565b5080515f036103915760405163f23044db60e01b815260040160405180910390fd5b505050565b816001036103b05760036103aa8482610e78565b50505050565b816002036103915760046103aa8482610e78565b6103cc6106ae565b6103d581610707565b50565b6060610343600480546102c290610df3565b6103f26106ae565b6103fb5f61074c565b565b60015433906001600160a01b031681146104705760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b6103d58161074c565b5f805f610484610765565b91959094509092509050565b5f61034361084c565b5f805f806104a561084c565b92506104b0836108d5565b6005548202828203670de0b6b3a764000002109694955090939092509050565b5f6103436109db565b6104e16106ae565b600180546001600160a01b0383166001600160a01b031990911681179091556105115f546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6060610343600280546102c290610df3565b602081015160609060218301905f1a8067ffffffffffffffff81111561058357610583610cf3565b6040519080825280602002602001820160405280156105ac578160200160208202803683370190505b5092505f5b818110156106a6575f805f85515f1a6001870196505f8111156105d957865193506020870196505b60018111156105ed57865192506020870196505b600281111561060157865191506020870196505b50825f036106225760405163f23044db60e01b815260040160405180910390fd5b815f036106555761063283610a29565b87858151811061064457610644610f34565b602002602001018181525050610690565b805f03610666576106328383610ab8565b610671838383610aea565b87858151811061068357610683610f34565b6020026020010181815250505b505050808061069e90610f5c565b9150506105b1565b505050919050565b5f546001600160a01b031633146103fb5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610467565b600580549082905560408051828152602081018490527f23df930eba8ee7044ae7ac6a1957ef1e8e314bdcebc6347bc92decdbff21b717910160405180910390a15050565b600180546001600160a01b03191690556103d581610b1e565b5f805f6107917f0000000000000000000000000000000000000000000000000000000000000000610b6d565b92505f6107a4600280546102c290610df3565b90508391508192505f5b815181101561084557828282815181106107ca576107ca610f34565b602002602001015111156107f5578181815181106107ea576107ea610f34565b602002602001015192505b8382828151811061080857610808610f34565b602002602001015110156108335781818151811061082857610828610f34565b602002602001015193505b8061083d81610f5c565b9150506107ae565b5050909192565b604051639f05715160e01b81524260048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639f057151906024015b602060405180830381865afa1580156108b1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103439190610f74565b80805f806108e1610765565b92509250505f6108ef6102b0565b90505f6108fa6103d8565b82519091505f195f805b8381101561094a575f86828151811061091f5761091f610f34565b6020026020010151905082811115610935578092505b83811015610941578093505b50600101610904565b5080156109825761096789670de0b6b3a7640000848a0204610c8b565b985061097f88670de0b6b3a764000083890204610ca2565b97505b835192505f5b838110156109ce575f8582815181106109a3576109a3610f34565b60200260200101519050898111156109b9578099505b8a8110156109c557809a505b50600101610988565b5050505050505050915091565b604051639f05715160e01b81524260048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639f05715190602401610896565b604051630fda366d60e01b8152600481018290525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690630fda366d90602401602060405180830381865afa158015610a8e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ab29190610f74565b92915050565b5f670de0b6b3a7640000610acb83610a29565b610ad485610a29565b0281610ae257610ae2610f8b565b049392505050565b5f670de0b6b3a7640000610afd83610a29565b610b078686610ab8565b0281610b1557610b15610f8b565b04949350505050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f805f808460601c925067ffffffffffffffff8560201c16915063ffffffff851690505f80846001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610bce573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bf29190610fbd565b509350509250505f821215610c335760405162461bcd60e51b81526020600482015260076024820152661a5b9d985b1a5960ca1b6044820152606401610467565b82610c3e8242611009565b1115610c765760405162461bcd60e51b8152602060048201526007602482015266195e1c1a5c995960ca1b6044820152606401610467565b610c80848361101c565b979650505050505050565b5f818310610c995781610c9b565b825b9392505050565b5f818311610c995781610c9b565b602080825282518282018190525f9190848201906040850190845b81811015610ce757835183529284019291840191600101610ccb565b50909695505050505050565b634e487b7160e01b5f52604160045260245ffd5b5f8060408385031215610d18575f80fd5b823567ffffffffffffffff80821115610d2f575f80fd5b818501915085601f830112610d42575f80fd5b813581811115610d5457610d54610cf3565b604051601f8201601f19908116603f01168101908382118183101715610d7c57610d7c610cf3565b81604052828152886020848701011115610d94575f80fd5b826020860160208301375f602093820184015298969091013596505050505050565b5f60208284031215610dc6575f80fd5b5035919050565b5f60208284031215610ddd575f80fd5b81356001600160a01b0381168114610c9b575f80fd5b600181811c90821680610e0757607f821691505b602082108103610e2557634e487b7160e01b5f52602260045260245ffd5b50919050565b601f821115610391575f81815260208120601f850160051c81016020861015610e515750805b601f850160051c820191505b81811015610e7057828155600101610e5d565b505050505050565b815167ffffffffffffffff811115610e9257610e92610cf3565b610ea681610ea08454610df3565b84610e2b565b602080601f831160018114610ed9575f8415610ec25750858301515b5f19600386901b1c1916600185901b178555610e70565b5f85815260208120601f198616915b82811015610f0757888601518255948401946001909101908401610ee8565b5085821015610f2457878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b5f60018201610f6d57610f6d610f48565b5060010190565b5f60208284031215610f84575f80fd5b5051919050565b634e487b7160e01b5f52601260045260245ffd5b805169ffffffffffffffffffff81168114610fb8575f80fd5b919050565b5f805f805f60a08688031215610fd1575f80fd5b610fda86610f9f565b9450602086015193506040860151925060608601519150610ffd60808701610f9f565b90509295509295909350565b81810381811115610ab257610ab2610f48565b8082028115828204841417610ab257610ab2610f4856fea264697066735822122059ee5f811d0a93378335150832424b49fdc9e00d81cc4780a54785419a02308664736f6c63430008140033000000000000000000000000c2312caf0de62ec9b4adc785c79851cb989c9abc5f4ec3df9cbd43714fe2740f5e3616155c5b841900000002540be40000002a300000000000000000000000002eb56aa6a6e48b142287f723e547c687281580bd0000000000000000000000001964dc4ee572631c6947096736238716b15ce0ee | 608060405234801561000f575f80fd5b5060043610610111575f3560e01c80638e276af21161009e57806398d5fdca1161006e57806398d5fdca14610252578063c6bd4b251461027c578063e30c397814610284578063f2fde38b14610295578063fe6b400d146102a8575f80fd5b80638e276af2146101f75780639224a3351461021e578063961c91e514610241578063975b866214610249575f80fd5b8063715018a6116100e4578063715018a61461016357806379ba50971461016b5780638281e85c1461017357806384de4087146101b25780638da5cb5b146101e7575f80fd5b806305b79940146101155780632427546d1461013357806324f1c5c114610148578063474eb5a51461015b575b5f80fd5b61011d6102b0565b60405161012a9190610cb0565b60405180910390f35b610146610141366004610d07565b610348565b005b610146610156366004610db6565b6103c4565b61011d6103d8565b6101466103ea565b6101466103fd565b61019a7f0000000000000000000000002eb56aa6a6e48b142287f723e547c687281580bd81565b6040516001600160a01b03909116815260200161012a565b6101d97f5f4ec3df9cbd43714fe2740f5e3616155c5b841900000002540be40000002a3081565b60405190815260200161012a565b5f546001600160a01b031661019a565b61019a7f0000000000000000000000001964dc4ee572631c6947096736238716b15ce0ee81565b610226610479565b6040805193845260208401929092529082015260600161012a565b6101d9610490565b6101d960055481565b61025a610499565b604080519415158552602085019390935291830152606082015260800161012a565b6101d96104d0565b6001546001600160a01b031661019a565b6101466102a3366004610dcd565b6104d9565b61011d610549565b6060610343600380546102c290610df3565b80601f01602080910402602001604051908101604052809291908181526020018280546102ee90610df3565b80156103395780601f1061031057610100808354040283529160200191610339565b820191905f5260205f20905b81548152906001019060200180831161031c57829003601f168201915b505050505061055b565b905090565b6103506106ae565b5f61035a8361055b565b9050815f0361039657600261036f8482610e78565b5080515f036103915760405163f23044db60e01b815260040160405180910390fd5b505050565b816001036103b05760036103aa8482610e78565b50505050565b816002036103915760046103aa8482610e78565b6103cc6106ae565b6103d581610707565b50565b6060610343600480546102c290610df3565b6103f26106ae565b6103fb5f61074c565b565b60015433906001600160a01b031681146104705760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b6103d58161074c565b5f805f610484610765565b91959094509092509050565b5f61034361084c565b5f805f806104a561084c565b92506104b0836108d5565b6005548202828203670de0b6b3a764000002109694955090939092509050565b5f6103436109db565b6104e16106ae565b600180546001600160a01b0383166001600160a01b031990911681179091556105115f546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6060610343600280546102c290610df3565b602081015160609060218301905f1a8067ffffffffffffffff81111561058357610583610cf3565b6040519080825280602002602001820160405280156105ac578160200160208202803683370190505b5092505f5b818110156106a6575f805f85515f1a6001870196505f8111156105d957865193506020870196505b60018111156105ed57865192506020870196505b600281111561060157865191506020870196505b50825f036106225760405163f23044db60e01b815260040160405180910390fd5b815f036106555761063283610a29565b87858151811061064457610644610f34565b602002602001018181525050610690565b805f03610666576106328383610ab8565b610671838383610aea565b87858151811061068357610683610f34565b6020026020010181815250505b505050808061069e90610f5c565b9150506105b1565b505050919050565b5f546001600160a01b031633146103fb5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610467565b600580549082905560408051828152602081018490527f23df930eba8ee7044ae7ac6a1957ef1e8e314bdcebc6347bc92decdbff21b717910160405180910390a15050565b600180546001600160a01b03191690556103d581610b1e565b5f805f6107917f5f4ec3df9cbd43714fe2740f5e3616155c5b841900000002540be40000002a30610b6d565b92505f6107a4600280546102c290610df3565b90508391508192505f5b815181101561084557828282815181106107ca576107ca610f34565b602002602001015111156107f5578181815181106107ea576107ea610f34565b602002602001015192505b8382828151811061080857610808610f34565b602002602001015110156108335781818151811061082857610828610f34565b602002602001015193505b8061083d81610f5c565b9150506107ae565b5050909192565b604051639f05715160e01b81524260048201525f907f0000000000000000000000001964dc4ee572631c6947096736238716b15ce0ee6001600160a01b031690639f057151906024015b602060405180830381865afa1580156108b1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103439190610f74565b80805f806108e1610765565b92509250505f6108ef6102b0565b90505f6108fa6103d8565b82519091505f195f805b8381101561094a575f86828151811061091f5761091f610f34565b6020026020010151905082811115610935578092505b83811015610941578093505b50600101610904565b5080156109825761096789670de0b6b3a7640000848a0204610c8b565b985061097f88670de0b6b3a764000083890204610ca2565b97505b835192505f5b838110156109ce575f8582815181106109a3576109a3610f34565b60200260200101519050898111156109b9578099505b8a8110156109c557809a505b50600101610988565b5050505050505050915091565b604051639f05715160e01b81524260048201525f907f0000000000000000000000002eb56aa6a6e48b142287f723e547c687281580bd6001600160a01b031690639f05715190602401610896565b604051630fda366d60e01b8152600481018290525f907f000000000000000000000000c2312caf0de62ec9b4adc785c79851cb989c9abc6001600160a01b031690630fda366d90602401602060405180830381865afa158015610a8e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ab29190610f74565b92915050565b5f670de0b6b3a7640000610acb83610a29565b610ad485610a29565b0281610ae257610ae2610f8b565b049392505050565b5f670de0b6b3a7640000610afd83610a29565b610b078686610ab8565b0281610b1557610b15610f8b565b04949350505050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f805f808460601c925067ffffffffffffffff8560201c16915063ffffffff851690505f80846001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610bce573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bf29190610fbd565b509350509250505f821215610c335760405162461bcd60e51b81526020600482015260076024820152661a5b9d985b1a5960ca1b6044820152606401610467565b82610c3e8242611009565b1115610c765760405162461bcd60e51b8152602060048201526007602482015266195e1c1a5c995960ca1b6044820152606401610467565b610c80848361101c565b979650505050505050565b5f818310610c995781610c9b565b825b9392505050565b5f818311610c995781610c9b565b602080825282518282018190525f9190848201906040850190845b81811015610ce757835183529284019291840191600101610ccb565b50909695505050505050565b634e487b7160e01b5f52604160045260245ffd5b5f8060408385031215610d18575f80fd5b823567ffffffffffffffff80821115610d2f575f80fd5b818501915085601f830112610d42575f80fd5b813581811115610d5457610d54610cf3565b604051601f8201601f19908116603f01168101908382118183101715610d7c57610d7c610cf3565b81604052828152886020848701011115610d94575f80fd5b826020860160208301375f602093820184015298969091013596505050505050565b5f60208284031215610dc6575f80fd5b5035919050565b5f60208284031215610ddd575f80fd5b81356001600160a01b0381168114610c9b575f80fd5b600181811c90821680610e0757607f821691505b602082108103610e2557634e487b7160e01b5f52602260045260245ffd5b50919050565b601f821115610391575f81815260208120601f850160051c81016020861015610e515750805b601f850160051c820191505b81811015610e7057828155600101610e5d565b505050505050565b815167ffffffffffffffff811115610e9257610e92610cf3565b610ea681610ea08454610df3565b84610e2b565b602080601f831160018114610ed9575f8415610ec25750858301515b5f19600386901b1c1916600185901b178555610e70565b5f85815260208120601f198616915b82811015610f0757888601518255948401946001909101908401610ee8565b5085821015610f2457878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b5f60018201610f6d57610f6d610f48565b5060010190565b5f60208284031215610f84575f80fd5b5051919050565b634e487b7160e01b5f52601260045260245ffd5b805169ffffffffffffffffffff81168114610fb8575f80fd5b919050565b5f805f805f60a08688031215610fd1575f80fd5b610fda86610f9f565b9450602086015193506040860151925060608601519150610ffd60808701610f9f565b90509295509295909350565b81810381811115610ab257610ab2610f48565b8082028115828204841417610ab257610ab2610f4856fea264697066735822122059ee5f811d0a93378335150832424b49fdc9e00d81cc4780a54785419a02308664736f6c63430008140033 | {{
"language": "Solidity",
"sources": {
"@openzeppelin/contracts-v4/access/Ownable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n"
},
"@openzeppelin/contracts-v4/access/Ownable2Step.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./Ownable.sol\";\n\n/**\n * @dev Contract module which provides access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership} and {acceptOwnership}.\n *\n * This module is used through inheritance. It will make available all functions\n * from parent (Ownable).\n */\nabstract contract Ownable2Step is Ownable {\n address private _pendingOwner;\n\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Returns the address of the pending owner.\n */\n function pendingOwner() public view virtual returns (address) {\n return _pendingOwner;\n }\n\n /**\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual override onlyOwner {\n _pendingOwner = newOwner;\n emit OwnershipTransferStarted(owner(), newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual override {\n delete _pendingOwner;\n super._transferOwnership(newOwner);\n }\n\n /**\n * @dev The new owner accepts the ownership transfer.\n */\n function acceptOwnership() public virtual {\n address sender = _msgSender();\n require(pendingOwner() == sender, \"Ownable2Step: caller is not the new owner\");\n _transferOwnership(sender);\n }\n}\n"
},
"@openzeppelin/contracts-v4/utils/Context.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n"
},
"@openzeppelin/contracts-v4/utils/math/Math.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n"
},
"contracts/f(x)/oracle/FxCVXOracle.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\nimport { Math } from \"@openzeppelin/contracts-v4/utils/math/Math.sol\";\n\nimport { ITwapOracle } from \"../../price-oracle/interfaces/ITwapOracle.sol\";\nimport { ICurvePoolOracle } from \"../../interfaces/ICurvePoolOracle.sol\";\n\nimport { FxSpotOracleBase } from \"./FxSpotOracleBase.sol\";\nimport { FxERC20OracleBase } from \"./FxERC20OracleBase.sol\";\n\ncontract FxCVXOracle is FxERC20OracleBase {\n /*************\n * Constants *\n *************/\n\n /// @notice The address of the Chainlink CVX/USD Twap.\n address public immutable Chainlink_CVX_USD_Twap;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(\n address _spotPriceOracle,\n bytes32 _Chainlink_ETH_USD_Spot,\n address _Chainlink_ETH_USD_Twap,\n address _Chainlink_CVX_USD_Twap\n ) FxSpotOracleBase(_spotPriceOracle) FxERC20OracleBase(_Chainlink_ETH_USD_Spot, _Chainlink_ETH_USD_Twap) {\n Chainlink_CVX_USD_Twap = _Chainlink_CVX_USD_Twap;\n }\n\n /**********************\n * Internal Functions *\n **********************/\n\n /// @inheritdoc FxERC20OracleBase\n /// @dev [Chainlink CVX/USD twap]\n function _getERC20USDTwap() internal view virtual override returns (uint256) {\n return ITwapOracle(Chainlink_CVX_USD_Twap).getTwap(block.timestamp);\n }\n}\n"
},
"contracts/f(x)/oracle/FxERC20OracleBase.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\nimport { Math } from \"@openzeppelin/contracts-v4/utils/math/Math.sol\";\n\nimport { FxSpotOracleBase } from \"./FxSpotOracleBase.sol\";\n\nimport { IFxPriceOracleV2 } from \"../../interfaces/f(x)/IFxPriceOracleV2.sol\";\nimport { ITwapOracle } from \"../../price-oracle/interfaces/ITwapOracle.sol\";\n\nabstract contract FxERC20OracleBase is FxSpotOracleBase, IFxPriceOracleV2 {\n /*************\n * Constants *\n *************/\n\n /// @notice The Chainlink ETH/USD price feed.\n /// @dev See comments of `_readSpotPriceByChainlink` for more details.\n bytes32 public immutable Chainlink_ETH_USD_Spot;\n\n /// @notice The address of the Chainlink ETH/USD Twap.\n address public immutable Chainlink_ETH_USD_Twap;\n\n /*************\n * Variables *\n *************/\n\n /// @dev The encodings for ETH/USD spot sources.\n bytes private onchainSpotEncodings_ETHUSD;\n\n /// @dev The encodings for ERC20/ETH spot sources.\n bytes private onchainSpotEncodings_ERC20ETH;\n\n /// @dev The encodings for ERC20/USD spot sources.\n bytes private onchainSpotEncodings_ERC20USD;\n\n /// @notice The value of maximum price deviation, multiplied by 1e18.\n uint256 public maxPriceDeviation;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(bytes32 _Chainlink_ETH_USD_Spot, address _Chainlink_ETH_USD_Twap) {\n Chainlink_ETH_USD_Spot = _Chainlink_ETH_USD_Spot;\n Chainlink_ETH_USD_Twap = _Chainlink_ETH_USD_Twap;\n\n _updateMaxPriceDeviation(1e16); // 1%\n }\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @notice Return the ETH/USD spot price.\n /// @return chainlinkPrice The spot price from Chainlink price feed.\n /// @return minPrice The minimum spot price among all available sources.\n /// @return maxPrice The maximum spot price among all available sources.\n function getETHUSDSpotPrice()\n external\n view\n returns (\n uint256 chainlinkPrice,\n uint256 minPrice,\n uint256 maxPrice\n )\n {\n (chainlinkPrice, minPrice, maxPrice) = _getETHUSDSpotPrice();\n }\n\n /// @notice Return the ETH/USD spot prices.\n /// @return prices The list of spot price among all available sources, multiplied by 1e18.\n function getETHUSDSpotPrices() external view returns (uint256[] memory prices) {\n prices = _getSpotPriceByEncoding(onchainSpotEncodings_ETHUSD);\n }\n\n /// @notice Return the ERC20/ETH spot prices.\n /// @return prices The list of spot price among all available sources, multiplied by 1e18.\n function getERC20ETHSpotPrices() public view returns (uint256[] memory prices) {\n prices = _getSpotPriceByEncoding(onchainSpotEncodings_ERC20ETH);\n }\n\n /// @notice Return the ERC20/ETH spot prices.\n /// @return prices The list of spot price among all available sources, multiplied by 1e18.\n function getERC20USDSpotPrices() public view returns (uint256[] memory prices) {\n prices = _getSpotPriceByEncoding(onchainSpotEncodings_ERC20USD);\n }\n\n /// @notice Return the ETH/USD time-weighted average price.\n /// @return price The time-weighted average price, multiplied by 1e18.\n function getETHUSDTwap() external view returns (uint256 price) {\n price = _getETHUSDTwap();\n }\n\n /// @notice Return the ERC20/USD time-weighted average price.\n /// @return price The time-weighted average price, multiplied by 1e18.\n function getERC20USDTwap() external view returns (uint256 price) {\n price = _getERC20USDTwap();\n }\n\n /// @inheritdoc IFxPriceOracleV2\n /// @dev The price is valid iff |maxPrice-minPrice|/minPrice < maxPriceDeviation\n function getPrice()\n external\n view\n override\n returns (\n bool isValid,\n uint256 twap,\n uint256 minPrice,\n uint256 maxPrice\n )\n {\n twap = _getERC20USDTwap();\n (minPrice, maxPrice) = _getERC20MinMaxPrice(twap);\n unchecked {\n isValid = (maxPrice - minPrice) * PRECISION < maxPriceDeviation * minPrice;\n }\n }\n\n /************************\n * Restricted Functions *\n ************************/\n\n /// @notice Update the on-chain spot encodings.\n /// @param encodings The encodings to update. See `_getSpotPriceByEncoding` for more details.\n /// @param spotType The type of the encodings.\n function updateOnchainSpotEncodings(bytes memory encodings, uint256 spotType) external onlyOwner {\n // validate encoding\n uint256[] memory prices = _getSpotPriceByEncoding(encodings);\n\n if (spotType == 0) {\n onchainSpotEncodings_ETHUSD = encodings;\n if (prices.length == 0) revert ErrorInvalidEncodings();\n } else if (spotType == 1) {\n onchainSpotEncodings_ERC20ETH = encodings;\n } else if (spotType == 2) {\n onchainSpotEncodings_ERC20USD = encodings;\n }\n }\n\n /// @notice Update the value of maximum price deviation.\n /// @param newMaxPriceDeviation The new value of maximum price deviation, multiplied by 1e18.\n function updateMaxPriceDeviation(uint256 newMaxPriceDeviation) external onlyOwner {\n _updateMaxPriceDeviation(newMaxPriceDeviation);\n }\n\n /**********************\n * Internal Functions *\n **********************/\n\n /// @dev Internal function to update the value of maximum price deviation.\n /// @param newMaxPriceDeviation The new value of maximum price deviation, multiplied by 1e18.\n function _updateMaxPriceDeviation(uint256 newMaxPriceDeviation) private {\n uint256 oldMaxPriceDeviation = maxPriceDeviation;\n maxPriceDeviation = newMaxPriceDeviation;\n\n emit UpdateMaxPriceDeviation(oldMaxPriceDeviation, newMaxPriceDeviation);\n }\n\n /// @dev Internal function to calculate the ETH/USD spot price.\n /// @return chainlinkPrice The spot price from Chainlink price feed, multiplied by 1e18.\n /// @return minPrice The minimum spot price among all available sources, multiplied by 1e18.\n /// @return maxPrice The maximum spot price among all available sources, multiplied by 1e18.\n function _getETHUSDSpotPrice()\n internal\n view\n returns (\n uint256 chainlinkPrice,\n uint256 minPrice,\n uint256 maxPrice\n )\n {\n chainlinkPrice = _readSpotPriceByChainlink(Chainlink_ETH_USD_Spot);\n uint256[] memory prices = _getSpotPriceByEncoding(onchainSpotEncodings_ETHUSD);\n minPrice = maxPrice = chainlinkPrice;\n for (uint256 i = 0; i < prices.length; i++) {\n if (prices[i] > maxPrice) maxPrice = prices[i];\n if (prices[i] < minPrice) minPrice = prices[i];\n }\n }\n\n /// @dev Internal function to return the ETH/USD time-weighted average price.\n /// @return price The time-weighted average price of ETH/USD, multiplied by 1e18.\n function _getETHUSDTwap() internal view returns (uint256 price) {\n price = ITwapOracle(Chainlink_ETH_USD_Twap).getTwap(block.timestamp);\n }\n\n /// @dev Internal function to return the min/max ERC20/USD prices.\n /// @param twap The ERC20/USD time-weighted average price, multiplied by 1e18.\n /// @return minPrice The minimum price among all available sources (including twap), multiplied by 1e18.\n /// @return maxPrice The maximum price among all available sources (including twap), multiplied by 1e18.\n function _getERC20MinMaxPrice(uint256 twap) internal view returns (uint256 minPrice, uint256 maxPrice) {\n minPrice = maxPrice = twap;\n (, uint256 minETHUSDPrice, uint256 maxETHUSDPrice) = _getETHUSDSpotPrice();\n uint256[] memory ERC20_ETH_prices = getERC20ETHSpotPrices();\n uint256[] memory ERC20_USD_prices = getERC20USDSpotPrices();\n\n uint256 length = ERC20_ETH_prices.length;\n uint256 ERC20_ETH_minPrice = type(uint256).max;\n uint256 ERC20_ETH_maxPrice;\n unchecked {\n for (uint256 i = 0; i < length; i++) {\n uint256 price = ERC20_ETH_prices[i];\n if (price > ERC20_ETH_maxPrice) ERC20_ETH_maxPrice = price;\n if (price < ERC20_ETH_minPrice) ERC20_ETH_minPrice = price;\n }\n if (ERC20_ETH_maxPrice != 0) {\n minPrice = Math.min(minPrice, (ERC20_ETH_minPrice * minETHUSDPrice) / PRECISION);\n maxPrice = Math.max(maxPrice, (ERC20_ETH_maxPrice * maxETHUSDPrice) / PRECISION);\n }\n\n length = ERC20_USD_prices.length;\n for (uint256 i = 0; i < length; i++) {\n uint256 price = ERC20_USD_prices[i];\n if (price > maxPrice) maxPrice = price;\n if (price < minPrice) minPrice = price;\n }\n }\n }\n\n /// @dev Internal function to return the ERC20/USD time-weighted average price.\n /// @return price The time-weighted average price of ERC20/USD, multiplied by 1e18.\n function _getERC20USDTwap() internal view virtual returns (uint256 price);\n}\n"
},
"contracts/f(x)/oracle/FxSpotOracleBase.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity =0.8.20;\n\nimport { Ownable2Step } from \"@openzeppelin/contracts-v4/access/Ownable2Step.sol\";\n\nimport { AggregatorV3Interface } from \"../../price-oracle/interfaces/AggregatorV3Interface.sol\";\nimport { ISpotPriceOracle } from \"../../price-oracle/interfaces/ISpotPriceOracle.sol\";\n\nabstract contract FxSpotOracleBase is Ownable2Step {\n /**********\n * Errors *\n **********/\n\n /// @dev Thrown when the given encodings are invalid.\n error ErrorInvalidEncodings();\n\n /// @dev Thrown when update some parameters to the same value.\n error ErrorParameterUnchanged();\n\n /*************\n * Constants *\n *************/\n\n /// @dev The precision for oracle price.\n uint256 internal constant PRECISION = 1e18;\n\n /// @dev The address of `SpotPriceOracle` contract.\n address immutable spotPriceOracle;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(address _spotPriceOracle) {\n spotPriceOracle = _spotPriceOracle;\n }\n\n /**********************\n * Internal Functions *\n **********************/\n\n /// @dev The encoding is below.\n /// ```text\n /// | 32 bits | 64 bits | 160 bits |\n /// | heartbeat | scale | price_feed |\n /// |low high |\n /// ```\n function _readSpotPriceByChainlink(bytes32 encoding) internal view returns (uint256) {\n address aggregator;\n uint256 scale;\n uint256 heartbeat;\n assembly {\n aggregator := shr(96, encoding)\n scale := and(shr(32, encoding), 0xffffffffffffffff)\n heartbeat := and(encoding, 0xffffffff)\n }\n (, int256 answer, , uint256 updatedAt, ) = AggregatorV3Interface(aggregator).latestRoundData();\n if (answer < 0) revert(\"invalid\");\n if (block.timestamp - updatedAt > heartbeat) revert(\"expired\");\n return uint256(answer) * scale;\n }\n\n /// @dev Internal function to calculate spot price by encodings.\n ///\n /// The details of the encoding is below\n /// ```text\n /// | 1 byte | ... | ... | ... | ... |\n /// | num_source | source[0] | source[1] | ... | source[n] |\n ///\n /// source encoding:\n /// | 1 byte | 32 bytes | 32 bytes | ... | 32 bytes |\n /// | num_pool | pool[0] | pool[1] | ... | pool[n] |\n /// 1 <= num_pool <= 3\n ///\n /// The encoding of each pool can be found in `SpotPriceOracle` contract.\n /// ```\n /// @return prices The list of prices of each source, multiplied by 1e18.\n function _getSpotPriceByEncoding(bytes memory encodings) internal view returns (uint256[] memory prices) {\n uint256 ptr;\n uint256 length;\n assembly {\n ptr := add(encodings, 0x21)\n length := byte(0, mload(sub(ptr, 1)))\n }\n prices = new uint256[](length);\n for (uint256 i = 0; i < length; i++) {\n uint256 encoding1;\n uint256 encoding2;\n uint256 encoding3;\n assembly {\n let cnt := byte(0, mload(ptr))\n ptr := add(ptr, 0x01)\n if gt(cnt, 0) {\n encoding1 := mload(ptr)\n ptr := add(ptr, 0x20)\n }\n if gt(cnt, 1) {\n encoding2 := mload(ptr)\n ptr := add(ptr, 0x20)\n }\n if gt(cnt, 2) {\n encoding3 := mload(ptr)\n ptr := add(ptr, 0x20)\n }\n }\n if (encoding1 == 0) {\n revert ErrorInvalidEncodings();\n } else if (encoding2 == 0) {\n prices[i] = _readSpotPrice(encoding1);\n } else if (encoding3 == 0) {\n prices[i] = _readSpotPrice(encoding1, encoding2);\n } else {\n prices[i] = _readSpotPrice(encoding1, encoding2, encoding3);\n }\n }\n }\n\n /// @dev Internal function to calculate spot price of single pool.\n /// @param encoding The encoding for the pool.\n /// @return price The spot price of the source, multiplied by 1e18.\n function _readSpotPrice(uint256 encoding) private view returns (uint256 price) {\n price = ISpotPriceOracle(spotPriceOracle).getSpotPrice(encoding);\n }\n\n /// @dev Internal function to calculate spot price of two pools.\n /// @param encoding1 The encoding for the first pool.\n /// @param encoding2 The encoding for the second pool.\n /// @return price The spot price of the source, multiplied by 1e18.\n function _readSpotPrice(uint256 encoding1, uint256 encoding2) private view returns (uint256 price) {\n unchecked {\n price = (_readSpotPrice(encoding1) * _readSpotPrice(encoding2)) / PRECISION;\n }\n }\n\n /// @dev Internal function to calculate spot price of three pools.\n /// @param encoding1 The encoding for the first pool.\n /// @param encoding2 The encoding for the second pool.\n /// @param encoding3 The encoding for the third pool.\n /// @return price The spot price of the source, multiplied by 1e18.\n function _readSpotPrice(\n uint256 encoding1,\n uint256 encoding2,\n uint256 encoding3\n ) private view returns (uint256 price) {\n unchecked {\n price = (_readSpotPrice(encoding1, encoding2) * _readSpotPrice(encoding3)) / PRECISION;\n }\n }\n}\n"
},
"contracts/interfaces/f(x)/IFxPriceOracleV2.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0 || ^0.8.0;\n\ninterface IFxPriceOracleV2 {\n /**********\n * Events *\n **********/\n\n /// @notice Emitted when the value of maximum price deviation is updated.\n /// @param oldValue The value of the previous maximum price deviation.\n /// @param newValue The value of the current maximum price deviation.\n event UpdateMaxPriceDeviation(uint256 oldValue, uint256 newValue);\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @notice Return the oracle price with 18 decimal places.\n /// @return isValid Whether the oracle price is valid -- the difference between `minPrice` and `maxPrice` is reasonable.\n /// @return twap The time-weighted average price, multiplied by 1e18. It should be the anchor price for this asset, which is hard to manipulate.\n /// @return minPrice The minimum oracle price among all available price sources (including twap), multiplied by 1e18.\n /// @return maxPrice The maximum oracle price among all available price sources (including twap), multiplied by 1e18.\n function getPrice()\n external\n view\n returns (\n bool isValid,\n uint256 twap,\n uint256 minPrice,\n uint256 maxPrice\n );\n}\n"
},
"contracts/interfaces/ICurvePoolOracle.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0 || ^0.8.0;\n\n// solhint-disable func-name-mixedcase\n\ninterface ICurvePoolOracle {\n /********************\n * Common Functions *\n ********************/\n\n function ma_exp_time() external view returns (uint256);\n\n function ma_last_time() external view returns (uint256);\n\n /***************************\n * Functions of Plain Pool *\n ***************************/\n\n function get_p() external view returns (uint256);\n\n function last_price() external view returns (uint256);\n\n function last_prices() external view returns (uint256);\n\n function ema_price() external view returns (uint256);\n\n function price_oracle() external view returns (uint256);\n\n /************************\n * Functions of NG Pool *\n ************************/\n\n function get_p(uint256 index) external view returns (uint256);\n\n /// @notice Returns last price of the coin at index `k` w.r.t the coin\n /// at index 0.\n /// @dev last_prices returns the quote by the AMM for an infinitesimally small swap\n /// after the last trade. It is not equivalent to the last traded price, and\n /// is computed by taking the partial differential of `x` w.r.t `y`. The\n /// derivative is calculated in `get_p` and then multiplied with price_scale\n /// to give last_prices.\n /// @param index The index of the coin.\n /// @return uint256 Last logged price of coin.\n function last_price(uint256 index) external view returns (uint256);\n\n function last_prices(uint256 index) external view returns (uint256);\n\n function ema_price(uint256 index) external view returns (uint256);\n\n function price_oracle(uint256 index) external view returns (uint256);\n}\n"
},
"contracts/price-oracle/interfaces/AggregatorV3Interface.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0 || ^0.8.0;\n\ninterface AggregatorV3Interface {\n function decimals() external view returns (uint8);\n\n function description() external view returns (string memory);\n\n function version() external view returns (uint256);\n\n function latestAnswer() external view returns (uint256);\n\n function getRoundData(uint80 _roundId)\n external\n view\n returns (\n uint80 roundId,\n int256 answer,\n uint256 startedAt,\n uint256 updatedAt,\n uint80 answeredInRound\n );\n\n function latestRoundData()\n external\n view\n returns (\n uint80 roundId,\n int256 answer,\n uint256 startedAt,\n uint256 updatedAt,\n uint80 answeredInRound\n );\n}\n"
},
"contracts/price-oracle/interfaces/ISpotPriceOracle.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0 || ^0.8.0;\n\ninterface ISpotPriceOracle {\n /// @notice Return spot price with 18 decimal places.\n ///\n /// @dev encoding for single route\n /// | 8 bits | 160 bits | 88 bits |\n /// | pool_type | pool | customized |\n /// assume all base and quote token has no more than 18 decimals.\n ///\n /// + pool_type = 0: UniswapV2\n /// customized = | 1 bit | 8 bits | 8 bits | ... |\n /// | base_index | base_scale | quote_scale | ... |\n /// + pool_type = 1: UniswapV3\n /// customized = | 1 bit | 8 bits | 8 bits | ... |\n /// | base_index | base_scale | quote_scale | ... |\n /// + pool_type = 2: Balancer V2 Weighted\n /// customized = | 3 bit | 3 bit | 8 bits | 8 bits | ... |\n /// | base_index | quote_index | base_scale | quote_scale | ... |\n /// + pool_type = 3: Balancer V2 Stable\n /// customized = | 3 bits | 3 bits | ... |\n /// | base_index | quote_index | ... |\n /// + pool_type = 4: Curve Plain\n /// customized = | 3 bits | 3 bits | 3 bits | 1 bits | 8 bits | ... | 8 bits | ... |\n /// | tokens | base_index | quote_index | has_amm_precise | scale[0] | ... | scale[n] | ... |\n /// + pool_type = 5: Curve Plain with oracle\n /// customized = | 1 bit | 1 bit |... |\n /// | base_index | use_cache | ... |\n /// + pool_type = 6: Curve Plain NG\n /// customized = | 3 bits | 3 bits | 1 bit | ... |\n /// | base_index | quote_index | use_cache | ... |\n /// + pool_type = 7: Curve Crypto\n /// customized = | 1 bit | ... |\n /// | base_index | ... |\n /// + pool_type = 8: Curve TriCrypto\n /// customized = | 2 bits | 2 bits | ... |\n /// | base_index | quote_index | ... |\n /// + pool_type = 9: ERC4626\n /// customized = | 1 bit | ... |\n /// | base_is_underlying | ... |\n /// + pool_type = 10: ETHLSD, wstETH, weETH, ezETH\n /// customized = | 1 bit | ... |\n /// | base_is_ETH | ... |\n /// + pool_type = 11: BalancerV2CachedRate\n /// customized = | 3 bits | ... |\n /// | base_index | ... |\n ///\n /// @param encoding The encoding of the price source.\n /// @return spotPrice The spot price with 18 decimal places.\n function getSpotPrice(uint256 encoding) external view returns (uint256 spotPrice);\n}\n"
},
"contracts/price-oracle/interfaces/ITwapOracle.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0 || ^0.8.0;\n\ninterface ITwapOracle {\n /// @notice Return TWAP with 18 decimal places in the epoch ending at the specified timestamp.\n /// Zero is returned if TWAP in the epoch is not available.\n /// @param timestamp End Timestamp in seconds of the epoch\n /// @return TWAP (18 decimal places) in the epoch, or zero if not available\n function getTwap(uint256 timestamp) external view returns (uint256);\n\n /// @notice Return the latest price with 18 decimal places.\n function getLatest() external view returns (uint256);\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "shanghai",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}
}} |
1 | 20,291,265 | 477cd586331a5bb985f703dbf273f74f2a9fe01001229826db9f55d336b6f51d | f8a2c8cc044c7f5597af1f1a53a5b3329a807796ab53c5aab91673eb51692c2b | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | 6eb03222179f83126735d7e9fde94571d716d399 | 60a060405234801561000f575f80fd5b506040516101fd3803806101fd83398101604081905261002e9161003f565b6001600160a01b031660805261006c565b5f6020828403121561004f575f80fd5b81516001600160a01b0381168114610065575f80fd5b9392505050565b6080516101746100895f395f81816058015260b101526101745ff3fe608060405234801561000f575f80fd5b5060043610610034575f3560e01c8063679aefce14610038578063fbfa77cf14610053575b5f80fd5b610040610092565b6040519081526020015b60405180910390f35b61007a7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161004a565b6040516303d1689d60e11b8152670de0b6b3a764000060048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906307a2d13a90602401602060405180830381865afa1580156100fe573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101229190610127565b905090565b5f60208284031215610137575f80fd5b505191905056fea2646970667358221220388fa187f4da66b3f56fc13da97d8326debbf1e3dcdd7daa437eea8882c4317e64736f6c63430008140033000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb777 | 608060405234801561000f575f80fd5b5060043610610034575f3560e01c8063679aefce14610038578063fbfa77cf14610053575b5f80fd5b610040610092565b6040519081526020015b60405180910390f35b61007a7f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb77781565b6040516001600160a01b03909116815260200161004a565b6040516303d1689d60e11b8152670de0b6b3a764000060048201525f907f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb7776001600160a01b0316906307a2d13a90602401602060405180830381865afa1580156100fe573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101229190610127565b905090565b5f60208284031215610137575f80fd5b505191905056fea2646970667358221220388fa187f4da66b3f56fc13da97d8326debbf1e3dcdd7daa437eea8882c4317e64736f6c63430008140033 | {{
"language": "Solidity",
"sources": {
"@openzeppelin/contracts-v4/interfaces/IERC4626.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC4626.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20.sol\";\nimport \"../token/ERC20/extensions/IERC20Metadata.sol\";\n\n/**\n * @dev Interface of the ERC4626 \"Tokenized Vault Standard\", as defined in\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\n *\n * _Available since v4.7._\n */\ninterface IERC4626 is IERC20, IERC20Metadata {\n event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);\n\n event Withdraw(\n address indexed sender,\n address indexed receiver,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n /**\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n *\n * - MUST be an ERC-20 token contract.\n * - MUST NOT revert.\n */\n function asset() external view returns (address assetTokenAddress);\n\n /**\n * @dev Returns the total amount of the underlying asset that is “managed” by Vault.\n *\n * - SHOULD include any compounding that occurs from yield.\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT revert.\n */\n function totalAssets() external view returns (uint256 totalManagedAssets);\n\n /**\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToShares(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\n * through a deposit call.\n *\n * - MUST return a limited value if receiver is subject to some deposit limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\n * - MUST NOT revert.\n */\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\n * in the same transaction.\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * deposit execution, and are accounted for during deposit.\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\n * - MUST return a limited value if receiver is subject to some mint limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\n * - MUST NOT revert.\n */\n function maxMint(address receiver) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\n * same transaction.\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\n * would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\n */\n function previewMint(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\n * execution, and are accounted for during mint.\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\n * Vault, through a withdraw call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\n * called\n * in the same transaction.\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * withdraw execution, and are accounted for during withdraw.\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\n * through a redeem call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxRedeem(address owner) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\n * same transaction.\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\n * redemption would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\n */\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * redeem execution, and are accounted for during redeem.\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);\n}\n"
},
"@openzeppelin/contracts-v4/token/ERC20/extensions/IERC20Metadata.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n"
},
"@openzeppelin/contracts-v4/token/ERC20/IERC20.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n"
},
"contracts/f(x)/rate-provider/ERC4626RateProvider.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity =0.8.20;\n\nimport { IERC4626 } from \"@openzeppelin/contracts-v4/interfaces/IERC4626.sol\";\n\nimport { IFxRateProvider } from \"../../interfaces/f(x)/IFxRateProvider.sol\";\n\n// solhint-disable contract-name-camelcase\n\ncontract ERC4626RateProvider is IFxRateProvider {\n /// @dev The address of ERC4626 Vault contract.\n address public immutable vault;\n\n constructor(address _vault) {\n vault = _vault;\n }\n\n /// @inheritdoc IFxRateProvider\n function getRate() external view override returns (uint256) {\n return IERC4626(vault).convertToAssets(1 ether);\n }\n}\n"
},
"contracts/interfaces/f(x)/IFxRateProvider.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0 || ^0.8.0;\n\ninterface IFxRateProvider {\n /// @notice Return the exchange rate from wrapped token to underlying rate,\n /// multiplied by 1e18.\n function getRate() external view returns (uint256);\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "shanghai",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}
}} |
1 | 20,291,267 | e6c9600fd3a65cb41218a39ad1310243ea8818edf7b604045af81af7ddde8edd | 8f06ada5a70d166b88d2c23d5d0d29523f803f881f7febf89ee87a1d0fa857ec | 15b186778595d92ef52eda20ac233b6ff0ecef8d | 42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794 | ec1b7b945ea39c3ef0ff2fea097c4b37dd584941 | 3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,267 | e6c9600fd3a65cb41218a39ad1310243ea8818edf7b604045af81af7ddde8edd | 8f06ada5a70d166b88d2c23d5d0d29523f803f881f7febf89ee87a1d0fa857ec | 15b186778595d92ef52eda20ac233b6ff0ecef8d | 42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794 | 875f92aa1cd68f8b5c9786590050271024660b0b | 3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,267 | e6c9600fd3a65cb41218a39ad1310243ea8818edf7b604045af81af7ddde8edd | 8f06ada5a70d166b88d2c23d5d0d29523f803f881f7febf89ee87a1d0fa857ec | 15b186778595d92ef52eda20ac233b6ff0ecef8d | 42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794 | dc21afa3aa4c73b5e2dd576f9d5528f16a768019 | 3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,267 | e6c9600fd3a65cb41218a39ad1310243ea8818edf7b604045af81af7ddde8edd | 8f06ada5a70d166b88d2c23d5d0d29523f803f881f7febf89ee87a1d0fa857ec | 15b186778595d92ef52eda20ac233b6ff0ecef8d | 42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794 | 2760b2e80427c6722f2692a7f32a8fdf3481277f | 3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,267 | e6c9600fd3a65cb41218a39ad1310243ea8818edf7b604045af81af7ddde8edd | 8f06ada5a70d166b88d2c23d5d0d29523f803f881f7febf89ee87a1d0fa857ec | 15b186778595d92ef52eda20ac233b6ff0ecef8d | 42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794 | bdfcc15a515a0c1d749768ad2e1b32ecc38a62b8 | 3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,267 | e6c9600fd3a65cb41218a39ad1310243ea8818edf7b604045af81af7ddde8edd | 8f06ada5a70d166b88d2c23d5d0d29523f803f881f7febf89ee87a1d0fa857ec | 15b186778595d92ef52eda20ac233b6ff0ecef8d | 42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794 | c926dc0f73a44b17b996e72c3192928890f8af92 | 3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,267 | e6c9600fd3a65cb41218a39ad1310243ea8818edf7b604045af81af7ddde8edd | 8f06ada5a70d166b88d2c23d5d0d29523f803f881f7febf89ee87a1d0fa857ec | 15b186778595d92ef52eda20ac233b6ff0ecef8d | 42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794 | 61aabbd36fec98d195605ff62893e63d172b9f0b | 3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,267 | e6c9600fd3a65cb41218a39ad1310243ea8818edf7b604045af81af7ddde8edd | 8f06ada5a70d166b88d2c23d5d0d29523f803f881f7febf89ee87a1d0fa857ec | 15b186778595d92ef52eda20ac233b6ff0ecef8d | 42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794 | 72e17b48761de18183d5a506da6dc994340381f3 | 3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,267 | e6c9600fd3a65cb41218a39ad1310243ea8818edf7b604045af81af7ddde8edd | 8f06ada5a70d166b88d2c23d5d0d29523f803f881f7febf89ee87a1d0fa857ec | 15b186778595d92ef52eda20ac233b6ff0ecef8d | 42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794 | acf1e9a1bf54d631bd61687d2c02630d4e049a0a | 3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,267 | e6c9600fd3a65cb41218a39ad1310243ea8818edf7b604045af81af7ddde8edd | 8f06ada5a70d166b88d2c23d5d0d29523f803f881f7febf89ee87a1d0fa857ec | 15b186778595d92ef52eda20ac233b6ff0ecef8d | 42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794 | 341784eb5e6dbb6c117b590506d4dc8c8608038d | 3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,267 | e6c9600fd3a65cb41218a39ad1310243ea8818edf7b604045af81af7ddde8edd | 8f06ada5a70d166b88d2c23d5d0d29523f803f881f7febf89ee87a1d0fa857ec | 15b186778595d92ef52eda20ac233b6ff0ecef8d | 42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794 | 5255485621c315b64ba155e071ba3bb55d81c799 | 3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,270 | 7c43fd465e16658c385d1d6e671a8efce094747ecae7b1eb72af31d2d9368382 | 149e7454a70918c4f1f398c1cd52a6fdc4c364b35d842ab484c0ec9aa775638e | dc6cfffe3062c239a5355528948a0833dd18997a | 42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794 | eae7d76ca4bf66efd047ac98c1a78a5a2a1af174 | 3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,270 | 7c43fd465e16658c385d1d6e671a8efce094747ecae7b1eb72af31d2d9368382 | 149e7454a70918c4f1f398c1cd52a6fdc4c364b35d842ab484c0ec9aa775638e | dc6cfffe3062c239a5355528948a0833dd18997a | 42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794 | 4116eb2210a0ce72e93d202160ed7fc5379f11f0 | 3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,270 | 7c43fd465e16658c385d1d6e671a8efce094747ecae7b1eb72af31d2d9368382 | 149e7454a70918c4f1f398c1cd52a6fdc4c364b35d842ab484c0ec9aa775638e | dc6cfffe3062c239a5355528948a0833dd18997a | 42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794 | f481626a83fc56a1a97cd492bff08cb19b1ff520 | 3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,270 | 7c43fd465e16658c385d1d6e671a8efce094747ecae7b1eb72af31d2d9368382 | 149e7454a70918c4f1f398c1cd52a6fdc4c364b35d842ab484c0ec9aa775638e | dc6cfffe3062c239a5355528948a0833dd18997a | 42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794 | 1b6d02347d59420c574fc76898d3aefacb0c7b30 | 3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,270 | 7c43fd465e16658c385d1d6e671a8efce094747ecae7b1eb72af31d2d9368382 | 149e7454a70918c4f1f398c1cd52a6fdc4c364b35d842ab484c0ec9aa775638e | dc6cfffe3062c239a5355528948a0833dd18997a | 42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794 | 6e25de57d54a77a266f8f93999a3689f5d674f64 | 3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,270 | 7c43fd465e16658c385d1d6e671a8efce094747ecae7b1eb72af31d2d9368382 | 149e7454a70918c4f1f398c1cd52a6fdc4c364b35d842ab484c0ec9aa775638e | dc6cfffe3062c239a5355528948a0833dd18997a | 42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794 | feca3a2205aa56aec077ef3c36f376ac6b302ee0 | 3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,270 | 7c43fd465e16658c385d1d6e671a8efce094747ecae7b1eb72af31d2d9368382 | 149e7454a70918c4f1f398c1cd52a6fdc4c364b35d842ab484c0ec9aa775638e | dc6cfffe3062c239a5355528948a0833dd18997a | 42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794 | 5b6b0254ccd68656e8414ae8b8b5c9b7f559c6c7 | 3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,270 | 7c43fd465e16658c385d1d6e671a8efce094747ecae7b1eb72af31d2d9368382 | 149e7454a70918c4f1f398c1cd52a6fdc4c364b35d842ab484c0ec9aa775638e | dc6cfffe3062c239a5355528948a0833dd18997a | 42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794 | 65ff8339310bca81d4b3ccef451cbe3161b0f3eb | 3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,270 | 7c43fd465e16658c385d1d6e671a8efce094747ecae7b1eb72af31d2d9368382 | 149e7454a70918c4f1f398c1cd52a6fdc4c364b35d842ab484c0ec9aa775638e | dc6cfffe3062c239a5355528948a0833dd18997a | 42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794 | a10b9f13b73a55954aad72b84cf776b1fea1a616 | 3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,270 | 7c43fd465e16658c385d1d6e671a8efce094747ecae7b1eb72af31d2d9368382 | 149e7454a70918c4f1f398c1cd52a6fdc4c364b35d842ab484c0ec9aa775638e | dc6cfffe3062c239a5355528948a0833dd18997a | 42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794 | 1aa1aa9779fe1bf1bd42a9ed43b3307f5b136f88 | 3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,270 | 7c43fd465e16658c385d1d6e671a8efce094747ecae7b1eb72af31d2d9368382 | 149e7454a70918c4f1f398c1cd52a6fdc4c364b35d842ab484c0ec9aa775638e | dc6cfffe3062c239a5355528948a0833dd18997a | 42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794 | 9f97268728f3e0770aeae95d5659bc5d183be1ed | 3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,270 | 7c43fd465e16658c385d1d6e671a8efce094747ecae7b1eb72af31d2d9368382 | 149e7454a70918c4f1f398c1cd52a6fdc4c364b35d842ab484c0ec9aa775638e | dc6cfffe3062c239a5355528948a0833dd18997a | 42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794 | 5302cd80cbd30c0720e7d8e9f61d7f60d1442296 | 3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,270 | 7c43fd465e16658c385d1d6e671a8efce094747ecae7b1eb72af31d2d9368382 | 149e7454a70918c4f1f398c1cd52a6fdc4c364b35d842ab484c0ec9aa775638e | dc6cfffe3062c239a5355528948a0833dd18997a | 42bca2a5593c3b6dc2ebaf62db7e7f6e1d273794 | 0ede3b20072ec133d3c72d5b9f68b14f143b75b1 | 3d602d80600a3d3981f3363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7342bca2a5593c3b6dc2ebaf62db7e7f6e1d2737945af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,270 | 7c43fd465e16658c385d1d6e671a8efce094747ecae7b1eb72af31d2d9368382 | 75a170b04714e8ab7b471098848baf71eb0c6fc6f714d76ebac1e8e36e3ea88b | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | 9f0d5e33617a1db6f1cbd5580834422684f09269 | 608060405260405162000c7c38038062000c7c833981810160405260608110156200002957600080fd5b815160208301516040808501805191519395929483019291846401000000008211156200005557600080fd5b9083019060208201858111156200006b57600080fd5b82516401000000008111828201881017156200008657600080fd5b82525081516020918201929091019080838360005b83811015620000b55781810151838201526020016200009b565b50505050905090810190601f168015620000e35780820380516001836020036101000a031916815260200191505b5060405250849150829050620000f98262000137565b8051156200011a57620001188282620001ae60201b620003841760201c565b505b50620001239050565b6200012e82620001dd565b505050620003be565b6200014d816200020160201b620003b01760201c565b6200018a5760405162461bcd60e51b815260040180806020018281038252603681526020018062000c206036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b6060620001d6838360405180606001604052806027815260200162000bf96027913962000207565b9392505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b3b151590565b6060620002148462000201565b620002515760405162461bcd60e51b815260040180806020018281038252602681526020018062000c566026913960400191505060405180910390fd5b600080856001600160a01b0316856040518082805190602001908083835b60208310620002905780518252601f1990920191602091820191016200026f565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114620002f2576040519150601f19603f3d011682016040523d82523d6000602084013e620002f7565b606091505b5090925090506200030a82828662000314565b9695505050505050565b6060831562000325575081620001d6565b825115620003365782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156200038257818101518382015260200162000368565b50505050905090810190601f168015620003b05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b61082b80620003ce6000396000f3fe60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610262565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b031661029f565b34801561018857600080fd5b5061012d610359565b6101996103b6565b6101a96101a4610416565b61043b565b565b6101b361045f565b6001600160a01b0316336001600160a01b031614156101da576101d581610484565b6101e2565b6101e2610191565b50565b6101ed61045f565b6001600160a01b0316336001600160a01b031614156102555761020f83610484565b61024f8383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061038492505050565b5061025d565b61025d610191565b505050565b600061026c61045f565b6001600160a01b0316336001600160a01b031614156102945761028d610416565b905061029c565b61029c610191565b90565b6102a761045f565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103055760405162461bcd60e51b815260040180806020018281038252603a8152602001806106f7603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61032e61045f565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c4565b600061036361045f565b6001600160a01b0316336001600160a01b031614156102945761028d61045f565b60606103a98383604051806060016040528060278152602001610731602791396104e8565b9392505050565b3b151590565b6103be61045f565b6001600160a01b0316336001600160a01b0316141561040e5760405162461bcd60e51b81526004018080602001828103825260428152602001806107b46042913960600191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045a573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b61048d816105ea565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b60606104f3846103b0565b61052e5760405162461bcd60e51b815260040180806020018281038252602681526020018061078e6026913960400191505060405180910390fd5b600080856001600160a01b0316856040518082805190602001908083835b6020831061056b5780518252601f19909201916020918201910161054c565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146105cb576040519150601f19603f3d011682016040523d82523d6000602084013e6105d0565b606091505b50915091506105e0828286610652565b9695505050505050565b6105f3816103b0565b61062e5760405162461bcd60e51b81526004018080602001828103825260368152602001806107586036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b606083156106615750816103a9565b8251156106715782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156106bb5781810151838201526020016106a3565b50505050905090810190601f1680156106e85780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f2061646472657373416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65645570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a264697066735822122090e3614b706279d077ae7fe131a8a3c1ad0a982ff84dd5c3262dea995c0e225864736f6c63430007060033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65645570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6e7472616374000000000000000000000000ad95d0c8782f8c9076e8f081f7a5e1a4ac4499a30000000000000000000000009b54b7703551d9d0ced177a78367560a8b2edda4000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c44cd88b7600000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000b66287829206376785553440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006637678555344000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | 60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610262565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b031661029f565b34801561018857600080fd5b5061012d610359565b6101996103b6565b6101a96101a4610416565b61043b565b565b6101b361045f565b6001600160a01b0316336001600160a01b031614156101da576101d581610484565b6101e2565b6101e2610191565b50565b6101ed61045f565b6001600160a01b0316336001600160a01b031614156102555761020f83610484565b61024f8383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061038492505050565b5061025d565b61025d610191565b505050565b600061026c61045f565b6001600160a01b0316336001600160a01b031614156102945761028d610416565b905061029c565b61029c610191565b90565b6102a761045f565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103055760405162461bcd60e51b815260040180806020018281038252603a8152602001806106f7603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61032e61045f565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c4565b600061036361045f565b6001600160a01b0316336001600160a01b031614156102945761028d61045f565b60606103a98383604051806060016040528060278152602001610731602791396104e8565b9392505050565b3b151590565b6103be61045f565b6001600160a01b0316336001600160a01b0316141561040e5760405162461bcd60e51b81526004018080602001828103825260428152602001806107b46042913960600191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045a573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b61048d816105ea565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b60606104f3846103b0565b61052e5760405162461bcd60e51b815260040180806020018281038252602681526020018061078e6026913960400191505060405180910390fd5b600080856001600160a01b0316856040518082805190602001908083835b6020831061056b5780518252601f19909201916020918201910161054c565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146105cb576040519150601f19603f3d011682016040523d82523d6000602084013e6105d0565b606091505b50915091506105e0828286610652565b9695505050505050565b6105f3816103b0565b61062e5760405162461bcd60e51b81526004018080602001828103825260368152602001806107586036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b606083156106615750816103a9565b8251156106715782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156106bb5781810151838201526020016106a3565b50505050905090810190601f1680156106e85780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f2061646472657373416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65645570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a264697066735822122090e3614b706279d077ae7fe131a8a3c1ad0a982ff84dd5c3262dea995c0e225864736f6c63430007060033 | // SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
/**
* @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
* instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
* be specified by overriding the virtual {_implementation} function.
*
* Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
* different contract through the {_delegate} function.
*
* The success and return data of the delegated call will be returned back to the caller of the proxy.
*/
abstract contract Proxy {
/**
* @dev Delegates the current call to `implementation`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _delegate(address implementation) internal virtual {
// solhint-disable-next-line no-inline-assembly
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
/**
* @dev This is a virtual function that should be overriden so it returns the address to which the fallback function
* and {_fallback} should delegate.
*/
function _implementation() internal view virtual returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _fallback() internal virtual {
_beforeFallback();
_delegate(_implementation());
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
* function in the contract matches the call data.
*/
fallback () external payable virtual {
_fallback();
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
* is empty.
*/
receive () external payable virtual {
_fallback();
}
/**
* @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
* call, or as part of the Solidity `fallback` or `receive` functions.
*
* If overriden should call `super._beforeFallback()`.
*/
function _beforeFallback() internal virtual {
}
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
/**
* @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an
* implementation address that can be changed. This address is stored in storage in the location specified by
* https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the
* implementation behind the proxy.
*
* Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see
* {TransparentUpgradeableProxy}.
*/
contract UpgradeableProxy is Proxy {
/**
* @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.
*
* If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded
* function call, and allows initializating the storage of the proxy like a Solidity constructor.
*/
constructor(address _logic, bytes memory _data) payable {
assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
Address.functionDelegateCall(_logic, _data);
}
}
/**
* @dev Emitted when the implementation is upgraded.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation address.
*/
function _implementation() internal view virtual override returns (address impl) {
bytes32 slot = _IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
*
* Emits an {Upgraded} event.
*/
function _upgradeTo(address newImplementation) internal virtual {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Stores a new address in the EIP1967 implementation slot.
*/
function _setImplementation(address newImplementation) private {
require(Address.isContract(newImplementation), "UpgradeableProxy: new implementation is not a contract");
bytes32 slot = _IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @dev This contract implements a proxy that is upgradeable by an admin.
*
* To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector
* clashing], which can potentially be used in an attack, this contract uses the
* https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two
* things that go hand in hand:
*
* 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if
* that call matches one of the admin functions exposed by the proxy itself.
* 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the
* implementation. If the admin tries to call a function on the implementation it will fail with an error that says
* "admin cannot fallback to proxy target".
*
* These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing
* the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due
* to sudden errors when trying to call a function from the proxy implementation.
*
* Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,
* you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.
*/
contract TransparentUpgradeableProxy is UpgradeableProxy {
/**
* @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and
* optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.
*/
constructor(address _logic, address admin_, bytes memory _data) payable UpgradeableProxy(_logic, _data) {
assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
_setAdmin(admin_);
}
/**
* @dev Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @dev Returns the current admin.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
*/
function admin() external ifAdmin returns (address admin_) {
admin_ = _admin();
}
/**
* @dev Returns the current implementation.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`
*/
function implementation() external ifAdmin returns (address implementation_) {
implementation_ = _implementation();
}
/**
* @dev Changes the admin of the proxy.
*
* Emits an {AdminChanged} event.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.
*/
function changeAdmin(address newAdmin) external virtual ifAdmin {
require(newAdmin != address(0), "TransparentUpgradeableProxy: new admin is the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the implementation of the proxy.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.
*/
function upgradeTo(address newImplementation) external virtual ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified
* by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the
* proxied contract.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) external payable virtual ifAdmin {
_upgradeTo(newImplementation);
Address.functionDelegateCall(newImplementation, data);
}
/**
* @dev Returns the current admin.
*/
function _admin() internal view virtual returns (address adm) {
bytes32 slot = _ADMIN_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
adm := sload(slot)
}
}
/**
* @dev Stores a new address in the EIP1967 admin slot.
*/
function _setAdmin(address newAdmin) private {
bytes32 slot = _ADMIN_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.
*/
function _beforeFallback() internal virtual override {
require(msg.sender != _admin(), "TransparentUpgradeableProxy: admin cannot fallback to proxy target");
super._beforeFallback();
}
} |
1 | 20,291,271 | cac31f42b694e6d7bf531af624ef631525ab273f494d3b8fc4f5cdda5f7c8016 | 72406a68b2ead9438bbee8b92b9b8c9044e74f4b3146e703d84d61d40d1ab83b | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | dfac83173a96b06c5d6176638124d028269cfcd2 | 608060405260405162000c7c38038062000c7c833981810160405260608110156200002957600080fd5b815160208301516040808501805191519395929483019291846401000000008211156200005557600080fd5b9083019060208201858111156200006b57600080fd5b82516401000000008111828201881017156200008657600080fd5b82525081516020918201929091019080838360005b83811015620000b55781810151838201526020016200009b565b50505050905090810190601f168015620000e35780820380516001836020036101000a031916815260200191505b5060405250849150829050620000f98262000137565b8051156200011a57620001188282620001ae60201b620003841760201c565b505b50620001239050565b6200012e82620001dd565b505050620003be565b6200014d816200020160201b620003b01760201c565b6200018a5760405162461bcd60e51b815260040180806020018281038252603681526020018062000c206036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b6060620001d6838360405180606001604052806027815260200162000bf96027913962000207565b9392505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b3b151590565b6060620002148462000201565b620002515760405162461bcd60e51b815260040180806020018281038252602681526020018062000c566026913960400191505060405180910390fd5b600080856001600160a01b0316856040518082805190602001908083835b60208310620002905780518252601f1990920191602091820191016200026f565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114620002f2576040519150601f19603f3d011682016040523d82523d6000602084013e620002f7565b606091505b5090925090506200030a82828662000314565b9695505050505050565b6060831562000325575081620001d6565b825115620003365782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156200038257818101518382015260200162000368565b50505050905090810190601f168015620003b05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b61082b80620003ce6000396000f3fe60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610262565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b031661029f565b34801561018857600080fd5b5061012d610359565b6101996103b6565b6101a96101a4610416565b61043b565b565b6101b361045f565b6001600160a01b0316336001600160a01b031614156101da576101d581610484565b6101e2565b6101e2610191565b50565b6101ed61045f565b6001600160a01b0316336001600160a01b031614156102555761020f83610484565b61024f8383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061038492505050565b5061025d565b61025d610191565b505050565b600061026c61045f565b6001600160a01b0316336001600160a01b031614156102945761028d610416565b905061029c565b61029c610191565b90565b6102a761045f565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103055760405162461bcd60e51b815260040180806020018281038252603a8152602001806106f7603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61032e61045f565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c4565b600061036361045f565b6001600160a01b0316336001600160a01b031614156102945761028d61045f565b60606103a98383604051806060016040528060278152602001610731602791396104e8565b9392505050565b3b151590565b6103be61045f565b6001600160a01b0316336001600160a01b0316141561040e5760405162461bcd60e51b81526004018080602001828103825260428152602001806107b46042913960600191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045a573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b61048d816105ea565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b60606104f3846103b0565b61052e5760405162461bcd60e51b815260040180806020018281038252602681526020018061078e6026913960400191505060405180910390fd5b600080856001600160a01b0316856040518082805190602001908083835b6020831061056b5780518252601f19909201916020918201910161054c565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146105cb576040519150601f19603f3d011682016040523d82523d6000602084013e6105d0565b606091505b50915091506105e0828286610652565b9695505050505050565b6105f3816103b0565b61062e5760405162461bcd60e51b81526004018080602001828103825260368152602001806107586036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b606083156106615750816103a9565b8251156106715782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156106bb5781810151838201526020016106a3565b50505050905090810190601f1680156106e85780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f2061646472657373416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65645570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a264697066735822122090e3614b706279d077ae7fe131a8a3c1ad0a982ff84dd5c3262dea995c0e225864736f6c63430007060033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65645570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6e7472616374000000000000000000000000387568e1ea4ff4d003b8147739db69d87325e206000000000000000000000000a1d0027ca4c0cb79f9403d06a29470abc7b0a46800000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000 | 60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610262565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b031661029f565b34801561018857600080fd5b5061012d610359565b6101996103b6565b6101a96101a4610416565b61043b565b565b6101b361045f565b6001600160a01b0316336001600160a01b031614156101da576101d581610484565b6101e2565b6101e2610191565b50565b6101ed61045f565b6001600160a01b0316336001600160a01b031614156102555761020f83610484565b61024f8383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061038492505050565b5061025d565b61025d610191565b505050565b600061026c61045f565b6001600160a01b0316336001600160a01b031614156102945761028d610416565b905061029c565b61029c610191565b90565b6102a761045f565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103055760405162461bcd60e51b815260040180806020018281038252603a8152602001806106f7603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61032e61045f565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c4565b600061036361045f565b6001600160a01b0316336001600160a01b031614156102945761028d61045f565b60606103a98383604051806060016040528060278152602001610731602791396104e8565b9392505050565b3b151590565b6103be61045f565b6001600160a01b0316336001600160a01b0316141561040e5760405162461bcd60e51b81526004018080602001828103825260428152602001806107b46042913960600191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045a573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b61048d816105ea565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b60606104f3846103b0565b61052e5760405162461bcd60e51b815260040180806020018281038252602681526020018061078e6026913960400191505060405180910390fd5b600080856001600160a01b0316856040518082805190602001908083835b6020831061056b5780518252601f19909201916020918201910161054c565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146105cb576040519150601f19603f3d011682016040523d82523d6000602084013e6105d0565b606091505b50915091506105e0828286610652565b9695505050505050565b6105f3816103b0565b61062e5760405162461bcd60e51b81526004018080602001828103825260368152602001806107586036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b606083156106615750816103a9565b8251156106715782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156106bb5781810151838201526020016106a3565b50505050905090810190601f1680156106e85780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f2061646472657373416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65645570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a264697066735822122090e3614b706279d077ae7fe131a8a3c1ad0a982ff84dd5c3262dea995c0e225864736f6c63430007060033 | // SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
/**
* @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
* instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
* be specified by overriding the virtual {_implementation} function.
*
* Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
* different contract through the {_delegate} function.
*
* The success and return data of the delegated call will be returned back to the caller of the proxy.
*/
abstract contract Proxy {
/**
* @dev Delegates the current call to `implementation`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _delegate(address implementation) internal virtual {
// solhint-disable-next-line no-inline-assembly
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
/**
* @dev This is a virtual function that should be overriden so it returns the address to which the fallback function
* and {_fallback} should delegate.
*/
function _implementation() internal view virtual returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _fallback() internal virtual {
_beforeFallback();
_delegate(_implementation());
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
* function in the contract matches the call data.
*/
fallback () external payable virtual {
_fallback();
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
* is empty.
*/
receive () external payable virtual {
_fallback();
}
/**
* @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
* call, or as part of the Solidity `fallback` or `receive` functions.
*
* If overriden should call `super._beforeFallback()`.
*/
function _beforeFallback() internal virtual {
}
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
/**
* @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an
* implementation address that can be changed. This address is stored in storage in the location specified by
* https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the
* implementation behind the proxy.
*
* Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see
* {TransparentUpgradeableProxy}.
*/
contract UpgradeableProxy is Proxy {
/**
* @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.
*
* If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded
* function call, and allows initializating the storage of the proxy like a Solidity constructor.
*/
constructor(address _logic, bytes memory _data) payable {
assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
Address.functionDelegateCall(_logic, _data);
}
}
/**
* @dev Emitted when the implementation is upgraded.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation address.
*/
function _implementation() internal view virtual override returns (address impl) {
bytes32 slot = _IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
*
* Emits an {Upgraded} event.
*/
function _upgradeTo(address newImplementation) internal virtual {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Stores a new address in the EIP1967 implementation slot.
*/
function _setImplementation(address newImplementation) private {
require(Address.isContract(newImplementation), "UpgradeableProxy: new implementation is not a contract");
bytes32 slot = _IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @dev This contract implements a proxy that is upgradeable by an admin.
*
* To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector
* clashing], which can potentially be used in an attack, this contract uses the
* https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two
* things that go hand in hand:
*
* 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if
* that call matches one of the admin functions exposed by the proxy itself.
* 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the
* implementation. If the admin tries to call a function on the implementation it will fail with an error that says
* "admin cannot fallback to proxy target".
*
* These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing
* the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due
* to sudden errors when trying to call a function from the proxy implementation.
*
* Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,
* you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.
*/
contract TransparentUpgradeableProxy is UpgradeableProxy {
/**
* @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and
* optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.
*/
constructor(address _logic, address admin_, bytes memory _data) payable UpgradeableProxy(_logic, _data) {
assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
_setAdmin(admin_);
}
/**
* @dev Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @dev Returns the current admin.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
*/
function admin() external ifAdmin returns (address admin_) {
admin_ = _admin();
}
/**
* @dev Returns the current implementation.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`
*/
function implementation() external ifAdmin returns (address implementation_) {
implementation_ = _implementation();
}
/**
* @dev Changes the admin of the proxy.
*
* Emits an {AdminChanged} event.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.
*/
function changeAdmin(address newAdmin) external virtual ifAdmin {
require(newAdmin != address(0), "TransparentUpgradeableProxy: new admin is the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the implementation of the proxy.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.
*/
function upgradeTo(address newImplementation) external virtual ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified
* by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the
* proxied contract.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) external payable virtual ifAdmin {
_upgradeTo(newImplementation);
Address.functionDelegateCall(newImplementation, data);
}
/**
* @dev Returns the current admin.
*/
function _admin() internal view virtual returns (address adm) {
bytes32 slot = _ADMIN_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
adm := sload(slot)
}
}
/**
* @dev Stores a new address in the EIP1967 admin slot.
*/
function _setAdmin(address newAdmin) private {
bytes32 slot = _ADMIN_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.
*/
function _beforeFallback() internal virtual override {
require(msg.sender != _admin(), "TransparentUpgradeableProxy: admin cannot fallback to proxy target");
super._beforeFallback();
}
} |
1 | 20,291,272 | 3e3e81da77ae9feabc83f603719d0a1a1f269bcc6616cafe303739507a4a5156 | 807cb143310d94abfcd0afed1ab1b7e5a081028d2bea94fa821691479c6e34ba | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | 8e3815ef103b8d8528778969cd53baa2e94be25e | 608060405260405162000c7c38038062000c7c833981810160405260608110156200002957600080fd5b815160208301516040808501805191519395929483019291846401000000008211156200005557600080fd5b9083019060208201858111156200006b57600080fd5b82516401000000008111828201881017156200008657600080fd5b82525081516020918201929091019080838360005b83811015620000b55781810151838201526020016200009b565b50505050905090810190601f168015620000e35780820380516001836020036101000a031916815260200191505b5060405250849150829050620000f98262000137565b8051156200011a57620001188282620001ae60201b620003841760201c565b505b50620001239050565b6200012e82620001dd565b505050620003be565b6200014d816200020160201b620003b01760201c565b6200018a5760405162461bcd60e51b815260040180806020018281038252603681526020018062000c206036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b6060620001d6838360405180606001604052806027815260200162000bf96027913962000207565b9392505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b3b151590565b6060620002148462000201565b620002515760405162461bcd60e51b815260040180806020018281038252602681526020018062000c566026913960400191505060405180910390fd5b600080856001600160a01b0316856040518082805190602001908083835b60208310620002905780518252601f1990920191602091820191016200026f565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114620002f2576040519150601f19603f3d011682016040523d82523d6000602084013e620002f7565b606091505b5090925090506200030a82828662000314565b9695505050505050565b6060831562000325575081620001d6565b825115620003365782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156200038257818101518382015260200162000368565b50505050905090810190601f168015620003b05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b61082b80620003ce6000396000f3fe60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610262565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b031661029f565b34801561018857600080fd5b5061012d610359565b6101996103b6565b6101a96101a4610416565b61043b565b565b6101b361045f565b6001600160a01b0316336001600160a01b031614156101da576101d581610484565b6101e2565b6101e2610191565b50565b6101ed61045f565b6001600160a01b0316336001600160a01b031614156102555761020f83610484565b61024f8383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061038492505050565b5061025d565b61025d610191565b505050565b600061026c61045f565b6001600160a01b0316336001600160a01b031614156102945761028d610416565b905061029c565b61029c610191565b90565b6102a761045f565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103055760405162461bcd60e51b815260040180806020018281038252603a8152602001806106f7603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61032e61045f565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c4565b600061036361045f565b6001600160a01b0316336001600160a01b031614156102945761028d61045f565b60606103a98383604051806060016040528060278152602001610731602791396104e8565b9392505050565b3b151590565b6103be61045f565b6001600160a01b0316336001600160a01b0316141561040e5760405162461bcd60e51b81526004018080602001828103825260428152602001806107b46042913960600191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045a573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b61048d816105ea565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b60606104f3846103b0565b61052e5760405162461bcd60e51b815260040180806020018281038252602681526020018061078e6026913960400191505060405180910390fd5b600080856001600160a01b0316856040518082805190602001908083835b6020831061056b5780518252601f19909201916020918201910161054c565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146105cb576040519150601f19603f3d011682016040523d82523d6000602084013e6105d0565b606091505b50915091506105e0828286610652565b9695505050505050565b6105f3816103b0565b61062e5760405162461bcd60e51b81526004018080602001828103825260368152602001806107586036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b606083156106615750816103a9565b8251156106715782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156106bb5781810151838201526020016106a3565b50505050905090810190601f1680156106e85780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f2061646472657373416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65645570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a264697066735822122090e3614b706279d077ae7fe131a8a3c1ad0a982ff84dd5c3262dea995c0e225864736f6c63430007060033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65645570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6e7472616374000000000000000000000000387568e1ea4ff4d003b8147739db69d87325e206000000000000000000000000a1d0027ca4c0cb79f9403d06a29470abc7b0a46800000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000 | 60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610262565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b031661029f565b34801561018857600080fd5b5061012d610359565b6101996103b6565b6101a96101a4610416565b61043b565b565b6101b361045f565b6001600160a01b0316336001600160a01b031614156101da576101d581610484565b6101e2565b6101e2610191565b50565b6101ed61045f565b6001600160a01b0316336001600160a01b031614156102555761020f83610484565b61024f8383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061038492505050565b5061025d565b61025d610191565b505050565b600061026c61045f565b6001600160a01b0316336001600160a01b031614156102945761028d610416565b905061029c565b61029c610191565b90565b6102a761045f565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103055760405162461bcd60e51b815260040180806020018281038252603a8152602001806106f7603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61032e61045f565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c4565b600061036361045f565b6001600160a01b0316336001600160a01b031614156102945761028d61045f565b60606103a98383604051806060016040528060278152602001610731602791396104e8565b9392505050565b3b151590565b6103be61045f565b6001600160a01b0316336001600160a01b0316141561040e5760405162461bcd60e51b81526004018080602001828103825260428152602001806107b46042913960600191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045a573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b61048d816105ea565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b60606104f3846103b0565b61052e5760405162461bcd60e51b815260040180806020018281038252602681526020018061078e6026913960400191505060405180910390fd5b600080856001600160a01b0316856040518082805190602001908083835b6020831061056b5780518252601f19909201916020918201910161054c565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146105cb576040519150601f19603f3d011682016040523d82523d6000602084013e6105d0565b606091505b50915091506105e0828286610652565b9695505050505050565b6105f3816103b0565b61062e5760405162461bcd60e51b81526004018080602001828103825260368152602001806107586036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b606083156106615750816103a9565b8251156106715782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156106bb5781810151838201526020016106a3565b50505050905090810190601f1680156106e85780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f2061646472657373416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65645570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a264697066735822122090e3614b706279d077ae7fe131a8a3c1ad0a982ff84dd5c3262dea995c0e225864736f6c63430007060033 | // SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
/**
* @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
* instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
* be specified by overriding the virtual {_implementation} function.
*
* Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
* different contract through the {_delegate} function.
*
* The success and return data of the delegated call will be returned back to the caller of the proxy.
*/
abstract contract Proxy {
/**
* @dev Delegates the current call to `implementation`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _delegate(address implementation) internal virtual {
// solhint-disable-next-line no-inline-assembly
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
/**
* @dev This is a virtual function that should be overriden so it returns the address to which the fallback function
* and {_fallback} should delegate.
*/
function _implementation() internal view virtual returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _fallback() internal virtual {
_beforeFallback();
_delegate(_implementation());
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
* function in the contract matches the call data.
*/
fallback () external payable virtual {
_fallback();
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
* is empty.
*/
receive () external payable virtual {
_fallback();
}
/**
* @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
* call, or as part of the Solidity `fallback` or `receive` functions.
*
* If overriden should call `super._beforeFallback()`.
*/
function _beforeFallback() internal virtual {
}
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
/**
* @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an
* implementation address that can be changed. This address is stored in storage in the location specified by
* https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the
* implementation behind the proxy.
*
* Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see
* {TransparentUpgradeableProxy}.
*/
contract UpgradeableProxy is Proxy {
/**
* @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.
*
* If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded
* function call, and allows initializating the storage of the proxy like a Solidity constructor.
*/
constructor(address _logic, bytes memory _data) payable {
assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
Address.functionDelegateCall(_logic, _data);
}
}
/**
* @dev Emitted when the implementation is upgraded.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation address.
*/
function _implementation() internal view virtual override returns (address impl) {
bytes32 slot = _IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
*
* Emits an {Upgraded} event.
*/
function _upgradeTo(address newImplementation) internal virtual {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Stores a new address in the EIP1967 implementation slot.
*/
function _setImplementation(address newImplementation) private {
require(Address.isContract(newImplementation), "UpgradeableProxy: new implementation is not a contract");
bytes32 slot = _IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @dev This contract implements a proxy that is upgradeable by an admin.
*
* To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector
* clashing], which can potentially be used in an attack, this contract uses the
* https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two
* things that go hand in hand:
*
* 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if
* that call matches one of the admin functions exposed by the proxy itself.
* 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the
* implementation. If the admin tries to call a function on the implementation it will fail with an error that says
* "admin cannot fallback to proxy target".
*
* These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing
* the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due
* to sudden errors when trying to call a function from the proxy implementation.
*
* Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,
* you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.
*/
contract TransparentUpgradeableProxy is UpgradeableProxy {
/**
* @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and
* optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.
*/
constructor(address _logic, address admin_, bytes memory _data) payable UpgradeableProxy(_logic, _data) {
assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
_setAdmin(admin_);
}
/**
* @dev Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @dev Returns the current admin.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
*/
function admin() external ifAdmin returns (address admin_) {
admin_ = _admin();
}
/**
* @dev Returns the current implementation.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`
*/
function implementation() external ifAdmin returns (address implementation_) {
implementation_ = _implementation();
}
/**
* @dev Changes the admin of the proxy.
*
* Emits an {AdminChanged} event.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.
*/
function changeAdmin(address newAdmin) external virtual ifAdmin {
require(newAdmin != address(0), "TransparentUpgradeableProxy: new admin is the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the implementation of the proxy.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.
*/
function upgradeTo(address newImplementation) external virtual ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified
* by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the
* proxied contract.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) external payable virtual ifAdmin {
_upgradeTo(newImplementation);
Address.functionDelegateCall(newImplementation, data);
}
/**
* @dev Returns the current admin.
*/
function _admin() internal view virtual returns (address adm) {
bytes32 slot = _ADMIN_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
adm := sload(slot)
}
}
/**
* @dev Stores a new address in the EIP1967 admin slot.
*/
function _setAdmin(address newAdmin) private {
bytes32 slot = _ADMIN_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.
*/
function _beforeFallback() internal virtual override {
require(msg.sender != _admin(), "TransparentUpgradeableProxy: admin cannot fallback to proxy target");
super._beforeFallback();
}
} |
1 | 20,291,273 | 13ca2030343bb66fcf54326c7b655b74f3c6f68d880d9d9a23b5c80c57418aa1 | 198b7557aa17c770fb4b2ac7d5d10c44bb90d023241b95aaa459807a60b4c662 | 2df71a96c11c33ebbe35344b655dd31f44439170 | a6b71e26c5e0845f74c812102ca7114b6a896ab2 | e0735e1151b1925084ac29657b97db0db5c6f396 | 608060405234801561001057600080fd5b506040516101e63803806101e68339818101604052602081101561003357600080fd5b8101908080519060200190929190505050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156100ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806101c46022913960400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060ab806101196000396000f3fe608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033496e76616c69642073696e676c65746f6e20616464726573732070726f7669646564000000000000000000000000d9db270c1b5e3bd161e8c8503c55ceabee709552 | 608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033 | // SPDX-License-Identifier: LGPL-3.0-only
pragma solidity >=0.7.0 <0.9.0;
/// @title IProxy - Helper interface to access masterCopy of the Proxy on-chain
/// @author Richard Meissner - <[email protected]>
interface IProxy {
function masterCopy() external view returns (address);
}
/// @title GnosisSafeProxy - Generic proxy contract allows to execute all transactions applying the code of a master contract.
/// @author Stefan George - <[email protected]>
/// @author Richard Meissner - <[email protected]>
contract GnosisSafeProxy {
// singleton always needs to be first declared variable, to ensure that it is at the same location in the contracts to which calls are delegated.
// To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt`
address internal singleton;
/// @dev Constructor function sets address of singleton contract.
/// @param _singleton Singleton address.
constructor(address _singleton) {
require(_singleton != address(0), "Invalid singleton address provided");
singleton = _singleton;
}
/// @dev Fallback function forwards all transactions and returns all received return data.
fallback() external payable {
// solhint-disable-next-line no-inline-assembly
assembly {
let _singleton := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff)
// 0xa619486e == keccak("masterCopy()"). The value is right padded to 32-bytes with 0s
if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) {
mstore(0, _singleton)
return(0, 0x20)
}
calldatacopy(0, 0, calldatasize())
let success := delegatecall(gas(), _singleton, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
if eq(success, 0) {
revert(0, returndatasize())
}
return(0, returndatasize())
}
}
}
/// @title Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction.
/// @author Stefan George - <[email protected]>
contract GnosisSafeProxyFactory {
event ProxyCreation(GnosisSafeProxy proxy, address singleton);
/// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction.
/// @param singleton Address of singleton contract.
/// @param data Payload for message call sent to new proxy contract.
function createProxy(address singleton, bytes memory data) public returns (GnosisSafeProxy proxy) {
proxy = new GnosisSafeProxy(singleton);
if (data.length > 0)
// solhint-disable-next-line no-inline-assembly
assembly {
if eq(call(gas(), proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) {
revert(0, 0)
}
}
emit ProxyCreation(proxy, singleton);
}
/// @dev Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed.
function proxyRuntimeCode() public pure returns (bytes memory) {
return type(GnosisSafeProxy).runtimeCode;
}
/// @dev Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address.
function proxyCreationCode() public pure returns (bytes memory) {
return type(GnosisSafeProxy).creationCode;
}
/// @dev Allows to create new proxy contact using CREATE2 but it doesn't run the initializer.
/// This method is only meant as an utility to be called from other methods
/// @param _singleton Address of singleton contract.
/// @param initializer Payload for message call sent to new proxy contract.
/// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.
function deployProxyWithNonce(
address _singleton,
bytes memory initializer,
uint256 saltNonce
) internal returns (GnosisSafeProxy proxy) {
// If the initializer changes the proxy address should change too. Hashing the initializer data is cheaper than just concatinating it
bytes32 salt = keccak256(abi.encodePacked(keccak256(initializer), saltNonce));
bytes memory deploymentData = abi.encodePacked(type(GnosisSafeProxy).creationCode, uint256(uint160(_singleton)));
// solhint-disable-next-line no-inline-assembly
assembly {
proxy := create2(0x0, add(0x20, deploymentData), mload(deploymentData), salt)
}
require(address(proxy) != address(0), "Create2 call failed");
}
/// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction.
/// @param _singleton Address of singleton contract.
/// @param initializer Payload for message call sent to new proxy contract.
/// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.
function createProxyWithNonce(
address _singleton,
bytes memory initializer,
uint256 saltNonce
) public returns (GnosisSafeProxy proxy) {
proxy = deployProxyWithNonce(_singleton, initializer, saltNonce);
if (initializer.length > 0)
// solhint-disable-next-line no-inline-assembly
assembly {
if eq(call(gas(), proxy, 0, add(initializer, 0x20), mload(initializer), 0, 0), 0) {
revert(0, 0)
}
}
emit ProxyCreation(proxy, _singleton);
}
/// @dev Allows to create new proxy contact, execute a message call to the new proxy and call a specified callback within one transaction
/// @param _singleton Address of singleton contract.
/// @param initializer Payload for message call sent to new proxy contract.
/// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.
/// @param callback Callback that will be invoced after the new proxy contract has been successfully deployed and initialized.
function createProxyWithCallback(
address _singleton,
bytes memory initializer,
uint256 saltNonce,
IProxyCreationCallback callback
) public returns (GnosisSafeProxy proxy) {
uint256 saltNonceWithCallback = uint256(keccak256(abi.encodePacked(saltNonce, callback)));
proxy = createProxyWithNonce(_singleton, initializer, saltNonceWithCallback);
if (address(callback) != address(0)) callback.proxyCreated(proxy, _singleton, initializer, saltNonce);
}
/// @dev Allows to get the address for a new proxy contact created via `createProxyWithNonce`
/// This method is only meant for address calculation purpose when you use an initializer that would revert,
/// therefore the response is returned with a revert. When calling this method set `from` to the address of the proxy factory.
/// @param _singleton Address of singleton contract.
/// @param initializer Payload for message call sent to new proxy contract.
/// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.
function calculateCreateProxyWithNonceAddress(
address _singleton,
bytes calldata initializer,
uint256 saltNonce
) external returns (GnosisSafeProxy proxy) {
proxy = deployProxyWithNonce(_singleton, initializer, saltNonce);
revert(string(abi.encodePacked(proxy)));
}
}
interface IProxyCreationCallback {
function proxyCreated(
GnosisSafeProxy proxy,
address _singleton,
bytes calldata initializer,
uint256 saltNonce
) external;
} |
1 | 20,291,273 | 13ca2030343bb66fcf54326c7b655b74f3c6f68d880d9d9a23b5c80c57418aa1 | 42bb3e8e558caf43664a8d0a224f2e436d89d012607ad5d6550892d0496764fb | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | 9fcb2c47dab11e38fec4b8c886f63741bfed4c41 | 608060405260405162000c7c38038062000c7c833981810160405260608110156200002957600080fd5b815160208301516040808501805191519395929483019291846401000000008211156200005557600080fd5b9083019060208201858111156200006b57600080fd5b82516401000000008111828201881017156200008657600080fd5b82525081516020918201929091019080838360005b83811015620000b55781810151838201526020016200009b565b50505050905090810190601f168015620000e35780820380516001836020036101000a031916815260200191505b5060405250849150829050620000f98262000137565b8051156200011a57620001188282620001ae60201b620003841760201c565b505b50620001239050565b6200012e82620001dd565b505050620003be565b6200014d816200020160201b620003b01760201c565b6200018a5760405162461bcd60e51b815260040180806020018281038252603681526020018062000c206036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b6060620001d6838360405180606001604052806027815260200162000bf96027913962000207565b9392505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b3b151590565b6060620002148462000201565b620002515760405162461bcd60e51b815260040180806020018281038252602681526020018062000c566026913960400191505060405180910390fd5b600080856001600160a01b0316856040518082805190602001908083835b60208310620002905780518252601f1990920191602091820191016200026f565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114620002f2576040519150601f19603f3d011682016040523d82523d6000602084013e620002f7565b606091505b5090925090506200030a82828662000314565b9695505050505050565b6060831562000325575081620001d6565b825115620003365782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156200038257818101518382015260200162000368565b50505050905090810190601f168015620003b05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b61082b80620003ce6000396000f3fe60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610262565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b031661029f565b34801561018857600080fd5b5061012d610359565b6101996103b6565b6101a96101a4610416565b61043b565b565b6101b361045f565b6001600160a01b0316336001600160a01b031614156101da576101d581610484565b6101e2565b6101e2610191565b50565b6101ed61045f565b6001600160a01b0316336001600160a01b031614156102555761020f83610484565b61024f8383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061038492505050565b5061025d565b61025d610191565b505050565b600061026c61045f565b6001600160a01b0316336001600160a01b031614156102945761028d610416565b905061029c565b61029c610191565b90565b6102a761045f565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103055760405162461bcd60e51b815260040180806020018281038252603a8152602001806106f7603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61032e61045f565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c4565b600061036361045f565b6001600160a01b0316336001600160a01b031614156102945761028d61045f565b60606103a98383604051806060016040528060278152602001610731602791396104e8565b9392505050565b3b151590565b6103be61045f565b6001600160a01b0316336001600160a01b0316141561040e5760405162461bcd60e51b81526004018080602001828103825260428152602001806107b46042913960600191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045a573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b61048d816105ea565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b60606104f3846103b0565b61052e5760405162461bcd60e51b815260040180806020018281038252602681526020018061078e6026913960400191505060405180910390fd5b600080856001600160a01b0316856040518082805190602001908083835b6020831061056b5780518252601f19909201916020918201910161054c565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146105cb576040519150601f19603f3d011682016040523d82523d6000602084013e6105d0565b606091505b50915091506105e0828286610652565b9695505050505050565b6105f3816103b0565b61062e5760405162461bcd60e51b81526004018080602001828103825260368152602001806107586036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b606083156106615750816103a9565b8251156106715782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156106bb5781810151838201526020016106a3565b50505050905090810190601f1680156106e85780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f2061646472657373416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65645570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a264697066735822122090e3614b706279d077ae7fe131a8a3c1ad0a982ff84dd5c3262dea995c0e225864736f6c63430007060033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65645570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6e7472616374000000000000000000000000387568e1ea4ff4d003b8147739db69d87325e206000000000000000000000000a1d0027ca4c0cb79f9403d06a29470abc7b0a46800000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000 | 60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610262565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b031661029f565b34801561018857600080fd5b5061012d610359565b6101996103b6565b6101a96101a4610416565b61043b565b565b6101b361045f565b6001600160a01b0316336001600160a01b031614156101da576101d581610484565b6101e2565b6101e2610191565b50565b6101ed61045f565b6001600160a01b0316336001600160a01b031614156102555761020f83610484565b61024f8383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061038492505050565b5061025d565b61025d610191565b505050565b600061026c61045f565b6001600160a01b0316336001600160a01b031614156102945761028d610416565b905061029c565b61029c610191565b90565b6102a761045f565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103055760405162461bcd60e51b815260040180806020018281038252603a8152602001806106f7603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61032e61045f565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c4565b600061036361045f565b6001600160a01b0316336001600160a01b031614156102945761028d61045f565b60606103a98383604051806060016040528060278152602001610731602791396104e8565b9392505050565b3b151590565b6103be61045f565b6001600160a01b0316336001600160a01b0316141561040e5760405162461bcd60e51b81526004018080602001828103825260428152602001806107b46042913960600191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045a573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b61048d816105ea565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b60606104f3846103b0565b61052e5760405162461bcd60e51b815260040180806020018281038252602681526020018061078e6026913960400191505060405180910390fd5b600080856001600160a01b0316856040518082805190602001908083835b6020831061056b5780518252601f19909201916020918201910161054c565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146105cb576040519150601f19603f3d011682016040523d82523d6000602084013e6105d0565b606091505b50915091506105e0828286610652565b9695505050505050565b6105f3816103b0565b61062e5760405162461bcd60e51b81526004018080602001828103825260368152602001806107586036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b606083156106615750816103a9565b8251156106715782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156106bb5781810151838201526020016106a3565b50505050905090810190601f1680156106e85780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f2061646472657373416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65645570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a264697066735822122090e3614b706279d077ae7fe131a8a3c1ad0a982ff84dd5c3262dea995c0e225864736f6c63430007060033 | // SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
/**
* @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
* instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
* be specified by overriding the virtual {_implementation} function.
*
* Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
* different contract through the {_delegate} function.
*
* The success and return data of the delegated call will be returned back to the caller of the proxy.
*/
abstract contract Proxy {
/**
* @dev Delegates the current call to `implementation`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _delegate(address implementation) internal virtual {
// solhint-disable-next-line no-inline-assembly
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
/**
* @dev This is a virtual function that should be overriden so it returns the address to which the fallback function
* and {_fallback} should delegate.
*/
function _implementation() internal view virtual returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _fallback() internal virtual {
_beforeFallback();
_delegate(_implementation());
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
* function in the contract matches the call data.
*/
fallback () external payable virtual {
_fallback();
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
* is empty.
*/
receive () external payable virtual {
_fallback();
}
/**
* @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
* call, or as part of the Solidity `fallback` or `receive` functions.
*
* If overriden should call `super._beforeFallback()`.
*/
function _beforeFallback() internal virtual {
}
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
/**
* @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an
* implementation address that can be changed. This address is stored in storage in the location specified by
* https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the
* implementation behind the proxy.
*
* Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see
* {TransparentUpgradeableProxy}.
*/
contract UpgradeableProxy is Proxy {
/**
* @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.
*
* If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded
* function call, and allows initializating the storage of the proxy like a Solidity constructor.
*/
constructor(address _logic, bytes memory _data) payable {
assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
Address.functionDelegateCall(_logic, _data);
}
}
/**
* @dev Emitted when the implementation is upgraded.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation address.
*/
function _implementation() internal view virtual override returns (address impl) {
bytes32 slot = _IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
*
* Emits an {Upgraded} event.
*/
function _upgradeTo(address newImplementation) internal virtual {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Stores a new address in the EIP1967 implementation slot.
*/
function _setImplementation(address newImplementation) private {
require(Address.isContract(newImplementation), "UpgradeableProxy: new implementation is not a contract");
bytes32 slot = _IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @dev This contract implements a proxy that is upgradeable by an admin.
*
* To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector
* clashing], which can potentially be used in an attack, this contract uses the
* https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two
* things that go hand in hand:
*
* 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if
* that call matches one of the admin functions exposed by the proxy itself.
* 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the
* implementation. If the admin tries to call a function on the implementation it will fail with an error that says
* "admin cannot fallback to proxy target".
*
* These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing
* the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due
* to sudden errors when trying to call a function from the proxy implementation.
*
* Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,
* you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.
*/
contract TransparentUpgradeableProxy is UpgradeableProxy {
/**
* @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and
* optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.
*/
constructor(address _logic, address admin_, bytes memory _data) payable UpgradeableProxy(_logic, _data) {
assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
_setAdmin(admin_);
}
/**
* @dev Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @dev Returns the current admin.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
*/
function admin() external ifAdmin returns (address admin_) {
admin_ = _admin();
}
/**
* @dev Returns the current implementation.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`
*/
function implementation() external ifAdmin returns (address implementation_) {
implementation_ = _implementation();
}
/**
* @dev Changes the admin of the proxy.
*
* Emits an {AdminChanged} event.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.
*/
function changeAdmin(address newAdmin) external virtual ifAdmin {
require(newAdmin != address(0), "TransparentUpgradeableProxy: new admin is the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the implementation of the proxy.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.
*/
function upgradeTo(address newImplementation) external virtual ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified
* by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the
* proxied contract.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) external payable virtual ifAdmin {
_upgradeTo(newImplementation);
Address.functionDelegateCall(newImplementation, data);
}
/**
* @dev Returns the current admin.
*/
function _admin() internal view virtual returns (address adm) {
bytes32 slot = _ADMIN_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
adm := sload(slot)
}
}
/**
* @dev Stores a new address in the EIP1967 admin slot.
*/
function _setAdmin(address newAdmin) private {
bytes32 slot = _ADMIN_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.
*/
function _beforeFallback() internal virtual override {
require(msg.sender != _admin(), "TransparentUpgradeableProxy: admin cannot fallback to proxy target");
super._beforeFallback();
}
} |
1 | 20,291,274 | d66e371c549b9489ca9b3e6c4fd3f6537ac19d4294507d05b43146a2c649f1fb | f8ed54c3396a92b2926d2c82083357c473d5742f4c7c73c17448d9e34c3f7d7b | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | b90d347e10a085b591955cbd0603ac7866fcadc8 | 608060405260405162000c7c38038062000c7c833981810160405260608110156200002957600080fd5b815160208301516040808501805191519395929483019291846401000000008211156200005557600080fd5b9083019060208201858111156200006b57600080fd5b82516401000000008111828201881017156200008657600080fd5b82525081516020918201929091019080838360005b83811015620000b55781810151838201526020016200009b565b50505050905090810190601f168015620000e35780820380516001836020036101000a031916815260200191505b5060405250849150829050620000f98262000137565b8051156200011a57620001188282620001ae60201b620003841760201c565b505b50620001239050565b6200012e82620001dd565b505050620003be565b6200014d816200020160201b620003b01760201c565b6200018a5760405162461bcd60e51b815260040180806020018281038252603681526020018062000c206036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b6060620001d6838360405180606001604052806027815260200162000bf96027913962000207565b9392505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b3b151590565b6060620002148462000201565b620002515760405162461bcd60e51b815260040180806020018281038252602681526020018062000c566026913960400191505060405180910390fd5b600080856001600160a01b0316856040518082805190602001908083835b60208310620002905780518252601f1990920191602091820191016200026f565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114620002f2576040519150601f19603f3d011682016040523d82523d6000602084013e620002f7565b606091505b5090925090506200030a82828662000314565b9695505050505050565b6060831562000325575081620001d6565b825115620003365782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156200038257818101518382015260200162000368565b50505050905090810190601f168015620003b05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b61082b80620003ce6000396000f3fe60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610262565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b031661029f565b34801561018857600080fd5b5061012d610359565b6101996103b6565b6101a96101a4610416565b61043b565b565b6101b361045f565b6001600160a01b0316336001600160a01b031614156101da576101d581610484565b6101e2565b6101e2610191565b50565b6101ed61045f565b6001600160a01b0316336001600160a01b031614156102555761020f83610484565b61024f8383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061038492505050565b5061025d565b61025d610191565b505050565b600061026c61045f565b6001600160a01b0316336001600160a01b031614156102945761028d610416565b905061029c565b61029c610191565b90565b6102a761045f565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103055760405162461bcd60e51b815260040180806020018281038252603a8152602001806106f7603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61032e61045f565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c4565b600061036361045f565b6001600160a01b0316336001600160a01b031614156102945761028d61045f565b60606103a98383604051806060016040528060278152602001610731602791396104e8565b9392505050565b3b151590565b6103be61045f565b6001600160a01b0316336001600160a01b0316141561040e5760405162461bcd60e51b81526004018080602001828103825260428152602001806107b46042913960600191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045a573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b61048d816105ea565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b60606104f3846103b0565b61052e5760405162461bcd60e51b815260040180806020018281038252602681526020018061078e6026913960400191505060405180910390fd5b600080856001600160a01b0316856040518082805190602001908083835b6020831061056b5780518252601f19909201916020918201910161054c565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146105cb576040519150601f19603f3d011682016040523d82523d6000602084013e6105d0565b606091505b50915091506105e0828286610652565b9695505050505050565b6105f3816103b0565b61062e5760405162461bcd60e51b81526004018080602001828103825260368152602001806107586036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b606083156106615750816103a9565b8251156106715782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156106bb5781810151838201526020016106a3565b50505050905090810190601f1680156106e85780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f2061646472657373416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65645570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a264697066735822122090e3614b706279d077ae7fe131a8a3c1ad0a982ff84dd5c3262dea995c0e225864736f6c63430007060033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65645570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6e7472616374000000000000000000000000387568e1ea4ff4d003b8147739db69d87325e206000000000000000000000000a1d0027ca4c0cb79f9403d06a29470abc7b0a46800000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000 | 60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610262565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b031661029f565b34801561018857600080fd5b5061012d610359565b6101996103b6565b6101a96101a4610416565b61043b565b565b6101b361045f565b6001600160a01b0316336001600160a01b031614156101da576101d581610484565b6101e2565b6101e2610191565b50565b6101ed61045f565b6001600160a01b0316336001600160a01b031614156102555761020f83610484565b61024f8383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061038492505050565b5061025d565b61025d610191565b505050565b600061026c61045f565b6001600160a01b0316336001600160a01b031614156102945761028d610416565b905061029c565b61029c610191565b90565b6102a761045f565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103055760405162461bcd60e51b815260040180806020018281038252603a8152602001806106f7603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61032e61045f565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c4565b600061036361045f565b6001600160a01b0316336001600160a01b031614156102945761028d61045f565b60606103a98383604051806060016040528060278152602001610731602791396104e8565b9392505050565b3b151590565b6103be61045f565b6001600160a01b0316336001600160a01b0316141561040e5760405162461bcd60e51b81526004018080602001828103825260428152602001806107b46042913960600191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045a573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b61048d816105ea565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b60606104f3846103b0565b61052e5760405162461bcd60e51b815260040180806020018281038252602681526020018061078e6026913960400191505060405180910390fd5b600080856001600160a01b0316856040518082805190602001908083835b6020831061056b5780518252601f19909201916020918201910161054c565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146105cb576040519150601f19603f3d011682016040523d82523d6000602084013e6105d0565b606091505b50915091506105e0828286610652565b9695505050505050565b6105f3816103b0565b61062e5760405162461bcd60e51b81526004018080602001828103825260368152602001806107586036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b606083156106615750816103a9565b8251156106715782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156106bb5781810151838201526020016106a3565b50505050905090810190601f1680156106e85780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f2061646472657373416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65645570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a264697066735822122090e3614b706279d077ae7fe131a8a3c1ad0a982ff84dd5c3262dea995c0e225864736f6c63430007060033 | // SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
/**
* @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
* instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
* be specified by overriding the virtual {_implementation} function.
*
* Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
* different contract through the {_delegate} function.
*
* The success and return data of the delegated call will be returned back to the caller of the proxy.
*/
abstract contract Proxy {
/**
* @dev Delegates the current call to `implementation`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _delegate(address implementation) internal virtual {
// solhint-disable-next-line no-inline-assembly
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
/**
* @dev This is a virtual function that should be overriden so it returns the address to which the fallback function
* and {_fallback} should delegate.
*/
function _implementation() internal view virtual returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _fallback() internal virtual {
_beforeFallback();
_delegate(_implementation());
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
* function in the contract matches the call data.
*/
fallback () external payable virtual {
_fallback();
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
* is empty.
*/
receive () external payable virtual {
_fallback();
}
/**
* @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
* call, or as part of the Solidity `fallback` or `receive` functions.
*
* If overriden should call `super._beforeFallback()`.
*/
function _beforeFallback() internal virtual {
}
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
/**
* @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an
* implementation address that can be changed. This address is stored in storage in the location specified by
* https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the
* implementation behind the proxy.
*
* Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see
* {TransparentUpgradeableProxy}.
*/
contract UpgradeableProxy is Proxy {
/**
* @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.
*
* If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded
* function call, and allows initializating the storage of the proxy like a Solidity constructor.
*/
constructor(address _logic, bytes memory _data) payable {
assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
Address.functionDelegateCall(_logic, _data);
}
}
/**
* @dev Emitted when the implementation is upgraded.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation address.
*/
function _implementation() internal view virtual override returns (address impl) {
bytes32 slot = _IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
*
* Emits an {Upgraded} event.
*/
function _upgradeTo(address newImplementation) internal virtual {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Stores a new address in the EIP1967 implementation slot.
*/
function _setImplementation(address newImplementation) private {
require(Address.isContract(newImplementation), "UpgradeableProxy: new implementation is not a contract");
bytes32 slot = _IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @dev This contract implements a proxy that is upgradeable by an admin.
*
* To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector
* clashing], which can potentially be used in an attack, this contract uses the
* https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two
* things that go hand in hand:
*
* 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if
* that call matches one of the admin functions exposed by the proxy itself.
* 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the
* implementation. If the admin tries to call a function on the implementation it will fail with an error that says
* "admin cannot fallback to proxy target".
*
* These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing
* the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due
* to sudden errors when trying to call a function from the proxy implementation.
*
* Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,
* you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.
*/
contract TransparentUpgradeableProxy is UpgradeableProxy {
/**
* @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and
* optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.
*/
constructor(address _logic, address admin_, bytes memory _data) payable UpgradeableProxy(_logic, _data) {
assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
_setAdmin(admin_);
}
/**
* @dev Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @dev Returns the current admin.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
*/
function admin() external ifAdmin returns (address admin_) {
admin_ = _admin();
}
/**
* @dev Returns the current implementation.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`
*/
function implementation() external ifAdmin returns (address implementation_) {
implementation_ = _implementation();
}
/**
* @dev Changes the admin of the proxy.
*
* Emits an {AdminChanged} event.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.
*/
function changeAdmin(address newAdmin) external virtual ifAdmin {
require(newAdmin != address(0), "TransparentUpgradeableProxy: new admin is the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the implementation of the proxy.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.
*/
function upgradeTo(address newImplementation) external virtual ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified
* by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the
* proxied contract.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) external payable virtual ifAdmin {
_upgradeTo(newImplementation);
Address.functionDelegateCall(newImplementation, data);
}
/**
* @dev Returns the current admin.
*/
function _admin() internal view virtual returns (address adm) {
bytes32 slot = _ADMIN_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
adm := sload(slot)
}
}
/**
* @dev Stores a new address in the EIP1967 admin slot.
*/
function _setAdmin(address newAdmin) private {
bytes32 slot = _ADMIN_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.
*/
function _beforeFallback() internal virtual override {
require(msg.sender != _admin(), "TransparentUpgradeableProxy: admin cannot fallback to proxy target");
super._beforeFallback();
}
} |
1 | 20,291,275 | fed5d8c7e360ea58da4ec6d2102da7e433ce1a9354107a84f7a00ae196e9da24 | 361728d9442248d37db872bc3cc7c20b4174e608adf77c9c24896454d1cbb736 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | 58465fff9f31f0d46822d3a4cea0395f017e161a | 61010060405234801562000011575f80fd5b5060405162003c3338038062003c338339810160408190526200003491620000fc565b6001600160a01b03808416608081905281841660a05290821660c0526040805163313ce56760e01b8152905185928592859263313ce567916004808201926020929091908290030181865afa15801562000090573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190620000b6919062000143565b620000c390601262000180565b620000d090600a6200029b565b60e05250620002ab945050505050565b80516001600160a01b0381168114620000f7575f80fd5b919050565b5f805f606084860312156200010f575f80fd5b6200011a84620000e0565b92506200012a60208501620000e0565b91506200013a60408501620000e0565b90509250925092565b5f6020828403121562000154575f80fd5b815160ff8116811462000165575f80fd5b9392505050565b634e487b7160e01b5f52601160045260245ffd5b60ff82811682821603908111156200019c576200019c6200016c565b92915050565b600181815b80851115620001e257815f1904821115620001c657620001c66200016c565b80851615620001d457918102915b93841c9390800290620001a7565b509250929050565b5f82620001fa575060016200019c565b816200020857505f6200019c565b81600181146200022157600281146200022c576200024c565b60019150506200019c565b60ff8411156200024057620002406200016c565b50506001821b6200019c565b5060208310610133831016604e8410600b841016171562000271575081810a6200019c565b6200027d8383620001a2565b805f19048211156200029357620002936200016c565b029392505050565b5f6200016560ff841683620001ea565b60805160a05160c05160e0516138e0620003535f395f50505f81816103f701528181610a51015281816114b00152818161176c0152611eb301525f81816106e3015281816109cd015281816110aa015281816116e30152611e3601525f818161075901528181610ce90152818161158e01528181611b0601528181611c0401528181611c9201528181611d090152818161246f015281816124af01526124f101526138e05ff3fe608060405234801561000f575f80fd5b506004361061034d575f3560e01c80638baad540116101c9578063af6360f3116100fe578063cdc6c7cc1161009e578063daccaf6311610079578063daccaf63146107c5578063dbbd47d4146107d8578063e9ea2b25146107e0578063ffcf925e146107f3575f80fd5b8063cdc6c7cc14610797578063d2056f3e1461079f578063d547741f146107b2575f80fd5b8063bf6f5b00116100d9578063bf6f5b0014610741578063c55dae6314610754578063c780b4431461077b578063cd8bf87414610784575f80fd5b8063af6360f314610718578063b1b8cd3314610726578063b4eae1cb14610739575f80fd5b8063a0a7445a11610169578063a42c542411610144578063a42c5424146106ba578063a69f4935146106cd578063a8694e57146106de578063a8c62e7614610705575f80fd5b8063a0a7445a1461068d578063a217fddf146106a0578063a293da0f146106a7575f80fd5b8063949db658116101a4578063949db658146106605780639ce4520d146106735780639d1c0f3b1461067c5780639e3ad87114610685575f80fd5b80638baad540146105ff57806391d14854146106265780639454287514610639575f80fd5b806336568abe1161029f5780634bde38c81161023f57806366498a101161021a57806366498a10146105b25780636defd35f146105c55780637ede6b10146105d9578063876d20de146105ec575f80fd5b80634bde38c814610579578063531bec591461058c5780635fe208201461059f575f80fd5b806340fe6ee61161027a57806340fe6ee61461054257806344d90cf9146105555780634641257d1461055e578063496c62e714610566575f80fd5b806336568abe146104a757806339d1fc82146104ba5780633afc7282146104cd575f80fd5b8063088b699e1161030a578063248a9ca3116102e5578063248a9ca31461044c5780632630c12f1461046e57806329174f5c146104815780632f2ff15d14610494575f80fd5b8063088b699e146103f25780630b27295e1461043157806311da60b414610444575f80fd5b806301c5a46c1461035157806301ffc9a71461037e57806302a5a773146103a1578063049104e5146103b6578063076079a1146103d7578063082ad6ac146103ea575b5f80fd5b61036461035f36600461348e565b6107fb565b604080519283526020830191909152015b60405180910390f35b61039161038c3660046134a5565b610847565b6040519015158152602001610375565b6103b46103af36600461348e565b61087d565b005b6103c96103c43660046134e2565b6108cf565b604051908152602001610375565b6103646103e536600461348e565b610acd565b6103c9610b0c565b6104197f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610375565b6103c961043f36600461348e565b610b6b565b6103b4610bf2565b6103c961045a36600461348e565b5f9081526065602052604090206001015490565b609754610419906001600160a01b031681565b6103b461048f36600461348e565b610c8e565b6103b46104a2366004613514565b610d2b565b6103b46104b5366004613514565b610d54565b6103b46104c836600461353e565b610dd2565b609d546105079064ffffffffff81169062ffffff600160281b820416906001600160601b03600160401b8204811691600160a01b90041684565b6040805164ffffffffff909516855262ffffff90931660208501526001600160601b0391821692840192909252166060820152608001610375565b6103c961055036600461348e565b610de5565b6103c960995481565b6103b4610e6d565b6103b461057436600461353e565b610e92565b609e54610419906001600160a01b031681565b6103b461059a366004613569565b610ea5565b6103c96105ad366004613514565b610fe6565b6103646105c036600461348e565b61110a565b6103c95f8051602061388b83398151915281565b609f54610419906001600160a01b031681565b6103b46105fa36600461348e565b61114b565b6103c97f7a674bc9ca1d5ae35bc3b985343a16fa8652fb50eae4a09af3e055500694096481565b610391610634366004613514565b61115e565b6103c97f8e2ea90053027dd0e107693aeca5d0e7b6cd7291479d8384fbbcee6d132d671681565b60c954610419906001600160a01b031681565b6103c9609c5481565b6103c960985481565b610391611188565b6103b461069b36600461353e565b6111fc565b6103c95f81565b6103b46106b536600461353e565b61120f565b6103b46106c83660046135d2565b611222565b60a054601e1c633fffffff166103c9565b6104197f000000000000000000000000000000000000000000000000000000000000000081565b609b54610419906001600160a01b031681565b60a054633fffffff166103c9565b6103b46107343660046135f5565b6112c1565b6103c96112e9565b6103b461074f3660046135d2565b611351565b6104197f000000000000000000000000000000000000000000000000000000000000000081565b6103c9609a5481565b6103c9610792366004613514565b6113ec565b6103916114df565b6103646107ad36600461348e565b6114f5565b6103b46107c0366004613514565b611536565b6103b46107d336600461353e565b61155a565b6103c961156d565b6103646107ee36600461348e565b611628565b6103c9611669565b5f80670de0b6b3a764000083116108255760405163a989a74b60e01b815260040160405180910390fd5b5f610830600361167b565b905061083c8185611872565b909590945092505050565b5f6001600160e01b03198216637965db0b60e01b148061087757506301ffc9a760e01b6001600160e01b03198316145b92915050565b609b546001600160a01b031633146108cc5760405162461bcd60e51b815260206004820152600d60248201526c4f6e6c7920737472617465677960981b60448201526064015b60405180910390fd5b50565b5f5f8051602061388b8339815191526108e781611931565b61091a6040518060c001604052805f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b85156109315761092a600361167b565b905061093e565b61093b600461167b565b90505b6109478161193b565b8060a001515f0361099357841561097157604051635cbe463960e01b815260040160405180910390fd5b606081015181516109829088613622565b61098c919061364d565b92506109a1565b61099e818787611a1b565b92505b8515610a2557604051632770a7eb60e21b81526001600160a01b038581166004830152602482018890527f00000000000000000000000000000000000000000000000000000000000000001690639dc29fac906044015f604051808303815f87803b158015610a0e575f80fd5b505af1158015610a20573d5f803e3d5ffd5b505050505b8415610aa957604051632770a7eb60e21b81526001600160a01b038581166004830152602482018790527f00000000000000000000000000000000000000000000000000000000000000001690639dc29fac906044015f604051808303815f87803b158015610a92575f80fd5b505af1158015610aa4573d5f803e3d5ffd5b505050505b8051610ab690849061366c565b609955610ac38333611ada565b5050509392505050565b5f807f7a674bc9ca1d5ae35bc3b985343a16fa8652fb50eae4a09af3e0555006940964610af981611931565b610b0284611cc1565b9250925050915091565b60408051608081018252609d5464ffffffffff8116825262ffffff600160281b82041660208301526001600160601b03600160401b8204811693830193909352600160a01b900490911660608201525f90610b6690612015565b905090565b60c954604080516333cd77e760e11b815290515f926001600160a01b03169163679aefce9160048083019260209291908290030181865afa158015610bb2573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bd6919061367f565b610be8670de0b6b3a764000084613622565b610877919061364d565b7f8e2ea90053027dd0e107693aeca5d0e7b6cd7291479d8384fbbcee6d132d6716610c1c81611931565b609954156108cc576098545f610c31816120eb565b50609881905560408051848152602081018390529192507f88a84ea6dd274b386afd27dbbe11b6192b25017f5e60bb8c4053dfddb45c294d910160405180910390a15f610c7d5f61167b565b9050610c888161193b565b50505050565b609b546001600160a01b03163314610cd85760405162461bcd60e51b815260206004820152600d60248201526c4f6e6c7920737472617465677960981b60448201526064016108c3565b609b54610d12906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116911683612213565b80609c5f828254610d239190613696565b909155505050565b5f82815260656020526040902060010154610d4581611931565b610d4f8383612265565b505050565b6001600160a01b0381163314610dc45760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016108c3565b610dce82826122ea565b5050565b5f610ddc81611931565b610dce82612350565b5f670de0b6b3a764000060c95f9054906101000a90046001600160a01b03166001600160a01b031663679aefce6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e3f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e63919061367f565b610be89084613622565b5f610e775f61167b565b9050610e828161193b565b6108cc610e8d61156d565b6123c8565b5f610e9c81611931565b610dce8261251a565b5f54610100900460ff1615808015610ec357505f54600160ff909116105b80610edc5750303b158015610edc57505f5460ff166001145b610f3f5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016108c3565b5f805460ff191660011790558015610f60575f805461ff0019166101001790555b610f68612592565b610f70612592565b610f78612592565b610f8587878686866125ba565b610f8f5f33612265565b610f988561251a565b8015610fdd575f805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050565b5f5f8051602061388b833981519152610ffe81611931565b5f611009600161167b565b90508060a001515f0361102f57604051635cbe463960e01b815260040160405180910390fd5b609a54815161103f908790613696565b111561105e5760405163165fa2eb60e11b815260040160405180910390fd5b6110678161193b565b6110718186612614565b8151909350611081908690613696565b6099556040516340c10f1960e01b81526001600160a01b038581166004830152602482018590527f000000000000000000000000000000000000000000000000000000000000000016906340c10f19906044015b5f604051808303815f87803b1580156110ec575f80fd5b505af11580156110fe573d5f803e3d5ffd5b50505050505092915050565b5f80670de0b6b3a764000083116111345760405163a989a74b60e01b815260040160405180910390fd5b5f61113f600161167b565b905061083c818561263f565b5f61115581611931565b610dce826126fd565b5f9182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60975460408051634c6afee560e11b815290515f926001600160a01b0316916398d5fdca9160048083019260809291908290030181865afa1580156111cf573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111f391906136b8565b50919392505050565b5f61120681611931565b610dce82612743565b5f61121981611931565b610dce826127bb565b5f61122c81611931565b633b9aca008263ffffffff16111561125757604051636a6dba0160e11b815260040160405180910390fd5b60a054633fffffff81166112798263ffffffff868116905f90601e9061283316565b60a0556040805182815263ffffffff861660208201527f88f50f945c5448292dcb16c3e1e7d10c1d0a9ea8a109eb4e7f0064ef582ff08591015b60405180910390a150505050565b5f6112cb81611931565b5f6112d55f61167b565b90506112e08161193b565b610d4f83612847565b5f806112f45f61167b565b80519091505f0361130e57670de0b6b3a764000091505090565b80606001515f036113315761132b670de0b6b3a764000080613622565b91505090565b6060810151602082015182516113479190613622565b61132b919061364d565b5f61135b81611931565b6305f5e1008263ffffffff1611156113855760405162bdd18d60e51b815260040160405180910390fd5b60a0545f601e82901c633fffffff1690506113ae8263ffffffff80871690601e90819061283316565b60a0556040805182815263ffffffff861660208201527f2c3b971a5011a057ee9b96ea2aa1504d93d268e5c9cfdee7581d31435b24435e91016112b3565b5f5f8051602061388b83398151915261140481611931565b5f61140f600261167b565b90508060a001515f0361143557604051635cbe463960e01b815260040160405180910390fd5b609a548151611445908790613696565b11156114645760405163165fa2eb60e11b815260040160405180910390fd5b61146d8161193b565b61147781866128d7565b8151909350611487908690613696565b6099556040516340c10f1960e01b81526001600160a01b038581166004830152602482018590527f000000000000000000000000000000000000000000000000000000000000000016906340c10f19906044016110d5565b5f806114ea5f61167b565b60a001511592915050565b5f80670de0b6b3a7640000831161151f5760405163a989a74b60e01b815260040160405180910390fd5b5f61152a600461167b565b905061083c8185612936565b5f8281526065602052604090206001015461155081611931565b610d4f83836122ea565b5f61156481611931565b610dce826129d8565b6040516370a0823160e01b81523060048201525f9081906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa1580156115d3573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906115f7919061367f565b90505f611605609954610b6b565b905080821015611617575f9250505090565b611621818361366c565b9250505090565b5f80670de0b6b3a764000083116116525760405163a989a74b60e01b815260040160405180910390fd5b5f61165d600261167b565b905061083c8185612a29565b5f806116745f6120eb565b5092915050565b6116ae6040518060c001604052805f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b60995481526116bc826120eb565b6020830152604082015280515f036116e157670de0b6b3a764000060a0820152919050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561173d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611761919061367f565b8160600181815250507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117c6573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906117ea919061367f565b608082018190525f0361180a57670de0b6b3a764000060a0820152919050565b602081015181515f9161181c91613622565b90505f670de0b6b3a764000083606001516118379190613622565b905080821061186357608083015161184f828461366c565b611859919061364d565b60a084015261186a565b5f60a08401525b50505b919050565b5f805f670de0b6b3a76400008560200151865f01516118919190613622565b61189b9190613622565b90505f670de0b6b3a76400008660600151866118b79190613622565b6118c19190613622565b905081811115611928575f6118d6838361366c565b90506118ea670de0b6b3a76400008761366c565b95506118fe670de0b6b3a764000087613622565b611908908261364d565b935086602001518661191a9190613622565b611924908261364d565b9450505b50509250929050565b6108cc8133612acb565b5f61194582612b24565b60408051608081018252609d5464ffffffffff8116825262ffffff600160281b82041660208301526001600160601b03600160401b8204811693830193909352600160a01b900490911660608201529091506119a18183612bdc565b8051609d80546020840151604085015160609095015164ffffffffff90941667ffffffffffffffff1990921691909117600160281b62ffffff909216919091021767ffffffffffffffff16600160401b6001600160601b03948516026001600160a01b031617600160a01b93909216929092021790555050565b5f80670de0b6b3a76400008560600151611a359190613622565b60208601518651611a469190613622565b611a50919061366c565b905084608001515f03611a85576020850151611a74670de0b6b3a764000086613622565b611a7e919061364d565b9150611ad2565b611a97670de0b6b3a764000085613622565b6080860151909250611aa98285613622565b611ab3919061364d565b611abd9083613696565b9150846020015182611acf919061364d565b91505b509392505050565b5f611ae483610b6b565b6040516370a0823160e01b81523060048201529093505f906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015611b4b573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611b6f919061367f565b905083811015611c85575f611b84828661366c565b609b5460405163abae70c560e01b8152600481018390529192506001600160a01b03169063abae70c5906024015f604051808303815f87803b158015611bc8575f80fd5b505af1158015611bda573d5f803e3d5ffd5b5050505080609c54611bec919061366c565b609c556040516370a0823160e01b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015611c51573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c75919061367f565b915081851115611c83578194505b505b611cb96001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168486612213565b509192915050565b5f805f6098541115611ce6576040516353df203b60e11b815260040160405180910390fd5b6040516370a0823160e01b81523060048201528390611d72906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015611d4e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610550919061367f565b1015611d91576040516358ac431f60e01b815260040160405180910390fd5b335f611d9c816120eb565b506098819055604080515f8152602081018390529192507f88a84ea6dd274b386afd27dbbe11b6192b25017f5e60bb8c4053dfddb45c294d910160405180910390a16099859055611df6670de0b6b3a76400006002613622565b611e008287613622565b611e0a919061364d565b6040516340c10f1960e01b81526001600160a01b038481166004830152602482018390529195508594507f0000000000000000000000000000000000000000000000000000000000000000909116906340c10f19906044015f604051808303815f87803b158015611e79575f80fd5b505af1158015611e8b573d5f803e3d5ffd5b50506040516340c10f1960e01b81526001600160a01b038581166004830152602482018790527f00000000000000000000000000000000000000000000000000000000000000001692506340c10f1991506044015f604051808303815f87803b158015611ef6575f80fd5b505af1158015611f08573d5f803e3d5ffd5b505060408051608081018252609d5462ffffff600160281b82041660208301526001600160601b03600160401b8204811693830193909352600160a01b900490911660608201524264ffffffffff1681529150611f709050670de0b6b3a76400006002613622565b6001600160601b03166040820152611f91670de0b6b3a76400006002613622565b6001600160601b03908116606083018190528251609d8054602086015160409096015164ffffffffff90931667ffffffffffffffff1990911617600160281b62ffffff909616959095029490941767ffffffffffffffff16600160401b91909316026001600160a01b031691909117600160a01b9091021790555091939092509050565b5f42825f015164ffffffffff1610156120da578151602083015164ffffffffff9091164203905f9062ffffff16670de0b6b3a764000083028161205a5761205a613639565b049050680238fd42c5cf04000081111561208157505050604001516001600160601b031690565b5f61208d825f03612c07565b9050670de0b6b3a76400008186606001516001600160601b03160282670de0b6b3a76400000387604001516001600160601b03160201816120d0576120d0613639565b0495945050505050565b50606001516001600160601b031690565b5f805f8060975f9054906101000a90046001600160a01b03166001600160a01b03166398d5fdca6040518163ffffffff1660e01b8152600401608060405180830381865afa15801561213f573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061216391906136b8565b9196509350915060019050856004811115612180576121806136f2565b148061219d5750600485600481111561219b5761219b6136f2565b145b156121aa578192506121ec565b60028560048111156121be576121be6136f2565b14806121db575060038560048111156121d9576121d96136f2565b145b156121e8578092506121ec565b8092505b835f0361220c57604051630ae7ae7760e21b815260040160405180910390fd5b5050915091565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610d4f90849061301b565b61226f828261115e565b610dce575f8281526065602090815260408083206001600160a01b03851684529091529020805460ff191660011790556122a63390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6122f4828261115e565b15610dce575f8281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001600160a01b0381166123775760405163a7f9319d60e01b815260040160405180910390fd5b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907ff3920b145a63851522088bd18b14d6bb919fbd12ac87f12498d6001c727ba070905f90a35050565b60a0545f90633b9aca00908390601e1c633fffffff166123e89190613622565b6123f2919061364d565b90505f633b9aca008361240a60a054633fffffff1690565b6124149190613622565b61241e919061364d565b604080518581526020810183905290810184905290915033907f4534f107610758c3931de9ad1e176476fcfb8c74adf920167e1d54ee84fcfe769060600160405180910390a281156124a45761249e7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163384612213565b81830392505b80156124da576124d47f0000000000000000000000000000000000000000000000000000000000000000826130ee565b80830392505b8215610d4f57609e54610d4f906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116911685612213565b6001600160a01b0381166125415760405163a7f9319d60e01b815260040160405180910390fd5b60c980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f7e3c69aeb2663518561503b579e3829e9b028006b471ba9d9bf73c96a291bbee905f90a35050565b5f54610100900460ff166125b85760405162461bcd60e51b81526004016108c390613706565b565b5f54610100900460ff166125e05760405162461bcd60e51b81526004016108c390613706565b6125e9856127bb565b6125f284612743565b6125fb83612350565b612604826126fd565b61260d81612847565b5050505050565b5f670de0b6b3a764000083602001518361262e9190613622565b612638919061364d565b9392505050565b5f805f670de0b6b3a76400008560200151865f015161265e9190613622565b6126689190613622565b90505f670de0b6b3a76400008660600151866126849190613622565b61268e9190613622565b905080821115611928576126aa670de0b6b3a76400008661366c565b94505f6126b7828461366c565b90508587602001516126c99190613622565b6126d3908261364d565b94506126e786670de0b6b3a7640000613622565b6126f1908261364d565b93505050509250929050565b609a80549082905560408051828152602081018490527fede537d020307519a197807a3685dc458e5a912bd674738aad346e7da11883a091015b60405180910390a15050565b6001600160a01b03811661276a5760405163a7f9319d60e01b815260040160405180910390fd5b609f80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f9b0fc4e5102ba0bac5926778aa4acd4b8f9848a3832bf497af328f021b8de559905f90a35050565b6001600160a01b0381166127e25760405163a7f9319d60e01b815260040160405180910390fd5b609e80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f6c2db31e86a0021e31afb30fde602864ef1c7f25230ceefd3a8bee7ee945324a905f90a35050565b6001901b5f1901811b1992909216911b1790565b603c8162ffffff16101561286e576040516362e329d160e01b815260040160405180910390fd5b609d805462ffffff838116600160281b90810267ffffff0000000000198416179093556040519290910416907f66f5085a384a3a57e220a32bd106166497658ba63b87291301ddf4628d88c96c90612737908390859091825262ffffff16602082015260400190565b5f82608001518360200151836128ed9190613622565b6128f79190613622565b9050670de0b6b3a764000083606001516129119190613622565b602084015184516129229190613622565b61292c919061366c565b612638908261364d565b5f805f670de0b6b3a76400008560200151865f01516129559190613622565b61295f9190613622565b90505f670de0b6b3a764000086606001518661297b9190613622565b6129859190613622565b905080821115611928575f61299a828461366c565b9050670de0b6b3a76400008760a001516129b49190613622565b6129be908261364d565b9350670de0b6b3a7640000876020015161191a9190613622565b609b80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f1e0f9bc8b0f77d9ae5d0ad2b0a996f775d47a5d0b473e464166e7d559f384734905f90a35050565b5f805f670de0b6b3a7640000855f01518660200151612a489190613622565b612a529190613622565b90505f670de0b6b3a7640000866060015186612a6e9190613622565b612a789190613622565b905081811115611928575f612a8d838361366c565b9050670de0b6b3a76400008760200151612aa79190613622565b612ab1908261364d565b9450670de0b6b3a76400008760a001516126e79190613622565b612ad5828261115e565b610dce57612ae28161315c565b612aed83602061316e565b604051602001612afe929190613773565b60408051601f198184030181529082905262461bcd60e51b82526108c3916004016137e7565b5f808260400151835f0151612b399190613622565b670de0b6b3a7640000808560600151612b529190613622565b612b5c9190613622565b612b66919061364d565b9050670de0b6b3a76400008110612b885768056bc75e2d631000009150612bd6565b612b9a81670de0b6b3a764000061366c565b612bac670de0b6b3a764000080613622565b612bb6919061364d565b915068056bc75e2d63100000821115612bd65768056bc75e2d6310000091505b50919050565b612be582612015565b6001600160601b03908116606084015216604082015264ffffffffff42169052565b5f680238fd42c5cf03ffff198212158015612c2b575068070c1cc73b00c800008213155b612c6a5760405162461bcd60e51b815260206004820152601060248201526f1253959053125117d1561413d391539560821b60448201526064016108c3565b5f821215612ca157612c7d825f03612c07565b6ec097ce7bc90715b34b9f100000000081612c9a57612c9a613639565b0592915050565b5f6806f05b59d3b20000008312612ce057506806f05b59d3b1ffffff1990910190770195e54c5dd42177f53a27172fa9ec630262827000000000612d16565b6803782dace9d90000008312612d1257506803782dace9d8ffffff19909101906b1425982cf597cd205cef7380612d16565b5060015b6064929092029168056bc75e2d6310000068ad78ebc5ac620000008412612d665768ad78ebc5ac61ffffff199093019268056bc75e2d631000006e01855144814a7ff805980ff008400082020590505b6856bc75e2d6310000008412612da2576856bc75e2d630ffffff199093019268056bc75e2d631000006b02df0ab5a80a22c61ab5a70082020590505b682b5e3af16b188000008412612ddc57682b5e3af16b187fffff199093019268056bc75e2d63100000693f1fce3da636ea5cf85082020590505b6815af1d78b58c4000008412612e16576815af1d78b58c3fffff199093019268056bc75e2d63100000690127fa27722cc06cc5e282020590505b680ad78ebc5ac62000008412612e4f57680ad78ebc5ac61fffff199093019268056bc75e2d6310000068280e60114edb805d0382020590505b68056bc75e2d631000008412612e885768056bc75e2d630fffff199093019268056bc75e2d63100000680ebc5fb4174612111082020590505b6802b5e3af16b18800008412612ec1576802b5e3af16b187ffff199093019268056bc75e2d631000006808f00f760a4b2db55d82020590505b68015af1d78b58c400008412612efa5768015af1d78b58c3ffff199093019268056bc75e2d631000006806f5f177578893793782020590505b68056bc75e2d631000008481019085906002908280020505918201919050600368056bc75e2d631000008783020505918201919050600468056bc75e2d631000008783020505918201919050600568056bc75e2d631000008783020505918201919050600668056bc75e2d631000008783020505918201919050600768056bc75e2d631000008783020505918201919050600868056bc75e2d631000008783020505918201919050600968056bc75e2d631000008783020505918201919050600a68056bc75e2d631000008783020505918201919050600b68056bc75e2d631000008783020505918201919050600c68056bc75e2d631000008783020505918201919050606468056bc75e2d63100000848402058502059695505050505050565b5f61306f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166133049092919063ffffffff16565b905080515f148061308f57508080602001905181019061308f9190613819565b610d4f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016108c3565b609f546001600160a01b039081169061310a9084168284612213565b60405163056fa47f60e41b81526001600160a01b0384811660048301528216906356fa47f0906024015f604051808303815f87803b15801561314a575f80fd5b505af1158015610fdd573d5f803e3d5ffd5b60606108776001600160a01b03831660145b60605f61317c836002613622565b613187906002613696565b67ffffffffffffffff81111561319f5761319f613832565b6040519080825280601f01601f1916602001820160405280156131c9576020820181803683370190505b509050600360fc1b815f815181106131e3576131e3613846565b60200101906001600160f81b03191690815f1a905350600f60fb1b8160018151811061321157613211613846565b60200101906001600160f81b03191690815f1a9053505f613233846002613622565b61323e906001613696565b90505b60018111156132b5576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061327257613272613846565b1a60f81b82828151811061328857613288613846565b60200101906001600160f81b03191690815f1a90535060049490941c936132ae8161385a565b9050613241565b5083156126385760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016108c3565b606061331284845f8561331a565b949350505050565b60608247101561337b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016108c3565b5f80866001600160a01b03168587604051613396919061386f565b5f6040518083038185875af1925050503d805f81146133d0576040519150601f19603f3d011682016040523d82523d5f602084013e6133d5565b606091505b50915091506133e6878383876133f1565b979650505050505050565b6060831561345f5782515f03613458576001600160a01b0385163b6134585760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016108c3565b5081613312565b61331283838151156134745781518083602001fd5b8060405162461bcd60e51b81526004016108c391906137e7565b5f6020828403121561349e575f80fd5b5035919050565b5f602082840312156134b5575f80fd5b81356001600160e01b031981168114612638575f80fd5b80356001600160a01b038116811461186d575f80fd5b5f805f606084860312156134f4575f80fd5b833592506020840135915061350b604085016134cc565b90509250925092565b5f8060408385031215613525575f80fd5b82359150613535602084016134cc565b90509250929050565b5f6020828403121561354e575f80fd5b612638826134cc565b803562ffffff8116811461186d575f80fd5b5f805f805f8060c0878903121561357e575f80fd5b613587876134cc565b9550613595602088016134cc565b94506135a3604088016134cc565b93506135b1606088016134cc565b9250608087013591506135c660a08801613557565b90509295509295509295565b5f602082840312156135e2575f80fd5b813563ffffffff81168114612638575f80fd5b5f60208284031215613605575f80fd5b61263882613557565b634e487b7160e01b5f52601160045260245ffd5b80820281158282048414176108775761087761360e565b634e487b7160e01b5f52601260045260245ffd5b5f8261366757634e487b7160e01b5f52601260045260245ffd5b500490565b818103818111156108775761087761360e565b5f6020828403121561368f575f80fd5b5051919050565b808201808211156108775761087761360e565b8051801515811461186d575f80fd5b5f805f80608085870312156136cb575f80fd5b6136d4856136a9565b60208601516040870151606090970151919890975090945092505050565b634e487b7160e01b5f52602160045260245ffd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b5f5b8381101561376b578181015183820152602001613753565b50505f910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081525f83516137aa816017850160208801613751565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516137db816028840160208801613751565b01602801949350505050565b602081525f8251806020840152613805816040850160208701613751565b601f01601f19169190910160400192915050565b5f60208284031215613829575f80fd5b612638826136a9565b634e487b7160e01b5f52604160045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b5f816138685761386861360e565b505f190190565b5f8251613880818460208701613751565b919091019291505056fee88ed2d35c0cfab359fb462bf5a023d04cb058b5e7f26c13b23a5904cff6b510a26469706673582212204284cc4ed867bd7f616616f4f5418441c919394c0b459293d07d4312d6e8821e64736f6c63430008140033000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb7770000000000000000000000009fcb2c47dab11e38fec4b8c886f63741bfed4c41000000000000000000000000b90d347e10a085b591955cbd0603ac7866fcadc8 | 608060405234801561000f575f80fd5b506004361061034d575f3560e01c80638baad540116101c9578063af6360f3116100fe578063cdc6c7cc1161009e578063daccaf6311610079578063daccaf63146107c5578063dbbd47d4146107d8578063e9ea2b25146107e0578063ffcf925e146107f3575f80fd5b8063cdc6c7cc14610797578063d2056f3e1461079f578063d547741f146107b2575f80fd5b8063bf6f5b00116100d9578063bf6f5b0014610741578063c55dae6314610754578063c780b4431461077b578063cd8bf87414610784575f80fd5b8063af6360f314610718578063b1b8cd3314610726578063b4eae1cb14610739575f80fd5b8063a0a7445a11610169578063a42c542411610144578063a42c5424146106ba578063a69f4935146106cd578063a8694e57146106de578063a8c62e7614610705575f80fd5b8063a0a7445a1461068d578063a217fddf146106a0578063a293da0f146106a7575f80fd5b8063949db658116101a4578063949db658146106605780639ce4520d146106735780639d1c0f3b1461067c5780639e3ad87114610685575f80fd5b80638baad540146105ff57806391d14854146106265780639454287514610639575f80fd5b806336568abe1161029f5780634bde38c81161023f57806366498a101161021a57806366498a10146105b25780636defd35f146105c55780637ede6b10146105d9578063876d20de146105ec575f80fd5b80634bde38c814610579578063531bec591461058c5780635fe208201461059f575f80fd5b806340fe6ee61161027a57806340fe6ee61461054257806344d90cf9146105555780634641257d1461055e578063496c62e714610566575f80fd5b806336568abe146104a757806339d1fc82146104ba5780633afc7282146104cd575f80fd5b8063088b699e1161030a578063248a9ca3116102e5578063248a9ca31461044c5780632630c12f1461046e57806329174f5c146104815780632f2ff15d14610494575f80fd5b8063088b699e146103f25780630b27295e1461043157806311da60b414610444575f80fd5b806301c5a46c1461035157806301ffc9a71461037e57806302a5a773146103a1578063049104e5146103b6578063076079a1146103d7578063082ad6ac146103ea575b5f80fd5b61036461035f36600461348e565b6107fb565b604080519283526020830191909152015b60405180910390f35b61039161038c3660046134a5565b610847565b6040519015158152602001610375565b6103b46103af36600461348e565b61087d565b005b6103c96103c43660046134e2565b6108cf565b604051908152602001610375565b6103646103e536600461348e565b610acd565b6103c9610b0c565b6104197f000000000000000000000000b90d347e10a085b591955cbd0603ac7866fcadc881565b6040516001600160a01b039091168152602001610375565b6103c961043f36600461348e565b610b6b565b6103b4610bf2565b6103c961045a36600461348e565b5f9081526065602052604090206001015490565b609754610419906001600160a01b031681565b6103b461048f36600461348e565b610c8e565b6103b46104a2366004613514565b610d2b565b6103b46104b5366004613514565b610d54565b6103b46104c836600461353e565b610dd2565b609d546105079064ffffffffff81169062ffffff600160281b820416906001600160601b03600160401b8204811691600160a01b90041684565b6040805164ffffffffff909516855262ffffff90931660208501526001600160601b0391821692840192909252166060820152608001610375565b6103c961055036600461348e565b610de5565b6103c960995481565b6103b4610e6d565b6103b461057436600461353e565b610e92565b609e54610419906001600160a01b031681565b6103b461059a366004613569565b610ea5565b6103c96105ad366004613514565b610fe6565b6103646105c036600461348e565b61110a565b6103c95f8051602061388b83398151915281565b609f54610419906001600160a01b031681565b6103b46105fa36600461348e565b61114b565b6103c97f7a674bc9ca1d5ae35bc3b985343a16fa8652fb50eae4a09af3e055500694096481565b610391610634366004613514565b61115e565b6103c97f8e2ea90053027dd0e107693aeca5d0e7b6cd7291479d8384fbbcee6d132d671681565b60c954610419906001600160a01b031681565b6103c9609c5481565b6103c960985481565b610391611188565b6103b461069b36600461353e565b6111fc565b6103c95f81565b6103b46106b536600461353e565b61120f565b6103b46106c83660046135d2565b611222565b60a054601e1c633fffffff166103c9565b6104197f0000000000000000000000009fcb2c47dab11e38fec4b8c886f63741bfed4c4181565b609b54610419906001600160a01b031681565b60a054633fffffff166103c9565b6103b46107343660046135f5565b6112c1565b6103c96112e9565b6103b461074f3660046135d2565b611351565b6104197f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb77781565b6103c9609a5481565b6103c9610792366004613514565b6113ec565b6103916114df565b6103646107ad36600461348e565b6114f5565b6103b46107c0366004613514565b611536565b6103b46107d336600461353e565b61155a565b6103c961156d565b6103646107ee36600461348e565b611628565b6103c9611669565b5f80670de0b6b3a764000083116108255760405163a989a74b60e01b815260040160405180910390fd5b5f610830600361167b565b905061083c8185611872565b909590945092505050565b5f6001600160e01b03198216637965db0b60e01b148061087757506301ffc9a760e01b6001600160e01b03198316145b92915050565b609b546001600160a01b031633146108cc5760405162461bcd60e51b815260206004820152600d60248201526c4f6e6c7920737472617465677960981b60448201526064015b60405180910390fd5b50565b5f5f8051602061388b8339815191526108e781611931565b61091a6040518060c001604052805f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b85156109315761092a600361167b565b905061093e565b61093b600461167b565b90505b6109478161193b565b8060a001515f0361099357841561097157604051635cbe463960e01b815260040160405180910390fd5b606081015181516109829088613622565b61098c919061364d565b92506109a1565b61099e818787611a1b565b92505b8515610a2557604051632770a7eb60e21b81526001600160a01b038581166004830152602482018890527f0000000000000000000000009fcb2c47dab11e38fec4b8c886f63741bfed4c411690639dc29fac906044015f604051808303815f87803b158015610a0e575f80fd5b505af1158015610a20573d5f803e3d5ffd5b505050505b8415610aa957604051632770a7eb60e21b81526001600160a01b038581166004830152602482018790527f000000000000000000000000b90d347e10a085b591955cbd0603ac7866fcadc81690639dc29fac906044015f604051808303815f87803b158015610a92575f80fd5b505af1158015610aa4573d5f803e3d5ffd5b505050505b8051610ab690849061366c565b609955610ac38333611ada565b5050509392505050565b5f807f7a674bc9ca1d5ae35bc3b985343a16fa8652fb50eae4a09af3e0555006940964610af981611931565b610b0284611cc1565b9250925050915091565b60408051608081018252609d5464ffffffffff8116825262ffffff600160281b82041660208301526001600160601b03600160401b8204811693830193909352600160a01b900490911660608201525f90610b6690612015565b905090565b60c954604080516333cd77e760e11b815290515f926001600160a01b03169163679aefce9160048083019260209291908290030181865afa158015610bb2573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bd6919061367f565b610be8670de0b6b3a764000084613622565b610877919061364d565b7f8e2ea90053027dd0e107693aeca5d0e7b6cd7291479d8384fbbcee6d132d6716610c1c81611931565b609954156108cc576098545f610c31816120eb565b50609881905560408051848152602081018390529192507f88a84ea6dd274b386afd27dbbe11b6192b25017f5e60bb8c4053dfddb45c294d910160405180910390a15f610c7d5f61167b565b9050610c888161193b565b50505050565b609b546001600160a01b03163314610cd85760405162461bcd60e51b815260206004820152600d60248201526c4f6e6c7920737472617465677960981b60448201526064016108c3565b609b54610d12906001600160a01b037f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb7778116911683612213565b80609c5f828254610d239190613696565b909155505050565b5f82815260656020526040902060010154610d4581611931565b610d4f8383612265565b505050565b6001600160a01b0381163314610dc45760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016108c3565b610dce82826122ea565b5050565b5f610ddc81611931565b610dce82612350565b5f670de0b6b3a764000060c95f9054906101000a90046001600160a01b03166001600160a01b031663679aefce6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e3f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e63919061367f565b610be89084613622565b5f610e775f61167b565b9050610e828161193b565b6108cc610e8d61156d565b6123c8565b5f610e9c81611931565b610dce8261251a565b5f54610100900460ff1615808015610ec357505f54600160ff909116105b80610edc5750303b158015610edc57505f5460ff166001145b610f3f5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016108c3565b5f805460ff191660011790558015610f60575f805461ff0019166101001790555b610f68612592565b610f70612592565b610f78612592565b610f8587878686866125ba565b610f8f5f33612265565b610f988561251a565b8015610fdd575f805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050565b5f5f8051602061388b833981519152610ffe81611931565b5f611009600161167b565b90508060a001515f0361102f57604051635cbe463960e01b815260040160405180910390fd5b609a54815161103f908790613696565b111561105e5760405163165fa2eb60e11b815260040160405180910390fd5b6110678161193b565b6110718186612614565b8151909350611081908690613696565b6099556040516340c10f1960e01b81526001600160a01b038581166004830152602482018590527f0000000000000000000000009fcb2c47dab11e38fec4b8c886f63741bfed4c4116906340c10f19906044015b5f604051808303815f87803b1580156110ec575f80fd5b505af11580156110fe573d5f803e3d5ffd5b50505050505092915050565b5f80670de0b6b3a764000083116111345760405163a989a74b60e01b815260040160405180910390fd5b5f61113f600161167b565b905061083c818561263f565b5f61115581611931565b610dce826126fd565b5f9182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60975460408051634c6afee560e11b815290515f926001600160a01b0316916398d5fdca9160048083019260809291908290030181865afa1580156111cf573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111f391906136b8565b50919392505050565b5f61120681611931565b610dce82612743565b5f61121981611931565b610dce826127bb565b5f61122c81611931565b633b9aca008263ffffffff16111561125757604051636a6dba0160e11b815260040160405180910390fd5b60a054633fffffff81166112798263ffffffff868116905f90601e9061283316565b60a0556040805182815263ffffffff861660208201527f88f50f945c5448292dcb16c3e1e7d10c1d0a9ea8a109eb4e7f0064ef582ff08591015b60405180910390a150505050565b5f6112cb81611931565b5f6112d55f61167b565b90506112e08161193b565b610d4f83612847565b5f806112f45f61167b565b80519091505f0361130e57670de0b6b3a764000091505090565b80606001515f036113315761132b670de0b6b3a764000080613622565b91505090565b6060810151602082015182516113479190613622565b61132b919061364d565b5f61135b81611931565b6305f5e1008263ffffffff1611156113855760405162bdd18d60e51b815260040160405180910390fd5b60a0545f601e82901c633fffffff1690506113ae8263ffffffff80871690601e90819061283316565b60a0556040805182815263ffffffff861660208201527f2c3b971a5011a057ee9b96ea2aa1504d93d268e5c9cfdee7581d31435b24435e91016112b3565b5f5f8051602061388b83398151915261140481611931565b5f61140f600261167b565b90508060a001515f0361143557604051635cbe463960e01b815260040160405180910390fd5b609a548151611445908790613696565b11156114645760405163165fa2eb60e11b815260040160405180910390fd5b61146d8161193b565b61147781866128d7565b8151909350611487908690613696565b6099556040516340c10f1960e01b81526001600160a01b038581166004830152602482018590527f000000000000000000000000b90d347e10a085b591955cbd0603ac7866fcadc816906340c10f19906044016110d5565b5f806114ea5f61167b565b60a001511592915050565b5f80670de0b6b3a7640000831161151f5760405163a989a74b60e01b815260040160405180910390fd5b5f61152a600461167b565b905061083c8185612936565b5f8281526065602052604090206001015461155081611931565b610d4f83836122ea565b5f61156481611931565b610dce826129d8565b6040516370a0823160e01b81523060048201525f9081906001600160a01b037f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb77716906370a0823190602401602060405180830381865afa1580156115d3573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906115f7919061367f565b90505f611605609954610b6b565b905080821015611617575f9250505090565b611621818361366c565b9250505090565b5f80670de0b6b3a764000083116116525760405163a989a74b60e01b815260040160405180910390fd5b5f61165d600261167b565b905061083c8185612a29565b5f806116745f6120eb565b5092915050565b6116ae6040518060c001604052805f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b60995481526116bc826120eb565b6020830152604082015280515f036116e157670de0b6b3a764000060a0820152919050565b7f0000000000000000000000009fcb2c47dab11e38fec4b8c886f63741bfed4c416001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561173d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611761919061367f565b8160600181815250507f000000000000000000000000b90d347e10a085b591955cbd0603ac7866fcadc86001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117c6573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906117ea919061367f565b608082018190525f0361180a57670de0b6b3a764000060a0820152919050565b602081015181515f9161181c91613622565b90505f670de0b6b3a764000083606001516118379190613622565b905080821061186357608083015161184f828461366c565b611859919061364d565b60a084015261186a565b5f60a08401525b50505b919050565b5f805f670de0b6b3a76400008560200151865f01516118919190613622565b61189b9190613622565b90505f670de0b6b3a76400008660600151866118b79190613622565b6118c19190613622565b905081811115611928575f6118d6838361366c565b90506118ea670de0b6b3a76400008761366c565b95506118fe670de0b6b3a764000087613622565b611908908261364d565b935086602001518661191a9190613622565b611924908261364d565b9450505b50509250929050565b6108cc8133612acb565b5f61194582612b24565b60408051608081018252609d5464ffffffffff8116825262ffffff600160281b82041660208301526001600160601b03600160401b8204811693830193909352600160a01b900490911660608201529091506119a18183612bdc565b8051609d80546020840151604085015160609095015164ffffffffff90941667ffffffffffffffff1990921691909117600160281b62ffffff909216919091021767ffffffffffffffff16600160401b6001600160601b03948516026001600160a01b031617600160a01b93909216929092021790555050565b5f80670de0b6b3a76400008560600151611a359190613622565b60208601518651611a469190613622565b611a50919061366c565b905084608001515f03611a85576020850151611a74670de0b6b3a764000086613622565b611a7e919061364d565b9150611ad2565b611a97670de0b6b3a764000085613622565b6080860151909250611aa98285613622565b611ab3919061364d565b611abd9083613696565b9150846020015182611acf919061364d565b91505b509392505050565b5f611ae483610b6b565b6040516370a0823160e01b81523060048201529093505f906001600160a01b037f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb77716906370a0823190602401602060405180830381865afa158015611b4b573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611b6f919061367f565b905083811015611c85575f611b84828661366c565b609b5460405163abae70c560e01b8152600481018390529192506001600160a01b03169063abae70c5906024015f604051808303815f87803b158015611bc8575f80fd5b505af1158015611bda573d5f803e3d5ffd5b5050505080609c54611bec919061366c565b609c556040516370a0823160e01b81523060048201527f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb7776001600160a01b0316906370a0823190602401602060405180830381865afa158015611c51573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c75919061367f565b915081851115611c83578194505b505b611cb96001600160a01b037f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb777168486612213565b509192915050565b5f805f6098541115611ce6576040516353df203b60e11b815260040160405180910390fd5b6040516370a0823160e01b81523060048201528390611d72906001600160a01b037f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb77716906370a0823190602401602060405180830381865afa158015611d4e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610550919061367f565b1015611d91576040516358ac431f60e01b815260040160405180910390fd5b335f611d9c816120eb565b506098819055604080515f8152602081018390529192507f88a84ea6dd274b386afd27dbbe11b6192b25017f5e60bb8c4053dfddb45c294d910160405180910390a16099859055611df6670de0b6b3a76400006002613622565b611e008287613622565b611e0a919061364d565b6040516340c10f1960e01b81526001600160a01b038481166004830152602482018390529195508594507f0000000000000000000000009fcb2c47dab11e38fec4b8c886f63741bfed4c41909116906340c10f19906044015f604051808303815f87803b158015611e79575f80fd5b505af1158015611e8b573d5f803e3d5ffd5b50506040516340c10f1960e01b81526001600160a01b038581166004830152602482018790527f000000000000000000000000b90d347e10a085b591955cbd0603ac7866fcadc81692506340c10f1991506044015f604051808303815f87803b158015611ef6575f80fd5b505af1158015611f08573d5f803e3d5ffd5b505060408051608081018252609d5462ffffff600160281b82041660208301526001600160601b03600160401b8204811693830193909352600160a01b900490911660608201524264ffffffffff1681529150611f709050670de0b6b3a76400006002613622565b6001600160601b03166040820152611f91670de0b6b3a76400006002613622565b6001600160601b03908116606083018190528251609d8054602086015160409096015164ffffffffff90931667ffffffffffffffff1990911617600160281b62ffffff909616959095029490941767ffffffffffffffff16600160401b91909316026001600160a01b031691909117600160a01b9091021790555091939092509050565b5f42825f015164ffffffffff1610156120da578151602083015164ffffffffff9091164203905f9062ffffff16670de0b6b3a764000083028161205a5761205a613639565b049050680238fd42c5cf04000081111561208157505050604001516001600160601b031690565b5f61208d825f03612c07565b9050670de0b6b3a76400008186606001516001600160601b03160282670de0b6b3a76400000387604001516001600160601b03160201816120d0576120d0613639565b0495945050505050565b50606001516001600160601b031690565b5f805f8060975f9054906101000a90046001600160a01b03166001600160a01b03166398d5fdca6040518163ffffffff1660e01b8152600401608060405180830381865afa15801561213f573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061216391906136b8565b9196509350915060019050856004811115612180576121806136f2565b148061219d5750600485600481111561219b5761219b6136f2565b145b156121aa578192506121ec565b60028560048111156121be576121be6136f2565b14806121db575060038560048111156121d9576121d96136f2565b145b156121e8578092506121ec565b8092505b835f0361220c57604051630ae7ae7760e21b815260040160405180910390fd5b5050915091565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610d4f90849061301b565b61226f828261115e565b610dce575f8281526065602090815260408083206001600160a01b03851684529091529020805460ff191660011790556122a63390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6122f4828261115e565b15610dce575f8281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001600160a01b0381166123775760405163a7f9319d60e01b815260040160405180910390fd5b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907ff3920b145a63851522088bd18b14d6bb919fbd12ac87f12498d6001c727ba070905f90a35050565b60a0545f90633b9aca00908390601e1c633fffffff166123e89190613622565b6123f2919061364d565b90505f633b9aca008361240a60a054633fffffff1690565b6124149190613622565b61241e919061364d565b604080518581526020810183905290810184905290915033907f4534f107610758c3931de9ad1e176476fcfb8c74adf920167e1d54ee84fcfe769060600160405180910390a281156124a45761249e7f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb7776001600160a01b03163384612213565b81830392505b80156124da576124d47f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb777826130ee565b80830392505b8215610d4f57609e54610d4f906001600160a01b037f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb7778116911685612213565b6001600160a01b0381166125415760405163a7f9319d60e01b815260040160405180910390fd5b60c980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f7e3c69aeb2663518561503b579e3829e9b028006b471ba9d9bf73c96a291bbee905f90a35050565b5f54610100900460ff166125b85760405162461bcd60e51b81526004016108c390613706565b565b5f54610100900460ff166125e05760405162461bcd60e51b81526004016108c390613706565b6125e9856127bb565b6125f284612743565b6125fb83612350565b612604826126fd565b61260d81612847565b5050505050565b5f670de0b6b3a764000083602001518361262e9190613622565b612638919061364d565b9392505050565b5f805f670de0b6b3a76400008560200151865f015161265e9190613622565b6126689190613622565b90505f670de0b6b3a76400008660600151866126849190613622565b61268e9190613622565b905080821115611928576126aa670de0b6b3a76400008661366c565b94505f6126b7828461366c565b90508587602001516126c99190613622565b6126d3908261364d565b94506126e786670de0b6b3a7640000613622565b6126f1908261364d565b93505050509250929050565b609a80549082905560408051828152602081018490527fede537d020307519a197807a3685dc458e5a912bd674738aad346e7da11883a091015b60405180910390a15050565b6001600160a01b03811661276a5760405163a7f9319d60e01b815260040160405180910390fd5b609f80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f9b0fc4e5102ba0bac5926778aa4acd4b8f9848a3832bf497af328f021b8de559905f90a35050565b6001600160a01b0381166127e25760405163a7f9319d60e01b815260040160405180910390fd5b609e80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f6c2db31e86a0021e31afb30fde602864ef1c7f25230ceefd3a8bee7ee945324a905f90a35050565b6001901b5f1901811b1992909216911b1790565b603c8162ffffff16101561286e576040516362e329d160e01b815260040160405180910390fd5b609d805462ffffff838116600160281b90810267ffffff0000000000198416179093556040519290910416907f66f5085a384a3a57e220a32bd106166497658ba63b87291301ddf4628d88c96c90612737908390859091825262ffffff16602082015260400190565b5f82608001518360200151836128ed9190613622565b6128f79190613622565b9050670de0b6b3a764000083606001516129119190613622565b602084015184516129229190613622565b61292c919061366c565b612638908261364d565b5f805f670de0b6b3a76400008560200151865f01516129559190613622565b61295f9190613622565b90505f670de0b6b3a764000086606001518661297b9190613622565b6129859190613622565b905080821115611928575f61299a828461366c565b9050670de0b6b3a76400008760a001516129b49190613622565b6129be908261364d565b9350670de0b6b3a7640000876020015161191a9190613622565b609b80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f1e0f9bc8b0f77d9ae5d0ad2b0a996f775d47a5d0b473e464166e7d559f384734905f90a35050565b5f805f670de0b6b3a7640000855f01518660200151612a489190613622565b612a529190613622565b90505f670de0b6b3a7640000866060015186612a6e9190613622565b612a789190613622565b905081811115611928575f612a8d838361366c565b9050670de0b6b3a76400008760200151612aa79190613622565b612ab1908261364d565b9450670de0b6b3a76400008760a001516126e79190613622565b612ad5828261115e565b610dce57612ae28161315c565b612aed83602061316e565b604051602001612afe929190613773565b60408051601f198184030181529082905262461bcd60e51b82526108c3916004016137e7565b5f808260400151835f0151612b399190613622565b670de0b6b3a7640000808560600151612b529190613622565b612b5c9190613622565b612b66919061364d565b9050670de0b6b3a76400008110612b885768056bc75e2d631000009150612bd6565b612b9a81670de0b6b3a764000061366c565b612bac670de0b6b3a764000080613622565b612bb6919061364d565b915068056bc75e2d63100000821115612bd65768056bc75e2d6310000091505b50919050565b612be582612015565b6001600160601b03908116606084015216604082015264ffffffffff42169052565b5f680238fd42c5cf03ffff198212158015612c2b575068070c1cc73b00c800008213155b612c6a5760405162461bcd60e51b815260206004820152601060248201526f1253959053125117d1561413d391539560821b60448201526064016108c3565b5f821215612ca157612c7d825f03612c07565b6ec097ce7bc90715b34b9f100000000081612c9a57612c9a613639565b0592915050565b5f6806f05b59d3b20000008312612ce057506806f05b59d3b1ffffff1990910190770195e54c5dd42177f53a27172fa9ec630262827000000000612d16565b6803782dace9d90000008312612d1257506803782dace9d8ffffff19909101906b1425982cf597cd205cef7380612d16565b5060015b6064929092029168056bc75e2d6310000068ad78ebc5ac620000008412612d665768ad78ebc5ac61ffffff199093019268056bc75e2d631000006e01855144814a7ff805980ff008400082020590505b6856bc75e2d6310000008412612da2576856bc75e2d630ffffff199093019268056bc75e2d631000006b02df0ab5a80a22c61ab5a70082020590505b682b5e3af16b188000008412612ddc57682b5e3af16b187fffff199093019268056bc75e2d63100000693f1fce3da636ea5cf85082020590505b6815af1d78b58c4000008412612e16576815af1d78b58c3fffff199093019268056bc75e2d63100000690127fa27722cc06cc5e282020590505b680ad78ebc5ac62000008412612e4f57680ad78ebc5ac61fffff199093019268056bc75e2d6310000068280e60114edb805d0382020590505b68056bc75e2d631000008412612e885768056bc75e2d630fffff199093019268056bc75e2d63100000680ebc5fb4174612111082020590505b6802b5e3af16b18800008412612ec1576802b5e3af16b187ffff199093019268056bc75e2d631000006808f00f760a4b2db55d82020590505b68015af1d78b58c400008412612efa5768015af1d78b58c3ffff199093019268056bc75e2d631000006806f5f177578893793782020590505b68056bc75e2d631000008481019085906002908280020505918201919050600368056bc75e2d631000008783020505918201919050600468056bc75e2d631000008783020505918201919050600568056bc75e2d631000008783020505918201919050600668056bc75e2d631000008783020505918201919050600768056bc75e2d631000008783020505918201919050600868056bc75e2d631000008783020505918201919050600968056bc75e2d631000008783020505918201919050600a68056bc75e2d631000008783020505918201919050600b68056bc75e2d631000008783020505918201919050600c68056bc75e2d631000008783020505918201919050606468056bc75e2d63100000848402058502059695505050505050565b5f61306f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166133049092919063ffffffff16565b905080515f148061308f57508080602001905181019061308f9190613819565b610d4f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016108c3565b609f546001600160a01b039081169061310a9084168284612213565b60405163056fa47f60e41b81526001600160a01b0384811660048301528216906356fa47f0906024015f604051808303815f87803b15801561314a575f80fd5b505af1158015610fdd573d5f803e3d5ffd5b60606108776001600160a01b03831660145b60605f61317c836002613622565b613187906002613696565b67ffffffffffffffff81111561319f5761319f613832565b6040519080825280601f01601f1916602001820160405280156131c9576020820181803683370190505b509050600360fc1b815f815181106131e3576131e3613846565b60200101906001600160f81b03191690815f1a905350600f60fb1b8160018151811061321157613211613846565b60200101906001600160f81b03191690815f1a9053505f613233846002613622565b61323e906001613696565b90505b60018111156132b5576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061327257613272613846565b1a60f81b82828151811061328857613288613846565b60200101906001600160f81b03191690815f1a90535060049490941c936132ae8161385a565b9050613241565b5083156126385760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016108c3565b606061331284845f8561331a565b949350505050565b60608247101561337b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016108c3565b5f80866001600160a01b03168587604051613396919061386f565b5f6040518083038185875af1925050503d805f81146133d0576040519150601f19603f3d011682016040523d82523d5f602084013e6133d5565b606091505b50915091506133e6878383876133f1565b979650505050505050565b6060831561345f5782515f03613458576001600160a01b0385163b6134585760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016108c3565b5081613312565b61331283838151156134745781518083602001fd5b8060405162461bcd60e51b81526004016108c391906137e7565b5f6020828403121561349e575f80fd5b5035919050565b5f602082840312156134b5575f80fd5b81356001600160e01b031981168114612638575f80fd5b80356001600160a01b038116811461186d575f80fd5b5f805f606084860312156134f4575f80fd5b833592506020840135915061350b604085016134cc565b90509250925092565b5f8060408385031215613525575f80fd5b82359150613535602084016134cc565b90509250929050565b5f6020828403121561354e575f80fd5b612638826134cc565b803562ffffff8116811461186d575f80fd5b5f805f805f8060c0878903121561357e575f80fd5b613587876134cc565b9550613595602088016134cc565b94506135a3604088016134cc565b93506135b1606088016134cc565b9250608087013591506135c660a08801613557565b90509295509295509295565b5f602082840312156135e2575f80fd5b813563ffffffff81168114612638575f80fd5b5f60208284031215613605575f80fd5b61263882613557565b634e487b7160e01b5f52601160045260245ffd5b80820281158282048414176108775761087761360e565b634e487b7160e01b5f52601260045260245ffd5b5f8261366757634e487b7160e01b5f52601260045260245ffd5b500490565b818103818111156108775761087761360e565b5f6020828403121561368f575f80fd5b5051919050565b808201808211156108775761087761360e565b8051801515811461186d575f80fd5b5f805f80608085870312156136cb575f80fd5b6136d4856136a9565b60208601516040870151606090970151919890975090945092505050565b634e487b7160e01b5f52602160045260245ffd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b5f5b8381101561376b578181015183820152602001613753565b50505f910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081525f83516137aa816017850160208801613751565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516137db816028840160208801613751565b01602801949350505050565b602081525f8251806020840152613805816040850160208701613751565b601f01601f19169190910160400192915050565b5f60208284031215613829575f80fd5b612638826136a9565b634e487b7160e01b5f52604160045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b5f816138685761386861360e565b505f190190565b5f8251613880818460208701613751565b919091019291505056fee88ed2d35c0cfab359fb462bf5a023d04cb058b5e7f26c13b23a5904cff6b510a26469706673582212204284cc4ed867bd7f616616f4f5418441c919394c0b459293d07d4312d6e8821e64736f6c63430008140033 | {{
"language": "Solidity",
"sources": {
"@openzeppelin/contracts-upgradeable-v4/access/AccessControlUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlUpgradeable.sol\";\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../utils/StringsUpgradeable.sol\";\nimport \"../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\n function __AccessControl_init() internal onlyInitializing {\n }\n\n function __AccessControl_init_unchained() internal onlyInitializing {\n }\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n StringsUpgradeable.toHexString(account),\n \" is missing role \",\n StringsUpgradeable.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * May emit a {RoleGranted} event.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/access/IAccessControlUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControlUpgradeable {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/proxy/utils/Initializable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/token/ERC20/extensions/IERC20MetadataUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/token/ERC20/extensions/IERC20PermitUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/token/ERC20/IERC20Upgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/token/ERC20/utils/SafeERC20Upgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));\n }\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/AddressUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/ContextUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/introspection/ERC165Upgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/introspection/IERC165Upgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/math/MathUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/math/SignedMathUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMathUpgradeable {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/StringsUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SignedMathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMathUpgradeable.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n"
},
"contracts/common/codec/WordCodec.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n// solhint-disable no-inline-assembly\n\n/// @dev A subset copied from the following contracts:\n///\n/// + `balancer-labs/v2-solidity-utils/contracts/helpers/WordCodec.sol`\n/// + `balancer-labs/v2-solidity-utils/contracts/helpers/WordCodecHelpers.sol`\nlibrary WordCodec {\n /// @dev Inserts an unsigned integer of bitLength, shifted by an offset, into a 256 bit word,\n /// replacing the old value. Returns the new word.\n function insertUint(\n bytes32 word,\n uint256 value,\n uint256 offset,\n uint256 bitLength\n ) internal pure returns (bytes32 result) {\n // Equivalent to:\n // uint256 mask = (1 << bitLength) - 1;\n // bytes32 clearedWord = bytes32(uint256(word) & ~(mask << offset));\n // result = clearedWord | bytes32(value << offset);\n assembly {\n let mask := sub(shl(bitLength, 1), 1)\n let clearedWord := and(word, not(shl(offset, mask)))\n result := or(clearedWord, shl(offset, value))\n }\n }\n\n /// @dev Decodes and returns an unsigned integer with `bitLength` bits, shifted by an offset, from a 256 bit word.\n function decodeUint(\n bytes32 word,\n uint256 offset,\n uint256 bitLength\n ) internal pure returns (uint256 result) {\n // Equivalent to:\n // result = uint256(word >> offset) & ((1 << bitLength) - 1);\n assembly {\n result := and(shr(offset, word), sub(shl(bitLength, 1), 1))\n }\n }\n\n /// @dev Inserts a signed integer shifted by an offset into a 256 bit word, replacing the old value. Returns\n /// the new word.\n ///\n /// Assumes `value` can be represented using `bitLength` bits.\n function insertInt(\n bytes32 word,\n int256 value,\n uint256 offset,\n uint256 bitLength\n ) internal pure returns (bytes32) {\n unchecked {\n uint256 mask = (1 << bitLength) - 1;\n bytes32 clearedWord = bytes32(uint256(word) & ~(mask << offset));\n // Integer values need masking to remove the upper bits of negative values.\n return clearedWord | bytes32((uint256(value) & mask) << offset);\n }\n }\n\n /// @dev Decodes and returns a signed integer with `bitLength` bits, shifted by an offset, from a 256 bit word.\n function decodeInt(\n bytes32 word,\n uint256 offset,\n uint256 bitLength\n ) internal pure returns (int256 result) {\n unchecked {\n int256 maxInt = int256((1 << (bitLength - 1)) - 1);\n uint256 mask = (1 << bitLength) - 1;\n\n int256 value = int256(uint256(word >> offset) & mask);\n // In case the decoded value is greater than the max positive integer that can be represented with bitLength\n // bits, we know it was originally a negative integer. Therefore, we mask it to restore the sign in the 256 bit\n // representation.\n //\n // Equivalent to:\n // result = value > maxInt ? (value | int256(~mask)) : value;\n assembly {\n result := or(mul(gt(value, maxInt), not(mask)), value)\n }\n }\n }\n\n /// @dev Decodes and returns a boolean shifted by an offset from a 256 bit word.\n function decodeBool(bytes32 word, uint256 offset) internal pure returns (bool result) {\n // Equivalent to:\n // result = (uint256(word >> offset) & 1) == 1;\n assembly {\n result := and(shr(offset, word), 1)\n }\n }\n\n /// @dev Inserts a boolean value shifted by an offset into a 256 bit word, replacing the old value. Returns the new\n /// word.\n function insertBool(\n bytes32 word,\n bool value,\n uint256 offset\n ) internal pure returns (bytes32 result) {\n // Equivalent to:\n // bytes32 clearedWord = bytes32(uint256(word) & ~(1 << offset));\n // bytes32 referenceInsertBool = clearedWord | bytes32(uint256(value ? 1 : 0) << offset);\n assembly {\n let clearedWord := and(word, not(shl(offset, 1)))\n result := or(clearedWord, shl(offset, value))\n }\n }\n\n function clearWordAtPosition(\n bytes32 word,\n uint256 offset,\n uint256 bitLength\n ) internal pure returns (bytes32 clearedWord) {\n unchecked {\n uint256 mask = (1 << bitLength) - 1;\n clearedWord = bytes32(uint256(word) & ~(mask << offset));\n }\n }\n}\n"
},
"contracts/common/math/ExponentialMovingAverageV8.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport { LogExpMathV8 } from \"./LogExpMathV8.sol\";\n\n// solhint-disable not-rely-on-time\n\n/// @dev See https://en.wikipedia.org/wiki/Exponential_smoothing\n/// It is the same as `ExponentialMovingAverageV7` with `unchecked` scope.\nlibrary ExponentialMovingAverageV8 {\n /*************\n * Constants *\n *************/\n\n /// @dev The precision used to compute EMA.\n uint256 private constant PRECISION = 1e18;\n\n /***********\n * Structs *\n ***********/\n\n /// @dev Compiler will pack this into single `uint256`.\n /// @param lastTime The last timestamp when the storage is updated.\n /// @param sampleInterval The sampling time interval used in the EMA.\n /// @param lastValue The last value in the data sequence, with precision 1e18.\n /// @param lastEmaValue The last EMA value computed, with precision 1e18.\n struct EMAStorage {\n uint40 lastTime;\n uint24 sampleInterval;\n uint96 lastValue;\n uint96 lastEmaValue;\n }\n\n /// @dev Save value of EMA storage.\n /// @param s The EMA storage.\n /// @param value The new value, with precision 1e18.\n function saveValue(EMAStorage memory s, uint96 value) internal view {\n s.lastEmaValue = uint96(emaValue(s));\n s.lastValue = value;\n s.lastTime = uint40(block.timestamp);\n }\n\n /// @dev Return the current ema value.\n /// @param s The EMA storage.\n function emaValue(EMAStorage memory s) internal view returns (uint256) {\n unchecked {\n if (uint256(s.lastTime) < block.timestamp) {\n uint256 dt = block.timestamp - uint256(s.lastTime);\n uint256 e = (dt * PRECISION) / s.sampleInterval;\n if (e > 41e18) {\n return s.lastValue;\n } else {\n uint256 alpha = uint256(LogExpMathV8.exp(-int256(e)));\n return (s.lastValue * (PRECISION - alpha) + s.lastEmaValue * alpha) / PRECISION;\n }\n } else {\n return s.lastEmaValue;\n }\n }\n }\n}\n"
},
"contracts/common/math/LogExpMathV8.sol": {
"content": "// SPDX-License-Identifier: MIT\n// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n// documentation files (the “Software”), to deal in the Software without restriction, including without limitation the\n// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\n// permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\n// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the\n// Software.\n\n// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\n// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\npragma solidity ^0.8.0;\n\n/* solhint-disable */\n\n/**\n * @dev Copied from https://github.com/balancer/balancer-v2-monorepo/blob/master/pkg/solidity-utils/contracts/math/LogExpMath.sol\n *\n * Some modifications are made due to compile error.\n *\n * It is the same as `LogExpMathV8` with `unchecked` scope.\n *\n * @dev Exponentiation and logarithm functions for 18 decimal fixed point numbers (both base and exponent/argument).\n *\n * Exponentiation and logarithm with arbitrary bases (x^y and log_x(y)) are implemented by conversion to natural\n * exponentiation and logarithm (where the base is Euler's number).\n *\n * @author Fernando Martinelli - @fernandomartinelli\n * @author Sergio Yuhjtman - @sergioyuhjtman\n * @author Daniel Fernandez - @dmf7z\n */\nlibrary LogExpMathV8 {\n // All fixed point multiplications and divisions are inlined. This means we need to divide by ONE when multiplying\n // two numbers, and multiply by ONE when dividing them.\n\n // All arguments and return values are 18 decimal fixed point numbers.\n int256 constant ONE_18 = 1e18;\n\n // Internally, intermediate values are computed with higher precision as 20 decimal fixed point numbers, and in the\n // case of ln36, 36 decimals.\n int256 constant ONE_20 = 1e20;\n int256 constant ONE_36 = 1e36;\n\n // The domain of natural exponentiation is bound by the word size and number of decimals used.\n //\n // Because internally the result will be stored using 20 decimals, the largest possible result is\n // (2^255 - 1) / 10^20, which makes the largest exponent ln((2^255 - 1) / 10^20) = 130.700829182905140221.\n // The smallest possible result is 10^(-18), which makes largest negative argument\n // ln(10^(-18)) = -41.446531673892822312.\n // We use 130.0 and -41.0 to have some safety margin.\n int256 constant MAX_NATURAL_EXPONENT = 130e18;\n int256 constant MIN_NATURAL_EXPONENT = -41e18;\n\n // Bounds for ln_36's argument. Both ln(0.9) and ln(1.1) can be represented with 36 decimal places in a fixed point\n // 256 bit integer.\n int256 constant LN_36_LOWER_BOUND = ONE_18 - 1e17;\n int256 constant LN_36_UPPER_BOUND = ONE_18 + 1e17;\n\n uint256 constant MILD_EXPONENT_BOUND = 2**254 / uint256(ONE_20);\n\n // 18 decimal constants\n int256 constant x0 = 128000000000000000000; // 2ˆ7\n int256 constant a0 = 38877084059945950922200000000000000000000000000000000000; // eˆ(x0) (no decimals)\n int256 constant x1 = 64000000000000000000; // 2ˆ6\n int256 constant a1 = 6235149080811616882910000000; // eˆ(x1) (no decimals)\n\n // 20 decimal constants\n int256 constant x2 = 3200000000000000000000; // 2ˆ5\n int256 constant a2 = 7896296018268069516100000000000000; // eˆ(x2)\n int256 constant x3 = 1600000000000000000000; // 2ˆ4\n int256 constant a3 = 888611052050787263676000000; // eˆ(x3)\n int256 constant x4 = 800000000000000000000; // 2ˆ3\n int256 constant a4 = 298095798704172827474000; // eˆ(x4)\n int256 constant x5 = 400000000000000000000; // 2ˆ2\n int256 constant a5 = 5459815003314423907810; // eˆ(x5)\n int256 constant x6 = 200000000000000000000; // 2ˆ1\n int256 constant a6 = 738905609893065022723; // eˆ(x6)\n int256 constant x7 = 100000000000000000000; // 2ˆ0\n int256 constant a7 = 271828182845904523536; // eˆ(x7)\n int256 constant x8 = 50000000000000000000; // 2ˆ-1\n int256 constant a8 = 164872127070012814685; // eˆ(x8)\n int256 constant x9 = 25000000000000000000; // 2ˆ-2\n int256 constant a9 = 128402541668774148407; // eˆ(x9)\n int256 constant x10 = 12500000000000000000; // 2ˆ-3\n int256 constant a10 = 113314845306682631683; // eˆ(x10)\n int256 constant x11 = 6250000000000000000; // 2ˆ-4\n int256 constant a11 = 106449445891785942956; // eˆ(x11)\n\n /**\n * @dev Exponentiation (x^y) with unsigned 18 decimal fixed point base and exponent.\n *\n * Reverts if ln(x) * y is smaller than `MIN_NATURAL_EXPONENT`, or larger than `MAX_NATURAL_EXPONENT`.\n */\n function pow(uint256 x, uint256 y) internal pure returns (uint256) {\n unchecked {\n if (y == 0) {\n // We solve the 0^0 indetermination by making it equal one.\n return uint256(ONE_18);\n }\n\n if (x == 0) {\n return 0;\n }\n\n // Instead of computing x^y directly, we instead rely on the properties of logarithms and exponentiation to\n // arrive at that result. In particular, exp(ln(x)) = x, and ln(x^y) = y * ln(x). This means\n // x^y = exp(y * ln(x)).\n\n // The ln function takes a signed value, so we need to make sure x fits in the signed 256 bit range.\n require(x >> 255 == 0, \"X_OUT_OF_BOUNDS\");\n int256 x_int256 = int256(x);\n\n // We will compute y * ln(x) in a single step. Depending on the value of x, we can either use ln or ln_36. In\n // both cases, we leave the division by ONE_18 (due to fixed point multiplication) to the end.\n\n // This prevents y * ln(x) from overflowing, and at the same time guarantees y fits in the signed 256 bit range.\n require(y < MILD_EXPONENT_BOUND, \"Y_OUT_OF_BOUNDS\");\n int256 y_int256 = int256(y);\n\n int256 logx_times_y;\n if (LN_36_LOWER_BOUND < x_int256 && x_int256 < LN_36_UPPER_BOUND) {\n int256 ln_36_x = _ln_36(x_int256);\n\n // ln_36_x has 36 decimal places, so multiplying by y_int256 isn't as straightforward, since we can't just\n // bring y_int256 to 36 decimal places, as it might overflow. Instead, we perform two 18 decimal\n // multiplications and add the results: one with the first 18 decimals of ln_36_x, and one with the\n // (downscaled) last 18 decimals.\n logx_times_y = ((ln_36_x / ONE_18) * y_int256 + ((ln_36_x % ONE_18) * y_int256) / ONE_18);\n } else {\n logx_times_y = _ln(x_int256) * y_int256;\n }\n logx_times_y /= ONE_18;\n\n // Finally, we compute exp(y * ln(x)) to arrive at x^y\n require(MIN_NATURAL_EXPONENT <= logx_times_y && logx_times_y <= MAX_NATURAL_EXPONENT, \"PRODUCT_OUT_OF_BOUNDS\");\n\n return uint256(exp(logx_times_y));\n }\n }\n\n /**\n * @dev Natural exponentiation (e^x) with signed 18 decimal fixed point exponent.\n *\n * Reverts if `x` is smaller than MIN_NATURAL_EXPONENT, or larger than `MAX_NATURAL_EXPONENT`.\n */\n function exp(int256 x) internal pure returns (int256) {\n unchecked {\n require(x >= MIN_NATURAL_EXPONENT && x <= MAX_NATURAL_EXPONENT, \"INVALID_EXPONENT\");\n\n if (x < 0) {\n // We only handle positive exponents: e^(-x) is computed as 1 / e^x. We can safely make x positive since it\n // fits in the signed 256 bit range (as it is larger than MIN_NATURAL_EXPONENT).\n // Fixed point division requires multiplying by ONE_18.\n return ((ONE_18 * ONE_18) / exp(-x));\n }\n\n // First, we use the fact that e^(x+y) = e^x * e^y to decompose x into a sum of powers of two, which we call x_n,\n // where x_n == 2^(7 - n), and e^x_n = a_n has been precomputed. We choose the first x_n, x0, to equal 2^7\n // because all larger powers are larger than MAX_NATURAL_EXPONENT, and therefore not present in the\n // decomposition.\n // At the end of this process we will have the product of all e^x_n = a_n that apply, and the remainder of this\n // decomposition, which will be lower than the smallest x_n.\n // exp(x) = k_0 * a_0 * k_1 * a_1 * ... + k_n * a_n * exp(remainder), where each k_n equals either 0 or 1.\n // We mutate x by subtracting x_n, making it the remainder of the decomposition.\n\n // The first two a_n (e^(2^7) and e^(2^6)) are too large if stored as 18 decimal numbers, and could cause\n // intermediate overflows. Instead we store them as plain integers, with 0 decimals.\n // Additionally, x0 + x1 is larger than MAX_NATURAL_EXPONENT, which means they will not both be present in the\n // decomposition.\n\n // For each x_n, we test if that term is present in the decomposition (if x is larger than it), and if so deduct\n // it and compute the accumulated product.\n\n int256 firstAN;\n if (x >= x0) {\n x -= x0;\n firstAN = a0;\n } else if (x >= x1) {\n x -= x1;\n firstAN = a1;\n } else {\n firstAN = 1; // One with no decimal places\n }\n\n // We now transform x into a 20 decimal fixed point number, to have enhanced precision when computing the\n // smaller terms.\n x *= 100;\n\n // `product` is the accumulated product of all a_n (except a0 and a1), which starts at 20 decimal fixed point\n // one. Recall that fixed point multiplication requires dividing by ONE_20.\n int256 product = ONE_20;\n\n if (x >= x2) {\n x -= x2;\n product = (product * a2) / ONE_20;\n }\n if (x >= x3) {\n x -= x3;\n product = (product * a3) / ONE_20;\n }\n if (x >= x4) {\n x -= x4;\n product = (product * a4) / ONE_20;\n }\n if (x >= x5) {\n x -= x5;\n product = (product * a5) / ONE_20;\n }\n if (x >= x6) {\n x -= x6;\n product = (product * a6) / ONE_20;\n }\n if (x >= x7) {\n x -= x7;\n product = (product * a7) / ONE_20;\n }\n if (x >= x8) {\n x -= x8;\n product = (product * a8) / ONE_20;\n }\n if (x >= x9) {\n x -= x9;\n product = (product * a9) / ONE_20;\n }\n\n // x10 and x11 are unnecessary here since we have high enough precision already.\n\n // Now we need to compute e^x, where x is small (in particular, it is smaller than x9). We use the Taylor series\n // expansion for e^x: 1 + x + (x^2 / 2!) + (x^3 / 3!) + ... + (x^n / n!).\n\n int256 seriesSum = ONE_20; // The initial one in the sum, with 20 decimal places.\n int256 term; // Each term in the sum, where the nth term is (x^n / n!).\n\n // The first term is simply x.\n term = x;\n seriesSum += term;\n\n // Each term (x^n / n!) equals the previous one times x, divided by n. Since x is a fixed point number,\n // multiplying by it requires dividing by ONE_20, but dividing by the non-fixed point n values does not.\n\n term = ((term * x) / ONE_20) / 2;\n seriesSum += term;\n\n term = ((term * x) / ONE_20) / 3;\n seriesSum += term;\n\n term = ((term * x) / ONE_20) / 4;\n seriesSum += term;\n\n term = ((term * x) / ONE_20) / 5;\n seriesSum += term;\n\n term = ((term * x) / ONE_20) / 6;\n seriesSum += term;\n\n term = ((term * x) / ONE_20) / 7;\n seriesSum += term;\n\n term = ((term * x) / ONE_20) / 8;\n seriesSum += term;\n\n term = ((term * x) / ONE_20) / 9;\n seriesSum += term;\n\n term = ((term * x) / ONE_20) / 10;\n seriesSum += term;\n\n term = ((term * x) / ONE_20) / 11;\n seriesSum += term;\n\n term = ((term * x) / ONE_20) / 12;\n seriesSum += term;\n\n // 12 Taylor terms are sufficient for 18 decimal precision.\n\n // We now have the first a_n (with no decimals), and the product of all other a_n present, and the Taylor\n // approximation of the exponentiation of the remainder (both with 20 decimals). All that remains is to multiply\n // all three (one 20 decimal fixed point multiplication, dividing by ONE_20, and one integer multiplication),\n // and then drop two digits to return an 18 decimal value.\n\n return (((product * seriesSum) / ONE_20) * firstAN) / 100;\n }\n }\n\n /**\n * @dev Logarithm (log(arg, base), with signed 18 decimal fixed point base and argument.\n */\n function log(int256 arg, int256 base) internal pure returns (int256) {\n unchecked {\n // This performs a simple base change: log(arg, base) = ln(arg) / ln(base).\n\n // Both logBase and logArg are computed as 36 decimal fixed point numbers, either by using ln_36, or by\n // upscaling.\n\n int256 logBase;\n if (LN_36_LOWER_BOUND < base && base < LN_36_UPPER_BOUND) {\n logBase = _ln_36(base);\n } else {\n logBase = _ln(base) * ONE_18;\n }\n\n int256 logArg;\n if (LN_36_LOWER_BOUND < arg && arg < LN_36_UPPER_BOUND) {\n logArg = _ln_36(arg);\n } else {\n logArg = _ln(arg) * ONE_18;\n }\n\n // When dividing, we multiply by ONE_18 to arrive at a result with 18 decimal places\n return (logArg * ONE_18) / logBase;\n }\n }\n\n /**\n * @dev Natural logarithm (ln(a)) with signed 18 decimal fixed point argument.\n */\n function ln(int256 a) internal pure returns (int256) {\n unchecked {\n // The real natural logarithm is not defined for negative numbers or zero.\n require(a > 0, \"OUT_OF_BOUNDS\");\n if (LN_36_LOWER_BOUND < a && a < LN_36_UPPER_BOUND) {\n return _ln_36(a) / ONE_18;\n } else {\n return _ln(a);\n }\n }\n }\n\n /**\n * @dev Internal natural logarithm (ln(a)) with signed 18 decimal fixed point argument.\n */\n function _ln(int256 a) private pure returns (int256) {\n unchecked {\n if (a < ONE_18) {\n // Since ln(a^k) = k * ln(a), we can compute ln(a) as ln(a) = ln((1/a)^(-1)) = - ln((1/a)). If a is less\n // than one, 1/a will be greater than one, and this if statement will not be entered in the recursive call.\n // Fixed point division requires multiplying by ONE_18.\n return (-_ln((ONE_18 * ONE_18) / a));\n }\n\n // First, we use the fact that ln^(a * b) = ln(a) + ln(b) to decompose ln(a) into a sum of powers of two, which\n // we call x_n, where x_n == 2^(7 - n), which are the natural logarithm of precomputed quantities a_n (that is,\n // ln(a_n) = x_n). We choose the first x_n, x0, to equal 2^7 because the exponential of all larger powers cannot\n // be represented as 18 fixed point decimal numbers in 256 bits, and are therefore larger than a.\n // At the end of this process we will have the sum of all x_n = ln(a_n) that apply, and the remainder of this\n // decomposition, which will be lower than the smallest a_n.\n // ln(a) = k_0 * x_0 + k_1 * x_1 + ... + k_n * x_n + ln(remainder), where each k_n equals either 0 or 1.\n // We mutate a by subtracting a_n, making it the remainder of the decomposition.\n\n // For reasons related to how `exp` works, the first two a_n (e^(2^7) and e^(2^6)) are not stored as fixed point\n // numbers with 18 decimals, but instead as plain integers with 0 decimals, so we need to multiply them by\n // ONE_18 to convert them to fixed point.\n // For each a_n, we test if that term is present in the decomposition (if a is larger than it), and if so divide\n // by it and compute the accumulated sum.\n\n int256 sum = 0;\n if (a >= a0 * ONE_18) {\n a /= a0; // Integer, not fixed point division\n sum += x0;\n }\n\n if (a >= a1 * ONE_18) {\n a /= a1; // Integer, not fixed point division\n sum += x1;\n }\n\n // All other a_n and x_n are stored as 20 digit fixed point numbers, so we convert the sum and a to this format.\n sum *= 100;\n a *= 100;\n\n // Because further a_n are 20 digit fixed point numbers, we multiply by ONE_20 when dividing by them.\n\n if (a >= a2) {\n a = (a * ONE_20) / a2;\n sum += x2;\n }\n\n if (a >= a3) {\n a = (a * ONE_20) / a3;\n sum += x3;\n }\n\n if (a >= a4) {\n a = (a * ONE_20) / a4;\n sum += x4;\n }\n\n if (a >= a5) {\n a = (a * ONE_20) / a5;\n sum += x5;\n }\n\n if (a >= a6) {\n a = (a * ONE_20) / a6;\n sum += x6;\n }\n\n if (a >= a7) {\n a = (a * ONE_20) / a7;\n sum += x7;\n }\n\n if (a >= a8) {\n a = (a * ONE_20) / a8;\n sum += x8;\n }\n\n if (a >= a9) {\n a = (a * ONE_20) / a9;\n sum += x9;\n }\n\n if (a >= a10) {\n a = (a * ONE_20) / a10;\n sum += x10;\n }\n\n if (a >= a11) {\n a = (a * ONE_20) / a11;\n sum += x11;\n }\n\n // a is now a small number (smaller than a_11, which roughly equals 1.06). This means we can use a Taylor series\n // that converges rapidly for values of `a` close to one - the same one used in ln_36.\n // Let z = (a - 1) / (a + 1).\n // ln(a) = 2 * (z + z^3 / 3 + z^5 / 5 + z^7 / 7 + ... + z^(2 * n + 1) / (2 * n + 1))\n\n // Recall that 20 digit fixed point division requires multiplying by ONE_20, and multiplication requires\n // division by ONE_20.\n int256 z = ((a - ONE_20) * ONE_20) / (a + ONE_20);\n int256 z_squared = (z * z) / ONE_20;\n\n // num is the numerator of the series: the z^(2 * n + 1) term\n int256 num = z;\n\n // seriesSum holds the accumulated sum of each term in the series, starting with the initial z\n int256 seriesSum = num;\n\n // In each step, the numerator is multiplied by z^2\n num = (num * z_squared) / ONE_20;\n seriesSum += num / 3;\n\n num = (num * z_squared) / ONE_20;\n seriesSum += num / 5;\n\n num = (num * z_squared) / ONE_20;\n seriesSum += num / 7;\n\n num = (num * z_squared) / ONE_20;\n seriesSum += num / 9;\n\n num = (num * z_squared) / ONE_20;\n seriesSum += num / 11;\n\n // 6 Taylor terms are sufficient for 36 decimal precision.\n\n // Finally, we multiply by 2 (non fixed point) to compute ln(remainder)\n seriesSum *= 2;\n\n // We now have the sum of all x_n present, and the Taylor approximation of the logarithm of the remainder (both\n // with 20 decimals). All that remains is to sum these two, and then drop two digits to return a 18 decimal\n // value.\n\n return (sum + seriesSum) / 100;\n }\n }\n\n /**\n * @dev Intrnal high precision (36 decimal places) natural logarithm (ln(x)) with signed 18 decimal fixed point argument,\n * for x close to one.\n *\n * Should only be used if x is between LN_36_LOWER_BOUND and LN_36_UPPER_BOUND.\n */\n function _ln_36(int256 x) private pure returns (int256) {\n unchecked {\n // Since ln(1) = 0, a value of x close to one will yield a very small result, which makes using 36 digits\n // worthwhile.\n\n // First, we transform x to a 36 digit fixed point value.\n x *= ONE_18;\n\n // We will use the following Taylor expansion, which converges very rapidly. Let z = (x - 1) / (x + 1).\n // ln(x) = 2 * (z + z^3 / 3 + z^5 / 5 + z^7 / 7 + ... + z^(2 * n + 1) / (2 * n + 1))\n\n // Recall that 36 digit fixed point division requires multiplying by ONE_36, and multiplication requires\n // division by ONE_36.\n int256 z = ((x - ONE_36) * ONE_36) / (x + ONE_36);\n int256 z_squared = (z * z) / ONE_36;\n\n // num is the numerator of the series: the z^(2 * n + 1) term\n int256 num = z;\n\n // seriesSum holds the accumulated sum of each term in the series, starting with the initial z\n int256 seriesSum = num;\n\n // In each step, the numerator is multiplied by z^2\n num = (num * z_squared) / ONE_36;\n seriesSum += num / 3;\n\n num = (num * z_squared) / ONE_36;\n seriesSum += num / 5;\n\n num = (num * z_squared) / ONE_36;\n seriesSum += num / 7;\n\n num = (num * z_squared) / ONE_36;\n seriesSum += num / 9;\n\n num = (num * z_squared) / ONE_36;\n seriesSum += num / 11;\n\n num = (num * z_squared) / ONE_36;\n seriesSum += num / 13;\n\n num = (num * z_squared) / ONE_36;\n seriesSum += num / 15;\n\n // 8 Taylor terms are sufficient for 36 decimal precision.\n\n // All that remains is multiplying by 2 (non fixed point).\n return seriesSum * 2;\n }\n }\n}\n"
},
"contracts/f(x)/math/FxStableMath.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/// @dev In this library, we assume the nav for fractional token is always 1.\nlibrary FxStableMath {\n /*************\n * Constants *\n *************/\n\n /// @dev The precision used to compute nav.\n uint256 internal constant PRECISION = 1e18;\n\n /// @dev The precision used to compute nav.\n int256 internal constant PRECISION_I256 = 1e18;\n\n /// @dev The maximum value of leverage ratio.\n uint256 internal constant MAX_LEVERAGE_RATIO = 100e18;\n\n /***********\n * Structs *\n ***********/\n\n struct SwapState {\n // Current supply of base token\n uint256 baseSupply;\n // Current nav of base token\n uint256 baseNav;\n // Current nav of base token\n uint256 baseTwapNav;\n // Current supply of fractional token\n uint256 fSupply;\n // Current supply of leveraged token\n uint256 xSupply;\n // Current nav of leveraged token\n uint256 xNav;\n }\n\n /// @notice Compute the amount of base token needed to reach the new collateral ratio.\n ///\n /// @dev If the current collateral ratio <= new collateral ratio, we should return 0.\n ///\n /// @param state The current state.\n /// @param _newCollateralRatio The target collateral ratio, multipled by 1e18.\n /// @return _maxBaseIn The amount of base token needed.\n /// @return _maxFTokenMintable The amount of fToken can be minted.\n function maxMintableFToken(SwapState memory state, uint256 _newCollateralRatio)\n internal\n pure\n returns (uint256 _maxBaseIn, uint256 _maxFTokenMintable)\n {\n // n * v = nf * vf + nx * vx\n // (n + dn) * v = (nf + df) * vf + nx * vx\n // (n + dn) * v / ((nf + df) * vf) = ncr\n // =>\n // n * v - ncr * nf * vf = (ncr - 1) * dn * v\n // n * v - ncr * nf * vf = (ncr - 1) * df * vf\n // =>\n // dn = (n * v - ncr * nf * vf) / ((ncr - 1) * v)\n // df = (n * v - ncr * nf * vf) / ((ncr - 1) * vf)\n\n uint256 _baseVal = state.baseSupply * (state.baseNav) * (PRECISION);\n uint256 _fVal = _newCollateralRatio * (state.fSupply) * (PRECISION);\n\n if (_baseVal > _fVal) {\n _newCollateralRatio = _newCollateralRatio - (PRECISION);\n uint256 _delta = _baseVal - _fVal;\n\n _maxBaseIn = _delta / (state.baseNav * (_newCollateralRatio));\n _maxFTokenMintable = _delta / (PRECISION * (_newCollateralRatio));\n }\n }\n\n /// @notice Compute the amount of base token needed to reach the new collateral ratio.\n ///\n /// @dev If the current collateral ratio >= new collateral ratio, we should return 0.\n ///\n /// @param state The current state.\n /// @param _newCollateralRatio The target collateral ratio, multipled by 1e18.\n /// @return _maxBaseIn The amount of base token needed.\n /// @return _maxXTokenMintable The amount of xToken can be minted.\n function maxMintableXToken(SwapState memory state, uint256 _newCollateralRatio)\n internal\n pure\n returns (uint256 _maxBaseIn, uint256 _maxXTokenMintable)\n {\n // n * v = nf * vf + nx * vx\n // (n + dn) * v = nf * vf + (nx + dx) * vx\n // (n + dn) * v / (nf * vf) = ncr\n // =>\n // n * v + dn * v = ncr * nf * vf\n // n * v + dx * vx = ncr * nf * vf\n // =>\n // dn = (ncr * nf * vf - n * v) / v\n // dx = (ncr * nf * vf - n * v) / vx\n\n uint256 _baseVal = state.baseNav * (state.baseSupply) * (PRECISION);\n uint256 _fVal = _newCollateralRatio * (state.fSupply) * (PRECISION);\n\n if (_fVal > _baseVal) {\n uint256 _delta = _fVal - _baseVal;\n\n _maxBaseIn = _delta / (state.baseNav * (PRECISION));\n _maxXTokenMintable = _delta / (state.xNav * (PRECISION));\n }\n }\n\n /// @notice Compute the amount of fToken needed to reach the new collateral ratio.\n ///\n /// @dev If the current collateral ratio >= new collateral ratio, we should return 0.\n ///\n /// @param state The current state.\n /// @param _newCollateralRatio The target collateral ratio, multipled by 1e18.\n /// @return _maxBaseOut The amount of base token redeemed.\n /// @return _maxFTokenRedeemable The amount of fToken needed.\n function maxRedeemableFToken(SwapState memory state, uint256 _newCollateralRatio)\n internal\n pure\n returns (uint256 _maxBaseOut, uint256 _maxFTokenRedeemable)\n {\n // n * v = nf * vf + nx * vx\n // (n - dn) * v = (nf - df) * vf + nx * vx\n // (n - dn) * v / ((nf - df) * vf) = ncr\n // =>\n // n * v - dn * v = ncr * nf * vf - ncr * dn * v\n // n * v - df * vf = ncr * nf * vf - ncr * df * vf\n // =>\n // df = (ncr * nf * vf - n * v) / ((ncr - 1) * vf)\n // dn = (ncr * nf * vf - n * v) / ((ncr - 1) * v)\n\n uint256 _baseVal = state.baseSupply * (state.baseNav) * (PRECISION);\n uint256 _fVal = _newCollateralRatio * (state.fSupply) * (PRECISION);\n\n if (_fVal > _baseVal) {\n uint256 _delta = _fVal - _baseVal;\n _newCollateralRatio = _newCollateralRatio - (PRECISION);\n\n _maxFTokenRedeemable = _delta / (_newCollateralRatio * (PRECISION));\n _maxBaseOut = _delta / (_newCollateralRatio * (state.baseNav));\n }\n }\n\n /// @notice Compute the amount of xToken needed to reach the new collateral ratio.\n ///\n /// @dev If the current collateral ratio <= new collateral ratio, we should return 0.\n ///\n /// @param state The current state.\n /// @param _newCollateralRatio The target collateral ratio, multipled by 1e18.\n /// @return _maxBaseOut The amount of base token redeemed.\n /// @return _maxXTokenRedeemable The amount of xToken needed.\n function maxRedeemableXToken(SwapState memory state, uint256 _newCollateralRatio)\n internal\n pure\n returns (uint256 _maxBaseOut, uint256 _maxXTokenRedeemable)\n {\n // n * v = nf * vf + nx * vx\n // (n - dn) * v = nf * vf + (nx - dx) * vx\n // (n - dn) * v / (nf * vf) = ncr\n // =>\n // n * v - dn * v = ncr * nf * vf\n // n * v - dx * vx = ncr * nf * vf\n // =>\n // dn = (n * v - ncr * nf * vf) / v\n // dx = (n * v - ncr * nf * vf) / vx\n\n uint256 _baseVal = state.baseSupply * (state.baseNav) * (PRECISION);\n uint256 _fVal = _newCollateralRatio * (state.fSupply) * (PRECISION);\n\n if (_baseVal > _fVal) {\n uint256 _delta = _baseVal - _fVal;\n\n _maxXTokenRedeemable = _delta / (state.xNav * (PRECISION));\n _maxBaseOut = _delta / (state.baseNav * (PRECISION));\n }\n }\n\n /// @notice Mint fToken.\n /// @param state The current state.\n /// @param _baseIn The amount of base token supplied.\n /// @return _fTokenOut The amount of fToken expected.\n function mintFToken(SwapState memory state, uint256 _baseIn) internal pure returns (uint256 _fTokenOut) {\n // n * v = nf * vf + nx * vx\n // (n + dn) * v = (nf + df) * vf + nx * vx\n // =>\n // df = dn * v / vf\n _fTokenOut = (_baseIn * state.baseNav) / PRECISION;\n }\n\n /// @notice Mint xToken.\n /// @param state The current state.\n /// @param _baseIn The amount of base token supplied.\n /// @return _xTokenOut The amount of xToken expected.\n function mintXToken(SwapState memory state, uint256 _baseIn) internal pure returns (uint256 _xTokenOut) {\n // n * v = nf * vf + nx * vx\n // (n + dn) * v = nf * vf + (nx + dx) * vx\n // =>\n // dx = (dn * v * nx) / (n * v - nf * vf)\n _xTokenOut = _baseIn * state.baseNav * state.xSupply;\n _xTokenOut = _xTokenOut / (state.baseSupply * state.baseNav - state.fSupply * PRECISION);\n }\n\n /// @notice Redeem base token with fToken and xToken.\n /// @param state The current state.\n /// @param _fTokenIn The amount of fToken supplied.\n /// @param _xTokenIn The amount of xToken supplied.\n /// @return _baseOut The amount of base token expected.\n function redeem(\n SwapState memory state,\n uint256 _fTokenIn,\n uint256 _xTokenIn\n ) internal pure returns (uint256 _baseOut) {\n uint256 _xVal = state.baseSupply * state.baseNav - state.fSupply * PRECISION;\n\n // n * v = nf * vf + nx * vx\n // (n - dn) * v = (nf - df) * vf + (nx - dx) * vx\n // =>\n // dn = (df * vf + dx * (n * v - nf * vf) / nx) / v\n\n if (state.xSupply == 0) {\n _baseOut = (_fTokenIn * PRECISION) / state.baseNav;\n } else {\n _baseOut = _fTokenIn * PRECISION;\n _baseOut += (_xTokenIn * _xVal) / state.xSupply;\n _baseOut /= state.baseNav;\n }\n }\n\n /// @notice Compute current leverage ratio for xToken.\n ///\n /// @dev We use `baseTwapNav` to compute leverage ratio to avoid manipulation.\n ///\n /// @param state The current state.\n /// @return ratio The current leverage ratio.\n function leverageRatio(SwapState memory state) internal pure returns (uint256 ratio) {\n // ratio = (1 - rho * beta * (1 + r)) / (1 - rho), and beta = 0\n // ratio = 1 / (1 - rho)\n uint256 rho = (state.fSupply * PRECISION * PRECISION) / (state.baseSupply * state.baseTwapNav);\n if (rho >= PRECISION) {\n // under collateral, assume infinite leverage\n ratio = MAX_LEVERAGE_RATIO;\n } else {\n ratio = (PRECISION * PRECISION) / (PRECISION - rho);\n if (ratio > MAX_LEVERAGE_RATIO) ratio = MAX_LEVERAGE_RATIO;\n }\n }\n}\n"
},
"contracts/f(x)/v2/TreasuryV2.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity =0.8.20;\n\nimport { AccessControlUpgradeable } from \"@openzeppelin/contracts-upgradeable-v4/access/AccessControlUpgradeable.sol\";\nimport { IERC20MetadataUpgradeable } from \"@openzeppelin/contracts-upgradeable-v4/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\nimport { SafeERC20Upgradeable } from \"@openzeppelin/contracts-upgradeable-v4/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport { IERC20Upgradeable } from \"@openzeppelin/contracts-upgradeable-v4/token/ERC20/IERC20Upgradeable.sol\";\n\nimport { WordCodec } from \"../../common/codec/WordCodec.sol\";\nimport { ExponentialMovingAverageV8 } from \"../../common/math/ExponentialMovingAverageV8.sol\";\n\nimport { IAssetStrategy } from \"../../interfaces/f(x)/IAssetStrategy.sol\";\nimport { IFxFractionalTokenV2 } from \"../../interfaces/f(x)/IFxFractionalTokenV2.sol\";\nimport { IFxLeveragedTokenV2 } from \"../../interfaces/f(x)/IFxLeveragedTokenV2.sol\";\nimport { IFxMarketV2 } from \"../../interfaces/f(x)/IFxMarketV2.sol\";\nimport { IFxPriceOracleV2 } from \"../../interfaces/f(x)/IFxPriceOracleV2.sol\";\nimport { IFxRateProvider } from \"../../interfaces/f(x)/IFxRateProvider.sol\";\nimport { IFxRebalancePoolSplitter } from \"../../interfaces/f(x)/IFxRebalancePoolSplitter.sol\";\nimport { IFxTreasuryV2 } from \"../../interfaces/f(x)/IFxTreasuryV2.sol\";\n\nimport { FxStableMath } from \"../math/FxStableMath.sol\";\n\n// solhint-disable no-empty-blocks\n// solhint-disable not-rely-on-time\n\nabstract contract TreasuryV2 is AccessControlUpgradeable, IFxTreasuryV2 {\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n using ExponentialMovingAverageV8 for ExponentialMovingAverageV8.EMAStorage;\n using FxStableMath for FxStableMath.SwapState;\n using WordCodec for bytes32;\n\n /*************\n * Constants *\n *************/\n\n /// @inheritdoc IFxTreasuryV2\n address public immutable override baseToken;\n\n /// @inheritdoc IFxTreasuryV2\n address public immutable override fToken;\n\n /// @inheritdoc IFxTreasuryV2\n address public immutable override xToken;\n\n /// @dev The scale to make sure base token amount are with precision 1e18.\n uint256 private immutable baseTokenScale;\n\n /// @notice The role for f(x) market contract.\n bytes32 public constant FX_MARKET_ROLE = keccak256(\"FX_MARKET_ROLE\");\n\n /// @notice The role for f(x) settle whitelist.\n bytes32 public constant SETTLE_WHITELIST_ROLE = keccak256(\"SETTLE_WHITELIST_ROLE\");\n\n /// @notice The role for f(x) settle whitelist.\n bytes32 public constant PROTOCOL_INITIALIZER_ROLE = keccak256(\"PROTOCOL_INITIALIZER_ROLE\");\n\n /// @dev The precision used to compute fees.\n uint256 internal constant FEE_PRECISION = 1e9;\n\n /// @dev The precision used to compute nav.\n uint256 internal constant PRECISION = 1e18;\n\n /// @dev The precision used to compute nav.\n int256 private constant PRECISION_I256 = 1e18;\n\n /// @dev The offset of expense ratio in `_miscData`.\n uint256 private constant REBALANCE_POOL_RATIO_OFFSET = 0;\n\n /// @dev The offset of harvester ratio in `_miscData`.\n uint256 private constant HARVESTER_RATIO_OFFSET = 30;\n\n /// @dev The maximum expense ratio.\n uint256 private constant MAX_REBALANCE_POOL_RATIO = 1e9; // 100%\n\n /// @dev The maximum harvester ratio.\n uint256 private constant MAX_HARVESTER_RATIO = 1e8; // 10%\n\n /*************\n * Variables *\n *************/\n\n /// @notice The address of price oracle contract.\n address public override priceOracle;\n\n /// @inheritdoc IFxTreasuryV2\n uint256 public override referenceBaseTokenPrice;\n\n /// @inheritdoc IFxTreasuryV2\n uint256 public override totalBaseToken;\n\n /// @notice The maximum amount of base token can be deposited.\n uint256 public baseTokenCap;\n\n /// @inheritdoc IFxTreasuryV2\n address public override strategy;\n\n /// @inheritdoc IFxTreasuryV2\n uint256 public override strategyUnderlying;\n\n /// @notice The ema storage of the leverage ratio.\n ExponentialMovingAverageV8.EMAStorage public emaLeverageRatio;\n\n /// @notice The address platform contract.\n address public platform;\n\n /// @notice The address of RebalancePoolSplitter contract.\n address public rebalancePoolSplitter;\n\n /// @dev `_miscData` is a storage slot that can be used to store unrelated pieces of information.\n /// All pools store the *expense ratio* and *harvester ratio*, but the `miscData`can be extended\n /// to store more pieces of information.\n ///\n /// The *expense ratio* is stored in the first most significant 32 bits, and the *harvester ratio* is\n /// stored in the next most significant 32 bits leaving the remaining 196 bits free to store any\n /// other information derived pools might need.\n ///\n /// - The *expense ratio* and *harvester ratio* are charged each time when harvester harvest the pool revenue.\n ///\n /// [ expense ratio | harvester ratio | available ]\n /// [ 30 bits | 30 bits | 196 bits ]\n /// [ MSB LSB ]\n bytes32 internal _miscData;\n\n /// @dev Slots for future use.\n uint256[40] private _gap;\n\n /************\n * Modifier *\n ************/\n\n modifier onlyStrategy() {\n require(msg.sender == strategy, \"Only strategy\");\n _;\n }\n\n /***************\n * Constructor *\n ***************/\n\n constructor(\n address _baseToken,\n address _fToken,\n address _xToken\n ) {\n baseToken = _baseToken;\n fToken = _fToken;\n xToken = _xToken;\n baseTokenScale = 10**(18 - IERC20MetadataUpgradeable(_baseToken).decimals());\n }\n\n function __TreasuryV2_init(\n address _platform,\n address _rebalancePoolSplitter,\n address _priceOracle,\n uint256 _baseTokenCap,\n uint24 sampleInterval\n ) internal onlyInitializing {\n _updatePlatform(_platform);\n _updateRebalancePoolSplitter(_rebalancePoolSplitter);\n _updatePriceOracle(_priceOracle);\n _updateBaseTokenCap(_baseTokenCap);\n _updateEMASampleInterval(sampleInterval);\n }\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @inheritdoc IFxTreasuryV2\n function getRebalancePoolRatio() public view override returns (uint256) {\n return _miscData.decodeUint(REBALANCE_POOL_RATIO_OFFSET, 30);\n }\n\n /// @inheritdoc IFxTreasuryV2\n function getHarvesterRatio() public view override returns (uint256) {\n return _miscData.decodeUint(HARVESTER_RATIO_OFFSET, 30);\n }\n\n /// @inheritdoc IFxTreasuryV2\n function collateralRatio() public view override returns (uint256) {\n FxStableMath.SwapState memory _state = _loadSwapState(Action.None);\n\n if (_state.baseSupply == 0) return PRECISION;\n if (_state.fSupply == 0) return PRECISION * PRECISION;\n\n return (_state.baseSupply * _state.baseNav) / _state.fSupply;\n }\n\n /// @inheritdoc IFxTreasuryV2\n function isUnderCollateral() public view returns (bool) {\n FxStableMath.SwapState memory _state = _loadSwapState(Action.None);\n return _state.xNav == 0;\n }\n\n /// @inheritdoc IFxTreasuryV2\n /// @dev If the current collateral ratio <= new collateral ratio, we should return 0.\n function maxMintableFToken(uint256 _newCollateralRatio)\n external\n view\n override\n returns (uint256 _maxBaseIn, uint256 _maxFTokenMintable)\n {\n if (_newCollateralRatio <= PRECISION) revert ErrorCollateralRatioTooSmall();\n\n FxStableMath.SwapState memory _state = _loadSwapState(Action.MintFToken);\n (_maxBaseIn, _maxFTokenMintable) = _state.maxMintableFToken(_newCollateralRatio);\n }\n\n /// @inheritdoc IFxTreasuryV2\n /// @dev If the current collateral ratio >= new collateral ratio, we should return 0.\n function maxMintableXToken(uint256 _newCollateralRatio)\n external\n view\n override\n returns (uint256 _maxBaseIn, uint256 _maxXTokenMintable)\n {\n if (_newCollateralRatio <= PRECISION) revert ErrorCollateralRatioTooSmall();\n\n FxStableMath.SwapState memory _state = _loadSwapState(Action.MintXToken);\n (_maxBaseIn, _maxXTokenMintable) = _state.maxMintableXToken(_newCollateralRatio);\n }\n\n /// @inheritdoc IFxTreasuryV2\n /// @dev If the current collateral ratio >= new collateral ratio, we should return 0.\n function maxRedeemableFToken(uint256 _newCollateralRatio)\n external\n view\n override\n returns (uint256 _maxBaseOut, uint256 _maxFTokenRedeemable)\n {\n if (_newCollateralRatio <= PRECISION) revert ErrorCollateralRatioTooSmall();\n\n FxStableMath.SwapState memory _state = _loadSwapState(Action.RedeemFToken);\n (_maxBaseOut, _maxFTokenRedeemable) = _state.maxRedeemableFToken(_newCollateralRatio);\n }\n\n /// @inheritdoc IFxTreasuryV2\n /// @dev If the current collateral ratio <= new collateral ratio, we should return 0.\n function maxRedeemableXToken(uint256 _newCollateralRatio)\n external\n view\n override\n returns (uint256 _maxBaseOut, uint256 _maxXTokenRedeemable)\n {\n if (_newCollateralRatio <= PRECISION) revert ErrorCollateralRatioTooSmall();\n\n FxStableMath.SwapState memory _state = _loadSwapState(Action.RedeemXToken);\n (_maxBaseOut, _maxXTokenRedeemable) = _state.maxRedeemableXToken(_newCollateralRatio);\n }\n\n /// @inheritdoc IFxTreasuryV2\n /// @dev This function is used to calculate the nav of fToken and xToken.\n /// To avoid, price manipulation, we return the twap.\n function currentBaseTokenPrice() external view override returns (uint256) {\n (uint256 price, ) = _fetchBaseTokenPrice(Action.None);\n return price;\n }\n\n /// @inheritdoc IFxTreasuryV2\n function isBaseTokenPriceValid() public view returns (bool _isValid) {\n (_isValid, , , ) = IFxPriceOracleV2(priceOracle).getPrice();\n }\n\n /// @inheritdoc IFxTreasuryV2\n function leverageRatio() external view override returns (uint256) {\n return emaLeverageRatio.emaValue();\n }\n\n /// @inheritdoc IFxTreasuryV2\n function getWrapppedValue(uint256 amount) public view virtual returns (uint256) {\n return amount / baseTokenScale;\n }\n\n /// @inheritdoc IFxTreasuryV2\n function getUnderlyingValue(uint256 amount) public view virtual returns (uint256) {\n return amount * baseTokenScale;\n }\n\n /// @notice Return then amount of base token can be harvested.\n function harvestable() public view virtual returns (uint256) {\n uint256 balance = IERC20Upgradeable(baseToken).balanceOf(address(this));\n uint256 managed = getWrapppedValue(totalBaseToken);\n if (balance < managed) return 0;\n else return balance - managed;\n }\n\n /****************************\n * Public Mutated Functions *\n ****************************/\n\n /// @inheritdoc IFxTreasuryV2\n function mintFToken(uint256 _baseIn, address _recipient)\n external\n override\n onlyRole(FX_MARKET_ROLE)\n returns (uint256 _fTokenOut)\n {\n FxStableMath.SwapState memory _state = _loadSwapState(Action.MintFToken);\n if (_state.xNav == 0) revert ErrorUnderCollateral();\n if (_state.baseSupply + _baseIn > baseTokenCap) revert ErrorExceedTotalCap();\n\n _updateEMALeverageRatio(_state);\n\n _fTokenOut = _state.mintFToken(_baseIn);\n totalBaseToken = _state.baseSupply + _baseIn;\n\n IFxFractionalTokenV2(fToken).mint(_recipient, _fTokenOut);\n }\n\n /// @inheritdoc IFxTreasuryV2\n function mintXToken(uint256 _baseIn, address _recipient)\n external\n override\n onlyRole(FX_MARKET_ROLE)\n returns (uint256 _xTokenOut)\n {\n FxStableMath.SwapState memory _state = _loadSwapState(Action.MintXToken);\n if (_state.xNav == 0) revert ErrorUnderCollateral();\n if (_state.baseSupply + _baseIn > baseTokenCap) revert ErrorExceedTotalCap();\n\n _updateEMALeverageRatio(_state);\n\n _xTokenOut = _state.mintXToken(_baseIn);\n totalBaseToken = _state.baseSupply + _baseIn;\n\n IFxLeveragedTokenV2(xToken).mint(_recipient, _xTokenOut);\n }\n\n /// @inheritdoc IFxTreasuryV2\n function redeem(\n uint256 _fTokenIn,\n uint256 _xTokenIn,\n address _owner\n ) external override onlyRole(FX_MARKET_ROLE) returns (uint256 _baseOut) {\n FxStableMath.SwapState memory _state;\n\n if (_fTokenIn > 0) {\n _state = _loadSwapState(Action.RedeemFToken);\n } else {\n _state = _loadSwapState(Action.RedeemXToken);\n }\n _updateEMALeverageRatio(_state);\n\n if (_state.xNav == 0) {\n if (_xTokenIn > 0) revert ErrorUnderCollateral();\n // only redeem fToken proportionally when under collateral.\n _baseOut = (_fTokenIn * _state.baseSupply) / _state.fSupply;\n } else {\n _baseOut = _state.redeem(_fTokenIn, _xTokenIn);\n }\n\n if (_fTokenIn > 0) {\n IFxFractionalTokenV2(fToken).burn(_owner, _fTokenIn);\n }\n\n if (_xTokenIn > 0) {\n IFxLeveragedTokenV2(xToken).burn(_owner, _xTokenIn);\n }\n\n totalBaseToken = _state.baseSupply - _baseOut;\n\n _transferBaseToken(_baseOut, msg.sender);\n }\n\n /// @inheritdoc IFxTreasuryV2\n function settle() external override onlyRole(SETTLE_WHITELIST_ROLE) {\n if (totalBaseToken == 0) return;\n\n uint256 _oldPrice = referenceBaseTokenPrice;\n (uint256 _newPrice, ) = _fetchBaseTokenPrice(Action.None);\n referenceBaseTokenPrice = _newPrice;\n\n emit Settle(_oldPrice, _newPrice);\n\n // update leverage ratio at the end\n FxStableMath.SwapState memory _state = _loadSwapState(Action.None);\n _updateEMALeverageRatio(_state);\n }\n\n /// @inheritdoc IFxTreasuryV2\n function transferToStrategy(uint256 _amount) external override onlyStrategy {\n IERC20Upgradeable(baseToken).safeTransfer(strategy, _amount);\n strategyUnderlying += _amount;\n }\n\n /// @inheritdoc IFxTreasuryV2\n /// @dev For future use.\n function notifyStrategyProfit(uint256 _amount) external override onlyStrategy {}\n\n /// @notice Harvest pending rewards to stability pool.\n function harvest() external virtual {\n FxStableMath.SwapState memory _state = _loadSwapState(Action.None);\n _updateEMALeverageRatio(_state);\n\n _distributedHarvestedRewards(harvestable());\n }\n\n /************************\n * Restricted Functions *\n ************************/\n\n /// @inheritdoc IFxTreasuryV2\n function initializeProtocol(uint256 _baseIn)\n external\n virtual\n onlyRole(PROTOCOL_INITIALIZER_ROLE)\n returns (uint256, uint256)\n {\n return _initializeProtocol(_baseIn);\n }\n\n /// @notice Change address of strategy contract.\n /// @param _strategy The new address of strategy contract.\n function updateStrategy(address _strategy) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _updateStrategy(_strategy);\n }\n\n /// @notice Change address of price oracle contract.\n /// @param _priceOracle The new address of price oracle contract.\n function updatePriceOracle(address _priceOracle) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _updatePriceOracle(_priceOracle);\n }\n\n /// @notice Update the base token cap.\n /// @param _baseTokenCap The new base token cap.\n function updateBaseTokenCap(uint256 _baseTokenCap) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _updateBaseTokenCap(_baseTokenCap);\n }\n\n /// @notice Update the EMA sample interval.\n /// @param _sampleInterval The new EMA sample interval.\n function updateEMASampleInterval(uint24 _sampleInterval) external onlyRole(DEFAULT_ADMIN_ROLE) {\n FxStableMath.SwapState memory _state = _loadSwapState(Action.None);\n _updateEMALeverageRatio(_state);\n\n _updateEMASampleInterval(_sampleInterval);\n }\n\n /// @notice Change address of platform contract.\n /// @param _platform The new address of platform contract.\n function updatePlatform(address _platform) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _updatePlatform(_platform);\n }\n\n /// @notice Change address of RebalancePoolSplitter contract.\n /// @param _splitter The new address of RebalancePoolSplitter contract.\n function updateRebalancePoolSplitter(address _splitter) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _updateRebalancePoolSplitter(_splitter);\n }\n\n /// @notice Update the fee ratio distributed to treasury.\n /// @param _newRatio The new ratio to update, multiplied by 1e9.\n function updateRebalancePoolRatio(uint32 _newRatio) external onlyRole(DEFAULT_ADMIN_ROLE) {\n if (uint256(_newRatio) > MAX_REBALANCE_POOL_RATIO) {\n revert ErrorRebalancePoolRatioTooLarge();\n }\n\n bytes32 _data = _miscData;\n uint256 _oldRatio = _miscData.decodeUint(REBALANCE_POOL_RATIO_OFFSET, 30);\n _miscData = _data.insertUint(_newRatio, REBALANCE_POOL_RATIO_OFFSET, 30);\n\n emit UpdateRebalancePoolRatio(_oldRatio, _newRatio);\n }\n\n /// @notice Update the fee ratio distributed to harvester.\n /// @param _newRatio The new ratio to update, multiplied by 1e9.\n function updateHarvesterRatio(uint32 _newRatio) external onlyRole(DEFAULT_ADMIN_ROLE) {\n if (uint256(_newRatio) > MAX_HARVESTER_RATIO) {\n revert ErrorHarvesterRatioTooLarge();\n }\n\n bytes32 _data = _miscData;\n uint256 _oldRatio = _miscData.decodeUint(HARVESTER_RATIO_OFFSET, 30);\n _miscData = _data.insertUint(_newRatio, HARVESTER_RATIO_OFFSET, 30);\n\n emit UpdateHarvesterRatio(_oldRatio, _newRatio);\n }\n\n /**********************\n * Internal Functions *\n **********************/\n\n function _distributedHarvestedRewards(uint256 _totalRewards) internal {\n uint256 _harvestBounty = (getHarvesterRatio() * _totalRewards) / FEE_PRECISION;\n uint256 _rebalancePoolRewards = (getRebalancePoolRatio() * _totalRewards) / FEE_PRECISION;\n\n emit Harvest(msg.sender, _totalRewards, _rebalancePoolRewards, _harvestBounty);\n\n if (_harvestBounty > 0) {\n IERC20Upgradeable(baseToken).safeTransfer(_msgSender(), _harvestBounty);\n unchecked {\n _totalRewards = _totalRewards - _harvestBounty;\n }\n }\n\n if (_rebalancePoolRewards > 0) {\n _distributeRebalancePoolRewards(baseToken, _rebalancePoolRewards);\n unchecked {\n _totalRewards = _totalRewards - _rebalancePoolRewards;\n }\n }\n\n if (_totalRewards > 0) {\n IERC20Upgradeable(baseToken).safeTransfer(platform, _totalRewards);\n }\n }\n\n /// @dev Internal function to initialize protocol.\n /// @param _baseIn The amount of underlying value of the base token used to initialize.\n /// @return fTokenOut The amount of fToken minted.\n /// @return xTokenOut The amount of xToken minted.\n function _initializeProtocol(uint256 _baseIn) internal returns (uint256 fTokenOut, uint256 xTokenOut) {\n if (referenceBaseTokenPrice > 0) revert ErrorProtocolInitialized();\n if (getUnderlyingValue(IERC20Upgradeable(baseToken).balanceOf(address(this))) < _baseIn) {\n revert ErrorInsufficientInitialBaseToken();\n }\n\n // initialize reference price\n address _sender = _msgSender();\n (uint256 _price, ) = _fetchBaseTokenPrice(Action.None);\n referenceBaseTokenPrice = _price;\n emit Settle(0, _price);\n\n // mint fToken and xToken\n totalBaseToken = _baseIn;\n fTokenOut = (_baseIn * _price) / (2 * PRECISION);\n xTokenOut = fTokenOut;\n IFxFractionalTokenV2(fToken).mint(_sender, fTokenOut);\n IFxLeveragedTokenV2(xToken).mint(_sender, xTokenOut);\n\n // initialize EMA leverage\n ExponentialMovingAverageV8.EMAStorage memory cachedEmaLeverageRatio = emaLeverageRatio;\n cachedEmaLeverageRatio.lastTime = uint40(block.timestamp);\n cachedEmaLeverageRatio.lastValue = uint96(PRECISION * 2);\n cachedEmaLeverageRatio.lastEmaValue = uint96(PRECISION * 2);\n emaLeverageRatio = cachedEmaLeverageRatio;\n }\n\n /// @dev Internal function to change the address of strategy contract.\n /// @param _newStrategy The new address of strategy contract.\n function _updateStrategy(address _newStrategy) internal {\n address _oldStrategy = strategy;\n strategy = _newStrategy;\n\n emit UpdateStrategy(_oldStrategy, _newStrategy);\n }\n\n /// @dev Internal function to change the address of price oracle contract.\n /// @param _newPriceOracle The new address of price oracle contract.\n function _updatePriceOracle(address _newPriceOracle) internal {\n if (_newPriceOracle == address(0)) revert ErrorZeroAddress();\n\n address _oldPriceOracle = priceOracle;\n priceOracle = _newPriceOracle;\n\n emit UpdatePriceOracle(_oldPriceOracle, _newPriceOracle);\n }\n\n /// @dev Internal function to update the base token cap.\n /// @param _newBaseTokenCap The new base token cap.\n function _updateBaseTokenCap(uint256 _newBaseTokenCap) internal {\n uint256 _oldBaseTokenCap = baseTokenCap;\n baseTokenCap = _newBaseTokenCap;\n\n emit UpdateBaseTokenCap(_oldBaseTokenCap, _newBaseTokenCap);\n }\n\n /// @dev Internal function to update the EMA sample interval.\n /// @param _newSampleInterval The new EMA sample interval.\n function _updateEMASampleInterval(uint24 _newSampleInterval) internal {\n if (_newSampleInterval < 1 minutes) revert ErrorEMASampleIntervalTooSmall();\n\n uint256 _oldSampleInterval = emaLeverageRatio.sampleInterval;\n emaLeverageRatio.sampleInterval = _newSampleInterval;\n\n emit UpdateEMASampleInterval(_oldSampleInterval, _newSampleInterval);\n }\n\n /// @dev Internal function to change the address of platform contract.\n /// @param _newPlatform The new address of platform contract.\n function _updatePlatform(address _newPlatform) internal {\n if (_newPlatform == address(0)) revert ErrorZeroAddress();\n\n address _oldPlatform = platform;\n platform = _newPlatform;\n\n emit UpdatePlatform(_oldPlatform, _newPlatform);\n }\n\n /// @dev Internal function to change the address of RebalancePoolSplitter contract.\n /// @param _newRebalancePoolSplitter The new address of RebalancePoolSplitter contract.\n function _updateRebalancePoolSplitter(address _newRebalancePoolSplitter) internal {\n if (_newRebalancePoolSplitter == address(0)) revert ErrorZeroAddress();\n address _oldRebalancePoolSplitter = rebalancePoolSplitter;\n rebalancePoolSplitter = _newRebalancePoolSplitter;\n\n emit UpdateRebalancePoolSplitter(_oldRebalancePoolSplitter, _newRebalancePoolSplitter);\n }\n\n /// @dev Internal function to transfer base token to receiver.\n /// @param _amount The amount of base token to transfer.\n /// @param _recipient The address of receiver.\n function _transferBaseToken(uint256 _amount, address _recipient) internal returns (uint256) {\n _amount = getWrapppedValue(_amount);\n\n uint256 _balance = IERC20Upgradeable(baseToken).balanceOf(address(this));\n if (_balance < _amount) {\n uint256 _diff = _amount - _balance;\n IAssetStrategy(strategy).withdrawToTreasury(_diff);\n strategyUnderlying = strategyUnderlying - _diff;\n\n // consider possible slippage here.\n _balance = IERC20Upgradeable(baseToken).balanceOf(address(this));\n if (_amount > _balance) {\n _amount = _balance;\n }\n }\n\n IERC20Upgradeable(baseToken).safeTransfer(_recipient, _amount);\n\n return _amount;\n }\n\n /// @dev Internal function to load swap variable to memory\n function _loadSwapState(Action _action) internal view virtual returns (FxStableMath.SwapState memory _state) {\n _state.baseSupply = totalBaseToken;\n (_state.baseTwapNav, _state.baseNav) = _fetchBaseTokenPrice(_action);\n\n if (_state.baseSupply == 0) {\n _state.xNav = PRECISION;\n } else {\n _state.fSupply = IERC20Upgradeable(fToken).totalSupply();\n _state.xSupply = IERC20Upgradeable(xToken).totalSupply();\n if (_state.xSupply == 0) {\n // no xToken, treat the nav of xToken as 1.0\n _state.xNav = PRECISION;\n } else {\n uint256 _baseVal = _state.baseSupply * _state.baseNav;\n uint256 _fVal = _state.fSupply * PRECISION;\n if (_baseVal >= _fVal) {\n _state.xNav = (_baseVal - _fVal) / _state.xSupply;\n } else {\n // under collateral\n _state.xNav = 0;\n }\n }\n }\n }\n\n /// @dev Internal function to update ema leverage ratio.\n function _updateEMALeverageRatio(FxStableMath.SwapState memory _state) internal {\n uint256 _ratio = _state.leverageRatio();\n\n ExponentialMovingAverageV8.EMAStorage memory cachedEmaLeverageRatio = emaLeverageRatio;\n // The value is capped with 100*10^18, it is safe to cast.\n cachedEmaLeverageRatio.saveValue(uint96(_ratio));\n emaLeverageRatio = cachedEmaLeverageRatio;\n }\n\n /// @dev Internal function to fetch twap price.\n /// @return _twap The twap price of the base token.\n function _fetchBaseTokenPrice(Action _action) internal view returns (uint256 _twap, uint256 _price) {\n uint256 _minPrice;\n uint256 _maxPrice;\n (, _twap, _minPrice, _maxPrice) = IFxPriceOracleV2(priceOracle).getPrice();\n\n if (_action == Action.MintFToken || _action == Action.RedeemXToken) _price = _minPrice;\n else if (_action == Action.MintXToken || _action == Action.RedeemFToken) _price = _maxPrice;\n else _price = _maxPrice;\n\n if (_twap == 0) revert ErrorInvalidTwapPrice();\n }\n\n /// @dev Internal function to distribute rewards to rebalance pool.\n /// @param _token The address of token to distribute.\n /// @param _amount The amount of token to distribute.\n function _distributeRebalancePoolRewards(address _token, uint256 _amount) internal virtual {\n address _splitter = rebalancePoolSplitter;\n\n IERC20Upgradeable(_token).safeTransfer(_splitter, _amount);\n IFxRebalancePoolSplitter(_splitter).split(_token);\n }\n}\n"
},
"contracts/f(x)/v2/WrappedTokenTreasuryV2.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity =0.8.20;\npragma abicoder v2;\n\nimport { IERC20Upgradeable } from \"@openzeppelin/contracts-upgradeable-v4/token/ERC20/IERC20Upgradeable.sol\";\nimport { SafeERC20Upgradeable } from \"@openzeppelin/contracts-upgradeable-v4/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\nimport { IFxRebalancePoolSplitter } from \"../../interfaces/f(x)/IFxRebalancePoolSplitter.sol\";\nimport { IFxRateProvider } from \"../../interfaces/f(x)/IFxRateProvider.sol\";\nimport { IFxTreasuryV2 } from \"../../interfaces/f(x)/IFxTreasuryV2.sol\";\n\nimport { TreasuryV2 } from \"./TreasuryV2.sol\";\n\ncontract WrappedTokenTreasuryV2 is TreasuryV2 {\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n /**********\n * Events *\n **********/\n\n /// @notice Emitted when the rate provider contract is updated.\n /// @param oldRateProvider The address of previous rate provider.\n /// @param newRateProvider The address of current rate provider.\n event UpdateRateProvider(address indexed oldRateProvider, address indexed newRateProvider);\n\n /*************\n * Variables *\n *************/\n\n /// @notice The address of rate provider contract.\n address public rateProvider;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(\n address _baseToken,\n address _fToken,\n address _xToken\n ) TreasuryV2(_baseToken, _fToken, _xToken) {}\n\n function initialize(\n address _platform,\n address _rebalancePoolSplitter,\n address _rateProvider,\n address _priceOracle,\n uint256 _baseTokenCap,\n uint24 sampleInterval\n ) external initializer {\n __Context_init();\n __ERC165_init();\n __AccessControl_init();\n\n __TreasuryV2_init(_platform, _rebalancePoolSplitter, _priceOracle, _baseTokenCap, sampleInterval);\n\n _grantRole(DEFAULT_ADMIN_ROLE, _msgSender());\n\n _updateRateProvider(_rateProvider);\n }\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @inheritdoc IFxTreasuryV2\n function getWrapppedValue(uint256 _amount) public view virtual override returns (uint256) {\n return (_amount * PRECISION) / IFxRateProvider(rateProvider).getRate();\n }\n\n /// @inheritdoc IFxTreasuryV2\n function getUnderlyingValue(uint256 _amount) public view virtual override returns (uint256) {\n return (_amount * IFxRateProvider(rateProvider).getRate()) / PRECISION;\n }\n\n /************************\n * Restricted Functions *\n ************************/\n\n /// @notice Change address of price oracle contract.\n /// @param _rateProvider The new address of price oracle contract.\n function updateRateProvider(address _rateProvider) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _updateRateProvider(_rateProvider);\n }\n\n /**********************\n * Internal Functions *\n **********************/\n\n /// @dev Internal function to change the address of rate provider contract.\n /// @param _newRateProvider The new address of rate provider contract.\n function _updateRateProvider(address _newRateProvider) internal {\n if (_newRateProvider == address(0)) revert ErrorZeroAddress();\n\n address _oldRateProvider = rateProvider;\n rateProvider = _newRateProvider;\n\n emit UpdateRateProvider(_oldRateProvider, _newRateProvider);\n }\n}\n"
},
"contracts/interfaces/f(x)/IAssetStrategy.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0 || ^0.8.0;\n\ninterface IAssetStrategy {\n /// @notice Withdraw assets from strategy to treasury.\n /// @param amount The amount of token to withdraw.\n function withdrawToTreasury(uint256 amount) external;\n}\n"
},
"contracts/interfaces/f(x)/IFxFractionalTokenV2.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IFxFractionalTokenV2 {\n /**********\n * Errors *\n **********/\n\n /// @dev Thrown when caller is not treasury contract.\n error ErrorCallerIsNotTreasury();\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @notice Return the net asset value for the token, multipled by 1e18.\n function nav() external view returns (uint256);\n\n /****************************\n * Public Mutated Functions *\n ****************************/\n\n /// @notice Mint some token to someone.\n /// @param to The address of recipient.\n /// @param amount The amount of token to mint.\n function mint(address to, uint256 amount) external;\n\n /// @notice Burn some token from someone.\n /// @param from The address of owner to burn.\n /// @param amount The amount of token to burn.\n function burn(address from, uint256 amount) external;\n}\n"
},
"contracts/interfaces/f(x)/IFxLeveragedTokenV2.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IFxLeveragedTokenV2 {\n /**********\n * Errors *\n **********/\n\n /// @dev Thrown when caller is not treasury contract.\n error ErrorCallerIsNotTreasury();\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @notice Return the net asset value for the token.\n function nav() external view returns (uint256);\n\n /****************************\n * Public Mutated Functions *\n ****************************/\n\n /// @notice Mint some token to someone.\n /// @param to The address of recipient.\n /// @param amount The amount of token to mint.\n function mint(address to, uint256 amount) external;\n\n /// @notice Burn some token from someone.\n /// @param from The address of owner to burn.\n /// @param amount The amount of token to burn.\n function burn(address from, uint256 amount) external;\n}\n"
},
"contracts/interfaces/f(x)/IFxMarketV2.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IFxMarketV2 {\n /**********\n * Events *\n **********/\n\n /// @notice Emitted when fToken is minted.\n /// @param owner The address of base token owner.\n /// @param recipient The address of receiver for fToken or xToken.\n /// @param baseTokenIn The amount of base token deposited.\n /// @param fTokenOut The amount of fToken minted.\n /// @param mintFee The amount of mint fee charged.\n event MintFToken(\n address indexed owner,\n address indexed recipient,\n uint256 baseTokenIn,\n uint256 fTokenOut,\n uint256 mintFee\n );\n\n /// @notice Emitted when xToken is minted.\n /// @param owner The address of base token owner.\n /// @param recipient The address of receiver for fToken or xToken.\n /// @param baseTokenIn The amount of base token deposited.\n /// @param xTokenOut The amount of xToken minted.\n /// @param bonus The amount of base token as bonus.\n /// @param mintFee The amount of mint fee charged.\n event MintXToken(\n address indexed owner,\n address indexed recipient,\n uint256 baseTokenIn,\n uint256 xTokenOut,\n uint256 bonus,\n uint256 mintFee\n );\n\n /// @notice Emitted when someone redeem base token with fToken or xToken.\n /// @param owner The address of fToken and xToken owner.\n /// @param recipient The address of receiver for base token.\n /// @param fTokenBurned The amount of fToken burned.\n /// @param baseTokenOut The amount of base token redeemed.\n /// @param bonus The amount of base token as bonus.\n /// @param redeemFee The amount of redeem fee charged.\n event RedeemFToken(\n address indexed owner,\n address indexed recipient,\n uint256 fTokenBurned,\n uint256 baseTokenOut,\n uint256 bonus,\n uint256 redeemFee\n );\n\n /// @notice Emitted when someone redeem base token with fToken or xToken.\n /// @param owner The address of fToken and xToken owner.\n /// @param recipient The address of receiver for base token.\n /// @param xTokenBurned The amount of xToken burned.\n /// @param baseTokenOut The amount of base token redeemed.\n /// @param redeemFee The amount of redeem fee charged.\n event RedeemXToken(\n address indexed owner,\n address indexed recipient,\n uint256 xTokenBurned,\n uint256 baseTokenOut,\n uint256 redeemFee\n );\n\n /// @notice Emitted when the fee ratio for minting fToken is updated.\n /// @param defaultFeeRatio The new default fee ratio, multipled by 1e18.\n /// @param extraFeeRatio The new extra fee ratio, multipled by 1e18.\n event UpdateMintFeeRatioFToken(uint256 defaultFeeRatio, int256 extraFeeRatio);\n\n /// @notice Emitted when the fee ratio for minting xToken is updated.\n /// @param defaultFeeRatio The new default fee ratio, multipled by 1e18.\n /// @param extraFeeRatio The new extra fee ratio, multipled by 1e18.\n event UpdateMintFeeRatioXToken(uint256 defaultFeeRatio, int256 extraFeeRatio);\n\n /// @notice Emitted when the fee ratio for redeeming fToken is updated.\n /// @param defaultFeeRatio The new default fee ratio, multipled by 1e18.\n /// @param extraFeeRatio The new extra fee ratio, multipled by 1e18.\n event UpdateRedeemFeeRatioFToken(uint256 defaultFeeRatio, int256 extraFeeRatio);\n\n /// @notice Emitted when the fee ratio for redeeming xToken is updated.\n /// @param defaultFeeRatio The new default fee ratio, multipled by 1e18.\n /// @param extraFeeRatio The new extra fee ratio, multipled by 1e18.\n event UpdateRedeemFeeRatioXToken(uint256 defaultFeeRatio, int256 extraFeeRatio);\n\n /// @notice Emitted when the stability ratio is updated.\n /// @param oldRatio The previous collateral ratio to enter stability mode, multiplied by 1e18.\n /// @param newRatio The current collateral ratio to enter stability mode, multiplied by 1e18.\n event UpdateStabilityRatio(uint256 oldRatio, uint256 newRatio);\n\n /// @notice Emitted when the platform contract is updated.\n /// @param oldPlatform The address of previous platform contract.\n /// @param newPlatform The address of current platform contract.\n event UpdatePlatform(address indexed oldPlatform, address indexed newPlatform);\n\n /// @notice Emitted when the reserve pool contract is updated.\n /// @param oldReservePool The address of previous reserve pool contract.\n /// @param newReservePool The address of current reserve pool contract.\n event UpdateReservePool(address indexed oldReservePool, address indexed newReservePool);\n\n /// @notice Emitted when the RebalancePoolRegistry contract is updated.\n /// @param oldRegistry The address of previous RebalancePoolRegistry contract.\n /// @param newRegistry The address of current RebalancePoolRegistry contract.\n event UpdateRebalancePoolRegistry(address indexed oldRegistry, address indexed newRegistry);\n\n /// @notice Pause or unpause mint.\n /// @param oldStatus The previous status for mint.\n /// @param newStatus The current status for mint.\n event UpdateMintStatus(bool oldStatus, bool newStatus);\n\n /// @notice Pause or unpause redeem.\n /// @param oldStatus The previous status for redeem.\n /// @param newStatus The current status for redeem.\n event UpdateRedeemStatus(bool oldStatus, bool newStatus);\n\n /// @notice Pause or unpause fToken mint in stability mode.\n /// @param oldStatus The previous status for mint.\n /// @param newStatus The current status for mint.\n event UpdateFTokenMintStatusInStabilityMode(bool oldStatus, bool newStatus);\n\n /// @notice Pause or unpause xToken redeem in stability mode.\n /// @param oldStatus The previous status for redeem.\n /// @param newStatus The current status for redeem.\n event UpdateXTokenRedeemStatusInStabilityMode(bool oldStatus, bool newStatus);\n\n /**********\n * Errors *\n **********/\n\n /// @dev Thrown when the caller if not fUSD contract.\n error ErrorCallerNotFUSD();\n\n /// @dev Thrown when token mint is paused.\n error ErrorMintPaused();\n\n /// @dev Thrown when fToken mint is paused in stability mode.\n error ErrorFTokenMintPausedInStabilityMode();\n\n /// @dev Thrown when mint with zero amount base token.\n error ErrorMintZeroAmount();\n\n /// @dev Thrown when the amount of fToken is not enough.\n error ErrorInsufficientFTokenOutput();\n\n /// @dev Thrown when the amount of xToken is not enough.\n error ErrorInsufficientXTokenOutput();\n\n /// @dev Thrown when token redeem is paused.\n error ErrorRedeemPaused();\n\n /// @dev Thrown when xToken redeem is paused in stability mode.\n error ErrorXTokenRedeemPausedInStabilityMode();\n\n /// @dev Thrown when redeem with zero amount fToken or xToken.\n error ErrorRedeemZeroAmount();\n\n /// @dev Thrown when the amount of base token is not enough.\n error ErrorInsufficientBaseOutput();\n\n /// @dev Thrown when the stability ratio is too large.\n error ErrorStabilityRatioTooLarge();\n\n /// @dev Thrown when the default fee is too large.\n error ErrorDefaultFeeTooLarge();\n\n /// @dev Thrown when the delta fee is too small.\n error ErrorDeltaFeeTooSmall();\n\n /// @dev Thrown when the sum of default fee and delta fee is too large.\n error ErrorTotalFeeTooLarge();\n\n /// @dev Thrown when the given address is zero.\n error ErrorZeroAddress();\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @notice The address of Treasury contract.\n function treasury() external view returns (address);\n\n /// @notice Return the address of base token.\n function baseToken() external view returns (address);\n\n /// @notice Return the address fractional base token.\n function fToken() external view returns (address);\n\n /// @notice Return the address leveraged base token.\n function xToken() external view returns (address);\n\n /// @notice Return the address of fxUSD token.\n function fxUSD() external view returns (address);\n\n /// @notice Return the collateral ratio to enter stability mode, multiplied by 1e18.\n function stabilityRatio() external view returns (uint256);\n\n /****************************\n * Public Mutated Functions *\n ****************************/\n\n /// @notice Mint some fToken with some base token.\n /// @param baseIn The amount of wrapped value of base token supplied, use `uint256(-1)` to supply all base token.\n /// @param recipient The address of receiver for fToken.\n /// @param minFTokenMinted The minimum amount of fToken should be received.\n /// @return fTokenMinted The amount of fToken should be received.\n function mintFToken(\n uint256 baseIn,\n address recipient,\n uint256 minFTokenMinted\n ) external returns (uint256 fTokenMinted);\n\n /// @notice Mint some xToken with some base token.\n /// @param baseIn The amount of wrapped value of base token supplied, use `uint256(-1)` to supply all base token.\n /// @param recipient The address of receiver for xToken.\n /// @param minXTokenMinted The minimum amount of xToken should be received.\n /// @return xTokenMinted The amount of xToken should be received.\n /// @return bonus The amount of wrapped value of base token as bonus.\n function mintXToken(\n uint256 baseIn,\n address recipient,\n uint256 minXTokenMinted\n ) external returns (uint256 xTokenMinted, uint256 bonus);\n\n /// @notice Redeem base token with fToken.\n /// @param fTokenIn the amount of fToken to redeem, use `uint256(-1)` to redeem all fToken.\n /// @param recipient The address of receiver for base token.\n /// @param minBaseOut The minimum amount of wrapped value of base token should be received.\n /// @return baseOut The amount of wrapped value of base token should be received.\n /// @return bonus The amount of wrapped value of base token as bonus.\n function redeemFToken(\n uint256 fTokenIn,\n address recipient,\n uint256 minBaseOut\n ) external returns (uint256 baseOut, uint256 bonus);\n\n /// @notice Redeem base token with xToken.\n /// @param xTokenIn the amount of xToken to redeem, use `uint256(-1)` to redeem all xToken.\n /// @param recipient The address of receiver for base token.\n /// @param minBaseOut The minimum amount of wrapped value of base token should be received.\n /// @return baseOut The amount of wrapped value of base token should be received.\n function redeemXToken(\n uint256 xTokenIn,\n address recipient,\n uint256 minBaseOut\n ) external returns (uint256 baseOut);\n}\n"
},
"contracts/interfaces/f(x)/IFxPriceOracleV2.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0 || ^0.8.0;\n\ninterface IFxPriceOracleV2 {\n /**********\n * Events *\n **********/\n\n /// @notice Emitted when the value of maximum price deviation is updated.\n /// @param oldValue The value of the previous maximum price deviation.\n /// @param newValue The value of the current maximum price deviation.\n event UpdateMaxPriceDeviation(uint256 oldValue, uint256 newValue);\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @notice Return the oracle price with 18 decimal places.\n /// @return isValid Whether the oracle price is valid -- the difference between `minPrice` and `maxPrice` is reasonable.\n /// @return twap The time-weighted average price, multiplied by 1e18. It should be the anchor price for this asset, which is hard to manipulate.\n /// @return minPrice The minimum oracle price among all available price sources (including twap), multiplied by 1e18.\n /// @return maxPrice The maximum oracle price among all available price sources (including twap), multiplied by 1e18.\n function getPrice()\n external\n view\n returns (\n bool isValid,\n uint256 twap,\n uint256 minPrice,\n uint256 maxPrice\n );\n}\n"
},
"contracts/interfaces/f(x)/IFxRateProvider.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0 || ^0.8.0;\n\ninterface IFxRateProvider {\n /// @notice Return the exchange rate from wrapped token to underlying rate,\n /// multiplied by 1e18.\n function getRate() external view returns (uint256);\n}\n"
},
"contracts/interfaces/f(x)/IFxRebalancePoolSplitter.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0 || ^0.8.0;\n\ninterface IFxRebalancePoolSplitter {\n /**********\n * Events *\n **********/\n\n /// @notice Emitted when the address of splitter is updated.\n /// @param token The address of the token.\n /// @param oldSplitter The address of previous token splitter.\n /// @param newSplitter The address of current token splitter.\n event UpdateSplitter(address indexed token, address indexed oldSplitter, address indexed newSplitter);\n\n /// @notice Emitted when the address of token wrapper is updated.\n /// @param token The address of the token.\n /// @param oldWrapper The address of previous token wrapper.\n /// @param newWrapper The address of current token wrapper.\n event UpdateTokenWrapper(address indexed token, address indexed oldWrapper, address indexed newWrapper);\n\n /// @notice Emitted when a new receiver is added.\n /// @param token The address of the token.\n /// @param receiver The address of the receiver.\n event RegisterReceiver(address indexed token, address indexed receiver);\n\n /// @notice Emitted when an existed receiver is removed.\n /// @param token The address of the token.\n /// @param receiver The address of the receiver.\n event DeregisterReceiver(address indexed token, address indexed receiver);\n\n /// @notice Emitted when the split ratio is updated.\n /// @param token The address of the token.\n /// @param ratios The list of new split ratios.\n event UpdateSplitRatios(address indexed token, uint256[] ratios);\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @notice Return the splitter of the given token.\n /// @param token The address of token to query.\n function splitter(address token) external view returns (address);\n\n /// @notice Return the receivers and split ratios for the given token.\n /// @param token The address of token to query.\n /// @return receivers The address list of receivers.\n /// @return ratios The list of corresponding split ratio.\n function getReceivers(address token) external view returns (address[] memory receivers, uint256[] memory ratios);\n\n /****************************\n * Public Mutated Functions *\n ****************************/\n\n /// @notice Split token to different RebalancePool.\n /// @param token The address of token to split.\n function split(address token) external;\n}\n"
},
"contracts/interfaces/f(x)/IFxTreasuryV2.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IFxTreasuryV2 {\n /**********\n * Events *\n **********/\n\n /// @notice Emitted when the platform contract is updated.\n /// @param oldPlatform The address of previous platform contract.\n /// @param newPlatform The address of current platform contract.\n event UpdatePlatform(address indexed oldPlatform, address indexed newPlatform);\n\n /// @notice Emitted when the RebalancePoolSplitter contract is updated.\n /// @param oldRebalancePoolSplitter The address of previous RebalancePoolSplitter contract.\n /// @param newRebalancePoolSplitter The address of current RebalancePoolSplitter.\n event UpdateRebalancePoolSplitter(address indexed oldRebalancePoolSplitter, address indexed newRebalancePoolSplitter);\n\n /// @notice Emitted when the price oracle contract is updated.\n /// @param oldPriceOracle The address of previous price oracle.\n /// @param newPriceOracle The address of current price oracle.\n event UpdatePriceOracle(address indexed oldPriceOracle, address indexed newPriceOracle);\n\n /// @notice Emitted when the strategy contract is updated.\n /// @param oldStrategy The address of previous strategy.\n /// @param newStrategy The address of current strategy.\n event UpdateStrategy(address indexed oldStrategy, address indexed newStrategy);\n\n /// @notice Emitted when the base token cap is updated.\n /// @param oldBaseTokenCap The value of previous base token cap.\n /// @param newBaseTokenCap The value of current base token cap.\n event UpdateBaseTokenCap(uint256 oldBaseTokenCap, uint256 newBaseTokenCap);\n\n /// @notice Emitted when the EMA sample interval is updated.\n /// @param oldSampleInterval The value of previous EMA sample interval.\n /// @param newSampleInterval The value of current EMA sample interval.\n event UpdateEMASampleInterval(uint256 oldSampleInterval, uint256 newSampleInterval);\n\n /// @notice Emitted when the reference price is updated.\n /// @param oldPrice The value of previous reference price.\n /// @param newPrice The value of current reference price.\n event Settle(uint256 oldPrice, uint256 newPrice);\n\n /// @notice Emitted when the ratio for rebalance pool is updated.\n /// @param oldRatio The value of the previous ratio, multiplied by 1e9.\n /// @param newRatio The value of the current ratio, multiplied by 1e9.\n event UpdateRebalancePoolRatio(uint256 oldRatio, uint256 newRatio);\n\n /// @notice Emitted when the ratio for harvester is updated.\n /// @param oldRatio The value of the previous ratio, multiplied by 1e9.\n /// @param newRatio The value of the current ratio, multiplied by 1e9.\n event UpdateHarvesterRatio(uint256 oldRatio, uint256 newRatio);\n\n /// @notice Emitted when someone harvest pending stETH rewards.\n /// @param caller The address of caller.\n /// @param totalRewards The amount of total harvested rewards.\n /// @param rebalancePoolRewards The amount of harvested rewards distributed to stability pool.\n /// @param harvestBounty The amount of harvested rewards distributed to caller as harvest bounty.\n event Harvest(address indexed caller, uint256 totalRewards, uint256 rebalancePoolRewards, uint256 harvestBounty);\n\n /**********\n * Errors *\n **********/\n\n /// @dev Thrown when the collateral ratio is smaller than 100%.\n error ErrorCollateralRatioTooSmall();\n\n /// @dev Thrown when mint exceed total capacity.\n error ErrorExceedTotalCap();\n\n /// @dev Thrown when the oracle price is invalid.\n error ErrorInvalidOraclePrice();\n\n /// @dev Thrown when the twap price is invalid.\n error ErrorInvalidTwapPrice();\n\n /// @dev Thrown when initialize protocol twice.\n error ErrorProtocolInitialized();\n\n /// @dev Thrown when the initial amount of base token is not enough.\n error ErrorInsufficientInitialBaseToken();\n\n /// @dev Thrown when current is under collateral.\n error ErrorUnderCollateral();\n\n /// @dev Thrown when the sample internal for EMA is too small.\n error ErrorEMASampleIntervalTooSmall();\n\n /// @dev Thrown when the expense ratio exceeds `MAX_REBALANCE_POOL_RATIO`.\n error ErrorRebalancePoolRatioTooLarge();\n\n /// @dev Thrown when the harvester ratio exceeds `MAX_HARVESTER_RATIO`.\n error ErrorHarvesterRatioTooLarge();\n\n /// @dev Thrown when the given address is zero.\n error ErrorZeroAddress();\n\n /*********\n * Enums *\n *********/\n\n enum Action {\n None,\n MintFToken,\n MintXToken,\n RedeemFToken,\n RedeemXToken\n }\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @notice Return the address of price oracle contract.\n function priceOracle() external view returns (address);\n\n /// @notice Return the address of base token.\n function baseToken() external view returns (address);\n\n /// @notice Return the address fractional base token.\n function fToken() external view returns (address);\n\n /// @notice Return the address leveraged base token.\n function xToken() external view returns (address);\n\n /// @notice The reference base token price.\n function referenceBaseTokenPrice() external view returns (uint256);\n\n /// @notice The current base token price.\n function currentBaseTokenPrice() external view returns (uint256);\n\n /// @notice Return whether the price is valid.\n function isBaseTokenPriceValid() external view returns (bool);\n\n /// @notice Return the total amount of underlying value of base token deposited.\n function totalBaseToken() external view returns (uint256);\n\n /// @notice Return the address of strategy contract.\n function strategy() external view returns (address);\n\n /// @notice Return the total amount of base token managed by strategy.\n function strategyUnderlying() external view returns (uint256);\n\n /// @notice Return the current collateral ratio of fToken, multiplied by 1e18.\n function collateralRatio() external view returns (uint256);\n\n /// @notice Return whether the system is under collateral.\n function isUnderCollateral() external view returns (bool);\n\n /// @notice Compute the amount of base token needed to reach the new collateral ratio.\n /// @param newCollateralRatio The target collateral ratio, multiplied by 1e18.\n /// @return maxBaseIn The amount of underlying value of base token needed.\n /// @return maxFTokenMintable The amount of fToken can be minted.\n function maxMintableFToken(uint256 newCollateralRatio)\n external\n view\n returns (uint256 maxBaseIn, uint256 maxFTokenMintable);\n\n /// @notice Compute the amount of base token needed to reach the new collateral ratio.\n /// @param newCollateralRatio The target collateral ratio, multiplied by 1e18.\n /// @return maxBaseIn The amount of underlying value of base token needed.\n /// @return maxXTokenMintable The amount of xToken can be minted.\n function maxMintableXToken(uint256 newCollateralRatio)\n external\n view\n returns (uint256 maxBaseIn, uint256 maxXTokenMintable);\n\n /// @notice Compute the amount of fToken needed to reach the new collateral ratio.\n /// @param newCollateralRatio The target collateral ratio, multiplied by 1e18.\n /// @return maxBaseOut The amount of underlying value of base token redeemed.\n /// @return maxFTokenRedeemable The amount of fToken needed.\n function maxRedeemableFToken(uint256 newCollateralRatio)\n external\n view\n returns (uint256 maxBaseOut, uint256 maxFTokenRedeemable);\n\n /// @notice Compute the amount of xToken needed to reach the new collateral ratio.\n /// @param newCollateralRatio The target collateral ratio, multiplied by 1e18.\n /// @return maxBaseOut The amount of underlying value of base token redeemed.\n /// @return maxXTokenRedeemable The amount of xToken needed.\n function maxRedeemableXToken(uint256 newCollateralRatio)\n external\n view\n returns (uint256 maxBaseOut, uint256 maxXTokenRedeemable);\n\n /// @notice Return the exponential moving average of the leverage ratio.\n function leverageRatio() external view returns (uint256);\n\n /// @notice Convert underlying token amount to wrapped token amount.\n /// @param amount The underlying token amount.\n function getWrapppedValue(uint256 amount) external view returns (uint256);\n\n /// @notice Convert wrapped token amount to underlying token amount.\n /// @param amount The wrapped token amount.\n function getUnderlyingValue(uint256 amount) external view returns (uint256);\n\n /// @notice Return the fee ratio distributed to rebalance pool, multiplied by 1e9.\n function getRebalancePoolRatio() external view returns (uint256);\n\n /// @notice Return the fee ratio distributed to harvester, multiplied by 1e9.\n function getHarvesterRatio() external view returns (uint256);\n\n /****************************\n * Public Mutated Functions *\n ****************************/\n\n /// @notice Initialize the protocol.\n /// @param baseIn The amount of underlying value of the base token used to initialize.\n function initializeProtocol(uint256 baseIn) external returns (uint256 fTokenOut, uint256 xTokenOut);\n\n /// @notice Mint fToken with some base token.\n /// @param baseIn The amount of underlying value of base token deposited.\n /// @param recipient The address of receiver.\n /// @return fTokenOut The amount of fToken minted.\n function mintFToken(uint256 baseIn, address recipient) external returns (uint256 fTokenOut);\n\n /// @notice Mint xToken with some base token.\n /// @param baseIn The amount of underlying value of base token deposited.\n /// @param recipient The address of receiver.\n /// @return xTokenOut The amount of xToken minted.\n function mintXToken(uint256 baseIn, address recipient) external returns (uint256 xTokenOut);\n\n /// @notice Redeem fToken and xToken to base token.\n /// @param fTokenIn The amount of fToken to redeem.\n /// @param xTokenIn The amount of xToken to redeem.\n /// @param owner The owner of the fToken or xToken.\n /// @param baseOut The amount of underlying value of base token redeemed.\n function redeem(\n uint256 fTokenIn,\n uint256 xTokenIn,\n address owner\n ) external returns (uint256 baseOut);\n\n /// @notice Settle the nav of base token, fToken and xToken.\n function settle() external;\n\n /// @notice Transfer some base token to strategy contract.\n /// @param amount The amount of token to transfer.\n function transferToStrategy(uint256 amount) external;\n\n /// @notice Notify base token profit from strategy contract.\n /// @param amount The amount of base token.\n function notifyStrategyProfit(uint256 amount) external;\n\n /// @notice Harvest pending rewards to stability pool.\n function harvest() external;\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "shanghai",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}
}} |
1 | 20,291,278 | 3f1324d613d311f8ecdaa31cdd323821c1e6e740f2c845996cd47567c7ebc222 | 447c4f28b3e3ddc0a95f0202767c1e9cbceb80a7376de2f3c6f6a8d3776a1238 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | 98ea26a76fd78a22691c9ff64f26893a13cd9b28 | 61010060405234801562000011575f80fd5b50604051620035b4380380620035b48339810160408190526200003491620001ae565b6001600160a01b03811660808190526040805163c55dae6360e01b8152905163c55dae63916004808201926020929091908290030181865afa1580156200007d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190620000a39190620001ae565b6001600160a01b031660a0816001600160a01b031681525050806001600160a01b031663a8694e576040518163ffffffff1660e01b8152600401602060405180830381865afa158015620000f9573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906200011f9190620001ae565b6001600160a01b031660c0816001600160a01b031681525050806001600160a01b031663088b699e6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000175573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906200019b9190620001ae565b6001600160a01b031660e05250620001dd565b5f60208284031215620001bf575f80fd5b81516001600160a01b0381168114620001d6575f80fd5b9392505050565b60805160a05160c05160e0516132d1620002e35f395f81816102a60152610cb901525f81816104bc0152611b4a01525f818161051f015281816107f501528181610aa501528181611021015281816110cf01528181611133015281816114ed015281816118ac01528181611e530152818161200b015281816120b90152818161211d0152612a1e01525f8181610396015281816108d001528181610957015281816109db01528181610ac801528181610b0301528181610d7701528181610e1401528181610ed801528181610f8e015281816115c80152818161164f015281816116ef01528181611c0801528181611cad01528181611e770152611f7801526132d15ff3fe608060405234801561000f575f80fd5b506004361061024a575f3560e01c80638373c53b11610140578063b235d468116100bf578063d0ce98fa11610084578063d0ce98fa14610549578063d547741f1461055c578063e3d65a6f1461056f578063edd6fcd214610582578063f478f35d1461058a578063f76a582514610592575f80fd5b8063b235d468146104e6578063b5567473146104f4578063c0c53b8b14610507578063c55dae631461051a578063cf0b5b3014610541575f80fd5b8063a217fddf11610105578063a217fddf14610495578063a293da0f1461049c578063a455f1ac146104af578063a8694e57146104b7578063ab7c425b146104de575f80fd5b80638373c53b1461043557806391d148541461044857806395a086d71461045b57806396e838391461046e578063a0b4f94a14610482575f80fd5b80634bde38c8116101cc57806372b790db1161019157806372b790db146103de578063742e6b3e146103f15780637b103999146104045780637cf98049146104175780637e4831d31461042a575f80fd5b80634bde38c81461036b578063534b23bb1461037e57806361d027b31461039157806364c9b4c3146103b85780636dbe4bb9146103cb575f80fd5b80631f73b2d3116102125780631f73b2d3146102fa578063248a9ca3146103025780632cdb9862146103325780632f2ff15d1461034557806336568abe14610358575f80fd5b806301ffc9a71461024e5780630266f04414610276578063088b699e146102a1578063153f7cd0146102c857806318ebbb82146102dd575b5f80fd5b61026161025c366004612e51565b6105a5565b60405190151581526020015b60405180910390f35b60cd54610289906001600160a01b031681565b6040516001600160a01b03909116815260200161026d565b6102897f000000000000000000000000000000000000000000000000000000000000000081565b6102db6102d6366004612e93565b6105db565b005b6102e56105f2565b6040805192835260208301919091520161026d565b61026161062d565b610324610310366004612eac565b5f9081526065602052604090206001015490565b60405190815260200161026d565b6102db610340366004612ed0565b610644565b6102db610353366004612eeb565b6106b8565b6102db610366366004612eeb565b6106e1565b60cc54610289906001600160a01b031681565b6102db61038c366004612e93565b610760565b6102897f000000000000000000000000000000000000000000000000000000000000000081565b6103246103c6366004612f15565b610773565b60cf54610289906001600160a01b031681565b6103246103ec366004612f15565b610c77565b6102db6103ff366004612e93565b6111b6565b60ce54610289906001600160a01b031681565b6102db610425366004612ed0565b611218565b60c954600116610261565b6102db610443366004612ed0565b611283565b610261610456366004612eeb565b6112ee565b6102db610469366004612f47565b611318565b6103245f8051602061327c83398151915281565b6102db610490366004612eac565b611434565b6103245f81565b6102db6104aa366004612e93565b611447565b6102e561145a565b6102897f000000000000000000000000000000000000000000000000000000000000000081565b61026161149b565b60c954600190811c16610261565b6102e5610502366004612f15565b6114ad565b6102db610515366004612fa0565b6119aa565b6102897f000000000000000000000000000000000000000000000000000000000000000081565b610324611af5565b6102e5610557366004612f15565b611b07565b6102db61056a366004612eeb565b6121a8565b6102db61057d366004612fe0565b6121cc565b6102e56122aa565b6102e56122be565b6102db6105a0366004612ed0565b6122d1565b5f6001600160e01b03198216637965db0b60e01b14806105d557506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f6105e581612335565b6105ee82612342565b5050565b60cb545f90819061060681608060406123ba565b9250677fffffffffffffff60c082901c90811167ffffffffffffffff1902175b9150509091565b60c9545f9061063f9060031c60011690565b905090565b5f8051602061327c83398151915261065b81612335565b60c98054600384811b6008198316179092555f911c60011660408051821515815285151560208201529192507f1d3720296a9c03dedcca7947c2e2a866b93fd3d5d936ee525175c7500e10b88991015b60405180910390a1505050565b5f828152606560205260409020600101546106d281612335565b6106dc83836123c8565b505050565b6001600160a01b03811633146107565760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6105ee828261244d565b5f61076a81612335565b6105ee826124b3565b5f61077c61252b565b60c954600116156107a057604051638397554960e01b815260040160405180910390fd5b60cf546001600160a01b031680158015906107c457506001600160a01b0381163314155b156107e257604051635121c12760e01b815260040160405180910390fd5b505f198403610884576001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166370a08231336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa15801561085d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610881919061300b565b93505b835f036108a457604051637161b5e160e01b815260040160405180910390fd5b5f6108ad611af5565b60405163066498a160e41b8152600481018290529091505f906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906366498a10906024016040805180830381865afa158015610914573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109389190613022565b50905080156109cb5760405163059394af60e11b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690630b27295e90602401602060405180830381865afa1580156109a4573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109c8919061300b565b90505b6109d361149b565b15610a89575f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b4eae1cb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a35573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a59919061300b565b9050828111610a7b57604051630af33d4560e31b815260040160405180910390fd5b81871115610a87578196505b505b5f610a948783612586565b9050610aed335b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016907f0000000000000000000000000000000000000000000000000000000000000000846125bb565b60405163207f377360e11b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635fe208209082906340fe6ee690602401602060405180830381865afa158015610b58573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b7c919061300b565b6040516001600160e01b031960e084901b16815260048101919091526001600160a01b03891660248201526044016020604051808303815f875af1158015610bc6573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bea919061300b565b935084841015610c0d57604051633178177760e11b815260040160405180910390fd5b6001600160a01b038616337f35c491de72a5104fe4f7b7e908ad5ac54aadbedc624455aaf6415fcf9a85d0478987610c458683613058565b6040805193845260208401929092529082015260600160405180910390a3505050610c706001609755565b9392505050565b5f610c8061252b565b60c954600190811c1615610ca757604051637e7f033f60e11b815260040160405180910390fd5b5f198403610d48576001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166370a08231336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015610d21573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d45919061300b565b93505b835f03610d6857604051634379594d60e11b815260040160405180910390fd5b5f610d71611af5565b90505f807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d2056f3e846040518263ffffffff1660e01b8152600401610dc391815260200190565b6040805180830381865afa158015610ddd573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e019190613022565b915050610e0c61062d565b15610ec2575f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b4eae1cb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e6e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e92919061300b565b9050838111610eb457604051639692570b60e01b815260040160405180910390fd5b81881115610ec0578197505b505b610ecc878261262d565b91506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663049104e55f89336040516001600160e01b031960e086901b168152600481019390935260248301919091526001600160a01b031660448201526064016020604051808303815f875af1158015610f51573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f75919061300b565b60405163059394af60e11b8152600481018290529094507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690630b27295e90602401602060405180830381865afa158015610fdb573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fff919061300b565b6040516370a0823160e01b81523060048201529094505f906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015611066573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061108a919061300b565b905084811015611098578094505b5f670de0b6b3a76400006110ac858861306b565b6110b69190613082565b905080156111055760cc546110f8906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116911683612657565b6111028187613058565b95505b8686101561112657604051631d0d055760e11b815260040160405180910390fd5b61115a6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168988612657565b604080518a81526020810188905280820183905290516001600160a01b038a169133917f514b5806ac61806bec81468a48c859aa0393139dcdf0e36b8e5933d1d5f37aa79181900360600190a35050505050610c706001609755565b5f6111c081612335565b6001600160a01b0382166111e75760405163a7f9319d60e01b815260040160405180910390fd5b60cf546001600160a01b03166105ee5760cf80546001600160a01b0384166001600160a01b03199091161790555050565b5f8051602061327c83398151915261122f81612335565b60c98054600284811b6004198316179092555f911c60011660408051821515815285151560208201529192507fd1c4dccc0d477de173d9ff9d15c46099e72a60465ae205e1e312fbac46f194b291016106ab565b5f8051602061327c83398151915261129a81612335565b60c98054600184811b6002198316179092555f9190811c1660408051821515815285151560208201529192507f74b35077012c8e49409b89157958f89c81139301b437a3b30bad78b75e531ac691016106ab565b5f9182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b5f61132281612335565b611338846001600160801b031684600f0b612687565b60ca5482156113b757611357816001600160801b0387165f6040612713565b905061136a81600f86900b604080612727565b604080516001600160801b0388168152600f87900b60208201529192507f71a7b2c63c80f57231f61b616df32af0aca06fa38eddb55286818753a091d302910160405180910390a161142b565b6113ce816001600160801b03871660806040612713565b90506113e281600f86900b60c06040612727565b604080516001600160801b0388168152600f87900b60208201529192507f59b9b7a829db9b6a52f2071b54c024d0e9b3d6e61d70a1e59bc7b01c046582d1910160405180910390a15b60ca5550505050565b5f61143e81612335565b6105ee82612743565b5f61145181612335565b6105ee826127c6565b60ca545f90819061146d818360406123ba565b9250677fffffffffffffff604082901c67ffffffffffffffff1690811167ffffffffffffffff190217610626565b60c9545f9061063f9060021c60011690565b5f806114b761252b565b60c954600116156114db57604051638397554960e01b815260040160405180910390fd5b5f19850361157c576001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166370a08231336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015611555573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611579919061300b565b94505b845f0361159c57604051637161b5e160e01b815260040160405180910390fd5b5f6115a5611af5565b60405163e9ea2b2560e01b8152600481018290529091505f906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063e9ea2b25906024016040805180830381865afa15801561160c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906116309190613022565b50905080156116c35760405163059394af60e11b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690630b27295e90602401602060405180830381865afa15801561169c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906116c0919061300b565b90505b5f6116ce888361283e565b90506116d933610a9b565b60405163207f377360e11b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063cd8bf8749082906340fe6ee690602401602060405180830381865afa158015611744573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611768919061300b565b6040516001600160e01b031960e084901b16815260048101919091526001600160a01b038a1660248201526044016020604051808303815f875af11580156117b2573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906117d6919061300b565b9450858510156117f9576040516303a7a15b60e21b815260040160405180910390fd5b818110156118095780935061180d565b8193505b5f8411801561188d575060ce5f9054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611867573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061188b919061300b565b155b156119355760cd54604051632b2b2cf560e11b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660048301528981166024830152604482018790529091169063565659ea906064016020604051808303815f875af115801561190a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061192e919061300b565b9350611939565b5f93505b6001600160a01b038716337f4e4164ca4717505705e4c67fdbb1a54891b87dab3c5635cd3a2d2b6351aa37e78a88886119728784613058565b60408051948552602085019390935291830152606082015260800160405180910390a35050506119a26001609755565b935093915050565b5f54610100900460ff16158080156119c857505f54600160ff909116105b806119e15750303b1580156119e157505f5460ff166001145b611a445760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161074d565b5f805460ff191660011790558015611a65575f805461ff0019166101001790555b611a6d612868565b611a75612868565b611a7d612868565b611a8561288e565b611a8f5f336128bc565b611a98846127c6565b611aa183612342565b611aaa826124b3565b8015611aef575f805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b60c9545f9061063f90602260406123ba565b5f80611b1161252b565b60c954600190811c1615611b3857604051637e7f033f60e11b815260040160405180910390fd5b5f198503611bd9576001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166370a08231336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015611bb2573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611bd6919061300b565b94505b845f03611bf957604051634379594d60e11b815260040160405180910390fd5b5f611c02611af5565b90505f807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166301c5a46c846040518263ffffffff1660e01b8152600401611c5491815260200190565b6040805180830381865afa158015611c6e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c929190613022565b915091505f611ca189836128c6565b90506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663049104e58a5f336040516001600160e01b031960e086901b168152600481019390935260248301919091526001600160a01b031660448201526064016020604051808303815f875af1158015611d26573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611d4a919061300b565b955082861015611d5c57859450611d60565b8294505b5f85118015611de0575060ce5f9054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611dba573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611dde919061300b565b155b15611f5e575f80611def61145a565b9092509050670de0b6b3a7640000611e0782846130a1565b611e11908961306b565b611e1b9190613082565b611e259088613058565b60cd5460405163059394af60e11b8152600481018390529198506001600160a01b039081169163565659ea917f0000000000000000000000000000000000000000000000000000000000000000918e917f00000000000000000000000000000000000000000000000000000000000000001690630b27295e90602401602060405180830381865afa158015611ebc573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611ee0919061300b565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303815f875af1158015611f31573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611f55919061300b565b96505050611f62565b5f94505b60405163059394af60e11b8152600481018790527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690630b27295e90602401602060405180830381865afa158015611fc5573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611fe9919061300b565b6040516370a0823160e01b81523060048201529096505f906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015612050573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612074919061300b565b905086811015612082578096505b5f670de0b6b3a7640000612096848a61306b565b6120a09190613082565b905080156120ef5760cc546120e2906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116911683612657565b6120ec8189613058565b97505b8888101561211057604051631d0d055760e11b815260040160405180910390fd5b6121446001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168b8a612657565b604080518c8152602081018a90528082018990526060810183905290516001600160a01b038c169133917f8f5033fe33b538c2ea1f8b384e8ed3f01ee53152013f9d6193ec03c3856e691d9181900360800190a35050505050506119a26001609755565b5f828152606560205260409020600101546121c281612335565b6106dc838361244d565b5f6121d681612335565b6121e08484612687565b60cb548215612246576121f681865f6040612713565b90506122058185604080612727565b60408051878152602081018790529192507f1ec1b6512cef010f57f2806f29d57940c879821f180a23b1d0ea11c269434443910160405180910390a16122a1565b612254818660806040612713565b9050612264818560c06040612727565b60408051878152602081018790529192507fb3d49e95905d108ea668ffe62a85ee16bdc4ff9f122a7137964327ea8e0585ff910160405180910390a15b60cb5550505050565b60ca545f90819061060681608060406123ba565b60cb545f90819061146d818360406123ba565b5f8051602061327c8339815191526122e881612335565b60c980546001198116841790915560408051600190921680151583528415156020840152917f05095a4b0d0cb4a358559380eebe35777692f901515ac5278f332edaa16fd33591016106ab565b61233f81336128f0565b50565b6001600160a01b0381166123695760405163a7f9319d60e01b815260040160405180910390fd5b60cd80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f3ed91ef70e6e7c6a805523d1a95ddc27851b8f620524b5def16053d07bc33c32905f90a35050565b6001901b5f190191901c1690565b6123d282826112ee565b6105ee575f8281526065602090815260408083206001600160a01b03851684529091529020805460ff191660011790556124093390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61245782826112ee565b156105ee575f8281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001600160a01b0381166124da5760405163a7f9319d60e01b815260040160405180910390fd5b60ce80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f5f2a649788894faaa5a908b84297dbf1046c11a9b141a2b43aa0ce110f20dc98905f90a35050565b60026097540361257d5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161074d565b6002609755565b565b5f805f61259161145a565b9092509050815f6125a283836130a1565b90506125b087838389612949565b979650505050505050565b6040516001600160a01b0380851660248301528316604482015260648101829052611aef9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612a52565b6001609755565b5f805f6126386105f2565b9092509050815f61264983836130a1565b90506125b087838389612b25565b6040516001600160a01b0383166024820152604481018290526106dc90849063a9059cbb60e01b906064016125ef565b670de0b6b3a76400008211156126b0576040516377637bf960e01b815260040160405180910390fd5b5f8112156126e157816126c2826130c8565b11156105ee5760405163efb17f0560e01b815260040160405180910390fd5b6126f382670de0b6b3a7640000613058565b8111156105ee5760405163ec4bc98360e01b815260040160405180910390fd5b6001901b5f1901811b1992909216911b1790565b5f196001821b01838116831b90831b198516175b949350505050565b67ffffffffffffffff81111561276c57604051633ee7e47d60e21b815260040160405180910390fd5b60c9545f61277d82602260406123ba565b905061278d828460226040612713565b60c95560408051828152602081018590527f843a697469013557fdd29318d1292ede372c6154a1c0d300b4fcaf4c1a98366091016106ab565b6001600160a01b0381166127ed5760405163a7f9319d60e01b815260040160405180910390fd5b60cc80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f6c2db31e86a0021e31afb30fde602864ef1c7f25230ceefd3a8bee7ee945324a905f90a35050565b5f805f6128496122aa565b90925090505f61285982846130a1565b9050826125b087838389612949565b5f54610100900460ff166125845760405162461bcd60e51b815260040161074d906130e2565b5f54610100900460ff166128b45760405162461bcd60e51b815260040161074d906130e2565b612584612b76565b6105ee82826123c8565b5f805f6128d16122be565b90925090505f6128e182846130a1565b9050826125b087838389612b25565b6128fa82826112ee565b6105ee5761290781612b9c565b612912836020612bae565b60405160200161292392919061314f565b60408051601f198184030181529082905262461bcd60e51b825261074d916004016131c3565b5f8061295d85670de0b6b3a7640000613058565b61296f670de0b6b3a76400008561306b565b6129799190613082565b90505f8187116129a757670de0b6b3a7640000612996878961306b565b6129a09190613082565b90506129fb565b670de0b6b3a76400006129ba878461306b565b6129c49190613082565b9050670de0b6b3a7640000856129da848a613058565b6129e4919061306b565b6129ee9190613082565b6129f890826131f5565b90505b612a058188613058565b92508015612a4857612a483360cc546001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116929116846125bb565b5050949350505050565b5f612aa6826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612d449092919063ffffffff16565b905080515f1480612ac6575080806020019051810190612ac69190613208565b6106dc5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161074d565b5f818511612b3457508261273b565b5f612b3f858461306b565b905083612b4c8488613058565b612b56919061306b565b612b6090826131f5565b9050612b6c8682613082565b9695505050505050565b5f54610100900460ff166126265760405162461bcd60e51b815260040161074d906130e2565b60606105d56001600160a01b03831660145b60605f612bbc83600261306b565b612bc79060026131f5565b67ffffffffffffffff811115612bdf57612bdf613223565b6040519080825280601f01601f191660200182016040528015612c09576020820181803683370190505b509050600360fc1b815f81518110612c2357612c23613237565b60200101906001600160f81b03191690815f1a905350600f60fb1b81600181518110612c5157612c51613237565b60200101906001600160f81b03191690815f1a9053505f612c7384600261306b565b612c7e9060016131f5565b90505b6001811115612cf5576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612cb257612cb2613237565b1a60f81b828281518110612cc857612cc8613237565b60200101906001600160f81b03191690815f1a90535060049490941c93612cee8161324b565b9050612c81565b508315610c705760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161074d565b606061273b84845f85855f80866001600160a01b03168587604051612d699190613260565b5f6040518083038185875af1925050503d805f8114612da3576040519150601f19603f3d011682016040523d82523d5f602084013e612da8565b606091505b50915091506125b08783838760608315612e225782515f03612e1b576001600160a01b0385163b612e1b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161074d565b508161273b565b61273b8383815115612e375781518083602001fd5b8060405162461bcd60e51b815260040161074d91906131c3565b5f60208284031215612e61575f80fd5b81356001600160e01b031981168114610c70575f80fd5b80356001600160a01b0381168114612e8e575f80fd5b919050565b5f60208284031215612ea3575f80fd5b610c7082612e78565b5f60208284031215612ebc575f80fd5b5035919050565b801515811461233f575f80fd5b5f60208284031215612ee0575f80fd5b8135610c7081612ec3565b5f8060408385031215612efc575f80fd5b82359150612f0c60208401612e78565b90509250929050565b5f805f60608486031215612f27575f80fd5b83359250612f3760208501612e78565b9150604084013590509250925092565b5f805f60608486031215612f59575f80fd5b83356001600160801b0381168114612f6f575f80fd5b92506020840135600f81900b8114612f85575f80fd5b91506040840135612f9581612ec3565b809150509250925092565b5f805f60608486031215612fb2575f80fd5b612fbb84612e78565b9250612fc960208501612e78565b9150612fd760408501612e78565b90509250925092565b5f805f60608486031215612ff2575f80fd5b83359250602084013591506040840135612f9581612ec3565b5f6020828403121561301b575f80fd5b5051919050565b5f8060408385031215613033575f80fd5b505080516020909101519092909150565b634e487b7160e01b5f52601160045260245ffd5b818103818111156105d5576105d5613044565b80820281158282048414176105d5576105d5613044565b5f8261309c57634e487b7160e01b5f52601260045260245ffd5b500490565b8082018281125f8312801582168215821617156130c0576130c0613044565b505092915050565b5f600160ff1b82016130dc576130dc613044565b505f0390565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b5f5b8381101561314757818101518382015260200161312f565b50505f910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081525f835161318681601785016020880161312d565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516131b781602884016020880161312d565b01602801949350505050565b602081525f82518060208401526131e181604085016020870161312d565b601f01601f19169190910160400192915050565b808201808211156105d5576105d5613044565b5f60208284031215613218575f80fd5b8151610c7081612ec3565b634e487b7160e01b5f52604160045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b5f8161325957613259613044565b505f190190565b5f825161327181846020870161312d565b919091019291505056fe30d43bb366ef85d2e9345bef3138e4a552faefea6255fa2db4667fdcf34d69a5a2646970667358221220f7c9f56f3a6bb714c33d13acec1194a390bccdc6662ec50b1c272b7bd5c45a1764736f6c63430008140033000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd2 | 608060405234801561000f575f80fd5b506004361061024a575f3560e01c80638373c53b11610140578063b235d468116100bf578063d0ce98fa11610084578063d0ce98fa14610549578063d547741f1461055c578063e3d65a6f1461056f578063edd6fcd214610582578063f478f35d1461058a578063f76a582514610592575f80fd5b8063b235d468146104e6578063b5567473146104f4578063c0c53b8b14610507578063c55dae631461051a578063cf0b5b3014610541575f80fd5b8063a217fddf11610105578063a217fddf14610495578063a293da0f1461049c578063a455f1ac146104af578063a8694e57146104b7578063ab7c425b146104de575f80fd5b80638373c53b1461043557806391d148541461044857806395a086d71461045b57806396e838391461046e578063a0b4f94a14610482575f80fd5b80634bde38c8116101cc57806372b790db1161019157806372b790db146103de578063742e6b3e146103f15780637b103999146104045780637cf98049146104175780637e4831d31461042a575f80fd5b80634bde38c81461036b578063534b23bb1461037e57806361d027b31461039157806364c9b4c3146103b85780636dbe4bb9146103cb575f80fd5b80631f73b2d3116102125780631f73b2d3146102fa578063248a9ca3146103025780632cdb9862146103325780632f2ff15d1461034557806336568abe14610358575f80fd5b806301ffc9a71461024e5780630266f04414610276578063088b699e146102a1578063153f7cd0146102c857806318ebbb82146102dd575b5f80fd5b61026161025c366004612e51565b6105a5565b60405190151581526020015b60405180910390f35b60cd54610289906001600160a01b031681565b6040516001600160a01b03909116815260200161026d565b6102897f000000000000000000000000b90d347e10a085b591955cbd0603ac7866fcadc881565b6102db6102d6366004612e93565b6105db565b005b6102e56105f2565b6040805192835260208301919091520161026d565b61026161062d565b610324610310366004612eac565b5f9081526065602052604090206001015490565b60405190815260200161026d565b6102db610340366004612ed0565b610644565b6102db610353366004612eeb565b6106b8565b6102db610366366004612eeb565b6106e1565b60cc54610289906001600160a01b031681565b6102db61038c366004612e93565b610760565b6102897f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd281565b6103246103c6366004612f15565b610773565b60cf54610289906001600160a01b031681565b6103246103ec366004612f15565b610c77565b6102db6103ff366004612e93565b6111b6565b60ce54610289906001600160a01b031681565b6102db610425366004612ed0565b611218565b60c954600116610261565b6102db610443366004612ed0565b611283565b610261610456366004612eeb565b6112ee565b6102db610469366004612f47565b611318565b6103245f8051602061327c83398151915281565b6102db610490366004612eac565b611434565b6103245f81565b6102db6104aa366004612e93565b611447565b6102e561145a565b6102897f0000000000000000000000009fcb2c47dab11e38fec4b8c886f63741bfed4c4181565b61026161149b565b60c954600190811c16610261565b6102e5610502366004612f15565b6114ad565b6102db610515366004612fa0565b6119aa565b6102897f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb77781565b610324611af5565b6102e5610557366004612f15565b611b07565b6102db61056a366004612eeb565b6121a8565b6102db61057d366004612fe0565b6121cc565b6102e56122aa565b6102e56122be565b6102db6105a0366004612ed0565b6122d1565b5f6001600160e01b03198216637965db0b60e01b14806105d557506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f6105e581612335565b6105ee82612342565b5050565b60cb545f90819061060681608060406123ba565b9250677fffffffffffffff60c082901c90811167ffffffffffffffff1902175b9150509091565b60c9545f9061063f9060031c60011690565b905090565b5f8051602061327c83398151915261065b81612335565b60c98054600384811b6008198316179092555f911c60011660408051821515815285151560208201529192507f1d3720296a9c03dedcca7947c2e2a866b93fd3d5d936ee525175c7500e10b88991015b60405180910390a1505050565b5f828152606560205260409020600101546106d281612335565b6106dc83836123c8565b505050565b6001600160a01b03811633146107565760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6105ee828261244d565b5f61076a81612335565b6105ee826124b3565b5f61077c61252b565b60c954600116156107a057604051638397554960e01b815260040160405180910390fd5b60cf546001600160a01b031680158015906107c457506001600160a01b0381163314155b156107e257604051635121c12760e01b815260040160405180910390fd5b505f198403610884576001600160a01b037f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb777166370a08231336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa15801561085d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610881919061300b565b93505b835f036108a457604051637161b5e160e01b815260040160405180910390fd5b5f6108ad611af5565b60405163066498a160e41b8152600481018290529091505f906001600160a01b037f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd216906366498a10906024016040805180830381865afa158015610914573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109389190613022565b50905080156109cb5760405163059394af60e11b8152600481018290527f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd26001600160a01b031690630b27295e90602401602060405180830381865afa1580156109a4573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109c8919061300b565b90505b6109d361149b565b15610a89575f7f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd26001600160a01b031663b4eae1cb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a35573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a59919061300b565b9050828111610a7b57604051630af33d4560e31b815260040160405180910390fd5b81871115610a87578196505b505b5f610a948783612586565b9050610aed335b6001600160a01b037f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb77716907f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd2846125bb565b60405163207f377360e11b8152600481018290527f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd26001600160a01b031690635fe208209082906340fe6ee690602401602060405180830381865afa158015610b58573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b7c919061300b565b6040516001600160e01b031960e084901b16815260048101919091526001600160a01b03891660248201526044016020604051808303815f875af1158015610bc6573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bea919061300b565b935084841015610c0d57604051633178177760e11b815260040160405180910390fd5b6001600160a01b038616337f35c491de72a5104fe4f7b7e908ad5ac54aadbedc624455aaf6415fcf9a85d0478987610c458683613058565b6040805193845260208401929092529082015260600160405180910390a3505050610c706001609755565b9392505050565b5f610c8061252b565b60c954600190811c1615610ca757604051637e7f033f60e11b815260040160405180910390fd5b5f198403610d48576001600160a01b037f000000000000000000000000b90d347e10a085b591955cbd0603ac7866fcadc8166370a08231336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015610d21573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d45919061300b565b93505b835f03610d6857604051634379594d60e11b815260040160405180910390fd5b5f610d71611af5565b90505f807f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd26001600160a01b031663d2056f3e846040518263ffffffff1660e01b8152600401610dc391815260200190565b6040805180830381865afa158015610ddd573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e019190613022565b915050610e0c61062d565b15610ec2575f7f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd26001600160a01b031663b4eae1cb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e6e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e92919061300b565b9050838111610eb457604051639692570b60e01b815260040160405180910390fd5b81881115610ec0578197505b505b610ecc878261262d565b91506001600160a01b037f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd21663049104e55f89336040516001600160e01b031960e086901b168152600481019390935260248301919091526001600160a01b031660448201526064016020604051808303815f875af1158015610f51573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f75919061300b565b60405163059394af60e11b8152600481018290529094507f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd26001600160a01b031690630b27295e90602401602060405180830381865afa158015610fdb573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fff919061300b565b6040516370a0823160e01b81523060048201529094505f906001600160a01b037f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb77716906370a0823190602401602060405180830381865afa158015611066573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061108a919061300b565b905084811015611098578094505b5f670de0b6b3a76400006110ac858861306b565b6110b69190613082565b905080156111055760cc546110f8906001600160a01b037f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb7778116911683612657565b6111028187613058565b95505b8686101561112657604051631d0d055760e11b815260040160405180910390fd5b61115a6001600160a01b037f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb777168988612657565b604080518a81526020810188905280820183905290516001600160a01b038a169133917f514b5806ac61806bec81468a48c859aa0393139dcdf0e36b8e5933d1d5f37aa79181900360600190a35050505050610c706001609755565b5f6111c081612335565b6001600160a01b0382166111e75760405163a7f9319d60e01b815260040160405180910390fd5b60cf546001600160a01b03166105ee5760cf80546001600160a01b0384166001600160a01b03199091161790555050565b5f8051602061327c83398151915261122f81612335565b60c98054600284811b6004198316179092555f911c60011660408051821515815285151560208201529192507fd1c4dccc0d477de173d9ff9d15c46099e72a60465ae205e1e312fbac46f194b291016106ab565b5f8051602061327c83398151915261129a81612335565b60c98054600184811b6002198316179092555f9190811c1660408051821515815285151560208201529192507f74b35077012c8e49409b89157958f89c81139301b437a3b30bad78b75e531ac691016106ab565b5f9182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b5f61132281612335565b611338846001600160801b031684600f0b612687565b60ca5482156113b757611357816001600160801b0387165f6040612713565b905061136a81600f86900b604080612727565b604080516001600160801b0388168152600f87900b60208201529192507f71a7b2c63c80f57231f61b616df32af0aca06fa38eddb55286818753a091d302910160405180910390a161142b565b6113ce816001600160801b03871660806040612713565b90506113e281600f86900b60c06040612727565b604080516001600160801b0388168152600f87900b60208201529192507f59b9b7a829db9b6a52f2071b54c024d0e9b3d6e61d70a1e59bc7b01c046582d1910160405180910390a15b60ca5550505050565b5f61143e81612335565b6105ee82612743565b5f61145181612335565b6105ee826127c6565b60ca545f90819061146d818360406123ba565b9250677fffffffffffffff604082901c67ffffffffffffffff1690811167ffffffffffffffff190217610626565b60c9545f9061063f9060021c60011690565b5f806114b761252b565b60c954600116156114db57604051638397554960e01b815260040160405180910390fd5b5f19850361157c576001600160a01b037f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb777166370a08231336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015611555573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611579919061300b565b94505b845f0361159c57604051637161b5e160e01b815260040160405180910390fd5b5f6115a5611af5565b60405163e9ea2b2560e01b8152600481018290529091505f906001600160a01b037f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd2169063e9ea2b25906024016040805180830381865afa15801561160c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906116309190613022565b50905080156116c35760405163059394af60e11b8152600481018290527f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd26001600160a01b031690630b27295e90602401602060405180830381865afa15801561169c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906116c0919061300b565b90505b5f6116ce888361283e565b90506116d933610a9b565b60405163207f377360e11b8152600481018290527f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd26001600160a01b03169063cd8bf8749082906340fe6ee690602401602060405180830381865afa158015611744573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611768919061300b565b6040516001600160e01b031960e084901b16815260048101919091526001600160a01b038a1660248201526044016020604051808303815f875af11580156117b2573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906117d6919061300b565b9450858510156117f9576040516303a7a15b60e21b815260040160405180910390fd5b818110156118095780935061180d565b8193505b5f8411801561188d575060ce5f9054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611867573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061188b919061300b565b155b156119355760cd54604051632b2b2cf560e11b81526001600160a01b037f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb777811660048301528981166024830152604482018790529091169063565659ea906064016020604051808303815f875af115801561190a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061192e919061300b565b9350611939565b5f93505b6001600160a01b038716337f4e4164ca4717505705e4c67fdbb1a54891b87dab3c5635cd3a2d2b6351aa37e78a88886119728784613058565b60408051948552602085019390935291830152606082015260800160405180910390a35050506119a26001609755565b935093915050565b5f54610100900460ff16158080156119c857505f54600160ff909116105b806119e15750303b1580156119e157505f5460ff166001145b611a445760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161074d565b5f805460ff191660011790558015611a65575f805461ff0019166101001790555b611a6d612868565b611a75612868565b611a7d612868565b611a8561288e565b611a8f5f336128bc565b611a98846127c6565b611aa183612342565b611aaa826124b3565b8015611aef575f805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b60c9545f9061063f90602260406123ba565b5f80611b1161252b565b60c954600190811c1615611b3857604051637e7f033f60e11b815260040160405180910390fd5b5f198503611bd9576001600160a01b037f0000000000000000000000009fcb2c47dab11e38fec4b8c886f63741bfed4c41166370a08231336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015611bb2573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611bd6919061300b565b94505b845f03611bf957604051634379594d60e11b815260040160405180910390fd5b5f611c02611af5565b90505f807f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd26001600160a01b03166301c5a46c846040518263ffffffff1660e01b8152600401611c5491815260200190565b6040805180830381865afa158015611c6e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c929190613022565b915091505f611ca189836128c6565b90506001600160a01b037f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd21663049104e58a5f336040516001600160e01b031960e086901b168152600481019390935260248301919091526001600160a01b031660448201526064016020604051808303815f875af1158015611d26573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611d4a919061300b565b955082861015611d5c57859450611d60565b8294505b5f85118015611de0575060ce5f9054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611dba573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611dde919061300b565b155b15611f5e575f80611def61145a565b9092509050670de0b6b3a7640000611e0782846130a1565b611e11908961306b565b611e1b9190613082565b611e259088613058565b60cd5460405163059394af60e11b8152600481018390529198506001600160a01b039081169163565659ea917f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb777918e917f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd21690630b27295e90602401602060405180830381865afa158015611ebc573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611ee0919061300b565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303815f875af1158015611f31573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611f55919061300b565b96505050611f62565b5f94505b60405163059394af60e11b8152600481018790527f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd26001600160a01b031690630b27295e90602401602060405180830381865afa158015611fc5573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611fe9919061300b565b6040516370a0823160e01b81523060048201529096505f906001600160a01b037f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb77716906370a0823190602401602060405180830381865afa158015612050573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612074919061300b565b905086811015612082578096505b5f670de0b6b3a7640000612096848a61306b565b6120a09190613082565b905080156120ef5760cc546120e2906001600160a01b037f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb7778116911683612657565b6120ec8189613058565b97505b8888101561211057604051631d0d055760e11b815260040160405180910390fd5b6121446001600160a01b037f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb777168b8a612657565b604080518c8152602081018a90528082018990526060810183905290516001600160a01b038c169133917f8f5033fe33b538c2ea1f8b384e8ed3f01ee53152013f9d6193ec03c3856e691d9181900360800190a35050505050506119a26001609755565b5f828152606560205260409020600101546121c281612335565b6106dc838361244d565b5f6121d681612335565b6121e08484612687565b60cb548215612246576121f681865f6040612713565b90506122058185604080612727565b60408051878152602081018790529192507f1ec1b6512cef010f57f2806f29d57940c879821f180a23b1d0ea11c269434443910160405180910390a16122a1565b612254818660806040612713565b9050612264818560c06040612727565b60408051878152602081018790529192507fb3d49e95905d108ea668ffe62a85ee16bdc4ff9f122a7137964327ea8e0585ff910160405180910390a15b60cb5550505050565b60ca545f90819061060681608060406123ba565b60cb545f90819061146d818360406123ba565b5f8051602061327c8339815191526122e881612335565b60c980546001198116841790915560408051600190921680151583528415156020840152917f05095a4b0d0cb4a358559380eebe35777692f901515ac5278f332edaa16fd33591016106ab565b61233f81336128f0565b50565b6001600160a01b0381166123695760405163a7f9319d60e01b815260040160405180910390fd5b60cd80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f3ed91ef70e6e7c6a805523d1a95ddc27851b8f620524b5def16053d07bc33c32905f90a35050565b6001901b5f190191901c1690565b6123d282826112ee565b6105ee575f8281526065602090815260408083206001600160a01b03851684529091529020805460ff191660011790556124093390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61245782826112ee565b156105ee575f8281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001600160a01b0381166124da5760405163a7f9319d60e01b815260040160405180910390fd5b60ce80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f5f2a649788894faaa5a908b84297dbf1046c11a9b141a2b43aa0ce110f20dc98905f90a35050565b60026097540361257d5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161074d565b6002609755565b565b5f805f61259161145a565b9092509050815f6125a283836130a1565b90506125b087838389612949565b979650505050505050565b6040516001600160a01b0380851660248301528316604482015260648101829052611aef9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612a52565b6001609755565b5f805f6126386105f2565b9092509050815f61264983836130a1565b90506125b087838389612b25565b6040516001600160a01b0383166024820152604481018290526106dc90849063a9059cbb60e01b906064016125ef565b670de0b6b3a76400008211156126b0576040516377637bf960e01b815260040160405180910390fd5b5f8112156126e157816126c2826130c8565b11156105ee5760405163efb17f0560e01b815260040160405180910390fd5b6126f382670de0b6b3a7640000613058565b8111156105ee5760405163ec4bc98360e01b815260040160405180910390fd5b6001901b5f1901811b1992909216911b1790565b5f196001821b01838116831b90831b198516175b949350505050565b67ffffffffffffffff81111561276c57604051633ee7e47d60e21b815260040160405180910390fd5b60c9545f61277d82602260406123ba565b905061278d828460226040612713565b60c95560408051828152602081018590527f843a697469013557fdd29318d1292ede372c6154a1c0d300b4fcaf4c1a98366091016106ab565b6001600160a01b0381166127ed5760405163a7f9319d60e01b815260040160405180910390fd5b60cc80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f6c2db31e86a0021e31afb30fde602864ef1c7f25230ceefd3a8bee7ee945324a905f90a35050565b5f805f6128496122aa565b90925090505f61285982846130a1565b9050826125b087838389612949565b5f54610100900460ff166125845760405162461bcd60e51b815260040161074d906130e2565b5f54610100900460ff166128b45760405162461bcd60e51b815260040161074d906130e2565b612584612b76565b6105ee82826123c8565b5f805f6128d16122be565b90925090505f6128e182846130a1565b9050826125b087838389612b25565b6128fa82826112ee565b6105ee5761290781612b9c565b612912836020612bae565b60405160200161292392919061314f565b60408051601f198184030181529082905262461bcd60e51b825261074d916004016131c3565b5f8061295d85670de0b6b3a7640000613058565b61296f670de0b6b3a76400008561306b565b6129799190613082565b90505f8187116129a757670de0b6b3a7640000612996878961306b565b6129a09190613082565b90506129fb565b670de0b6b3a76400006129ba878461306b565b6129c49190613082565b9050670de0b6b3a7640000856129da848a613058565b6129e4919061306b565b6129ee9190613082565b6129f890826131f5565b90505b612a058188613058565b92508015612a4857612a483360cc546001600160a01b037f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb7778116929116846125bb565b5050949350505050565b5f612aa6826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612d449092919063ffffffff16565b905080515f1480612ac6575080806020019051810190612ac69190613208565b6106dc5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161074d565b5f818511612b3457508261273b565b5f612b3f858461306b565b905083612b4c8488613058565b612b56919061306b565b612b6090826131f5565b9050612b6c8682613082565b9695505050505050565b5f54610100900460ff166126265760405162461bcd60e51b815260040161074d906130e2565b60606105d56001600160a01b03831660145b60605f612bbc83600261306b565b612bc79060026131f5565b67ffffffffffffffff811115612bdf57612bdf613223565b6040519080825280601f01601f191660200182016040528015612c09576020820181803683370190505b509050600360fc1b815f81518110612c2357612c23613237565b60200101906001600160f81b03191690815f1a905350600f60fb1b81600181518110612c5157612c51613237565b60200101906001600160f81b03191690815f1a9053505f612c7384600261306b565b612c7e9060016131f5565b90505b6001811115612cf5576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612cb257612cb2613237565b1a60f81b828281518110612cc857612cc8613237565b60200101906001600160f81b03191690815f1a90535060049490941c93612cee8161324b565b9050612c81565b508315610c705760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161074d565b606061273b84845f85855f80866001600160a01b03168587604051612d699190613260565b5f6040518083038185875af1925050503d805f8114612da3576040519150601f19603f3d011682016040523d82523d5f602084013e612da8565b606091505b50915091506125b08783838760608315612e225782515f03612e1b576001600160a01b0385163b612e1b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161074d565b508161273b565b61273b8383815115612e375781518083602001fd5b8060405162461bcd60e51b815260040161074d91906131c3565b5f60208284031215612e61575f80fd5b81356001600160e01b031981168114610c70575f80fd5b80356001600160a01b0381168114612e8e575f80fd5b919050565b5f60208284031215612ea3575f80fd5b610c7082612e78565b5f60208284031215612ebc575f80fd5b5035919050565b801515811461233f575f80fd5b5f60208284031215612ee0575f80fd5b8135610c7081612ec3565b5f8060408385031215612efc575f80fd5b82359150612f0c60208401612e78565b90509250929050565b5f805f60608486031215612f27575f80fd5b83359250612f3760208501612e78565b9150604084013590509250925092565b5f805f60608486031215612f59575f80fd5b83356001600160801b0381168114612f6f575f80fd5b92506020840135600f81900b8114612f85575f80fd5b91506040840135612f9581612ec3565b809150509250925092565b5f805f60608486031215612fb2575f80fd5b612fbb84612e78565b9250612fc960208501612e78565b9150612fd760408501612e78565b90509250925092565b5f805f60608486031215612ff2575f80fd5b83359250602084013591506040840135612f9581612ec3565b5f6020828403121561301b575f80fd5b5051919050565b5f8060408385031215613033575f80fd5b505080516020909101519092909150565b634e487b7160e01b5f52601160045260245ffd5b818103818111156105d5576105d5613044565b80820281158282048414176105d5576105d5613044565b5f8261309c57634e487b7160e01b5f52601260045260245ffd5b500490565b8082018281125f8312801582168215821617156130c0576130c0613044565b505092915050565b5f600160ff1b82016130dc576130dc613044565b505f0390565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b5f5b8381101561314757818101518382015260200161312f565b50505f910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081525f835161318681601785016020880161312d565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516131b781602884016020880161312d565b01602801949350505050565b602081525f82518060208401526131e181604085016020870161312d565b601f01601f19169190910160400192915050565b808201808211156105d5576105d5613044565b5f60208284031215613218575f80fd5b8151610c7081612ec3565b634e487b7160e01b5f52604160045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b5f8161325957613259613044565b505f190190565b5f825161327181846020870161312d565b919091019291505056fe30d43bb366ef85d2e9345bef3138e4a552faefea6255fa2db4667fdcf34d69a5a2646970667358221220f7c9f56f3a6bb714c33d13acec1194a390bccdc6662ec50b1c272b7bd5c45a1764736f6c63430008140033 | {{
"language": "Solidity",
"sources": {
"@openzeppelin/contracts-upgradeable-v4/access/AccessControlUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlUpgradeable.sol\";\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../utils/StringsUpgradeable.sol\";\nimport \"../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\n function __AccessControl_init() internal onlyInitializing {\n }\n\n function __AccessControl_init_unchained() internal onlyInitializing {\n }\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n StringsUpgradeable.toHexString(account),\n \" is missing role \",\n StringsUpgradeable.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * May emit a {RoleGranted} event.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/access/IAccessControlUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControlUpgradeable {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/proxy/utils/Initializable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/security/ReentrancyGuardUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n function __ReentrancyGuard_init() internal onlyInitializing {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n * `nonReentrant` function in the call stack.\n */\n function _reentrancyGuardEntered() internal view returns (bool) {\n return _status == _ENTERED;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/token/ERC20/extensions/IERC20PermitUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/token/ERC20/IERC20Upgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/token/ERC20/utils/SafeERC20Upgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));\n }\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/AddressUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/ContextUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/introspection/ERC165Upgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/introspection/IERC165Upgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/math/MathUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/math/SignedMathUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMathUpgradeable {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/StringsUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SignedMathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMathUpgradeable.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n"
},
"contracts/common/codec/WordCodec.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n// solhint-disable no-inline-assembly\n\n/// @dev A subset copied from the following contracts:\n///\n/// + `balancer-labs/v2-solidity-utils/contracts/helpers/WordCodec.sol`\n/// + `balancer-labs/v2-solidity-utils/contracts/helpers/WordCodecHelpers.sol`\nlibrary WordCodec {\n /// @dev Inserts an unsigned integer of bitLength, shifted by an offset, into a 256 bit word,\n /// replacing the old value. Returns the new word.\n function insertUint(\n bytes32 word,\n uint256 value,\n uint256 offset,\n uint256 bitLength\n ) internal pure returns (bytes32 result) {\n // Equivalent to:\n // uint256 mask = (1 << bitLength) - 1;\n // bytes32 clearedWord = bytes32(uint256(word) & ~(mask << offset));\n // result = clearedWord | bytes32(value << offset);\n assembly {\n let mask := sub(shl(bitLength, 1), 1)\n let clearedWord := and(word, not(shl(offset, mask)))\n result := or(clearedWord, shl(offset, value))\n }\n }\n\n /// @dev Decodes and returns an unsigned integer with `bitLength` bits, shifted by an offset, from a 256 bit word.\n function decodeUint(\n bytes32 word,\n uint256 offset,\n uint256 bitLength\n ) internal pure returns (uint256 result) {\n // Equivalent to:\n // result = uint256(word >> offset) & ((1 << bitLength) - 1);\n assembly {\n result := and(shr(offset, word), sub(shl(bitLength, 1), 1))\n }\n }\n\n /// @dev Inserts a signed integer shifted by an offset into a 256 bit word, replacing the old value. Returns\n /// the new word.\n ///\n /// Assumes `value` can be represented using `bitLength` bits.\n function insertInt(\n bytes32 word,\n int256 value,\n uint256 offset,\n uint256 bitLength\n ) internal pure returns (bytes32) {\n unchecked {\n uint256 mask = (1 << bitLength) - 1;\n bytes32 clearedWord = bytes32(uint256(word) & ~(mask << offset));\n // Integer values need masking to remove the upper bits of negative values.\n return clearedWord | bytes32((uint256(value) & mask) << offset);\n }\n }\n\n /// @dev Decodes and returns a signed integer with `bitLength` bits, shifted by an offset, from a 256 bit word.\n function decodeInt(\n bytes32 word,\n uint256 offset,\n uint256 bitLength\n ) internal pure returns (int256 result) {\n unchecked {\n int256 maxInt = int256((1 << (bitLength - 1)) - 1);\n uint256 mask = (1 << bitLength) - 1;\n\n int256 value = int256(uint256(word >> offset) & mask);\n // In case the decoded value is greater than the max positive integer that can be represented with bitLength\n // bits, we know it was originally a negative integer. Therefore, we mask it to restore the sign in the 256 bit\n // representation.\n //\n // Equivalent to:\n // result = value > maxInt ? (value | int256(~mask)) : value;\n assembly {\n result := or(mul(gt(value, maxInt), not(mask)), value)\n }\n }\n }\n\n /// @dev Decodes and returns a boolean shifted by an offset from a 256 bit word.\n function decodeBool(bytes32 word, uint256 offset) internal pure returns (bool result) {\n // Equivalent to:\n // result = (uint256(word >> offset) & 1) == 1;\n assembly {\n result := and(shr(offset, word), 1)\n }\n }\n\n /// @dev Inserts a boolean value shifted by an offset into a 256 bit word, replacing the old value. Returns the new\n /// word.\n function insertBool(\n bytes32 word,\n bool value,\n uint256 offset\n ) internal pure returns (bytes32 result) {\n // Equivalent to:\n // bytes32 clearedWord = bytes32(uint256(word) & ~(1 << offset));\n // bytes32 referenceInsertBool = clearedWord | bytes32(uint256(value ? 1 : 0) << offset);\n assembly {\n let clearedWord := and(word, not(shl(offset, 1)))\n result := or(clearedWord, shl(offset, value))\n }\n }\n\n function clearWordAtPosition(\n bytes32 word,\n uint256 offset,\n uint256 bitLength\n ) internal pure returns (bytes32 clearedWord) {\n unchecked {\n uint256 mask = (1 << bitLength) - 1;\n clearedWord = bytes32(uint256(word) & ~(mask << offset));\n }\n }\n}\n"
},
"contracts/f(x)/v2/MarketV2.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity =0.8.20;\n\nimport { AccessControlUpgradeable } from \"@openzeppelin/contracts-upgradeable-v4/access/AccessControlUpgradeable.sol\";\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin/contracts-upgradeable-v4/security/ReentrancyGuardUpgradeable.sol\";\nimport { IERC20Upgradeable } from \"@openzeppelin/contracts-upgradeable-v4/token/ERC20/IERC20Upgradeable.sol\";\nimport { SafeERC20Upgradeable } from \"@openzeppelin/contracts-upgradeable-v4/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\nimport { WordCodec } from \"../../common/codec/WordCodec.sol\";\n\nimport { IFxMarketV2 } from \"../../interfaces/f(x)/IFxMarketV2.sol\";\nimport { IFxRebalancePoolRegistry } from \"../../interfaces/f(x)/IFxRebalancePoolRegistry.sol\";\nimport { IFxReservePool } from \"../../interfaces/f(x)/IFxReservePool.sol\";\nimport { IFxTreasuryV2 } from \"../../interfaces/f(x)/IFxTreasuryV2.sol\";\n\n// solhint-disable max-states-count\n\ncontract MarketV2 is AccessControlUpgradeable, ReentrancyGuardUpgradeable, IFxMarketV2 {\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n using WordCodec for bytes32;\n\n /*************\n * Constants *\n *************/\n\n /// @notice The role for emergency dao.\n bytes32 public constant EMERGENCY_DAO_ROLE = keccak256(\"EMERGENCY_DAO_ROLE\");\n\n /// @dev The precision used to compute nav.\n uint256 private constant FEE_PRECISION = 1e18;\n\n /// @dev The offset of mint flag in `marketConfigData`.\n uint256 private constant MINT_FLAG_OFFSET = 0;\n\n /// @dev The offset of redeem flag in `marketConfigData`.\n uint256 private constant REDEEM_FLAG_OFFSET = 1;\n\n /// @dev The offset of stability mode mint flag in `marketConfigData`.\n uint256 private constant MINT_FLAG_STABILITY_OFFSET = 2;\n\n /// @dev The offset of stability mode redeem flag in `marketConfigData`.\n uint256 private constant REDEEM_FLAG_STABILITY_OFFSET = 3;\n\n /// @dev The offset of stability ratio in `marketConfigData`.\n uint256 private constant STABILITY_RATIO_OFFSET = 34;\n\n /// @dev The offset of default fToken fee ratio in `mintFeeData` and `redeemFeeData`.\n uint256 private constant FTOKEN_DEFAULT_FEE_OFFSET = 0;\n\n /// @dev The offset of delta fToken fee ratio in `mintFeeData` and `redeemFeeData`.\n uint256 private constant FTOKEN_DELTA_FEE_OFFSET = 64;\n\n /// @dev The offset of default xToken fee ratio in `mintFeeData` and `redeemFeeData`.\n uint256 private constant XTOKEN_DEFAULT_FEE_OFFSET = 128;\n\n /// @dev The offset of delta xToken fee ratio in `mintFeeData` and `redeemFeeData`.\n uint256 private constant XTOKEN_DELTA_FEE_OFFSET = 192;\n\n /// @inheritdoc IFxMarketV2\n address public immutable override treasury;\n\n /// @inheritdoc IFxMarketV2\n address public immutable override baseToken;\n\n /// @inheritdoc IFxMarketV2\n address public immutable override fToken;\n\n /// @inheritdoc IFxMarketV2\n address public immutable override xToken;\n\n /*************\n * Variables *\n *************/\n\n /// @dev `marketConfigData` is a storage slot that can be used to store market configuration.\n ///\n /// - The *mint flag* indicate whether the token mint is paused (both fToken and xToken).\n /// - The *redeem flag* indicate whether the token redeem is paused (both fToken and xToken).\n /// - The *mint flag stability* indicate whether the fToken mint is paused in stability mode.\n /// - The *redeem flag stability* indicate whether the xToken redeem is paused in stability mode.\n /// - The *stability ratio* is the collateral ratio to enter stability mode, multiplied by 1e18.\n ///\n /// [ mint flag | redeem flag | mint flag stability | redeem flag stability | stability ratio | available ]\n /// [ 1 bit | 1 bit | 1 bit | 1 bit | 64 bits | 188 bits ]\n /// [ MSB LSB ]\n bytes32 private marketConfigData;\n\n /// @dev `mintFeeData` is a storage slot that can be used to store mint fee ratio.\n ///\n /// [ default fToken | delta fToken | default xToken | delta xToken |\n /// [ 64 bit | 64 bit | 64 bit | 64 bit ]\n /// [ MSB LSB ]\n bytes32 private mintFeeData;\n\n /// @dev `redeemFeeData` is a storage slot that can be used to store redeem fee ratio.\n ///\n /// [ default fToken | delta fToken | default xToken | delta xToken |\n /// [ 64 bit | 64 bit | 64 bit | 64 bit ]\n /// [ MSB LSB ]\n bytes32 private redeemFeeData;\n\n /// @notice The address of platform contract;\n address public platform;\n\n /// @notice The address of ReservePool contract.\n address public reservePool;\n\n /// @notice The address of RebalancePoolRegistry contract.\n address public registry;\n\n /// @inheritdoc IFxMarketV2\n address public fxUSD;\n\n /// @dev Slots for future use.\n uint256[43] private _gap;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(address _treasury) {\n treasury = _treasury;\n\n baseToken = IFxTreasuryV2(_treasury).baseToken();\n fToken = IFxTreasuryV2(_treasury).fToken();\n xToken = IFxTreasuryV2(_treasury).xToken();\n }\n\n function initialize(\n address _platform,\n address _reservePool,\n address _registry\n ) external initializer {\n __Context_init();\n __ERC165_init();\n __AccessControl_init();\n __ReentrancyGuard_init();\n\n _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n\n _updatePlatform(_platform);\n _updateReservePool(_reservePool);\n _updateRebalancePoolRegistry(_registry);\n }\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @notice Return whether token mint is paused.\n function mintPaused() public view returns (bool) {\n return marketConfigData.decodeBool(MINT_FLAG_OFFSET);\n }\n\n /// @notice Return whether token redeem is paused.\n function redeemPaused() public view returns (bool) {\n return marketConfigData.decodeBool(REDEEM_FLAG_OFFSET);\n }\n\n /// @notice Return whether fToken mint is paused in stability mode.\n function fTokenMintPausedInStabilityMode() public view returns (bool) {\n return marketConfigData.decodeBool(MINT_FLAG_STABILITY_OFFSET);\n }\n\n /// @notice Return whether xToken redeem is paused in stability mode.\n function xTokenRedeemPausedInStabilityMode() public view returns (bool) {\n return marketConfigData.decodeBool(REDEEM_FLAG_STABILITY_OFFSET);\n }\n\n /// @inheritdoc IFxMarketV2\n function stabilityRatio() public view returns (uint256) {\n return marketConfigData.decodeUint(STABILITY_RATIO_OFFSET, 64);\n }\n\n /// @notice The mint fee ratio for fToken.\n function fTokenMintFeeRatio() public view returns (uint256 defaultFee, int256 deltaFee) {\n bytes32 _mintFeeData = mintFeeData;\n defaultFee = _mintFeeData.decodeUint(FTOKEN_DEFAULT_FEE_OFFSET, 64);\n deltaFee = _mintFeeData.decodeInt(FTOKEN_DELTA_FEE_OFFSET, 64);\n }\n\n /// @notice The mint fee ratio for xToken.\n function xTokenMintFeeRatio() public view returns (uint256 defaultFee, int256 deltaFee) {\n bytes32 _mintFeeData = mintFeeData;\n defaultFee = _mintFeeData.decodeUint(XTOKEN_DEFAULT_FEE_OFFSET, 64);\n deltaFee = _mintFeeData.decodeInt(XTOKEN_DELTA_FEE_OFFSET, 64);\n }\n\n /// @notice The redeem fee ratio for fToken.\n function fTokenRedeemFeeRatio() public view returns (uint256 defaultFee, int256 deltaFee) {\n bytes32 _redeemFeeData = redeemFeeData;\n defaultFee = _redeemFeeData.decodeUint(FTOKEN_DEFAULT_FEE_OFFSET, 64);\n deltaFee = _redeemFeeData.decodeInt(FTOKEN_DELTA_FEE_OFFSET, 64);\n }\n\n /// @notice The redeem fee ratio for xToken.\n function xTokenRedeemFeeRatio() public view returns (uint256 defaultFee, int256 deltaFee) {\n bytes32 _redeemFeeData = redeemFeeData;\n defaultFee = _redeemFeeData.decodeUint(XTOKEN_DEFAULT_FEE_OFFSET, 64);\n deltaFee = _redeemFeeData.decodeInt(XTOKEN_DELTA_FEE_OFFSET, 64);\n }\n\n /****************************\n * Public Mutated Functions *\n ****************************/\n\n /// @inheritdoc IFxMarketV2\n function mintFToken(\n uint256 _baseIn,\n address _recipient,\n uint256 _minFTokenMinted\n ) external override nonReentrant returns (uint256 _fTokenMinted) {\n if (mintPaused()) revert ErrorMintPaused();\n\n // make sure caller is fxUSD, when fxUSD is enabled\n {\n address _fxUSD = fxUSD;\n if (_fxUSD != address(0) && _fxUSD != _msgSender()) revert ErrorCallerNotFUSD();\n }\n _beforeMintFToken();\n\n if (_baseIn == type(uint256).max) {\n _baseIn = IERC20Upgradeable(baseToken).balanceOf(_msgSender());\n }\n if (_baseIn == 0) revert ErrorMintZeroAmount();\n\n uint256 _stabilityRatio = stabilityRatio();\n (uint256 _maxBaseInBeforeSystemStabilityMode, ) = IFxTreasuryV2(treasury).maxMintableFToken(_stabilityRatio);\n if (_maxBaseInBeforeSystemStabilityMode > 0) {\n _maxBaseInBeforeSystemStabilityMode = IFxTreasuryV2(treasury).getWrapppedValue(\n _maxBaseInBeforeSystemStabilityMode\n );\n }\n\n if (fTokenMintPausedInStabilityMode()) {\n uint256 _collateralRatio = IFxTreasuryV2(treasury).collateralRatio();\n if (_collateralRatio <= _stabilityRatio) revert ErrorFTokenMintPausedInStabilityMode();\n\n // bound maximum amount of base token to mint fToken.\n if (_baseIn > _maxBaseInBeforeSystemStabilityMode) {\n _baseIn = _maxBaseInBeforeSystemStabilityMode;\n }\n }\n\n uint256 _amountWithoutFee = _deductFTokenMintFee(_baseIn, _maxBaseInBeforeSystemStabilityMode);\n IERC20Upgradeable(baseToken).safeTransferFrom(_msgSender(), treasury, _amountWithoutFee);\n\n _fTokenMinted = IFxTreasuryV2(treasury).mintFToken(\n IFxTreasuryV2(treasury).getUnderlyingValue(_amountWithoutFee),\n _recipient\n );\n if (_fTokenMinted < _minFTokenMinted) revert ErrorInsufficientFTokenOutput();\n\n emit MintFToken(_msgSender(), _recipient, _baseIn, _fTokenMinted, _baseIn - _amountWithoutFee);\n }\n\n /// @inheritdoc IFxMarketV2\n function mintXToken(\n uint256 _baseIn,\n address _recipient,\n uint256 _minXTokenMinted\n ) external override nonReentrant returns (uint256 _xTokenMinted, uint256 _bonus) {\n if (mintPaused()) revert ErrorMintPaused();\n _beforeMintXToken();\n\n if (_baseIn == type(uint256).max) {\n _baseIn = IERC20Upgradeable(baseToken).balanceOf(_msgSender());\n }\n if (_baseIn == 0) revert ErrorMintZeroAmount();\n\n uint256 _stabilityRatio = stabilityRatio();\n (uint256 _maxBaseInBeforeSystemStabilityMode, ) = IFxTreasuryV2(treasury).maxMintableXToken(_stabilityRatio);\n if (_maxBaseInBeforeSystemStabilityMode > 0) {\n _maxBaseInBeforeSystemStabilityMode = IFxTreasuryV2(treasury).getWrapppedValue(\n _maxBaseInBeforeSystemStabilityMode\n );\n }\n\n uint256 _amountWithoutFee = _deductXTokenMintFee(_baseIn, _maxBaseInBeforeSystemStabilityMode);\n IERC20Upgradeable(baseToken).safeTransferFrom(_msgSender(), treasury, _amountWithoutFee);\n\n _xTokenMinted = IFxTreasuryV2(treasury).mintXToken(\n IFxTreasuryV2(treasury).getUnderlyingValue(_amountWithoutFee),\n _recipient\n );\n if (_xTokenMinted < _minXTokenMinted) revert ErrorInsufficientXTokenOutput();\n\n // give bnous\n if (_amountWithoutFee < _maxBaseInBeforeSystemStabilityMode) {\n _bonus = _amountWithoutFee;\n } else {\n _bonus = _maxBaseInBeforeSystemStabilityMode;\n }\n if (_bonus > 0 && IFxRebalancePoolRegistry(registry).totalSupply() == 0) {\n _bonus = IFxReservePool(reservePool).requestBonus(baseToken, _recipient, _bonus);\n } else {\n _bonus = 0;\n }\n\n emit MintXToken(_msgSender(), _recipient, _baseIn, _xTokenMinted, _bonus, _baseIn - _amountWithoutFee);\n }\n\n /// @inheritdoc IFxMarketV2\n function redeemFToken(\n uint256 _fTokenIn,\n address _recipient,\n uint256 _minBaseOut\n ) external override nonReentrant returns (uint256 _baseOut, uint256 _bonus) {\n if (redeemPaused()) revert ErrorRedeemPaused();\n _beforeRedeemFToken();\n\n if (_fTokenIn == type(uint256).max) {\n _fTokenIn = IERC20Upgradeable(fToken).balanceOf(_msgSender());\n }\n if (_fTokenIn == 0) revert ErrorRedeemZeroAmount();\n\n uint256 _stabilityRatio = stabilityRatio();\n (uint256 _maxBaseOut, uint256 _maxFTokenInBeforeSystemStabilityMode) = IFxTreasuryV2(treasury).maxRedeemableFToken(\n _stabilityRatio\n );\n uint256 _feeRatio = _computeFTokenRedeemFeeRatio(_fTokenIn, _maxFTokenInBeforeSystemStabilityMode);\n\n _baseOut = IFxTreasuryV2(treasury).redeem(_fTokenIn, 0, _msgSender());\n // give bonus when redeem fToken\n if (_baseOut < _maxBaseOut) {\n _bonus = _baseOut;\n } else {\n _bonus = _maxBaseOut;\n }\n\n // request bonus\n if (_bonus > 0 && IFxRebalancePoolRegistry(registry).totalSupply() == 0) {\n (uint256 _defaultRatio, int256 _deltaRatio) = fTokenMintFeeRatio();\n _bonus -= (_bonus * uint256(int256(_defaultRatio) + _deltaRatio)) / FEE_PRECISION; // deduct fee\n _bonus = IFxReservePool(reservePool).requestBonus(\n baseToken,\n _recipient,\n IFxTreasuryV2(treasury).getWrapppedValue(_bonus)\n );\n } else {\n _bonus = 0;\n }\n\n _baseOut = IFxTreasuryV2(treasury).getWrapppedValue(_baseOut);\n uint256 _balance = IERC20Upgradeable(baseToken).balanceOf(address(this));\n // consider possible slippage\n if (_balance < _baseOut) {\n _baseOut = _balance;\n }\n\n uint256 _fee = (_baseOut * _feeRatio) / FEE_PRECISION;\n if (_fee > 0) {\n IERC20Upgradeable(baseToken).safeTransfer(platform, _fee);\n _baseOut = _baseOut - _fee;\n }\n if (_baseOut < _minBaseOut) revert ErrorInsufficientBaseOutput();\n\n IERC20Upgradeable(baseToken).safeTransfer(_recipient, _baseOut);\n\n emit RedeemFToken(_msgSender(), _recipient, _fTokenIn, _baseOut, _bonus, _fee);\n }\n\n /// @inheritdoc IFxMarketV2\n function redeemXToken(\n uint256 _xTokenIn,\n address _recipient,\n uint256 _minBaseOut\n ) external override nonReentrant returns (uint256 _baseOut) {\n if (redeemPaused()) revert ErrorRedeemPaused();\n _beforeRedeemXToken();\n\n if (_xTokenIn == type(uint256).max) {\n _xTokenIn = IERC20Upgradeable(xToken).balanceOf(_msgSender());\n }\n if (_xTokenIn == 0) revert ErrorRedeemZeroAmount();\n\n uint256 _stabilityRatio = stabilityRatio();\n uint256 _feeRatio;\n (, uint256 _maxXTokenInBeforeSystemStabilityMode) = IFxTreasuryV2(treasury).maxRedeemableXToken(_stabilityRatio);\n\n if (xTokenRedeemPausedInStabilityMode()) {\n uint256 _collateralRatio = IFxTreasuryV2(treasury).collateralRatio();\n if (_collateralRatio <= _stabilityRatio) revert ErrorXTokenRedeemPausedInStabilityMode();\n\n // bound maximum amount of xToken to redeem.\n if (_xTokenIn > _maxXTokenInBeforeSystemStabilityMode) {\n _xTokenIn = _maxXTokenInBeforeSystemStabilityMode;\n }\n }\n\n _feeRatio = _computeXTokenRedeemFeeRatio(_xTokenIn, _maxXTokenInBeforeSystemStabilityMode);\n\n _baseOut = IFxTreasuryV2(treasury).redeem(0, _xTokenIn, _msgSender());\n _baseOut = IFxTreasuryV2(treasury).getWrapppedValue(_baseOut);\n uint256 _balance = IERC20Upgradeable(baseToken).balanceOf(address(this));\n // consider possible slippage\n if (_balance < _baseOut) {\n _baseOut = _balance;\n }\n\n uint256 _fee = (_baseOut * _feeRatio) / FEE_PRECISION;\n if (_fee > 0) {\n IERC20Upgradeable(baseToken).safeTransfer(platform, _fee);\n _baseOut = _baseOut - _fee;\n }\n if (_baseOut < _minBaseOut) revert ErrorInsufficientBaseOutput();\n\n IERC20Upgradeable(baseToken).safeTransfer(_recipient, _baseOut);\n\n emit RedeemXToken(_msgSender(), _recipient, _xTokenIn, _baseOut, _fee);\n }\n\n /*******************************\n * Public Restricted Functions *\n *******************************/\n\n /// @notice Update the fee ratio for redeeming.\n /// @param _defaultFeeRatio The new default fee ratio, multipled by 1e18.\n /// @param _extraFeeRatio The new extra fee ratio, multipled by 1e18.\n /// @param _isFToken Whether we are updating for fToken.\n function updateRedeemFeeRatio(\n uint256 _defaultFeeRatio,\n int256 _extraFeeRatio,\n bool _isFToken\n ) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _validateFeeRatio(_defaultFeeRatio, _extraFeeRatio);\n\n bytes32 _redeemFeeData = redeemFeeData;\n if (_isFToken) {\n _redeemFeeData = _redeemFeeData.insertUint(_defaultFeeRatio, FTOKEN_DEFAULT_FEE_OFFSET, 64);\n _redeemFeeData = _redeemFeeData.insertInt(_extraFeeRatio, FTOKEN_DELTA_FEE_OFFSET, 64);\n emit UpdateRedeemFeeRatioFToken(_defaultFeeRatio, _extraFeeRatio);\n } else {\n _redeemFeeData = _redeemFeeData.insertUint(_defaultFeeRatio, XTOKEN_DEFAULT_FEE_OFFSET, 64);\n _redeemFeeData = _redeemFeeData.insertInt(_extraFeeRatio, XTOKEN_DELTA_FEE_OFFSET, 64);\n emit UpdateRedeemFeeRatioXToken(_defaultFeeRatio, _extraFeeRatio);\n }\n redeemFeeData = _redeemFeeData;\n }\n\n /// @notice Update the fee ratio for minting.\n /// @param _defaultFeeRatio The new default fee ratio, multipled by 1e18.\n /// @param _extraFeeRatio The new extra fee ratio, multipled by 1e18.\n /// @param _isFToken Whether we are updating for fToken.\n function updateMintFeeRatio(\n uint128 _defaultFeeRatio,\n int128 _extraFeeRatio,\n bool _isFToken\n ) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _validateFeeRatio(_defaultFeeRatio, _extraFeeRatio);\n\n bytes32 _mintFeeData = mintFeeData;\n if (_isFToken) {\n _mintFeeData = _mintFeeData.insertUint(_defaultFeeRatio, FTOKEN_DEFAULT_FEE_OFFSET, 64);\n _mintFeeData = _mintFeeData.insertInt(_extraFeeRatio, FTOKEN_DELTA_FEE_OFFSET, 64);\n emit UpdateMintFeeRatioFToken(_defaultFeeRatio, _extraFeeRatio);\n } else {\n _mintFeeData = _mintFeeData.insertUint(_defaultFeeRatio, XTOKEN_DEFAULT_FEE_OFFSET, 64);\n _mintFeeData = _mintFeeData.insertInt(_extraFeeRatio, XTOKEN_DELTA_FEE_OFFSET, 64);\n emit UpdateMintFeeRatioXToken(_defaultFeeRatio, _extraFeeRatio);\n }\n mintFeeData = _mintFeeData;\n }\n\n /// @notice Update the stability ratio.\n /// @param _newRatio The new collateral ratio to enter stability mode, multiplied by 1e18.\n function updateStabilityRatio(uint256 _newRatio) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _updateStabilityRatio(_newRatio);\n }\n\n /// @notice Update mint pause status.\n /// @param _newStatus The new mint pause status.\n function updateMintStatus(bool _newStatus) external onlyRole(EMERGENCY_DAO_ROLE) {\n bool _oldStatus = _updateBoolInMarketConfigData(MINT_FLAG_OFFSET, _newStatus);\n\n emit UpdateMintStatus(_oldStatus, _newStatus);\n }\n\n /// @notice Update redeem pause status.\n /// @param _newStatus The new redeem pause status.\n function updateRedeemStatus(bool _newStatus) external onlyRole(EMERGENCY_DAO_ROLE) {\n bool _oldStatus = _updateBoolInMarketConfigData(REDEEM_FLAG_OFFSET, _newStatus);\n\n emit UpdateRedeemStatus(_oldStatus, _newStatus);\n }\n\n /// @notice Update fToken mint pause status in stability mode.\n /// @param _newStatus The new mint pause status.\n function updateFTokenMintStatusInStabilityMode(bool _newStatus) external onlyRole(EMERGENCY_DAO_ROLE) {\n bool _oldStatus = _updateBoolInMarketConfigData(MINT_FLAG_STABILITY_OFFSET, _newStatus);\n\n emit UpdateFTokenMintStatusInStabilityMode(_oldStatus, _newStatus);\n }\n\n /// @notice Update xToken redeem status in stability mode\n /// @param _newStatus The new redeem pause status.\n function updateXTokenRedeemStatusInStabilityMode(bool _newStatus) external onlyRole(EMERGENCY_DAO_ROLE) {\n bool _oldStatus = _updateBoolInMarketConfigData(REDEEM_FLAG_STABILITY_OFFSET, _newStatus);\n\n emit UpdateXTokenRedeemStatusInStabilityMode(_oldStatus, _newStatus);\n }\n\n /// @notice Change address of platform contract.\n /// @param _newPlatform The new address of platform contract.\n function updatePlatform(address _newPlatform) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _updatePlatform(_newPlatform);\n }\n\n /// @notice Change address of reserve pool contract.\n /// @param _newReservePool The new address of reserve pool contract.\n function updateReservePool(address _newReservePool) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _updateReservePool(_newReservePool);\n }\n\n /// @notice Change address of RebalancePoolRegistry contract.\n /// @param _newRegistry The new address of RebalancePoolRegistry contract.\n function updateRebalancePoolRegistry(address _newRegistry) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _updateRebalancePoolRegistry(_newRegistry);\n }\n\n /// @notice Enable fxUSD mint.\n /// @param _fxUSD The address of fxUSD token.\n function enableFxUSD(address _fxUSD) external onlyRole(DEFAULT_ADMIN_ROLE) {\n if (_fxUSD == address(0)) revert ErrorZeroAddress();\n\n if (fxUSD == address(0)) fxUSD = _fxUSD;\n }\n\n /**********************\n * Internal Functions *\n **********************/\n\n /// @dev Hook function to call before mint fToken.\n function _beforeMintFToken() internal virtual {}\n\n /// @dev Hook function to call before mint xToken.\n function _beforeMintXToken() internal virtual {}\n\n /// @dev Hook function to call before redeem fToken.\n function _beforeRedeemFToken() internal virtual {}\n\n /// @dev Hook function to call before redeem xToken.\n function _beforeRedeemXToken() internal virtual {}\n\n /// @dev Internal function to validate fee ratio.\n function _validateFeeRatio(uint256 _defaultFeeRatio, int256 _extraFeeRatio) internal pure {\n if (_defaultFeeRatio > FEE_PRECISION) revert ErrorDefaultFeeTooLarge();\n if (_extraFeeRatio < 0) {\n if (uint256(-_extraFeeRatio) > _defaultFeeRatio) revert ErrorDeltaFeeTooSmall();\n } else {\n if (uint256(_extraFeeRatio) > FEE_PRECISION - _defaultFeeRatio) revert ErrorTotalFeeTooLarge();\n }\n }\n\n /// @dev Internal function to update bool value in `marketConfigData`.\n /// @param offset The offset of the value in `marketConfigData`.\n /// @param newValue The value to update.\n /// @return oldValue The original value in the `offset`.\n function _updateBoolInMarketConfigData(uint256 offset, bool newValue) private returns (bool oldValue) {\n bytes32 _data = marketConfigData;\n oldValue = _data.decodeBool(offset);\n marketConfigData = _data.insertBool(newValue, offset);\n }\n\n /// @dev Internal function to update stability ratio.\n /// @param _newRatio The new collateral ratio to enter stability mode, multiplied by 1e18.\n function _updateStabilityRatio(uint256 _newRatio) private {\n if (_newRatio > type(uint64).max) revert ErrorStabilityRatioTooLarge();\n\n bytes32 _data = marketConfigData;\n uint256 _oldRatio = _data.decodeUint(STABILITY_RATIO_OFFSET, 64);\n marketConfigData = _data.insertUint(_newRatio, STABILITY_RATIO_OFFSET, 64);\n\n emit UpdateStabilityRatio(_oldRatio, _newRatio);\n }\n\n /// @notice Change address of platform contract.\n /// @param _newPlatform The new address of platform contract.\n function _updatePlatform(address _newPlatform) private {\n if (_newPlatform == address(0)) revert ErrorZeroAddress();\n\n address _oldPlatform = platform;\n platform = _newPlatform;\n\n emit UpdatePlatform(_oldPlatform, _newPlatform);\n }\n\n /// @notice Change address of reserve pool contract.\n /// @param _newReservePool The new address of reserve pool contract.\n function _updateReservePool(address _newReservePool) private {\n if (_newReservePool == address(0)) revert ErrorZeroAddress();\n\n address _oldReservePool = reservePool;\n reservePool = _newReservePool;\n\n emit UpdateReservePool(_oldReservePool, _newReservePool);\n }\n\n /// @notice Change address of RebalancePoolRegistry contract.\n /// @param _newRegistry The new address of RebalancePoolRegistry contract.\n function _updateRebalancePoolRegistry(address _newRegistry) private {\n if (_newRegistry == address(0)) revert ErrorZeroAddress();\n\n address _oldRegistry = registry;\n registry = _newRegistry;\n\n emit UpdateRebalancePoolRegistry(_oldRegistry, _newRegistry);\n }\n\n /// @dev Internal function to deduct fToken mint fee for base token.\n /// @param _baseIn The amount of base token.\n /// @param _maxBaseInBeforeSystemStabilityMode The maximum amount of base token can be deposit before entering system stability mode.\n /// @return _baseInWithoutFee The amount of base token without fee.\n function _deductFTokenMintFee(uint256 _baseIn, uint256 _maxBaseInBeforeSystemStabilityMode)\n private\n returns (uint256 _baseInWithoutFee)\n {\n // [0, _maxBaseInBeforeSystemStabilityMode) => default = fee_ratio_0\n // [_maxBaseInBeforeSystemStabilityMode, infinity) => default + extra = fee_ratio_1\n\n (uint256 _defaultRatio, int256 _deltaRatio) = fTokenMintFeeRatio();\n uint256 _feeRatio0 = _defaultRatio;\n uint256 _feeRatio1 = uint256(int256(_defaultRatio) + _deltaRatio);\n\n _baseInWithoutFee = _deductMintFee(_baseIn, _feeRatio0, _feeRatio1, _maxBaseInBeforeSystemStabilityMode);\n }\n\n /// @dev Internal function to deduct fToken mint fee for base token.\n /// @param _baseIn The amount of base token.\n /// @param _maxBaseInBeforeSystemStabilityMode The maximum amount of base token can be deposit before entering system stability mode.\n /// @return _baseInWithoutFee The amount of base token without fee.\n function _deductXTokenMintFee(uint256 _baseIn, uint256 _maxBaseInBeforeSystemStabilityMode)\n private\n returns (uint256 _baseInWithoutFee)\n {\n // [0, _maxBaseInBeforeSystemStabilityMode) => default + extra = fee_ratio_0\n // [_maxBaseInBeforeSystemStabilityMode, infinity) => default = fee_ratio_1\n\n (uint256 _defaultRatio, int256 _deltaRatio) = xTokenMintFeeRatio();\n uint256 _feeRatio0 = uint256(int256(_defaultRatio) + _deltaRatio);\n uint256 _feeRatio1 = _defaultRatio;\n\n _baseInWithoutFee = _deductMintFee(_baseIn, _feeRatio0, _feeRatio1, _maxBaseInBeforeSystemStabilityMode);\n }\n\n function _deductMintFee(\n uint256 _baseIn,\n uint256 _feeRatio0,\n uint256 _feeRatio1,\n uint256 _maxBaseInBeforeSystemStabilityMode\n ) private returns (uint256 _baseInWithoutFee) {\n uint256 _maxBaseIn = (_maxBaseInBeforeSystemStabilityMode * FEE_PRECISION) / (FEE_PRECISION - _feeRatio0);\n\n // compute fee\n uint256 _fee;\n if (_baseIn <= _maxBaseIn) {\n _fee = (_baseIn * _feeRatio0) / FEE_PRECISION;\n } else {\n _fee = (_maxBaseIn * _feeRatio0) / FEE_PRECISION;\n _fee += ((_baseIn - _maxBaseIn) * _feeRatio1) / FEE_PRECISION;\n }\n\n _baseInWithoutFee = _baseIn - _fee;\n // take fee to platform\n if (_fee > 0) {\n IERC20Upgradeable(baseToken).safeTransferFrom(_msgSender(), platform, _fee);\n }\n }\n\n /// @dev Internal function to deduct mint fee for base token.\n /// @param _amountIn The amount of fToken.\n /// @param _maxInBeforeSystemStabilityMode The maximum amount of fToken can be redeemed before leaving system stability mode.\n /// @return _feeRatio The computed fee ratio for base token redeemed.\n function _computeFTokenRedeemFeeRatio(uint256 _amountIn, uint256 _maxInBeforeSystemStabilityMode)\n private\n view\n returns (uint256 _feeRatio)\n {\n // [0, _maxBaseInBeforeSystemStabilityMode) => default + extra = fee_ratio_0\n // [_maxBaseInBeforeSystemStabilityMode, infinity) => default = fee_ratio_1\n\n (uint256 _defaultRatio, int256 _deltaRatio) = fTokenRedeemFeeRatio();\n uint256 _feeRatio0 = uint256(int256(_defaultRatio) + _deltaRatio);\n uint256 _feeRatio1 = _defaultRatio;\n\n _feeRatio = _computeRedeemFeeRatio(_amountIn, _feeRatio0, _feeRatio1, _maxInBeforeSystemStabilityMode);\n }\n\n /// @dev Internal function to deduct mint fee for base token.\n /// @param _amountIn The amount of xToken.\n /// @param _maxInBeforeSystemStabilityMode The maximum amount of xToken can be redeemed before entering system stability mode.\n /// @return _feeRatio The computed fee ratio for base token redeemed.\n function _computeXTokenRedeemFeeRatio(uint256 _amountIn, uint256 _maxInBeforeSystemStabilityMode)\n private\n view\n returns (uint256 _feeRatio)\n {\n // [0, _maxBaseInBeforeSystemStabilityMode) => default = fee_ratio_0\n // [_maxBaseInBeforeSystemStabilityMode, infinity) => default + extra = fee_ratio_1\n\n (uint256 _defaultRatio, int256 _deltaRatio) = xTokenRedeemFeeRatio();\n uint256 _feeRatio0 = _defaultRatio;\n uint256 _feeRatio1 = uint256(int256(_defaultRatio) + _deltaRatio);\n\n _feeRatio = _computeRedeemFeeRatio(_amountIn, _feeRatio0, _feeRatio1, _maxInBeforeSystemStabilityMode);\n }\n\n /// @dev Internal function to deduct mint fee for base token.\n /// @param _amountIn The amount of fToken or xToken.\n /// @param _feeRatio0 The default fee ratio.\n /// @param _feeRatio1 The second fee ratio.\n /// @param _maxInBeforeSystemStabilityMode The maximum amount of fToken/xToken can be redeemed before entering/leaving system stability mode.\n /// @return _feeRatio The computed fee ratio for base token redeemed.\n function _computeRedeemFeeRatio(\n uint256 _amountIn,\n uint256 _feeRatio0,\n uint256 _feeRatio1,\n uint256 _maxInBeforeSystemStabilityMode\n ) private pure returns (uint256 _feeRatio) {\n if (_amountIn <= _maxInBeforeSystemStabilityMode) {\n return _feeRatio0;\n }\n uint256 _fee = _maxInBeforeSystemStabilityMode * _feeRatio0;\n _fee += (_amountIn - _maxInBeforeSystemStabilityMode) * _feeRatio1;\n return _fee / _amountIn;\n }\n}\n"
},
"contracts/interfaces/f(x)/IFxMarketV2.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IFxMarketV2 {\n /**********\n * Events *\n **********/\n\n /// @notice Emitted when fToken is minted.\n /// @param owner The address of base token owner.\n /// @param recipient The address of receiver for fToken or xToken.\n /// @param baseTokenIn The amount of base token deposited.\n /// @param fTokenOut The amount of fToken minted.\n /// @param mintFee The amount of mint fee charged.\n event MintFToken(\n address indexed owner,\n address indexed recipient,\n uint256 baseTokenIn,\n uint256 fTokenOut,\n uint256 mintFee\n );\n\n /// @notice Emitted when xToken is minted.\n /// @param owner The address of base token owner.\n /// @param recipient The address of receiver for fToken or xToken.\n /// @param baseTokenIn The amount of base token deposited.\n /// @param xTokenOut The amount of xToken minted.\n /// @param bonus The amount of base token as bonus.\n /// @param mintFee The amount of mint fee charged.\n event MintXToken(\n address indexed owner,\n address indexed recipient,\n uint256 baseTokenIn,\n uint256 xTokenOut,\n uint256 bonus,\n uint256 mintFee\n );\n\n /// @notice Emitted when someone redeem base token with fToken or xToken.\n /// @param owner The address of fToken and xToken owner.\n /// @param recipient The address of receiver for base token.\n /// @param fTokenBurned The amount of fToken burned.\n /// @param baseTokenOut The amount of base token redeemed.\n /// @param bonus The amount of base token as bonus.\n /// @param redeemFee The amount of redeem fee charged.\n event RedeemFToken(\n address indexed owner,\n address indexed recipient,\n uint256 fTokenBurned,\n uint256 baseTokenOut,\n uint256 bonus,\n uint256 redeemFee\n );\n\n /// @notice Emitted when someone redeem base token with fToken or xToken.\n /// @param owner The address of fToken and xToken owner.\n /// @param recipient The address of receiver for base token.\n /// @param xTokenBurned The amount of xToken burned.\n /// @param baseTokenOut The amount of base token redeemed.\n /// @param redeemFee The amount of redeem fee charged.\n event RedeemXToken(\n address indexed owner,\n address indexed recipient,\n uint256 xTokenBurned,\n uint256 baseTokenOut,\n uint256 redeemFee\n );\n\n /// @notice Emitted when the fee ratio for minting fToken is updated.\n /// @param defaultFeeRatio The new default fee ratio, multipled by 1e18.\n /// @param extraFeeRatio The new extra fee ratio, multipled by 1e18.\n event UpdateMintFeeRatioFToken(uint256 defaultFeeRatio, int256 extraFeeRatio);\n\n /// @notice Emitted when the fee ratio for minting xToken is updated.\n /// @param defaultFeeRatio The new default fee ratio, multipled by 1e18.\n /// @param extraFeeRatio The new extra fee ratio, multipled by 1e18.\n event UpdateMintFeeRatioXToken(uint256 defaultFeeRatio, int256 extraFeeRatio);\n\n /// @notice Emitted when the fee ratio for redeeming fToken is updated.\n /// @param defaultFeeRatio The new default fee ratio, multipled by 1e18.\n /// @param extraFeeRatio The new extra fee ratio, multipled by 1e18.\n event UpdateRedeemFeeRatioFToken(uint256 defaultFeeRatio, int256 extraFeeRatio);\n\n /// @notice Emitted when the fee ratio for redeeming xToken is updated.\n /// @param defaultFeeRatio The new default fee ratio, multipled by 1e18.\n /// @param extraFeeRatio The new extra fee ratio, multipled by 1e18.\n event UpdateRedeemFeeRatioXToken(uint256 defaultFeeRatio, int256 extraFeeRatio);\n\n /// @notice Emitted when the stability ratio is updated.\n /// @param oldRatio The previous collateral ratio to enter stability mode, multiplied by 1e18.\n /// @param newRatio The current collateral ratio to enter stability mode, multiplied by 1e18.\n event UpdateStabilityRatio(uint256 oldRatio, uint256 newRatio);\n\n /// @notice Emitted when the platform contract is updated.\n /// @param oldPlatform The address of previous platform contract.\n /// @param newPlatform The address of current platform contract.\n event UpdatePlatform(address indexed oldPlatform, address indexed newPlatform);\n\n /// @notice Emitted when the reserve pool contract is updated.\n /// @param oldReservePool The address of previous reserve pool contract.\n /// @param newReservePool The address of current reserve pool contract.\n event UpdateReservePool(address indexed oldReservePool, address indexed newReservePool);\n\n /// @notice Emitted when the RebalancePoolRegistry contract is updated.\n /// @param oldRegistry The address of previous RebalancePoolRegistry contract.\n /// @param newRegistry The address of current RebalancePoolRegistry contract.\n event UpdateRebalancePoolRegistry(address indexed oldRegistry, address indexed newRegistry);\n\n /// @notice Pause or unpause mint.\n /// @param oldStatus The previous status for mint.\n /// @param newStatus The current status for mint.\n event UpdateMintStatus(bool oldStatus, bool newStatus);\n\n /// @notice Pause or unpause redeem.\n /// @param oldStatus The previous status for redeem.\n /// @param newStatus The current status for redeem.\n event UpdateRedeemStatus(bool oldStatus, bool newStatus);\n\n /// @notice Pause or unpause fToken mint in stability mode.\n /// @param oldStatus The previous status for mint.\n /// @param newStatus The current status for mint.\n event UpdateFTokenMintStatusInStabilityMode(bool oldStatus, bool newStatus);\n\n /// @notice Pause or unpause xToken redeem in stability mode.\n /// @param oldStatus The previous status for redeem.\n /// @param newStatus The current status for redeem.\n event UpdateXTokenRedeemStatusInStabilityMode(bool oldStatus, bool newStatus);\n\n /**********\n * Errors *\n **********/\n\n /// @dev Thrown when the caller if not fUSD contract.\n error ErrorCallerNotFUSD();\n\n /// @dev Thrown when token mint is paused.\n error ErrorMintPaused();\n\n /// @dev Thrown when fToken mint is paused in stability mode.\n error ErrorFTokenMintPausedInStabilityMode();\n\n /// @dev Thrown when mint with zero amount base token.\n error ErrorMintZeroAmount();\n\n /// @dev Thrown when the amount of fToken is not enough.\n error ErrorInsufficientFTokenOutput();\n\n /// @dev Thrown when the amount of xToken is not enough.\n error ErrorInsufficientXTokenOutput();\n\n /// @dev Thrown when token redeem is paused.\n error ErrorRedeemPaused();\n\n /// @dev Thrown when xToken redeem is paused in stability mode.\n error ErrorXTokenRedeemPausedInStabilityMode();\n\n /// @dev Thrown when redeem with zero amount fToken or xToken.\n error ErrorRedeemZeroAmount();\n\n /// @dev Thrown when the amount of base token is not enough.\n error ErrorInsufficientBaseOutput();\n\n /// @dev Thrown when the stability ratio is too large.\n error ErrorStabilityRatioTooLarge();\n\n /// @dev Thrown when the default fee is too large.\n error ErrorDefaultFeeTooLarge();\n\n /// @dev Thrown when the delta fee is too small.\n error ErrorDeltaFeeTooSmall();\n\n /// @dev Thrown when the sum of default fee and delta fee is too large.\n error ErrorTotalFeeTooLarge();\n\n /// @dev Thrown when the given address is zero.\n error ErrorZeroAddress();\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @notice The address of Treasury contract.\n function treasury() external view returns (address);\n\n /// @notice Return the address of base token.\n function baseToken() external view returns (address);\n\n /// @notice Return the address fractional base token.\n function fToken() external view returns (address);\n\n /// @notice Return the address leveraged base token.\n function xToken() external view returns (address);\n\n /// @notice Return the address of fxUSD token.\n function fxUSD() external view returns (address);\n\n /// @notice Return the collateral ratio to enter stability mode, multiplied by 1e18.\n function stabilityRatio() external view returns (uint256);\n\n /****************************\n * Public Mutated Functions *\n ****************************/\n\n /// @notice Mint some fToken with some base token.\n /// @param baseIn The amount of wrapped value of base token supplied, use `uint256(-1)` to supply all base token.\n /// @param recipient The address of receiver for fToken.\n /// @param minFTokenMinted The minimum amount of fToken should be received.\n /// @return fTokenMinted The amount of fToken should be received.\n function mintFToken(\n uint256 baseIn,\n address recipient,\n uint256 minFTokenMinted\n ) external returns (uint256 fTokenMinted);\n\n /// @notice Mint some xToken with some base token.\n /// @param baseIn The amount of wrapped value of base token supplied, use `uint256(-1)` to supply all base token.\n /// @param recipient The address of receiver for xToken.\n /// @param minXTokenMinted The minimum amount of xToken should be received.\n /// @return xTokenMinted The amount of xToken should be received.\n /// @return bonus The amount of wrapped value of base token as bonus.\n function mintXToken(\n uint256 baseIn,\n address recipient,\n uint256 minXTokenMinted\n ) external returns (uint256 xTokenMinted, uint256 bonus);\n\n /// @notice Redeem base token with fToken.\n /// @param fTokenIn the amount of fToken to redeem, use `uint256(-1)` to redeem all fToken.\n /// @param recipient The address of receiver for base token.\n /// @param minBaseOut The minimum amount of wrapped value of base token should be received.\n /// @return baseOut The amount of wrapped value of base token should be received.\n /// @return bonus The amount of wrapped value of base token as bonus.\n function redeemFToken(\n uint256 fTokenIn,\n address recipient,\n uint256 minBaseOut\n ) external returns (uint256 baseOut, uint256 bonus);\n\n /// @notice Redeem base token with xToken.\n /// @param xTokenIn the amount of xToken to redeem, use `uint256(-1)` to redeem all xToken.\n /// @param recipient The address of receiver for base token.\n /// @param minBaseOut The minimum amount of wrapped value of base token should be received.\n /// @return baseOut The amount of wrapped value of base token should be received.\n function redeemXToken(\n uint256 xTokenIn,\n address recipient,\n uint256 minBaseOut\n ) external returns (uint256 baseOut);\n}\n"
},
"contracts/interfaces/f(x)/IFxRebalancePoolRegistry.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0 || ^0.8.0;\n\ninterface IFxRebalancePoolRegistry {\n /**********\n * Events *\n **********/\n\n /// @notice Emitted when a new rebalance pool is added.\n /// @param pool The address of the rebalance pool.\n event RegisterPool(address indexed pool);\n\n /// @notice Emitted when an exsited rebalance pool is removed.\n /// @param pool The address of the rebalance pool.\n event DeregisterPool(address indexed pool);\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @notice Return the address list of all registered RebalancePool.\n function getPools() external view returns (address[] memory pools);\n\n /// @notice Return the total amount of asset managed by all registered RebalancePool.\n function totalSupply() external view returns (uint256);\n}\n"
},
"contracts/interfaces/f(x)/IFxReservePool.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0 || ^0.8.0;\n\ninterface IFxReservePool {\n /// @notice Request bonus token from Reserve Pool.\n /// @param token The address of token to request.\n /// @param receiver The address recipient for the bonus token.\n /// @param originalAmount The original amount of token used.\n /// @param bonus The amount of bonus token received.\n function requestBonus(\n address token,\n address receiver,\n uint256 originalAmount\n ) external returns (uint256 bonus);\n}\n"
},
"contracts/interfaces/f(x)/IFxTreasuryV2.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IFxTreasuryV2 {\n /**********\n * Events *\n **********/\n\n /// @notice Emitted when the platform contract is updated.\n /// @param oldPlatform The address of previous platform contract.\n /// @param newPlatform The address of current platform contract.\n event UpdatePlatform(address indexed oldPlatform, address indexed newPlatform);\n\n /// @notice Emitted when the RebalancePoolSplitter contract is updated.\n /// @param oldRebalancePoolSplitter The address of previous RebalancePoolSplitter contract.\n /// @param newRebalancePoolSplitter The address of current RebalancePoolSplitter.\n event UpdateRebalancePoolSplitter(address indexed oldRebalancePoolSplitter, address indexed newRebalancePoolSplitter);\n\n /// @notice Emitted when the price oracle contract is updated.\n /// @param oldPriceOracle The address of previous price oracle.\n /// @param newPriceOracle The address of current price oracle.\n event UpdatePriceOracle(address indexed oldPriceOracle, address indexed newPriceOracle);\n\n /// @notice Emitted when the strategy contract is updated.\n /// @param oldStrategy The address of previous strategy.\n /// @param newStrategy The address of current strategy.\n event UpdateStrategy(address indexed oldStrategy, address indexed newStrategy);\n\n /// @notice Emitted when the base token cap is updated.\n /// @param oldBaseTokenCap The value of previous base token cap.\n /// @param newBaseTokenCap The value of current base token cap.\n event UpdateBaseTokenCap(uint256 oldBaseTokenCap, uint256 newBaseTokenCap);\n\n /// @notice Emitted when the EMA sample interval is updated.\n /// @param oldSampleInterval The value of previous EMA sample interval.\n /// @param newSampleInterval The value of current EMA sample interval.\n event UpdateEMASampleInterval(uint256 oldSampleInterval, uint256 newSampleInterval);\n\n /// @notice Emitted when the reference price is updated.\n /// @param oldPrice The value of previous reference price.\n /// @param newPrice The value of current reference price.\n event Settle(uint256 oldPrice, uint256 newPrice);\n\n /// @notice Emitted when the ratio for rebalance pool is updated.\n /// @param oldRatio The value of the previous ratio, multiplied by 1e9.\n /// @param newRatio The value of the current ratio, multiplied by 1e9.\n event UpdateRebalancePoolRatio(uint256 oldRatio, uint256 newRatio);\n\n /// @notice Emitted when the ratio for harvester is updated.\n /// @param oldRatio The value of the previous ratio, multiplied by 1e9.\n /// @param newRatio The value of the current ratio, multiplied by 1e9.\n event UpdateHarvesterRatio(uint256 oldRatio, uint256 newRatio);\n\n /// @notice Emitted when someone harvest pending stETH rewards.\n /// @param caller The address of caller.\n /// @param totalRewards The amount of total harvested rewards.\n /// @param rebalancePoolRewards The amount of harvested rewards distributed to stability pool.\n /// @param harvestBounty The amount of harvested rewards distributed to caller as harvest bounty.\n event Harvest(address indexed caller, uint256 totalRewards, uint256 rebalancePoolRewards, uint256 harvestBounty);\n\n /**********\n * Errors *\n **********/\n\n /// @dev Thrown when the collateral ratio is smaller than 100%.\n error ErrorCollateralRatioTooSmall();\n\n /// @dev Thrown when mint exceed total capacity.\n error ErrorExceedTotalCap();\n\n /// @dev Thrown when the oracle price is invalid.\n error ErrorInvalidOraclePrice();\n\n /// @dev Thrown when the twap price is invalid.\n error ErrorInvalidTwapPrice();\n\n /// @dev Thrown when initialize protocol twice.\n error ErrorProtocolInitialized();\n\n /// @dev Thrown when the initial amount of base token is not enough.\n error ErrorInsufficientInitialBaseToken();\n\n /// @dev Thrown when current is under collateral.\n error ErrorUnderCollateral();\n\n /// @dev Thrown when the sample internal for EMA is too small.\n error ErrorEMASampleIntervalTooSmall();\n\n /// @dev Thrown when the expense ratio exceeds `MAX_REBALANCE_POOL_RATIO`.\n error ErrorRebalancePoolRatioTooLarge();\n\n /// @dev Thrown when the harvester ratio exceeds `MAX_HARVESTER_RATIO`.\n error ErrorHarvesterRatioTooLarge();\n\n /// @dev Thrown when the given address is zero.\n error ErrorZeroAddress();\n\n /*********\n * Enums *\n *********/\n\n enum Action {\n None,\n MintFToken,\n MintXToken,\n RedeemFToken,\n RedeemXToken\n }\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @notice Return the address of price oracle contract.\n function priceOracle() external view returns (address);\n\n /// @notice Return the address of base token.\n function baseToken() external view returns (address);\n\n /// @notice Return the address fractional base token.\n function fToken() external view returns (address);\n\n /// @notice Return the address leveraged base token.\n function xToken() external view returns (address);\n\n /// @notice The reference base token price.\n function referenceBaseTokenPrice() external view returns (uint256);\n\n /// @notice The current base token price.\n function currentBaseTokenPrice() external view returns (uint256);\n\n /// @notice Return whether the price is valid.\n function isBaseTokenPriceValid() external view returns (bool);\n\n /// @notice Return the total amount of underlying value of base token deposited.\n function totalBaseToken() external view returns (uint256);\n\n /// @notice Return the address of strategy contract.\n function strategy() external view returns (address);\n\n /// @notice Return the total amount of base token managed by strategy.\n function strategyUnderlying() external view returns (uint256);\n\n /// @notice Return the current collateral ratio of fToken, multiplied by 1e18.\n function collateralRatio() external view returns (uint256);\n\n /// @notice Return whether the system is under collateral.\n function isUnderCollateral() external view returns (bool);\n\n /// @notice Compute the amount of base token needed to reach the new collateral ratio.\n /// @param newCollateralRatio The target collateral ratio, multiplied by 1e18.\n /// @return maxBaseIn The amount of underlying value of base token needed.\n /// @return maxFTokenMintable The amount of fToken can be minted.\n function maxMintableFToken(uint256 newCollateralRatio)\n external\n view\n returns (uint256 maxBaseIn, uint256 maxFTokenMintable);\n\n /// @notice Compute the amount of base token needed to reach the new collateral ratio.\n /// @param newCollateralRatio The target collateral ratio, multiplied by 1e18.\n /// @return maxBaseIn The amount of underlying value of base token needed.\n /// @return maxXTokenMintable The amount of xToken can be minted.\n function maxMintableXToken(uint256 newCollateralRatio)\n external\n view\n returns (uint256 maxBaseIn, uint256 maxXTokenMintable);\n\n /// @notice Compute the amount of fToken needed to reach the new collateral ratio.\n /// @param newCollateralRatio The target collateral ratio, multiplied by 1e18.\n /// @return maxBaseOut The amount of underlying value of base token redeemed.\n /// @return maxFTokenRedeemable The amount of fToken needed.\n function maxRedeemableFToken(uint256 newCollateralRatio)\n external\n view\n returns (uint256 maxBaseOut, uint256 maxFTokenRedeemable);\n\n /// @notice Compute the amount of xToken needed to reach the new collateral ratio.\n /// @param newCollateralRatio The target collateral ratio, multiplied by 1e18.\n /// @return maxBaseOut The amount of underlying value of base token redeemed.\n /// @return maxXTokenRedeemable The amount of xToken needed.\n function maxRedeemableXToken(uint256 newCollateralRatio)\n external\n view\n returns (uint256 maxBaseOut, uint256 maxXTokenRedeemable);\n\n /// @notice Return the exponential moving average of the leverage ratio.\n function leverageRatio() external view returns (uint256);\n\n /// @notice Convert underlying token amount to wrapped token amount.\n /// @param amount The underlying token amount.\n function getWrapppedValue(uint256 amount) external view returns (uint256);\n\n /// @notice Convert wrapped token amount to underlying token amount.\n /// @param amount The wrapped token amount.\n function getUnderlyingValue(uint256 amount) external view returns (uint256);\n\n /// @notice Return the fee ratio distributed to rebalance pool, multiplied by 1e9.\n function getRebalancePoolRatio() external view returns (uint256);\n\n /// @notice Return the fee ratio distributed to harvester, multiplied by 1e9.\n function getHarvesterRatio() external view returns (uint256);\n\n /****************************\n * Public Mutated Functions *\n ****************************/\n\n /// @notice Initialize the protocol.\n /// @param baseIn The amount of underlying value of the base token used to initialize.\n function initializeProtocol(uint256 baseIn) external returns (uint256 fTokenOut, uint256 xTokenOut);\n\n /// @notice Mint fToken with some base token.\n /// @param baseIn The amount of underlying value of base token deposited.\n /// @param recipient The address of receiver.\n /// @return fTokenOut The amount of fToken minted.\n function mintFToken(uint256 baseIn, address recipient) external returns (uint256 fTokenOut);\n\n /// @notice Mint xToken with some base token.\n /// @param baseIn The amount of underlying value of base token deposited.\n /// @param recipient The address of receiver.\n /// @return xTokenOut The amount of xToken minted.\n function mintXToken(uint256 baseIn, address recipient) external returns (uint256 xTokenOut);\n\n /// @notice Redeem fToken and xToken to base token.\n /// @param fTokenIn The amount of fToken to redeem.\n /// @param xTokenIn The amount of xToken to redeem.\n /// @param owner The owner of the fToken or xToken.\n /// @param baseOut The amount of underlying value of base token redeemed.\n function redeem(\n uint256 fTokenIn,\n uint256 xTokenIn,\n address owner\n ) external returns (uint256 baseOut);\n\n /// @notice Settle the nav of base token, fToken and xToken.\n function settle() external;\n\n /// @notice Transfer some base token to strategy contract.\n /// @param amount The amount of token to transfer.\n function transferToStrategy(uint256 amount) external;\n\n /// @notice Notify base token profit from strategy contract.\n /// @param amount The amount of base token.\n function notifyStrategyProfit(uint256 amount) external;\n\n /// @notice Harvest pending rewards to stability pool.\n function harvest() external;\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "shanghai",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}
}} |
1 | 20,291,281 | 85e5df656f8b970050a6d056523b846c5c04a37e5edd4ddd18affbfd065fb037 | e7c7865b9038ca04e01b3016da506b732192cfac5bfe3468ae5965c44bb67f35 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | f5a3c54cfd96837c5efce8a4b260de7b117f2681 | 60a060405234801561000f575f80fd5b50604051611a86380380611a8683398101604081905261002e9161003f565b6001600160a01b031660805261006c565b5f6020828403121561004f575f80fd5b81516001600160a01b0381168114610065575f80fd5b9392505050565b6080516119df6100a75f395f81816101e8015281816103ed0152818161062e015281816107160152818161079c015261081f01526119df5ff3fe608060405234801561000f575f80fd5b5060043610610127575f3560e01c806370a08231116100a9578063a457c2d71161006e578063a457c2d714610293578063a9059cbb146102a6578063c1590cd7146102b9578063d505accf146102c1578063dd62ed3e146102d4575f80fd5b806370a08231146102225780637ecebe001461024a57806384b0196e1461025d57806395d89b41146102785780639dc29fac14610280575f80fd5b80633644e515116100ef5780633644e515146101a057806339509351146101a857806340c10f19146101bb5780634cd88b76146101d057806361d027b3146101e3575f80fd5b806306fdde031461012b578063095ea7b31461014957806318160ddd1461016c57806323b872dd1461017e578063313ce56714610191575b5f80fd5b6101336102e7565b604051610140919061149f565b60405180910390f35b61015c6101573660046114d3565b610377565b6040519015158152602001610140565b6035545b604051908152602001610140565b61015c61018c3660046114fb565b610390565b60405160128152602001610140565b6101706103b3565b61015c6101b63660046114d3565b6103c1565b6101ce6101c93660046114d3565b6103e2565b005b6101ce6101de3660046115d1565b610439565b61020a7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610140565b610170610230366004611631565b6001600160a01b03165f9081526033602052604090205490565b610170610258366004611631565b61055e565b61026561057b565b604051610140979695949392919061164a565b610133610614565b6101ce61028e3660046114d3565b610623565b61015c6102a13660046114d3565b610676565b61015c6102b43660046114d3565b6106f0565b6101706106fd565b6101ce6102cf3660046116de565b6108cb565b6101706102e236600461174b565b610a2c565b6060603680546102f69061177c565b80601f01602080910402602001604051908101604052809291908181526020018280546103229061177c565b801561036d5780601f106103445761010080835404028352916020019161036d565b820191905f5260205f20905b81548152906001019060200180831161035057829003601f168201915b5050505050905090565b5f33610384818585610a56565b60019150505b92915050565b5f3361039d858285610b79565b6103a8858585610bf1565b506001949350505050565b5f6103bc610d9a565b905090565b5f336103848185856103d38383610a2c565b6103dd91906117c2565b610a56565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461042b5760405163227e980560e01b815260040160405180910390fd5b6104358282610da3565b5050565b5f54610100900460ff161580801561045757505f54600160ff909116105b806104705750303b15801561047057505f5460ff166001145b6104d85760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b5f805460ff1916600117905580156104f9575f805461ff0019166101001790555b610501610e62565b61050b8383610e8a565b61051483610eba565b8015610559575f805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b6001600160a01b0381165f9081526099602052604081205461038a565b5f6060805f805f60606065545f801b1480156105975750606654155b6105db5760405162461bcd60e51b81526020600482015260156024820152741152540dcc4c8e88155b9a5b9a5d1a585b1a5e9959605a1b60448201526064016104cf565b6105e3610f06565b6105eb610f15565b604080515f80825260208201909252600f60f81b9b939a50919850469750309650945092509050565b6060603780546102f69061177c565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461066c5760405163227e980560e01b815260040160405180910390fd5b6104358282610f24565b5f33816106838286610a2c565b9050838110156106e35760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016104cf565b6103a88286868403610a56565b5f33610384818585610bf1565b5f8061070860355490565b90505f8111801561079457507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663cdc6c7cc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610770573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061079491906117d5565b156108bc575f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663ffcf925e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107f6573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061081a91906117f4565b90505f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166344d90cf96040518163ffffffff1660e01b8152600401602060405180830381865afa158015610879573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061089d91906117f4565b9050826108aa828461180b565b6108b49190611822565b935050505090565b670de0b6b3a764000091505090565b8342111561091b5760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e6500000060448201526064016104cf565b5f7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886109498c611056565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090505f6109a38261107d565b90505f6109b2828787876110a9565b9050896001600160a01b0316816001600160a01b031614610a155760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e6174757265000060448201526064016104cf565b610a208a8a8a610a56565b50505050505050505050565b6001600160a01b039182165f90815260346020908152604080832093909416825291909152205490565b6001600160a01b038316610ab85760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104cf565b6001600160a01b038216610b195760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104cf565b6001600160a01b038381165f8181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b5f610b848484610a2c565b90505f198114610beb5781811015610bde5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016104cf565b610beb8484848403610a56565b50505050565b6001600160a01b038316610c555760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104cf565b6001600160a01b038216610cb75760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104cf565b6001600160a01b0383165f9081526033602052604090205481811015610d2e5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016104cf565b6001600160a01b038085165f8181526033602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610d8d9086815260200190565b60405180910390a3610beb565b5f6103bc6110cf565b6001600160a01b038216610df95760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016104cf565b8060355f828254610e0a91906117c2565b90915550506001600160a01b0382165f818152603360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b5f54610100900460ff16610e885760405162461bcd60e51b81526004016104cf90611841565b565b5f54610100900460ff16610eb05760405162461bcd60e51b81526004016104cf90611841565b6104358282611142565b5f54610100900460ff16610ee05760405162461bcd60e51b81526004016104cf90611841565b610f0381604051806040016040528060018152602001603160f81b815250611181565b50565b6060606780546102f69061177c565b6060606880546102f69061177c565b6001600160a01b038216610f845760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016104cf565b6001600160a01b0382165f9081526033602052604090205481811015610ff75760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016104cf565b6001600160a01b0383165f8181526033602090815260408083208686039055603580548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b6001600160a01b0381165f9081526099602052604090208054600181018255905b50919050565b5f61038a611089610d9a565b8360405161190160f01b8152600281019290925260228201526042902090565b5f805f6110b8878787876111ce565b915091506110c58161128b565b5095945050505050565b5f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6110f96113d4565b61110161142c565b60408051602081019490945283019190915260608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b5f54610100900460ff166111685760405162461bcd60e51b81526004016104cf90611841565b603661117483826118d9565b50603761055982826118d9565b5f54610100900460ff166111a75760405162461bcd60e51b81526004016104cf90611841565b60676111b383826118d9565b5060686111c082826118d9565b50505f606581905560665550565b5f807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561120357505f90506003611282565b604080515f8082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611254573d5f803e3d5ffd5b5050604051601f1901519150506001600160a01b03811661127c575f60019250925050611282565b91505f90505b94509492505050565b5f81600481111561129e5761129e611995565b036112a65750565b60018160048111156112ba576112ba611995565b036113075760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016104cf565b600281600481111561131b5761131b611995565b036113685760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016104cf565b600381600481111561137c5761137c611995565b03610f035760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016104cf565b5f806113de610f06565b8051909150156113f5578051602090910120919050565b60655480156114045792915050565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4709250505090565b5f80611436610f15565b80519091501561144d578051602090910120919050565b60665480156114045792915050565b5f81518084525f5b8181101561148057602081850181015186830182015201611464565b505f602082860101526020601f19601f83011685010191505092915050565b602081525f6114b1602083018461145c565b9392505050565b80356001600160a01b03811681146114ce575f80fd5b919050565b5f80604083850312156114e4575f80fd5b6114ed836114b8565b946020939093013593505050565b5f805f6060848603121561150d575f80fd5b611516846114b8565b9250611524602085016114b8565b9150604084013590509250925092565b634e487b7160e01b5f52604160045260245ffd5b5f82601f830112611557575f80fd5b813567ffffffffffffffff8082111561157257611572611534565b604051601f8301601f19908116603f0116810190828211818310171561159a5761159a611534565b816040528381528660208588010111156115b2575f80fd5b836020870160208301375f602085830101528094505050505092915050565b5f80604083850312156115e2575f80fd5b823567ffffffffffffffff808211156115f9575f80fd5b61160586838701611548565b9350602085013591508082111561161a575f80fd5b5061162785828601611548565b9150509250929050565b5f60208284031215611641575f80fd5b6114b1826114b8565b60ff60f81b881681525f602060e08184015261166960e084018a61145c565b838103604085015261167b818a61145c565b606085018990526001600160a01b038816608086015260a0850187905284810360c086015285518082528387019250908301905f5b818110156116cc578351835292840192918401916001016116b0565b50909c9b505050505050505050505050565b5f805f805f805f60e0888a0312156116f4575f80fd5b6116fd886114b8565b965061170b602089016114b8565b95506040880135945060608801359350608088013560ff8116811461172e575f80fd5b9699959850939692959460a0840135945060c09093013592915050565b5f806040838503121561175c575f80fd5b611765836114b8565b9150611773602084016114b8565b90509250929050565b600181811c9082168061179057607f821691505b60208210810361107757634e487b7160e01b5f52602260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b8082018082111561038a5761038a6117ae565b5f602082840312156117e5575f80fd5b815180151581146114b1575f80fd5b5f60208284031215611804575f80fd5b5051919050565b808202811582820484141761038a5761038a6117ae565b5f8261183c57634e487b7160e01b5f52601260045260245ffd5b500490565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b601f821115610559575f81815260208120601f850160051c810160208610156118b25750805b601f850160051c820191505b818110156118d1578281556001016118be565b505050505050565b815167ffffffffffffffff8111156118f3576118f3611534565b61190781611901845461177c565b8461188c565b602080601f83116001811461193a575f84156119235750858301515b5f19600386901b1c1916600185901b1785556118d1565b5f85815260208120601f198616915b8281101561196857888601518255948401946001909101908401611949565b508582101561198557878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b5f52602160045260245ffdfea2646970667358221220fb136188adc61d21ca4ff9e8e1221c0566f6e4fc26e529ed42c0de186a7a260a64736f6c63430008140033000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd2 | 608060405234801561000f575f80fd5b5060043610610127575f3560e01c806370a08231116100a9578063a457c2d71161006e578063a457c2d714610293578063a9059cbb146102a6578063c1590cd7146102b9578063d505accf146102c1578063dd62ed3e146102d4575f80fd5b806370a08231146102225780637ecebe001461024a57806384b0196e1461025d57806395d89b41146102785780639dc29fac14610280575f80fd5b80633644e515116100ef5780633644e515146101a057806339509351146101a857806340c10f19146101bb5780634cd88b76146101d057806361d027b3146101e3575f80fd5b806306fdde031461012b578063095ea7b31461014957806318160ddd1461016c57806323b872dd1461017e578063313ce56714610191575b5f80fd5b6101336102e7565b604051610140919061149f565b60405180910390f35b61015c6101573660046114d3565b610377565b6040519015158152602001610140565b6035545b604051908152602001610140565b61015c61018c3660046114fb565b610390565b60405160128152602001610140565b6101706103b3565b61015c6101b63660046114d3565b6103c1565b6101ce6101c93660046114d3565b6103e2565b005b6101ce6101de3660046115d1565b610439565b61020a7f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd281565b6040516001600160a01b039091168152602001610140565b610170610230366004611631565b6001600160a01b03165f9081526033602052604090205490565b610170610258366004611631565b61055e565b61026561057b565b604051610140979695949392919061164a565b610133610614565b6101ce61028e3660046114d3565b610623565b61015c6102a13660046114d3565b610676565b61015c6102b43660046114d3565b6106f0565b6101706106fd565b6101ce6102cf3660046116de565b6108cb565b6101706102e236600461174b565b610a2c565b6060603680546102f69061177c565b80601f01602080910402602001604051908101604052809291908181526020018280546103229061177c565b801561036d5780601f106103445761010080835404028352916020019161036d565b820191905f5260205f20905b81548152906001019060200180831161035057829003601f168201915b5050505050905090565b5f33610384818585610a56565b60019150505b92915050565b5f3361039d858285610b79565b6103a8858585610bf1565b506001949350505050565b5f6103bc610d9a565b905090565b5f336103848185856103d38383610a2c565b6103dd91906117c2565b610a56565b336001600160a01b037f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd2161461042b5760405163227e980560e01b815260040160405180910390fd5b6104358282610da3565b5050565b5f54610100900460ff161580801561045757505f54600160ff909116105b806104705750303b15801561047057505f5460ff166001145b6104d85760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b5f805460ff1916600117905580156104f9575f805461ff0019166101001790555b610501610e62565b61050b8383610e8a565b61051483610eba565b8015610559575f805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b6001600160a01b0381165f9081526099602052604081205461038a565b5f6060805f805f60606065545f801b1480156105975750606654155b6105db5760405162461bcd60e51b81526020600482015260156024820152741152540dcc4c8e88155b9a5b9a5d1a585b1a5e9959605a1b60448201526064016104cf565b6105e3610f06565b6105eb610f15565b604080515f80825260208201909252600f60f81b9b939a50919850469750309650945092509050565b6060603780546102f69061177c565b336001600160a01b037f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd2161461066c5760405163227e980560e01b815260040160405180910390fd5b6104358282610f24565b5f33816106838286610a2c565b9050838110156106e35760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016104cf565b6103a88286868403610a56565b5f33610384818585610bf1565b5f8061070860355490565b90505f8111801561079457507f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd26001600160a01b031663cdc6c7cc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610770573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061079491906117d5565b156108bc575f7f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd26001600160a01b031663ffcf925e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107f6573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061081a91906117f4565b90505f7f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd26001600160a01b03166344d90cf96040518163ffffffff1660e01b8152600401602060405180830381865afa158015610879573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061089d91906117f4565b9050826108aa828461180b565b6108b49190611822565b935050505090565b670de0b6b3a764000091505090565b8342111561091b5760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e6500000060448201526064016104cf565b5f7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886109498c611056565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090505f6109a38261107d565b90505f6109b2828787876110a9565b9050896001600160a01b0316816001600160a01b031614610a155760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e6174757265000060448201526064016104cf565b610a208a8a8a610a56565b50505050505050505050565b6001600160a01b039182165f90815260346020908152604080832093909416825291909152205490565b6001600160a01b038316610ab85760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104cf565b6001600160a01b038216610b195760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104cf565b6001600160a01b038381165f8181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b5f610b848484610a2c565b90505f198114610beb5781811015610bde5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016104cf565b610beb8484848403610a56565b50505050565b6001600160a01b038316610c555760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104cf565b6001600160a01b038216610cb75760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104cf565b6001600160a01b0383165f9081526033602052604090205481811015610d2e5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016104cf565b6001600160a01b038085165f8181526033602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610d8d9086815260200190565b60405180910390a3610beb565b5f6103bc6110cf565b6001600160a01b038216610df95760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016104cf565b8060355f828254610e0a91906117c2565b90915550506001600160a01b0382165f818152603360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b5f54610100900460ff16610e885760405162461bcd60e51b81526004016104cf90611841565b565b5f54610100900460ff16610eb05760405162461bcd60e51b81526004016104cf90611841565b6104358282611142565b5f54610100900460ff16610ee05760405162461bcd60e51b81526004016104cf90611841565b610f0381604051806040016040528060018152602001603160f81b815250611181565b50565b6060606780546102f69061177c565b6060606880546102f69061177c565b6001600160a01b038216610f845760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016104cf565b6001600160a01b0382165f9081526033602052604090205481811015610ff75760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016104cf565b6001600160a01b0383165f8181526033602090815260408083208686039055603580548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b6001600160a01b0381165f9081526099602052604090208054600181018255905b50919050565b5f61038a611089610d9a565b8360405161190160f01b8152600281019290925260228201526042902090565b5f805f6110b8878787876111ce565b915091506110c58161128b565b5095945050505050565b5f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6110f96113d4565b61110161142c565b60408051602081019490945283019190915260608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b5f54610100900460ff166111685760405162461bcd60e51b81526004016104cf90611841565b603661117483826118d9565b50603761055982826118d9565b5f54610100900460ff166111a75760405162461bcd60e51b81526004016104cf90611841565b60676111b383826118d9565b5060686111c082826118d9565b50505f606581905560665550565b5f807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561120357505f90506003611282565b604080515f8082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611254573d5f803e3d5ffd5b5050604051601f1901519150506001600160a01b03811661127c575f60019250925050611282565b91505f90505b94509492505050565b5f81600481111561129e5761129e611995565b036112a65750565b60018160048111156112ba576112ba611995565b036113075760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016104cf565b600281600481111561131b5761131b611995565b036113685760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016104cf565b600381600481111561137c5761137c611995565b03610f035760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016104cf565b5f806113de610f06565b8051909150156113f5578051602090910120919050565b60655480156114045792915050565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4709250505090565b5f80611436610f15565b80519091501561144d578051602090910120919050565b60665480156114045792915050565b5f81518084525f5b8181101561148057602081850181015186830182015201611464565b505f602082860101526020601f19601f83011685010191505092915050565b602081525f6114b1602083018461145c565b9392505050565b80356001600160a01b03811681146114ce575f80fd5b919050565b5f80604083850312156114e4575f80fd5b6114ed836114b8565b946020939093013593505050565b5f805f6060848603121561150d575f80fd5b611516846114b8565b9250611524602085016114b8565b9150604084013590509250925092565b634e487b7160e01b5f52604160045260245ffd5b5f82601f830112611557575f80fd5b813567ffffffffffffffff8082111561157257611572611534565b604051601f8301601f19908116603f0116810190828211818310171561159a5761159a611534565b816040528381528660208588010111156115b2575f80fd5b836020870160208301375f602085830101528094505050505092915050565b5f80604083850312156115e2575f80fd5b823567ffffffffffffffff808211156115f9575f80fd5b61160586838701611548565b9350602085013591508082111561161a575f80fd5b5061162785828601611548565b9150509250929050565b5f60208284031215611641575f80fd5b6114b1826114b8565b60ff60f81b881681525f602060e08184015261166960e084018a61145c565b838103604085015261167b818a61145c565b606085018990526001600160a01b038816608086015260a0850187905284810360c086015285518082528387019250908301905f5b818110156116cc578351835292840192918401916001016116b0565b50909c9b505050505050505050505050565b5f805f805f805f60e0888a0312156116f4575f80fd5b6116fd886114b8565b965061170b602089016114b8565b95506040880135945060608801359350608088013560ff8116811461172e575f80fd5b9699959850939692959460a0840135945060c09093013592915050565b5f806040838503121561175c575f80fd5b611765836114b8565b9150611773602084016114b8565b90509250929050565b600181811c9082168061179057607f821691505b60208210810361107757634e487b7160e01b5f52602260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b8082018082111561038a5761038a6117ae565b5f602082840312156117e5575f80fd5b815180151581146114b1575f80fd5b5f60208284031215611804575f80fd5b5051919050565b808202811582820484141761038a5761038a6117ae565b5f8261183c57634e487b7160e01b5f52601260045260245ffd5b500490565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b601f821115610559575f81815260208120601f850160051c810160208610156118b25750805b601f850160051c820191505b818110156118d1578281556001016118be565b505050505050565b815167ffffffffffffffff8111156118f3576118f3611534565b61190781611901845461177c565b8461188c565b602080601f83116001811461193a575f84156119235750858301515b5f19600386901b1c1916600185901b1785556118d1565b5f85815260208120601f198616915b8281101561196857888601518255948401946001909101908401611949565b508582101561198557878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b5f52602160045260245ffdfea2646970667358221220fb136188adc61d21ca4ff9e8e1221c0566f6e4fc26e529ed42c0de186a7a260a64736f6c63430008140033 | {{
"language": "Solidity",
"sources": {
"@openzeppelin/contracts-upgradeable-v4/interfaces/IERC5267Upgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)\n\npragma solidity ^0.8.0;\n\ninterface IERC5267Upgradeable {\n /**\n * @dev MAY be emitted to signal that the domain could have changed.\n */\n event EIP712DomainChanged();\n\n /**\n * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\n * signature.\n */\n function eip712Domain()\n external\n view\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n );\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/proxy/utils/Initializable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/token/ERC20/ERC20Upgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20Upgradeable.sol\";\nimport \"./extensions/IERC20MetadataUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC20_init_unchained(name_, symbol_);\n }\n\n function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(address from, address to, uint256 amount) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[45] private __gap;\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/token/ERC20/extensions/ERC20PermitUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/ERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20PermitUpgradeable.sol\";\nimport \"../ERC20Upgradeable.sol\";\nimport \"../../../utils/cryptography/ECDSAUpgradeable.sol\";\nimport \"../../../utils/cryptography/EIP712Upgradeable.sol\";\nimport \"../../../utils/CountersUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * _Available since v3.4._\n *\n * @custom:storage-size 51\n */\nabstract contract ERC20PermitUpgradeable is Initializable, ERC20Upgradeable, IERC20PermitUpgradeable, EIP712Upgradeable {\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n mapping(address => CountersUpgradeable.Counter) private _nonces;\n\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private constant _PERMIT_TYPEHASH =\n keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n /**\n * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.\n * However, to ensure consistency with the upgradeable transpiler, we will continue\n * to reserve a slot.\n * @custom:oz-renamed-from _PERMIT_TYPEHASH\n */\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;\n\n /**\n * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\"1\"`.\n *\n * It's a good idea to use the same `name` that is defined as the ERC20 token name.\n */\n function __ERC20Permit_init(string memory name) internal onlyInitializing {\n __EIP712_init_unchained(name, \"1\");\n }\n\n function __ERC20Permit_init_unchained(string memory) internal onlyInitializing {}\n\n /**\n * @dev See {IERC20Permit-permit}.\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual override {\n require(block.timestamp <= deadline, \"ERC20Permit: expired deadline\");\n\n bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\n\n bytes32 hash = _hashTypedDataV4(structHash);\n\n address signer = ECDSAUpgradeable.recover(hash, v, r, s);\n require(signer == owner, \"ERC20Permit: invalid signature\");\n\n _approve(owner, spender, value);\n }\n\n /**\n * @dev See {IERC20Permit-nonces}.\n */\n function nonces(address owner) public view virtual override returns (uint256) {\n return _nonces[owner].current();\n }\n\n /**\n * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view override returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n /**\n * @dev \"Consume a nonce\": return the current value and increment.\n *\n * _Available since v4.1._\n */\n function _useNonce(address owner) internal virtual returns (uint256 current) {\n CountersUpgradeable.Counter storage nonce = _nonces[owner];\n current = nonce.current();\n nonce.increment();\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/token/ERC20/extensions/IERC20MetadataUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/token/ERC20/extensions/IERC20PermitUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/token/ERC20/IERC20Upgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/AddressUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/ContextUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/CountersUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary CountersUpgradeable {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/cryptography/ECDSAUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../StringsUpgradeable.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSAUpgradeable {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\")\n mstore(0x1c, hash)\n message := keccak256(0x00, 0x3c)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", StringsUpgradeable.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(ptr, \"\\x19\\x01\")\n mstore(add(ptr, 0x02), domainSeparator)\n mstore(add(ptr, 0x22), structHash)\n data := keccak256(ptr, 0x42)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\n * `validator` and `data` according to the version 0 of EIP-191.\n *\n * See {recover}.\n */\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x00\", validator, data));\n }\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/cryptography/EIP712Upgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.8;\n\nimport \"./ECDSAUpgradeable.sol\";\nimport \"../../interfaces/IERC5267Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\n * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the\n * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\n *\n * _Available since v3.4._\n *\n * @custom:storage-size 52\n */\nabstract contract EIP712Upgradeable is Initializable, IERC5267Upgradeable {\n bytes32 private constant _TYPE_HASH =\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n /// @custom:oz-renamed-from _HASHED_NAME\n bytes32 private _hashedName;\n /// @custom:oz-renamed-from _HASHED_VERSION\n bytes32 private _hashedVersion;\n\n string private _name;\n string private _version;\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\n __EIP712_init_unchained(name, version);\n }\n\n function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\n _name = name;\n _version = version;\n\n // Reset prior values in storage if upgrading\n _hashedName = 0;\n _hashedVersion = 0;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n return _buildDomainSeparator();\n }\n\n function _buildDomainSeparator() private view returns (bytes32) {\n return keccak256(abi.encode(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash(), block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n\n /**\n * @dev See {EIP-5267}.\n *\n * _Available since v4.9._\n */\n function eip712Domain()\n public\n view\n virtual\n override\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n )\n {\n // If the hashed name and version in storage are non-zero, the contract hasn't been properly initialized\n // and the EIP712 domain is not reliable, as it will be missing name and version.\n require(_hashedName == 0 && _hashedVersion == 0, \"EIP712: Uninitialized\");\n\n return (\n hex\"0f\", // 01111\n _EIP712Name(),\n _EIP712Version(),\n block.chainid,\n address(this),\n bytes32(0),\n new uint256[](0)\n );\n }\n\n /**\n * @dev The name parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712Name() internal virtual view returns (string memory) {\n return _name;\n }\n\n /**\n * @dev The version parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712Version() internal virtual view returns (string memory) {\n return _version;\n }\n\n /**\n * @dev The hash of the name parameter for the EIP712 domain.\n *\n * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Name` instead.\n */\n function _EIP712NameHash() internal view returns (bytes32) {\n string memory name = _EIP712Name();\n if (bytes(name).length > 0) {\n return keccak256(bytes(name));\n } else {\n // If the name is empty, the contract may have been upgraded without initializing the new storage.\n // We return the name hash in storage if non-zero, otherwise we assume the name is empty by design.\n bytes32 hashedName = _hashedName;\n if (hashedName != 0) {\n return hashedName;\n } else {\n return keccak256(\"\");\n }\n }\n }\n\n /**\n * @dev The hash of the version parameter for the EIP712 domain.\n *\n * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Version` instead.\n */\n function _EIP712VersionHash() internal view returns (bytes32) {\n string memory version = _EIP712Version();\n if (bytes(version).length > 0) {\n return keccak256(bytes(version));\n } else {\n // If the version is empty, the contract may have been upgraded without initializing the new storage.\n // We return the version hash in storage if non-zero, otherwise we assume the version is empty by design.\n bytes32 hashedVersion = _hashedVersion;\n if (hashedVersion != 0) {\n return hashedVersion;\n } else {\n return keccak256(\"\");\n }\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[48] private __gap;\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/math/MathUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/math/SignedMathUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMathUpgradeable {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/StringsUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SignedMathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMathUpgradeable.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n"
},
"contracts/f(x)/v2/FractionalTokenV2.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity =0.8.20;\n\nimport { ERC20PermitUpgradeable } from \"@openzeppelin/contracts-upgradeable-v4/token/ERC20/extensions/ERC20PermitUpgradeable.sol\";\n\nimport { IFxFractionalTokenV2 } from \"../../interfaces/f(x)/IFxFractionalTokenV2.sol\";\nimport { IFxTreasuryV2 } from \"../../interfaces/f(x)/IFxTreasuryV2.sol\";\n\ncontract FractionalTokenV2 is ERC20PermitUpgradeable, IFxFractionalTokenV2 {\n /*************\n * Constants *\n *************/\n\n /// @notice The address of Treasury contract.\n address public immutable treasury;\n\n /// @dev The precision used to compute nav.\n uint256 private constant PRECISION = 1e18;\n\n /*************\n * Variables *\n *************/\n\n /*************\n * Modifiers *\n *************/\n\n modifier onlyTreasury() {\n if (msg.sender != treasury) revert ErrorCallerIsNotTreasury();\n _;\n }\n\n /***************\n * Constructor *\n ***************/\n\n constructor(address _treasury) {\n treasury = _treasury;\n }\n\n function initialize(string memory _name, string memory _symbol) external initializer {\n __Context_init();\n __ERC20_init(_name, _symbol);\n __ERC20Permit_init(_name);\n }\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @inheritdoc IFxFractionalTokenV2\n function nav() external view override returns (uint256) {\n uint256 _fSupply = totalSupply();\n if (_fSupply > 0 && IFxTreasuryV2(treasury).isUnderCollateral()) {\n // under collateral\n uint256 baseNav = IFxTreasuryV2(treasury).currentBaseTokenPrice();\n uint256 baseSupply = IFxTreasuryV2(treasury).totalBaseToken();\n return (baseNav * baseSupply) / _fSupply;\n } else {\n return PRECISION;\n }\n }\n\n /****************************\n * Public Mutated Functions *\n ****************************/\n\n /// @inheritdoc IFxFractionalTokenV2\n function mint(address _to, uint256 _amount) external override onlyTreasury {\n _mint(_to, _amount);\n }\n\n /// @inheritdoc IFxFractionalTokenV2\n function burn(address _from, uint256 _amount) external override onlyTreasury {\n _burn(_from, _amount);\n }\n}\n"
},
"contracts/interfaces/f(x)/IFxFractionalTokenV2.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IFxFractionalTokenV2 {\n /**********\n * Errors *\n **********/\n\n /// @dev Thrown when caller is not treasury contract.\n error ErrorCallerIsNotTreasury();\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @notice Return the net asset value for the token, multipled by 1e18.\n function nav() external view returns (uint256);\n\n /****************************\n * Public Mutated Functions *\n ****************************/\n\n /// @notice Mint some token to someone.\n /// @param to The address of recipient.\n /// @param amount The amount of token to mint.\n function mint(address to, uint256 amount) external;\n\n /// @notice Burn some token from someone.\n /// @param from The address of owner to burn.\n /// @param amount The amount of token to burn.\n function burn(address from, uint256 amount) external;\n}\n"
},
"contracts/interfaces/f(x)/IFxTreasuryV2.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IFxTreasuryV2 {\n /**********\n * Events *\n **********/\n\n /// @notice Emitted when the platform contract is updated.\n /// @param oldPlatform The address of previous platform contract.\n /// @param newPlatform The address of current platform contract.\n event UpdatePlatform(address indexed oldPlatform, address indexed newPlatform);\n\n /// @notice Emitted when the RebalancePoolSplitter contract is updated.\n /// @param oldRebalancePoolSplitter The address of previous RebalancePoolSplitter contract.\n /// @param newRebalancePoolSplitter The address of current RebalancePoolSplitter.\n event UpdateRebalancePoolSplitter(address indexed oldRebalancePoolSplitter, address indexed newRebalancePoolSplitter);\n\n /// @notice Emitted when the price oracle contract is updated.\n /// @param oldPriceOracle The address of previous price oracle.\n /// @param newPriceOracle The address of current price oracle.\n event UpdatePriceOracle(address indexed oldPriceOracle, address indexed newPriceOracle);\n\n /// @notice Emitted when the strategy contract is updated.\n /// @param oldStrategy The address of previous strategy.\n /// @param newStrategy The address of current strategy.\n event UpdateStrategy(address indexed oldStrategy, address indexed newStrategy);\n\n /// @notice Emitted when the base token cap is updated.\n /// @param oldBaseTokenCap The value of previous base token cap.\n /// @param newBaseTokenCap The value of current base token cap.\n event UpdateBaseTokenCap(uint256 oldBaseTokenCap, uint256 newBaseTokenCap);\n\n /// @notice Emitted when the EMA sample interval is updated.\n /// @param oldSampleInterval The value of previous EMA sample interval.\n /// @param newSampleInterval The value of current EMA sample interval.\n event UpdateEMASampleInterval(uint256 oldSampleInterval, uint256 newSampleInterval);\n\n /// @notice Emitted when the reference price is updated.\n /// @param oldPrice The value of previous reference price.\n /// @param newPrice The value of current reference price.\n event Settle(uint256 oldPrice, uint256 newPrice);\n\n /// @notice Emitted when the ratio for rebalance pool is updated.\n /// @param oldRatio The value of the previous ratio, multiplied by 1e9.\n /// @param newRatio The value of the current ratio, multiplied by 1e9.\n event UpdateRebalancePoolRatio(uint256 oldRatio, uint256 newRatio);\n\n /// @notice Emitted when the ratio for harvester is updated.\n /// @param oldRatio The value of the previous ratio, multiplied by 1e9.\n /// @param newRatio The value of the current ratio, multiplied by 1e9.\n event UpdateHarvesterRatio(uint256 oldRatio, uint256 newRatio);\n\n /// @notice Emitted when someone harvest pending stETH rewards.\n /// @param caller The address of caller.\n /// @param totalRewards The amount of total harvested rewards.\n /// @param rebalancePoolRewards The amount of harvested rewards distributed to stability pool.\n /// @param harvestBounty The amount of harvested rewards distributed to caller as harvest bounty.\n event Harvest(address indexed caller, uint256 totalRewards, uint256 rebalancePoolRewards, uint256 harvestBounty);\n\n /**********\n * Errors *\n **********/\n\n /// @dev Thrown when the collateral ratio is smaller than 100%.\n error ErrorCollateralRatioTooSmall();\n\n /// @dev Thrown when mint exceed total capacity.\n error ErrorExceedTotalCap();\n\n /// @dev Thrown when the oracle price is invalid.\n error ErrorInvalidOraclePrice();\n\n /// @dev Thrown when the twap price is invalid.\n error ErrorInvalidTwapPrice();\n\n /// @dev Thrown when initialize protocol twice.\n error ErrorProtocolInitialized();\n\n /// @dev Thrown when the initial amount of base token is not enough.\n error ErrorInsufficientInitialBaseToken();\n\n /// @dev Thrown when current is under collateral.\n error ErrorUnderCollateral();\n\n /// @dev Thrown when the sample internal for EMA is too small.\n error ErrorEMASampleIntervalTooSmall();\n\n /// @dev Thrown when the expense ratio exceeds `MAX_REBALANCE_POOL_RATIO`.\n error ErrorRebalancePoolRatioTooLarge();\n\n /// @dev Thrown when the harvester ratio exceeds `MAX_HARVESTER_RATIO`.\n error ErrorHarvesterRatioTooLarge();\n\n /// @dev Thrown when the given address is zero.\n error ErrorZeroAddress();\n\n /*********\n * Enums *\n *********/\n\n enum Action {\n None,\n MintFToken,\n MintXToken,\n RedeemFToken,\n RedeemXToken\n }\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @notice Return the address of price oracle contract.\n function priceOracle() external view returns (address);\n\n /// @notice Return the address of base token.\n function baseToken() external view returns (address);\n\n /// @notice Return the address fractional base token.\n function fToken() external view returns (address);\n\n /// @notice Return the address leveraged base token.\n function xToken() external view returns (address);\n\n /// @notice The reference base token price.\n function referenceBaseTokenPrice() external view returns (uint256);\n\n /// @notice The current base token price.\n function currentBaseTokenPrice() external view returns (uint256);\n\n /// @notice Return whether the price is valid.\n function isBaseTokenPriceValid() external view returns (bool);\n\n /// @notice Return the total amount of underlying value of base token deposited.\n function totalBaseToken() external view returns (uint256);\n\n /// @notice Return the address of strategy contract.\n function strategy() external view returns (address);\n\n /// @notice Return the total amount of base token managed by strategy.\n function strategyUnderlying() external view returns (uint256);\n\n /// @notice Return the current collateral ratio of fToken, multiplied by 1e18.\n function collateralRatio() external view returns (uint256);\n\n /// @notice Return whether the system is under collateral.\n function isUnderCollateral() external view returns (bool);\n\n /// @notice Compute the amount of base token needed to reach the new collateral ratio.\n /// @param newCollateralRatio The target collateral ratio, multiplied by 1e18.\n /// @return maxBaseIn The amount of underlying value of base token needed.\n /// @return maxFTokenMintable The amount of fToken can be minted.\n function maxMintableFToken(uint256 newCollateralRatio)\n external\n view\n returns (uint256 maxBaseIn, uint256 maxFTokenMintable);\n\n /// @notice Compute the amount of base token needed to reach the new collateral ratio.\n /// @param newCollateralRatio The target collateral ratio, multiplied by 1e18.\n /// @return maxBaseIn The amount of underlying value of base token needed.\n /// @return maxXTokenMintable The amount of xToken can be minted.\n function maxMintableXToken(uint256 newCollateralRatio)\n external\n view\n returns (uint256 maxBaseIn, uint256 maxXTokenMintable);\n\n /// @notice Compute the amount of fToken needed to reach the new collateral ratio.\n /// @param newCollateralRatio The target collateral ratio, multiplied by 1e18.\n /// @return maxBaseOut The amount of underlying value of base token redeemed.\n /// @return maxFTokenRedeemable The amount of fToken needed.\n function maxRedeemableFToken(uint256 newCollateralRatio)\n external\n view\n returns (uint256 maxBaseOut, uint256 maxFTokenRedeemable);\n\n /// @notice Compute the amount of xToken needed to reach the new collateral ratio.\n /// @param newCollateralRatio The target collateral ratio, multiplied by 1e18.\n /// @return maxBaseOut The amount of underlying value of base token redeemed.\n /// @return maxXTokenRedeemable The amount of xToken needed.\n function maxRedeemableXToken(uint256 newCollateralRatio)\n external\n view\n returns (uint256 maxBaseOut, uint256 maxXTokenRedeemable);\n\n /// @notice Return the exponential moving average of the leverage ratio.\n function leverageRatio() external view returns (uint256);\n\n /// @notice Convert underlying token amount to wrapped token amount.\n /// @param amount The underlying token amount.\n function getWrapppedValue(uint256 amount) external view returns (uint256);\n\n /// @notice Convert wrapped token amount to underlying token amount.\n /// @param amount The wrapped token amount.\n function getUnderlyingValue(uint256 amount) external view returns (uint256);\n\n /// @notice Return the fee ratio distributed to rebalance pool, multiplied by 1e9.\n function getRebalancePoolRatio() external view returns (uint256);\n\n /// @notice Return the fee ratio distributed to harvester, multiplied by 1e9.\n function getHarvesterRatio() external view returns (uint256);\n\n /****************************\n * Public Mutated Functions *\n ****************************/\n\n /// @notice Initialize the protocol.\n /// @param baseIn The amount of underlying value of the base token used to initialize.\n function initializeProtocol(uint256 baseIn) external returns (uint256 fTokenOut, uint256 xTokenOut);\n\n /// @notice Mint fToken with some base token.\n /// @param baseIn The amount of underlying value of base token deposited.\n /// @param recipient The address of receiver.\n /// @return fTokenOut The amount of fToken minted.\n function mintFToken(uint256 baseIn, address recipient) external returns (uint256 fTokenOut);\n\n /// @notice Mint xToken with some base token.\n /// @param baseIn The amount of underlying value of base token deposited.\n /// @param recipient The address of receiver.\n /// @return xTokenOut The amount of xToken minted.\n function mintXToken(uint256 baseIn, address recipient) external returns (uint256 xTokenOut);\n\n /// @notice Redeem fToken and xToken to base token.\n /// @param fTokenIn The amount of fToken to redeem.\n /// @param xTokenIn The amount of xToken to redeem.\n /// @param owner The owner of the fToken or xToken.\n /// @param baseOut The amount of underlying value of base token redeemed.\n function redeem(\n uint256 fTokenIn,\n uint256 xTokenIn,\n address owner\n ) external returns (uint256 baseOut);\n\n /// @notice Settle the nav of base token, fToken and xToken.\n function settle() external;\n\n /// @notice Transfer some base token to strategy contract.\n /// @param amount The amount of token to transfer.\n function transferToStrategy(uint256 amount) external;\n\n /// @notice Notify base token profit from strategy contract.\n /// @param amount The amount of base token.\n function notifyStrategyProfit(uint256 amount) external;\n\n /// @notice Harvest pending rewards to stability pool.\n function harvest() external;\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "shanghai",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}
}} |
1 | 20,291,284 | 93be05d4db776bd0eb7aa6946ec0c51ea611663b0d245a7faf3dbe92e4bca8cb | 84a308a9f4f40c2667e2309ee982b4e1a0bf2f44ba1c1703374cf2d5e42c0d19 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | 1146cb9f7d8633c5f2ed62ff74ab81cb488780dc | 60c060405234801562000010575f80fd5b506040516200243238038062002432833981016040819052620000339162000067565b6001600160a01b039182166080521660a0526200009d565b80516001600160a01b038116811462000062575f80fd5b919050565b5f806040838503121562000079575f80fd5b62000084836200004b565b915062000094602084016200004b565b90509250929050565b60805160a051612349620000e95f395f81816103f90152610bd001525f818161031c015281816106880152818161094901528181610a2701528181610aca0152610b4d01526123495ff3fe608060405234801561000f575f80fd5b50600436106101e7575f3560e01c806370a0823111610109578063a8694e571161009e578063d505accf1161006e578063d505accf14610456578063d547741f14610469578063dd62ed3e1461047c578063f6dabb561461048f575f80fd5b8063a8694e57146103f4578063a9059cbb1461041b578063bcd897d61461042e578063c1590cd71461044e575f80fd5b806395d89b41116100d957806395d89b41146103bf5780639dc29fac146103c7578063a217fddf146103da578063a457c2d7146103e1575f80fd5b806370a08231146103565780637ecebe001461037e57806384b0196e1461039157806391d14854146103ac575f80fd5b8063313ce5671161017f57806340c10f191161014f57806340c10f19146102de5780634cd88b76146102f15780635b4e128c1461030457806361d027b314610317575f80fd5b8063313ce567146102a15780633644e515146102b057806336568abe146102b857806339509351146102cb575f80fd5b806323b872dd116101ba57806323b872dd1461024d578063248a9ca3146102605780632f2ff15d146102825780632febaa7414610297575f80fd5b806301ffc9a7146101eb57806306fdde0314610213578063095ea7b31461022857806318160ddd1461023b575b5f80fd5b6101fe6101f9366004611c66565b6104a2565b60405190151581526020015b60405180910390f35b61021b6104d8565b60405161020a9190611cda565b6101fe610236366004611d07565b610568565b6035545b60405190815260200161020a565b6101fe61025b366004611d2f565b61057f565b61023f61026e366004611d68565b5f90815260fe602052604090206001015490565b610295610290366004611d7f565b6105a2565b005b61023f6101305481565b6040516012815260200161020a565b61023f6105cb565b6102956102c6366004611d7f565b6105d9565b6101fe6102d9366004611d07565b61065c565b6102956102ec366004611d07565b61067d565b6102956102ff366004611e46565b6106d0565b610295610312366004611d68565b6107a8565b61033e7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161020a565b61023f610364366004611ea6565b6001600160a01b03165f9081526033602052604090205490565b61023f61038c366004611ea6565b61084f565b61039961086c565b60405161020a9796959493929190611ebf565b6101fe6103ba366004611d7f565b610905565b61021b61092f565b6102956103d5366004611d07565b61093e565b61023f5f81565b6101fe6103ef366004611d07565b610991565b61033e7f000000000000000000000000000000000000000000000000000000000000000081565b6101fe610429366004611d07565b610a0b565b61023f61043c366004611ea6565b6101316020525f908152604090205481565b61023f610a18565b610295610464366004611f53565b610c8a565b610295610477366004611d7f565b610deb565b61023f61048a366004611fc0565b610e0f565b61029561049d366004611d68565b610e39565b5f6001600160e01b03198216637965db0b60e01b14806104d257506301ffc9a760e01b6001600160e01b03198316145b92915050565b6060603680546104e790611fe8565b80601f016020809104026020016040519081016040528092919081815260200182805461051390611fe8565b801561055e5780601f106105355761010080835404028352916020019161055e565b820191905f5260205f20905b81548152906001019060200180831161054157829003601f168201915b5050505050905090565b5f33610575818585610e4c565b5060019392505050565b5f3361058c858285610f6f565b610597858585610fe7565b506001949350505050565b5f82815260fe60205260409020600101546105bc8161119b565b6105c683836111a8565b505050565b5f6105d461122d565b905090565b6001600160a01b038116331461064e5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6106588282611236565b5050565b5f3361057581858561066e8383610e0f565b610678919061202e565b610e4c565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146106c65760405163227e980560e01b815260040160405180910390fd5b610658828261129c565b5f54610100900460ff16158080156106ee57505f54600160ff909116105b806107075750303b15801561070757505f5460ff166001145b6107235760405162461bcd60e51b815260040161064590612041565b5f805460ff191660011790558015610744575f805461ff0019166101001790555b61074c611366565b610756838361138e565b61075f836113be565b80156105c6575f805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b5f54600290610100900460ff161580156107c857505f5460ff8083169116105b6107e45760405162461bcd60e51b815260040161064590612041565b5f805461ffff191660ff83161761010017905561080082611407565b61080a5f336111a8565b5f805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15050565b6001600160a01b0381165f908152609960205260408120546104d2565b5f6060805f805f60606065545f801b1480156108885750606654155b6108cc5760405162461bcd60e51b81526020600482015260156024820152741152540dcc4c8e88155b9a5b9a5d1a585b1a5e9959605a1b6044820152606401610645565b6108d461148b565b6108dc61149a565b604080515f80825260208201909252600f60f81b9b939a50919850469750309650945092509050565b5f91825260fe602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6060603780546104e790611fe8565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109875760405163227e980560e01b815260040160405180910390fd5b61065882826114a9565b5f338161099e8286610e0f565b9050838110156109fe5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610645565b6105978286868403610e4c565b5f33610575818585610fe7565b5f80610a2360355490565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663cdc6c7cc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a81573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610aa5919061208f565b15610ab1575f91505090565b805f03610ac757670de0b6b3a764000091505090565b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663ffcf925e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b24573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b4891906120ae565b90505f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166344d90cf96040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ba7573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bcb91906120ae565b90505f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c2a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c4e91906120ae565b905083610c63670de0b6b3a7640000836120c5565b610c6d84866120c5565b610c7791906120dc565b610c8191906120ef565b94505050505090565b83421115610cda5760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e650000006044820152606401610645565b5f7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9888888610d088c6115e6565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090505f610d628261160d565b90505f610d7182878787611639565b9050896001600160a01b0316816001600160a01b031614610dd45760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e617475726500006044820152606401610645565b610ddf8a8a8a610e4c565b50505050505050505050565b5f82815260fe6020526040902060010154610e058161119b565b6105c68383611236565b6001600160a01b039182165f90815260346020908152604080832093909416825291909152205490565b5f610e438161119b565b61065882611407565b6001600160a01b038316610eae5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610645565b6001600160a01b038216610f0f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610645565b6001600160a01b038381165f8181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b5f610f7a8484610e0f565b90505f198114610fe15781811015610fd45760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610645565b610fe18484848403610e4c565b50505050565b6001600160a01b03831661104b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610645565b6001600160a01b0382166110ad5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610645565b6110b883838361165f565b6001600160a01b0383165f908152603360205260409020548181101561112f5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610645565b6001600160a01b038085165f8181526033602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061118e9086815260200190565b60405180910390a3610fe1565b6111a581336116d1565b50565b6111b28282610905565b610658575f82815260fe602090815260408083206001600160a01b03851684529091529020805460ff191660011790556111e93390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b5f6105d461172a565b6112408282610905565b15610658575f82815260fe602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001600160a01b0382166112f25760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610645565b6112fd5f838361165f565b8060355f82825461130e919061202e565b90915550506001600160a01b0382165f818152603360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b5f54610100900460ff1661138c5760405162461bcd60e51b81526004016106459061210e565b565b5f54610100900460ff166113b45760405162461bcd60e51b81526004016106459061210e565b610658828261179d565b5f54610100900460ff166113e45760405162461bcd60e51b81526004016106459061210e565b6111a581604051806040016040528060018152602001603160f81b8152506117dc565b6201518081111561142b576040516327a6162b60e11b815260040160405180910390fd5b6101305480820361144f576040516391171f0360e01b815260040160405180910390fd5b61013082905560408051828152602081018490527fa35891b1e3dd3cde5b3c2daa4942c8fda86ea73e919846d38216cb36b0748d969101610843565b6060606780546104e790611fe8565b6060606880546104e790611fe8565b6001600160a01b0382166115095760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610645565b611514825f8361165f565b6001600160a01b0382165f90815260336020526040902054818110156115875760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610645565b6001600160a01b0383165f8181526033602090815260408083208686039055603580548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b6001600160a01b0381165f9081526099602052604090208054600181018255905b50919050565b5f6104d261161961122d565b8360405161190160f01b8152600281019290925260228201526042902090565b5f805f61164887878787611829565b91509150611655816118e6565b5095945050505050565b6001600160a01b03831661168b57506001600160a01b03165f9081526101316020526040902042905550565b610130546001600160a01b0384165f90815261013160205260409020546116b290426120dc565b10156105c65760405163042e30b760e31b815260040160405180910390fd5b6116db8282610905565b610658576116e881611a2f565b6116f3836020611a41565b604051602001611704929190612159565b60408051601f198184030181529082905262461bcd60e51b825261064591600401611cda565b5f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f611754611bde565b61175c611c36565b60408051602081019490945283019190915260608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b5f54610100900460ff166117c35760405162461bcd60e51b81526004016106459061210e565b60366117cf838261221a565b5060376105c6828261221a565b5f54610100900460ff166118025760405162461bcd60e51b81526004016106459061210e565b606761180e838261221a565b50606861181b828261221a565b50505f606581905560665550565b5f807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561185e57505f905060036118dd565b604080515f8082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156118af573d5f803e3d5ffd5b5050604051601f1901519150506001600160a01b0381166118d7575f600192509250506118dd565b91505f90505b94509492505050565b5f8160048111156118f9576118f96122d6565b036119015750565b6001816004811115611915576119156122d6565b036119625760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610645565b6002816004811115611976576119766122d6565b036119c35760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610645565b60038160048111156119d7576119d76122d6565b036111a55760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610645565b60606104d26001600160a01b03831660145b60605f611a4f8360026120c5565b611a5a90600261202e565b67ffffffffffffffff811115611a7257611a72611da9565b6040519080825280601f01601f191660200182016040528015611a9c576020820181803683370190505b509050600360fc1b815f81518110611ab657611ab66122ea565b60200101906001600160f81b03191690815f1a905350600f60fb1b81600181518110611ae457611ae46122ea565b60200101906001600160f81b03191690815f1a9053505f611b068460026120c5565b611b1190600161202e565b90505b6001811115611b88576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611b4557611b456122ea565b1a60f81b828281518110611b5b57611b5b6122ea565b60200101906001600160f81b03191690815f1a90535060049490941c93611b81816122fe565b9050611b14565b508315611bd75760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610645565b9392505050565b5f80611be861148b565b805190915015611bff578051602090910120919050565b6065548015611c0e5792915050565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4709250505090565b5f80611c4061149a565b805190915015611c57578051602090910120919050565b6066548015611c0e5792915050565b5f60208284031215611c76575f80fd5b81356001600160e01b031981168114611bd7575f80fd5b5f5b83811015611ca7578181015183820152602001611c8f565b50505f910152565b5f8151808452611cc6816020860160208601611c8d565b601f01601f19169290920160200192915050565b602081525f611bd76020830184611caf565b80356001600160a01b0381168114611d02575f80fd5b919050565b5f8060408385031215611d18575f80fd5b611d2183611cec565b946020939093013593505050565b5f805f60608486031215611d41575f80fd5b611d4a84611cec565b9250611d5860208501611cec565b9150604084013590509250925092565b5f60208284031215611d78575f80fd5b5035919050565b5f8060408385031215611d90575f80fd5b82359150611da060208401611cec565b90509250929050565b634e487b7160e01b5f52604160045260245ffd5b5f82601f830112611dcc575f80fd5b813567ffffffffffffffff80821115611de757611de7611da9565b604051601f8301601f19908116603f01168101908282118183101715611e0f57611e0f611da9565b81604052838152866020858801011115611e27575f80fd5b836020870160208301375f602085830101528094505050505092915050565b5f8060408385031215611e57575f80fd5b823567ffffffffffffffff80821115611e6e575f80fd5b611e7a86838701611dbd565b93506020850135915080821115611e8f575f80fd5b50611e9c85828601611dbd565b9150509250929050565b5f60208284031215611eb6575f80fd5b611bd782611cec565b60ff60f81b881681525f602060e081840152611ede60e084018a611caf565b8381036040850152611ef0818a611caf565b606085018990526001600160a01b038816608086015260a0850187905284810360c086015285518082528387019250908301905f5b81811015611f4157835183529284019291840191600101611f25565b50909c9b505050505050505050505050565b5f805f805f805f60e0888a031215611f69575f80fd5b611f7288611cec565b9650611f8060208901611cec565b95506040880135945060608801359350608088013560ff81168114611fa3575f80fd5b9699959850939692959460a0840135945060c09093013592915050565b5f8060408385031215611fd1575f80fd5b611fda83611cec565b9150611da060208401611cec565b600181811c90821680611ffc57607f821691505b60208210810361160757634e487b7160e01b5f52602260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b808201808211156104d2576104d261201a565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b5f6020828403121561209f575f80fd5b81518015158114611bd7575f80fd5b5f602082840312156120be575f80fd5b5051919050565b80820281158282048414176104d2576104d261201a565b818103818111156104d2576104d261201a565b5f8261210957634e487b7160e01b5f52601260045260245ffd5b500490565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081525f8351612190816017850160208801611c8d565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516121c1816028840160208801611c8d565b01602801949350505050565b601f8211156105c6575f81815260208120601f850160051c810160208610156121f35750805b601f850160051c820191505b81811015612212578281556001016121ff565b505050505050565b815167ffffffffffffffff81111561223457612234611da9565b612248816122428454611fe8565b846121cd565b602080601f83116001811461227b575f84156122645750858301515b5f19600386901b1c1916600185901b178555612212565b5f85815260208120601f198616915b828110156122a95788860151825594840194600190910190840161228a565b50858210156122c657878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b5f52602160045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b5f8161230c5761230c61201a565b505f19019056fea2646970667358221220de495b067036b16c037b23e352d05679a9e1f26e7b66698a81bfdc4433c93a4364736f6c63430008140033000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd20000000000000000000000009fcb2c47dab11e38fec4b8c886f63741bfed4c41 | 608060405234801561000f575f80fd5b50600436106101e7575f3560e01c806370a0823111610109578063a8694e571161009e578063d505accf1161006e578063d505accf14610456578063d547741f14610469578063dd62ed3e1461047c578063f6dabb561461048f575f80fd5b8063a8694e57146103f4578063a9059cbb1461041b578063bcd897d61461042e578063c1590cd71461044e575f80fd5b806395d89b41116100d957806395d89b41146103bf5780639dc29fac146103c7578063a217fddf146103da578063a457c2d7146103e1575f80fd5b806370a08231146103565780637ecebe001461037e57806384b0196e1461039157806391d14854146103ac575f80fd5b8063313ce5671161017f57806340c10f191161014f57806340c10f19146102de5780634cd88b76146102f15780635b4e128c1461030457806361d027b314610317575f80fd5b8063313ce567146102a15780633644e515146102b057806336568abe146102b857806339509351146102cb575f80fd5b806323b872dd116101ba57806323b872dd1461024d578063248a9ca3146102605780632f2ff15d146102825780632febaa7414610297575f80fd5b806301ffc9a7146101eb57806306fdde0314610213578063095ea7b31461022857806318160ddd1461023b575b5f80fd5b6101fe6101f9366004611c66565b6104a2565b60405190151581526020015b60405180910390f35b61021b6104d8565b60405161020a9190611cda565b6101fe610236366004611d07565b610568565b6035545b60405190815260200161020a565b6101fe61025b366004611d2f565b61057f565b61023f61026e366004611d68565b5f90815260fe602052604090206001015490565b610295610290366004611d7f565b6105a2565b005b61023f6101305481565b6040516012815260200161020a565b61023f6105cb565b6102956102c6366004611d7f565b6105d9565b6101fe6102d9366004611d07565b61065c565b6102956102ec366004611d07565b61067d565b6102956102ff366004611e46565b6106d0565b610295610312366004611d68565b6107a8565b61033e7f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd281565b6040516001600160a01b03909116815260200161020a565b61023f610364366004611ea6565b6001600160a01b03165f9081526033602052604090205490565b61023f61038c366004611ea6565b61084f565b61039961086c565b60405161020a9796959493929190611ebf565b6101fe6103ba366004611d7f565b610905565b61021b61092f565b6102956103d5366004611d07565b61093e565b61023f5f81565b6101fe6103ef366004611d07565b610991565b61033e7f0000000000000000000000009fcb2c47dab11e38fec4b8c886f63741bfed4c4181565b6101fe610429366004611d07565b610a0b565b61023f61043c366004611ea6565b6101316020525f908152604090205481565b61023f610a18565b610295610464366004611f53565b610c8a565b610295610477366004611d7f565b610deb565b61023f61048a366004611fc0565b610e0f565b61029561049d366004611d68565b610e39565b5f6001600160e01b03198216637965db0b60e01b14806104d257506301ffc9a760e01b6001600160e01b03198316145b92915050565b6060603680546104e790611fe8565b80601f016020809104026020016040519081016040528092919081815260200182805461051390611fe8565b801561055e5780601f106105355761010080835404028352916020019161055e565b820191905f5260205f20905b81548152906001019060200180831161054157829003601f168201915b5050505050905090565b5f33610575818585610e4c565b5060019392505050565b5f3361058c858285610f6f565b610597858585610fe7565b506001949350505050565b5f82815260fe60205260409020600101546105bc8161119b565b6105c683836111a8565b505050565b5f6105d461122d565b905090565b6001600160a01b038116331461064e5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6106588282611236565b5050565b5f3361057581858561066e8383610e0f565b610678919061202e565b610e4c565b336001600160a01b037f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd216146106c65760405163227e980560e01b815260040160405180910390fd5b610658828261129c565b5f54610100900460ff16158080156106ee57505f54600160ff909116105b806107075750303b15801561070757505f5460ff166001145b6107235760405162461bcd60e51b815260040161064590612041565b5f805460ff191660011790558015610744575f805461ff0019166101001790555b61074c611366565b610756838361138e565b61075f836113be565b80156105c6575f805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b5f54600290610100900460ff161580156107c857505f5460ff8083169116105b6107e45760405162461bcd60e51b815260040161064590612041565b5f805461ffff191660ff83161761010017905561080082611407565b61080a5f336111a8565b5f805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15050565b6001600160a01b0381165f908152609960205260408120546104d2565b5f6060805f805f60606065545f801b1480156108885750606654155b6108cc5760405162461bcd60e51b81526020600482015260156024820152741152540dcc4c8e88155b9a5b9a5d1a585b1a5e9959605a1b6044820152606401610645565b6108d461148b565b6108dc61149a565b604080515f80825260208201909252600f60f81b9b939a50919850469750309650945092509050565b5f91825260fe602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6060603780546104e790611fe8565b336001600160a01b037f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd216146109875760405163227e980560e01b815260040160405180910390fd5b61065882826114a9565b5f338161099e8286610e0f565b9050838110156109fe5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610645565b6105978286868403610e4c565b5f33610575818585610fe7565b5f80610a2360355490565b90507f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd26001600160a01b031663cdc6c7cc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a81573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610aa5919061208f565b15610ab1575f91505090565b805f03610ac757670de0b6b3a764000091505090565b5f7f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd26001600160a01b031663ffcf925e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b24573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b4891906120ae565b90505f7f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd26001600160a01b03166344d90cf96040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ba7573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bcb91906120ae565b90505f7f0000000000000000000000009fcb2c47dab11e38fec4b8c886f63741bfed4c416001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c2a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c4e91906120ae565b905083610c63670de0b6b3a7640000836120c5565b610c6d84866120c5565b610c7791906120dc565b610c8191906120ef565b94505050505090565b83421115610cda5760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e650000006044820152606401610645565b5f7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9888888610d088c6115e6565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090505f610d628261160d565b90505f610d7182878787611639565b9050896001600160a01b0316816001600160a01b031614610dd45760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e617475726500006044820152606401610645565b610ddf8a8a8a610e4c565b50505050505050505050565b5f82815260fe6020526040902060010154610e058161119b565b6105c68383611236565b6001600160a01b039182165f90815260346020908152604080832093909416825291909152205490565b5f610e438161119b565b61065882611407565b6001600160a01b038316610eae5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610645565b6001600160a01b038216610f0f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610645565b6001600160a01b038381165f8181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b5f610f7a8484610e0f565b90505f198114610fe15781811015610fd45760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610645565b610fe18484848403610e4c565b50505050565b6001600160a01b03831661104b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610645565b6001600160a01b0382166110ad5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610645565b6110b883838361165f565b6001600160a01b0383165f908152603360205260409020548181101561112f5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610645565b6001600160a01b038085165f8181526033602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061118e9086815260200190565b60405180910390a3610fe1565b6111a581336116d1565b50565b6111b28282610905565b610658575f82815260fe602090815260408083206001600160a01b03851684529091529020805460ff191660011790556111e93390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b5f6105d461172a565b6112408282610905565b15610658575f82815260fe602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001600160a01b0382166112f25760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610645565b6112fd5f838361165f565b8060355f82825461130e919061202e565b90915550506001600160a01b0382165f818152603360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b5f54610100900460ff1661138c5760405162461bcd60e51b81526004016106459061210e565b565b5f54610100900460ff166113b45760405162461bcd60e51b81526004016106459061210e565b610658828261179d565b5f54610100900460ff166113e45760405162461bcd60e51b81526004016106459061210e565b6111a581604051806040016040528060018152602001603160f81b8152506117dc565b6201518081111561142b576040516327a6162b60e11b815260040160405180910390fd5b6101305480820361144f576040516391171f0360e01b815260040160405180910390fd5b61013082905560408051828152602081018490527fa35891b1e3dd3cde5b3c2daa4942c8fda86ea73e919846d38216cb36b0748d969101610843565b6060606780546104e790611fe8565b6060606880546104e790611fe8565b6001600160a01b0382166115095760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610645565b611514825f8361165f565b6001600160a01b0382165f90815260336020526040902054818110156115875760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610645565b6001600160a01b0383165f8181526033602090815260408083208686039055603580548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b6001600160a01b0381165f9081526099602052604090208054600181018255905b50919050565b5f6104d261161961122d565b8360405161190160f01b8152600281019290925260228201526042902090565b5f805f61164887878787611829565b91509150611655816118e6565b5095945050505050565b6001600160a01b03831661168b57506001600160a01b03165f9081526101316020526040902042905550565b610130546001600160a01b0384165f90815261013160205260409020546116b290426120dc565b10156105c65760405163042e30b760e31b815260040160405180910390fd5b6116db8282610905565b610658576116e881611a2f565b6116f3836020611a41565b604051602001611704929190612159565b60408051601f198184030181529082905262461bcd60e51b825261064591600401611cda565b5f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f611754611bde565b61175c611c36565b60408051602081019490945283019190915260608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b5f54610100900460ff166117c35760405162461bcd60e51b81526004016106459061210e565b60366117cf838261221a565b5060376105c6828261221a565b5f54610100900460ff166118025760405162461bcd60e51b81526004016106459061210e565b606761180e838261221a565b50606861181b828261221a565b50505f606581905560665550565b5f807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561185e57505f905060036118dd565b604080515f8082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156118af573d5f803e3d5ffd5b5050604051601f1901519150506001600160a01b0381166118d7575f600192509250506118dd565b91505f90505b94509492505050565b5f8160048111156118f9576118f96122d6565b036119015750565b6001816004811115611915576119156122d6565b036119625760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610645565b6002816004811115611976576119766122d6565b036119c35760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610645565b60038160048111156119d7576119d76122d6565b036111a55760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610645565b60606104d26001600160a01b03831660145b60605f611a4f8360026120c5565b611a5a90600261202e565b67ffffffffffffffff811115611a7257611a72611da9565b6040519080825280601f01601f191660200182016040528015611a9c576020820181803683370190505b509050600360fc1b815f81518110611ab657611ab66122ea565b60200101906001600160f81b03191690815f1a905350600f60fb1b81600181518110611ae457611ae46122ea565b60200101906001600160f81b03191690815f1a9053505f611b068460026120c5565b611b1190600161202e565b90505b6001811115611b88576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611b4557611b456122ea565b1a60f81b828281518110611b5b57611b5b6122ea565b60200101906001600160f81b03191690815f1a90535060049490941c93611b81816122fe565b9050611b14565b508315611bd75760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610645565b9392505050565b5f80611be861148b565b805190915015611bff578051602090910120919050565b6065548015611c0e5792915050565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4709250505090565b5f80611c4061149a565b805190915015611c57578051602090910120919050565b6066548015611c0e5792915050565b5f60208284031215611c76575f80fd5b81356001600160e01b031981168114611bd7575f80fd5b5f5b83811015611ca7578181015183820152602001611c8f565b50505f910152565b5f8151808452611cc6816020860160208601611c8d565b601f01601f19169290920160200192915050565b602081525f611bd76020830184611caf565b80356001600160a01b0381168114611d02575f80fd5b919050565b5f8060408385031215611d18575f80fd5b611d2183611cec565b946020939093013593505050565b5f805f60608486031215611d41575f80fd5b611d4a84611cec565b9250611d5860208501611cec565b9150604084013590509250925092565b5f60208284031215611d78575f80fd5b5035919050565b5f8060408385031215611d90575f80fd5b82359150611da060208401611cec565b90509250929050565b634e487b7160e01b5f52604160045260245ffd5b5f82601f830112611dcc575f80fd5b813567ffffffffffffffff80821115611de757611de7611da9565b604051601f8301601f19908116603f01168101908282118183101715611e0f57611e0f611da9565b81604052838152866020858801011115611e27575f80fd5b836020870160208301375f602085830101528094505050505092915050565b5f8060408385031215611e57575f80fd5b823567ffffffffffffffff80821115611e6e575f80fd5b611e7a86838701611dbd565b93506020850135915080821115611e8f575f80fd5b50611e9c85828601611dbd565b9150509250929050565b5f60208284031215611eb6575f80fd5b611bd782611cec565b60ff60f81b881681525f602060e081840152611ede60e084018a611caf565b8381036040850152611ef0818a611caf565b606085018990526001600160a01b038816608086015260a0850187905284810360c086015285518082528387019250908301905f5b81811015611f4157835183529284019291840191600101611f25565b50909c9b505050505050505050505050565b5f805f805f805f60e0888a031215611f69575f80fd5b611f7288611cec565b9650611f8060208901611cec565b95506040880135945060608801359350608088013560ff81168114611fa3575f80fd5b9699959850939692959460a0840135945060c09093013592915050565b5f8060408385031215611fd1575f80fd5b611fda83611cec565b9150611da060208401611cec565b600181811c90821680611ffc57607f821691505b60208210810361160757634e487b7160e01b5f52602260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b808201808211156104d2576104d261201a565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b5f6020828403121561209f575f80fd5b81518015158114611bd7575f80fd5b5f602082840312156120be575f80fd5b5051919050565b80820281158282048414176104d2576104d261201a565b818103818111156104d2576104d261201a565b5f8261210957634e487b7160e01b5f52601260045260245ffd5b500490565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081525f8351612190816017850160208801611c8d565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516121c1816028840160208801611c8d565b01602801949350505050565b601f8211156105c6575f81815260208120601f850160051c810160208610156121f35750805b601f850160051c820191505b81811015612212578281556001016121ff565b505050505050565b815167ffffffffffffffff81111561223457612234611da9565b612248816122428454611fe8565b846121cd565b602080601f83116001811461227b575f84156122645750858301515b5f19600386901b1c1916600185901b178555612212565b5f85815260208120601f198616915b828110156122a95788860151825594840194600190910190840161228a565b50858210156122c657878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b5f52602160045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b5f8161230c5761230c61201a565b505f19019056fea2646970667358221220de495b067036b16c037b23e352d05679a9e1f26e7b66698a81bfdc4433c93a4364736f6c63430008140033 | {{
"language": "Solidity",
"sources": {
"@openzeppelin/contracts-upgradeable-v4/access/AccessControlUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlUpgradeable.sol\";\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../utils/StringsUpgradeable.sol\";\nimport \"../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\n function __AccessControl_init() internal onlyInitializing {\n }\n\n function __AccessControl_init_unchained() internal onlyInitializing {\n }\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n StringsUpgradeable.toHexString(account),\n \" is missing role \",\n StringsUpgradeable.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * May emit a {RoleGranted} event.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/access/IAccessControlUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControlUpgradeable {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/interfaces/IERC5267Upgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)\n\npragma solidity ^0.8.0;\n\ninterface IERC5267Upgradeable {\n /**\n * @dev MAY be emitted to signal that the domain could have changed.\n */\n event EIP712DomainChanged();\n\n /**\n * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\n * signature.\n */\n function eip712Domain()\n external\n view\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n );\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/proxy/utils/Initializable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/token/ERC20/ERC20Upgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20Upgradeable.sol\";\nimport \"./extensions/IERC20MetadataUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC20_init_unchained(name_, symbol_);\n }\n\n function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(address from, address to, uint256 amount) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n // decrementing then incrementing.\n _balances[to] += amount;\n }\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n unchecked {\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n _balances[account] += amount;\n }\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n // Overflow not possible: amount <= accountBalance <= totalSupply.\n _totalSupply -= amount;\n }\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[45] private __gap;\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/token/ERC20/extensions/ERC20PermitUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/ERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20PermitUpgradeable.sol\";\nimport \"../ERC20Upgradeable.sol\";\nimport \"../../../utils/cryptography/ECDSAUpgradeable.sol\";\nimport \"../../../utils/cryptography/EIP712Upgradeable.sol\";\nimport \"../../../utils/CountersUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * _Available since v3.4._\n *\n * @custom:storage-size 51\n */\nabstract contract ERC20PermitUpgradeable is Initializable, ERC20Upgradeable, IERC20PermitUpgradeable, EIP712Upgradeable {\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n mapping(address => CountersUpgradeable.Counter) private _nonces;\n\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private constant _PERMIT_TYPEHASH =\n keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n /**\n * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.\n * However, to ensure consistency with the upgradeable transpiler, we will continue\n * to reserve a slot.\n * @custom:oz-renamed-from _PERMIT_TYPEHASH\n */\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;\n\n /**\n * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\"1\"`.\n *\n * It's a good idea to use the same `name` that is defined as the ERC20 token name.\n */\n function __ERC20Permit_init(string memory name) internal onlyInitializing {\n __EIP712_init_unchained(name, \"1\");\n }\n\n function __ERC20Permit_init_unchained(string memory) internal onlyInitializing {}\n\n /**\n * @dev See {IERC20Permit-permit}.\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual override {\n require(block.timestamp <= deadline, \"ERC20Permit: expired deadline\");\n\n bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\n\n bytes32 hash = _hashTypedDataV4(structHash);\n\n address signer = ECDSAUpgradeable.recover(hash, v, r, s);\n require(signer == owner, \"ERC20Permit: invalid signature\");\n\n _approve(owner, spender, value);\n }\n\n /**\n * @dev See {IERC20Permit-nonces}.\n */\n function nonces(address owner) public view virtual override returns (uint256) {\n return _nonces[owner].current();\n }\n\n /**\n * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view override returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n /**\n * @dev \"Consume a nonce\": return the current value and increment.\n *\n * _Available since v4.1._\n */\n function _useNonce(address owner) internal virtual returns (uint256 current) {\n CountersUpgradeable.Counter storage nonce = _nonces[owner];\n current = nonce.current();\n nonce.increment();\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/token/ERC20/extensions/IERC20MetadataUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/token/ERC20/extensions/IERC20PermitUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/token/ERC20/IERC20Upgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/AddressUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/ContextUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/CountersUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary CountersUpgradeable {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/cryptography/ECDSAUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../StringsUpgradeable.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSAUpgradeable {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\")\n mstore(0x1c, hash)\n message := keccak256(0x00, 0x3c)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", StringsUpgradeable.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(ptr, \"\\x19\\x01\")\n mstore(add(ptr, 0x02), domainSeparator)\n mstore(add(ptr, 0x22), structHash)\n data := keccak256(ptr, 0x42)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\n * `validator` and `data` according to the version 0 of EIP-191.\n *\n * See {recover}.\n */\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x00\", validator, data));\n }\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/cryptography/EIP712Upgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.8;\n\nimport \"./ECDSAUpgradeable.sol\";\nimport \"../../interfaces/IERC5267Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\n * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the\n * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\n *\n * _Available since v3.4._\n *\n * @custom:storage-size 52\n */\nabstract contract EIP712Upgradeable is Initializable, IERC5267Upgradeable {\n bytes32 private constant _TYPE_HASH =\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n /// @custom:oz-renamed-from _HASHED_NAME\n bytes32 private _hashedName;\n /// @custom:oz-renamed-from _HASHED_VERSION\n bytes32 private _hashedVersion;\n\n string private _name;\n string private _version;\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\n __EIP712_init_unchained(name, version);\n }\n\n function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\n _name = name;\n _version = version;\n\n // Reset prior values in storage if upgrading\n _hashedName = 0;\n _hashedVersion = 0;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n return _buildDomainSeparator();\n }\n\n function _buildDomainSeparator() private view returns (bytes32) {\n return keccak256(abi.encode(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash(), block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n\n /**\n * @dev See {EIP-5267}.\n *\n * _Available since v4.9._\n */\n function eip712Domain()\n public\n view\n virtual\n override\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n )\n {\n // If the hashed name and version in storage are non-zero, the contract hasn't been properly initialized\n // and the EIP712 domain is not reliable, as it will be missing name and version.\n require(_hashedName == 0 && _hashedVersion == 0, \"EIP712: Uninitialized\");\n\n return (\n hex\"0f\", // 01111\n _EIP712Name(),\n _EIP712Version(),\n block.chainid,\n address(this),\n bytes32(0),\n new uint256[](0)\n );\n }\n\n /**\n * @dev The name parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712Name() internal virtual view returns (string memory) {\n return _name;\n }\n\n /**\n * @dev The version parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712Version() internal virtual view returns (string memory) {\n return _version;\n }\n\n /**\n * @dev The hash of the name parameter for the EIP712 domain.\n *\n * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Name` instead.\n */\n function _EIP712NameHash() internal view returns (bytes32) {\n string memory name = _EIP712Name();\n if (bytes(name).length > 0) {\n return keccak256(bytes(name));\n } else {\n // If the name is empty, the contract may have been upgraded without initializing the new storage.\n // We return the name hash in storage if non-zero, otherwise we assume the name is empty by design.\n bytes32 hashedName = _hashedName;\n if (hashedName != 0) {\n return hashedName;\n } else {\n return keccak256(\"\");\n }\n }\n }\n\n /**\n * @dev The hash of the version parameter for the EIP712 domain.\n *\n * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Version` instead.\n */\n function _EIP712VersionHash() internal view returns (bytes32) {\n string memory version = _EIP712Version();\n if (bytes(version).length > 0) {\n return keccak256(bytes(version));\n } else {\n // If the version is empty, the contract may have been upgraded without initializing the new storage.\n // We return the version hash in storage if non-zero, otherwise we assume the version is empty by design.\n bytes32 hashedVersion = _hashedVersion;\n if (hashedVersion != 0) {\n return hashedVersion;\n } else {\n return keccak256(\"\");\n }\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[48] private __gap;\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/introspection/ERC165Upgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/introspection/IERC165Upgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/math/MathUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/math/SignedMathUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMathUpgradeable {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n"
},
"@openzeppelin/contracts-upgradeable-v4/utils/StringsUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SignedMathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMathUpgradeable.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n"
},
"contracts/f(x)/v2/LeveragedTokenV2.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity =0.8.20;\n\nimport { AccessControlUpgradeable } from \"@openzeppelin/contracts-upgradeable-v4/access/AccessControlUpgradeable.sol\";\nimport { ERC20PermitUpgradeable } from \"@openzeppelin/contracts-upgradeable-v4/token/ERC20/extensions/ERC20PermitUpgradeable.sol\";\nimport { ERC20Upgradeable } from \"@openzeppelin/contracts-upgradeable-v4/token/ERC20/ERC20Upgradeable.sol\";\nimport { IERC20Upgradeable } from \"@openzeppelin/contracts-upgradeable-v4/token/ERC20/IERC20Upgradeable.sol\";\n\nimport { IFxFractionalTokenV2 } from \"../../interfaces/f(x)/IFxFractionalTokenV2.sol\";\nimport { IFxLeveragedTokenV2 } from \"../../interfaces/f(x)/IFxLeveragedTokenV2.sol\";\nimport { IFxTreasuryV2 } from \"../../interfaces/f(x)/IFxTreasuryV2.sol\";\n\ncontract LeveragedTokenV2 is ERC20PermitUpgradeable, AccessControlUpgradeable, IFxLeveragedTokenV2 {\n /**********\n * Events *\n **********/\n\n /// @notice Emitted when the cooling-off period is updated.\n /// @param oldValue The value of the previous cooling-off period.\n /// @param newValue The value of the current cooling-off period.\n event UpdateCoolingOffPeriod(uint256 oldValue, uint256 newValue);\n\n /**********\n * Errors *\n **********/\n\n /// @dev Thrown when users try to transfer token before cooling-off period.\n error ErrorTransferBeforeCoolingOffPeriod();\n\n /// @dev Thrown when the updated `coolingOffPeriod` is larger than `MAX_COOLING_OFF_PERIOD`.\n error ErrorCoolingOffPeriodTooLarge();\n\n /// @dev Thrown when update some parameters to the same value.\n error ErrorParameterUnchanged();\n\n /*************\n * Constants *\n *************/\n\n /// @notice The address of Treasury contract.\n address public immutable treasury;\n\n /// @notice The address of Fractional Token contract.\n address public immutable fToken;\n\n /// @dev The precision used to compute nav.\n uint256 private constant PRECISION = 1e18;\n\n /// @dev The maximum value of `coolingOffPeriod`.\n uint256 private constant MAX_COOLING_OFF_PERIOD = 1 days;\n\n /// @notice The minimum hold seconds after minting.\n uint256 public coolingOffPeriod;\n\n /// @notice Mapping from account address of latest token mint timestamp.\n mapping(address => uint256) public mintAt;\n\n /*************\n * Modifiers *\n *************/\n\n modifier onlyTreasury() {\n if (msg.sender != treasury) revert ErrorCallerIsNotTreasury();\n _;\n }\n\n /***************\n * Constructor *\n ***************/\n\n constructor(address _treasury, address _fToken) {\n treasury = _treasury;\n fToken = _fToken;\n }\n\n function initialize(string memory _name, string memory _symbol) external initializer {\n __Context_init();\n __ERC20_init(_name, _symbol);\n __ERC20Permit_init(_name);\n }\n\n function initializeV2(uint256 _coolingOffPeriod) external reinitializer(2) {\n _updateCoolingOffPeriod(_coolingOffPeriod);\n\n _grantRole(DEFAULT_ADMIN_ROLE, _msgSender());\n }\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @inheritdoc IFxLeveragedTokenV2\n function nav() external view override returns (uint256) {\n uint256 _xSupply = totalSupply();\n if (IFxTreasuryV2(treasury).isUnderCollateral()) {\n return 0;\n } else if (_xSupply == 0) {\n return PRECISION;\n } else {\n uint256 baseNav = IFxTreasuryV2(treasury).currentBaseTokenPrice();\n uint256 baseSupply = IFxTreasuryV2(treasury).totalBaseToken();\n uint256 fSupply = IERC20Upgradeable(fToken).totalSupply();\n return (baseNav * baseSupply - fSupply * PRECISION) / _xSupply;\n }\n }\n\n /****************************\n * Public Mutated Functions *\n ****************************/\n\n /// @inheritdoc IFxLeveragedTokenV2\n function mint(address _to, uint256 _amount) external override onlyTreasury {\n _mint(_to, _amount);\n }\n\n /// @inheritdoc IFxLeveragedTokenV2\n function burn(address _from, uint256 _amount) external override onlyTreasury {\n _burn(_from, _amount);\n }\n\n /************************\n * Restricted Functions *\n ************************/\n\n /// @notice Update the cooling-off period.\n /// @param _coolingOffPeriod The value of new cooling-off period.\n function updateCoolingOffPeriod(uint256 _coolingOffPeriod) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _updateCoolingOffPeriod(_coolingOffPeriod);\n }\n\n /**********************\n * Internal Functions *\n **********************/\n\n /// @dev Internal function to update cooling-off period.\n /// @param _newCoolingOffPeriod The value of new cooling-off period.\n function _updateCoolingOffPeriod(uint256 _newCoolingOffPeriod) private {\n if (_newCoolingOffPeriod > MAX_COOLING_OFF_PERIOD) {\n revert ErrorCoolingOffPeriodTooLarge();\n }\n uint256 oldCoolingOffPeriod = coolingOffPeriod;\n if (_newCoolingOffPeriod == oldCoolingOffPeriod) {\n revert ErrorParameterUnchanged();\n }\n\n coolingOffPeriod = _newCoolingOffPeriod;\n\n emit UpdateCoolingOffPeriod(oldCoolingOffPeriod, _newCoolingOffPeriod);\n }\n\n /// @inheritdoc ERC20Upgradeable\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 /*amount*/\n ) internal virtual override {\n if (from == address(0)) {\n mintAt[to] = block.timestamp;\n } else if (block.timestamp - mintAt[from] < coolingOffPeriod) {\n revert ErrorTransferBeforeCoolingOffPeriod();\n }\n }\n}\n"
},
"contracts/interfaces/f(x)/IFxFractionalTokenV2.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IFxFractionalTokenV2 {\n /**********\n * Errors *\n **********/\n\n /// @dev Thrown when caller is not treasury contract.\n error ErrorCallerIsNotTreasury();\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @notice Return the net asset value for the token, multipled by 1e18.\n function nav() external view returns (uint256);\n\n /****************************\n * Public Mutated Functions *\n ****************************/\n\n /// @notice Mint some token to someone.\n /// @param to The address of recipient.\n /// @param amount The amount of token to mint.\n function mint(address to, uint256 amount) external;\n\n /// @notice Burn some token from someone.\n /// @param from The address of owner to burn.\n /// @param amount The amount of token to burn.\n function burn(address from, uint256 amount) external;\n}\n"
},
"contracts/interfaces/f(x)/IFxLeveragedTokenV2.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IFxLeveragedTokenV2 {\n /**********\n * Errors *\n **********/\n\n /// @dev Thrown when caller is not treasury contract.\n error ErrorCallerIsNotTreasury();\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @notice Return the net asset value for the token.\n function nav() external view returns (uint256);\n\n /****************************\n * Public Mutated Functions *\n ****************************/\n\n /// @notice Mint some token to someone.\n /// @param to The address of recipient.\n /// @param amount The amount of token to mint.\n function mint(address to, uint256 amount) external;\n\n /// @notice Burn some token from someone.\n /// @param from The address of owner to burn.\n /// @param amount The amount of token to burn.\n function burn(address from, uint256 amount) external;\n}\n"
},
"contracts/interfaces/f(x)/IFxTreasuryV2.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IFxTreasuryV2 {\n /**********\n * Events *\n **********/\n\n /// @notice Emitted when the platform contract is updated.\n /// @param oldPlatform The address of previous platform contract.\n /// @param newPlatform The address of current platform contract.\n event UpdatePlatform(address indexed oldPlatform, address indexed newPlatform);\n\n /// @notice Emitted when the RebalancePoolSplitter contract is updated.\n /// @param oldRebalancePoolSplitter The address of previous RebalancePoolSplitter contract.\n /// @param newRebalancePoolSplitter The address of current RebalancePoolSplitter.\n event UpdateRebalancePoolSplitter(address indexed oldRebalancePoolSplitter, address indexed newRebalancePoolSplitter);\n\n /// @notice Emitted when the price oracle contract is updated.\n /// @param oldPriceOracle The address of previous price oracle.\n /// @param newPriceOracle The address of current price oracle.\n event UpdatePriceOracle(address indexed oldPriceOracle, address indexed newPriceOracle);\n\n /// @notice Emitted when the strategy contract is updated.\n /// @param oldStrategy The address of previous strategy.\n /// @param newStrategy The address of current strategy.\n event UpdateStrategy(address indexed oldStrategy, address indexed newStrategy);\n\n /// @notice Emitted when the base token cap is updated.\n /// @param oldBaseTokenCap The value of previous base token cap.\n /// @param newBaseTokenCap The value of current base token cap.\n event UpdateBaseTokenCap(uint256 oldBaseTokenCap, uint256 newBaseTokenCap);\n\n /// @notice Emitted when the EMA sample interval is updated.\n /// @param oldSampleInterval The value of previous EMA sample interval.\n /// @param newSampleInterval The value of current EMA sample interval.\n event UpdateEMASampleInterval(uint256 oldSampleInterval, uint256 newSampleInterval);\n\n /// @notice Emitted when the reference price is updated.\n /// @param oldPrice The value of previous reference price.\n /// @param newPrice The value of current reference price.\n event Settle(uint256 oldPrice, uint256 newPrice);\n\n /// @notice Emitted when the ratio for rebalance pool is updated.\n /// @param oldRatio The value of the previous ratio, multiplied by 1e9.\n /// @param newRatio The value of the current ratio, multiplied by 1e9.\n event UpdateRebalancePoolRatio(uint256 oldRatio, uint256 newRatio);\n\n /// @notice Emitted when the ratio for harvester is updated.\n /// @param oldRatio The value of the previous ratio, multiplied by 1e9.\n /// @param newRatio The value of the current ratio, multiplied by 1e9.\n event UpdateHarvesterRatio(uint256 oldRatio, uint256 newRatio);\n\n /// @notice Emitted when someone harvest pending stETH rewards.\n /// @param caller The address of caller.\n /// @param totalRewards The amount of total harvested rewards.\n /// @param rebalancePoolRewards The amount of harvested rewards distributed to stability pool.\n /// @param harvestBounty The amount of harvested rewards distributed to caller as harvest bounty.\n event Harvest(address indexed caller, uint256 totalRewards, uint256 rebalancePoolRewards, uint256 harvestBounty);\n\n /**********\n * Errors *\n **********/\n\n /// @dev Thrown when the collateral ratio is smaller than 100%.\n error ErrorCollateralRatioTooSmall();\n\n /// @dev Thrown when mint exceed total capacity.\n error ErrorExceedTotalCap();\n\n /// @dev Thrown when the oracle price is invalid.\n error ErrorInvalidOraclePrice();\n\n /// @dev Thrown when the twap price is invalid.\n error ErrorInvalidTwapPrice();\n\n /// @dev Thrown when initialize protocol twice.\n error ErrorProtocolInitialized();\n\n /// @dev Thrown when the initial amount of base token is not enough.\n error ErrorInsufficientInitialBaseToken();\n\n /// @dev Thrown when current is under collateral.\n error ErrorUnderCollateral();\n\n /// @dev Thrown when the sample internal for EMA is too small.\n error ErrorEMASampleIntervalTooSmall();\n\n /// @dev Thrown when the expense ratio exceeds `MAX_REBALANCE_POOL_RATIO`.\n error ErrorRebalancePoolRatioTooLarge();\n\n /// @dev Thrown when the harvester ratio exceeds `MAX_HARVESTER_RATIO`.\n error ErrorHarvesterRatioTooLarge();\n\n /// @dev Thrown when the given address is zero.\n error ErrorZeroAddress();\n\n /*********\n * Enums *\n *********/\n\n enum Action {\n None,\n MintFToken,\n MintXToken,\n RedeemFToken,\n RedeemXToken\n }\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @notice Return the address of price oracle contract.\n function priceOracle() external view returns (address);\n\n /// @notice Return the address of base token.\n function baseToken() external view returns (address);\n\n /// @notice Return the address fractional base token.\n function fToken() external view returns (address);\n\n /// @notice Return the address leveraged base token.\n function xToken() external view returns (address);\n\n /// @notice The reference base token price.\n function referenceBaseTokenPrice() external view returns (uint256);\n\n /// @notice The current base token price.\n function currentBaseTokenPrice() external view returns (uint256);\n\n /// @notice Return whether the price is valid.\n function isBaseTokenPriceValid() external view returns (bool);\n\n /// @notice Return the total amount of underlying value of base token deposited.\n function totalBaseToken() external view returns (uint256);\n\n /// @notice Return the address of strategy contract.\n function strategy() external view returns (address);\n\n /// @notice Return the total amount of base token managed by strategy.\n function strategyUnderlying() external view returns (uint256);\n\n /// @notice Return the current collateral ratio of fToken, multiplied by 1e18.\n function collateralRatio() external view returns (uint256);\n\n /// @notice Return whether the system is under collateral.\n function isUnderCollateral() external view returns (bool);\n\n /// @notice Compute the amount of base token needed to reach the new collateral ratio.\n /// @param newCollateralRatio The target collateral ratio, multiplied by 1e18.\n /// @return maxBaseIn The amount of underlying value of base token needed.\n /// @return maxFTokenMintable The amount of fToken can be minted.\n function maxMintableFToken(uint256 newCollateralRatio)\n external\n view\n returns (uint256 maxBaseIn, uint256 maxFTokenMintable);\n\n /// @notice Compute the amount of base token needed to reach the new collateral ratio.\n /// @param newCollateralRatio The target collateral ratio, multiplied by 1e18.\n /// @return maxBaseIn The amount of underlying value of base token needed.\n /// @return maxXTokenMintable The amount of xToken can be minted.\n function maxMintableXToken(uint256 newCollateralRatio)\n external\n view\n returns (uint256 maxBaseIn, uint256 maxXTokenMintable);\n\n /// @notice Compute the amount of fToken needed to reach the new collateral ratio.\n /// @param newCollateralRatio The target collateral ratio, multiplied by 1e18.\n /// @return maxBaseOut The amount of underlying value of base token redeemed.\n /// @return maxFTokenRedeemable The amount of fToken needed.\n function maxRedeemableFToken(uint256 newCollateralRatio)\n external\n view\n returns (uint256 maxBaseOut, uint256 maxFTokenRedeemable);\n\n /// @notice Compute the amount of xToken needed to reach the new collateral ratio.\n /// @param newCollateralRatio The target collateral ratio, multiplied by 1e18.\n /// @return maxBaseOut The amount of underlying value of base token redeemed.\n /// @return maxXTokenRedeemable The amount of xToken needed.\n function maxRedeemableXToken(uint256 newCollateralRatio)\n external\n view\n returns (uint256 maxBaseOut, uint256 maxXTokenRedeemable);\n\n /// @notice Return the exponential moving average of the leverage ratio.\n function leverageRatio() external view returns (uint256);\n\n /// @notice Convert underlying token amount to wrapped token amount.\n /// @param amount The underlying token amount.\n function getWrapppedValue(uint256 amount) external view returns (uint256);\n\n /// @notice Convert wrapped token amount to underlying token amount.\n /// @param amount The wrapped token amount.\n function getUnderlyingValue(uint256 amount) external view returns (uint256);\n\n /// @notice Return the fee ratio distributed to rebalance pool, multiplied by 1e9.\n function getRebalancePoolRatio() external view returns (uint256);\n\n /// @notice Return the fee ratio distributed to harvester, multiplied by 1e9.\n function getHarvesterRatio() external view returns (uint256);\n\n /****************************\n * Public Mutated Functions *\n ****************************/\n\n /// @notice Initialize the protocol.\n /// @param baseIn The amount of underlying value of the base token used to initialize.\n function initializeProtocol(uint256 baseIn) external returns (uint256 fTokenOut, uint256 xTokenOut);\n\n /// @notice Mint fToken with some base token.\n /// @param baseIn The amount of underlying value of base token deposited.\n /// @param recipient The address of receiver.\n /// @return fTokenOut The amount of fToken minted.\n function mintFToken(uint256 baseIn, address recipient) external returns (uint256 fTokenOut);\n\n /// @notice Mint xToken with some base token.\n /// @param baseIn The amount of underlying value of base token deposited.\n /// @param recipient The address of receiver.\n /// @return xTokenOut The amount of xToken minted.\n function mintXToken(uint256 baseIn, address recipient) external returns (uint256 xTokenOut);\n\n /// @notice Redeem fToken and xToken to base token.\n /// @param fTokenIn The amount of fToken to redeem.\n /// @param xTokenIn The amount of xToken to redeem.\n /// @param owner The owner of the fToken or xToken.\n /// @param baseOut The amount of underlying value of base token redeemed.\n function redeem(\n uint256 fTokenIn,\n uint256 xTokenIn,\n address owner\n ) external returns (uint256 baseOut);\n\n /// @notice Settle the nav of base token, fToken and xToken.\n function settle() external;\n\n /// @notice Transfer some base token to strategy contract.\n /// @param amount The amount of token to transfer.\n function transferToStrategy(uint256 amount) external;\n\n /// @notice Notify base token profit from strategy contract.\n /// @param amount The amount of base token.\n function notifyStrategyProfit(uint256 amount) external;\n\n /// @notice Harvest pending rewards to stability pool.\n function harvest() external;\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "shanghai",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}
}} |
1 | 20,291,287 | f2adf8a18c2ded13de332b6f9587df566bf24b1d0c0159feed34f08776b81ddc | 4d993b55b92c5414582215fc64ea8304cfc443aa47428865d4af1f8d2692d87c | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | 05abfad11c275f91cc79f6ec507cb273e9f59de7 | 61014060405234801562000011575f80fd5b5060405162001baa38038062001baa8339810160408190526200003491620002ef565b5f826001600160a01b03166361d027b36040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000072573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019062000098919062000325565b6001600160a01b03808516608052811660a08190526040805163c55dae6360e01b81529051929350909163c55dae63916004808201926020929091908290030181865afa158015620000ec573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019062000112919062000325565b6001600160a01b031660c0816001600160a01b031681525050806001600160a01b031663a8694e576040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000168573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906200018e919062000325565b6001600160a01b031660e0816001600160a01b031681525050806001600160a01b031663088b699e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015620001e4573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906200020a919062000325565b6001600160a01b03908116610100528216610120526200022b5f3362000234565b50505062000348565b5f828152602081815260408083206001600160a01b038516845290915290205460ff16620002cf575f828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556200028e3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b80516001600160a01b0381168114620002ea575f80fd5b919050565b5f806040838503121562000301575f80fd5b6200030c83620002d3565b91506200031c60208401620002d3565b90509250929050565b5f6020828403121562000336575f80fd5b6200034182620002d3565b9392505050565b60805160a05160c05160e0516101005161012051611795620004155f395f81816102cc015281816106420152818161069e0152818161070f015281816108f70152818161097801528181610bf70152610c3101525f818161019e0152610c9e01525f81816103470152818161067c0152610c6a01525f818161036e0152818161048401528181610504015281816106da0152818161093b0152610cf501525f818161029301528181610526015261056d01525f818161030601528181610a150152610ab101526117955ff3fe608060405234801561000f575f80fd5b506004361061016d575f3560e01c806351cff8d9116100d957806391d1485411610093578063c55dae631161006e578063c55dae6314610369578063ce7c2ac214610390578063d5391393146103af578063d547741f146103d6575f80fd5b806391d1485414610328578063a217fddf1461033b578063a8694e5714610342575f80fd5b806351cff8d91461027b57806361d027b31461028e5780636af7589d146102b55780636dbe4bb9146102c75780636e553f65146102ee57806380f5560514610301575f80fd5b80631cf6a9fa1161012a5780631cf6a9fa1461020e578063248a9ca3146102175780632f2ff15d1461023957806336568abe1461024c5780633a98ef391461025f5780633d6af8d514610268575f80fd5b806301ffc9a714610171578063088b699e146101995780631249c58b146101d857806313781264146101e2578063158ef93e146101f95780631b23532114610206575b5f80fd5b61018461017f3660046114c6565b6103e9565b60405190151581526020015b60405180910390f35b6101c07f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610190565b6101e061041f565b005b6101eb60045481565b604051908152602001610190565b6005546101849060ff1681565b6101e0610781565b6101eb60035481565b6101eb6102253660046114ed565b5f9081526020819052604090206001015490565b6101e061024736600461151f565b6107d1565b6101e061025a36600461151f565b6107fa565b6101eb60025481565b6101eb610276366004611549565b61087d565b6101e0610289366004611571565b610b58565b6101c07f000000000000000000000000000000000000000000000000000000000000000081565b60055461018490610100900460ff1681565b6101c07f000000000000000000000000000000000000000000000000000000000000000081565b6101e06102fc36600461151f565b610ccc565b6101c07f000000000000000000000000000000000000000000000000000000000000000081565b61018461033636600461151f565b610d6d565b6101eb5f81565b6101c07f000000000000000000000000000000000000000000000000000000000000000081565b6101c07f000000000000000000000000000000000000000000000000000000000000000081565b6101eb61039e366004611571565b60016020525f908152604090205481565b6101eb7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6101e06103e436600461151f565b610d95565b5f6001600160e01b03198216637965db0b60e01b148061041957506301ffc9a760e01b6001600160e01b03198316145b92915050565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a661044981610db9565b60055460ff161561046d57604051630dc53f8d60e21b815260040160405180910390fd5b6040516370a0823160e01b81523060048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156104d1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104f5919061158a565b905061054b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000167f000000000000000000000000000000000000000000000000000000000000000083610dc6565b60405163207f377360e11b8152600481018290525f9081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063076079a19082906340fe6ee690602401602060405180830381865afa1580156105ba573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105de919061158a565b6040518263ffffffff1660e01b81526004016105fc91815260200190565b60408051808303815f875af1158015610617573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061063b91906115a1565b90925090507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031615610767576106c36001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000167f000000000000000000000000000000000000000000000000000000000000000084610e29565b604051632e0a8aaf60e11b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018490523060448301527f00000000000000000000000000000000000000000000000000000000000000001690635c15155e906064015f604051808303815f87803b158015610750575f80fd5b505af1158015610762573d5f803e3d5ffd5b505050505b60039190915560045550506005805460ff19166001179055565b5f61078b81610db9565b6005805461ff001981166101009182900460ff16159091021790556040517fcecce16fb48394242f0c4cccbcc83b1a814bb13cc4e0160f6546f6a4b0c18de9905f90a150565b5f828152602081905260409020600101546107eb81610db9565b6107f58383610f3c565b505050565b6001600160a01b038116331461086f5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6108798282610fbf565b5050565b6005545f9060ff166108a2576040516314afe08360e01b815260040160405180910390fd5b335f9081526001602052604081208054908290556002546003549192909182906108cc90856115d7565b6108d691906115ee565b90505f82600454856108e891906115d7565b6108f291906115ee565b90505f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316156109e95760405163f3f094a160e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660048301526024820185905289811660448301525f60648301527f0000000000000000000000000000000000000000000000000000000000000000169063f3f094a19060840160408051808303815f875af11580156109bd573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109e191906115a1565b509050610a82565b6040516368674c7d60e11b8152600481018490526001600160a01b0389811660248301525f60448301527f0000000000000000000000000000000000000000000000000000000000000000169063d0ce98fa9060640160408051808303815f875af1158015610a5a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a7e91906115a1565b5090505b6040516372b790db60e01b8152600481018390526001600160a01b0389811660248301525f60448301819052917f0000000000000000000000000000000000000000000000000000000000000000909116906372b790db906064016020604051808303815f875af1158015610af9573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b1d919061158a565b9050610b29828261160d565b965087871015610b4c57604051630843673360e31b815260040160405180910390fd5b50505050505092915050565b60055460ff16610b7b576040516314afe08360e01b815260040160405180910390fd5b600554610100900460ff16610ba357604051631494770360e11b815260040160405180910390fd5b335f908152600160205260408120805490829055600254600354919290918290610bcd90856115d7565b610bd791906115ee565b90505f8260045485610be991906115d7565b610bf391906115ee565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031615610c5d57610c586001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168684610dc6565b610c91565b610c916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168684610dc6565b610cc56001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168683610dc6565b5050505050565b60055460ff1615610cf057604051630dc53f8d60e21b815260040160405180910390fd5b610d257f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316333085611023565b6001600160a01b0381165f9081526001602052604081208054849290610d4c90849061160d565b925050819055508160025f828254610d64919061160d565b90915550505050565b5f918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b5f82815260208190526040902060010154610daf81610db9565b6107f58383610fbf565b610dc38133611061565b50565b6040516001600160a01b0383166024820152604481018290526107f590849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526110ba565b801580610ea15750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015610e7b573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e9f919061158a565b155b610f0c5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610866565b6040516001600160a01b0383166024820152604481018290526107f590849063095ea7b360e01b90606401610df2565b610f468282610d6d565b610879575f828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610f7b3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610fc98282610d6d565b15610879575f828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6040516001600160a01b038085166024830152831660448201526064810182905261105b9085906323b872dd60e01b90608401610df2565b50505050565b61106b8282610d6d565b610879576110788161118d565b61108383602061119f565b604051602001611094929190611642565b60408051601f198184030181529082905262461bcd60e51b8252610866916004016116b6565b5f61110e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661133c9092919063ffffffff16565b905080515f148061112e57508080602001905181019061112e91906116e8565b6107f55760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610866565b60606104196001600160a01b03831660145b60605f6111ad8360026115d7565b6111b890600261160d565b67ffffffffffffffff8111156111d0576111d0611707565b6040519080825280601f01601f1916602001820160405280156111fa576020820181803683370190505b509050600360fc1b815f815181106112145761121461171b565b60200101906001600160f81b03191690815f1a905350600f60fb1b816001815181106112425761124261171b565b60200101906001600160f81b03191690815f1a9053505f6112648460026115d7565b61126f90600161160d565b90505b60018111156112e6576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106112a3576112a361171b565b1a60f81b8282815181106112b9576112b961171b565b60200101906001600160f81b03191690815f1a90535060049490941c936112df8161172f565b9050611272565b5083156113355760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610866565b9392505050565b606061134a84845f85611352565b949350505050565b6060824710156113b35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610866565b5f80866001600160a01b031685876040516113ce9190611744565b5f6040518083038185875af1925050503d805f8114611408576040519150601f19603f3d011682016040523d82523d5f602084013e61140d565b606091505b509150915061141e87838387611429565b979650505050505050565b606083156114975782515f03611490576001600160a01b0385163b6114905760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610866565b508161134a565b61134a83838151156114ac5781518083602001fd5b8060405162461bcd60e51b815260040161086691906116b6565b5f602082840312156114d6575f80fd5b81356001600160e01b031981168114611335575f80fd5b5f602082840312156114fd575f80fd5b5035919050565b80356001600160a01b038116811461151a575f80fd5b919050565b5f8060408385031215611530575f80fd5b8235915061154060208401611504565b90509250929050565b5f806040838503121561155a575f80fd5b61156383611504565b946020939093013593505050565b5f60208284031215611581575f80fd5b61133582611504565b5f6020828403121561159a575f80fd5b5051919050565b5f80604083850312156115b2575f80fd5b505080516020909101519092909150565b634e487b7160e01b5f52601160045260245ffd5b8082028115828204841417610419576104196115c3565b5f8261160857634e487b7160e01b5f52601260045260245ffd5b500490565b80820180821115610419576104196115c3565b5f5b8381101561163a578181015183820152602001611622565b50505f910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081525f8351611679816017850160208801611620565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516116aa816028840160208801611620565b01602801949350505050565b602081525f82518060208401526116d4816040850160208701611620565b601f01601f19169190910160400192915050565b5f602082840312156116f8575f80fd5b81518015158114611335575f80fd5b634e487b7160e01b5f52604160045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b5f8161173d5761173d6115c3565b505f190190565b5f8251611755818460208701611620565b919091019291505056fea2646970667358221220927ae646d7c976fb352826c038a5c87e089dfe02d665a60289f0945179f3dad764736f6c634300081400330000000000000000000000008e3815ef103b8d8528778969cd53baa2e94be25e0000000000000000000000009f0d5e33617a1db6f1cbd5580834422684f09269 | 608060405234801561000f575f80fd5b506004361061016d575f3560e01c806351cff8d9116100d957806391d1485411610093578063c55dae631161006e578063c55dae6314610369578063ce7c2ac214610390578063d5391393146103af578063d547741f146103d6575f80fd5b806391d1485414610328578063a217fddf1461033b578063a8694e5714610342575f80fd5b806351cff8d91461027b57806361d027b31461028e5780636af7589d146102b55780636dbe4bb9146102c75780636e553f65146102ee57806380f5560514610301575f80fd5b80631cf6a9fa1161012a5780631cf6a9fa1461020e578063248a9ca3146102175780632f2ff15d1461023957806336568abe1461024c5780633a98ef391461025f5780633d6af8d514610268575f80fd5b806301ffc9a714610171578063088b699e146101995780631249c58b146101d857806313781264146101e2578063158ef93e146101f95780631b23532114610206575b5f80fd5b61018461017f3660046114c6565b6103e9565b60405190151581526020015b60405180910390f35b6101c07f000000000000000000000000b90d347e10a085b591955cbd0603ac7866fcadc881565b6040516001600160a01b039091168152602001610190565b6101e061041f565b005b6101eb60045481565b604051908152602001610190565b6005546101849060ff1681565b6101e0610781565b6101eb60035481565b6101eb6102253660046114ed565b5f9081526020819052604090206001015490565b6101e061024736600461151f565b6107d1565b6101e061025a36600461151f565b6107fa565b6101eb60025481565b6101eb610276366004611549565b61087d565b6101e0610289366004611571565b610b58565b6101c07f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd281565b60055461018490610100900460ff1681565b6101c07f0000000000000000000000009f0d5e33617a1db6f1cbd5580834422684f0926981565b6101e06102fc36600461151f565b610ccc565b6101c07f0000000000000000000000008e3815ef103b8d8528778969cd53baa2e94be25e81565b61018461033636600461151f565b610d6d565b6101eb5f81565b6101c07f0000000000000000000000009fcb2c47dab11e38fec4b8c886f63741bfed4c4181565b6101c07f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb77781565b6101eb61039e366004611571565b60016020525f908152604090205481565b6101eb7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6101e06103e436600461151f565b610d95565b5f6001600160e01b03198216637965db0b60e01b148061041957506301ffc9a760e01b6001600160e01b03198316145b92915050565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a661044981610db9565b60055460ff161561046d57604051630dc53f8d60e21b815260040160405180910390fd5b6040516370a0823160e01b81523060048201525f907f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb7776001600160a01b0316906370a0823190602401602060405180830381865afa1580156104d1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104f5919061158a565b905061054b6001600160a01b037f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb777167f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd283610dc6565b60405163207f377360e11b8152600481018290525f9081906001600160a01b037f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd2169063076079a19082906340fe6ee690602401602060405180830381865afa1580156105ba573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105de919061158a565b6040518263ffffffff1660e01b81526004016105fc91815260200190565b60408051808303815f875af1158015610617573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061063b91906115a1565b90925090507f0000000000000000000000009f0d5e33617a1db6f1cbd5580834422684f092696001600160a01b031615610767576106c36001600160a01b037f0000000000000000000000009fcb2c47dab11e38fec4b8c886f63741bfed4c41167f0000000000000000000000009f0d5e33617a1db6f1cbd5580834422684f0926984610e29565b604051632e0a8aaf60e11b81526001600160a01b037f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb77781166004830152602482018490523060448301527f0000000000000000000000009f0d5e33617a1db6f1cbd5580834422684f092691690635c15155e906064015f604051808303815f87803b158015610750575f80fd5b505af1158015610762573d5f803e3d5ffd5b505050505b60039190915560045550506005805460ff19166001179055565b5f61078b81610db9565b6005805461ff001981166101009182900460ff16159091021790556040517fcecce16fb48394242f0c4cccbcc83b1a814bb13cc4e0160f6546f6a4b0c18de9905f90a150565b5f828152602081905260409020600101546107eb81610db9565b6107f58383610f3c565b505050565b6001600160a01b038116331461086f5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6108798282610fbf565b5050565b6005545f9060ff166108a2576040516314afe08360e01b815260040160405180910390fd5b335f9081526001602052604081208054908290556002546003549192909182906108cc90856115d7565b6108d691906115ee565b90505f82600454856108e891906115d7565b6108f291906115ee565b90505f7f0000000000000000000000009f0d5e33617a1db6f1cbd5580834422684f092696001600160a01b0316156109e95760405163f3f094a160e01b81526001600160a01b037f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb777811660048301526024820185905289811660448301525f60648301527f0000000000000000000000009f0d5e33617a1db6f1cbd5580834422684f09269169063f3f094a19060840160408051808303815f875af11580156109bd573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109e191906115a1565b509050610a82565b6040516368674c7d60e11b8152600481018490526001600160a01b0389811660248301525f60448301527f0000000000000000000000008e3815ef103b8d8528778969cd53baa2e94be25e169063d0ce98fa9060640160408051808303815f875af1158015610a5a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a7e91906115a1565b5090505b6040516372b790db60e01b8152600481018390526001600160a01b0389811660248301525f60448301819052917f0000000000000000000000008e3815ef103b8d8528778969cd53baa2e94be25e909116906372b790db906064016020604051808303815f875af1158015610af9573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b1d919061158a565b9050610b29828261160d565b965087871015610b4c57604051630843673360e31b815260040160405180910390fd5b50505050505092915050565b60055460ff16610b7b576040516314afe08360e01b815260040160405180910390fd5b600554610100900460ff16610ba357604051631494770360e11b815260040160405180910390fd5b335f908152600160205260408120805490829055600254600354919290918290610bcd90856115d7565b610bd791906115ee565b90505f8260045485610be991906115d7565b610bf391906115ee565b90507f0000000000000000000000009f0d5e33617a1db6f1cbd5580834422684f092696001600160a01b031615610c5d57610c586001600160a01b037f0000000000000000000000009f0d5e33617a1db6f1cbd5580834422684f09269168684610dc6565b610c91565b610c916001600160a01b037f0000000000000000000000009fcb2c47dab11e38fec4b8c886f63741bfed4c41168684610dc6565b610cc56001600160a01b037f000000000000000000000000b90d347e10a085b591955cbd0603ac7866fcadc8168683610dc6565b5050505050565b60055460ff1615610cf057604051630dc53f8d60e21b815260040160405180910390fd5b610d257f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb7776001600160a01b0316333085611023565b6001600160a01b0381165f9081526001602052604081208054849290610d4c90849061160d565b925050819055508160025f828254610d64919061160d565b90915550505050565b5f918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b5f82815260208190526040902060010154610daf81610db9565b6107f58383610fbf565b610dc38133611061565b50565b6040516001600160a01b0383166024820152604481018290526107f590849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526110ba565b801580610ea15750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015610e7b573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e9f919061158a565b155b610f0c5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610866565b6040516001600160a01b0383166024820152604481018290526107f590849063095ea7b360e01b90606401610df2565b610f468282610d6d565b610879575f828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610f7b3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610fc98282610d6d565b15610879575f828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6040516001600160a01b038085166024830152831660448201526064810182905261105b9085906323b872dd60e01b90608401610df2565b50505050565b61106b8282610d6d565b610879576110788161118d565b61108383602061119f565b604051602001611094929190611642565b60408051601f198184030181529082905262461bcd60e51b8252610866916004016116b6565b5f61110e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661133c9092919063ffffffff16565b905080515f148061112e57508080602001905181019061112e91906116e8565b6107f55760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610866565b60606104196001600160a01b03831660145b60605f6111ad8360026115d7565b6111b890600261160d565b67ffffffffffffffff8111156111d0576111d0611707565b6040519080825280601f01601f1916602001820160405280156111fa576020820181803683370190505b509050600360fc1b815f815181106112145761121461171b565b60200101906001600160f81b03191690815f1a905350600f60fb1b816001815181106112425761124261171b565b60200101906001600160f81b03191690815f1a9053505f6112648460026115d7565b61126f90600161160d565b90505b60018111156112e6576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106112a3576112a361171b565b1a60f81b8282815181106112b9576112b961171b565b60200101906001600160f81b03191690815f1a90535060049490941c936112df8161172f565b9050611272565b5083156113355760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610866565b9392505050565b606061134a84845f85611352565b949350505050565b6060824710156113b35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610866565b5f80866001600160a01b031685876040516113ce9190611744565b5f6040518083038185875af1925050503d805f8114611408576040519150601f19603f3d011682016040523d82523d5f602084013e61140d565b606091505b509150915061141e87838387611429565b979650505050505050565b606083156114975782515f03611490576001600160a01b0385163b6114905760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610866565b508161134a565b61134a83838151156114ac5781518083602001fd5b8060405162461bcd60e51b815260040161086691906116b6565b5f602082840312156114d6575f80fd5b81356001600160e01b031981168114611335575f80fd5b5f602082840312156114fd575f80fd5b5035919050565b80356001600160a01b038116811461151a575f80fd5b919050565b5f8060408385031215611530575f80fd5b8235915061154060208401611504565b90509250929050565b5f806040838503121561155a575f80fd5b61156383611504565b946020939093013593505050565b5f60208284031215611581575f80fd5b61133582611504565b5f6020828403121561159a575f80fd5b5051919050565b5f80604083850312156115b2575f80fd5b505080516020909101519092909150565b634e487b7160e01b5f52601160045260245ffd5b8082028115828204841417610419576104196115c3565b5f8261160857634e487b7160e01b5f52601260045260245ffd5b500490565b80820180821115610419576104196115c3565b5f5b8381101561163a578181015183820152602001611622565b50505f910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081525f8351611679816017850160208801611620565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516116aa816028840160208801611620565b01602801949350505050565b602081525f82518060208401526116d4816040850160208701611620565b601f01601f19169190910160400192915050565b5f602082840312156116f8575f80fd5b81518015158114611335575f80fd5b634e487b7160e01b5f52604160045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b5f8161173d5761173d6115c3565b505f190190565b5f8251611755818460208701611620565b919091019291505056fea2646970667358221220927ae646d7c976fb352826c038a5c87e089dfe02d665a60289f0945179f3dad764736f6c63430008140033 | {{
"language": "Solidity",
"sources": {
"@openzeppelin/contracts-v4/access/AccessControl.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\nimport \"../utils/Context.sol\";\nimport \"../utils/Strings.sol\";\nimport \"../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n Strings.toHexString(account),\n \" is missing role \",\n Strings.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * May emit a {RoleGranted} event.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n}\n"
},
"@openzeppelin/contracts-v4/access/IAccessControl.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n"
},
"@openzeppelin/contracts-v4/token/ERC20/extensions/IERC20Permit.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"
},
"@openzeppelin/contracts-v4/token/ERC20/IERC20.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n"
},
"@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\n }\n}\n"
},
"@openzeppelin/contracts-v4/utils/Address.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n"
},
"@openzeppelin/contracts-v4/utils/Context.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n"
},
"@openzeppelin/contracts-v4/utils/introspection/ERC165.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n"
},
"@openzeppelin/contracts-v4/utils/introspection/IERC165.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
},
"@openzeppelin/contracts-v4/utils/math/Math.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n"
},
"@openzeppelin/contracts-v4/utils/math/SignedMath.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n"
},
"@openzeppelin/contracts-v4/utils/Strings.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n"
},
"contracts/f(x)/v2/FxInitialFund.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity =0.8.20;\n\nimport { AccessControl } from \"@openzeppelin/contracts-v4/access/AccessControl.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts-v4/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol\";\n\nimport { IFxMarketV2 } from \"../../interfaces/f(x)/IFxMarketV2.sol\";\nimport { IFxTreasuryV2 } from \"../../interfaces/f(x)/IFxTreasuryV2.sol\";\nimport { IFxUSD } from \"../../interfaces/f(x)/IFxUSD.sol\";\n\ncontract FxInitialFund is AccessControl {\n using SafeERC20 for IERC20;\n\n /**********\n * Events *\n **********/\n\n /// @notice Emitted when the status of `fxWithdrawalEnabled` is updated.\n event ToggleFxWithdrawalStatus();\n\n /**********\n * Errors *\n **********/\n\n /// @dev Thrown when try to withdraw both fxUSD and xToken.\n error ErrorFxWithdrawalNotEnabled();\n\n /// @dev Thrown when the amount of base token is not enough.\n error ErrorInsufficientBaseToken();\n\n /// @dev Thrown when deposit after initialization.\n error ErrorInitialized();\n\n /// @dev Thrown when withdraw before initialization.\n error ErrorNotInitialized();\n\n /*************\n * Constants *\n *************/\n\n /// @notice The role for minter.\n bytes32 public constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n\n /// @notice The address of market contract.\n address public immutable market;\n\n /// @notice The address of treasury contract.\n address public immutable treasury;\n\n /// @notice The address of base token.\n address public immutable baseToken;\n\n /// @notice The address of fToken token.\n address public immutable fToken;\n\n /// @notice The address of xToken token.\n address public immutable xToken;\n\n /// @notice The address of fxUSD token.\n address public immutable fxUSD;\n\n /*************\n * Variables *\n *************/\n\n /// @notice Mapping from user address to pool shares.\n mapping(address => uint256) public shares;\n\n /// @notice The total amount of pool shares.\n uint256 public totalShares;\n\n /// @notice The total amount of fxUSD/fToken minted.\n uint256 public totalFToken;\n\n /// @notice The total amount of xToken minted.\n uint256 public totalXToken;\n\n /// @notice Whether the pool is initialized.\n bool public initialized;\n\n /// @notice Whether withdraw both fxUSD and xToken is enabled.\n bool public fxWithdrawalEnabled;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(address _market, address _fxUSD) {\n address _treasury = IFxMarketV2(_market).treasury();\n\n market = _market;\n treasury = _treasury;\n baseToken = IFxTreasuryV2(_treasury).baseToken();\n fToken = IFxTreasuryV2(_treasury).fToken();\n xToken = IFxTreasuryV2(_treasury).xToken();\n fxUSD = _fxUSD;\n\n _grantRole(DEFAULT_ADMIN_ROLE, _msgSender());\n }\n\n /****************************\n * Public Mutated Functions *\n ****************************/\n\n /// @notice Deposit base token to this contract.\n /// @param amount The amount of token to deposit.\n /// @param receiver The address of pool share recipient.\n function deposit(uint256 amount, address receiver) external {\n if (initialized) revert ErrorInitialized();\n\n IERC20(baseToken).safeTransferFrom(_msgSender(), address(this), amount);\n shares[receiver] += amount;\n totalShares += amount;\n }\n\n /// @notice Withdraw base token from this contract.\n /// @param receiver The address of base token recipient.\n /// @param minBaseOut The minimum amount of base token should receive.\n /// @return baseOut The amount of base token received.\n function withdrawBaseToken(address receiver, uint256 minBaseOut) external returns (uint256 baseOut) {\n if (!initialized) revert ErrorNotInitialized();\n\n uint256 _share = shares[_msgSender()];\n shares[_msgSender()] = 0;\n uint256 _totalShares = totalShares;\n uint256 _fAmount = (_share * totalFToken) / _totalShares;\n uint256 _xAmount = (_share * totalXToken) / _totalShares;\n\n uint256 _fBaseOut;\n if (fxUSD != address(0)) {\n (_fBaseOut, ) = IFxUSD(fxUSD).redeem(baseToken, _fAmount, receiver, 0);\n } else {\n (_fBaseOut, ) = IFxMarketV2(market).redeemFToken(_fAmount, receiver, 0);\n }\n // No need to approve xToken to market\n uint256 _xBaseOut = IFxMarketV2(market).redeemXToken(_xAmount, receiver, 0);\n\n baseOut = _xBaseOut + _fBaseOut;\n if (baseOut < minBaseOut) revert ErrorInsufficientBaseToken();\n }\n\n /// @notice Withdraw fxUSD/fToken and xToken from this contract.\n /// @param receiver The address of token recipient.\n function withdraw(address receiver) external {\n if (!initialized) revert ErrorNotInitialized();\n if (!fxWithdrawalEnabled) revert ErrorFxWithdrawalNotEnabled();\n\n uint256 _share = shares[_msgSender()];\n shares[_msgSender()] = 0;\n uint256 _totalShares = totalShares;\n uint256 _fAmount = (_share * totalFToken) / _totalShares;\n uint256 _xAmount = (_share * totalXToken) / _totalShares;\n\n if (fxUSD != address(0)) {\n IERC20(fxUSD).safeTransfer(receiver, _fAmount);\n } else {\n IERC20(fToken).safeTransfer(receiver, _fAmount);\n }\n IERC20(xToken).safeTransfer(receiver, _xAmount);\n }\n\n /************************\n * Restricted Functions *\n ************************/\n\n /// @notice Initialize treasury with base token in this contract.\n function mint() external onlyRole(MINTER_ROLE) {\n if (initialized) revert ErrorInitialized();\n\n uint256 _balance = IERC20(baseToken).balanceOf(address(this));\n IERC20(baseToken).safeTransfer(treasury, _balance);\n (uint256 _totalFToken, uint256 _totalXToken) = IFxTreasuryV2(treasury).initializeProtocol(\n IFxTreasuryV2(treasury).getUnderlyingValue(_balance)\n );\n\n if (fxUSD != address(0)) {\n IERC20(fToken).safeApprove(fxUSD, _totalFToken);\n IFxUSD(fxUSD).wrap(baseToken, _totalFToken, address(this));\n }\n\n totalFToken = _totalFToken;\n totalXToken = _totalXToken;\n initialized = true;\n }\n\n /// @notice Change the status of `fxWithdrawalEnabled`.\n function toggleFxWithdrawalStatus() external onlyRole(DEFAULT_ADMIN_ROLE) {\n fxWithdrawalEnabled = !fxWithdrawalEnabled;\n\n emit ToggleFxWithdrawalStatus();\n }\n}\n"
},
"contracts/interfaces/f(x)/IFxMarketV2.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IFxMarketV2 {\n /**********\n * Events *\n **********/\n\n /// @notice Emitted when fToken is minted.\n /// @param owner The address of base token owner.\n /// @param recipient The address of receiver for fToken or xToken.\n /// @param baseTokenIn The amount of base token deposited.\n /// @param fTokenOut The amount of fToken minted.\n /// @param mintFee The amount of mint fee charged.\n event MintFToken(\n address indexed owner,\n address indexed recipient,\n uint256 baseTokenIn,\n uint256 fTokenOut,\n uint256 mintFee\n );\n\n /// @notice Emitted when xToken is minted.\n /// @param owner The address of base token owner.\n /// @param recipient The address of receiver for fToken or xToken.\n /// @param baseTokenIn The amount of base token deposited.\n /// @param xTokenOut The amount of xToken minted.\n /// @param bonus The amount of base token as bonus.\n /// @param mintFee The amount of mint fee charged.\n event MintXToken(\n address indexed owner,\n address indexed recipient,\n uint256 baseTokenIn,\n uint256 xTokenOut,\n uint256 bonus,\n uint256 mintFee\n );\n\n /// @notice Emitted when someone redeem base token with fToken or xToken.\n /// @param owner The address of fToken and xToken owner.\n /// @param recipient The address of receiver for base token.\n /// @param fTokenBurned The amount of fToken burned.\n /// @param baseTokenOut The amount of base token redeemed.\n /// @param bonus The amount of base token as bonus.\n /// @param redeemFee The amount of redeem fee charged.\n event RedeemFToken(\n address indexed owner,\n address indexed recipient,\n uint256 fTokenBurned,\n uint256 baseTokenOut,\n uint256 bonus,\n uint256 redeemFee\n );\n\n /// @notice Emitted when someone redeem base token with fToken or xToken.\n /// @param owner The address of fToken and xToken owner.\n /// @param recipient The address of receiver for base token.\n /// @param xTokenBurned The amount of xToken burned.\n /// @param baseTokenOut The amount of base token redeemed.\n /// @param redeemFee The amount of redeem fee charged.\n event RedeemXToken(\n address indexed owner,\n address indexed recipient,\n uint256 xTokenBurned,\n uint256 baseTokenOut,\n uint256 redeemFee\n );\n\n /// @notice Emitted when the fee ratio for minting fToken is updated.\n /// @param defaultFeeRatio The new default fee ratio, multipled by 1e18.\n /// @param extraFeeRatio The new extra fee ratio, multipled by 1e18.\n event UpdateMintFeeRatioFToken(uint256 defaultFeeRatio, int256 extraFeeRatio);\n\n /// @notice Emitted when the fee ratio for minting xToken is updated.\n /// @param defaultFeeRatio The new default fee ratio, multipled by 1e18.\n /// @param extraFeeRatio The new extra fee ratio, multipled by 1e18.\n event UpdateMintFeeRatioXToken(uint256 defaultFeeRatio, int256 extraFeeRatio);\n\n /// @notice Emitted when the fee ratio for redeeming fToken is updated.\n /// @param defaultFeeRatio The new default fee ratio, multipled by 1e18.\n /// @param extraFeeRatio The new extra fee ratio, multipled by 1e18.\n event UpdateRedeemFeeRatioFToken(uint256 defaultFeeRatio, int256 extraFeeRatio);\n\n /// @notice Emitted when the fee ratio for redeeming xToken is updated.\n /// @param defaultFeeRatio The new default fee ratio, multipled by 1e18.\n /// @param extraFeeRatio The new extra fee ratio, multipled by 1e18.\n event UpdateRedeemFeeRatioXToken(uint256 defaultFeeRatio, int256 extraFeeRatio);\n\n /// @notice Emitted when the stability ratio is updated.\n /// @param oldRatio The previous collateral ratio to enter stability mode, multiplied by 1e18.\n /// @param newRatio The current collateral ratio to enter stability mode, multiplied by 1e18.\n event UpdateStabilityRatio(uint256 oldRatio, uint256 newRatio);\n\n /// @notice Emitted when the platform contract is updated.\n /// @param oldPlatform The address of previous platform contract.\n /// @param newPlatform The address of current platform contract.\n event UpdatePlatform(address indexed oldPlatform, address indexed newPlatform);\n\n /// @notice Emitted when the reserve pool contract is updated.\n /// @param oldReservePool The address of previous reserve pool contract.\n /// @param newReservePool The address of current reserve pool contract.\n event UpdateReservePool(address indexed oldReservePool, address indexed newReservePool);\n\n /// @notice Emitted when the RebalancePoolRegistry contract is updated.\n /// @param oldRegistry The address of previous RebalancePoolRegistry contract.\n /// @param newRegistry The address of current RebalancePoolRegistry contract.\n event UpdateRebalancePoolRegistry(address indexed oldRegistry, address indexed newRegistry);\n\n /// @notice Pause or unpause mint.\n /// @param oldStatus The previous status for mint.\n /// @param newStatus The current status for mint.\n event UpdateMintStatus(bool oldStatus, bool newStatus);\n\n /// @notice Pause or unpause redeem.\n /// @param oldStatus The previous status for redeem.\n /// @param newStatus The current status for redeem.\n event UpdateRedeemStatus(bool oldStatus, bool newStatus);\n\n /// @notice Pause or unpause fToken mint in stability mode.\n /// @param oldStatus The previous status for mint.\n /// @param newStatus The current status for mint.\n event UpdateFTokenMintStatusInStabilityMode(bool oldStatus, bool newStatus);\n\n /// @notice Pause or unpause xToken redeem in stability mode.\n /// @param oldStatus The previous status for redeem.\n /// @param newStatus The current status for redeem.\n event UpdateXTokenRedeemStatusInStabilityMode(bool oldStatus, bool newStatus);\n\n /**********\n * Errors *\n **********/\n\n /// @dev Thrown when the caller if not fUSD contract.\n error ErrorCallerNotFUSD();\n\n /// @dev Thrown when token mint is paused.\n error ErrorMintPaused();\n\n /// @dev Thrown when fToken mint is paused in stability mode.\n error ErrorFTokenMintPausedInStabilityMode();\n\n /// @dev Thrown when mint with zero amount base token.\n error ErrorMintZeroAmount();\n\n /// @dev Thrown when the amount of fToken is not enough.\n error ErrorInsufficientFTokenOutput();\n\n /// @dev Thrown when the amount of xToken is not enough.\n error ErrorInsufficientXTokenOutput();\n\n /// @dev Thrown when token redeem is paused.\n error ErrorRedeemPaused();\n\n /// @dev Thrown when xToken redeem is paused in stability mode.\n error ErrorXTokenRedeemPausedInStabilityMode();\n\n /// @dev Thrown when redeem with zero amount fToken or xToken.\n error ErrorRedeemZeroAmount();\n\n /// @dev Thrown when the amount of base token is not enough.\n error ErrorInsufficientBaseOutput();\n\n /// @dev Thrown when the stability ratio is too large.\n error ErrorStabilityRatioTooLarge();\n\n /// @dev Thrown when the default fee is too large.\n error ErrorDefaultFeeTooLarge();\n\n /// @dev Thrown when the delta fee is too small.\n error ErrorDeltaFeeTooSmall();\n\n /// @dev Thrown when the sum of default fee and delta fee is too large.\n error ErrorTotalFeeTooLarge();\n\n /// @dev Thrown when the given address is zero.\n error ErrorZeroAddress();\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @notice The address of Treasury contract.\n function treasury() external view returns (address);\n\n /// @notice Return the address of base token.\n function baseToken() external view returns (address);\n\n /// @notice Return the address fractional base token.\n function fToken() external view returns (address);\n\n /// @notice Return the address leveraged base token.\n function xToken() external view returns (address);\n\n /// @notice Return the address of fxUSD token.\n function fxUSD() external view returns (address);\n\n /// @notice Return the collateral ratio to enter stability mode, multiplied by 1e18.\n function stabilityRatio() external view returns (uint256);\n\n /****************************\n * Public Mutated Functions *\n ****************************/\n\n /// @notice Mint some fToken with some base token.\n /// @param baseIn The amount of wrapped value of base token supplied, use `uint256(-1)` to supply all base token.\n /// @param recipient The address of receiver for fToken.\n /// @param minFTokenMinted The minimum amount of fToken should be received.\n /// @return fTokenMinted The amount of fToken should be received.\n function mintFToken(\n uint256 baseIn,\n address recipient,\n uint256 minFTokenMinted\n ) external returns (uint256 fTokenMinted);\n\n /// @notice Mint some xToken with some base token.\n /// @param baseIn The amount of wrapped value of base token supplied, use `uint256(-1)` to supply all base token.\n /// @param recipient The address of receiver for xToken.\n /// @param minXTokenMinted The minimum amount of xToken should be received.\n /// @return xTokenMinted The amount of xToken should be received.\n /// @return bonus The amount of wrapped value of base token as bonus.\n function mintXToken(\n uint256 baseIn,\n address recipient,\n uint256 minXTokenMinted\n ) external returns (uint256 xTokenMinted, uint256 bonus);\n\n /// @notice Redeem base token with fToken.\n /// @param fTokenIn the amount of fToken to redeem, use `uint256(-1)` to redeem all fToken.\n /// @param recipient The address of receiver for base token.\n /// @param minBaseOut The minimum amount of wrapped value of base token should be received.\n /// @return baseOut The amount of wrapped value of base token should be received.\n /// @return bonus The amount of wrapped value of base token as bonus.\n function redeemFToken(\n uint256 fTokenIn,\n address recipient,\n uint256 minBaseOut\n ) external returns (uint256 baseOut, uint256 bonus);\n\n /// @notice Redeem base token with xToken.\n /// @param xTokenIn the amount of xToken to redeem, use `uint256(-1)` to redeem all xToken.\n /// @param recipient The address of receiver for base token.\n /// @param minBaseOut The minimum amount of wrapped value of base token should be received.\n /// @return baseOut The amount of wrapped value of base token should be received.\n function redeemXToken(\n uint256 xTokenIn,\n address recipient,\n uint256 minBaseOut\n ) external returns (uint256 baseOut);\n}\n"
},
"contracts/interfaces/f(x)/IFxTreasuryV2.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IFxTreasuryV2 {\n /**********\n * Events *\n **********/\n\n /// @notice Emitted when the platform contract is updated.\n /// @param oldPlatform The address of previous platform contract.\n /// @param newPlatform The address of current platform contract.\n event UpdatePlatform(address indexed oldPlatform, address indexed newPlatform);\n\n /// @notice Emitted when the RebalancePoolSplitter contract is updated.\n /// @param oldRebalancePoolSplitter The address of previous RebalancePoolSplitter contract.\n /// @param newRebalancePoolSplitter The address of current RebalancePoolSplitter.\n event UpdateRebalancePoolSplitter(address indexed oldRebalancePoolSplitter, address indexed newRebalancePoolSplitter);\n\n /// @notice Emitted when the price oracle contract is updated.\n /// @param oldPriceOracle The address of previous price oracle.\n /// @param newPriceOracle The address of current price oracle.\n event UpdatePriceOracle(address indexed oldPriceOracle, address indexed newPriceOracle);\n\n /// @notice Emitted when the strategy contract is updated.\n /// @param oldStrategy The address of previous strategy.\n /// @param newStrategy The address of current strategy.\n event UpdateStrategy(address indexed oldStrategy, address indexed newStrategy);\n\n /// @notice Emitted when the base token cap is updated.\n /// @param oldBaseTokenCap The value of previous base token cap.\n /// @param newBaseTokenCap The value of current base token cap.\n event UpdateBaseTokenCap(uint256 oldBaseTokenCap, uint256 newBaseTokenCap);\n\n /// @notice Emitted when the EMA sample interval is updated.\n /// @param oldSampleInterval The value of previous EMA sample interval.\n /// @param newSampleInterval The value of current EMA sample interval.\n event UpdateEMASampleInterval(uint256 oldSampleInterval, uint256 newSampleInterval);\n\n /// @notice Emitted when the reference price is updated.\n /// @param oldPrice The value of previous reference price.\n /// @param newPrice The value of current reference price.\n event Settle(uint256 oldPrice, uint256 newPrice);\n\n /// @notice Emitted when the ratio for rebalance pool is updated.\n /// @param oldRatio The value of the previous ratio, multiplied by 1e9.\n /// @param newRatio The value of the current ratio, multiplied by 1e9.\n event UpdateRebalancePoolRatio(uint256 oldRatio, uint256 newRatio);\n\n /// @notice Emitted when the ratio for harvester is updated.\n /// @param oldRatio The value of the previous ratio, multiplied by 1e9.\n /// @param newRatio The value of the current ratio, multiplied by 1e9.\n event UpdateHarvesterRatio(uint256 oldRatio, uint256 newRatio);\n\n /// @notice Emitted when someone harvest pending stETH rewards.\n /// @param caller The address of caller.\n /// @param totalRewards The amount of total harvested rewards.\n /// @param rebalancePoolRewards The amount of harvested rewards distributed to stability pool.\n /// @param harvestBounty The amount of harvested rewards distributed to caller as harvest bounty.\n event Harvest(address indexed caller, uint256 totalRewards, uint256 rebalancePoolRewards, uint256 harvestBounty);\n\n /**********\n * Errors *\n **********/\n\n /// @dev Thrown when the collateral ratio is smaller than 100%.\n error ErrorCollateralRatioTooSmall();\n\n /// @dev Thrown when mint exceed total capacity.\n error ErrorExceedTotalCap();\n\n /// @dev Thrown when the oracle price is invalid.\n error ErrorInvalidOraclePrice();\n\n /// @dev Thrown when the twap price is invalid.\n error ErrorInvalidTwapPrice();\n\n /// @dev Thrown when initialize protocol twice.\n error ErrorProtocolInitialized();\n\n /// @dev Thrown when the initial amount of base token is not enough.\n error ErrorInsufficientInitialBaseToken();\n\n /// @dev Thrown when current is under collateral.\n error ErrorUnderCollateral();\n\n /// @dev Thrown when the sample internal for EMA is too small.\n error ErrorEMASampleIntervalTooSmall();\n\n /// @dev Thrown when the expense ratio exceeds `MAX_REBALANCE_POOL_RATIO`.\n error ErrorRebalancePoolRatioTooLarge();\n\n /// @dev Thrown when the harvester ratio exceeds `MAX_HARVESTER_RATIO`.\n error ErrorHarvesterRatioTooLarge();\n\n /// @dev Thrown when the given address is zero.\n error ErrorZeroAddress();\n\n /*********\n * Enums *\n *********/\n\n enum Action {\n None,\n MintFToken,\n MintXToken,\n RedeemFToken,\n RedeemXToken\n }\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @notice Return the address of price oracle contract.\n function priceOracle() external view returns (address);\n\n /// @notice Return the address of base token.\n function baseToken() external view returns (address);\n\n /// @notice Return the address fractional base token.\n function fToken() external view returns (address);\n\n /// @notice Return the address leveraged base token.\n function xToken() external view returns (address);\n\n /// @notice The reference base token price.\n function referenceBaseTokenPrice() external view returns (uint256);\n\n /// @notice The current base token price.\n function currentBaseTokenPrice() external view returns (uint256);\n\n /// @notice Return whether the price is valid.\n function isBaseTokenPriceValid() external view returns (bool);\n\n /// @notice Return the total amount of underlying value of base token deposited.\n function totalBaseToken() external view returns (uint256);\n\n /// @notice Return the address of strategy contract.\n function strategy() external view returns (address);\n\n /// @notice Return the total amount of base token managed by strategy.\n function strategyUnderlying() external view returns (uint256);\n\n /// @notice Return the current collateral ratio of fToken, multiplied by 1e18.\n function collateralRatio() external view returns (uint256);\n\n /// @notice Return whether the system is under collateral.\n function isUnderCollateral() external view returns (bool);\n\n /// @notice Compute the amount of base token needed to reach the new collateral ratio.\n /// @param newCollateralRatio The target collateral ratio, multiplied by 1e18.\n /// @return maxBaseIn The amount of underlying value of base token needed.\n /// @return maxFTokenMintable The amount of fToken can be minted.\n function maxMintableFToken(uint256 newCollateralRatio)\n external\n view\n returns (uint256 maxBaseIn, uint256 maxFTokenMintable);\n\n /// @notice Compute the amount of base token needed to reach the new collateral ratio.\n /// @param newCollateralRatio The target collateral ratio, multiplied by 1e18.\n /// @return maxBaseIn The amount of underlying value of base token needed.\n /// @return maxXTokenMintable The amount of xToken can be minted.\n function maxMintableXToken(uint256 newCollateralRatio)\n external\n view\n returns (uint256 maxBaseIn, uint256 maxXTokenMintable);\n\n /// @notice Compute the amount of fToken needed to reach the new collateral ratio.\n /// @param newCollateralRatio The target collateral ratio, multiplied by 1e18.\n /// @return maxBaseOut The amount of underlying value of base token redeemed.\n /// @return maxFTokenRedeemable The amount of fToken needed.\n function maxRedeemableFToken(uint256 newCollateralRatio)\n external\n view\n returns (uint256 maxBaseOut, uint256 maxFTokenRedeemable);\n\n /// @notice Compute the amount of xToken needed to reach the new collateral ratio.\n /// @param newCollateralRatio The target collateral ratio, multiplied by 1e18.\n /// @return maxBaseOut The amount of underlying value of base token redeemed.\n /// @return maxXTokenRedeemable The amount of xToken needed.\n function maxRedeemableXToken(uint256 newCollateralRatio)\n external\n view\n returns (uint256 maxBaseOut, uint256 maxXTokenRedeemable);\n\n /// @notice Return the exponential moving average of the leverage ratio.\n function leverageRatio() external view returns (uint256);\n\n /// @notice Convert underlying token amount to wrapped token amount.\n /// @param amount The underlying token amount.\n function getWrapppedValue(uint256 amount) external view returns (uint256);\n\n /// @notice Convert wrapped token amount to underlying token amount.\n /// @param amount The wrapped token amount.\n function getUnderlyingValue(uint256 amount) external view returns (uint256);\n\n /// @notice Return the fee ratio distributed to rebalance pool, multiplied by 1e9.\n function getRebalancePoolRatio() external view returns (uint256);\n\n /// @notice Return the fee ratio distributed to harvester, multiplied by 1e9.\n function getHarvesterRatio() external view returns (uint256);\n\n /****************************\n * Public Mutated Functions *\n ****************************/\n\n /// @notice Initialize the protocol.\n /// @param baseIn The amount of underlying value of the base token used to initialize.\n function initializeProtocol(uint256 baseIn) external returns (uint256 fTokenOut, uint256 xTokenOut);\n\n /// @notice Mint fToken with some base token.\n /// @param baseIn The amount of underlying value of base token deposited.\n /// @param recipient The address of receiver.\n /// @return fTokenOut The amount of fToken minted.\n function mintFToken(uint256 baseIn, address recipient) external returns (uint256 fTokenOut);\n\n /// @notice Mint xToken with some base token.\n /// @param baseIn The amount of underlying value of base token deposited.\n /// @param recipient The address of receiver.\n /// @return xTokenOut The amount of xToken minted.\n function mintXToken(uint256 baseIn, address recipient) external returns (uint256 xTokenOut);\n\n /// @notice Redeem fToken and xToken to base token.\n /// @param fTokenIn The amount of fToken to redeem.\n /// @param xTokenIn The amount of xToken to redeem.\n /// @param owner The owner of the fToken or xToken.\n /// @param baseOut The amount of underlying value of base token redeemed.\n function redeem(\n uint256 fTokenIn,\n uint256 xTokenIn,\n address owner\n ) external returns (uint256 baseOut);\n\n /// @notice Settle the nav of base token, fToken and xToken.\n function settle() external;\n\n /// @notice Transfer some base token to strategy contract.\n /// @param amount The amount of token to transfer.\n function transferToStrategy(uint256 amount) external;\n\n /// @notice Notify base token profit from strategy contract.\n /// @param amount The amount of base token.\n function notifyStrategyProfit(uint256 amount) external;\n\n /// @notice Harvest pending rewards to stability pool.\n function harvest() external;\n}\n"
},
"contracts/interfaces/f(x)/IFxUSD.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IFxUSD {\n /**********\n * Events *\n **********/\n\n /// @notice Emitted when a new market is added.\n /// @param baseToken The address of base token of the market.\n /// @param mintCap The mint capacity of the market.\n event AddMarket(address indexed baseToken, uint256 mintCap);\n\n /// @notice Emitted when the mint capacity is updated.\n /// @param baseToken The address of base token of the market.\n /// @param oldCap The value of previous mint capacity.\n /// @param newCap The value of current mint capacity.\n event UpdateMintCap(address indexed baseToken, uint256 oldCap, uint256 newCap);\n\n /// @notice Emitted when a new rebalance pool is added.\n /// @param baseToken The address of base token of the market.\n /// @param pool The address of the rebalance pool.\n event AddRebalancePool(address indexed baseToken, address indexed pool);\n\n /// @notice Emitted when a new rebalance pool is removed.\n /// @param baseToken The address of base token of the market.\n /// @param pool The address of the rebalance pool.\n event RemoveRebalancePool(address indexed baseToken, address indexed pool);\n\n /// @notice Emitted when someone wrap fToken as fxUSD.\n /// @param baseToken The address of base token of the market.\n /// @param owner The address of fToken owner.\n /// @param receiver The address of fxUSD recipient.\n /// @param amount The amount of fxUSD minted.\n event Wrap(address indexed baseToken, address indexed owner, address indexed receiver, uint256 amount);\n\n /// @notice Emitted when someone unwrap fxUSD as fToken.\n /// @param baseToken The address of base token of the market.\n /// @param owner The address of fxUSD owner.\n /// @param receiver The address of base token recipient.\n /// @param amount The amount of fxUSD burned.\n event Unwrap(address indexed baseToken, address indexed owner, address indexed receiver, uint256 amount);\n\n /**********\n * Errors *\n **********/\n\n /// @dev Thrown when someone tries to interact with unsupported market.\n error ErrorUnsupportedMarket();\n\n /// @dev Thrown when someone tries to interact with unsupported rebalance pool.\n error ErrorUnsupportedRebalancePool();\n\n /// @dev Thrown when someone tries to interact with market in stability mode.\n error ErrorMarketInStabilityMode();\n\n /// @dev Thrown when someone tries to interact with market has invalid price.\n error ErrorMarketWithInvalidPrice();\n\n /// @dev Thrown when someone tries to add a supported market.\n error ErrorMarketAlreadySupported();\n\n /// @dev Thrown when the total supply of fToken exceed mint capacity.\n error ErrorExceedMintCap();\n\n /// @dev Thrown when the amount of fToken is not enough for redeem.\n error ErrorInsufficientLiquidity();\n\n /// @dev Thrown when current is under collateral.\n error ErrorUnderCollateral();\n\n /// @dev Thrown when the length of two arrays is mismatch.\n error ErrorLengthMismatch();\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @notice Return the list of supported markets.\n function getMarkets() external view returns (address[] memory);\n\n /// @notice Return the list of supported rebalance pools.\n function getRebalancePools() external view returns (address[] memory);\n\n /// @notice Return the nav of fxUSD.\n function nav() external view returns (uint256);\n\n /// @notice Return whether the system is under collateral.\n function isUnderCollateral() external view returns (bool);\n\n /****************************\n * Public Mutated Functions *\n ****************************/\n\n /// @notice Wrap fToken to fxUSD.\n /// @param baseToken The address of corresponding base token.\n /// @param amount The amount of fToken to wrap.\n /// @param receiver The address of fxUSD recipient.\n function wrap(\n address baseToken,\n uint256 amount,\n address receiver\n ) external;\n\n /// @notice Wrap fToken from rebalance pool to fxUSD.\n /// @param pool The address of rebalance pool.\n /// @param amount The amount of fToken to wrap.\n /// @param receiver The address of fxUSD recipient.\n function wrapFrom(\n address pool,\n uint256 amount,\n address receiver\n ) external;\n\n /// @notice Mint fxUSD with base token.\n /// @param baseToken The address of the base token.\n /// @param amountIn The amount of base token to use.\n /// @param receiver The address of fxUSD recipient.\n /// @param minOut The minimum amount of fxUSD should receive.\n /// @return amountOut The amount of fxUSD received by the receiver.\n function mint(\n address baseToken,\n uint256 amountIn,\n address receiver,\n uint256 minOut\n ) external returns (uint256 amountOut);\n\n /// @notice Deposit fxUSD to rebalance pool.\n /// @param pool The address of rebalance pool.\n /// @param amount The amount of fxUSD to use.\n /// @param receiver The address of rebalance pool share recipient.\n function earn(\n address pool,\n uint256 amount,\n address receiver\n ) external;\n\n /// @notice Mint fxUSD with base token and deposit to rebalance pool.\n /// @param pool The address of rebalance pool.\n /// @param amountIn The amount of base token to use.\n /// @param receiver The address of rebalance pool recipient.\n /// @param minOut The minimum amount of rebalance pool shares should receive.\n /// @return amountOut The amount of rebalance pool shares received by the receiver.\n function mintAndEarn(\n address pool,\n uint256 amountIn,\n address receiver,\n uint256 minOut\n ) external returns (uint256 amountOut);\n\n /// @notice Redeem fxUSD to base token.\n /// @param baseToken The address of the base token.\n /// @param amountIn The amount of fxUSD to redeem.\n /// @param receiver The address of base token recipient.\n /// @param minOut The minimum amount of base token should receive.\n /// @return amountOut The amount of base token received by the receiver.\n /// @return bonusOut The amount of bonus base token received by the receiver.\n function redeem(\n address baseToken,\n uint256 amountIn,\n address receiver,\n uint256 minOut\n ) external returns (uint256 amountOut, uint256 bonusOut);\n\n /// @notice Redeem fToken from rebalance pool to base token.\n /// @param amountIn The amount of fxUSD to redeem.\n /// @param receiver The address of base token recipient.\n /// @param minOut The minimum amount of base token should receive.\n /// @return amountOut The amount of base token received by the receiver.\n /// @return bonusOut The amount of bonus base token received by the receiver.\n function redeemFrom(\n address pool,\n uint256 amountIn,\n address receiver,\n uint256 minOut\n ) external returns (uint256 amountOut, uint256 bonusOut);\n\n /// @notice Redeem fxUSD to base token optimally.\n /// @param amountIn The amount of fxUSD to redeem.\n /// @param receiver The address of base token recipient.\n /// @param minOuts The list of minimum amount of base token should receive.\n /// @return baseTokens The list of base token received by the receiver.\n /// @return amountOuts The list of amount of base token received by the receiver.\n /// @return bonusOuts The list of amount of bonus base token received by the receiver.\n function autoRedeem(\n uint256 amountIn,\n address receiver,\n uint256[] memory minOuts\n )\n external\n returns (\n address[] memory baseTokens,\n uint256[] memory amountOuts,\n uint256[] memory bonusOuts\n );\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "shanghai",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}
}} |
1 | 20,291,288 | 65cdd368e807ef474bf916b219eef5e747f48f2e9047c7ae27db3f48548bafaa | 9c5ff0bcca2db08cecd2b8a2890f61a41c6d19a642a1605276da32a29f46c405 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | 63b038a7298fbdcf0945068637ec59b8a5e9c6bd | 608060405234801561000f575f80fd5b506100193361001e565b610089565b600180546001600160a01b03191690556100378161003a565b50565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610816806100965f395ff3fe608060405234801561000f575f80fd5b5060043610610090575f3560e01c8063715018a611610063578063715018a6146100ec57806379ba5097146100f45780638da5cb5b146100fc578063e30c397814610120578063f2fde38b14610131575f80fd5b806318160ddd1461009457806354edffbe146100af5780635d396b36146100c4578063673a2a1f146100d7575b5f80fd5b61009c610144565b6040519081526020015b60405180910390f35b6100c26100bd3660046106c9565b6101f2565b005b6100c26100d23660046106c9565b610258565b6100df6102be565b6040516100a691906106ef565b6100c2610368565b6100c261037b565b5f546001600160a01b03165b6040516001600160a01b0390911681526020016100a6565b6001546001600160a01b0316610108565b6100c261013f3660046106c9565b6103fa565b5f80610150600261046a565b90505f805b828110156101eb575f610169600283610479565b9050806001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101a7573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101cb919061073b565b6101d59084610766565b92505080806101e390610779565b915050610155565b5092915050565b6101fa61048b565b6102056002826104e4565b61022257604051635d6280c560e01b815260040160405180910390fd5b6040516001600160a01b038216907fdfc596fabc6581c887262c97695176a79e3c8fc6ab7aaf14700820f3436b8fb9905f90a250565b61026061048b565b61026b6002826104f8565b61028857604051630bc78ba560e11b815260040160405180910390fd5b6040516001600160a01b038216907f14f72643dce34766fb65879aabe55195729f8260dfa03f81126428844a1eaaa1905f90a250565b60605f6102cb600261046a565b90508067ffffffffffffffff8111156102e6576102e6610791565b60405190808252806020026020018201604052801561030f578160200160208202803683370190505b5091505f5b8181101561036357610327600282610479565b838281518110610339576103396107a5565b6001600160a01b03909216602092830291909101909101528061035b81610779565b915050610314565b505090565b61037061048b565b6103795f61050c565b565b60015433906001600160a01b031681146103ee5760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b6103f78161050c565b50565b61040261048b565b600180546001600160a01b0383166001600160a01b031990911681179091556104325f546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b5f610473825490565b92915050565b5f6104848383610525565b9392505050565b5f546001600160a01b031633146103795760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103e5565b5f610484836001600160a01b03841661054b565b5f610484836001600160a01b038416610597565b600180546001600160a01b03191690556103f78161067a565b5f825f01828154811061053a5761053a6107a5565b905f5260205f200154905092915050565b5f81815260018301602052604081205461059057508154600181810184555f848152602080822090930184905584548482528286019093526040902091909155610473565b505f610473565b5f8181526001830160205260408120548015610671575f6105b96001836107b9565b85549091505f906105cc906001906107b9565b905081811461062b575f865f0182815481106105ea576105ea6107a5565b905f5260205f200154905080875f01848154811061060a5761060a6107a5565b5f918252602080832090910192909255918252600188019052604090208390555b855486908061063c5761063c6107cc565b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f905560019350505050610473565b5f915050610473565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f602082840312156106d9575f80fd5b81356001600160a01b0381168114610484575f80fd5b602080825282518282018190525f9190848201906040850190845b8181101561072f5783516001600160a01b03168352928401929184019160010161070a565b50909695505050505050565b5f6020828403121561074b575f80fd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b8082018082111561047357610473610752565b5f6001820161078a5761078a610752565b5060010190565b634e487b7160e01b5f52604160045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b8181038181111561047357610473610752565b634e487b7160e01b5f52603160045260245ffdfea26469706673582212200581d45b67f878c37d168c92a0c9cd3ac01c9c602dc53c2370eb8cc44cb86f4564736f6c63430008140033 | 608060405234801561000f575f80fd5b5060043610610090575f3560e01c8063715018a611610063578063715018a6146100ec57806379ba5097146100f45780638da5cb5b146100fc578063e30c397814610120578063f2fde38b14610131575f80fd5b806318160ddd1461009457806354edffbe146100af5780635d396b36146100c4578063673a2a1f146100d7575b5f80fd5b61009c610144565b6040519081526020015b60405180910390f35b6100c26100bd3660046106c9565b6101f2565b005b6100c26100d23660046106c9565b610258565b6100df6102be565b6040516100a691906106ef565b6100c2610368565b6100c261037b565b5f546001600160a01b03165b6040516001600160a01b0390911681526020016100a6565b6001546001600160a01b0316610108565b6100c261013f3660046106c9565b6103fa565b5f80610150600261046a565b90505f805b828110156101eb575f610169600283610479565b9050806001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101a7573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101cb919061073b565b6101d59084610766565b92505080806101e390610779565b915050610155565b5092915050565b6101fa61048b565b6102056002826104e4565b61022257604051635d6280c560e01b815260040160405180910390fd5b6040516001600160a01b038216907fdfc596fabc6581c887262c97695176a79e3c8fc6ab7aaf14700820f3436b8fb9905f90a250565b61026061048b565b61026b6002826104f8565b61028857604051630bc78ba560e11b815260040160405180910390fd5b6040516001600160a01b038216907f14f72643dce34766fb65879aabe55195729f8260dfa03f81126428844a1eaaa1905f90a250565b60605f6102cb600261046a565b90508067ffffffffffffffff8111156102e6576102e6610791565b60405190808252806020026020018201604052801561030f578160200160208202803683370190505b5091505f5b8181101561036357610327600282610479565b838281518110610339576103396107a5565b6001600160a01b03909216602092830291909101909101528061035b81610779565b915050610314565b505090565b61037061048b565b6103795f61050c565b565b60015433906001600160a01b031681146103ee5760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b6103f78161050c565b50565b61040261048b565b600180546001600160a01b0383166001600160a01b031990911681179091556104325f546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b5f610473825490565b92915050565b5f6104848383610525565b9392505050565b5f546001600160a01b031633146103795760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103e5565b5f610484836001600160a01b03841661054b565b5f610484836001600160a01b038416610597565b600180546001600160a01b03191690556103f78161067a565b5f825f01828154811061053a5761053a6107a5565b905f5260205f200154905092915050565b5f81815260018301602052604081205461059057508154600181810184555f848152602080822090930184905584548482528286019093526040902091909155610473565b505f610473565b5f8181526001830160205260408120548015610671575f6105b96001836107b9565b85549091505f906105cc906001906107b9565b905081811461062b575f865f0182815481106105ea576105ea6107a5565b905f5260205f200154905080875f01848154811061060a5761060a6107a5565b5f918252602080832090910192909255918252600188019052604090208390555b855486908061063c5761063c6107cc565b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f905560019350505050610473565b5f915050610473565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f602082840312156106d9575f80fd5b81356001600160a01b0381168114610484575f80fd5b602080825282518282018190525f9190848201906040850190845b8181101561072f5783516001600160a01b03168352928401929184019160010161070a565b50909695505050505050565b5f6020828403121561074b575f80fd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b8082018082111561047357610473610752565b5f6001820161078a5761078a610752565b5060010190565b634e487b7160e01b5f52604160045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b8181038181111561047357610473610752565b634e487b7160e01b5f52603160045260245ffdfea26469706673582212200581d45b67f878c37d168c92a0c9cd3ac01c9c602dc53c2370eb8cc44cb86f4564736f6c63430008140033 | {{
"language": "Solidity",
"sources": {
"@openzeppelin/contracts-v4/access/Ownable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n"
},
"@openzeppelin/contracts-v4/access/Ownable2Step.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./Ownable.sol\";\n\n/**\n * @dev Contract module which provides access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership} and {acceptOwnership}.\n *\n * This module is used through inheritance. It will make available all functions\n * from parent (Ownable).\n */\nabstract contract Ownable2Step is Ownable {\n address private _pendingOwner;\n\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Returns the address of the pending owner.\n */\n function pendingOwner() public view virtual returns (address) {\n return _pendingOwner;\n }\n\n /**\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual override onlyOwner {\n _pendingOwner = newOwner;\n emit OwnershipTransferStarted(owner(), newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual override {\n delete _pendingOwner;\n super._transferOwnership(newOwner);\n }\n\n /**\n * @dev The new owner accepts the ownership transfer.\n */\n function acceptOwnership() public virtual {\n address sender = _msgSender();\n require(pendingOwner() == sender, \"Ownable2Step: caller is not the new owner\");\n _transferOwnership(sender);\n }\n}\n"
},
"@openzeppelin/contracts-v4/utils/Context.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n"
},
"@openzeppelin/contracts-v4/utils/structs/EnumerableSet.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastValue;\n // Update the index for the moved value\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n"
},
"contracts/f(x)/rebalance-pool/RebalancePoolRegistry.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity =0.8.20;\n\nimport { Ownable2Step } from \"@openzeppelin/contracts-v4/access/Ownable2Step.sol\";\nimport { EnumerableSet } from \"@openzeppelin/contracts-v4/utils/structs/EnumerableSet.sol\";\n\nimport { IFxRebalancePool } from \"../../interfaces/f(x)/IFxRebalancePool.sol\";\nimport { IFxRebalancePoolRegistry } from \"../../interfaces/f(x)/IFxRebalancePoolRegistry.sol\";\n\ncontract RebalancePoolRegistry is Ownable2Step, IFxRebalancePoolRegistry {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /**********\n * Errors *\n **********/\n\n /// @dev Thrown when add an already added pool.\n error ErrorPoolAlreadyAdded();\n\n /// @dev Thrown when remove an unkown pool.\n error ErrorPoolNotAdded();\n\n /*************\n * Variables *\n *************/\n\n /// @dev The list of registered RebalancePool.\n EnumerableSet.AddressSet private pools;\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @inheritdoc IFxRebalancePoolRegistry\n function getPools() external view override returns (address[] memory _pools) {\n uint256 _length = pools.length();\n _pools = new address[](_length);\n for (uint256 i = 0; i < _length; i++) {\n _pools[i] = pools.at(i);\n }\n }\n\n /// @inheritdoc IFxRebalancePoolRegistry\n function totalSupply() external view override returns (uint256) {\n uint256 _length = pools.length();\n uint256 _totalSupply;\n for (uint256 i = 0; i < _length; i++) {\n address _pool = pools.at(i);\n _totalSupply += IFxRebalancePool(_pool).totalSupply();\n }\n return _totalSupply;\n }\n\n /************************\n * Restricted Functions *\n ************************/\n\n /// @notice Add a RebalancePool to the list.\n /// @param _pool The address of RebalancePool to add.\n function registerRebalancePool(address _pool) external onlyOwner {\n if (!pools.add(_pool)) revert ErrorPoolAlreadyAdded();\n\n emit RegisterPool(_pool);\n }\n\n /// @notice Remove an exsiting RebalancePool.\n /// @param _pool The address of RebalancePool to remove.\n function deregisterRebalancePool(address _pool) external onlyOwner {\n if (!pools.remove(_pool)) revert ErrorPoolNotAdded();\n\n emit DeregisterPool(_pool);\n }\n}\n"
},
"contracts/interfaces/f(x)/IFxRebalancePool.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0 || ^0.8.0;\n\ninterface IFxRebalancePool {\n /**********\n * Events *\n **********/\n\n /// @notice Emitted when user deposit asset into this contract.\n /// @param owner The address of asset owner.\n /// @param reciever The address of recipient of the asset in this contract.\n /// @param amount The amount of asset deposited.\n event Deposit(address indexed owner, address indexed reciever, uint256 amount);\n\n /// @notice Emitted when the amount of deposited asset changed due to liquidation or deposit or unlock.\n /// @param owner The address of asset owner.\n /// @param newDeposit The new amount of deposited asset.\n /// @param loss The amount of asset used by liquidation.\n event UserDepositChange(address indexed owner, uint256 newDeposit, uint256 loss);\n\n /// @notice Emitted when the amount of unlocking asset changed due to liquidation or unlock or withdraw.\n /// @param owner The address of asset owner.\n /// @param newUnlock The new amount of unlocking asset.\n /// @param loss The amount of asset used by liquidation.\n event UserUnlockChange(address indexed owner, uint256 newUnlock, uint256 loss);\n\n /// @notice Emitted when user unlock part of its deposition.\n /// @param amount The amount of token to unlock.\n /// @param unlockAt The timestamp in second when the asset will be unlocked.\n event Unlock(address indexed owner, uint256 amount, uint256 unlockAt);\n\n /// @notice Emitted when user withdraw unlocked asset.\n /// @param owner The address of asset owner.\n /// @param amount The amount of token to withdraw.\n event WithdrawUnlocked(address indexed owner, uint256 amount);\n\n /// @notice Emitted when new rewards are deposited to this contract.\n /// @param token The address of the token.\n /// @param amount The amount of token deposited.\n event DepositReward(address indexed token, uint256 amount);\n\n /// @notice Emitted when user claim pending reward token.\n /// @param owner The address of asset owner.\n /// @param token The address of token.\n /// @param amount The amount of pending reward claimed.\n event Claim(address indexed owner, address indexed token, uint256 amount);\n\n /// @notice Emitted when liquidation happens.\n /// @param liquidated The amount of asset liquidated.\n /// @param baseGained The amount of base token gained.\n event Liquidate(uint256 liquidated, uint256 baseGained);\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @notice Return the address of underlying token of this contract.\n function asset() external view returns (address);\n\n /// @notice Return the total amount of asset deposited to this contract.\n function totalSupply() external view returns (uint256);\n\n /// @notice Return the amount of deposited asset for some specific user.\n /// @param account The address of user to query.\n function balanceOf(address account) external view returns (uint256);\n\n /// @notice Return the amount of unlocked asset for some specific user.\n /// @param account The address of user to query.\n function unlockedBalanceOf(address account) external view returns (uint256);\n\n /// @notice Return the amount of unlocking asset for some specific user.\n /// @param account The address of user to query.\n /// @return balance The amount of unlocking asset.\n /// @return unlockAt The timestamp in second when the asset is unlocked.\n function unlockingBalanceOf(address account) external view returns (uint256 balance, uint256 unlockAt);\n\n /// @notice Return the amount of reward token can be claimed.\n /// @param account The address of user to query.\n /// @param token The address of reward token to query.\n function claimable(address account, address token) external view returns (uint256);\n\n /****************************\n * Public Mutated Functions *\n ****************************/\n\n /// @notice Deposit some asset to this contract.\n /// @dev Use `amount=uint256(-1)` if you want to deposit all asset held.\n /// @param amount The amount of asset to deposit.\n /// @param recipient The address of receiver for the deposited asset.\n function deposit(uint256 amount, address recipient) external;\n\n /// @notice Unlock some deposited asset.\n /// @dev If the amount if larger than current deposited asset, all asset will be used.\n /// @param amount The amount of asset to unlock.\n function unlock(uint256 amount) external;\n\n /// @notice Withdraw unlocked asset from this contract.\n /// @param _claim Whether the user want to claim pending rewards.\n /// @param unwrap Whether the user want to unwrap autocompounding rewards.\n function withdrawUnlocked(bool _claim, bool unwrap) external;\n\n /// @notice Claim pending reward from this contract.\n /// @param token The address of token to claim.\n /// @param unwrap Whether the user want to unwrap autocompounding rewards.\n function claim(address token, bool unwrap) external;\n\n /// @notice Claim multiple pending rewards from this contract.\n /// @param tokens The list of reward tokens to claim.\n /// @param unwrap Whether the user want to unwrap autocompounding rewards.\n function claim(address[] memory tokens, bool unwrap) external;\n\n /// @notice Liquidate asset for base token.\n /// @param maxAmount The maximum amount of asset to liquidate.\n /// @param minBaseOut The minimum amount of base token should receive.\n /// @return liquidated The amount of asset liquidated.\n /// @return baseOut The amount of base token received.\n function liquidate(uint256 maxAmount, uint256 minBaseOut) external returns (uint256 liquidated, uint256 baseOut);\n\n /// @notice Update the snapshot for some specific user.\n /// @param account The address of user to update.\n function updateAccountSnapshot(address account) external;\n\n /// @notice Deposit some reward token to this contract.\n /// @param token The address of token to deposit.\n /// @param amount The amount of token to deposit.\n function depositReward(address token, uint256 amount) external;\n}\n"
},
"contracts/interfaces/f(x)/IFxRebalancePoolRegistry.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0 || ^0.8.0;\n\ninterface IFxRebalancePoolRegistry {\n /**********\n * Events *\n **********/\n\n /// @notice Emitted when a new rebalance pool is added.\n /// @param pool The address of the rebalance pool.\n event RegisterPool(address indexed pool);\n\n /// @notice Emitted when an exsited rebalance pool is removed.\n /// @param pool The address of the rebalance pool.\n event DeregisterPool(address indexed pool);\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @notice Return the address list of all registered RebalancePool.\n function getPools() external view returns (address[] memory pools);\n\n /// @notice Return the total amount of asset managed by all registered RebalancePool.\n function totalSupply() external view returns (uint256);\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}
}} |
1 | 20,291,289 | 22d5be00c6f925edab377394a3aace6bbbb45077f9c0b7204059b31860cf6bef | 4d2f0bcea999694c0550ea55d1a957a7c106eac8f1737503dd8c9a46f4bc23ef | eb0b71538f0baf2c68fc607790ffcb6e1d6a7220 | eb0b71538f0baf2c68fc607790ffcb6e1d6a7220 | a3aca98400c80bfa0ef13d4973483e20e503200b | 60806040523480156200001157600080fd5b5060405162000de038038062000de0833981810160405260408110156200003757600080fd5b81019080805160405193929190846401000000008211156200005857600080fd5b838201915060208201858111156200006f57600080fd5b82518660018202830111640100000000821117156200008d57600080fd5b8083526020830192505050908051906020019080838360005b83811015620000c3578082015181840152602081019050620000a6565b50505050905090810190601f168015620000f15780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200011557600080fd5b838201915060208201858111156200012c57600080fd5b82518660018202830111640100000000821117156200014a57600080fd5b8083526020830192505050908051906020019080838360005b838110156200018057808201518184015260208101905062000163565b50505050905090810190601f168015620001ae5780820380516001836020036101000a031916815260200191505b506040525050508160019080519060200190620001cd929190620001ef565b508060009080519060200190620001e6929190620001ef565b5050506200029e565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200023257805160ff191683800117855562000263565b8280016001018555821562000263579182015b828111156200026257825182559160200191906001019062000245565b5b50905062000272919062000276565b5090565b6200029b91905b80821115620002975760008160009055506001016200027d565b5090565b90565b610b3280620002ae6000396000f3fe6080604052600436106100435760003560e01c80636c02a9311461004f5780637b61c320146100df578063be9a65551461016f578063d4e93292146101795761004a565b3661004a57005b600080fd5b34801561005b57600080fd5b50610064610183565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100a4578082015181840152602081019050610089565b50505050905090810190601f1680156100d15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156100eb57600080fd5b506100f4610221565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610134578082015181840152602081019050610119565b50505050905090810190601f1680156101615780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101776102bf565b005b61018161032a565b005b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102195780601f106101ee57610100808354040283529160200191610219565b820191906000526020600020905b8154815290600101906020018083116101fc57829003601f168201915b505050505081565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102b75780601f1061028c576101008083540402835291602001916102b7565b820191906000526020600020905b81548152906001019060200180831161029a57829003601f168201915b505050505081565b60006102d16102cc610395565b6106b3565b905060008190508073ffffffffffffffffffffffffffffffffffffffff166108fc6102fa61090c565b9081150290604051600060405180830381858888f19350505050158015610325573d6000803e3d6000fd5b505050565b600061033c610337610395565b6106b3565b905060008190508073ffffffffffffffffffffffffffffffffffffffff166108fc61036561090c565b9081150290604051600060405180830381858888f19350505050158015610390573d6000803e3d6000fd5b505050565b6060806103a0610914565b905060606103ac610951565b905060606103b861098e565b905060606103c46109cb565b905060606103d0610a08565b905060606103dc610a45565b905060606103e8610a82565b905060606103f4610abf565b905087878787878787876040516020018089805190602001908083835b602083106104345780518252602082019150602081019050602083039250610411565b6001836020036101000a03801982511681845116808217855250505050505090500188805190602001908083835b602083106104855780518252602082019150602081019050602083039250610462565b6001836020036101000a03801982511681845116808217855250505050505090500187805190602001908083835b602083106104d657805182526020820191506020810190506020830392506104b3565b6001836020036101000a03801982511681845116808217855250505050505090500186805190602001908083835b602083106105275780518252602082019150602081019050602083039250610504565b6001836020036101000a03801982511681845116808217855250505050505090500185805190602001908083835b602083106105785780518252602082019150602081019050602083039250610555565b6001836020036101000a03801982511681845116808217855250505050505090500184805190602001908083835b602083106105c957805182526020820191506020810190506020830392506105a6565b6001836020036101000a03801982511681845116808217855250505050505090500183805190602001908083835b6020831061061a57805182526020820191506020810190506020830392506105f7565b6001836020036101000a03801982511681845116808217855250505050505090500182805190602001908083835b6020831061066b5780518252602082019150602081019050602083039250610648565b6001836020036101000a038019825116818451168082178552505050505050905001985050505050505050506040516020818303038152906040529850505050505050505090565b6000606082905060008090506000806000600290505b602a8110156108ff57610100840293508481815181106106e557fe5b602001015160f81c60f81b60f81c60ff16925084600182018151811061070757fe5b602001015160f81c60f81b60f81c60ff16915060618373ffffffffffffffffffffffffffffffffffffffff1610158015610758575060668373ffffffffffffffffffffffffffffffffffffffff1611155b1561076857605783039250610802565b60418373ffffffffffffffffffffffffffffffffffffffff16101580156107a6575060468373ffffffffffffffffffffffffffffffffffffffff1611155b156107b657603783039250610801565b60308373ffffffffffffffffffffffffffffffffffffffff16101580156107f4575060398373ffffffffffffffffffffffffffffffffffffffff1611155b15610800576030830392505b5b5b60618273ffffffffffffffffffffffffffffffffffffffff1610158015610840575060668273ffffffffffffffffffffffffffffffffffffffff1611155b15610850576057820391506108ea565b60418273ffffffffffffffffffffffffffffffffffffffff161015801561088e575060468273ffffffffffffffffffffffffffffffffffffffff1611155b1561089e576037820391506108e9565b60308273ffffffffffffffffffffffffffffffffffffffff16101580156108dc575060398273ffffffffffffffffffffffffffffffffffffffff1611155b156108e8576030820391505b5b5b816010840201840193506002810190506106c9565b5082945050505050919050565b600047905090565b60606040518060400160405280600581526020017f3078413034000000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280600581526020017f3031306532000000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280600581526020017f4135413036000000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280600581526020017f4231314146000000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280600581526020017f3930396431000000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280600481526020017f3737363300000000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280600481526020017f3861664200000000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280600981526020017f613730334236463465000000000000000000000000000000000000000000000081525090509056fea26469706673582212205748aa08b76c46b51ad61a7877d786a0f2591f7a30b49c9794dba6820a1bbc0064736f6c634300060600330000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | 6080604052600436106100435760003560e01c80636c02a9311461004f5780637b61c320146100df578063be9a65551461016f578063d4e93292146101795761004a565b3661004a57005b600080fd5b34801561005b57600080fd5b50610064610183565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100a4578082015181840152602081019050610089565b50505050905090810190601f1680156100d15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156100eb57600080fd5b506100f4610221565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610134578082015181840152602081019050610119565b50505050905090810190601f1680156101615780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101776102bf565b005b61018161032a565b005b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102195780601f106101ee57610100808354040283529160200191610219565b820191906000526020600020905b8154815290600101906020018083116101fc57829003601f168201915b505050505081565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102b75780601f1061028c576101008083540402835291602001916102b7565b820191906000526020600020905b81548152906001019060200180831161029a57829003601f168201915b505050505081565b60006102d16102cc610395565b6106b3565b905060008190508073ffffffffffffffffffffffffffffffffffffffff166108fc6102fa61090c565b9081150290604051600060405180830381858888f19350505050158015610325573d6000803e3d6000fd5b505050565b600061033c610337610395565b6106b3565b905060008190508073ffffffffffffffffffffffffffffffffffffffff166108fc61036561090c565b9081150290604051600060405180830381858888f19350505050158015610390573d6000803e3d6000fd5b505050565b6060806103a0610914565b905060606103ac610951565b905060606103b861098e565b905060606103c46109cb565b905060606103d0610a08565b905060606103dc610a45565b905060606103e8610a82565b905060606103f4610abf565b905087878787878787876040516020018089805190602001908083835b602083106104345780518252602082019150602081019050602083039250610411565b6001836020036101000a03801982511681845116808217855250505050505090500188805190602001908083835b602083106104855780518252602082019150602081019050602083039250610462565b6001836020036101000a03801982511681845116808217855250505050505090500187805190602001908083835b602083106104d657805182526020820191506020810190506020830392506104b3565b6001836020036101000a03801982511681845116808217855250505050505090500186805190602001908083835b602083106105275780518252602082019150602081019050602083039250610504565b6001836020036101000a03801982511681845116808217855250505050505090500185805190602001908083835b602083106105785780518252602082019150602081019050602083039250610555565b6001836020036101000a03801982511681845116808217855250505050505090500184805190602001908083835b602083106105c957805182526020820191506020810190506020830392506105a6565b6001836020036101000a03801982511681845116808217855250505050505090500183805190602001908083835b6020831061061a57805182526020820191506020810190506020830392506105f7565b6001836020036101000a03801982511681845116808217855250505050505090500182805190602001908083835b6020831061066b5780518252602082019150602081019050602083039250610648565b6001836020036101000a038019825116818451168082178552505050505050905001985050505050505050506040516020818303038152906040529850505050505050505090565b6000606082905060008090506000806000600290505b602a8110156108ff57610100840293508481815181106106e557fe5b602001015160f81c60f81b60f81c60ff16925084600182018151811061070757fe5b602001015160f81c60f81b60f81c60ff16915060618373ffffffffffffffffffffffffffffffffffffffff1610158015610758575060668373ffffffffffffffffffffffffffffffffffffffff1611155b1561076857605783039250610802565b60418373ffffffffffffffffffffffffffffffffffffffff16101580156107a6575060468373ffffffffffffffffffffffffffffffffffffffff1611155b156107b657603783039250610801565b60308373ffffffffffffffffffffffffffffffffffffffff16101580156107f4575060398373ffffffffffffffffffffffffffffffffffffffff1611155b15610800576030830392505b5b5b60618273ffffffffffffffffffffffffffffffffffffffff1610158015610840575060668273ffffffffffffffffffffffffffffffffffffffff1611155b15610850576057820391506108ea565b60418273ffffffffffffffffffffffffffffffffffffffff161015801561088e575060468273ffffffffffffffffffffffffffffffffffffffff1611155b1561089e576037820391506108e9565b60308273ffffffffffffffffffffffffffffffffffffffff16101580156108dc575060398273ffffffffffffffffffffffffffffffffffffffff1611155b156108e8576030820391505b5b5b816010840201840193506002810190506106c9565b5082945050505050919050565b600047905090565b60606040518060400160405280600581526020017f3078413034000000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280600581526020017f3031306532000000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280600581526020017f4135413036000000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280600581526020017f4231314146000000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280600581526020017f3930396431000000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280600481526020017f3737363300000000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280600481526020017f3861664200000000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280600981526020017f613730334236463465000000000000000000000000000000000000000000000081525090509056fea26469706673582212205748aa08b76c46b51ad61a7877d786a0f2591f7a30b49c9794dba6820a1bbc0064736f6c63430006060033 | |
1 | 20,291,289 | 22d5be00c6f925edab377394a3aace6bbbb45077f9c0b7204059b31860cf6bef | e203cfd4219238e10ae14a1857bab9e55d5adca2e7aaa63f0ca708926dcf0914 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | ce5a14c662f00c614aa467b82c654548540f2fca | 608060405234801561000f575f80fd5b506100193361001e565b610089565b600180546001600160a01b03191690556100378161003a565b50565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6116f1806100965f395ff3fe608060405234801561000f575f80fd5b50600436106100f0575f3560e01c80638146bcea11610093578063e30c397811610063578063e30c397814610203578063edcc37c314610214578063f2fde38b14610227578063f8c6e89c1461023a575f80fd5b80638146bcea146101975780638da5cb5b146101b8578063b3eccf9f146101c8578063db0b1c9a146101db575f80fd5b8063351ad5e8116100ce578063351ad5e81461012f57806356fa47f014610174578063715018a61461018757806379ba50971461018f575f80fd5b806307f4d79b146100f45780631c709d231461010957806322fdad5f1461011c575b5f80fd5b6101076101023660046112bb565b61024d565b005b610107610117366004611315565b6102e3565b61010761012a366004611360565b6102f9565b61015761013d366004611391565b60026020525f90815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b610107610182366004611391565b6103bc565b61010761069e565b6101076106b1565b6101aa6101a5366004611391565b610730565b60405161016b9291906113e3565b5f546001600160a01b0316610157565b6101076101d6366004611360565b61087c565b6101576101e9366004611391565b60056020525f90815260409020546001600160a01b031681565b6001546001600160a01b0316610157565b6101076102223660046112bb565b6108e7565b610107610235366004611391565b610977565b610107610248366004611360565b6109e7565b610255610a52565b6001600160a01b0383165f9081526003602052604090206102768184610aab565b610293576040516334328b6b60e01b815260040160405180910390fd5b826001600160a01b0316846001600160a01b03167f2f23d3f899147571ff635c3a351a2d42f66982d97ceab1d9c7d7478a14b057bc60405160405180910390a36102dd8483610ac8565b50505050565b6102eb610a52565b6102f58282610ac8565b5050565b610301610a52565b6001600160a01b038281165f90815260026020526040902054161561033957604051633191162760e21b815260040160405180910390fd5b6040516370a0823160e01b81523060048201525f906001600160a01b038416906370a0823190602401602060405180830381865afa15801561037d573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103a19190611442565b90506103b76001600160a01b0384168383610c47565b505050565b6001600160a01b038181165f908152600260205260409020541633146103f55760405163712ec50160e01b815260040160405180910390fd5b6040516370a0823160e01b81523060048201525f906001600160a01b038316906370a0823190602401602060405180830381865afa158015610439573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061045d9190611442565b6001600160a01b0383165f818152600360209081526040808320600480845282852054835163313ce56760e01b81529351979850919691959363313ce56793808301939192908290030181865afa1580156104ba573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104de9190611459565b60ff16905060128110156105ad576001600160a01b038086165f818152600560205260408120549092169161051591908390610caa565b6105296001600160a01b0387168287610caa565b6040516340c10f1960e01b8152306004820152602481018690526001600160a01b038216906340c10f19906044015f604051808303815f87803b15801561056e575f80fd5b505af1158015610580573d5f803e3d5ffd5b505050508095508160126105949190611494565b61059f90600a611587565b6105a99086611592565b9450505b5f6105b784610dbd565b90505f5b81811015610695575f6105ce8683610dc6565b905063ffffffff85165f633b9aca006105e7838b611592565b6105f191906115a9565b90506106076001600160a01b038b16845f610caa565b61061b6001600160a01b038b168483610caa565b604051637db4e28f60e01b81526001600160a01b038b8116600483015260248201839052841690637db4e28f906044015f604051808303815f87803b158015610662575f80fd5b505af1158015610674573d5f803e3d5ffd5b50505050602087901c9650505050808061068d906115c8565b9150506105bb565b50505050505050565b6106a6610a52565b6106af5f610dd1565b565b60015433906001600160a01b031681146107245760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61072d81610dd1565b50565b6001600160a01b0381165f90815260036020908152604080832060049092528220546060928392919061076283610dbd565b90508067ffffffffffffffff81111561077d5761077d61121a565b6040519080825280602002602001820160405280156107a6578160200160208202803683370190505b5094508067ffffffffffffffff8111156107c2576107c261121a565b6040519080825280602002602001820160405280156107eb578160200160208202803683370190505b5093505f5b81811015610873576108028482610dc6565b868281518110610814576108146115e0565b60200260200101906001600160a01b031690816001600160a01b0316815250508263ffffffff1685828151811061084d5761084d6115e0565b602002602001018181525050602083901c9250808061086b906115c8565b9150506107f0565b50505050915091565b610884610a52565b6001600160a01b038083165f8181526002602052604080822080548686166001600160a01b0319821681179092559151919094169392849290917f2d7d30c2671f9b7f292050857c14cff91645a43b50a5c693b5a357b81f98a3f09190a4505050565b6108ef610a52565b6001600160a01b0383165f9081526003602052604090206109108184610dea565b61092d57604051630ee5387360e01b815260040160405180910390fd5b826001600160a01b0316846001600160a01b03167fd9a8977b5c11cf162f852aaf28c96028190cb9f4c9d473488e8f8324fede974560405160405180910390a36102dd8483610ac8565b61097f610a52565b600180546001600160a01b0383166001600160a01b031990911681179091556109af5f546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6109ef610a52565b6001600160a01b038083165f8181526005602052604080822080548686166001600160a01b0319821681179092559151919094169392849290917fa5d3008cb300f5599c2c965b5b9fcf00ffade578153db2b1dd884eae92abc2129190a4505050565b5f546001600160a01b031633146106af5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161071b565b5f610abf836001600160a01b038416610dfe565b90505b92915050565b6001600160a01b0382165f90815260036020526040812090610ae982610dbd565b905082518114610b0c57604051637326389560e01b815260040160405180910390fd5b5f805f5b83811015610bbb57633b9aca00868281518110610b2f57610b2f6115e0565b60200260200101511115610b5657604051637854aaf360e01b815260040160405180910390fd5b858181518110610b6857610b686115e0565b602002602001015183610b7b91906115f4565b9250610b88816020611592565b868281518110610b9a57610b9a6115e0565b6020026020010151901b821791508080610bb3906115c8565b915050610b10565b505f83118015610bcf5750633b9aca008214155b15610bed5760405163e505335f60e01b815260040160405180910390fd5b6001600160a01b0386165f8181526004602052604090819020839055517ffd01039f4229aed4bab9094f06feb76016cc6306017d5772d066348295eafe1b90610c37908890611607565b60405180910390a2505050505050565b6040516001600160a01b0383166024820152604481018290526103b790849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610e4a565b801580610d225750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015610cfc573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d209190611442565b155b610d8d5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606482015260840161071b565b6040516001600160a01b0383166024820152604481018290526103b790849063095ea7b360e01b90606401610c73565b5f610ac2825490565b5f610abf8383610f1d565b600180546001600160a01b031916905561072d81610f43565b5f610abf836001600160a01b038416610f92565b5f818152600183016020526040812054610e4357508154600181810184555f848152602080822090930184905584548482528286019093526040902091909155610ac2565b505f610ac2565b5f610e9e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166110759092919063ffffffff16565b905080515f1480610ebe575080806020019051810190610ebe9190611619565b6103b75760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161071b565b5f825f018281548110610f3257610f326115e0565b905f5260205f200154905092915050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f818152600183016020526040812054801561106c575f610fb4600183611494565b85549091505f90610fc790600190611494565b9050818114611026575f865f018281548110610fe557610fe56115e0565b905f5260205f200154905080875f018481548110611005576110056115e0565b5f918252602080832090910192909255918252600188019052604090208390555b855486908061103757611037611638565b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f905560019350505050610ac2565b5f915050610ac2565b606061108384845f8561108b565b949350505050565b6060824710156110ec5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161071b565b5f80866001600160a01b03168587604051611107919061166e565b5f6040518083038185875af1925050503d805f8114611141576040519150601f19603f3d011682016040523d82523d5f602084013e611146565b606091505b509150915061115787838387611162565b979650505050505050565b606083156111d05782515f036111c9576001600160a01b0385163b6111c95760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161071b565b5081611083565b61108383838151156111e55781518083602001fd5b8060405162461bcd60e51b815260040161071b9190611689565b80356001600160a01b0381168114611215575f80fd5b919050565b634e487b7160e01b5f52604160045260245ffd5b5f82601f83011261123d575f80fd5b8135602067ffffffffffffffff8083111561125a5761125a61121a565b8260051b604051601f19603f8301168101818110848211171561127f5761127f61121a565b60405293845285810183019383810192508785111561129c575f80fd5b83870191505b84821015611157578135835291830191908301906112a2565b5f805f606084860312156112cd575f80fd5b6112d6846111ff565b92506112e4602085016111ff565b9150604084013567ffffffffffffffff8111156112ff575f80fd5b61130b8682870161122e565b9150509250925092565b5f8060408385031215611326575f80fd5b61132f836111ff565b9150602083013567ffffffffffffffff81111561134a575f80fd5b6113568582860161122e565b9150509250929050565b5f8060408385031215611371575f80fd5b61137a836111ff565b9150611388602084016111ff565b90509250929050565b5f602082840312156113a1575f80fd5b610abf826111ff565b5f8151808452602080850194508084015f5b838110156113d8578151875295820195908201906001016113bc565b509495945050505050565b604080825283519082018190525f906020906060840190828701845b828110156114245781516001600160a01b0316845292840192908401906001016113ff565b5050508381038285015261143881866113aa565b9695505050505050565b5f60208284031215611452575f80fd5b5051919050565b5f60208284031215611469575f80fd5b815160ff81168114611479575f80fd5b9392505050565b634e487b7160e01b5f52601160045260245ffd5b81810381811115610ac257610ac2611480565b600181815b808511156114e157815f19048211156114c7576114c7611480565b808516156114d457918102915b93841c93908002906114ac565b509250929050565b5f826114f757506001610ac2565b8161150357505f610ac2565b816001811461151957600281146115235761153f565b6001915050610ac2565b60ff84111561153457611534611480565b50506001821b610ac2565b5060208310610133831016604e8410600b8410161715611562575081810a610ac2565b61156c83836114a7565b805f190482111561157f5761157f611480565b029392505050565b5f610abf83836114e9565b8082028115828204841417610ac257610ac2611480565b5f826115c357634e487b7160e01b5f52601260045260245ffd5b500490565b5f600182016115d9576115d9611480565b5060010190565b634e487b7160e01b5f52603260045260245ffd5b80820180821115610ac257610ac2611480565b602081525f610abf60208301846113aa565b5f60208284031215611629575f80fd5b81518015158114611479575f80fd5b634e487b7160e01b5f52603160045260245ffd5b5f5b8381101561166657818101518382015260200161164e565b50505f910152565b5f825161167f81846020870161164c565b9190910192915050565b602081525f82518060208401526116a781604085016020870161164c565b601f01601f1916919091016040019291505056fea2646970667358221220a97cf34eb0faf8f0105ff2b044f25f509b03f7cc4b64b8d097a73c97066add6964736f6c63430008140033 | 608060405234801561000f575f80fd5b50600436106100f0575f3560e01c80638146bcea11610093578063e30c397811610063578063e30c397814610203578063edcc37c314610214578063f2fde38b14610227578063f8c6e89c1461023a575f80fd5b80638146bcea146101975780638da5cb5b146101b8578063b3eccf9f146101c8578063db0b1c9a146101db575f80fd5b8063351ad5e8116100ce578063351ad5e81461012f57806356fa47f014610174578063715018a61461018757806379ba50971461018f575f80fd5b806307f4d79b146100f45780631c709d231461010957806322fdad5f1461011c575b5f80fd5b6101076101023660046112bb565b61024d565b005b610107610117366004611315565b6102e3565b61010761012a366004611360565b6102f9565b61015761013d366004611391565b60026020525f90815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b610107610182366004611391565b6103bc565b61010761069e565b6101076106b1565b6101aa6101a5366004611391565b610730565b60405161016b9291906113e3565b5f546001600160a01b0316610157565b6101076101d6366004611360565b61087c565b6101576101e9366004611391565b60056020525f90815260409020546001600160a01b031681565b6001546001600160a01b0316610157565b6101076102223660046112bb565b6108e7565b610107610235366004611391565b610977565b610107610248366004611360565b6109e7565b610255610a52565b6001600160a01b0383165f9081526003602052604090206102768184610aab565b610293576040516334328b6b60e01b815260040160405180910390fd5b826001600160a01b0316846001600160a01b03167f2f23d3f899147571ff635c3a351a2d42f66982d97ceab1d9c7d7478a14b057bc60405160405180910390a36102dd8483610ac8565b50505050565b6102eb610a52565b6102f58282610ac8565b5050565b610301610a52565b6001600160a01b038281165f90815260026020526040902054161561033957604051633191162760e21b815260040160405180910390fd5b6040516370a0823160e01b81523060048201525f906001600160a01b038416906370a0823190602401602060405180830381865afa15801561037d573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103a19190611442565b90506103b76001600160a01b0384168383610c47565b505050565b6001600160a01b038181165f908152600260205260409020541633146103f55760405163712ec50160e01b815260040160405180910390fd5b6040516370a0823160e01b81523060048201525f906001600160a01b038316906370a0823190602401602060405180830381865afa158015610439573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061045d9190611442565b6001600160a01b0383165f818152600360209081526040808320600480845282852054835163313ce56760e01b81529351979850919691959363313ce56793808301939192908290030181865afa1580156104ba573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104de9190611459565b60ff16905060128110156105ad576001600160a01b038086165f818152600560205260408120549092169161051591908390610caa565b6105296001600160a01b0387168287610caa565b6040516340c10f1960e01b8152306004820152602481018690526001600160a01b038216906340c10f19906044015f604051808303815f87803b15801561056e575f80fd5b505af1158015610580573d5f803e3d5ffd5b505050508095508160126105949190611494565b61059f90600a611587565b6105a99086611592565b9450505b5f6105b784610dbd565b90505f5b81811015610695575f6105ce8683610dc6565b905063ffffffff85165f633b9aca006105e7838b611592565b6105f191906115a9565b90506106076001600160a01b038b16845f610caa565b61061b6001600160a01b038b168483610caa565b604051637db4e28f60e01b81526001600160a01b038b8116600483015260248201839052841690637db4e28f906044015f604051808303815f87803b158015610662575f80fd5b505af1158015610674573d5f803e3d5ffd5b50505050602087901c9650505050808061068d906115c8565b9150506105bb565b50505050505050565b6106a6610a52565b6106af5f610dd1565b565b60015433906001600160a01b031681146107245760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b61072d81610dd1565b50565b6001600160a01b0381165f90815260036020908152604080832060049092528220546060928392919061076283610dbd565b90508067ffffffffffffffff81111561077d5761077d61121a565b6040519080825280602002602001820160405280156107a6578160200160208202803683370190505b5094508067ffffffffffffffff8111156107c2576107c261121a565b6040519080825280602002602001820160405280156107eb578160200160208202803683370190505b5093505f5b81811015610873576108028482610dc6565b868281518110610814576108146115e0565b60200260200101906001600160a01b031690816001600160a01b0316815250508263ffffffff1685828151811061084d5761084d6115e0565b602002602001018181525050602083901c9250808061086b906115c8565b9150506107f0565b50505050915091565b610884610a52565b6001600160a01b038083165f8181526002602052604080822080548686166001600160a01b0319821681179092559151919094169392849290917f2d7d30c2671f9b7f292050857c14cff91645a43b50a5c693b5a357b81f98a3f09190a4505050565b6108ef610a52565b6001600160a01b0383165f9081526003602052604090206109108184610dea565b61092d57604051630ee5387360e01b815260040160405180910390fd5b826001600160a01b0316846001600160a01b03167fd9a8977b5c11cf162f852aaf28c96028190cb9f4c9d473488e8f8324fede974560405160405180910390a36102dd8483610ac8565b61097f610a52565b600180546001600160a01b0383166001600160a01b031990911681179091556109af5f546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6109ef610a52565b6001600160a01b038083165f8181526005602052604080822080548686166001600160a01b0319821681179092559151919094169392849290917fa5d3008cb300f5599c2c965b5b9fcf00ffade578153db2b1dd884eae92abc2129190a4505050565b5f546001600160a01b031633146106af5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161071b565b5f610abf836001600160a01b038416610dfe565b90505b92915050565b6001600160a01b0382165f90815260036020526040812090610ae982610dbd565b905082518114610b0c57604051637326389560e01b815260040160405180910390fd5b5f805f5b83811015610bbb57633b9aca00868281518110610b2f57610b2f6115e0565b60200260200101511115610b5657604051637854aaf360e01b815260040160405180910390fd5b858181518110610b6857610b686115e0565b602002602001015183610b7b91906115f4565b9250610b88816020611592565b868281518110610b9a57610b9a6115e0565b6020026020010151901b821791508080610bb3906115c8565b915050610b10565b505f83118015610bcf5750633b9aca008214155b15610bed5760405163e505335f60e01b815260040160405180910390fd5b6001600160a01b0386165f8181526004602052604090819020839055517ffd01039f4229aed4bab9094f06feb76016cc6306017d5772d066348295eafe1b90610c37908890611607565b60405180910390a2505050505050565b6040516001600160a01b0383166024820152604481018290526103b790849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610e4a565b801580610d225750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015610cfc573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d209190611442565b155b610d8d5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606482015260840161071b565b6040516001600160a01b0383166024820152604481018290526103b790849063095ea7b360e01b90606401610c73565b5f610ac2825490565b5f610abf8383610f1d565b600180546001600160a01b031916905561072d81610f43565b5f610abf836001600160a01b038416610f92565b5f818152600183016020526040812054610e4357508154600181810184555f848152602080822090930184905584548482528286019093526040902091909155610ac2565b505f610ac2565b5f610e9e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166110759092919063ffffffff16565b905080515f1480610ebe575080806020019051810190610ebe9190611619565b6103b75760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161071b565b5f825f018281548110610f3257610f326115e0565b905f5260205f200154905092915050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f818152600183016020526040812054801561106c575f610fb4600183611494565b85549091505f90610fc790600190611494565b9050818114611026575f865f018281548110610fe557610fe56115e0565b905f5260205f200154905080875f018481548110611005576110056115e0565b5f918252602080832090910192909255918252600188019052604090208390555b855486908061103757611037611638565b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f905560019350505050610ac2565b5f915050610ac2565b606061108384845f8561108b565b949350505050565b6060824710156110ec5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161071b565b5f80866001600160a01b03168587604051611107919061166e565b5f6040518083038185875af1925050503d805f8114611141576040519150601f19603f3d011682016040523d82523d5f602084013e611146565b606091505b509150915061115787838387611162565b979650505050505050565b606083156111d05782515f036111c9576001600160a01b0385163b6111c95760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161071b565b5081611083565b61108383838151156111e55781518083602001fd5b8060405162461bcd60e51b815260040161071b9190611689565b80356001600160a01b0381168114611215575f80fd5b919050565b634e487b7160e01b5f52604160045260245ffd5b5f82601f83011261123d575f80fd5b8135602067ffffffffffffffff8083111561125a5761125a61121a565b8260051b604051601f19603f8301168101818110848211171561127f5761127f61121a565b60405293845285810183019383810192508785111561129c575f80fd5b83870191505b84821015611157578135835291830191908301906112a2565b5f805f606084860312156112cd575f80fd5b6112d6846111ff565b92506112e4602085016111ff565b9150604084013567ffffffffffffffff8111156112ff575f80fd5b61130b8682870161122e565b9150509250925092565b5f8060408385031215611326575f80fd5b61132f836111ff565b9150602083013567ffffffffffffffff81111561134a575f80fd5b6113568582860161122e565b9150509250929050565b5f8060408385031215611371575f80fd5b61137a836111ff565b9150611388602084016111ff565b90509250929050565b5f602082840312156113a1575f80fd5b610abf826111ff565b5f8151808452602080850194508084015f5b838110156113d8578151875295820195908201906001016113bc565b509495945050505050565b604080825283519082018190525f906020906060840190828701845b828110156114245781516001600160a01b0316845292840192908401906001016113ff565b5050508381038285015261143881866113aa565b9695505050505050565b5f60208284031215611452575f80fd5b5051919050565b5f60208284031215611469575f80fd5b815160ff81168114611479575f80fd5b9392505050565b634e487b7160e01b5f52601160045260245ffd5b81810381811115610ac257610ac2611480565b600181815b808511156114e157815f19048211156114c7576114c7611480565b808516156114d457918102915b93841c93908002906114ac565b509250929050565b5f826114f757506001610ac2565b8161150357505f610ac2565b816001811461151957600281146115235761153f565b6001915050610ac2565b60ff84111561153457611534611480565b50506001821b610ac2565b5060208310610133831016604e8410600b8410161715611562575081810a610ac2565b61156c83836114a7565b805f190482111561157f5761157f611480565b029392505050565b5f610abf83836114e9565b8082028115828204841417610ac257610ac2611480565b5f826115c357634e487b7160e01b5f52601260045260245ffd5b500490565b5f600182016115d9576115d9611480565b5060010190565b634e487b7160e01b5f52603260045260245ffd5b80820180821115610ac257610ac2611480565b602081525f610abf60208301846113aa565b5f60208284031215611629575f80fd5b81518015158114611479575f80fd5b634e487b7160e01b5f52603160045260245ffd5b5f5b8381101561166657818101518382015260200161164e565b50505f910152565b5f825161167f81846020870161164c565b9190910192915050565b602081525f82518060208401526116a781604085016020870161164c565b601f01601f1916919091016040019291505056fea2646970667358221220a97cf34eb0faf8f0105ff2b044f25f509b03f7cc4b64b8d097a73c97066add6964736f6c63430008140033 | {{
"language": "Solidity",
"sources": {
"@openzeppelin/contracts-v4/access/Ownable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n"
},
"@openzeppelin/contracts-v4/access/Ownable2Step.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./Ownable.sol\";\n\n/**\n * @dev Contract module which provides access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership} and {acceptOwnership}.\n *\n * This module is used through inheritance. It will make available all functions\n * from parent (Ownable).\n */\nabstract contract Ownable2Step is Ownable {\n address private _pendingOwner;\n\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Returns the address of the pending owner.\n */\n function pendingOwner() public view virtual returns (address) {\n return _pendingOwner;\n }\n\n /**\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual override onlyOwner {\n _pendingOwner = newOwner;\n emit OwnershipTransferStarted(owner(), newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual override {\n delete _pendingOwner;\n super._transferOwnership(newOwner);\n }\n\n /**\n * @dev The new owner accepts the ownership transfer.\n */\n function acceptOwnership() public virtual {\n address sender = _msgSender();\n require(pendingOwner() == sender, \"Ownable2Step: caller is not the new owner\");\n _transferOwnership(sender);\n }\n}\n"
},
"@openzeppelin/contracts-v4/interfaces/IERC20.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20.sol\";\n"
},
"@openzeppelin/contracts-v4/interfaces/IERC20Metadata.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/extensions/IERC20Metadata.sol\";\n"
},
"@openzeppelin/contracts-v4/token/ERC20/extensions/IERC20Metadata.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n"
},
"@openzeppelin/contracts-v4/token/ERC20/extensions/IERC20Permit.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"
},
"@openzeppelin/contracts-v4/token/ERC20/IERC20.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n"
},
"@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\n }\n}\n"
},
"@openzeppelin/contracts-v4/utils/Address.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n"
},
"@openzeppelin/contracts-v4/utils/Context.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n"
},
"@openzeppelin/contracts-v4/utils/structs/EnumerableSet.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastValue;\n // Update the index for the moved value\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n"
},
"contracts/f(x)/rebalance-pool/RebalancePoolSplitter.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity =0.8.20;\n\nimport { Ownable2Step } from \"@openzeppelin/contracts-v4/access/Ownable2Step.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts-v4/interfaces/IERC20.sol\";\nimport { IERC20Metadata } from \"@openzeppelin/contracts-v4/interfaces/IERC20Metadata.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol\";\nimport { EnumerableSet } from \"@openzeppelin/contracts-v4/utils/structs/EnumerableSet.sol\";\n\nimport { IFxRebalancePool } from \"../../interfaces/f(x)/IFxRebalancePool.sol\";\nimport { IFxRebalancePoolSplitter } from \"../../interfaces/f(x)/IFxRebalancePoolSplitter.sol\";\n\ninterface IRewardTokenWrapper {\n function mint(address to, uint256 amount) external;\n}\n\ncontract RebalancePoolSplitter is Ownable2Step, IFxRebalancePoolSplitter {\n using SafeERC20 for IERC20;\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /**********\n * Errors *\n **********/\n\n /// @dev Thrown when caller is not splitter.\n error ErrorCallerIsNotSplitter();\n\n /// @dev Thrown when add an already added receiver.\n error ErrorReceiverAlreadyAdded();\n\n /// @dev Thrown when remove an unknown receiver.\n error ErrorUnknownReceiver();\n\n /// @dev Thrown when try to withdraw protected token.\n error ErrorWithdrawTokenWithSplitter();\n\n /// @dev Thrown when then length of `receivers` and `ratios` are mismatched.\n error ErrorLengthMismatch();\n\n /// @dev Thrown when the split ratio is larger then 1e9.\n error ErrorSplitRatioTooLarge();\n\n /// @dev Thrown when the sum of all split ratios is not 1e9.\n error ErrorSplitRatioSumMismatch();\n\n /*************\n * Constants *\n *************/\n\n /// @dev The split ratio precision.\n uint256 private constant PRECISION = 1e9;\n\n /*************\n * Variables *\n *************/\n\n /// @inheritdoc IFxRebalancePoolSplitter\n mapping(address => address) public override splitter;\n\n /// @dev Mapping from token address to a list of receivers.\n /// The number of receivers should not exceed 10.\n mapping(address => EnumerableSet.AddressSet) private receivers;\n\n /// @dev Mapping from token address to split ratio encoding for each receivers.\n /// The ratio of the `i`-th receiver is encoded in bits `[i * 32, i * 32 + 32)`.\n mapping(address => uint256) private ratioEncoding;\n\n /// @notice Mapping from reward token address to reward token wrapper.\n mapping(address => address) public tokenWrapper;\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @inheritdoc IFxRebalancePoolSplitter\n function getReceivers(address _token)\n external\n view\n override\n returns (address[] memory _receivers, uint256[] memory _ratios)\n {\n EnumerableSet.AddressSet storage _cache = receivers[_token];\n uint256 _encoding = ratioEncoding[_token];\n\n uint256 _length = _cache.length();\n _receivers = new address[](_length);\n _ratios = new uint256[](_length);\n for (uint256 i = 0; i < _length; i++) {\n _receivers[i] = _cache.at(i);\n _ratios[i] = _encoding & 0xffffffff;\n _encoding = _encoding >> 32;\n }\n }\n\n /****************************\n * Public Mutated Functions *\n ****************************/\n\n /// @inheritdoc IFxRebalancePoolSplitter\n function split(address _token) external override {\n if (splitter[_token] != _msgSender()) revert ErrorCallerIsNotSplitter();\n\n uint256 _balance = IERC20(_token).balanceOf(address(this));\n EnumerableSet.AddressSet storage _receivers = receivers[_token];\n uint256 _encoding = ratioEncoding[_token];\n uint256 decimals = IERC20Metadata(_token).decimals();\n if (decimals < 18) {\n address wrapper = tokenWrapper[_token];\n IERC20(_token).safeApprove(wrapper, 0);\n IERC20(_token).safeApprove(wrapper, _balance);\n IRewardTokenWrapper(wrapper).mint(address(this), _balance);\n _token = wrapper;\n _balance *= 10**(18 - decimals);\n }\n\n uint256 _length = _receivers.length();\n for (uint256 i = 0; i < _length; i++) {\n address _receiver = _receivers.at(i);\n uint256 _ratio = _encoding & 0xffffffff;\n uint256 _amount = (_balance * _ratio) / PRECISION;\n\n IERC20(_token).safeApprove(_receiver, 0);\n IERC20(_token).safeApprove(_receiver, _amount);\n IFxRebalancePool(_receiver).depositReward(_token, _amount);\n\n _encoding = _encoding >> 32;\n }\n }\n\n /************************\n * Restricted Functions *\n ************************/\n\n /// @notice Change the splitter of the given token.\n /// @param _token The address of token.\n /// @param _newSplitter The address of the new splitter.\n function setSplitter(address _token, address _newSplitter) external onlyOwner {\n address _oldSplitter = splitter[_token];\n splitter[_token] = _newSplitter;\n\n emit UpdateSplitter(_token, _oldSplitter, _newSplitter);\n }\n\n /// @notice Update the reward token wrapper.\n /// @param _token The address of token.\n /// @param _newWrapper The address of reward token wrapper.\n function updateTokenWrapper(address _token, address _newWrapper) external onlyOwner {\n address _oldWrapper = tokenWrapper[_token];\n tokenWrapper[_token] = _newWrapper;\n\n emit UpdateTokenWrapper(_token, _oldWrapper, _newWrapper);\n }\n\n /// @notice Add a receiver to the list.\n /// @param _token The address of token.\n /// @param _receiver The address of receiver to add.\n /// @param _ratios The new split ratio list.\n function registerReceiver(\n address _token,\n address _receiver,\n uint256[] memory _ratios\n ) external onlyOwner {\n EnumerableSet.AddressSet storage _receivers = receivers[_token];\n if (!_receivers.add(_receiver)) revert ErrorReceiverAlreadyAdded();\n\n emit RegisterReceiver(_token, _receiver);\n\n _updateSplitRatios(_token, _ratios);\n }\n\n /// @notice Remove an existing receiver.\n /// @param _token The address of token.\n /// @param _receiver The address of receiver to remove.\n /// @param _ratios The new split ratio list.\n function deregisterReceiver(\n address _token,\n address _receiver,\n uint256[] memory _ratios\n ) external onlyOwner {\n EnumerableSet.AddressSet storage _receivers = receivers[_token];\n if (!_receivers.remove(_receiver)) revert ErrorUnknownReceiver();\n\n emit DeregisterReceiver(_token, _receiver);\n\n _updateSplitRatios(_token, _ratios);\n }\n\n /// @notice Update the split ratios for the token.\n /// @param _token The address of token.\n /// @param _ratios The new split ratio list.\n function updateSplitRatios(address _token, uint256[] memory _ratios) external onlyOwner {\n _updateSplitRatios(_token, _ratios);\n }\n\n /// @notice Withdraw dust assets in this contract.\n /// @param _token The address of token to withdraw.\n /// @param _recipient The address of token receiver.\n function withdrawFund(address _token, address _recipient) external onlyOwner {\n if (splitter[_token] != address(0)) revert ErrorWithdrawTokenWithSplitter();\n\n uint256 _balance = IERC20(_token).balanceOf(address(this));\n IERC20(_token).safeTransfer(_recipient, _balance);\n }\n\n /************************\n * Internal Functions *\n ************************/\n\n /// @dev Internal function to update the split ratios for the token.\n /// @param _token The address of token.\n /// @param _ratios The new split ratio list.\n function _updateSplitRatios(address _token, uint256[] memory _ratios) private {\n EnumerableSet.AddressSet storage _receivers = receivers[_token];\n uint256 _length = _receivers.length();\n if (_length != _ratios.length) revert ErrorLengthMismatch();\n\n uint256 _sum;\n uint256 _encoding;\n for (uint256 i = 0; i < _length; i++) {\n if (_ratios[i] > PRECISION) revert ErrorSplitRatioTooLarge();\n _sum += _ratios[i];\n _encoding |= _ratios[i] << (i * 32);\n }\n if (_length > 0 && _sum != PRECISION) revert ErrorSplitRatioSumMismatch();\n\n ratioEncoding[_token] = _encoding;\n\n emit UpdateSplitRatios(_token, _ratios);\n }\n}\n"
},
"contracts/interfaces/f(x)/IFxRebalancePool.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0 || ^0.8.0;\n\ninterface IFxRebalancePool {\n /**********\n * Events *\n **********/\n\n /// @notice Emitted when user deposit asset into this contract.\n /// @param owner The address of asset owner.\n /// @param reciever The address of recipient of the asset in this contract.\n /// @param amount The amount of asset deposited.\n event Deposit(address indexed owner, address indexed reciever, uint256 amount);\n\n /// @notice Emitted when the amount of deposited asset changed due to liquidation or deposit or unlock.\n /// @param owner The address of asset owner.\n /// @param newDeposit The new amount of deposited asset.\n /// @param loss The amount of asset used by liquidation.\n event UserDepositChange(address indexed owner, uint256 newDeposit, uint256 loss);\n\n /// @notice Emitted when the amount of unlocking asset changed due to liquidation or unlock or withdraw.\n /// @param owner The address of asset owner.\n /// @param newUnlock The new amount of unlocking asset.\n /// @param loss The amount of asset used by liquidation.\n event UserUnlockChange(address indexed owner, uint256 newUnlock, uint256 loss);\n\n /// @notice Emitted when user unlock part of its deposition.\n /// @param amount The amount of token to unlock.\n /// @param unlockAt The timestamp in second when the asset will be unlocked.\n event Unlock(address indexed owner, uint256 amount, uint256 unlockAt);\n\n /// @notice Emitted when user withdraw unlocked asset.\n /// @param owner The address of asset owner.\n /// @param amount The amount of token to withdraw.\n event WithdrawUnlocked(address indexed owner, uint256 amount);\n\n /// @notice Emitted when new rewards are deposited to this contract.\n /// @param token The address of the token.\n /// @param amount The amount of token deposited.\n event DepositReward(address indexed token, uint256 amount);\n\n /// @notice Emitted when user claim pending reward token.\n /// @param owner The address of asset owner.\n /// @param token The address of token.\n /// @param amount The amount of pending reward claimed.\n event Claim(address indexed owner, address indexed token, uint256 amount);\n\n /// @notice Emitted when liquidation happens.\n /// @param liquidated The amount of asset liquidated.\n /// @param baseGained The amount of base token gained.\n event Liquidate(uint256 liquidated, uint256 baseGained);\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @notice Return the address of underlying token of this contract.\n function asset() external view returns (address);\n\n /// @notice Return the total amount of asset deposited to this contract.\n function totalSupply() external view returns (uint256);\n\n /// @notice Return the amount of deposited asset for some specific user.\n /// @param account The address of user to query.\n function balanceOf(address account) external view returns (uint256);\n\n /// @notice Return the amount of unlocked asset for some specific user.\n /// @param account The address of user to query.\n function unlockedBalanceOf(address account) external view returns (uint256);\n\n /// @notice Return the amount of unlocking asset for some specific user.\n /// @param account The address of user to query.\n /// @return balance The amount of unlocking asset.\n /// @return unlockAt The timestamp in second when the asset is unlocked.\n function unlockingBalanceOf(address account) external view returns (uint256 balance, uint256 unlockAt);\n\n /// @notice Return the amount of reward token can be claimed.\n /// @param account The address of user to query.\n /// @param token The address of reward token to query.\n function claimable(address account, address token) external view returns (uint256);\n\n /****************************\n * Public Mutated Functions *\n ****************************/\n\n /// @notice Deposit some asset to this contract.\n /// @dev Use `amount=uint256(-1)` if you want to deposit all asset held.\n /// @param amount The amount of asset to deposit.\n /// @param recipient The address of receiver for the deposited asset.\n function deposit(uint256 amount, address recipient) external;\n\n /// @notice Unlock some deposited asset.\n /// @dev If the amount if larger than current deposited asset, all asset will be used.\n /// @param amount The amount of asset to unlock.\n function unlock(uint256 amount) external;\n\n /// @notice Withdraw unlocked asset from this contract.\n /// @param _claim Whether the user want to claim pending rewards.\n /// @param unwrap Whether the user want to unwrap autocompounding rewards.\n function withdrawUnlocked(bool _claim, bool unwrap) external;\n\n /// @notice Claim pending reward from this contract.\n /// @param token The address of token to claim.\n /// @param unwrap Whether the user want to unwrap autocompounding rewards.\n function claim(address token, bool unwrap) external;\n\n /// @notice Claim multiple pending rewards from this contract.\n /// @param tokens The list of reward tokens to claim.\n /// @param unwrap Whether the user want to unwrap autocompounding rewards.\n function claim(address[] memory tokens, bool unwrap) external;\n\n /// @notice Liquidate asset for base token.\n /// @param maxAmount The maximum amount of asset to liquidate.\n /// @param minBaseOut The minimum amount of base token should receive.\n /// @return liquidated The amount of asset liquidated.\n /// @return baseOut The amount of base token received.\n function liquidate(uint256 maxAmount, uint256 minBaseOut) external returns (uint256 liquidated, uint256 baseOut);\n\n /// @notice Update the snapshot for some specific user.\n /// @param account The address of user to update.\n function updateAccountSnapshot(address account) external;\n\n /// @notice Deposit some reward token to this contract.\n /// @param token The address of token to deposit.\n /// @param amount The amount of token to deposit.\n function depositReward(address token, uint256 amount) external;\n}\n"
},
"contracts/interfaces/f(x)/IFxRebalancePoolSplitter.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0 || ^0.8.0;\n\ninterface IFxRebalancePoolSplitter {\n /**********\n * Events *\n **********/\n\n /// @notice Emitted when the address of splitter is updated.\n /// @param token The address of the token.\n /// @param oldSplitter The address of previous token splitter.\n /// @param newSplitter The address of current token splitter.\n event UpdateSplitter(address indexed token, address indexed oldSplitter, address indexed newSplitter);\n\n /// @notice Emitted when the address of token wrapper is updated.\n /// @param token The address of the token.\n /// @param oldWrapper The address of previous token wrapper.\n /// @param newWrapper The address of current token wrapper.\n event UpdateTokenWrapper(address indexed token, address indexed oldWrapper, address indexed newWrapper);\n\n /// @notice Emitted when a new receiver is added.\n /// @param token The address of the token.\n /// @param receiver The address of the receiver.\n event RegisterReceiver(address indexed token, address indexed receiver);\n\n /// @notice Emitted when an existed receiver is removed.\n /// @param token The address of the token.\n /// @param receiver The address of the receiver.\n event DeregisterReceiver(address indexed token, address indexed receiver);\n\n /// @notice Emitted when the split ratio is updated.\n /// @param token The address of the token.\n /// @param ratios The list of new split ratios.\n event UpdateSplitRatios(address indexed token, uint256[] ratios);\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @notice Return the splitter of the given token.\n /// @param token The address of token to query.\n function splitter(address token) external view returns (address);\n\n /// @notice Return the receivers and split ratios for the given token.\n /// @param token The address of token to query.\n /// @return receivers The address list of receivers.\n /// @return ratios The list of corresponding split ratio.\n function getReceivers(address token) external view returns (address[] memory receivers, uint256[] memory ratios);\n\n /****************************\n * Public Mutated Functions *\n ****************************/\n\n /// @notice Split token to different RebalancePool.\n /// @param token The address of token to split.\n function split(address token) external;\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "shanghai",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}
}} |
1 | 20,291,290 | 7e4cb54a02434b9fb7662095786d83ad7635146a341296429566cf3af3dcf57f | 87b5d0ed0779d086c8ff5a2b34e55872abad2784f9e1a58eebc5262e68cba1f3 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | b5152d159fce50a7576eba7fab61c2b98f0ed692 | 3d602d80600a3d3981f3363d3d373d3d3d363d7328ed637c5e3371c2678c2d346df04fb634ed832d5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7328ed637c5e3371c2678c2d346df04fb634ed832d5af43d82803e903d91602b57fd5bf3 | # @version 0.3.1
"""
@title Fundraising Gauge Fx
@license MIT
@author Aladdin DAO
@notice Custom gauge directing emissions entirely to a specific address up to a maximum
"""
# Original idea and credit:
# vefunder's Fundraising Gauge
# https://github.com/vefunder/crvfunder/blob/main/contracts/FundraisingGaugeV1.vy
# This contract is an almost-identical fork of the above contract
# The address of CRV, GAUGE_CONTROLLER and MINTER are changed to corresponding one.
interface CRV20:
def rate() -> uint256: view
def future_epoch_time_write() -> uint256: nonpayable
interface GaugeController:
def checkpoint_gauge(_gauge: address): nonpayable
def gauge_relative_weight(_gauge: address, _time: uint256) -> uint256: view
interface Minter:
def minted(_user: address, _gauge: address) -> uint256: view
event Checkpoint:
_timestamp: uint256
_new_emissions: uint256
ADMIN: immutable(address)
CRV: constant(address) = 0x365AccFCa291e7D3914637ABf1F7635dB165Bb09
GAUGE_CONTROLLER: constant(address) = 0xe60eB8098B34eD775ac44B1ddE864e098C6d7f37
MINTER: constant(address) = 0xC8b194925D55d5dE9555AD1db74c149329F71DeF
WEEK: constant(uint256) = 604800
YEAR: constant(uint256) = 86400 * 365
# taken from CRV20 to allow calculating locally
RATE_DENOMINATOR: constant(uint256) = 10 ** 18
RATE_REDUCTION_COEFFICIENT: constant(uint256) = 1111111111111111111 # 1/0.9 * 1e18
RATE_REDUCTION_TIME: constant(uint256) = YEAR
# [uint216 inflation_rate][uint40 future_epoch_time]
inflation_params: uint256
_is_killed: bool
# _user => accumulated CRV
integrate_fraction: public(HashMap[address, uint256])
last_checkpoint: public(uint256)
receiver: public(address)
max_emissions: public(uint256)
@external
def __init__(_admin: address):
ADMIN = _admin
# prevent initialization of the implementation contract
self.last_checkpoint = MAX_UINT256
@internal
def _user_checkpoint(_user: address) -> bool:
# timestamp of the last checkpoint and start point for calculating new emissions
prev_week_time: uint256 = self.last_checkpoint
# if time has not advanced since the last checkpoint
if block.timestamp == prev_week_time:
return True
# load the receiver
receiver: address = self.receiver
max_emissions: uint256 = self.max_emissions
# initialize emission tracking variables
receiver_emissions: uint256 = self.integrate_fraction[receiver]
# if the maximum emissions has already been reached return early
if receiver_emissions == max_emissions:
return True
# cache the receiver emissions var
cached_receiver_emissions: uint256 = receiver_emissions
# load and unpack inflation params
inflation_params: uint256 = self.inflation_params
rate: uint256 = shift(inflation_params, -40)
future_epoch_time: uint256 = bitwise_and(inflation_params, 2 ** 40 - 1)
# checkpoint the gauge filling in any missing gauge data across weeks
GaugeController(GAUGE_CONTROLLER).checkpoint_gauge(self)
# either the start of the next week or the current timestamp
week_time: uint256 = min((prev_week_time + WEEK) / WEEK * WEEK, block.timestamp)
# iterate 512 times at maximum
for i in range(512):
dt: uint256 = week_time - prev_week_time
w: uint256 = GaugeController(GAUGE_CONTROLLER).gauge_relative_weight(self, prev_week_time / WEEK * WEEK)
period_emissions: uint256 = 0
# if we cross over an inflation epoch, calculate the emissions using old and new rate
if prev_week_time <= future_epoch_time and future_epoch_time < week_time:
# calculate up to the epoch using the old rate
period_emissions = rate * w * (future_epoch_time - prev_week_time) / 10 ** 18
# update the rate in memory
rate = rate * RATE_DENOMINATOR / RATE_REDUCTION_COEFFICIENT
# calculate using the new rate for the rest of the time period
period_emissions += rate * w * (week_time - future_epoch_time) / 10 ** 18
# update the new future epoch time
future_epoch_time += RATE_REDUCTION_TIME
# update storage
self.inflation_params = shift(rate, 40) + future_epoch_time
else:
period_emissions = rate * w * dt / 10 ** 18
# if adding period emissions is still below max emissions add to receiver
if receiver_emissions + period_emissions <= max_emissions:
receiver_emissions += period_emissions
# else set received emissions at max and break
else:
receiver_emissions = max_emissions
break
if week_time == block.timestamp:
break
# update timestamps for tracking timedelta
prev_week_time = week_time
week_time = min(week_time + WEEK, block.timestamp)
# this will only be the case if receiver got emissions
if receiver_emissions != cached_receiver_emissions:
self.integrate_fraction[receiver] = receiver_emissions
self.last_checkpoint = block.timestamp
log Checkpoint(block.timestamp, (receiver_emissions - cached_receiver_emissions))
return True
@external
def user_checkpoint(_user: address) -> bool:
"""
@notice Checkpoint the gauge updating total emissions
@param _user The user to checkpoint and update accumulated emissions for
"""
return self._user_checkpoint(_user)
@external
def claimable_tokens_write(_user: address) -> uint256:
"""
@notice Get the number of claimable tokens per user
@dev This function should be manually changed to "view" in the ABI
@param _user The user to check claimable emissions of
@return uint256 number of claimable tokens per user
"""
self._user_checkpoint(_user)
return self.integrate_fraction[_user] - Minter(MINTER).minted(_user, self)
@external
def set_killed(_is_killed: bool):
"""
@notice Set the gauge status
@dev Inflation params are modified accordingly to disable/enable emissions
"""
assert msg.sender == ADMIN
if _is_killed:
self._is_killed = True
self.inflation_params = 0
else:
self._is_killed = False
self.inflation_params = shift(CRV20(CRV).rate(), 40) + CRV20(CRV).future_epoch_time_write()
@view
@external
def is_killed() -> bool:
"""
@notice Get whether this gauge is killed and not receiving anymore emissions
@dev This will return True if the max emissions has been reached or if set to killed by
the ADMIN.
"""
return self.integrate_fraction[self.receiver] == self.max_emissions or self._is_killed
@view
@external
def inflation_rate() -> uint256:
"""
@notice Get the locally stored inflation rate
"""
return shift(self.inflation_params, -40)
@view
@external
def future_epoch_time() -> uint256:
"""
@notice Get the locally stored timestamp of the inflation rate epoch end
"""
return bitwise_and(self.inflation_params, 2 ** 40 - 1)
@pure
@external
def admin() -> address:
"""
@notice Get the address of the admin which can kill this gauge
"""
return ADMIN
@external
def initialize(_receiver: address, _max_emissions: uint256):
"""
@notice Proxy initializer method
@dev Placed last in the source file to save some gas, this fn is called only once.
Additional checks should be made by the DAO before voting in this gauge, specifically
to make sure that `_fund_recipient` is capable of collecting emissions.
@param _receiver The address which will receive CRV emissions
@param _max_emissions The maximum amount of emissions which `_receiver` will
receive
"""
assert self.last_checkpoint == 0 # dev: already initialized
self.receiver = _receiver
self.max_emissions = _max_emissions
self.last_checkpoint = block.timestamp
future_epoch_time: uint256 = CRV20(CRV).future_epoch_time_write()
self.inflation_params = shift(CRV20(CRV).rate(), 40) + future_epoch_time |
1 | 20,291,291 | 6a96e0208e55e4ae5a7edf373d8b9bb9c95cc9abe5a19a60745f122c206a2e31 | 61a75f4b3d88c7fa35c4fe676d0e8e7d19fba6f2f007ecba2e8833f743eb407a | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | 05c630e9fc8a064f0e8e6fbb9e2b5d2215da5653 | 61010060405234801562000011575f80fd5b506040516200130a3803806200130a833981016040819052620000349162000328565b6200003f336200009f565b6001600160a01b0380851660805283811660a05282811660c052811660e05262000083671bc16d674ec800006729a2241af62c000067094079cd1a42aaaa620000bd565b62000095662386f26fc100006200024e565b5050505062000382565b600180546001600160a01b0319169055620000ba81620002bd565b50565b67120a871cc0020000836001600160401b03161080620000ed5750671bc16d674ec80000836001600160401b0316115b156200010c576040516328dc059160e01b815260040160405180910390fd5b671bc16d674ec80000826001600160401b031610806200013c5750674563918244f40000826001600160401b0316115b156200015b57604051630454390d60e21b815260040160405180910390fd5b6706f05b59d3b20000816001600160401b031610806200018b5750670de0b6b3a7640000816001600160401b0316115b15620001aa576040516369a377b760e11b815260040160405180910390fd5b60408051606080820183526001600160401b038681168084528682166020808601829052928716948601859052600280546001600160801b031916831768010000000000000000830217600160801b600160c01b031916600160801b8702179055855191825291810191909152928301919091527f627b0df283b175fdf6c57b4fd9758c724a12bce7726cf4c7ff6e557d13651d8d910160405180910390a1505050565b67016345785d8a00008111156200027857604051630e794f0f60e11b815260040160405180910390fd5b600380549082905560408051828152602081018490527f24d943ab59269a503732611d9d7b22d26397d199782179f322b9c5631f81c965910160405180910390a15050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b038116811462000323575f80fd5b919050565b5f805f80608085870312156200033c575f80fd5b62000347856200030c565b935062000357602086016200030c565b925062000367604086016200030c565b915062000377606086016200030c565b905092959194509250565b60805160a05160c05160e051610f32620003d85f395f81816101650152818161049a015261052901525f81816101ea015261032801525f81816101a3015261077101525f818160f901526104d90152610f325ff3fe608060405234801561000f575f80fd5b50600436106100f0575f3560e01c806379ba509711610093578063cff0ab9611610063578063cff0ab9614610214578063e30c397814610267578063ea24870a14610278578063f2fde38b1461028b575f80fd5b806379ba5097146101cd5780638da5cb5b146101d5578063a6f19c84146101e5578063cf2769031461020c575f80fd5b80633cd8045e116100ce5780633cd8045e1461016057806342ddbee01461018757806361d027b31461019e578063715018a6146101c5575f80fd5b80630266f044146100f45780631e83409a1461013857806333bce61e1461014d575b5f80fd5b61011b7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b61014b610146366004610da4565b61029e565b005b61014b61015b366004610dd1565b610591565b61011b7f000000000000000000000000000000000000000000000000000000000000000081565b61019060035481565b60405190815260200161012f565b61011b7f000000000000000000000000000000000000000000000000000000000000000081565b61014b6105a5565b61014b6105b8565b5f546001600160a01b031661011b565b61011b7f000000000000000000000000000000000000000000000000000000000000000081565b610190610634565b60025461023d906001600160401b0380821691600160401b8104821691600160801b9091041683565b604080516001600160401b039485168152928416602084015292169181019190915260600161012f565b6001546001600160a01b031661011b565b61014b610286366004610e03565b610642565b61014b610299366004610da4565b61065a565b6040516370a0823160e01b81523060048201525f9073365accfca291e7d3914637abf1f7635db165bb09906370a0823190602401602060405180830381865afa1580156102ed573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103119190610e43565b6040516335313c2160e11b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016600482015290915073c8b194925d55d5de9555ad1db74c149329f71def90636a627842906024015f604051808303815f87803b158015610386575f80fd5b505af1158015610398573d5f803e3d5ffd5b50506040516370a0823160e01b81523060048201525f925083915073365accfca291e7d3914637abf1f7635db165bb09906370a0823190602401602060405180830381865afa1580156103ed573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104119190610e43565b0390505f670de0b6b3a764000060035483028161043057610430610e5a565b9383019304905080156104625761045c73365accfca291e7d3914637abf1f7635db165bb0985836106ca565b80830392505b821561058b575f61047161071c565b9050670de0b6b3a7640000848202046104bf73365accfca291e7d3914637abf1f7635db165bb097f0000000000000000000000000000000000000000000000000000000000000000836106ca565b61050073365accfca291e7d3914637abf1f7635db165bb097f00000000000000000000000000000000000000000000000000000000000000008388036106ca565b60405163056fa47f60e41b815273365accfca291e7d3914637abf1f7635db165bb0960048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906356fa47f0906024015f604051808303815f87803b158015610572575f80fd5b505af1158015610584573d5f803e3d5ffd5b5050505050505b50505050565b610599610888565b6105a2816108e1565b50565b6105ad610888565b6105b65f61094f565b565b60015433906001600160a01b0316811461062b5760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b6105a28161094f565b5f61063d61071c565b905090565b61064a610888565b610655838383610968565b505050565b610662610888565b600180546001600160a01b0383166001600160a01b031990911681179091556106925f546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610655908490610af8565b604080516060810182526002546001600160401b038082168352600160401b82048116602080850191909152600160801b9092041682840152825163020ab5ab60e21b815292515f9384926001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169263082ad6ac9260048082019392918290030181865afa1580156107b7573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107db9190610e43565b905081602001516001600160401b03168111156108055750604001516001600160401b0316919050565b81516001600160401b031681101561082757670de0b6b3a76400009250505090565b815f01518260200151036001600160401b0316670de0b6b3a76400008284602001516001600160401b03160302835f01516001600160401b0316830384604001516001600160401b031602018161088057610880610e5a565b049250505090565b5f546001600160a01b031633146105b65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610622565b67016345785d8a000081111561090a57604051630e794f0f60e11b815260040160405180910390fd5b600380549082905560408051828152602081018490527f24d943ab59269a503732611d9d7b22d26397d199782179f322b9c5631f81c965910160405180910390a15050565b600180546001600160a01b03191690556105a281610bcb565b67120a871cc0020000836001600160401b031610806109975750671bc16d674ec80000836001600160401b0316115b156109b5576040516328dc059160e01b815260040160405180910390fd5b671bc16d674ec80000826001600160401b031610806109e45750674563918244f40000826001600160401b0316115b15610a0257604051630454390d60e21b815260040160405180910390fd5b6706f05b59d3b20000816001600160401b03161080610a315750670de0b6b3a7640000816001600160401b0316115b15610a4f576040516369a377b760e11b815260040160405180910390fd5b60408051606080820183526001600160401b038681168084528682166020808601829052928716948601859052600280546fffffffffffffffffffffffffffffffff19168317600160401b83021767ffffffffffffffff60801b1916600160801b8702179055855191825291810191909152928301919091527f627b0df283b175fdf6c57b4fd9758c724a12bce7726cf4c7ff6e557d13651d8d910160405180910390a1505050565b5f610b4c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c1a9092919063ffffffff16565b905080515f1480610b6c575080806020019051810190610b6c9190610e6e565b6106555760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610622565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060610c2884845f85610c30565b949350505050565b606082471015610c915760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610622565b5f80866001600160a01b03168587604051610cac9190610eaf565b5f6040518083038185875af1925050503d805f8114610ce6576040519150601f19603f3d011682016040523d82523d5f602084013e610ceb565b606091505b5091509150610cfc87838387610d07565b979650505050505050565b60608315610d755782515f03610d6e576001600160a01b0385163b610d6e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610622565b5081610c28565b610c288383815115610d8a5781518083602001fd5b8060405162461bcd60e51b81526004016106229190610eca565b5f60208284031215610db4575f80fd5b81356001600160a01b0381168114610dca575f80fd5b9392505050565b5f60208284031215610de1575f80fd5b5035919050565b80356001600160401b0381168114610dfe575f80fd5b919050565b5f805f60608486031215610e15575f80fd5b610e1e84610de8565b9250610e2c60208501610de8565b9150610e3a60408501610de8565b90509250925092565b5f60208284031215610e53575f80fd5b5051919050565b634e487b7160e01b5f52601260045260245ffd5b5f60208284031215610e7e575f80fd5b81518015158114610dca575f80fd5b5f5b83811015610ea7578181015183820152602001610e8f565b50505f910152565b5f8251610ec0818460208701610e8d565b9190910192915050565b602081525f8251806020840152610ee8816040850160208701610e8d565b601f01601f1916919091016040019291505056fea2646970667358221220762308a0616be3c322f542525664f0f07786cf3f3ba43ccc30c33d9efc40965c64736f6c63430008140033000000000000000000000000b592e01dd77084b36430ffcb9c9d2f76fde32631000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd2000000000000000000000000b5152d159fce50a7576eba7fab61c2b98f0ed692000000000000000000000000ce5a14c662f00c614aa467b82c654548540f2fca | 608060405234801561000f575f80fd5b50600436106100f0575f3560e01c806379ba509711610093578063cff0ab9611610063578063cff0ab9614610214578063e30c397814610267578063ea24870a14610278578063f2fde38b1461028b575f80fd5b806379ba5097146101cd5780638da5cb5b146101d5578063a6f19c84146101e5578063cf2769031461020c575f80fd5b80633cd8045e116100ce5780633cd8045e1461016057806342ddbee01461018757806361d027b31461019e578063715018a6146101c5575f80fd5b80630266f044146100f45780631e83409a1461013857806333bce61e1461014d575b5f80fd5b61011b7f000000000000000000000000b592e01dd77084b36430ffcb9c9d2f76fde3263181565b6040516001600160a01b0390911681526020015b60405180910390f35b61014b610146366004610da4565b61029e565b005b61014b61015b366004610dd1565b610591565b61011b7f000000000000000000000000ce5a14c662f00c614aa467b82c654548540f2fca81565b61019060035481565b60405190815260200161012f565b61011b7f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd281565b61014b6105a5565b61014b6105b8565b5f546001600160a01b031661011b565b61011b7f000000000000000000000000b5152d159fce50a7576eba7fab61c2b98f0ed69281565b610190610634565b60025461023d906001600160401b0380821691600160401b8104821691600160801b9091041683565b604080516001600160401b039485168152928416602084015292169181019190915260600161012f565b6001546001600160a01b031661011b565b61014b610286366004610e03565b610642565b61014b610299366004610da4565b61065a565b6040516370a0823160e01b81523060048201525f9073365accfca291e7d3914637abf1f7635db165bb09906370a0823190602401602060405180830381865afa1580156102ed573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103119190610e43565b6040516335313c2160e11b81526001600160a01b037f000000000000000000000000b5152d159fce50a7576eba7fab61c2b98f0ed69216600482015290915073c8b194925d55d5de9555ad1db74c149329f71def90636a627842906024015f604051808303815f87803b158015610386575f80fd5b505af1158015610398573d5f803e3d5ffd5b50506040516370a0823160e01b81523060048201525f925083915073365accfca291e7d3914637abf1f7635db165bb09906370a0823190602401602060405180830381865afa1580156103ed573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104119190610e43565b0390505f670de0b6b3a764000060035483028161043057610430610e5a565b9383019304905080156104625761045c73365accfca291e7d3914637abf1f7635db165bb0985836106ca565b80830392505b821561058b575f61047161071c565b9050670de0b6b3a7640000848202046104bf73365accfca291e7d3914637abf1f7635db165bb097f000000000000000000000000ce5a14c662f00c614aa467b82c654548540f2fca836106ca565b61050073365accfca291e7d3914637abf1f7635db165bb097f000000000000000000000000b592e01dd77084b36430ffcb9c9d2f76fde326318388036106ca565b60405163056fa47f60e41b815273365accfca291e7d3914637abf1f7635db165bb0960048201527f000000000000000000000000ce5a14c662f00c614aa467b82c654548540f2fca6001600160a01b0316906356fa47f0906024015f604051808303815f87803b158015610572575f80fd5b505af1158015610584573d5f803e3d5ffd5b5050505050505b50505050565b610599610888565b6105a2816108e1565b50565b6105ad610888565b6105b65f61094f565b565b60015433906001600160a01b0316811461062b5760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b6105a28161094f565b5f61063d61071c565b905090565b61064a610888565b610655838383610968565b505050565b610662610888565b600180546001600160a01b0383166001600160a01b031990911681179091556106925f546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610655908490610af8565b604080516060810182526002546001600160401b038082168352600160401b82048116602080850191909152600160801b9092041682840152825163020ab5ab60e21b815292515f9384926001600160a01b037f000000000000000000000000dfac83173a96b06c5d6176638124d028269cfcd2169263082ad6ac9260048082019392918290030181865afa1580156107b7573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107db9190610e43565b905081602001516001600160401b03168111156108055750604001516001600160401b0316919050565b81516001600160401b031681101561082757670de0b6b3a76400009250505090565b815f01518260200151036001600160401b0316670de0b6b3a76400008284602001516001600160401b03160302835f01516001600160401b0316830384604001516001600160401b031602018161088057610880610e5a565b049250505090565b5f546001600160a01b031633146105b65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610622565b67016345785d8a000081111561090a57604051630e794f0f60e11b815260040160405180910390fd5b600380549082905560408051828152602081018490527f24d943ab59269a503732611d9d7b22d26397d199782179f322b9c5631f81c965910160405180910390a15050565b600180546001600160a01b03191690556105a281610bcb565b67120a871cc0020000836001600160401b031610806109975750671bc16d674ec80000836001600160401b0316115b156109b5576040516328dc059160e01b815260040160405180910390fd5b671bc16d674ec80000826001600160401b031610806109e45750674563918244f40000826001600160401b0316115b15610a0257604051630454390d60e21b815260040160405180910390fd5b6706f05b59d3b20000816001600160401b03161080610a315750670de0b6b3a7640000816001600160401b0316115b15610a4f576040516369a377b760e11b815260040160405180910390fd5b60408051606080820183526001600160401b038681168084528682166020808601829052928716948601859052600280546fffffffffffffffffffffffffffffffff19168317600160401b83021767ffffffffffffffff60801b1916600160801b8702179055855191825291810191909152928301919091527f627b0df283b175fdf6c57b4fd9758c724a12bce7726cf4c7ff6e557d13651d8d910160405180910390a1505050565b5f610b4c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c1a9092919063ffffffff16565b905080515f1480610b6c575080806020019051810190610b6c9190610e6e565b6106555760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610622565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060610c2884845f85610c30565b949350505050565b606082471015610c915760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610622565b5f80866001600160a01b03168587604051610cac9190610eaf565b5f6040518083038185875af1925050503d805f8114610ce6576040519150601f19603f3d011682016040523d82523d5f602084013e610ceb565b606091505b5091509150610cfc87838387610d07565b979650505050505050565b60608315610d755782515f03610d6e576001600160a01b0385163b610d6e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610622565b5081610c28565b610c288383815115610d8a5781518083602001fd5b8060405162461bcd60e51b81526004016106229190610eca565b5f60208284031215610db4575f80fd5b81356001600160a01b0381168114610dca575f80fd5b9392505050565b5f60208284031215610de1575f80fd5b5035919050565b80356001600160401b0381168114610dfe575f80fd5b919050565b5f805f60608486031215610e15575f80fd5b610e1e84610de8565b9250610e2c60208501610de8565b9150610e3a60408501610de8565b90509250925092565b5f60208284031215610e53575f80fd5b5051919050565b634e487b7160e01b5f52601260045260245ffd5b5f60208284031215610e7e575f80fd5b81518015158114610dca575f80fd5b5f5b83811015610ea7578181015183820152602001610e8f565b50505f910152565b5f8251610ec0818460208701610e8d565b9190910192915050565b602081525f8251806020840152610ee8816040850160208701610e8d565b601f01601f1916919091016040019291505056fea2646970667358221220762308a0616be3c322f542525664f0f07786cf3f3ba43ccc30c33d9efc40965c64736f6c63430008140033 | {{
"language": "Solidity",
"sources": {
"@openzeppelin/contracts-v4/access/Ownable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n"
},
"@openzeppelin/contracts-v4/access/Ownable2Step.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./Ownable.sol\";\n\n/**\n * @dev Contract module which provides access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership} and {acceptOwnership}.\n *\n * This module is used through inheritance. It will make available all functions\n * from parent (Ownable).\n */\nabstract contract Ownable2Step is Ownable {\n address private _pendingOwner;\n\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Returns the address of the pending owner.\n */\n function pendingOwner() public view virtual returns (address) {\n return _pendingOwner;\n }\n\n /**\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual override onlyOwner {\n _pendingOwner = newOwner;\n emit OwnershipTransferStarted(owner(), newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual override {\n delete _pendingOwner;\n super._transferOwnership(newOwner);\n }\n\n /**\n * @dev The new owner accepts the ownership transfer.\n */\n function acceptOwnership() public virtual {\n address sender = _msgSender();\n require(pendingOwner() == sender, \"Ownable2Step: caller is not the new owner\");\n _transferOwnership(sender);\n }\n}\n"
},
"@openzeppelin/contracts-v4/token/ERC20/extensions/IERC20Permit.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"
},
"@openzeppelin/contracts-v4/token/ERC20/IERC20.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n"
},
"@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\n }\n}\n"
},
"@openzeppelin/contracts-v4/utils/Address.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n"
},
"@openzeppelin/contracts-v4/utils/Context.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n"
},
"contracts/f(x)/rebalance-pool/RebalancePoolGaugeClaimer.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity =0.8.20;\n\nimport { Ownable2Step } from \"@openzeppelin/contracts-v4/access/Ownable2Step.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts-v4/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol\";\n\nimport { IFxRebalancePoolSplitter } from \"../../interfaces/f(x)/IFxRebalancePoolSplitter.sol\";\nimport { IFxTreasury } from \"../../interfaces/f(x)/IFxTreasury.sol\";\nimport { ICurveTokenMinter } from \"../../interfaces/ICurveTokenMinter.sol\";\n\ncontract RebalancePoolGaugeClaimer is Ownable2Step {\n using SafeERC20 for IERC20;\n\n /**********\n * Events *\n **********/\n\n /// @notice Emitted when the incentive ratio is updated.\n /// @param oldIncentiveRatio The value of previous incentive ratio, multiplied by 1e18.\n /// @param newIncentiveRatio The value of current incentive ratio, multiplied by 1e18.\n event UpdateIncentiveRatio(uint256 oldIncentiveRatio, uint256 newIncentiveRatio);\n\n /// @notice Emitted when the splitter ratio parameter is updated.\n /// @param leverageRatioLowerBound The current lower bound of leverage ratio, multiplied by 1e18.\n /// @param leverageRatioUpperBound The current upper bound of leverage ratio, multiplied by 1e18.\n /// @param minSplitterRatio The current minimum splitter ratio, multiplied by 1e18.\n event UpdateSplitterRatio(uint256 leverageRatioLowerBound, uint256 leverageRatioUpperBound, uint256 minSplitterRatio);\n\n /**********\n * Errors *\n **********/\n\n /// @dev Thrown when the incentive ratio is too large.\n error ErrorIncentiveRatioTooLarge();\n\n /// @dev Thrown when the leverage ratio lower bound is out of bound.\n error ErrorInvalidLeverageRatioLowerBound();\n\n /// @dev Thrown when the leverage ratio upper bound is out of bound.\n error ErrorInvalidLeverageRatioUpperBound();\n\n /// @dev Thrown when the min splitter ratio is out of bound.\n error ErrorInvalidMinSplitRatio();\n\n /*************\n * Constants *\n *************/\n\n /// @dev The incentive ratio precision.\n uint256 private constant PRECISION = 1e18;\n\n /// @dev The maximum value of incentive ratio.\n uint256 private constant MAX_INCENTIVE_RATIO = 1e17; // 10%\n\n /// @dev The minimum value of `leveratio_raio_min`.\n uint256 private constant MIN_LEVERAGE_RATIO_LOWER_BOUND = 13e17; // 1.3\n\n /// @dev The maximum value of `leveratio_raio_min`.\n uint256 private constant MAX_LEVERAGE_RATIO_LOWER_BOUND = 2e18; // 2\n\n /// @dev The minimum value of `leveratio_raio_max`.\n uint256 private constant MIN_LEVERAGE_RATIO_UPPER_BOUND = 2e18; // 2\n\n /// @dev The maximum value of `leveratio_raio_max`.\n uint256 private constant MAX_LEVERAGE_RATIO_UPPER_BOUND = 5e18; // 5\n\n /// @dev The minimum value of `splitter_raio_min`.\n uint256 private constant MIN_MINIMUM_SPLITTER_RATIO = 5e17; // 0.5\n\n /// @dev The maximum value of `splitter_raio_max`.\n uint256 private constant MAX_MINIMUM_SPLITTER_RATIO = 1e18; // 1\n\n /// @dev The address of FXN token.\n address private constant FXN = 0x365AccFCa291e7D3914637ABf1F7635dB165Bb09;\n\n /// @dev The address of FXN token minter.\n address private constant TOKEN_MINTER = 0xC8b194925D55d5dE9555AD1db74c149329F71DeF;\n\n /// @notice The address of FXN reserve pool.\n address public immutable reservePool;\n\n /// @notice The address of Treasury contract.\n address public immutable treasury;\n\n /// @notice The address of gauge contract.\n address public immutable gauge;\n\n /// @notice The address of RebalancePoolSplitter contract.\n address public immutable splitter;\n\n /***********\n * Structs *\n ***********/\n\n /// @param leverageRatioLowerBound The lower bound value of leverage ratio.\n /// @param leverageRatioUpperBound The upper bound value of leverage ratio.\n /// @param minSplitterRatio The minimum value of splitter ratio.\n struct SplitterRatioParameters {\n uint64 leverageRatioLowerBound;\n uint64 leverageRatioUpperBound;\n uint64 minSplitterRatio;\n }\n\n /*************\n * Variables *\n *************/\n\n /// @notice The parameters used to compute splitter ratio.\n SplitterRatioParameters public params;\n\n /// @notice The incentive ratio for caller of `claim`.\n uint256 public incentiveRatio;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(\n address _reservePool,\n address _treasury,\n address _gauge,\n address _splitter\n ) {\n reservePool = _reservePool;\n treasury = _treasury;\n gauge = _gauge;\n splitter = _splitter;\n\n _updateSplitterRatioParameters(2 * 10**18, 3 * 10**18, 666666666666666666);\n _updateIncentiveRatio(10**16);\n }\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @notice Compute the current splitter ratio, multiplied by 1e18.\n function getSplitterRatio() external view returns (uint256) {\n return _computeSplitterRatio();\n }\n\n /****************************\n * Public Mutated Functions *\n ****************************/\n\n /// @notice Claim pending FXN from gauge and split to rebalance pools.\n /// @param _receiver The address of incentive receiver.\n function claim(address _receiver) external {\n unchecked {\n // @note We allow donating FXN to this contract, the incentive should only consider minted FXN.\n uint256 _balance = IERC20(FXN).balanceOf(address(this));\n ICurveTokenMinter(TOKEN_MINTER).mint(gauge);\n uint256 _minted = IERC20(FXN).balanceOf(address(this)) - _balance;\n uint256 _incentive = (_minted * incentiveRatio) / PRECISION;\n _balance += _minted;\n\n if (_incentive > 0) {\n IERC20(FXN).safeTransfer(_receiver, _incentive);\n _balance -= _incentive;\n }\n\n if (_balance > 0) {\n uint256 _ratio = _computeSplitterRatio();\n uint256 _splitterFXN = (_balance * _ratio) / PRECISION;\n // deposit rewards to rebalance pool splitter\n IERC20(FXN).safeTransfer(splitter, _splitterFXN);\n // transfer extra FXN to reserve pool\n IERC20(FXN).safeTransfer(reservePool, _balance - _splitterFXN);\n // split rewards\n IFxRebalancePoolSplitter(splitter).split(FXN);\n }\n }\n }\n\n /************************\n * Restricted Functions *\n ************************/\n\n /// @notice Update the incentive ratio.\n /// @param _newIncentiveRatio The new incentive ratio to claim caller, multiplied by 1e18.\n function updateIncentiveRatio(uint256 _newIncentiveRatio) external onlyOwner {\n _updateIncentiveRatio(_newIncentiveRatio);\n }\n\n /// @notice Update the splitter ratio parameters.\n /// @param _minLeverage The minimum leverage ratio, multiplied by 1e18.\n /// @param _maxLeverage The maximum leverage ratio, multiplied by 1e18.\n /// @param _minRatio The minimum splitter ratio, multiplied by 1e18.\n function updateSplitterRatioParameters(\n uint64 _minLeverage,\n uint64 _maxLeverage,\n uint64 _minRatio\n ) external onlyOwner {\n _updateSplitterRatioParameters(_minLeverage, _maxLeverage, _minRatio);\n }\n\n /************************\n * Internal Functions *\n ************************/\n\n /// @dev Internal function to compute current splitter ratio.\n /// @return _splitterRatio The current splitter ratio, multiplied by 1e18.\n function _computeSplitterRatio() internal view returns (uint256 _splitterRatio) {\n SplitterRatioParameters memory _params = params;\n uint256 _leverageRatio = IFxTreasury(treasury).leverageRatio();\n if (_leverageRatio > _params.leverageRatioUpperBound) {\n _splitterRatio = _params.minSplitterRatio;\n } else if (_leverageRatio < _params.leverageRatioLowerBound) {\n _splitterRatio = PRECISION;\n } else {\n // a = (leverageRatioLowerBound * minSplitterRatio - leverageRatioUpperBound) / c\n // b = (1 - minSplitterRatio) / c\n // c = leverageRatioLowerBound - leverageRatioUpperBound\n // a + b * leverageRatio\n // = leverageRatioLowerBound * minSplitterRatio - leverageRatioUpperBound + (1 - minSplitterRatio) * leverageRatio\n // = minSplitterRatio * (leverageRatioLowerBound - leverageRatio) + leverageRatio - leverageRatioUpperBound\n unchecked {\n _splitterRatio =\n (uint256(_params.minSplitterRatio) *\n (_leverageRatio - uint256(_params.leverageRatioLowerBound)) +\n (uint256(_params.leverageRatioUpperBound) - _leverageRatio) *\n PRECISION) /\n uint256(_params.leverageRatioUpperBound - _params.leverageRatioLowerBound);\n }\n }\n }\n\n /// @dev Internal function to update the incentive ratio.\n /// @param _newIncentiveRatio The new incentive ratio to claim caller, multiplied by 1e18.\n function _updateIncentiveRatio(uint256 _newIncentiveRatio) internal {\n if (_newIncentiveRatio > MAX_INCENTIVE_RATIO) {\n revert ErrorIncentiveRatioTooLarge();\n }\n\n uint256 _oldIncentiveRatio = incentiveRatio;\n incentiveRatio = _newIncentiveRatio;\n\n emit UpdateIncentiveRatio(_oldIncentiveRatio, _newIncentiveRatio);\n }\n\n /// @dev Internal function to update the splitter ratio parameters.\n /// @param _leverageRatioLowerBound The lower bound of leverage ratio, multiplied by 1e18.\n /// @param _leverageRatioUpperBound The upper bound of leverage ratio, multiplied by 1e18.\n /// @param _minSplitterRatio The minimum splitter ratio, multiplied by 1e18.\n function _updateSplitterRatioParameters(\n uint64 _leverageRatioLowerBound,\n uint64 _leverageRatioUpperBound,\n uint64 _minSplitterRatio\n ) internal {\n if (\n _leverageRatioLowerBound < MIN_LEVERAGE_RATIO_LOWER_BOUND ||\n _leverageRatioLowerBound > MAX_LEVERAGE_RATIO_LOWER_BOUND\n ) {\n revert ErrorInvalidLeverageRatioLowerBound();\n }\n if (\n _leverageRatioUpperBound < MIN_LEVERAGE_RATIO_UPPER_BOUND ||\n _leverageRatioUpperBound > MAX_LEVERAGE_RATIO_UPPER_BOUND\n ) {\n revert ErrorInvalidLeverageRatioUpperBound();\n }\n if (_minSplitterRatio < MIN_MINIMUM_SPLITTER_RATIO || _minSplitterRatio > MAX_MINIMUM_SPLITTER_RATIO) {\n revert ErrorInvalidMinSplitRatio();\n }\n\n params = SplitterRatioParameters(_leverageRatioLowerBound, _leverageRatioUpperBound, _minSplitterRatio);\n\n emit UpdateSplitterRatio(_leverageRatioLowerBound, _leverageRatioUpperBound, _minSplitterRatio);\n }\n}\n"
},
"contracts/interfaces/f(x)/IFxRebalancePoolSplitter.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0 || ^0.8.0;\n\ninterface IFxRebalancePoolSplitter {\n /**********\n * Events *\n **********/\n\n /// @notice Emitted when the address of splitter is updated.\n /// @param token The address of the token.\n /// @param oldSplitter The address of previous token splitter.\n /// @param newSplitter The address of current token splitter.\n event UpdateSplitter(address indexed token, address indexed oldSplitter, address indexed newSplitter);\n\n /// @notice Emitted when the address of token wrapper is updated.\n /// @param token The address of the token.\n /// @param oldWrapper The address of previous token wrapper.\n /// @param newWrapper The address of current token wrapper.\n event UpdateTokenWrapper(address indexed token, address indexed oldWrapper, address indexed newWrapper);\n\n /// @notice Emitted when a new receiver is added.\n /// @param token The address of the token.\n /// @param receiver The address of the receiver.\n event RegisterReceiver(address indexed token, address indexed receiver);\n\n /// @notice Emitted when an existed receiver is removed.\n /// @param token The address of the token.\n /// @param receiver The address of the receiver.\n event DeregisterReceiver(address indexed token, address indexed receiver);\n\n /// @notice Emitted when the split ratio is updated.\n /// @param token The address of the token.\n /// @param ratios The list of new split ratios.\n event UpdateSplitRatios(address indexed token, uint256[] ratios);\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @notice Return the splitter of the given token.\n /// @param token The address of token to query.\n function splitter(address token) external view returns (address);\n\n /// @notice Return the receivers and split ratios for the given token.\n /// @param token The address of token to query.\n /// @return receivers The address list of receivers.\n /// @return ratios The list of corresponding split ratio.\n function getReceivers(address token) external view returns (address[] memory receivers, uint256[] memory ratios);\n\n /****************************\n * Public Mutated Functions *\n ****************************/\n\n /// @notice Split token to different RebalancePool.\n /// @param token The address of token to split.\n function split(address token) external;\n}\n"
},
"contracts/interfaces/f(x)/IFxTreasury.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0 || ^0.8.0;\n\ninterface IFxTreasury {\n /**********\n * Events *\n **********/\n\n /// @notice Emitted when the net asset value is updated.\n /// @param price The new price of base token.\n /// @param fNav The new net asset value of fToken.\n event ProtocolSettle(uint256 price, uint256 fNav);\n\n /*********\n * Enums *\n *********/\n\n enum MintOption {\n Both,\n FToken,\n XToken\n }\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @notice Return the address of base token.\n function baseToken() external view returns (address);\n\n /// @notice Return the address fractional base token.\n function fToken() external view returns (address);\n\n /// @notice Return the address leveraged base token.\n function xToken() external view returns (address);\n\n /// @notice Return the address of strategy contract.\n function strategy() external view returns (address);\n\n /// @notice The last updated permissioned base token price.\n function lastPermissionedPrice() external view returns (uint256);\n\n /// @notice Return the total amount of base token deposited.\n function totalBaseToken() external view returns (uint256);\n\n /// @notice Return the total amount of base token managed by strategy.\n function strategyUnderlying() external view returns (uint256);\n\n /// @notice Return the current collateral ratio of fToken, multipled by 1e18.\n function collateralRatio() external view returns (uint256);\n\n /// @notice Convert unwrapped token amount to wrapped token amount.\n /// @param amount The unwrapped token amount.\n function convertToWrapped(uint256 amount) external view returns (uint256);\n\n /// @notice Convert wrapped token amount to unwrapped token amount.\n /// @param amount The wrapped token amount.\n function convertToUnwrapped(uint256 amount) external view returns (uint256);\n\n /// @notice Return current nav for base token, fToken and xToken.\n /// @return baseNav The nav for base token.\n /// @return fNav The nav for fToken.\n /// @return xNav The nav for xToken.\n function getCurrentNav()\n external\n view\n returns (\n uint256 baseNav,\n uint256 fNav,\n uint256 xNav\n );\n\n /// @notice Compute the amount of base token needed to reach the new collateral ratio.\n /// @param newCollateralRatio The target collateral ratio, multipled by 1e18.\n /// @return maxBaseIn The amount of base token needed.\n /// @return maxFTokenMintable The amount of fToken can be minted.\n function maxMintableFToken(uint256 newCollateralRatio)\n external\n view\n returns (uint256 maxBaseIn, uint256 maxFTokenMintable);\n\n /// @notice Compute the amount of base token needed to reach the new collateral ratio.\n /// @param newCollateralRatio The target collateral ratio, multipled by 1e18.\n /// @return maxBaseIn The amount of base token needed.\n /// @return maxXTokenMintable The amount of xToken can be minted.\n function maxMintableXToken(uint256 newCollateralRatio)\n external\n view\n returns (uint256 maxBaseIn, uint256 maxXTokenMintable);\n\n /// @notice Compute the amount of base token needed to reach the new collateral ratio, with incentive.\n /// @param newCollateralRatio The target collateral ratio, multipled by 1e18.\n /// @param incentiveRatio The extra incentive ratio, multipled by 1e18.\n /// @return maxBaseIn The amount of base token needed.\n /// @return maxXTokenMintable The amount of xToken can be minted.\n function maxMintableXTokenWithIncentive(uint256 newCollateralRatio, uint256 incentiveRatio)\n external\n view\n returns (uint256 maxBaseIn, uint256 maxXTokenMintable);\n\n /// @notice Compute the amount of fToken needed to reach the new collateral ratio.\n /// @param newCollateralRatio The target collateral ratio, multipled by 1e18.\n /// @return maxBaseOut The amount of base token redeemed.\n /// @return maxFTokenRedeemable The amount of fToken needed.\n function maxRedeemableFToken(uint256 newCollateralRatio)\n external\n view\n returns (uint256 maxBaseOut, uint256 maxFTokenRedeemable);\n\n /// @notice Compute the amount of xToken needed to reach the new collateral ratio.\n /// @param newCollateralRatio The target collateral ratio, multipled by 1e18.\n /// @return maxBaseOut The amount of base token redeemed.\n /// @return maxXTokenRedeemable The amount of xToken needed.\n function maxRedeemableXToken(uint256 newCollateralRatio)\n external\n view\n returns (uint256 maxBaseOut, uint256 maxXTokenRedeemable);\n\n /// @notice Compute the maximum amount of fToken can be liquidated.\n /// @param newCollateralRatio The target collateral ratio, multipled by 1e18.\n /// @param incentiveRatio The extra incentive ratio, multipled by 1e18.\n /// @return maxBaseOut The maximum amount of base token can liquidate, without incentive.\n /// @return maxFTokenLiquidatable The maximum amount of fToken can be liquidated.\n function maxLiquidatable(uint256 newCollateralRatio, uint256 incentiveRatio)\n external\n view\n returns (uint256 maxBaseOut, uint256 maxFTokenLiquidatable);\n\n /// @notice Return the exponential moving average of the leverage ratio.\n function leverageRatio() external view returns (uint256);\n\n /****************************\n * Public Mutated Functions *\n ****************************/\n\n /// @notice Mint fToken and xToken with some base token.\n /// @param baseIn The amount of base token deposited.\n /// @param recipient The address of receiver.\n /// @param option The mint option, xToken or fToken or both.\n /// @return fTokenOut The amount of fToken minted.\n /// @return xTokenOut The amount of xToken minted.\n function mint(\n uint256 baseIn,\n address recipient,\n MintOption option\n ) external returns (uint256 fTokenOut, uint256 xTokenOut);\n\n /// @notice Redeem fToken and xToken to base tokne.\n /// @param fTokenIn The amount of fToken to redeem.\n /// @param xTokenIn The amount of xToken to redeem.\n /// @param owner The owner of the fToken or xToken.\n /// @param baseOut The amount of base token redeemed.\n function redeem(\n uint256 fTokenIn,\n uint256 xTokenIn,\n address owner\n ) external returns (uint256 baseOut);\n\n /// @notice Add some base token to mint xToken with incentive.\n /// @param baseIn The amount of base token deposited.\n /// @param incentiveRatio The incentive ratio.\n /// @param recipient The address of receiver.\n /// @return xTokenOut The amount of xToken minted.\n function addBaseToken(\n uint256 baseIn,\n uint256 incentiveRatio,\n address recipient\n ) external returns (uint256 xTokenOut);\n\n /// @notice Liquidate fToken to base token with incentive.\n /// @param fTokenIn The amount of fToken to liquidate.\n /// @param incentiveRatio The incentive ratio.\n /// @param owner The owner of the fToken.\n /// @param baseOut The amount of base token liquidated.\n function liquidate(\n uint256 fTokenIn,\n uint256 incentiveRatio,\n address owner\n ) external returns (uint256 baseOut);\n\n /// @notice Settle the nav of base token, fToken and xToken.\n function protocolSettle() external;\n\n /// @notice Transfer some base token to strategy contract.\n /// @param amount The amount of token to transfer.\n function transferToStrategy(uint256 amount) external;\n\n /// @notice Notify base token profit from strategy contract.\n /// @param amount The amount of base token.\n function notifyStrategyProfit(uint256 amount) external;\n}\n"
},
"contracts/interfaces/ICurveTokenMinter.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0 || ^0.8.0;\n\n// solhint-disable func-name-mixedcase\n// solhint-disable var-name-mixedcase\n\ninterface ICurveTokenMinter {\n function token() external view returns (address);\n\n function controller() external view returns (address);\n\n function minted(address _user, address _gauge) external view returns (uint256);\n\n function allowed_to_mint_for(address _minter, address _user) external view returns (bool);\n\n function mint(address gauge_addr) external;\n\n function mint_many(address[8] memory gauge_addrs) external;\n\n function mint_for(address gauge_addr, address _for) external;\n\n function toggle_approve_mint(address minting_user) external;\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "shanghai",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}
}} |
1 | 20,291,292 | 0daa9bc81844268a09d7808b2dd1c25789a68f28eafccfc8845211232cdbd081 | 5ee0d08e0ef3d6138156a266c5c507ed7ba968e20adcf4e8c8b161cf4195f600 | 5dba0e26e3ac8cf14bad27f9b69d232801be8cd1 | 29ef46035e9fa3d570c598d3266424ca11413b0c | 89e4e583109c93502f95152d3ea31d6d2a361ae2 | 3d602d80600a3d3981f3363d3d373d3d3d363d735397d0869aba0d55e96d5716d383f6e1d8695ed75af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d735397d0869aba0d55e96d5716d383f6e1d8695ed75af43d82803e903d91602b57fd5bf3 | {{
"language": "Solidity",
"sources": {
"contracts/Forwarder.sol": {
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity 0.8.10;\nimport '@openzeppelin/contracts/token/ERC1155/IERC1155.sol';\nimport '@openzeppelin/contracts/token/ERC721/IERC721.sol';\nimport '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';\nimport '@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol';\nimport './ERC20Interface.sol';\nimport './TransferHelper.sol';\nimport './IForwarder.sol';\n\n/**\n * Contract that will forward any incoming Ether to the creator of the contract\n *\n */\ncontract Forwarder is IERC721Receiver, ERC1155Receiver, IForwarder {\n // Address to which any funds sent to this contract will be forwarded\n address public parentAddress;\n bool public autoFlush721 = true;\n bool public autoFlush1155 = true;\n\n event ForwarderDeposited(address from, uint256 value, bytes data);\n\n /**\n * Initialize the contract, and sets the destination address to that of the creator\n */\n function init(\n address _parentAddress,\n bool _autoFlush721,\n bool _autoFlush1155\n ) external onlyUninitialized {\n parentAddress = _parentAddress;\n uint256 value = address(this).balance;\n\n // set whether we want to automatically flush erc721/erc1155 tokens or not\n autoFlush721 = _autoFlush721;\n autoFlush1155 = _autoFlush1155;\n\n if (value == 0) {\n return;\n }\n\n (bool success, ) = parentAddress.call{ value: value }('');\n require(success, 'Flush failed');\n\n // NOTE: since we are forwarding on initialization,\n // we don't have the context of the original sender.\n // We still emit an event about the forwarding but set\n // the sender to the forwarder itself\n emit ForwarderDeposited(address(this), value, msg.data);\n }\n\n /**\n * Modifier that will execute internal code block only if the sender is the parent address\n */\n modifier onlyParent {\n require(msg.sender == parentAddress, 'Only Parent');\n _;\n }\n\n /**\n * Modifier that will execute internal code block only if the contract has not been initialized yet\n */\n modifier onlyUninitialized {\n require(parentAddress == address(0x0), 'Already initialized');\n _;\n }\n\n /**\n * Default function; Gets called when data is sent but does not match any other function\n */\n fallback() external payable {\n flush();\n }\n\n /**\n * Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address\n */\n receive() external payable {\n flush();\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function setAutoFlush721(bool autoFlush)\n external\n virtual\n override\n onlyParent\n {\n autoFlush721 = autoFlush;\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function setAutoFlush1155(bool autoFlush)\n external\n virtual\n override\n onlyParent\n {\n autoFlush1155 = autoFlush;\n }\n\n /**\n * ERC721 standard callback function for when a ERC721 is transfered. The forwarder will send the nft\n * to the base wallet once the nft contract invokes this method after transfering the nft.\n *\n * @param _operator The address which called `safeTransferFrom` function\n * @param _from The address of the sender\n * @param _tokenId The token id of the nft\n * @param data Additional data with no specified format, sent in call to `_to`\n */\n function onERC721Received(\n address _operator,\n address _from,\n uint256 _tokenId,\n bytes memory data\n ) external virtual override returns (bytes4) {\n if (autoFlush721) {\n IERC721 instance = IERC721(msg.sender);\n require(\n instance.supportsInterface(type(IERC721).interfaceId),\n 'The caller does not support the ERC721 interface'\n );\n // this won't work for ERC721 re-entrancy\n instance.safeTransferFrom(address(this), parentAddress, _tokenId, data);\n }\n\n return this.onERC721Received.selector;\n }\n\n function callFromParent(\n address target,\n uint256 value,\n bytes calldata data\n ) external onlyParent returns (bytes memory) {\n (bool success, bytes memory returnedData) = target.call{ value: value }(\n data\n );\n require(success, 'Parent call execution failed');\n\n return returnedData;\n }\n\n /**\n * @inheritdoc IERC1155Receiver\n */\n function onERC1155Received(\n address _operator,\n address _from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external virtual override returns (bytes4) {\n IERC1155 instance = IERC1155(msg.sender);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n if (autoFlush1155) {\n instance.safeTransferFrom(address(this), parentAddress, id, value, data);\n }\n\n return this.onERC1155Received.selector;\n }\n\n /**\n * @inheritdoc IERC1155Receiver\n */\n function onERC1155BatchReceived(\n address _operator,\n address _from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external virtual override returns (bytes4) {\n IERC1155 instance = IERC1155(msg.sender);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n if (autoFlush1155) {\n instance.safeBatchTransferFrom(\n address(this),\n parentAddress,\n ids,\n values,\n data\n );\n }\n\n return this.onERC1155BatchReceived.selector;\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushTokens(address tokenContractAddress)\n external\n virtual\n override\n onlyParent\n {\n ERC20Interface instance = ERC20Interface(tokenContractAddress);\n address forwarderAddress = address(this);\n uint256 forwarderBalance = instance.balanceOf(forwarderAddress);\n if (forwarderBalance == 0) {\n return;\n }\n\n TransferHelper.safeTransfer(\n tokenContractAddress,\n parentAddress,\n forwarderBalance\n );\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushERC721Token(address tokenContractAddress, uint256 tokenId)\n external\n virtual\n override\n onlyParent\n {\n IERC721 instance = IERC721(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC721).interfaceId),\n 'The tokenContractAddress does not support the ERC721 interface'\n );\n\n address ownerAddress = instance.ownerOf(tokenId);\n instance.transferFrom(ownerAddress, parentAddress, tokenId);\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushERC1155Tokens(address tokenContractAddress, uint256 tokenId)\n external\n virtual\n override\n onlyParent\n {\n IERC1155 instance = IERC1155(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n address forwarderAddress = address(this);\n uint256 forwarderBalance = instance.balanceOf(forwarderAddress, tokenId);\n\n instance.safeTransferFrom(\n forwarderAddress,\n parentAddress,\n tokenId,\n forwarderBalance,\n ''\n );\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function batchFlushERC1155Tokens(\n address tokenContractAddress,\n uint256[] calldata tokenIds\n ) external virtual override onlyParent {\n IERC1155 instance = IERC1155(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n address forwarderAddress = address(this);\n uint256[] memory amounts = new uint256[](tokenIds.length);\n for (uint256 i = 0; i < tokenIds.length; i++) {\n amounts[i] = instance.balanceOf(forwarderAddress, tokenIds[i]);\n }\n\n instance.safeBatchTransferFrom(\n forwarderAddress,\n parentAddress,\n tokenIds,\n amounts,\n ''\n );\n }\n\n /**\n * Flush the entire balance of the contract to the parent address.\n */\n function flush() public {\n uint256 value = address(this).balance;\n\n if (value == 0) {\n return;\n }\n\n (bool success, ) = parentAddress.call{ value: value }('');\n require(success, 'Flush failed');\n emit ForwarderDeposited(msg.sender, value, msg.data);\n }\n\n /**\n * @inheritdoc IERC165\n */\n function supportsInterface(bytes4 interfaceId)\n public\n virtual\n override(ERC1155Receiver, IERC165)\n view\n returns (bool)\n {\n return\n interfaceId == type(IForwarder).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n}\n"
},
"@openzeppelin/contracts/token/ERC1155/IERC1155.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n"
},
"@openzeppelin/contracts/token/ERC721/IERC721.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n}\n"
},
"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n"
},
"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155Receiver.sol\";\nimport \"../../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\nabstract contract ERC1155Receiver is ERC165, IERC1155Receiver {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);\n }\n}\n"
},
"contracts/ERC20Interface.sol": {
"content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\n/**\n * Contract that exposes the needed erc20 token functions\n */\n\nabstract contract ERC20Interface {\n // Send _value amount of tokens to address _to\n function transfer(address _to, uint256 _value)\n public\n virtual\n returns (bool success);\n\n // Get the account balance of another account with address _owner\n function balanceOf(address _owner)\n public\n virtual\n view\n returns (uint256 balance);\n}\n"
},
"contracts/TransferHelper.sol": {
"content": "// SPDX-License-Identifier: GPL-3.0-or-later\n// source: https://github.com/Uniswap/solidity-lib/blob/master/contracts/libraries/TransferHelper.sol\npragma solidity 0.8.10;\n\nimport '@openzeppelin/contracts/utils/Address.sol';\n\n// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false\nlibrary TransferHelper {\n function safeTransfer(\n address token,\n address to,\n uint256 value\n ) internal {\n // bytes4(keccak256(bytes('transfer(address,uint256)')));\n (bool success, bytes memory data) = token.call(\n abi.encodeWithSelector(0xa9059cbb, to, value)\n );\n require(\n success && (data.length == 0 || abi.decode(data, (bool))),\n 'TransferHelper::safeTransfer: transfer failed'\n );\n }\n\n function safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));\n (bool success, bytes memory returndata) = token.call(\n abi.encodeWithSelector(0x23b872dd, from, to, value)\n );\n Address.verifyCallResult(\n success,\n returndata,\n 'TransferHelper::transferFrom: transferFrom failed'\n );\n }\n}\n"
},
"contracts/IForwarder.sol": {
"content": "pragma solidity ^0.8.0;\n\nimport '@openzeppelin/contracts/utils/introspection/IERC165.sol';\n\ninterface IForwarder is IERC165 {\n /**\n * Sets the autoflush721 parameter.\n *\n * @param autoFlush whether to autoflush erc721 tokens\n */\n function setAutoFlush721(bool autoFlush) external;\n\n /**\n * Sets the autoflush1155 parameter.\n *\n * @param autoFlush whether to autoflush erc1155 tokens\n */\n function setAutoFlush1155(bool autoFlush) external;\n\n /**\n * Execute a token transfer of the full balance from the forwarder token to the parent address\n *\n * @param tokenContractAddress the address of the erc20 token contract\n */\n function flushTokens(address tokenContractAddress) external;\n\n /**\n * Execute a nft transfer from the forwarder to the parent address\n *\n * @param tokenContractAddress the address of the ERC721 NFT contract\n * @param tokenId The token id of the nft\n */\n function flushERC721Token(address tokenContractAddress, uint256 tokenId)\n external;\n\n /**\n * Execute a nft transfer from the forwarder to the parent address.\n *\n * @param tokenContractAddress the address of the ERC1155 NFT contract\n * @param tokenId The token id of the nft\n */\n function flushERC1155Tokens(address tokenContractAddress, uint256 tokenId)\n external;\n\n /**\n * Execute a batch nft transfer from the forwarder to the parent address.\n *\n * @param tokenContractAddress the address of the ERC1155 NFT contract\n * @param tokenIds The token ids of the nfts\n */\n function batchFlushERC1155Tokens(\n address tokenContractAddress,\n uint256[] calldata tokenIds\n ) external;\n}\n"
},
"@openzeppelin/contracts/utils/introspection/IERC165.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
},
"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n @dev Handles the receipt of a single ERC1155 token type. This function is\n called at the end of a `safeTransferFrom` after the balance has been updated.\n To accept the transfer, this must return\n `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n (i.e. 0xf23a6e61, or its own function selector).\n @param operator The address which initiated the transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param id The ID of the token being transferred\n @param value The amount of tokens being transferred\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n @dev Handles the receipt of a multiple ERC1155 token types. This function\n is called at the end of a `safeBatchTransferFrom` after the balances have\n been updated. To accept the transfer(s), this must return\n `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n (i.e. 0xbc197c81, or its own function selector).\n @param operator The address which initiated the batch transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param ids An array containing ids of each token being transferred (order and length must match values array)\n @param values An array containing amounts of each token being transferred (order and length must match ids array)\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n"
},
"@openzeppelin/contracts/utils/introspection/ERC165.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n"
},
"@openzeppelin/contracts/utils/Address.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}
}} |
1 | 20,291,292 | 0daa9bc81844268a09d7808b2dd1c25789a68f28eafccfc8845211232cdbd081 | 694050bc4c99938d516b9f8fdcb812076637df8c28d54081f4ae55d7cf29a627 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | 0ab9dc99a33cd02a776a9117f211803fb69fd7c4 | 608060405260405162000c7c38038062000c7c833981810160405260608110156200002957600080fd5b815160208301516040808501805191519395929483019291846401000000008211156200005557600080fd5b9083019060208201858111156200006b57600080fd5b82516401000000008111828201881017156200008657600080fd5b82525081516020918201929091019080838360005b83811015620000b55781810151838201526020016200009b565b50505050905090810190601f168015620000e35780820380516001836020036101000a031916815260200191505b5060405250849150829050620000f98262000137565b8051156200011a57620001188282620001ae60201b620003841760201c565b505b50620001239050565b6200012e82620001dd565b505050620003be565b6200014d816200020160201b620003b01760201c565b6200018a5760405162461bcd60e51b815260040180806020018281038252603681526020018062000c206036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b6060620001d6838360405180606001604052806027815260200162000bf96027913962000207565b9392505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b3b151590565b6060620002148462000201565b620002515760405162461bcd60e51b815260040180806020018281038252602681526020018062000c566026913960400191505060405180910390fd5b600080856001600160a01b0316856040518082805190602001908083835b60208310620002905780518252601f1990920191602091820191016200026f565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114620002f2576040519150601f19603f3d011682016040523d82523d6000602084013e620002f7565b606091505b5090925090506200030a82828662000314565b9695505050505050565b6060831562000325575081620001d6565b825115620003365782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156200038257818101518382015260200162000368565b50505050905090810190601f168015620003b05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b61082b80620003ce6000396000f3fe60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610262565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b031661029f565b34801561018857600080fd5b5061012d610359565b6101996103b6565b6101a96101a4610416565b61043b565b565b6101b361045f565b6001600160a01b0316336001600160a01b031614156101da576101d581610484565b6101e2565b6101e2610191565b50565b6101ed61045f565b6001600160a01b0316336001600160a01b031614156102555761020f83610484565b61024f8383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061038492505050565b5061025d565b61025d610191565b505050565b600061026c61045f565b6001600160a01b0316336001600160a01b031614156102945761028d610416565b905061029c565b61029c610191565b90565b6102a761045f565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103055760405162461bcd60e51b815260040180806020018281038252603a8152602001806106f7603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61032e61045f565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c4565b600061036361045f565b6001600160a01b0316336001600160a01b031614156102945761028d61045f565b60606103a98383604051806060016040528060278152602001610731602791396104e8565b9392505050565b3b151590565b6103be61045f565b6001600160a01b0316336001600160a01b0316141561040e5760405162461bcd60e51b81526004018080602001828103825260428152602001806107b46042913960600191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045a573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b61048d816105ea565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b60606104f3846103b0565b61052e5760405162461bcd60e51b815260040180806020018281038252602681526020018061078e6026913960400191505060405180910390fd5b600080856001600160a01b0316856040518082805190602001908083835b6020831061056b5780518252601f19909201916020918201910161054c565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146105cb576040519150601f19603f3d011682016040523d82523d6000602084013e6105d0565b606091505b50915091506105e0828286610652565b9695505050505050565b6105f3816103b0565b61062e5760405162461bcd60e51b81526004018080602001828103825260368152602001806107586036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b606083156106615750816103a9565b8251156106715782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156106bb5781810151838201526020016106a3565b50505050905090810190601f1680156106e85780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f2061646472657373416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65645570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a264697066735822122090e3614b706279d077ae7fe131a8a3c1ad0a982ff84dd5c3262dea995c0e225864736f6c63430007060033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65645570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6e747261637400000000000000000000000072a6239f1651a4556f4c40fe97575885a195f5350000000000000000000000009b54b7703551d9d0ced177a78367560a8b2edda400000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000 | 60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610262565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b031661029f565b34801561018857600080fd5b5061012d610359565b6101996103b6565b6101a96101a4610416565b61043b565b565b6101b361045f565b6001600160a01b0316336001600160a01b031614156101da576101d581610484565b6101e2565b6101e2610191565b50565b6101ed61045f565b6001600160a01b0316336001600160a01b031614156102555761020f83610484565b61024f8383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061038492505050565b5061025d565b61025d610191565b505050565b600061026c61045f565b6001600160a01b0316336001600160a01b031614156102945761028d610416565b905061029c565b61029c610191565b90565b6102a761045f565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103055760405162461bcd60e51b815260040180806020018281038252603a8152602001806106f7603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61032e61045f565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c4565b600061036361045f565b6001600160a01b0316336001600160a01b031614156102945761028d61045f565b60606103a98383604051806060016040528060278152602001610731602791396104e8565b9392505050565b3b151590565b6103be61045f565b6001600160a01b0316336001600160a01b0316141561040e5760405162461bcd60e51b81526004018080602001828103825260428152602001806107b46042913960600191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045a573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b61048d816105ea565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b60606104f3846103b0565b61052e5760405162461bcd60e51b815260040180806020018281038252602681526020018061078e6026913960400191505060405180910390fd5b600080856001600160a01b0316856040518082805190602001908083835b6020831061056b5780518252601f19909201916020918201910161054c565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146105cb576040519150601f19603f3d011682016040523d82523d6000602084013e6105d0565b606091505b50915091506105e0828286610652565b9695505050505050565b6105f3816103b0565b61062e5760405162461bcd60e51b81526004018080602001828103825260368152602001806107586036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b606083156106615750816103a9565b8251156106715782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156106bb5781810151838201526020016106a3565b50505050905090810190601f1680156106e85780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f2061646472657373416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65645570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a264697066735822122090e3614b706279d077ae7fe131a8a3c1ad0a982ff84dd5c3262dea995c0e225864736f6c63430007060033 | // SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
/**
* @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
* instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
* be specified by overriding the virtual {_implementation} function.
*
* Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
* different contract through the {_delegate} function.
*
* The success and return data of the delegated call will be returned back to the caller of the proxy.
*/
abstract contract Proxy {
/**
* @dev Delegates the current call to `implementation`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _delegate(address implementation) internal virtual {
// solhint-disable-next-line no-inline-assembly
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
/**
* @dev This is a virtual function that should be overriden so it returns the address to which the fallback function
* and {_fallback} should delegate.
*/
function _implementation() internal view virtual returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _fallback() internal virtual {
_beforeFallback();
_delegate(_implementation());
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
* function in the contract matches the call data.
*/
fallback () external payable virtual {
_fallback();
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
* is empty.
*/
receive () external payable virtual {
_fallback();
}
/**
* @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
* call, or as part of the Solidity `fallback` or `receive` functions.
*
* If overriden should call `super._beforeFallback()`.
*/
function _beforeFallback() internal virtual {
}
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
/**
* @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an
* implementation address that can be changed. This address is stored in storage in the location specified by
* https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the
* implementation behind the proxy.
*
* Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see
* {TransparentUpgradeableProxy}.
*/
contract UpgradeableProxy is Proxy {
/**
* @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.
*
* If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded
* function call, and allows initializating the storage of the proxy like a Solidity constructor.
*/
constructor(address _logic, bytes memory _data) payable {
assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
Address.functionDelegateCall(_logic, _data);
}
}
/**
* @dev Emitted when the implementation is upgraded.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation address.
*/
function _implementation() internal view virtual override returns (address impl) {
bytes32 slot = _IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
*
* Emits an {Upgraded} event.
*/
function _upgradeTo(address newImplementation) internal virtual {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Stores a new address in the EIP1967 implementation slot.
*/
function _setImplementation(address newImplementation) private {
require(Address.isContract(newImplementation), "UpgradeableProxy: new implementation is not a contract");
bytes32 slot = _IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @dev This contract implements a proxy that is upgradeable by an admin.
*
* To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector
* clashing], which can potentially be used in an attack, this contract uses the
* https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two
* things that go hand in hand:
*
* 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if
* that call matches one of the admin functions exposed by the proxy itself.
* 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the
* implementation. If the admin tries to call a function on the implementation it will fail with an error that says
* "admin cannot fallback to proxy target".
*
* These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing
* the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due
* to sudden errors when trying to call a function from the proxy implementation.
*
* Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,
* you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.
*/
contract TransparentUpgradeableProxy is UpgradeableProxy {
/**
* @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and
* optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.
*/
constructor(address _logic, address admin_, bytes memory _data) payable UpgradeableProxy(_logic, _data) {
assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
_setAdmin(admin_);
}
/**
* @dev Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @dev Returns the current admin.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
*/
function admin() external ifAdmin returns (address admin_) {
admin_ = _admin();
}
/**
* @dev Returns the current implementation.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`
*/
function implementation() external ifAdmin returns (address implementation_) {
implementation_ = _implementation();
}
/**
* @dev Changes the admin of the proxy.
*
* Emits an {AdminChanged} event.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.
*/
function changeAdmin(address newAdmin) external virtual ifAdmin {
require(newAdmin != address(0), "TransparentUpgradeableProxy: new admin is the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the implementation of the proxy.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.
*/
function upgradeTo(address newImplementation) external virtual ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified
* by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the
* proxied contract.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) external payable virtual ifAdmin {
_upgradeTo(newImplementation);
Address.functionDelegateCall(newImplementation, data);
}
/**
* @dev Returns the current admin.
*/
function _admin() internal view virtual returns (address adm) {
bytes32 slot = _ADMIN_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
adm := sload(slot)
}
}
/**
* @dev Stores a new address in the EIP1967 admin slot.
*/
function _setAdmin(address newAdmin) private {
bytes32 slot = _ADMIN_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.
*/
function _beforeFallback() internal virtual override {
require(msg.sender != _admin(), "TransparentUpgradeableProxy: admin cannot fallback to proxy target");
super._beforeFallback();
}
} |
1 | 20,291,293 | 8384467ea8c48f0c3717ad1b24596dc7397b4c7e80caf6da2314b5242e6e353f | 61b6df6264cffdc2770523ec1aa060e9f384ea5f0c0a4b3ffc9e9f6362e5b3cf | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | a04d761adad1029e4f2f60ac973a76c5307efcea | 608060405260405162000c7c38038062000c7c833981810160405260608110156200002957600080fd5b815160208301516040808501805191519395929483019291846401000000008211156200005557600080fd5b9083019060208201858111156200006b57600080fd5b82516401000000008111828201881017156200008657600080fd5b82525081516020918201929091019080838360005b83811015620000b55781810151838201526020016200009b565b50505050905090810190601f168015620000e35780820380516001836020036101000a031916815260200191505b5060405250849150829050620000f98262000137565b8051156200011a57620001188282620001ae60201b620003841760201c565b505b50620001239050565b6200012e82620001dd565b505050620003be565b6200014d816200020160201b620003b01760201c565b6200018a5760405162461bcd60e51b815260040180806020018281038252603681526020018062000c206036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b6060620001d6838360405180606001604052806027815260200162000bf96027913962000207565b9392505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b3b151590565b6060620002148462000201565b620002515760405162461bcd60e51b815260040180806020018281038252602681526020018062000c566026913960400191505060405180910390fd5b600080856001600160a01b0316856040518082805190602001908083835b60208310620002905780518252601f1990920191602091820191016200026f565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114620002f2576040519150601f19603f3d011682016040523d82523d6000602084013e620002f7565b606091505b5090925090506200030a82828662000314565b9695505050505050565b6060831562000325575081620001d6565b825115620003365782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156200038257818101518382015260200162000368565b50505050905090810190601f168015620003b05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b61082b80620003ce6000396000f3fe60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610262565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b031661029f565b34801561018857600080fd5b5061012d610359565b6101996103b6565b6101a96101a4610416565b61043b565b565b6101b361045f565b6001600160a01b0316336001600160a01b031614156101da576101d581610484565b6101e2565b6101e2610191565b50565b6101ed61045f565b6001600160a01b0316336001600160a01b031614156102555761020f83610484565b61024f8383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061038492505050565b5061025d565b61025d610191565b505050565b600061026c61045f565b6001600160a01b0316336001600160a01b031614156102945761028d610416565b905061029c565b61029c610191565b90565b6102a761045f565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103055760405162461bcd60e51b815260040180806020018281038252603a8152602001806106f7603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61032e61045f565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c4565b600061036361045f565b6001600160a01b0316336001600160a01b031614156102945761028d61045f565b60606103a98383604051806060016040528060278152602001610731602791396104e8565b9392505050565b3b151590565b6103be61045f565b6001600160a01b0316336001600160a01b0316141561040e5760405162461bcd60e51b81526004018080602001828103825260428152602001806107b46042913960600191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045a573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b61048d816105ea565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b60606104f3846103b0565b61052e5760405162461bcd60e51b815260040180806020018281038252602681526020018061078e6026913960400191505060405180910390fd5b600080856001600160a01b0316856040518082805190602001908083835b6020831061056b5780518252601f19909201916020918201910161054c565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146105cb576040519150601f19603f3d011682016040523d82523d6000602084013e6105d0565b606091505b50915091506105e0828286610652565b9695505050505050565b6105f3816103b0565b61062e5760405162461bcd60e51b81526004018080602001828103825260368152602001806107586036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b606083156106615750816103a9565b8251156106715782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156106bb5781810151838201526020016106a3565b50505050905090810190601f1680156106e85780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f2061646472657373416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65645570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a264697066735822122090e3614b706279d077ae7fe131a8a3c1ad0a982ff84dd5c3262dea995c0e225864736f6c63430007060033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65645570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6e747261637400000000000000000000000072a6239f1651a4556f4c40fe97575885a195f5350000000000000000000000009b54b7703551d9d0ced177a78367560a8b2edda400000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000 | 60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610262565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b031661029f565b34801561018857600080fd5b5061012d610359565b6101996103b6565b6101a96101a4610416565b61043b565b565b6101b361045f565b6001600160a01b0316336001600160a01b031614156101da576101d581610484565b6101e2565b6101e2610191565b50565b6101ed61045f565b6001600160a01b0316336001600160a01b031614156102555761020f83610484565b61024f8383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061038492505050565b5061025d565b61025d610191565b505050565b600061026c61045f565b6001600160a01b0316336001600160a01b031614156102945761028d610416565b905061029c565b61029c610191565b90565b6102a761045f565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103055760405162461bcd60e51b815260040180806020018281038252603a8152602001806106f7603a913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61032e61045f565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c4565b600061036361045f565b6001600160a01b0316336001600160a01b031614156102945761028d61045f565b60606103a98383604051806060016040528060278152602001610731602791396104e8565b9392505050565b3b151590565b6103be61045f565b6001600160a01b0316336001600160a01b0316141561040e5760405162461bcd60e51b81526004018080602001828103825260428152602001806107b46042913960600191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045a573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b61048d816105ea565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b60606104f3846103b0565b61052e5760405162461bcd60e51b815260040180806020018281038252602681526020018061078e6026913960400191505060405180910390fd5b600080856001600160a01b0316856040518082805190602001908083835b6020831061056b5780518252601f19909201916020918201910161054c565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146105cb576040519150601f19603f3d011682016040523d82523d6000602084013e6105d0565b606091505b50915091506105e0828286610652565b9695505050505050565b6105f3816103b0565b61062e5760405162461bcd60e51b81526004018080602001828103825260368152602001806107586036913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b606083156106615750816103a9565b8251156106715782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156106bb5781810151838201526020016106a3565b50505050905090810190601f1680156106e85780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe5472616e73706172656e745570677261646561626c6550726f78793a206e65772061646d696e20697320746865207a65726f2061646472657373416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65645570677261646561626c6550726f78793a206e657720696d706c656d656e746174696f6e206973206e6f74206120636f6e7472616374416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6e74726163745472616e73706172656e745570677261646561626c6550726f78793a2061646d696e2063616e6e6f742066616c6c6261636b20746f2070726f787920746172676574a264697066735822122090e3614b706279d077ae7fe131a8a3c1ad0a982ff84dd5c3262dea995c0e225864736f6c63430007060033 | // SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
/**
* @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
* instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
* be specified by overriding the virtual {_implementation} function.
*
* Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
* different contract through the {_delegate} function.
*
* The success and return data of the delegated call will be returned back to the caller of the proxy.
*/
abstract contract Proxy {
/**
* @dev Delegates the current call to `implementation`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _delegate(address implementation) internal virtual {
// solhint-disable-next-line no-inline-assembly
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
/**
* @dev This is a virtual function that should be overriden so it returns the address to which the fallback function
* and {_fallback} should delegate.
*/
function _implementation() internal view virtual returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _fallback() internal virtual {
_beforeFallback();
_delegate(_implementation());
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
* function in the contract matches the call data.
*/
fallback () external payable virtual {
_fallback();
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
* is empty.
*/
receive () external payable virtual {
_fallback();
}
/**
* @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
* call, or as part of the Solidity `fallback` or `receive` functions.
*
* If overriden should call `super._beforeFallback()`.
*/
function _beforeFallback() internal virtual {
}
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
/**
* @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an
* implementation address that can be changed. This address is stored in storage in the location specified by
* https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the
* implementation behind the proxy.
*
* Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see
* {TransparentUpgradeableProxy}.
*/
contract UpgradeableProxy is Proxy {
/**
* @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.
*
* If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded
* function call, and allows initializating the storage of the proxy like a Solidity constructor.
*/
constructor(address _logic, bytes memory _data) payable {
assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
Address.functionDelegateCall(_logic, _data);
}
}
/**
* @dev Emitted when the implementation is upgraded.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation address.
*/
function _implementation() internal view virtual override returns (address impl) {
bytes32 slot = _IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
*
* Emits an {Upgraded} event.
*/
function _upgradeTo(address newImplementation) internal virtual {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Stores a new address in the EIP1967 implementation slot.
*/
function _setImplementation(address newImplementation) private {
require(Address.isContract(newImplementation), "UpgradeableProxy: new implementation is not a contract");
bytes32 slot = _IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @dev This contract implements a proxy that is upgradeable by an admin.
*
* To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector
* clashing], which can potentially be used in an attack, this contract uses the
* https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two
* things that go hand in hand:
*
* 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if
* that call matches one of the admin functions exposed by the proxy itself.
* 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the
* implementation. If the admin tries to call a function on the implementation it will fail with an error that says
* "admin cannot fallback to proxy target".
*
* These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing
* the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due
* to sudden errors when trying to call a function from the proxy implementation.
*
* Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,
* you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.
*/
contract TransparentUpgradeableProxy is UpgradeableProxy {
/**
* @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and
* optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.
*/
constructor(address _logic, address admin_, bytes memory _data) payable UpgradeableProxy(_logic, _data) {
assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
_setAdmin(admin_);
}
/**
* @dev Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @dev Returns the current admin.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
*/
function admin() external ifAdmin returns (address admin_) {
admin_ = _admin();
}
/**
* @dev Returns the current implementation.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`
*/
function implementation() external ifAdmin returns (address implementation_) {
implementation_ = _implementation();
}
/**
* @dev Changes the admin of the proxy.
*
* Emits an {AdminChanged} event.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.
*/
function changeAdmin(address newAdmin) external virtual ifAdmin {
require(newAdmin != address(0), "TransparentUpgradeableProxy: new admin is the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the implementation of the proxy.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.
*/
function upgradeTo(address newImplementation) external virtual ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified
* by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the
* proxied contract.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) external payable virtual ifAdmin {
_upgradeTo(newImplementation);
Address.functionDelegateCall(newImplementation, data);
}
/**
* @dev Returns the current admin.
*/
function _admin() internal view virtual returns (address adm) {
bytes32 slot = _ADMIN_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
adm := sload(slot)
}
}
/**
* @dev Stores a new address in the EIP1967 admin slot.
*/
function _setAdmin(address newAdmin) private {
bytes32 slot = _ADMIN_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.
*/
function _beforeFallback() internal virtual override {
require(msg.sender != _admin(), "TransparentUpgradeableProxy: admin cannot fallback to proxy target");
super._beforeFallback();
}
} |
1 | 20,291,294 | 612bd5d79be13df24751cf3e7d5f0f1c4aa42027e163351c7c5d0e1266580ac7 | 38b762b8cc2febd1289a84f2b6aa958722373847e41840d97803e4e330abd24d | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | a1d0027ca4c0cb79f9403d06a29470abc7b0a468 | 08a602616593b79591cfc88a130c8825a0fcbd94 | 61010060405234801562000011575f80fd5b5060405162000cdc38038062000cdc83398101604081905262000034916200044b565b6001600160a01b03808516608081905284821660a05283821660c05290821660e0526200006490835f196200006e565b505050506200055a565b801580620000ea5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015620000c2573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190620000e89190620004a5565b155b620001625760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e63650000000000000000000060648201526084015b60405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b0390811663095ea7b360e01b17909152620001ba918591620001bf16565b505050565b6040805180820190915260208082527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564908201525f906200020d906001600160a01b03851690849062000291565b905080515f148062000230575080806020019051810190620002309190620004bd565b620001ba5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840162000159565b6060620002a184845f85620002a9565b949350505050565b6060824710156200030c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840162000159565b5f80866001600160a01b0316858760405162000329919062000509565b5f6040518083038185875af1925050503d805f811462000365576040519150601f19603f3d011682016040523d82523d5f602084013e6200036a565b606091505b5090925090506200037e8783838762000389565b979650505050505050565b60608315620003fc5782515f03620003f4576001600160a01b0385163b620003f45760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162000159565b5081620002a1565b620002a18383815115620004135781518083602001fd5b8060405162461bcd60e51b815260040162000159919062000526565b80516001600160a01b038116811462000446575f80fd5b919050565b5f805f80608085870312156200045f575f80fd5b6200046a856200042f565b93506200047a602086016200042f565b92506200048a604086016200042f565b91506200049a606086016200042f565b905092959194509250565b5f60208284031215620004b6575f80fd5b5051919050565b5f60208284031215620004ce575f80fd5b81518015158114620004de575f80fd5b9392505050565b5f5b8381101562000501578181015183820152602001620004e7565b50505f910152565b5f82516200051c818460208701620004e5565b9190910192915050565b602081525f825180602084015262000546816040850160208701620004e5565b601f01601f19169190910160400192915050565b60805160a05160c05160e051610728620005b45f395f818160ad015261032801525f818160d401528181610176015261025101525f818160fb01526102cc01525f81816069015281816101f7015261030601526107285ff3fe608060405234801561000f575f80fd5b5060043610610060575f3560e01c80632e7dc6af146100645780634bde38c8146100a857806380f55605146100cf578063d48532b3146100f6578063de0e9a3e1461011d578063ea598cb01461013e575b5f80fd5b61008b7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b61008b7f000000000000000000000000000000000000000000000000000000000000000081565b61008b7f000000000000000000000000000000000000000000000000000000000000000081565b61008b7f000000000000000000000000000000000000000000000000000000000000000081565b61013061012b36600461060d565b610151565b60405190815260200161009f565b61013061014c36600461060d565b610222565b6040516372b790db60e01b8152600481018290523060248201525f60448201819052907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906372b790db906064016020604051808303815f875af11580156101c4573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101e89190610624565b915061021e6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163384610354565b5090565b60405163b556747360e01b8152600481018290523060248201525f604482018190529081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063b55674739060640160408051808303815f875af1158015610296573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102ba919061063b565b90935090506102f36001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163385610354565b801561034d5761034d6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000167f000000000000000000000000000000000000000000000000000000000000000083610354565b5090919050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526103a69084906103ab565b505050565b5f6103ff826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166104839092919063ffffffff16565b905080515f148061041f57508080602001905181019061041f919061065d565b6103a65760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084015b60405180910390fd5b606061049184845f85610499565b949350505050565b6060824710156104fa5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161047a565b5f80866001600160a01b0316858760405161051591906106a5565b5f6040518083038185875af1925050503d805f811461054f576040519150601f19603f3d011682016040523d82523d5f602084013e610554565b606091505b509150915061056587838387610570565b979650505050505050565b606083156105de5782515f036105d7576001600160a01b0385163b6105d75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161047a565b5081610491565b61049183838151156105f35781518083602001fd5b8060405162461bcd60e51b815260040161047a91906106c0565b5f6020828403121561061d575f80fd5b5035919050565b5f60208284031215610634575f80fd5b5051919050565b5f806040838503121561064c575f80fd5b505080516020909101519092909150565b5f6020828403121561066d575f80fd5b8151801515811461067c575f80fd5b9392505050565b5f5b8381101561069d578181015183820152602001610685565b50505f910152565b5f82516106b6818460208701610683565b9190910192915050565b602081525f82518060208401526106de816040850160208701610683565b601f01601f1916919091016040019291505056fea26469706673582212208e99334de28d1730feeca471ca7e4772f919cd96df88e28d697540f0558494f364736f6c63430008140033000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb777000000000000000000000000b90d347e10a085b591955cbd0603ac7866fcadc80000000000000000000000008e3815ef103b8d8528778969cd53baa2e94be25e0000000000000000000000000084c2e1b1823564e597ff4848a88d61ac63d703 | 608060405234801561000f575f80fd5b5060043610610060575f3560e01c80632e7dc6af146100645780634bde38c8146100a857806380f55605146100cf578063d48532b3146100f6578063de0e9a3e1461011d578063ea598cb01461013e575b5f80fd5b61008b7f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb77781565b6040516001600160a01b0390911681526020015b60405180910390f35b61008b7f0000000000000000000000000084c2e1b1823564e597ff4848a88d61ac63d70381565b61008b7f0000000000000000000000008e3815ef103b8d8528778969cd53baa2e94be25e81565b61008b7f000000000000000000000000b90d347e10a085b591955cbd0603ac7866fcadc881565b61013061012b36600461060d565b610151565b60405190815260200161009f565b61013061014c36600461060d565b610222565b6040516372b790db60e01b8152600481018290523060248201525f60448201819052907f0000000000000000000000008e3815ef103b8d8528778969cd53baa2e94be25e6001600160a01b0316906372b790db906064016020604051808303815f875af11580156101c4573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101e89190610624565b915061021e6001600160a01b037f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb777163384610354565b5090565b60405163b556747360e01b8152600481018290523060248201525f604482018190529081906001600160a01b037f0000000000000000000000008e3815ef103b8d8528778969cd53baa2e94be25e169063b55674739060640160408051808303815f875af1158015610296573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102ba919061063b565b90935090506102f36001600160a01b037f000000000000000000000000b90d347e10a085b591955cbd0603ac7866fcadc8163385610354565b801561034d5761034d6001600160a01b037f000000000000000000000000b0903ab70a7467ee5756074b31ac88aebb8fb777167f0000000000000000000000000084c2e1b1823564e597ff4848a88d61ac63d70383610354565b5090919050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526103a69084906103ab565b505050565b5f6103ff826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166104839092919063ffffffff16565b905080515f148061041f57508080602001905181019061041f919061065d565b6103a65760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084015b60405180910390fd5b606061049184845f85610499565b949350505050565b6060824710156104fa5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161047a565b5f80866001600160a01b0316858760405161051591906106a5565b5f6040518083038185875af1925050503d805f811461054f576040519150601f19603f3d011682016040523d82523d5f602084013e610554565b606091505b509150915061056587838387610570565b979650505050505050565b606083156105de5782515f036105d7576001600160a01b0385163b6105d75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161047a565b5081610491565b61049183838151156105f35781518083602001fd5b8060405162461bcd60e51b815260040161047a91906106c0565b5f6020828403121561061d575f80fd5b5035919050565b5f60208284031215610634575f80fd5b5051919050565b5f806040838503121561064c575f80fd5b505080516020909101519092909150565b5f6020828403121561066d575f80fd5b8151801515811461067c575f80fd5b9392505050565b5f5b8381101561069d578181015183820152602001610685565b50505f910152565b5f82516106b6818460208701610683565b9190910192915050565b602081525f82518060208401526106de816040850160208701610683565b601f01601f1916919091016040019291505056fea26469706673582212208e99334de28d1730feeca471ca7e4772f919cd96df88e28d697540f0558494f364736f6c63430008140033 | {{
"language": "Solidity",
"sources": {
"@openzeppelin/contracts-v4/token/ERC20/extensions/IERC20Permit.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"
},
"@openzeppelin/contracts-v4/token/ERC20/IERC20.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n"
},
"@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\n */\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\n }\n}\n"
},
"@openzeppelin/contracts-v4/utils/Address.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n"
},
"contracts/f(x)/wrapper/LeveragedTokenWrapper.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity =0.8.20;\n\nimport { IERC20 } from \"@openzeppelin/contracts-v4/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol\";\n\nimport { IFxTokenWrapper } from \"../../interfaces/f(x)/IFxTokenWrapper.sol\";\nimport { IFxMarketV2 } from \"../../interfaces/f(x)/IFxMarketV2.sol\";\n\n// solhint-disable const-name-snakecase\n// solhint-disable contract-name-camelcase\n\ncontract LeveragedTokenWrapper is IFxTokenWrapper {\n using SafeERC20 for IERC20;\n\n /*************\n * Constants *\n *************/\n\n /// @notice The address of base token.\n address public immutable override src;\n\n /// @notice The address of of xETH.\n address public immutable override dst;\n\n /// @notice The address of of Market.\n address public immutable market;\n\n /// @notice The address of of Platform.\n address public immutable platform;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(\n address _baseToken,\n address _xETH,\n address _market,\n address _platform\n ) {\n src = _baseToken;\n dst = _xETH;\n market = _market;\n platform = _platform;\n\n IERC20(_baseToken).safeApprove(_market, type(uint256).max);\n }\n\n /****************************\n * Public Mutated Functions *\n ****************************/\n\n /// @inheritdoc IFxTokenWrapper\n function wrap(uint256 _amount) external override returns (uint256) {\n uint256 _bonus;\n (_amount, _bonus) = IFxMarketV2(market).mintXToken(_amount, address(this), 0);\n IERC20(dst).safeTransfer(msg.sender, _amount);\n\n // transfer bonus to platform\n if (_bonus > 0) {\n IERC20(src).safeTransfer(platform, _bonus);\n }\n return _amount;\n }\n\n /// @inheritdoc IFxTokenWrapper\n function unwrap(uint256 _amount) external override returns (uint256) {\n _amount = IFxMarketV2(market).redeemXToken(_amount, address(this), 0);\n IERC20(src).safeTransfer(msg.sender, _amount);\n return _amount;\n }\n}\n"
},
"contracts/interfaces/f(x)/IFxMarketV2.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IFxMarketV2 {\n /**********\n * Events *\n **********/\n\n /// @notice Emitted when fToken is minted.\n /// @param owner The address of base token owner.\n /// @param recipient The address of receiver for fToken or xToken.\n /// @param baseTokenIn The amount of base token deposited.\n /// @param fTokenOut The amount of fToken minted.\n /// @param mintFee The amount of mint fee charged.\n event MintFToken(\n address indexed owner,\n address indexed recipient,\n uint256 baseTokenIn,\n uint256 fTokenOut,\n uint256 mintFee\n );\n\n /// @notice Emitted when xToken is minted.\n /// @param owner The address of base token owner.\n /// @param recipient The address of receiver for fToken or xToken.\n /// @param baseTokenIn The amount of base token deposited.\n /// @param xTokenOut The amount of xToken minted.\n /// @param bonus The amount of base token as bonus.\n /// @param mintFee The amount of mint fee charged.\n event MintXToken(\n address indexed owner,\n address indexed recipient,\n uint256 baseTokenIn,\n uint256 xTokenOut,\n uint256 bonus,\n uint256 mintFee\n );\n\n /// @notice Emitted when someone redeem base token with fToken or xToken.\n /// @param owner The address of fToken and xToken owner.\n /// @param recipient The address of receiver for base token.\n /// @param fTokenBurned The amount of fToken burned.\n /// @param baseTokenOut The amount of base token redeemed.\n /// @param bonus The amount of base token as bonus.\n /// @param redeemFee The amount of redeem fee charged.\n event RedeemFToken(\n address indexed owner,\n address indexed recipient,\n uint256 fTokenBurned,\n uint256 baseTokenOut,\n uint256 bonus,\n uint256 redeemFee\n );\n\n /// @notice Emitted when someone redeem base token with fToken or xToken.\n /// @param owner The address of fToken and xToken owner.\n /// @param recipient The address of receiver for base token.\n /// @param xTokenBurned The amount of xToken burned.\n /// @param baseTokenOut The amount of base token redeemed.\n /// @param redeemFee The amount of redeem fee charged.\n event RedeemXToken(\n address indexed owner,\n address indexed recipient,\n uint256 xTokenBurned,\n uint256 baseTokenOut,\n uint256 redeemFee\n );\n\n /// @notice Emitted when the fee ratio for minting fToken is updated.\n /// @param defaultFeeRatio The new default fee ratio, multipled by 1e18.\n /// @param extraFeeRatio The new extra fee ratio, multipled by 1e18.\n event UpdateMintFeeRatioFToken(uint256 defaultFeeRatio, int256 extraFeeRatio);\n\n /// @notice Emitted when the fee ratio for minting xToken is updated.\n /// @param defaultFeeRatio The new default fee ratio, multipled by 1e18.\n /// @param extraFeeRatio The new extra fee ratio, multipled by 1e18.\n event UpdateMintFeeRatioXToken(uint256 defaultFeeRatio, int256 extraFeeRatio);\n\n /// @notice Emitted when the fee ratio for redeeming fToken is updated.\n /// @param defaultFeeRatio The new default fee ratio, multipled by 1e18.\n /// @param extraFeeRatio The new extra fee ratio, multipled by 1e18.\n event UpdateRedeemFeeRatioFToken(uint256 defaultFeeRatio, int256 extraFeeRatio);\n\n /// @notice Emitted when the fee ratio for redeeming xToken is updated.\n /// @param defaultFeeRatio The new default fee ratio, multipled by 1e18.\n /// @param extraFeeRatio The new extra fee ratio, multipled by 1e18.\n event UpdateRedeemFeeRatioXToken(uint256 defaultFeeRatio, int256 extraFeeRatio);\n\n /// @notice Emitted when the stability ratio is updated.\n /// @param oldRatio The previous collateral ratio to enter stability mode, multiplied by 1e18.\n /// @param newRatio The current collateral ratio to enter stability mode, multiplied by 1e18.\n event UpdateStabilityRatio(uint256 oldRatio, uint256 newRatio);\n\n /// @notice Emitted when the platform contract is updated.\n /// @param oldPlatform The address of previous platform contract.\n /// @param newPlatform The address of current platform contract.\n event UpdatePlatform(address indexed oldPlatform, address indexed newPlatform);\n\n /// @notice Emitted when the reserve pool contract is updated.\n /// @param oldReservePool The address of previous reserve pool contract.\n /// @param newReservePool The address of current reserve pool contract.\n event UpdateReservePool(address indexed oldReservePool, address indexed newReservePool);\n\n /// @notice Emitted when the RebalancePoolRegistry contract is updated.\n /// @param oldRegistry The address of previous RebalancePoolRegistry contract.\n /// @param newRegistry The address of current RebalancePoolRegistry contract.\n event UpdateRebalancePoolRegistry(address indexed oldRegistry, address indexed newRegistry);\n\n /// @notice Pause or unpause mint.\n /// @param oldStatus The previous status for mint.\n /// @param newStatus The current status for mint.\n event UpdateMintStatus(bool oldStatus, bool newStatus);\n\n /// @notice Pause or unpause redeem.\n /// @param oldStatus The previous status for redeem.\n /// @param newStatus The current status for redeem.\n event UpdateRedeemStatus(bool oldStatus, bool newStatus);\n\n /// @notice Pause or unpause fToken mint in stability mode.\n /// @param oldStatus The previous status for mint.\n /// @param newStatus The current status for mint.\n event UpdateFTokenMintStatusInStabilityMode(bool oldStatus, bool newStatus);\n\n /// @notice Pause or unpause xToken redeem in stability mode.\n /// @param oldStatus The previous status for redeem.\n /// @param newStatus The current status for redeem.\n event UpdateXTokenRedeemStatusInStabilityMode(bool oldStatus, bool newStatus);\n\n /**********\n * Errors *\n **********/\n\n /// @dev Thrown when the caller if not fUSD contract.\n error ErrorCallerNotFUSD();\n\n /// @dev Thrown when token mint is paused.\n error ErrorMintPaused();\n\n /// @dev Thrown when fToken mint is paused in stability mode.\n error ErrorFTokenMintPausedInStabilityMode();\n\n /// @dev Thrown when mint with zero amount base token.\n error ErrorMintZeroAmount();\n\n /// @dev Thrown when the amount of fToken is not enough.\n error ErrorInsufficientFTokenOutput();\n\n /// @dev Thrown when the amount of xToken is not enough.\n error ErrorInsufficientXTokenOutput();\n\n /// @dev Thrown when token redeem is paused.\n error ErrorRedeemPaused();\n\n /// @dev Thrown when xToken redeem is paused in stability mode.\n error ErrorXTokenRedeemPausedInStabilityMode();\n\n /// @dev Thrown when redeem with zero amount fToken or xToken.\n error ErrorRedeemZeroAmount();\n\n /// @dev Thrown when the amount of base token is not enough.\n error ErrorInsufficientBaseOutput();\n\n /// @dev Thrown when the stability ratio is too large.\n error ErrorStabilityRatioTooLarge();\n\n /// @dev Thrown when the default fee is too large.\n error ErrorDefaultFeeTooLarge();\n\n /// @dev Thrown when the delta fee is too small.\n error ErrorDeltaFeeTooSmall();\n\n /// @dev Thrown when the sum of default fee and delta fee is too large.\n error ErrorTotalFeeTooLarge();\n\n /// @dev Thrown when the given address is zero.\n error ErrorZeroAddress();\n\n /*************************\n * Public View Functions *\n *************************/\n\n /// @notice The address of Treasury contract.\n function treasury() external view returns (address);\n\n /// @notice Return the address of base token.\n function baseToken() external view returns (address);\n\n /// @notice Return the address fractional base token.\n function fToken() external view returns (address);\n\n /// @notice Return the address leveraged base token.\n function xToken() external view returns (address);\n\n /// @notice Return the address of fxUSD token.\n function fxUSD() external view returns (address);\n\n /// @notice Return the collateral ratio to enter stability mode, multiplied by 1e18.\n function stabilityRatio() external view returns (uint256);\n\n /****************************\n * Public Mutated Functions *\n ****************************/\n\n /// @notice Mint some fToken with some base token.\n /// @param baseIn The amount of wrapped value of base token supplied, use `uint256(-1)` to supply all base token.\n /// @param recipient The address of receiver for fToken.\n /// @param minFTokenMinted The minimum amount of fToken should be received.\n /// @return fTokenMinted The amount of fToken should be received.\n function mintFToken(\n uint256 baseIn,\n address recipient,\n uint256 minFTokenMinted\n ) external returns (uint256 fTokenMinted);\n\n /// @notice Mint some xToken with some base token.\n /// @param baseIn The amount of wrapped value of base token supplied, use `uint256(-1)` to supply all base token.\n /// @param recipient The address of receiver for xToken.\n /// @param minXTokenMinted The minimum amount of xToken should be received.\n /// @return xTokenMinted The amount of xToken should be received.\n /// @return bonus The amount of wrapped value of base token as bonus.\n function mintXToken(\n uint256 baseIn,\n address recipient,\n uint256 minXTokenMinted\n ) external returns (uint256 xTokenMinted, uint256 bonus);\n\n /// @notice Redeem base token with fToken.\n /// @param fTokenIn the amount of fToken to redeem, use `uint256(-1)` to redeem all fToken.\n /// @param recipient The address of receiver for base token.\n /// @param minBaseOut The minimum amount of wrapped value of base token should be received.\n /// @return baseOut The amount of wrapped value of base token should be received.\n /// @return bonus The amount of wrapped value of base token as bonus.\n function redeemFToken(\n uint256 fTokenIn,\n address recipient,\n uint256 minBaseOut\n ) external returns (uint256 baseOut, uint256 bonus);\n\n /// @notice Redeem base token with xToken.\n /// @param xTokenIn the amount of xToken to redeem, use `uint256(-1)` to redeem all xToken.\n /// @param recipient The address of receiver for base token.\n /// @param minBaseOut The minimum amount of wrapped value of base token should be received.\n /// @return baseOut The amount of wrapped value of base token should be received.\n function redeemXToken(\n uint256 xTokenIn,\n address recipient,\n uint256 minBaseOut\n ) external returns (uint256 baseOut);\n}\n"
},
"contracts/interfaces/f(x)/IFxTokenWrapper.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.7.0 || ^0.8.0;\n\ninterface IFxTokenWrapper {\n /// @notice Return the address of source token.\n function src() external view returns (address);\n\n /// @notice Return the address of destination token.\n function dst() external view returns (address);\n\n /// @notice Wrap some `src` token to `dst` token.\n ///\n /// @dev Assume that the token is already transfered to this contract.\n ///\n /// @param amount The amount of `src` token to wrap.\n /// @return uint256 The amount of `dst` token received.\n function wrap(uint256 amount) external returns (uint256);\n\n /// @notice Unwrap some `dst` token to `src` token.\n ///\n /// @dev Assume that the token is already transfered to this contract.\n ///\n /// @param amount The amount of `dst` token to unwrap.\n /// @return uint256 The amount of `src` token received.\n function unwrap(uint256 amount) external returns (uint256);\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "shanghai",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}
}} |
1 | 20,291,295 | b281628ddf4308f2149943b07321ef56cb093b5bbca9d2785a7bfa0ce24f96b6 | f70b0cde06fe5d53b8b0eb1f34fd951dd802e997a976121c8c523bd43e497b74 | 0000db5c8b030ae20308ac975898e09741e70000 | ed0e416e0feea5b484ba5c95d375545ac2b60572 | e05f1b8d46197245a487140d6e7b04a79c934937 | 608060405234801561001057600080fd5b50604051610a1a380380610a1a8339818101604052810190610032919061011c565b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550326000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610149565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100e9826100be565b9050919050565b6100f9816100de565b811461010457600080fd5b50565b600081519050610116816100f0565b92915050565b600060208284031215610132576101316100b9565b5b600061014084828501610107565b91505092915050565b6108c2806101586000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063caa5c23f1461003b578063cce3d5d314610057575b600080fd5b610055600480360381019061005091906105fa565b610073565b005b610071600480360381019061006c9190610679565b6101ca565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614610101576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100f890610703565b60405180910390fd5b60005b81518110156101c6578181815181106101205761011f610723565b5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1682828151811061015557610154610723565b5b60200260200101516020015160405161016e91906107c3565b6000604051808303816000865af19150503d80600081146101ab576040519150601f19603f3d011682016040523d82523d6000602084013e6101b0565b606091505b50505080806101be90610809565b915050610104565b5050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614610258576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161024f90610703565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168160405161029e90610877565b60006040518083038185875af1925050503d80600081146102db576040519150601f19603f3d011682016040523d82523d6000602084013e6102e0565b606091505b50505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610348826102ff565b810181811067ffffffffffffffff8211171561036757610366610310565b5b80604052505050565b600061037a6102e6565b9050610386828261033f565b919050565b600067ffffffffffffffff8211156103a6576103a5610310565b5b602082029050602081019050919050565b600080fd5b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006103f1826103c6565b9050919050565b610401816103e6565b811461040c57600080fd5b50565b60008135905061041e816103f8565b92915050565b600080fd5b600067ffffffffffffffff82111561044457610443610310565b5b61044d826102ff565b9050602081019050919050565b82818337600083830152505050565b600061047c61047784610429565b610370565b90508281526020810184848401111561049857610497610424565b5b6104a384828561045a565b509392505050565b600082601f8301126104c0576104bf6102fa565b5b81356104d0848260208601610469565b91505092915050565b6000604082840312156104ef576104ee6103bc565b5b6104f96040610370565b905060006105098482850161040f565b600083015250602082013567ffffffffffffffff81111561052d5761052c6103c1565b5b610539848285016104ab565b60208301525092915050565b60006105586105538461038b565b610370565b9050808382526020820190506020840283018581111561057b5761057a6103b7565b5b835b818110156105c257803567ffffffffffffffff8111156105a05761059f6102fa565b5b8086016105ad89826104d9565b8552602085019450505060208101905061057d565b5050509392505050565b600082601f8301126105e1576105e06102fa565b5b81356105f1848260208601610545565b91505092915050565b6000602082840312156106105761060f6102f0565b5b600082013567ffffffffffffffff81111561062e5761062d6102f5565b5b61063a848285016105cc565b91505092915050565b6000819050919050565b61065681610643565b811461066157600080fd5b50565b6000813590506106738161064d565b92915050565b60006020828403121561068f5761068e6102f0565b5b600061069d84828501610664565b91505092915050565b600082825260208201905092915050565b7f43616c6c6572206973206e6f7420746865206f776e6572000000000000000000600082015250565b60006106ed6017836106a6565b91506106f8826106b7565b602082019050919050565b6000602082019050818103600083015261071c816106e0565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081519050919050565b600081905092915050565b60005b8381101561078657808201518184015260208101905061076b565b60008484015250505050565b600061079d82610752565b6107a7818561075d565b93506107b7818560208601610768565b80840191505092915050565b60006107cf8284610792565b915081905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061081482610643565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610846576108456107da565b5b600182019050919050565b50565b600061086160008361075d565b915061086c82610851565b600082019050919050565b600061088282610854565b915081905091905056fea264697066735822122036692b46567a60a4f6844f8be0961cccba9ff2777bd37b4ea35791aba4c5159b64736f6c63430008120033000000000000000000000000000037bb05b2cef17c6469f4bcdb198826ce0000 | 608060405234801561001057600080fd5b50600436106100365760003560e01c8063caa5c23f1461003b578063cce3d5d314610057575b600080fd5b610055600480360381019061005091906105fa565b610073565b005b610071600480360381019061006c9190610679565b6101ca565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614610101576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100f890610703565b60405180910390fd5b60005b81518110156101c6578181815181106101205761011f610723565b5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1682828151811061015557610154610723565b5b60200260200101516020015160405161016e91906107c3565b6000604051808303816000865af19150503d80600081146101ab576040519150601f19603f3d011682016040523d82523d6000602084013e6101b0565b606091505b50505080806101be90610809565b915050610104565b5050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614610258576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161024f90610703565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168160405161029e90610877565b60006040518083038185875af1925050503d80600081146102db576040519150601f19603f3d011682016040523d82523d6000602084013e6102e0565b606091505b50505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610348826102ff565b810181811067ffffffffffffffff8211171561036757610366610310565b5b80604052505050565b600061037a6102e6565b9050610386828261033f565b919050565b600067ffffffffffffffff8211156103a6576103a5610310565b5b602082029050602081019050919050565b600080fd5b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006103f1826103c6565b9050919050565b610401816103e6565b811461040c57600080fd5b50565b60008135905061041e816103f8565b92915050565b600080fd5b600067ffffffffffffffff82111561044457610443610310565b5b61044d826102ff565b9050602081019050919050565b82818337600083830152505050565b600061047c61047784610429565b610370565b90508281526020810184848401111561049857610497610424565b5b6104a384828561045a565b509392505050565b600082601f8301126104c0576104bf6102fa565b5b81356104d0848260208601610469565b91505092915050565b6000604082840312156104ef576104ee6103bc565b5b6104f96040610370565b905060006105098482850161040f565b600083015250602082013567ffffffffffffffff81111561052d5761052c6103c1565b5b610539848285016104ab565b60208301525092915050565b60006105586105538461038b565b610370565b9050808382526020820190506020840283018581111561057b5761057a6103b7565b5b835b818110156105c257803567ffffffffffffffff8111156105a05761059f6102fa565b5b8086016105ad89826104d9565b8552602085019450505060208101905061057d565b5050509392505050565b600082601f8301126105e1576105e06102fa565b5b81356105f1848260208601610545565b91505092915050565b6000602082840312156106105761060f6102f0565b5b600082013567ffffffffffffffff81111561062e5761062d6102f5565b5b61063a848285016105cc565b91505092915050565b6000819050919050565b61065681610643565b811461066157600080fd5b50565b6000813590506106738161064d565b92915050565b60006020828403121561068f5761068e6102f0565b5b600061069d84828501610664565b91505092915050565b600082825260208201905092915050565b7f43616c6c6572206973206e6f7420746865206f776e6572000000000000000000600082015250565b60006106ed6017836106a6565b91506106f8826106b7565b602082019050919050565b6000602082019050818103600083015261071c816106e0565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081519050919050565b600081905092915050565b60005b8381101561078657808201518184015260208101905061076b565b60008484015250505050565b600061079d82610752565b6107a7818561075d565b93506107b7818560208601610768565b80840191505092915050565b60006107cf8284610792565b915081905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061081482610643565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610846576108456107da565b5b600182019050919050565b50565b600061086160008361075d565b915061086c82610851565b600082019050919050565b600061088282610854565b915081905091905056fea264697066735822122036692b46567a60a4f6844f8be0961cccba9ff2777bd37b4ea35791aba4c5159b64736f6c63430008120033 | |
1 | 20,291,295 | b281628ddf4308f2149943b07321ef56cb093b5bbca9d2785a7bfa0ce24f96b6 | d10e7a7d249b6daec9e4bb74e67de191fe23522b65a033c16d2c01b1f2529a93 | d123af31290072c03dbacedccd167c2317f3216f | bdeb4ba6a1bb01e01ed64f11ed8f6f4b906af52b | 88356567eb9133b26ee76f32e8a8e9af42a3f97f | 3d602d80600a3d3981f3363d3d373d3d3d363d73fb547b99356a114d54671915a0f7bf5cec1973f35af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73fb547b99356a114d54671915a0f7bf5cec1973f35af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,295 | b281628ddf4308f2149943b07321ef56cb093b5bbca9d2785a7bfa0ce24f96b6 | d10e7a7d249b6daec9e4bb74e67de191fe23522b65a033c16d2c01b1f2529a93 | d123af31290072c03dbacedccd167c2317f3216f | bdeb4ba6a1bb01e01ed64f11ed8f6f4b906af52b | add5bf0bd1a52dd4d75840321d513e171ea06410 | 3d602d80600a3d3981f3363d3d373d3d3d363d73fb547b99356a114d54671915a0f7bf5cec1973f35af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73fb547b99356a114d54671915a0f7bf5cec1973f35af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,295 | b281628ddf4308f2149943b07321ef56cb093b5bbca9d2785a7bfa0ce24f96b6 | d10e7a7d249b6daec9e4bb74e67de191fe23522b65a033c16d2c01b1f2529a93 | d123af31290072c03dbacedccd167c2317f3216f | bdeb4ba6a1bb01e01ed64f11ed8f6f4b906af52b | 5cbdf0266e4d6ac3ae4fc1cebe0bbe5e81b36750 | 3d602d80600a3d3981f3363d3d373d3d3d363d73fb547b99356a114d54671915a0f7bf5cec1973f35af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73fb547b99356a114d54671915a0f7bf5cec1973f35af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,295 | b281628ddf4308f2149943b07321ef56cb093b5bbca9d2785a7bfa0ce24f96b6 | d10e7a7d249b6daec9e4bb74e67de191fe23522b65a033c16d2c01b1f2529a93 | d123af31290072c03dbacedccd167c2317f3216f | bdeb4ba6a1bb01e01ed64f11ed8f6f4b906af52b | 9b73d43965bceb2db7312097bf4259e5366a8ae9 | 3d602d80600a3d3981f3363d3d373d3d3d363d73fb547b99356a114d54671915a0f7bf5cec1973f35af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73fb547b99356a114d54671915a0f7bf5cec1973f35af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,295 | b281628ddf4308f2149943b07321ef56cb093b5bbca9d2785a7bfa0ce24f96b6 | d10e7a7d249b6daec9e4bb74e67de191fe23522b65a033c16d2c01b1f2529a93 | d123af31290072c03dbacedccd167c2317f3216f | bdeb4ba6a1bb01e01ed64f11ed8f6f4b906af52b | 0efb740d6f9886a19f487ac0f43563c148095c8d | 3d602d80600a3d3981f3363d3d373d3d3d363d73fb547b99356a114d54671915a0f7bf5cec1973f35af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73fb547b99356a114d54671915a0f7bf5cec1973f35af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,295 | b281628ddf4308f2149943b07321ef56cb093b5bbca9d2785a7bfa0ce24f96b6 | d10e7a7d249b6daec9e4bb74e67de191fe23522b65a033c16d2c01b1f2529a93 | d123af31290072c03dbacedccd167c2317f3216f | bdeb4ba6a1bb01e01ed64f11ed8f6f4b906af52b | 8a6a3e14a1053c37f6b1681b5514c0dade6a0d27 | 3d602d80600a3d3981f3363d3d373d3d3d363d73fb547b99356a114d54671915a0f7bf5cec1973f35af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73fb547b99356a114d54671915a0f7bf5cec1973f35af43d82803e903d91602b57fd5bf3 | |
1 | 20,291,295 | b281628ddf4308f2149943b07321ef56cb093b5bbca9d2785a7bfa0ce24f96b6 | d10e7a7d249b6daec9e4bb74e67de191fe23522b65a033c16d2c01b1f2529a93 | d123af31290072c03dbacedccd167c2317f3216f | bdeb4ba6a1bb01e01ed64f11ed8f6f4b906af52b | 000a458c7e070523d5516ebc9c23e971c213127b | 3d602d80600a3d3981f3363d3d373d3d3d363d73fb547b99356a114d54671915a0f7bf5cec1973f35af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73fb547b99356a114d54671915a0f7bf5cec1973f35af43d82803e903d91602b57fd5bf3 |
Subsets and Splits