Address Contract Verified
Address
0xd23935f6aE4F7EE6B2b169b07824DCC7f596c4e7
Balance
0 ETH
Nonce
1
Code Size
14330 bytes
Creator
0xc493BD1d...D337 at tx 0xee90cecb...4fcb2d
Indexed Transactions
0 (1 on-chain, 0.6% indexed)
Contract Bytecode
14330 bytes
0x6080604052600436106102385760003560e01c806381e11bd011610138578063c415b95c116100b0578063d547741f1161007f578063ee8cbc7c11610064578063ee8cbc7c146106cf578063ef5cfb8c146106e4578063fbc4862b1461071257600080fd5b8063d547741f1461068f578063d9caed12146106af57600080fd5b8063c415b95c1461060d578063c65958af1461062e578063c6def0761461064e578063c7c4ff461461066e57600080fd5b8063a217fddf11610107578063a42dce80116100ec578063a42dce80146105a4578063a683f801146105c4578063b8239abc146105f857600080fd5b8063a217fddf1461056f578063a2c530da1461058457600080fd5b806381e11bd0146104c757806382dabb21146104f45780638456cb591461051457806391d148541461052957600080fd5b806355d4c244116101cb5780635c975abb1161019a578063657554e81161017f578063657554e814610472578063698766ee146104925780638129fc1c146104b257600080fd5b80635c975abb1461041b5780636449612a1461045257600080fd5b806355d4c2441461039a57806357926c55146103bb57806357a3ff1c146103db57806358e6309f146103fb57600080fd5b806336568abe1161020757806336568abe146103115780633f4ba83a14610331578063498bc288146103465780634cba593a1461036657600080fd5b806301ffc9a714610244578063201a04a014610279578063248a9ca3146102b15780632f2ff15d146102ef57600080fd5b3661023f57005b600080fd5b34801561025057600080fd5b5061026461025f366004612e16565b610733565b60405190151581526020015b60405180910390f35b34801561028557600080fd5b50609a54610299906001600160a01b031681565b6040516001600160a01b039091168152602001610270565b3480156102bd57600080fd5b506102e16102cc366004612e40565b60009081526065602052604090206001015490565b604051908152602001610270565b3480156102fb57600080fd5b5061030f61030a366004612e6e565b61079c565b005b34801561031d57600080fd5b5061030f61032c366004612e6e565b6107c6565b34801561033d57600080fd5b5061030f610857565b34801561035257600080fd5b5061030f610361366004612e9e565b61088c565b34801561037257600080fd5b506102e17f349eec46d2c564a125684d1934a6120a70cc341d3a26d362e358a775e07dec1781565b3480156103a657600080fd5b5061010154610299906001600160a01b031681565b3480156103c757600080fd5b50609754610299906001600160a01b031681565b3480156103e757600080fd5b5060ff54610299906001600160a01b031681565b34801561040757600080fd5b50610264610416366004612f34565b610c1d565b34801561042757600080fd5b507fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033005460ff16610264565b34801561045e57600080fd5b5061030f61046d366004612f6f565b610d20565b34801561047e57600080fd5b5061030f61048d366004612fd8565b610f06565b34801561049e57600080fd5b5061030f6104ad36600461301a565b6110bd565b3480156104be57600080fd5b5061030f61116f565b3480156104d357600080fd5b506104e76104e23660046130f1565b61128f565b60405161027091906131e0565b34801561050057600080fd5b50609854610299906001600160a01b031681565b34801561052057600080fd5b5061030f611465565b34801561053557600080fd5b50610264610544366004612e6e565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b34801561057b57600080fd5b506102e1600081565b34801561059057600080fd5b5060fe54610299906001600160a01b031681565b3480156105b057600080fd5b5061030f6105bf366004612f34565b611497565b3480156105d057600080fd5b506102e17ff28dfd3b70fdc4c240fe198ff7392f4c72fb08f96bed76e3fb845a046d01c11b81565b34801561060457600080fd5b5061030f611566565b34801561061957600080fd5b5061010354610299906001600160a01b031681565b34801561063a57600080fd5b5061030f610649366004612f34565b6116f1565b34801561065a57600080fd5b50609954610299906001600160a01b031681565b34801561067a57600080fd5b5061010054610299906001600160a01b031681565b34801561069b57600080fd5b5061030f6106aa366004612e6e565b611727565b3480156106bb57600080fd5b5061030f6106ca3660046131f3565b61174c565b3480156106db57600080fd5b5061030f6117fa565b3480156106f057600080fd5b506107046106ff366004612f34565b6119e3565b604051610270929190613264565b34801561071e57600080fd5b5061010254610299906001600160a01b031681565b60006001600160e01b031982167f7965db0b00000000000000000000000000000000000000000000000000000000148061079657507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b6000828152606560205260409020600101546107b781611cab565b6107c18383611cb5565b505050565b6001600160a01b03811633146108495760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6108538282611d57565b5050565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a61088181611cab565b610889611dda565b50565b600061089781611cab565b6001600160a01b0387166108ed5760405162461bcd60e51b815260206004820152601f60248201527f696e76616c6964205f70656e646c65566f74696e67436f6e74726f6c6c6572006044820152606401610840565b6001600160a01b0385166109435760405162461bcd60e51b815260206004820152601360248201527f696e76616c6964205f6465706f7369746f7221000000000000000000000000006044820152606401610840565b6001600160a01b0384166109995760405162461bcd60e51b815260206004820152601b60248201527f696e76616c6964205f6550656e646c65526577617264506f6f6c2100000000006044820152606401610840565b6001600160a01b0383166109ef5760405162461bcd60e51b815260206004820152601a60248201527f696e76616c6964205f6665654469737472696275746f725632210000000000006044820152606401610840565b6001600160a01b038216610a455760405162461bcd60e51b815260206004820152601660248201527f696e76616c6964205f666565436f6c6c6563746f7221000000000000000000006044820152606401610840565b610a4f8887611e46565b609860009054906101000a90046001600160a01b03166001600160a01b031663a2c530da6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610aa2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac69190613292565b60fe80546001600160a01b03199081166001600160a01b039384161790915560ff805482168a841617905561010080548216888416908117909155610101805483168885161790556101028054831687851617905561010380549092169285169290921790556040519081527f8cf8be695b910a30beed2532e7990699dfe014923098dc301a0e96205e46e25a9060200160405180910390a16040516001600160a01b03851681527f0edcabad30ac8d101e56b75408f7ad6291722d073a039798a4deb41a98eb12869060200160405180910390a16040516001600160a01b03841681527f7889fce52be8050c643a2e0c7a92ce5aaa933d97a0d7600400ab060cdfa15fdc9060200160405180910390a16040516001600160a01b03831681527fe5693914d19c789bdee50a362998c0bc8d035a835f9871da5d51152f0582c34f9060200160405180910390a15050505050505050565b6097546040516358e6309f60e01b81526001600160a01b03838116600483015260009216906358e6309f90602401602060405180830381865afa158015610c68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8c91906132af565b15610c9957506001919050565b609a546001600160a01b031615610d1857609a546040516358e6309f60e01b81526001600160a01b038481166004830152909116906358e6309f90602401602060405180830381865afa158015610cf4573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079691906132af565b506000919050565b610100546001600160a01b03163314610d635760405162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b6044820152606401610840565b60fe546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015610dac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd091906132d1565b90508015610e135760985460fe54610df6916001600160a01b039182169116600061203f565b60985460fe54610e13916001600160a01b0391821691168361203f565b6098546040517fc8121ec20000000000000000000000000000000000000000000000000000000081526fffffffffffffffffffffffffffffffff8084166004830152841660248201526001600160a01b039091169063c8121ec2906044016020604051808303816000875af1158015610e90573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb491906132ea565b50604080516fffffffffffffffffffffffffffffffff8084168252841660208201527f09a2dfd07bcc310649f1f6d871a0a2342b09caa89adef3e7a2ef72101316be9191015b60405180910390a15050565b7f349eec46d2c564a125684d1934a6120a70cc341d3a26d362e358a775e07dec17610f3081611cab565b60005b82811015610fd6576098546001600160a01b0316848483818110610f5957610f59613307565b9050602002016020810190610f6e9190612f34565b6001600160a01b031603610fc45760405162461bcd60e51b815260206004820152601b60248201527f63616e6e6f7420636c61696d20766550656e646c6520666565732100000000006044820152606401610840565b80610fce81613333565b915050610f33565b5061010254610103546040517fff5b406600000000000000000000000000000000000000000000000000000000815260009283926001600160a01b039182169263ff5b40669261102e9216908990899060040161338a565b6000604051808303816000875af115801561104d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110759190810190613413565b915091507f92a2d7c9ade63a926e1ae4cb3d1caa0b1e5cc226a427999c310b856f280d5439858584846040516110ae949392919061345a565b60405180910390a15050505050565b7ff28dfd3b70fdc4c240fe198ff7392f4c72fb08f96bed76e3fb845a046d01c11b6110e781611cab565b60ff546040517f698766ee0000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063698766ee90611136908890889088908890600401613486565b600060405180830381600087803b15801561115057600080fd5b505af1158015611164573d6000803e3d6000fd5b505050505050505050565b600054610100900460ff161580801561118f5750600054600160ff909116105b806111a95750303b1580156111a9575060005460ff166001145b61121b5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610840565b6000805460ff19166001179055801561123e576000805461ff0019166101001790555b6112466121d5565b8015610889576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a150565b606061129961224a565b6099546001600160a01b031633146112db5760405162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b6044820152606401610840565b6112e4836122a6565b905081518151146113375760405162461bcd60e51b815260206004820152601160248201527f696e76616c6964205f616d6f756e7473210000000000000000000000000000006044820152606401610840565b60005b81518110156114235761136582828151811061135857611358613307565b6020026020010151610c1d565b156113b25760405162461bcd60e51b815260206004820152601c60248201527f726577617264546f6b656e2063616e6e6f74206265206d61726b6574000000006044820152606401610840565b6099548351611411916001600160a01b0316908590849081106113d7576113d7613307565b60200260200101518484815181106113f1576113f1613307565b60200260200101516001600160a01b03166123b29092919063ffffffff16565b8061141b81613333565b91505061133a565b507fc53cb8bc1a7200a84d0b66a538905a245c4915aace7f1ce5dc4a0ba107ebc15c838284604051611457939291906134f3565b60405180910390a192915050565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a61148f81611cab565b6108896123eb565b7f349eec46d2c564a125684d1934a6120a70cc341d3a26d362e358a775e07dec176114c181611cab565b6001600160a01b0382166115175760405162461bcd60e51b815260206004820152601660248201527f696e76616c6964205f666565436f6c6c6563746f7221000000000000000000006044820152606401610840565b61010380546001600160a01b0319166001600160a01b0384169081179091556040519081527fe5693914d19c789bdee50a362998c0bc8d035a835f9871da5d51152f0582c34f90602001610efa565b7f349eec46d2c564a125684d1934a6120a70cc341d3a26d362e358a775e07dec1761159081611cab565b60408051600180825281830190925260009160208083019080368337505060985482519293506001600160a01b0316918391506000906115d2576115d2613307565b6001600160a01b039283166020918202929092010152610102546040517fff5b40660000000000000000000000000000000000000000000000000000000081526000928392169063ff5b40669061162f9030908790600401613531565b6000604051808303816000875af115801561164e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526116769190810190613413565b91509150816000036116885750505050565b6101035461169f906001600160a01b031683612446565b610103546040517f13527b36f6426983c59715eae35b95f2e2e50360df3650d0e44307c4b5fd4f8a916116e3916001600160a01b0390911690869086908690613553565b60405180910390a150505050565b6116f961224a565b600061170481611cab565b50609a80546001600160a01b0319166001600160a01b0392909216919091179055565b60008281526065602052604090206001015461174281611cab565b6107c18383611d57565b61175461224a565b6099546001600160a01b031633146117965760405162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b6044820152606401610840565b6117aa6001600160a01b038416838361250f565b604080516001600160a01b038086168252841660208201529081018290527fd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb9060600160405180910390a1505050565b7f349eec46d2c564a125684d1934a6120a70cc341d3a26d362e358a775e07dec1761182481611cab565b60408051600180825281830190925260009160208083019080368337505060985482519293506001600160a01b03169183915060009061186657611866613307565b6001600160a01b039283166020918202929092010152610102546040517fff5b40660000000000000000000000000000000000000000000000000000000081526000928392169063ff5b4066906118c39030908790600401613531565b6000604051808303816000875af11580156118e2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261190a9190810190613413565b915091508160000361191c5750505050565b610101546040517f04d0c2c500000000000000000000000000000000000000000000000000000000815273efefefefefefefefefefefefefefefefefefefef6004820152602481018490526001600160a01b03909116906304d0c2c59084906044016000604051808303818588803b15801561199757600080fd5b505af11580156119ab573d6000803e3d6000fd5b50505050507f92a2d7c9ade63a926e1ae4cb3d1caa0b1e5cc226a427999c310b856f280d54398383836040516116e39392919061358d565b6060806119ee61224a565b6099546001600160a01b03163314611a305760405162461bcd60e51b8152602060048201526005602482015264042c2eae8d60db1b6044820152606401610840565b611a39836122a6565b91506000825167ffffffffffffffff811115611a5757611a57613086565b604051908082528060200260200182016040528015611a80578160200160208202803683370190505b50905060005b8351811015611ae157611ab2848281518110611aa457611aa4613307565b60200260200101513061253f565b828281518110611ac457611ac4613307565b602090810291909101015280611ad981613333565b915050611a86565b506040517f9262187b0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03851690639262187b906024016000604051808303816000875af1158015611b41573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611b6991908101906135b8565b50825167ffffffffffffffff811115611b8457611b84613086565b604051908082528060200260200182016040528015611bad578160200160208202803683370190505b50915060005b8351811015611c69576000848281518110611bd057611bd0613307565b602002602001015190506000838381518110611bee57611bee613307565b6020026020010151611c00833061253f565b611c0a91906135ed565b905080858481518110611c1f57611c1f613307565b60200260200101818152505080600003611c3a575050611c57565b609954611c54906001600160a01b038481169116836123b2565b50505b80611c6181613333565b915050611bb3565b507fc53cb8bc1a7200a84d0b66a538905a245c4915aace7f1ce5dc4a0ba107ebc15c848484604051611c9d939291906134f3565b60405180910390a150915091565b61088981336125e7565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff166108535760008281526065602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611d133390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16156108535760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b611de2612667565b7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300805460ff191681557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b039091168152602001611284565b6099546001600160a01b031615611e9f5760405162461bcd60e51b815260206004820152600560248201527f21696e69740000000000000000000000000000000000000000000000000000006044820152606401610840565b6001600160a01b038216611ef55760405162461bcd60e51b815260206004820152601d60248201527f696e76616c6964205f70656e646c654d61726b6574466163746f7279210000006044820152606401610840565b6001600160a01b038116611f4b5760405162461bcd60e51b815260206004820152601160248201527f696e76616c6964205f626f6f73746572210000000000000000000000000000006044820152606401610840565b609780546001600160a01b0319166001600160a01b038416908117909155604080517f82dabb2100000000000000000000000000000000000000000000000000000000815290516382dabb21916004808201926020929091908290030181865afa158015611fbd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fe19190613292565b609880546001600160a01b03199081166001600160a01b03938416179091556099805490911691831691821790556040519081527f5407aa361e671ca7c620332ea4c073198f8bc6125f2aceb4766a160b5afec16190602001610efa565b8015806120d257506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa1580156120ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120d091906132d1565b155b6121445760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401610840565b6040516001600160a01b0383166024820152604481018290526107c19084907f095ea7b300000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b0319909316929092179091526126c2565b600054610100900460ff166122405760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610840565b6122486127aa565b565b7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033005460ff1615612248576040517fd93c066500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60606000826001600160a01b031663c4f59f9b6040518163ffffffff1660e01b8152600401600060405180830381865afa1580156122e8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526123109190810190613600565b905060005b81518110156123ab5760006001600160a01b031682828151811061233b5761233b613307565b60200260200101516001600160a01b0316036123995773efefefefefefefefefefefefefefefefefefefef82828151811061237857612378613307565b60200260200101906001600160a01b031690816001600160a01b0316815250505b806123a381613333565b915050612315565b5092915050565b73efefefefefefefefefefefefefefefefefefefef6001600160a01b038416036123e0576107c18282612446565b6107c1838383612830565b6123f361224a565b7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300805460ff191660011781557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833611e2e565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612493576040519150601f19603f3d011682016040523d82523d6000602084013e612498565b606091505b50509050806107c15760405162461bcd60e51b815260206004820152602260248201527f5472616e7366657248656c7065723a2053656e64696e6720455448206661696c60448201527f65640000000000000000000000000000000000000000000000000000000000006064820152608401610840565b6040516001600160a01b0383166024820152604481018290526107c190849063a9059cbb60e01b90606401612189565b600073efefefefefefefefefefefefefefefefefefefef6001600160a01b0384160361257657506001600160a01b03811631610796565b6040516370a0823160e01b81526001600160a01b0383811660048301528416906370a0823190602401602060405180830381865afa1580156125bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125e091906132d1565b9050610796565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff1661085357612625816001600160a01b03166014612986565b612630836020612986565b6040516020016126419291906136b3565b60408051601f198184030181529082905262461bcd60e51b825261084091600401613734565b7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033005460ff16612248576040517f8dfc202b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000612717826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612b6e9092919063ffffffff16565b905080516000148061273857508080602001905181019061273891906132af565b6107c15760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610840565b600054610100900460ff166128155760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610840565b61281d612b85565b612825612bf0565b612248600033611cb5565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e01b17905291516000928392908716916128a19190613767565b6000604051808303816000865af19150503d80600081146128de576040519150601f19603f3d011682016040523d82523d6000602084013e6128e3565b606091505b509150915081801561290d57508051158061290d57508080602001905181019061290d91906132af565b61297f5760405162461bcd60e51b815260206004820152602d60248201527f5472616e7366657248656c7065723a3a736166655472616e736665723a20747260448201527f616e73666572206661696c6564000000000000000000000000000000000000006064820152608401610840565b5050505050565b60606000612995836002613783565b6129a090600261379a565b67ffffffffffffffff8111156129b8576129b8613086565b6040519080825280601f01601f1916602001820160405280156129e2576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110612a1957612a19613307565b60200101906001600160f81b031916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110612a6457612a64613307565b60200101906001600160f81b031916908160001a9053506000612a88846002613783565b612a9390600161379a565b90505b6001811115612b18577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110612ad457612ad4613307565b1a60f81b828281518110612aea57612aea613307565b60200101906001600160f81b031916908160001a90535060049490941c93612b11816137ad565b9050612a96565b508315612b675760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610840565b9392505050565b6060612b7d8484600085612c86565b949350505050565b600054610100900460ff166122485760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610840565b600054610100900460ff16612c5b5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610840565b7fcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300805460ff19169055565b606082471015612cfe5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610840565b600080866001600160a01b03168587604051612d1a9190613767565b60006040518083038185875af1925050503d8060008114612d57576040519150601f19603f3d011682016040523d82523d6000602084013e612d5c565b606091505b5091509150612d6d87838387612d78565b979650505050505050565b60608315612de7578251600003612de0576001600160a01b0385163b612de05760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610840565b5081612b7d565b612b7d8383815115612dfc5781518083602001fd5b8060405162461bcd60e51b81526004016108409190613734565b600060208284031215612e2857600080fd5b81356001600160e01b031981168114612b6757600080fd5b600060208284031215612e5257600080fd5b5035919050565b6001600160a01b038116811461088957600080fd5b60008060408385031215612e8157600080fd5b823591506020830135612e9381612e59565b809150509250929050565b600080600080600080600060e0888a031215612eb957600080fd5b8735612ec481612e59565b96506020880135612ed481612e59565b95506040880135612ee481612e59565b94506060880135612ef481612e59565b93506080880135612f0481612e59565b925060a0880135612f1481612e59565b915060c0880135612f2481612e59565b8091505092959891949750929550565b600060208284031215612f4657600080fd5b8135612b6781612e59565b6fffffffffffffffffffffffffffffffff8116811461088957600080fd5b600060208284031215612f8157600080fd5b8135612b6781612f51565b60008083601f840112612f9e57600080fd5b50813567ffffffffffffffff811115612fb657600080fd5b6020830191508360208260051b8501011115612fd157600080fd5b9250929050565b60008060208385031215612feb57600080fd5b823567ffffffffffffffff81111561300257600080fd5b61300e85828601612f8c565b90969095509350505050565b6000806000806040858703121561303057600080fd5b843567ffffffffffffffff8082111561304857600080fd5b61305488838901612f8c565b9096509450602087013591508082111561306d57600080fd5b5061307a87828801612f8c565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156130c5576130c5613086565b604052919050565b600067ffffffffffffffff8211156130e7576130e7613086565b5060051b60200190565b6000806040838503121561310457600080fd5b823561310f81612e59565b915060208381013567ffffffffffffffff81111561312c57600080fd5b8401601f8101861361313d57600080fd5b803561315061314b826130cd565b61309c565b81815260059190911b8201830190838101908883111561316f57600080fd5b928401925b8284101561318d57833582529284019290840190613174565b80955050505050509250929050565b600081518084526020808501945080840160005b838110156131d55781516001600160a01b0316875295820195908201906001016131b0565b509495945050505050565b602081526000612b67602083018461319c565b60008060006060848603121561320857600080fd5b833561321381612e59565b9250602084013561322381612e59565b929592945050506040919091013590565b600081518084526020808501945080840160005b838110156131d557815187529582019590820190600101613248565b604081526000613277604083018561319c565b82810360208401526132898185613234565b95945050505050565b6000602082840312156132a457600080fd5b8151612b6781612e59565b6000602082840312156132c157600080fd5b81518015158114612b6757600080fd5b6000602082840312156132e357600080fd5b5051919050565b6000602082840312156132fc57600080fd5b8151612b6781612f51565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016133455761334561331d565b5060010190565b8183526000602080850194508260005b858110156131d557813561336f81612e59565b6001600160a01b03168752958201959082019060010161335c565b6001600160a01b038416815260406020820152600061328960408301848661334c565b600082601f8301126133be57600080fd5b815160206133ce61314b836130cd565b82815260059290921b840181019181810190868411156133ed57600080fd5b8286015b8481101561340857805183529183019183016133f1565b509695505050505050565b6000806040838503121561342657600080fd5b82519150602083015167ffffffffffffffff81111561344457600080fd5b613450858286016133ad565b9150509250929050565b60608152600061346e60608301868861334c565b8460208401528281036040840152612d6d8185613234565b60408152600061349a60408301868861334c565b828103602084810191909152848252859181016000805b878110156134e457843567ffffffffffffffff81168082146134d1578384fd5b84525093830193918301916001016134b1565b50909998505050505050505050565b6001600160a01b0384168152606060208201526000613515606083018561319c565b82810360408401526135278185613234565b9695505050505050565b6001600160a01b0383168152604060208201526000612b7d604083018461319c565b6001600160a01b0385168152608060208201526000613575608083018661319c565b8460408401528281036060840152612d6d8185613234565b6060815260006135a0606083018661319c565b84602084015282810360408401526135278185613234565b6000602082840312156135ca57600080fd5b815167ffffffffffffffff8111156135e157600080fd5b612b7d848285016133ad565b818103818111156107965761079661331d565b6000602080838503121561361357600080fd5b825167ffffffffffffffff81111561362a57600080fd5b8301601f8101851361363b57600080fd5b805161364961314b826130cd565b81815260059190911b8201830190838101908783111561366857600080fd5b928401925b82841015612d6d57835161368081612e59565b8252928401929084019061366d565b60005b838110156136aa578181015183820152602001613692565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516136eb81601785016020880161368f565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161372881602884016020880161368f565b01602801949350505050565b602081526000825180602084015261375381604085016020870161368f565b601f01601f19169190910160400192915050565b6000825161377981846020870161368f565b9190910192915050565b80820281158282048414176107965761079661331d565b808201808211156107965761079661331d565b6000816137bc576137bc61331d565b50600019019056fea264697066735822122091b9ddd794804719e0deae5df91ebfa817ca6adf49f5d4f2f728276b6b31168064736f6c63430008110033
Verified Source Code Full Match
Compiler: v0.8.17+commit.8df45f5f
EVM: london
Optimization: Yes (1000 runs)
AccessControlUpgradeable.sol 260 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it.
*/
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
function __AccessControl_init() internal onlyInitializing {
}
function __AccessControl_init_unchained() internal onlyInitializing {
}
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a standardized message including the required role.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Revert with a standard message if `_msgSender()` is missing `role`.
* Overriding this function changes the behavior of the {onlyRole} modifier.
*
* Format of the revert message is described in {_checkRole}.
*
* _Available since v4.6._
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Revert with a standard message if `account` is missing `role`.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
StringsUpgradeable.toHexString(uint160(account), 20),
" is missing role ",
StringsUpgradeable.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* May emit a {RoleGranted} event.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*
* NOTE: This function is deprecated in favor of {_grantRole}.
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Grants `role` to `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
/**
* @dev Revokes `role` from `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}
IAccessControlUpgradeable.sol 88 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControlUpgradeable {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}
Initializable.sol 138 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original
* initialization step. This is essential to configure modules that are added through upgrades and that require
* initialization.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized < type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
}
AddressUpgradeable.sol 195 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @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
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 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");
(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");
(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");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal 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
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
ContextUpgradeable.sol 37 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";
/**
* @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 ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}
ERC165Upgradeable.sol 42 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
function __ERC165_init() internal onlyInitializing {
}
function __ERC165_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165Upgradeable).interfaceId;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}
IERC165Upgradeable.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165Upgradeable {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
StringsUpgradeable.sol 75 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library StringsUpgradeable {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}
IERC20Metadata.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @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);
}
IERC20Permit.sol 60 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}
IERC20.sol 78 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @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 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 `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, 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 `from` to `to` 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 from, address to, uint256 amount) external returns (bool);
}
SafeERC20.sol 143 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}
Address.sol 244 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @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
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 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://consensys.net/diligence/blog/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.8.0/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");
(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 functionCallWithValue(target, data, 0, "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");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// 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
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
AddressLib.sol 12 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
library AddressLib {
address public constant PLATFORM_TOKEN_ADDRESS =
0xeFEfeFEfeFeFEFEFEfefeFeFefEfEfEfeFEFEFEf;
function isPlatformToken(address addr) internal pure returns (bool) {
return addr == PLATFORM_TOKEN_ADDRESS;
}
}
TransferHelper.sol 67 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./AddressLib.sol";
library TransferHelper {
using AddressLib for address;
function safeTransferToken(
address token,
address to,
uint value
) internal {
if (token.isPlatformToken()) {
safeTransferETH(to, value);
} else {
safeTransfer(IERC20(token), to, value);
}
}
function safeTransferETH(
address to,
uint value
) internal {
(bool success, ) = address(to).call{value: value}("");
require(success, "TransferHelper: Sending ETH failed");
}
function balanceOf(address token, address addr) internal view returns (uint) {
if (token.isPlatformToken()) {
return addr.balance;
} else {
return IERC20(token).balanceOf(addr);
}
}
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transfer(address,uint256)'))) -> 0xa9059cbb
(bool success, bytes memory data) = address(token).call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeTransfer: transfer failed'
);
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))) -> 0x23b872dd
(bool success, bytes memory data) = address(token).call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeTransferFrom: transfer failed'
);
}
}
EqbConstants.sol 26 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
library EqbConstants {
// Roles
bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
bytes32 public constant ZAP_ROLE = keccak256("ZAP_ROLE");
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
// contracts
bytes32 public constant PENDLE_ROUTER_V3 = keccak256("PENDLE_ROUTER_V3");
bytes32 public constant DEPOSIT_TOKEN_V2_BEACON =
keccak256("DEPOSIT_TOKEN_V2_BEACON");
bytes32 public constant BASE_REWARD_POOL_V2_BEACON =
keccak256("BASE_REWARD_POOL_V2_BEACON");
bytes32 public constant EPENDLE_VAULT_SIDECHAIN =
keccak256("EPENDLE_VAULT_SIDECHAIN");
bytes32 public constant SMART_CONVERTOR = keccak256("SMART_CONVERTOR");
bytes32 public constant EQB_ZAP = keccak256("EQB_ZAP");
bytes32 public constant VAULT_DEPOSIT_TOKEN_BEACON =
keccak256("VAULT_DEPOSIT_TOKEN_BEACON");
bytes32 public constant VAULT_DEPOSIT_TOKEN_FACTORY =
keccak256("VAULT_DEPOSIT_TOKEN_FACTORY");
}
PausableUpgradeable.sol 145 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)
pragma solidity 0.8.17;
import {ContextUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
/// @custom:storage-location erc7201:openzeppelin.storage.Pausable
struct PausableStorage {
bool _paused;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Pausable")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant PausableStorageLocation =
0xcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300;
function _getPausableStorage()
private
pure
returns (PausableStorage storage $)
{
assembly {
$.slot := PausableStorageLocation
}
}
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
/**
* @dev The operation failed because the contract is paused.
*/
error EnforcedPause();
/**
* @dev The operation failed because the contract is not paused.
*/
error ExpectedPause();
/**
* @dev Initializes the contract in unpaused state.
*/
function __Pausable_init() internal onlyInitializing {
__Pausable_init_unchained();
}
function __Pausable_init_unchained() internal onlyInitializing {
PausableStorage storage $ = _getPausableStorage();
$._paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
PausableStorage storage $ = _getPausableStorage();
return $._paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
if (paused()) {
revert EnforcedPause();
}
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
if (!paused()) {
revert ExpectedPause();
}
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
PausableStorage storage $ = _getPausableStorage();
$._paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
PausableStorage storage $ = _getPausableStorage();
$._paused = false;
emit Unpaused(_msgSender());
}
}
IPendleProxy.sol 29 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
interface IPendleProxy {
function isValidMarket(address _market) external view returns (bool);
function withdraw(address _market, address _to, uint256 _amount) external;
function claimRewards(
address _market
) external returns (address[] memory, uint256[] memory);
function claimRewardsManually(
address _market,
uint256[] memory _amounts
) external returns (address[] memory rewardTokens);
// --- Events ---
event BoosterUpdated(address _booster);
event Withdrawn(address _market, address _to, uint256 _amount);
event RewardsClaimed(
address _market,
address[] _rewardTokens,
uint256[] _rewardAmounts
);
}
IPendleProxyMainchain.sol 29 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import "./IPendleProxy.sol";
interface IPendleProxyMainchain is IPendleProxy {
function lockPendle(uint128 _expiry) external;
// --- Events ---
event DepositorUpdated(address _depositor);
event EPendleRewardPoolUpdated(address _ePendleRewardPool);
event FeeDistributorV2Updated(address _feeDistributorV2);
event FeeCollectorUpdated(address _feeCollector);
event PendleLocked(uint128 _additionalAmountToLock, uint128 _newExpiry);
event FeesClaimed(
address[] _pools,
uint256 _totalAmountOut,
uint256[] _amountsOut
);
event YTFeesClaimedToRecipient(
address _recipient,
address[] _pools,
uint256 _totalAmountOut,
uint256[] _amountsOut
);
}
IRewards.sol 9 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
interface IRewards {
function queueNewRewards(address, uint256) external payable;
event RewardAdded(address indexed _rewardToken, uint256 _reward);
}
IPFeeDistributorV2.sol 52 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
interface IPFeeDistributorV2 {
event SetMerkleRootAndFund(
bytes32 indexed merkleRoot,
uint256 amountFunded
);
event Claimed(address indexed user, uint256 amountOut);
event UpdateProtocolClaimable(address indexed user, uint256 sumTopUp);
struct UpdateProtocolStruct {
address user;
bytes32[] proof;
address[] pools;
uint256[] topUps;
}
/**
* @notice submit total ETH accrued & proof to claim the outstanding amount. Intended to be
used by retail users
*/
function claimRetail(
address receiver,
uint256 totalAccrued,
bytes32[] calldata proof
) external returns (uint256 amountOut);
/**
* @notice Protocols that require the use of this function & feeData should contact the Pendle team.
* @notice Protocols should NOT EVER use claimRetail. Using it will make getProtocolFeeData unreliable.
*/
function claimProtocol(
address receiver,
address[] calldata pools
) external returns (uint256 totalAmountOut, uint256[] memory amountsOut);
/**
* @notice returns the claimable fees per pool. Only available if the Pendle team has specifically
set up the data
*/
function getProtocolClaimables(
address user,
address[] calldata pools
) external view returns (uint256[] memory claimables);
function getProtocolTotalAccrued(
address user
) external view returns (uint256);
}
IPMarket.sol 85 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
interface IPMarket is IERC20Metadata {
event Mint(
address indexed receiver,
uint256 netLpMinted,
uint256 netSyUsed,
uint256 netPtUsed
);
event Burn(
address indexed receiverSy,
address indexed receiverPt,
uint256 netLpBurned,
uint256 netSyOut,
uint256 netPtOut
);
event Swap(
address indexed caller,
address indexed receiver,
int256 netPtOut,
int256 netSyOut,
uint256 netSyFee,
uint256 netSyToReserve
);
event UpdateImpliedRate(
uint256 indexed timestamp,
uint256 lnLastImpliedRate
);
event IncreaseObservationCardinalityNext(
uint16 observationCardinalityNextOld,
uint16 observationCardinalityNextNew
);
function mint(
address receiver,
uint256 netSyDesired,
uint256 netPtDesired
) external returns (uint256 netLpOut, uint256 netSyUsed, uint256 netPtUsed);
function burn(
address receiverSy,
address receiverPt,
uint256 netLpToBurn
) external returns (uint256 netSyOut, uint256 netPtOut);
function swapExactPtForSy(
address receiver,
uint256 exactPtIn,
bytes calldata data
) external returns (uint256 netSyOut, uint256 netSyFee);
function swapSyForExactPt(
address receiver,
uint256 exactPtOut,
bytes calldata data
) external returns (uint256 netSyIn, uint256 netSyFee);
function redeemRewards(address user) external returns (uint256[] memory);
function observe(
uint32[] memory secondsAgos
) external view returns (uint216[] memory lnImpliedRateCumulative);
function increaseObservationsCardinalityNext(
uint16 cardinalityNext
) external;
function readTokens()
external
view
returns (address _SY, address _PT, address _YT);
function getRewardTokens() external view returns (address[] memory);
function isExpired() external view returns (bool);
function expiry() external view returns (uint256);
}
IPMarketFactory.sol 45 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
interface IPMarketFactory {
struct FeeConfig {
uint80 lnFeeRateRoot;
uint8 reserveFeePercent;
bool active;
}
event NewMarketConfig(
address indexed treasury,
uint80 defaultLnFeeRateRoot,
uint8 reserveFeePercent
);
event SetOverriddenFee(
address indexed router,
uint80 lnFeeRateRoot,
uint8 reserveFeePercent
);
event UnsetOverriddenFee(address indexed router);
event CreateNewMarket(
address indexed market,
address indexed PT,
int256 scalarRoot,
int256 initialAnchor
);
function vePendle() external view returns (address);
function isValidMarket(address market) external view returns (bool);
// If this is changed, change the readState function in market as well
function getMarketConfig(
address router
)
external
view
returns (
address treasury,
uint80 lnFeeRateRoot,
uint8 reserveFeePercent
);
}
IPVotingController.sol 6 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
interface IPVotingController {
function vote(address[] calldata pools, uint64[] calldata weights) external;
}
IPVotingEscrowMainchain.sol 22 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
interface IPVotingEscrowMainchain {
function pendle() external view returns (address);
function getAllDestinationContracts()
external
view
returns (uint256[] memory chainIds, address[] memory addrs);
function increaseLockPosition(
uint128 additionalAmountToLock,
uint128 expiry
) external returns (uint128);
function increaseLockPositionAndBroadcast(
uint128 additionalAmountToLock,
uint128 newExpiry,
uint256[] calldata chainIds
) external payable returns (uint128 newVeBalance);
}
PendleProxyBaseUpg.sol 195 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "./Dependencies/openzeppelin/contracts/utils/PausableUpgradeable.sol";
import "./Dependencies/EqbConstants.sol";
import "./Interfaces/Pendle/IPMarket.sol";
import "./Interfaces/Pendle/IPMarketFactory.sol";
import "./Interfaces/IPendleProxy.sol";
import "@shared/lib-contracts-v0.8/contracts/Dependencies/TransferHelper.sol";
abstract contract PendleProxyBaseUpg is
IPendleProxy,
AccessControlUpgradeable,
PausableUpgradeable
{
using SafeERC20 for IERC20;
using TransferHelper for address;
IPMarketFactory public pendleMarketFactory;
address public vePendle;
address public booster;
address public pendleMarketFactoryV3;
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
}
function __PendleProxyBaseUpg_init() internal onlyInitializing {
__PendleProxyBaseUpg_init_unchained();
}
function __PendleProxyBaseUpg_init_unchained() internal onlyInitializing {
__AccessControl_init_unchained();
__Pausable_init_unchained();
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
}
modifier onlyBooster() {
require(msg.sender == booster, "!auth");
_;
}
function _setParams(
address _pendleMarketFactory,
address _booster
) internal {
require(booster == address(0), "!init");
require(
_pendleMarketFactory != address(0),
"invalid _pendleMarketFactory!"
);
require(_booster != address(0), "invalid _booster!");
pendleMarketFactory = IPMarketFactory(_pendleMarketFactory);
vePendle = IPMarketFactory(_pendleMarketFactory).vePendle();
booster = _booster;
emit BoosterUpdated(_booster);
}
function pause() external onlyRole(EqbConstants.PAUSER_ROLE) {
_pause();
}
function unpause() external onlyRole(EqbConstants.PAUSER_ROLE) {
_unpause();
}
function setPendleMarketFactoryV3(
address _pendleMarketFactoryV3
) external whenNotPaused onlyRole(DEFAULT_ADMIN_ROLE) {
pendleMarketFactoryV3 = _pendleMarketFactoryV3;
}
function isValidMarket(
address _market
) public view override returns (bool) {
if (pendleMarketFactory.isValidMarket(_market)) {
return true;
}
if (pendleMarketFactoryV3 != address(0)) {
return
IPMarketFactory(pendleMarketFactoryV3).isValidMarket(_market);
}
return false;
}
function withdraw(
address _market,
address _to,
uint256 _amount
) external override whenNotPaused onlyBooster {
IERC20(_market).safeTransfer(_to, _amount);
emit Withdrawn(_market, _to, _amount);
}
function claimRewards(
address _market
)
external
override
whenNotPaused
onlyBooster
returns (address[] memory rewardTokens, uint256[] memory rewardAmounts)
{
rewardTokens = _getRewardTokens(_market);
uint256[] memory rewardTokensBalBefore = new uint256[](
rewardTokens.length
);
for (uint256 i = 0; i < rewardTokens.length; i++) {
rewardTokensBalBefore[i] = TransferHelper.balanceOf(
rewardTokens[i],
address(this)
);
}
IPMarket(_market).redeemRewards(address(this));
rewardAmounts = new uint256[](rewardTokens.length);
for (uint256 i = 0; i < rewardTokens.length; i++) {
address rewardToken = rewardTokens[i];
uint256 rewardTokenAmount = TransferHelper.balanceOf(
rewardToken,
address(this)
) - rewardTokensBalBefore[i];
rewardAmounts[i] = rewardTokenAmount;
if (rewardTokenAmount == 0) {
continue;
}
rewardToken.safeTransferToken(booster, rewardTokenAmount);
}
emit RewardsClaimed(_market, rewardTokens, rewardAmounts);
}
function claimRewardsManually(
address _market,
uint256[] memory _amounts
)
external
override
whenNotPaused
onlyBooster
returns (address[] memory rewardTokens)
{
rewardTokens = _getRewardTokens(_market);
require(rewardTokens.length == _amounts.length, "invalid _amounts!");
for (uint256 i = 0; i < rewardTokens.length; i++) {
require(
!isValidMarket(rewardTokens[i]),
"rewardToken cannot be market"
);
rewardTokens[i].safeTransferToken(booster, _amounts[i]);
}
emit RewardsClaimed(_market, rewardTokens, _amounts);
}
function _getRewardTokens(
address _market
) internal view returns (address[] memory) {
address[] memory rewardTokens = IPMarket(_market).getRewardTokens();
for (uint256 i = 0; i < rewardTokens.length; i++) {
if (rewardTokens[i] == address(0)) {
// native
rewardTokens[i] = AddressLib.PLATFORM_TOKEN_ADDRESS;
}
}
return rewardTokens;
}
function _approveTokenIfNeeded(
address _token,
address _to,
uint256 _amount
) internal {
if (IERC20(_token).allowance(address(this), _to) < _amount) {
IERC20(_token).safeApprove(_to, 0);
IERC20(_token).safeApprove(_to, type(uint256).max);
}
}
receive() external payable {}
uint256[99] private __gap;
}
PendleProxyMainchain.sol 171 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import "@shared/lib-contracts-v0.8/contracts/Dependencies/AddressLib.sol";
import "./Interfaces/IRewards.sol";
import "./Interfaces/IPendleProxyMainchain.sol";
import "./Interfaces/Pendle/IPFeeDistributorV2.sol";
import "./Interfaces/Pendle/IPVotingController.sol";
import "./Interfaces/Pendle/IPVotingEscrowMainchain.sol";
import "./PendleProxyBaseUpg.sol";
contract PendleProxyMainchain is PendleProxyBaseUpg, IPendleProxyMainchain {
using SafeERC20 for IERC20;
address public pendle;
address public pendleVotingController;
address public depositor;
address public ePendleRewardPool;
address public feeDistributorV2;
address public feeCollector;
bytes32 public constant FEE_ADMIN_ROLE = keccak256("FEE_ADMIN_ROLE");
bytes32 public constant VOTE_ADMIN_ROLE = keccak256("VOTE_ADMIN_ROLE");
function initialize() public initializer {
__PendleProxyBaseUpg_init();
}
modifier onlyDepositor() {
require(msg.sender == depositor, "!auth");
_;
}
function setParams(
address _pendleMarketFactory,
address _pendleVotingController,
address _booster,
address _depositor,
address _ePendleRewardPool,
address _feeDistributorV2,
address _feeCollector
) external onlyRole(DEFAULT_ADMIN_ROLE) {
require(
_pendleVotingController != address(0),
"invalid _pendleVotingController"
);
require(_depositor != address(0), "invalid _depositor!");
require(
_ePendleRewardPool != address(0),
"invalid _ePendleRewardPool!"
);
require(_feeDistributorV2 != address(0), "invalid _feeDistributorV2!");
require(_feeCollector != address(0), "invalid _feeCollector!");
_setParams(_pendleMarketFactory, _booster);
pendle = IPVotingEscrowMainchain(vePendle).pendle();
pendleVotingController = _pendleVotingController;
depositor = _depositor;
ePendleRewardPool = _ePendleRewardPool;
feeDistributorV2 = _feeDistributorV2;
feeCollector = _feeCollector;
emit DepositorUpdated(_depositor);
emit EPendleRewardPoolUpdated(_ePendleRewardPool);
emit FeeDistributorV2Updated(_feeDistributorV2);
emit FeeCollectorUpdated(_feeCollector);
}
function setFeeCollector(
address _feeCollector
) external onlyRole(FEE_ADMIN_ROLE) {
require(_feeCollector != address(0), "invalid _feeCollector!");
feeCollector = _feeCollector;
emit FeeCollectorUpdated(_feeCollector);
}
function lockPendle(uint128 _expiry) external override onlyDepositor {
uint256 balance = IERC20(pendle).balanceOf(address(this));
if (balance > 0) {
IERC20(pendle).safeApprove(vePendle, 0);
IERC20(pendle).safeApprove(vePendle, balance);
}
IPVotingEscrowMainchain(vePendle).increaseLockPosition(
uint128(balance),
_expiry
);
emit PendleLocked(uint128(balance), _expiry);
}
function vote(
address[] calldata _pools,
uint64[] calldata _weights
) external onlyRole(VOTE_ADMIN_ROLE) {
IPVotingController(pendleVotingController).vote(_pools, _weights);
}
function claimYTFees() external onlyRole(FEE_ADMIN_ROLE) {
address[] memory pools = new address[](1);
pools[0] = vePendle;
(
uint256 totalAmountOut,
uint256[] memory amountsOut
) = IPFeeDistributorV2(feeDistributorV2).claimProtocol(
address(this),
pools
);
if (totalAmountOut == 0) {
return;
}
IRewards(ePendleRewardPool).queueNewRewards{value: totalAmountOut}(
AddressLib.PLATFORM_TOKEN_ADDRESS,
totalAmountOut
);
emit FeesClaimed(pools, totalAmountOut, amountsOut);
}
function claimYTFeesToRecipient() external onlyRole(FEE_ADMIN_ROLE) {
address[] memory pools = new address[](1);
pools[0] = vePendle;
(
uint256 totalAmountOut,
uint256[] memory amountsOut
) = IPFeeDistributorV2(feeDistributorV2).claimProtocol(
address(this),
pools
);
if (totalAmountOut == 0) {
return;
}
TransferHelper.safeTransferETH(feeCollector, totalAmountOut);
emit YTFeesClaimedToRecipient(
feeCollector,
pools,
totalAmountOut,
amountsOut
);
}
function claimSwapFees(
address[] calldata _pools
) external onlyRole(FEE_ADMIN_ROLE) {
for (uint256 i = 0; i < _pools.length; i++) {
require(_pools[i] != vePendle, "cannot claim vePendle fees!");
}
(
uint256 totalAmountOut,
uint256[] memory amountsOut
) = IPFeeDistributorV2(feeDistributorV2).claimProtocol(
feeCollector,
_pools
);
emit FeesClaimed(_pools, totalAmountOut, amountsOut);
}
}
Read Contract
DEFAULT_ADMIN_ROLE 0xa217fddf → bytes32
FEE_ADMIN_ROLE 0x4cba593a → bytes32
VOTE_ADMIN_ROLE 0xa683f801 → bytes32
booster 0xc6def076 → address
depositor 0xc7c4ff46 → address
ePendleRewardPool 0x55d4c244 → address
feeCollector 0xc415b95c → address
feeDistributorV2 0xfbc4862b → address
getRoleAdmin 0x248a9ca3 → bytes32
hasRole 0x91d14854 → bool
isValidMarket 0x58e6309f → bool
paused 0x5c975abb → bool
pendle 0xa2c530da → address
pendleMarketFactory 0x57926c55 → address
pendleMarketFactoryV3 0x201a04a0 → address
pendleVotingController 0x57a3ff1c → address
supportsInterface 0x01ffc9a7 → bool
vePendle 0x82dabb21 → address
Write Contract 17 functions
These functions modify contract state and require a wallet transaction to execute.
claimRewards 0xef5cfb8c
address _market
returns: address[], uint256[]
claimRewardsManually 0x81e11bd0
address _market
uint256[] _amounts
returns: address[]
claimSwapFees 0x657554e8
address[] _pools
claimYTFees 0xee8cbc7c
No parameters
claimYTFeesToRecipient 0xb8239abc
No parameters
grantRole 0x2f2ff15d
bytes32 role
address account
initialize 0x8129fc1c
No parameters
lockPendle 0x6449612a
uint128 _expiry
pause 0x8456cb59
No parameters
renounceRole 0x36568abe
bytes32 role
address account
revokeRole 0xd547741f
bytes32 role
address account
setFeeCollector 0xa42dce80
address _feeCollector
setParams 0x498bc288
address _pendleMarketFactory
address _pendleVotingController
address _booster
address _depositor
address _ePendleRewardPool
address _feeDistributorV2
address _feeCollector
setPendleMarketFactoryV3 0xc65958af
address _pendleMarketFactoryV3
unpause 0x3f4ba83a
No parameters
vote 0x698766ee
address[] _pools
uint64[] _weights
withdraw 0xd9caed12
address _market
address _to
uint256 _amount
Recent Transactions
This address has 1 on-chain transactions, but only 0.6% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →