Address Contract Partially Verified
Address
0xE7C6BEEb41F6A9f2576A318cB0AADf8994dfa9f4
Balance
0 ETH
Nonce
1
Code Size
20195 bytes
Creator
0x2532C3D3...8154 at tx 0x576d29fa...a6239b
Indexed Transactions
0
Contract Bytecode
20195 bytes
0x6080604052600436106100bc5760003560e01c8063920f5c8411610074578063be450d811161004e578063be450d81146101eb578063f04f27071461020b578063f2fde38b1461022b57600080fd5b8063920f5c8414610162578063976322a814610192578063bda009fe146101b257600080fd5b8063715018a6116100a5578063715018a6146100f65780638da5cb5b1461010b57806391b3bc181461014257600080fd5b806306edfc63146100c157806355c69843146100d6575b600080fd5b6100d46100cf36600461392b565b61024b565b005b3480156100e257600080fd5b506100d46100f13660046139e4565b610332565b34801561010257600080fd5b506100d4610576565b34801561011757600080fd5b506000546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b34801561014e57600080fd5b506100d461015d366004613a89565b61058a565b34801561016e57600080fd5b5061018261017d366004613b40565b610836565b6040519015158152602001610139565b34801561019e57600080fd5b506100d46101ad366004613c45565b610ac3565b3480156101be57600080fd5b506101256101cd366004613cb3565b6001600160a01b039081166000908152600360205260409020541690565b3480156101f757600080fd5b506100d46102063660046139e4565b610c85565b34801561021757600080fd5b506100d4610226366004613ecd565b61117c565b34801561023757600080fd5b506100d4610246366004613cb3565b61137e565b610253611413565b828181146102745760405163149ec99560e11b815260040160405180910390fd5b60005b8181101561032a5783838281811061029157610291613fd8565b90506020020160208101906102a69190613cb3565b600360008888858181106102bc576102bc613fd8565b90506020020160208101906102d19190613cb3565b6001600160a01b039081168252602082019290925260400160002080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169290911691909117905561032381614004565b9050610277565b505050505050565b61033a61146d565b8760000361035b5760405163d2956cc160e01b815260040160405180910390fd5b8660000361037c5760405163d2956cc160e01b815260040160405180910390fd5b62015f90871061039f5760405163149ec99560e11b815260040160405180910390fd5b6001600160a01b0386166103c65760405163149ec99560e11b815260040160405180910390fd5b6001600160a01b0385166103ed5760405163149ec99560e11b815260040160405180910390fd5b6001600160a01b0384166104145760405163149ec99560e11b815260040160405180910390fd5b6040516370a0823160e01b815233600482015288906001600160a01b038716906370a0823190602401602060405180830381865afa15801561045a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047e919061401d565b10156104b6576040517f6f29d14100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6104cb6001600160a01b03861633308b6114c6565b610563604051806101200160405280336001600160a01b031681526020018a8152602001898152602001886001600160a01b03168152602001876001600160a01b03168152602001866001600160a01b0316815260200185600181111561053457610534614036565b815260200161054836869003860186614242565b815260200161055c36859003850185614242565b9052611577565b61056c60018055565b5050505050505050565b61057e611413565b6105886000611842565b565b61059261146d565b896000036105b35760405163d2956cc160e01b815260040160405180910390fd5b886000036105d45760405163d2956cc160e01b815260040160405180910390fd5b62015f9089106105f75760405163149ec99560e11b815260040160405180910390fd5b6001600160a01b03881661061e5760405163149ec99560e11b815260040160405180910390fd5b6001600160a01b0387166106455760405163149ec99560e11b815260040160405180910390fd5b6001600160a01b03861661066c5760405163149ec99560e11b815260040160405180910390fd5b6001600160a01b0385166106935760405163149ec99560e11b815260040160405180910390fd5b6040516370a0823160e01b81523360048201528a906001600160a01b038a16906370a0823190602401602060405180830381865afa1580156106d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106fd919061401d565b101561071c5760405163eab35a3560e01b815260040160405180910390fd5b6107316001600160a01b03891633308d6114c6565b604080516060810190915260009061078d908a908a908e9088600387835b8282101561077c5761076d610360830285013681900381019061428f565b8152602001906001019061074f565b5050505088610a20013560016118aa565b9050610820604051806101200160405280336001600160a01b031681526020018381526020018c8152602001896001600160a01b031681526020018a6001600160a01b03168152602001886001600160a01b031681526020018760018111156107f8576107f8614036565b815260200161080c36879003870187614242565b815260200161055c36869003860186614242565b5061082a60018055565b50505050505050505050565b60006001600160a01b03841630146108615760405163149ec99560e11b815260040160405180910390fd5b337387870bca3f3fd6335c3f4ce8392d69350b4fa4e2146108955760405163149ec99560e11b815260040160405180910390fd5b8887146108b55760405163149ec99560e11b815260040160405180910390fd5b8885146108d55760405163149ec99560e11b815260040160405180910390fd5b878760008181106108e8576108e8613fd8565b9050602002013560000361090f5760405163149ec99560e11b815260040160405180910390fd5b60008a8a828161092157610921613fd8565b90506020020160208101906109369190613cb3565b6001600160a01b03160361095d5760405163149ec99560e11b815260040160405180910390fd5b6109f88a8a600081811061097357610973613fd8565b90506020020160208101906109889190613cb3565b8989600081811061099b5761099b613fd8565b90506020020135888860008181106109b5576109b5613fd8565b9050602002013586868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506119e892505050565b610a4a7387870bca3f3fd6335c3f4ce8392d69350b4fa4e260008c8c6000818110610a2557610a25613fd8565b9050602002016020810190610a3a9190613cb3565b6001600160a01b03169190611a7a565b610ab37387870bca3f3fd6335c3f4ce8392d69350b4fa4e287876000818110610a7557610a75613fd8565b905060200201358a8a6000818110610a8f57610a8f613fd8565b90506020020135610aa091906142ac565b8c8c6000818110610a2557610a25613fd8565b5060019998505050505050505050565b610acb61146d565b85600003610aec5760405163d2956cc160e01b815260040160405180910390fd5b6001600160a01b038416610b135760405163149ec99560e11b815260040160405180910390fd5b6001600160a01b038316610b3a5760405163149ec99560e11b815260040160405180910390fd5b6001600160a01b038216610b615760405163149ec99560e11b815260040160405180910390fd5b6040516370a0823160e01b815233600482015286906001600160a01b038616906370a0823190602401602060405180830381865afa158015610ba7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bcb919061401d565b1015610bea5760405163eab35a3560e01b815260040160405180910390fd5b610bff6001600160a01b0385163330896114c6565b6040805160608101909152600090610c5b90869086908a9086600387835b82821015610c4a57610c3b610360830285013681900381019061428f565b81526020019060010190610c1d565b5050505086610a20013560016118aa565b9050610c6984848333611bcd565b8515610c7b57610c7b83873333611c6e565b5061032a60018055565b610c8d61146d565b87600003610cae5760405163d2956cc160e01b815260040160405180910390fd5b86600003610ccf5760405163d2956cc160e01b815260040160405180910390fd5b6001600160a01b038616610cf65760405163149ec99560e11b815260040160405180910390fd5b6001600160a01b038516610d1d5760405163149ec99560e11b815260040160405180910390fd5b6001600160a01b038416610d445760405163149ec99560e11b815260040160405180910390fd5b604080516001808252818301909252600091602080830190803683375050815191925050610320830135908290600090610d8057610d80613fd8565b60200260200101818152505080600081518110610d9f57610d9f613fd8565b6020026020010151600003610dcf578881600081518110610dc257610dc2613fd8565b6020026020010181815250505b6000808a3389898888604051602001610dee9796959493929190614412565b60408051601f1981840301815291905290506000856001811115610e1457610e14614036565b03610f285760408051600180825281830190925260009160208083019080368337019050509050600081600081518110610e5057610e50613fd8565b60209081029190910101526040805160018082528183019092526000918160200160208202803683370190505090508981600081518110610e9357610e93613fd8565b6001600160a01b039092166020928302919091019091015260405163ab9c4b5d60e01b81527387870bca3f3fd6335c3f4ce8392d69350b4fa4e29063ab9c4b5d90610eef90309085908990889084908b906000906004016144f4565b600060405180830381600087803b158015610f0957600080fd5b505af1158015610f1d573d6000803e3d6000fd5b50505050505061100e565b600254600114610f4b5760405163149ec99560e11b815260040160405180910390fd5b604080516001808252818301909252600091602080830190803683370190505090508881600081518110610f8157610f81613fd8565b6001600160a01b039092166020928302919091019091015260028055604051632e1c224f60e11b815273ba12222222228d8ba445958a75a0704d566bf2c890635c38449e90610fda9030908590889088906004016145a3565b600060405180830381600087803b158015610ff457600080fd5b505af1158015611008573d6000803e3d6000fd5b50505050505b6040516370a0823160e01b81523060048201526110ce90899089906001600160a01b038316906370a0823190602401602060405180830381865afa15801561105a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061107e919061401d565b60408051606081019091528860036000835b828210156110bd576110ae610360830285013681900381019061428f565b81526020019060010190611090565b5050505088611440013560006118aa565b506040516370a0823160e01b81523060048201526000906001600160a01b038916906370a0823190602401602060405180830381865afa158015611116573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113a919061401d565b90508981111561115c5761115988886111538d8561461b565b33611bcd565b50885b6111706001600160a01b0389163383611eb1565b50505061056c60018055565b3373ba12222222228d8ba445958a75a0704d566bf2c8146111b05760405163149ec99560e11b815260040160405180910390fd5b6002546002146111d35760405163149ec99560e11b815260040160405180910390fd5b82518451146111f55760405163149ec99560e11b815260040160405180910390fd5b81518451146112175760405163149ec99560e11b815260040160405180910390fd5b8260008151811061122a5761122a613fd8565b60200260200101516000036112525760405163149ec99560e11b815260040160405180910390fd5b60006001600160a01b03168460008151811061127057611270613fd8565b60200260200101516001600160a01b03160361129f5760405163149ec99560e11b815260040160405180910390fd5b6001600281905550611301846000815181106112bd576112bd613fd8565b6020026020010151846000815181106112d8576112d8613fd8565b6020026020010151846000815181106112f3576112f3613fd8565b6020026020010151846119e8565b611378338360008151811061131857611318613fd8565b60200260200101518560008151811061133357611333613fd8565b602002602001015161134591906142ac565b8660008151811061135857611358613fd8565b60200260200101516001600160a01b0316611eb19092919063ffffffff16565b50505050565b611386611413565b6001600160a01b0381166114075760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61141081611842565b50565b6000546001600160a01b031633146105885760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016113fe565b6002600154036114bf5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016113fe565b6002600155565b6040516001600160a01b03808516602483015283166044820152606481018290526113789085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611efa565b6000612710826040015161271061158e91906142ac565b836020015161159d919061462e565b6115a79190614645565b90506000600182846000015185608001518660a001518760e001518861010001516040516020016115de97969594939291906147a0565b60408051601f1981840301815260018084528383019092529250600091906020808301908036833750505060e0850151515160c00151815191925090829060009061162b5761162b613fd8565b602090810291909101015260008460c00151600181111561164e5761164e614036565b03611745576040805160018082528183019092526000916020808301908036833750506040805160018082528183019092529293506000929150602080830190803683370190505090508560600151816000815181106116b0576116b0613fd8565b6001600160a01b039092166020928302919091019091015260405163ab9c4b5d60e01b81527387870bca3f3fd6335c3f4ce8392d69350b4fa4e29063ab9c4b5d9061170c90309085908890889084908c906000906004016144f4565b600060405180830381600087803b15801561172657600080fd5b505af115801561173a573d6000803e3d6000fd5b505050505050611834565b6002546001146117685760405163149ec99560e11b815260040160405180910390fd5b604080516001808252818301909252600091602080830190803683370190505090508460600151816000815181106117a2576117a2613fd8565b6001600160a01b039092166020928302919091019091015260028055604051632e1c224f60e11b815273ba12222222228d8ba445958a75a0704d566bf2c890635c38449e906117fb9030908590879089906004016145a3565b600060405180830381600087803b15801561181557600080fd5b505af1158015611829573d6000803e3d6000fd5b505060016002555050505b611378846060015185611fe2565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000826000036118cd5760405163149ec99560e11b815260040160405180910390fd5b8351608001516001600160a01b038881169116146118fe5760405163149ec99560e11b815260040160405180910390fd5b6001600160a01b0386168461191460018661461b565b6003811061192457611924613fd8565b602002015160a001516001600160a01b0316146119545760405163149ec99560e11b815260040160405180910390fd5b8460008190036119685760009150506119de565b60005b848110156119da57600086826003811061198757611987613fd8565b60200201516040015160058111156119a1576119a1614036565b146119ca576119c7828783600381106119bc576119bc613fd8565b602002015186612169565b91505b6119d381614004565b905061196b565b5090505b9695505050505050565b6000818060200190518101906119fe9190614a14565b90508060200151600003611a255760405163149ec99560e11b815260040160405180910390fd5b60408101516001600160a01b0316611a505760405163149ec99560e11b815260040160405180910390fd5b805115611a6857611a6385858584612391565b611a73565b611a738585836128fb565b5050505050565b801580611b0d57506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015611ae7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b0b919061401d565b155b611b7f5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e63650000000000000000000060648201526084016113fe565b6040516001600160a01b038316602482015260448101829052611bc89084907f095ea7b30000000000000000000000000000000000000000000000000000000090606401611513565b505050565b611be26001600160a01b038516846000611a7a565b611bf66001600160a01b0385168484611a7a565b6040517fcadac479000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b03828116602483015284169063cadac479906044015b600060405180830381600087803b158015611c5a57600080fd5b505af115801561056c573d6000803e3d6000fd5b6001600160a01b0384811660009081526003602052604090205416611da6576040517f27c151dc000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b0383811660248301528516906327c151dc906044016020604051808303816000875af1158015611cf5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d19919061401d565b506001600160a01b0381163014611da157611da18184866001600160a01b03166338d52e0f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d919190614ac7565b6001600160a01b03169190611eb1565b611378565b6001600160a01b0380851660008181526003602090815260408083205481517fc6e1c7c90000000000000000000000000000000000000000000000000000000081529151951694631fb72471948a948a949093919263c6e1c7c99260048082019392918290030181865afa158015611e22573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e469190614ac7565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e087901b1681526001600160a01b0394851660048201526024810193909352604483019190915282166064820152818616608482015290841660a482015260c401611c40565b6040516001600160a01b038316602482015260448101829052611bc89084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611513565b6000611f4f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612f1a9092919063ffffffff16565b9050805160001480611f70575080806020019051810190611f709190614ae4565b611bc85760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016113fe565b60008160a001516001600160a01b03166338d52e0f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612026573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061204a9190614ac7565b9050826001600160a01b0316816001600160a01b03160361206a57505050565b6040516370a0823160e01b81523060048201526120ef90849083906001600160a01b038316906370a0823190602401602060405180830381865afa1580156120b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120da919061401d565b610100860151805160409091015160006118aa565b5060a08201516040516370a0823160e01b8152306004820152611bc891906001600160a01b038416906370a0823190602401602060405180830381865afa15801561213e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612162919061401d565b8451612f31565b600060028360400151600581111561218357612183614036565b111561219b5761219484848461317c565b905061238a565b6002836040015160058111156121b3576121b3614036565b0361229557816121d65760405163149ec99560e11b815260040160405180910390fd5b60808301516040517fe63697c800000000000000000000000000000000000000000000000000000000815260048101869052306024820152600160448201526000916001600160a01b03169063e63697c8906064016020604051808303816000875af115801561224a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061226e919061401d565b90508360e0015181101561219457604051635bbdee4760e11b815260040160405180910390fd5b608083015160a08401516122b46001600160a01b038316826000611a7a565b6122c86001600160a01b0383168288611a7a565b6040517f6e553f65000000000000000000000000000000000000000000000000000000008152600481018790523060248201526000906001600160a01b03831690636e553f65906044016020604051808303816000875af1158015612331573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612355919061401d565b905084801561236757508560e0015181105b1561238557604051635bbdee4760e11b815260040160405180910390fd5b925050505b9392505050565b6123b4848260600151858460a00151600001518560a001516040015160016118aa565b5060608101516040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015612400573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612424919061401d565b9050816020015181101561244b5760405163eab35a3560e01b815260040160405180910390fd5b61246382606001518360800151838560400151611bcd565b600082608001519050856001600160a01b0316816001600160a01b03166338d52e0f6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156124b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124d89190614ac7565b6001600160a01b031603612509576080830151612504906124f986886142ac565b856040015130611c6e565b61032a565b600080826001600160a01b0316639a295e736040518163ffffffff1660e01b815260040161010060405180830381865afa15801561254b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061256f9190614aff565b5050604051631c6c959760e01b81526000600482015295975090955050506001600160a01b03861692631c6c959792506024019050610180604051808303816000875af11580156125c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125e89190614c06565b5050505050506000836001600160a01b03166302ce728f6040518163ffffffff1660e01b81526004016060604051808303816000875af1158015612630573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126549190614cc0565b6040808a01519051634fd422df60e01b81526001600160a01b0391821660048201529194506000935087169150634fd422df90602401602060405180830381865afa1580156126a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126cb919061401d565b604051637ec4b57160e01b815260048101829052600160248201526000604482018190529192506001600160a01b03871690637ec4b57190606401602060405180830381865afa158015612723573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612747919061401d565b6040808a01519051635ad7983160e11b81526001600160a01b0391821660048201529192506000919088169063b5af306290602401602060405180830381865afa158015612799573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127bd919061401d565b9050818685896001600160a01b031663f384bd056040518163ffffffff1660e01b8152600401602060405180830381865afa158015612800573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612824919061401d565b61282e898661462e565b612838919061462e565b6128429190614645565b61284c9190614645565b612856919061461b565b915061286c8960800151838b6040015130611c6e565b6128ec876001600160a01b03166338d52e0f6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156128ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128d19190614ac7565b8d848c60c00151602001518d60c001516040015160016118aa565b50505050505050505050505050565b6000816080015190506000816001600160a01b03166338d52e0f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612944573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129689190614ac7565b9050846001600160a01b0316816001600160a01b03160361299b576129968360800151858560400151612f31565b612a93565b6129ba8582868660c00151600001518760c001516040015160016118aa565b506040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015612a02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a26919061401d565b90508360200151811015612a4d5760405163147d3ce960e31b815260040160405180910390fd5b612a64846080015185602001518660400151612f31565b612a908287866020015184612a79919061461b565b60c0880151602081015160409091015160006118aa565b50505b816001600160a01b031663c6e1c7c96040518163ffffffff1660e01b8152600401602060405180830381865afa158015612ad1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612af59190614ac7565b6001600160a01b031683606001516001600160a01b031614612b2a5760405163149ec99560e11b815260040160405180910390fd5b600080836001600160a01b0316639a295e736040518163ffffffff1660e01b815260040161010060405180830381865afa158015612b6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b909190614aff565b5050604051631c6c959760e01b81526000600482015295975090955050506001600160a01b03871692631c6c959792506024019050610180604051808303816000875af1158015612be5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c099190614c06565b5050505050506000846001600160a01b03166302ce728f6040518163ffffffff1660e01b81526004016060604051808303816000875af1158015612c51573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c759190614cc0565b6040808a01519051634fd422df60e01b81526001600160a01b0391821660048201529194506000935088169150634fd422df90602401602060405180830381865afa158015612cc8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cec919061401d565b604051637ec4b57160e01b815260048101829052600160248201526000604482018190529192506001600160a01b03881690637ec4b57190606401602060405180830381865afa158015612d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d68919061401d565b6040808a01519051635ad7983160e11b81526001600160a01b0391821660048201529192506000919089169063b5af306290602401602060405180830381865afa158015612dba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dde919061401d565b90506000886001600160a01b031663f384bd056040518163ffffffff1660e01b8152600401602060405180830381865afa158015612e20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e44919061401d565b8688612e50888761462e565b612e5a919061462e565b612e649190614645565b612e6e9190614645565b612e78908361461b565b9050612e8f818b6080015160008d604001516136fb565b60608a01516040516370a0823160e01b81523060048201526128ec91908e906001600160a01b038316906370a0823190602401602060405180830381865afa158015612edf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f03919061401d565b60a08e0151602081015160409091015160016118aa565b6060612f29848460008561374f565b949350505050565b6000836001600160a01b03166338d52e0f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612f71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f959190614ac7565b604051631c6c959760e01b8152600060048201529091506001600160a01b03851690631c6c959790602401610180604051808303816000875af1158015612fe0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130049190614c06565b50506040517f93f46f64000000000000000000000000000000000000000000000000000000008152600481018890526000602482018190526044820181905294506001600160a01b03891693506393f46f6492506064019050602060405180830381865afa15801561307a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061309e919061401d565b90506130b56001600160a01b038316866000611a7a565b6130c96001600160a01b0383168686611a7a565b6040517f3d417d2d000000000000000000000000000000000000000000000000000000008152600481018290526001600160a01b03848116602483015260009190871690633d417d2d906044016020604051808303816000875af1158015613135573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613159919061401d565b90508060000361032a5760405163147d3ce960e31b815260040160405180910390fd5b60608201516000908183613191576000613197565b8460e001515b9050816000036131ba5760405163149ec99560e11b815260040160405180910390fd5b6004856040015160058111156131d2576131d2614036565b036134265760408051808201909152606080825260208201526131f68360016142ac565b67ffffffffffffffff81111561320e5761320e613cd0565b604051908082528060200260200182016040528015613237578160200160208202803683370190505b5081528267ffffffffffffffff81111561325357613253613cd0565b60405190808252806020026020018201604052801561327c578160200160208202803683370190505b50602082015260005b8381101561332e57865161329a82600261462e565b600981106132aa576132aa613fd8565b602002015182518051839081106132c3576132c3613fd8565b6001600160a01b0390921660209283029190910182015287015181600481106132ee576132ee613fd8565b60200201516000602002015160001b8260200151828151811061331357613313613fd8565b602090810291909101015261332781614004565b9050613285565b50855161333c84600261462e565b6009811061334c5761334c613fd8565b6020020151815180518590811061336557613365613fd8565b6001600160a01b0390921660209283029190910190910152608086015160a08701516040517fbcef490300000000000000000000000000000000000000000000000000000000815273dad951530ef3a823d835ef34367a96f5b9077cdb9263bcef4903926133db928c9087908990600401614d2e565b602060405180830381865af41580156133f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061341c919061401d565b935050505061238a565b60038560400151600581111561343e5761343e614036565b036136445760408051808201909152606080825260208201526134628360016142ac565b67ffffffffffffffff81111561347a5761347a613cd0565b6040519080825280602002602001820160405280156134a3578160200160208202803683370190505b5081528267ffffffffffffffff8111156134bf576134bf613cd0565b6040519080825280602002602001820160405280156134e8578160200160208202803683370190505b50602082015260005b8381101561359757865161350682600261462e565b6009811061351657613516613fd8565b6020020151825180518390811061352f5761352f613fd8565b6001600160a01b03909216602092830291909101820152870151816004811061355a5761355a613fd8565b6020020151600060200201518260200151828151811061357c5761357c613fd8565b602090810291909101015261359081614004565b90506134f1565b5085516135a584600261462e565b600981106135b5576135b5613fd8565b602002015181518051859081106135ce576135ce613fd8565b6001600160a01b0390921660209283029190910190910152608086015160a08701516040517fc049b35200000000000000000000000000000000000000000000000000000000815273d23bfa060c2dcb70d4aeb78ebd2ee9a172cf58189263c049b352926133db928c9087908990600401614d2e565b608085015160a0860151604080518082018252885181526020808a01519082015290517f3bda630b000000000000000000000000000000000000000000000000000000008152734827b1bb7fac4bef01273cde0abab695c32402a793633bda630b936136ba93919290918c918890600401614dc4565b602060405180830381865af41580156136d7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612385919061401d565b6040517f59508a10000000000000000000000000000000000000000000000000000000008152600481018590523060248201526001600160a01b0382811660448301528416906359508a1090606401611c40565b6060824710156137c75760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016113fe565b600080866001600160a01b031685876040516137e39190614e7e565b60006040518083038185875af1925050503d8060008114613820576040519150601f19603f3d011682016040523d82523d6000602084013e613825565b606091505b509150915061383687838387613841565b979650505050505050565b606083156138b05782516000036138a9576001600160a01b0385163b6138a95760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016113fe565b5081612f29565b612f2983838151156138c55781518083602001fd5b8060405162461bcd60e51b81526004016113fe9190614e9a565b60008083601f8401126138f157600080fd5b50813567ffffffffffffffff81111561390957600080fd5b6020830191508360208260051b850101111561392457600080fd5b9250929050565b6000806000806040858703121561394157600080fd5b843567ffffffffffffffff8082111561395957600080fd5b613965888389016138df565b9096509450602087013591508082111561397e57600080fd5b5061398b878288016138df565b95989497509550505050565b6001600160a01b038116811461141057600080fd5b80356139b781613997565b919050565b8035600281106139b757600080fd5b600061146082840312156139de57600080fd5b50919050565b600080600080600080600080612980898b031215613a0157600080fd5b88359750602089013596506040890135613a1a81613997565b95506060890135613a2a81613997565b94506080890135613a3a81613997565b9350613a4860a08a016139bc565b9250613a578a60c08b016139cb565b9150613a678a6115208b016139cb565b90509295985092959890939650565b6000610a4082840312156139de57600080fd5b6000806000806000806000806000806133e08b8d031215613aa957600080fd5b8a35995060208b0135985060408b0135613ac281613997565b975060608b0135613ad281613997565b965060808b0135613ae281613997565b955060a08b0135613af281613997565b9450613b0060c08c016139bc565b9350613b0f8c60e08d01613a76565b9250613b1f8c610b208d016139cb565b9150613b2f8c611f808d016139cb565b90509295989b9194979a5092959850565b600080600080600080600080600060a08a8c031215613b5e57600080fd5b893567ffffffffffffffff80821115613b7657600080fd5b613b828d838e016138df565b909b50995060208c0135915080821115613b9b57600080fd5b613ba78d838e016138df565b909950975060408c0135915080821115613bc057600080fd5b613bcc8d838e016138df565b909750955060608c01359150613be182613997565b90935060808b01359080821115613bf757600080fd5b818c0191508c601f830112613c0b57600080fd5b813581811115613c1a57600080fd5b8d6020828501011115613c2c57600080fd5b6020830194508093505050509295985092959850929598565b600080600080600080610ae08789031215613c5f57600080fd5b86359550602087013594506040870135613c7881613997565b93506060870135613c8881613997565b92506080870135613c9881613997565b9150613ca78860a08901613a76565b90509295509295509295565b600060208284031215613cc557600080fd5b813561238a81613997565b634e487b7160e01b600052604160045260246000fd5b604051610100810167ffffffffffffffff81118282101715613d0a57613d0a613cd0565b60405290565b6040516060810167ffffffffffffffff81118282101715613d0a57613d0a613cd0565b60405160a0810167ffffffffffffffff81118282101715613d0a57613d0a613cd0565b604051610120810167ffffffffffffffff81118282101715613d0a57613d0a613cd0565b6040516080810167ffffffffffffffff81118282101715613d0a57613d0a613cd0565b604051601f8201601f1916810167ffffffffffffffff81118282101715613dc657613dc6613cd0565b604052919050565b600067ffffffffffffffff821115613de857613de8613cd0565b5060051b60200190565b600082601f830112613e0357600080fd5b81356020613e18613e1383613dce565b613d9d565b82815260059290921b84018101918181019086841115613e3757600080fd5b8286015b84811015613e525780358352918301918301613e3b565b509695505050505050565b600082601f830112613e6e57600080fd5b813567ffffffffffffffff811115613e8857613e88613cd0565b613e9b601f8201601f1916602001613d9d565b818152846020838601011115613eb057600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215613ee357600080fd5b843567ffffffffffffffff80821115613efb57600080fd5b818701915087601f830112613f0f57600080fd5b81356020613f1f613e1383613dce565b82815260059290921b8401810191818101908b841115613f3e57600080fd5b948201945b83861015613f65578535613f5681613997565b82529482019490820190613f43565b98505088013592505080821115613f7b57600080fd5b613f8788838901613df2565b94506040870135915080821115613f9d57600080fd5b613fa988838901613df2565b93506060870135915080821115613fbf57600080fd5b50613fcc87828801613e5d565b91505092959194509250565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161401657614016613fee565b5060010190565b60006020828403121561402f57600080fd5b5051919050565b634e487b7160e01b600052602160045260246000fd5b600082601f83011261405d57600080fd5b614065613d56565b8061012084018581111561407857600080fd5b845b8181101561409b57803561408d81613997565b84526020938401930161407a565b509095945050505050565b6000601f83818401126140b857600080fd5b6140c0613d7a565b806101808501868111156140d357600080fd5b855b818110156141345787858201126140ec5760008081fd5b6140f4613d10565b80606083018a8111156141075760008081fd5b835b81811015614121578035845260209384019301614109565b50508552506020909301926060016140d5565b50909695505050505050565b6006811061141057600080fd5b80356139b781614140565b6000610360828403121561416b57600080fd5b614173613ce6565b905061417f838361404c565b815261418f8361012084016140a6565b60208201526141a16102a0830161414d565b60408201526102c082013560608201526141be6102e083016139ac565b60808201526141d061030083016139ac565b60a082015261032082013560c082015261034082013560e082015292915050565b600082601f83011261420257600080fd5b61420a613d10565b80610a2084018581111561421d57600080fd5b845b8181101561409b576142318782614158565b84526020909301926103600161421f565b6000611460828403121561425557600080fd5b61425d613d10565b61426784846141f1565b815261427784610a2085016141f1565b60208201526114409290920135604083015250919050565b600061036082840312156142a257600080fd5b61238a8383614158565b808201808211156142bf576142bf613fee565b92915050565b8060005b6004811015611378576060808386379384019391909101906001016142c9565b6006811061430757634e487b7160e01b600052602160045260246000fd5b9052565b806000805b6003811015611a73578483835b600981101561434f57813561433181613997565b6001600160a01b03168352602092830192919091019060010161431d565b5050506101206143638187018286016142c5565b506102a061437281850161414d565b61437e828801826142e9565b50506102c083810135908601526102e06143998185016139ac565b6001600160a01b0316908601526103006143b48482016139ac565b6001600160a01b031690860152610320838101359086015261034080840135908601526103609485019490920191600101614310565b6143f4828261430b565b610a2061440581840182840161430b565b5061144090810135910152565b8715158152602081018790526001600160a01b038681166040830152858116606083015284166080820152612960810161444f60a08301856143ea565b61445d6115008301846143ea565b98975050505050505050565b600081518084526020808501945080840160005b838110156144995781518752958201959082019060010161447d565b509495945050505050565b60005b838110156144bf5781810151838201526020016144a7565b50506000910152565b600081518084526144e08160208601602086016144a4565b601f01601f19169290920160200192915050565b600060e082016001600160a01b03808b168452602060e081860152828b5180855261010087019150828d01945060005b81811015614542578551851683529483019491830191600101614524565b50508581036040870152614556818c614469565b9350505050828103606084015261456d8188614469565b6001600160a01b0387166080850152905082810360a084015261459081866144c8565b91505061445d60c083018461ffff169052565b6000608082016001600160a01b038088168452602060808186015282885180855260a087019150828a01945060005b818110156145f05785518516835294830194918301916001016145d2565b505085810360408701526146048189614469565b9350505050828103606084015261383681856144c8565b818103818111156142bf576142bf613fee565b80820281158282048414176142bf576142bf613fee565b60008261466257634e487b7160e01b600052601260045260246000fd5b500490565b806000805b6004811015611a7357825185835b600381101561469957825182526020928301929091019060010161467a565b505050606094909401936020929092019160010161466c565b806000805b6003811015611a73578251805186845b60098110156146ef5782516001600160a01b03168252602092830192909101906001016146c7565b505050602080820151614706610120890182614667565b50604082015161471a6102a08901826142e9565b5060608201516102c088015260808201516001600160a01b039081166102e089015260a08301511661030088015260c082015161032088015260e0909101516103408701526103609095019492909201916001016146b7565b61477e8282516146b2565b6020810151614791610a208401826146b2565b50604001516114409190910152565b8715158152602081018790526001600160a01b03868116604083015285811660608301528416608082015261296081016147dd60a0830185614773565b61445d611500830184614773565b805180151581146139b757600080fd5b80516139b781613997565b600082601f83011261481757600080fd5b61481f613d56565b8061012084018581111561483257600080fd5b845b8181101561409b57805161484781613997565b845260209384019301614834565b6000601f838184011261486757600080fd5b61486f613d7a565b8061018085018681111561488257600080fd5b855b8181101561413457878582011261489b5760008081fd5b6148a3613d10565b80606083018a8111156148b65760008081fd5b835b818110156148d05780518452602093840193016148b8565b5050855250602090930192606001614884565b80516139b781614140565b600082601f8301126148ff57600080fd5b614907613d10565b80610a2084018581111561491a57600080fd5b845b8181101561409b5761036081880312156149365760008081fd5b61493e613ce6565b6149488883614806565b8152614958886101208401614855565b6020818184015261496c6102a085016148e3565b60408401526102c084015160608401526149896102e085016147fb565b608084015261499b61030085016147fb565b60a084015261032084015160c084015261034084015160e084015291865250909301926103600161491c565b600061146082840312156149da57600080fd5b6149e2613d10565b90506149ee83836148ee565b81526149fe83610a2084016148ee565b6020820152611440820151604082015292915050565b60006129608284031215614a2757600080fd5b60405160e0810181811067ffffffffffffffff82111715614a4a57614a4a613cd0565b604052614a56836147eb565b8152602083015160208201526040830151614a7081613997565b60408201526060830151614a8381613997565b60608201526080830151614a9681613997565b6080820152614aa88460a085016149c7565b60a0820152614abb8461150085016149c7565b60c08201529392505050565b600060208284031215614ad957600080fd5b815161238a81613997565b600060208284031215614af657600080fd5b61238a826147eb565b600080600080600080600080610100898b031215614b1c57600080fd5b505086516020880151604089015160608a015160808b015160a08c015160c08d015160e0909d0151959e949d50929b919a50985090965094509092509050565b805163ffffffff811681146139b757600080fd5b805167ffffffffffffffff811681146139b757600080fd5b80516fffffffffffffffffffffffffffffffff811681146139b757600080fd5b600060408284031215614bba57600080fd5b6040516040810181811067ffffffffffffffff82111715614bdd57614bdd613cd0565b604052905080614bec83614b88565b8152614bfa60208401614b88565b60208201525092915050565b600080600080600080868803610180811215614c2157600080fd5b87519650602088015195506040880151945060a0605f1982011215614c4557600080fd5b50614c4e613d33565b614c5a60608901614b5c565b8152614c6860808901614b5c565b6020820152614c7960a08901614b70565b6040820152614c8a60c08901614b70565b6060820152614c9b60e08901614b70565b60808201529250614cb0886101008901614ba8565b9150613ca7886101408901614ba8565b600080600060608486031215614cd557600080fd5b614cde846147eb565b925060208401519150604084015190509250925092565b600081518084526020808501945080840160005b838110156144995781516001600160a01b031687529582019590820190600101614d09565b60006001600160a01b03808816835260208188168185015286604085015260a0606085015285519150604060a0850152614d6b60e0850183614cf5565b86820151858203609f190160c0870152805180835290830193506000918301905b80831015614dac5784518252938301936001929092019190830190614d8c565b50809450505050508260808301529695505050505050565b6001600160a01b038681168252858116602080840191909152604083018690528451610320840192919060609060008287015b6009821015614e185782518616815291840191600191909101908401614df7565b505050818701519250610180850160005b6004811015614e685784518260005b6003811015614e5557825182529186019190860190600101614e38565b5050509383019390820190600101614e29565b5050505050826103008301529695505050505050565b60008251614e908184602087016144a4565b9190910192915050565b60208152600061238a60208301846144c856fea2646970667358221220e439201ac872947ac76055980bc2c2900d5ac0b79d604006a604f305ee5aa23d64736f6c63430008150033
Verified Source Code Partial Match
Compiler: v0.8.21+commit.d9974bed
EVM: paris
Optimization: Yes (1660 runs)
CrvYearnVaultLeverage.sol 3738 lines
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.21;
// OpenZeppelin Contracts v4.4.1 (utils/Context.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 Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
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);
}
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
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);
}
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)
/**
* @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);
}
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
/**
* @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);
}
}
}
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));
}
}
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}
interface IBaseLeverage {
enum FlashLoanType {
AAVE,
BALANCER
}
enum SwapType {
NONE,
DEPOSIT,
WITHDRAW,
UNISWAP,
BALANCER,
CURVE
}
struct MultipSwapPath {
address[9] routes;
uint256[3][4] routeParams;
// uniswap/balancer/curve
SwapType swapType;
uint256 poolCount;
address swapFrom;
address swapTo;
uint256 inAmount;
uint256 outAmount;
}
struct BiDirectSwapInfo {
MultipSwapPath[3] paths;
MultipSwapPath[3] reversePaths;
uint256 pathLength;
}
struct UniDirectSwapInfo {
MultipSwapPath[3] paths;
uint256 pathLength;
}
struct FlashLoanParams {
bool isEnterPosition;
uint256 minRequiredAmount;
address user;
address collateralAsset;
address silo;
BiDirectSwapInfo borrowAssetAndCollateral;
BiDirectSwapInfo borrowAssetAndSiloAsset;
}
struct LeverageParams {
address user;
uint256 principal;
uint256 leverage;
address borrowAsset;
address collateralAsset;
address silo;
FlashLoanType flashLoanType;
BiDirectSwapInfo borrowAssetAndCollateral;
BiDirectSwapInfo borrowAssetAndSiloAsset;
}
function enterPositionWithFlashloan(
uint256 _principal,
uint256 _leverage,
address _borrowAsset,
address _collateralAsset,
address _silo,
FlashLoanType _flashLoanType,
BiDirectSwapInfo calldata _borrowAssetAndCollateral,
BiDirectSwapInfo calldata _borrowAssetAndSiloAsset
) external;
function withdrawWithFlashloan(
uint256 _repayAmount,
uint256 _requiredAmount,
address _borrowAsset,
address _collateralAsset,
address _silo,
FlashLoanType _flashLoanType,
BiDirectSwapInfo calldata _borrowAssetAndSiloAsset,
BiDirectSwapInfo calldata _borrowAssetAndCollateral
) external;
}
interface IFlashLoanReceiver {
function executeOperation(
address[] calldata assets,
uint256[] calldata amounts,
uint256[] calldata premiums,
address initiator,
bytes calldata params
) external returns (bool);
}
interface IFlashLoanRecipient {
/**
* @dev When `flashLoan` is called on the Vault, it invokes the `receiveFlashLoan` hook on the recipient.
*
* At the time of the call, the Vault will have transferred `amounts` for `tokens` to the recipient. Before this
* call returns, the recipient must have transferred `amounts` plus `feeAmounts` for each token back to the
* Vault, or else the entire flash loan will revert.
*
* `userData` is the same value passed in the `IVault.flashLoan` call.
*/
function receiveFlashLoan(
IERC20[] memory tokens,
uint256[] memory amounts,
uint256[] memory feeAmounts,
bytes memory userData
) external;
}
interface IPoolAddressesProvider {
/**
* @dev Emitted when the market identifier is updated.
* @param oldMarketId The old id of the market
* @param newMarketId The new id of the market
*/
event MarketIdSet(string indexed oldMarketId, string indexed newMarketId);
/**
* @dev Emitted when the pool is updated.
* @param oldAddress The old address of the Pool
* @param newAddress The new address of the Pool
*/
event PoolUpdated(address indexed oldAddress, address indexed newAddress);
/**
* @dev Emitted when the pool configurator is updated.
* @param oldAddress The old address of the PoolConfigurator
* @param newAddress The new address of the PoolConfigurator
*/
event PoolConfiguratorUpdated(
address indexed oldAddress,
address indexed newAddress
);
/**
* @dev Emitted when the price oracle is updated.
* @param oldAddress The old address of the PriceOracle
* @param newAddress The new address of the PriceOracle
*/
event PriceOracleUpdated(
address indexed oldAddress,
address indexed newAddress
);
/**
* @dev Emitted when the ACL manager is updated.
* @param oldAddress The old address of the ACLManager
* @param newAddress The new address of the ACLManager
*/
event ACLManagerUpdated(
address indexed oldAddress,
address indexed newAddress
);
/**
* @dev Emitted when the ACL admin is updated.
* @param oldAddress The old address of the ACLAdmin
* @param newAddress The new address of the ACLAdmin
*/
event ACLAdminUpdated(
address indexed oldAddress,
address indexed newAddress
);
/**
* @dev Emitted when the price oracle sentinel is updated.
* @param oldAddress The old address of the PriceOracleSentinel
* @param newAddress The new address of the PriceOracleSentinel
*/
event PriceOracleSentinelUpdated(
address indexed oldAddress,
address indexed newAddress
);
/**
* @dev Emitted when the pool data provider is updated.
* @param oldAddress The old address of the PoolDataProvider
* @param newAddress The new address of the PoolDataProvider
*/
event PoolDataProviderUpdated(
address indexed oldAddress,
address indexed newAddress
);
/**
* @dev Emitted when a new proxy is created.
* @param id The identifier of the proxy
* @param proxyAddress The address of the created proxy contract
* @param implementationAddress The address of the implementation contract
*/
event ProxyCreated(
bytes32 indexed id,
address indexed proxyAddress,
address indexed implementationAddress
);
/**
* @dev Emitted when a new non-proxied contract address is registered.
* @param id The identifier of the contract
* @param oldAddress The address of the old contract
* @param newAddress The address of the new contract
*/
event AddressSet(
bytes32 indexed id,
address indexed oldAddress,
address indexed newAddress
);
/**
* @dev Emitted when the implementation of the proxy registered with id is updated
* @param id The identifier of the contract
* @param proxyAddress The address of the proxy contract
* @param oldImplementationAddress The address of the old implementation contract
* @param newImplementationAddress The address of the new implementation contract
*/
event AddressSetAsProxy(
bytes32 indexed id,
address indexed proxyAddress,
address oldImplementationAddress,
address indexed newImplementationAddress
);
/**
* @notice Returns the id of the Aave market to which this contract points to.
* @return The market id
**/
function getMarketId() external view returns (string memory);
/**
* @notice Associates an id with a specific PoolAddressesProvider.
* @dev This can be used to create an onchain registry of PoolAddressesProviders to
* identify and validate multiple Aave markets.
* @param newMarketId The market id
*/
function setMarketId(string calldata newMarketId) external;
/**
* @notice Returns an address by its identifier.
* @dev The returned address might be an EOA or a contract, potentially proxied
* @dev It returns ZERO if there is no registered address with the given id
* @param id The id
* @return The address of the registered for the specified id
*/
function getAddress(bytes32 id) external view returns (address);
/**
* @notice General function to update the implementation of a proxy registered with
* certain `id`. If there is no proxy registered, it will instantiate one and
* set as implementation the `newImplementationAddress`.
* @dev IMPORTANT Use this function carefully, only for ids that don't have an explicit
* setter function, in order to avoid unexpected consequences
* @param id The id
* @param newImplementationAddress The address of the new implementation
*/
function setAddressAsProxy(
bytes32 id,
address newImplementationAddress
) external;
/**
* @notice Sets an address for an id replacing the address saved in the addresses map.
* @dev IMPORTANT Use this function carefully, as it will do a hard replacement
* @param id The id
* @param newAddress The address to set
*/
function setAddress(bytes32 id, address newAddress) external;
/**
* @notice Returns the address of the Pool proxy.
* @return The Pool proxy address
**/
function getPool() external view returns (address);
/**
* @notice Updates the implementation of the Pool, or creates a proxy
* setting the new `pool` implementation when the function is called for the first time.
* @param newPoolImpl The new Pool implementation
**/
function setPoolImpl(address newPoolImpl) external;
/**
* @notice Returns the address of the PoolConfigurator proxy.
* @return The PoolConfigurator proxy address
**/
function getPoolConfigurator() external view returns (address);
/**
* @notice Updates the implementation of the PoolConfigurator, or creates a proxy
* setting the new `PoolConfigurator` implementation when the function is called for the first time.
* @param newPoolConfiguratorImpl The new PoolConfigurator implementation
**/
function setPoolConfiguratorImpl(address newPoolConfiguratorImpl) external;
/**
* @notice Returns the address of the price oracle.
* @return The address of the PriceOracle
*/
function getPriceOracle() external view returns (address);
/**
* @notice Updates the address of the price oracle.
* @param newPriceOracle The address of the new PriceOracle
*/
function setPriceOracle(address newPriceOracle) external;
/**
* @notice Returns the address of the ACL manager.
* @return The address of the ACLManager
*/
function getACLManager() external view returns (address);
/**
* @notice Updates the address of the ACL manager.
* @param newAclManager The address of the new ACLManager
**/
function setACLManager(address newAclManager) external;
/**
* @notice Returns the address of the ACL admin.
* @return The address of the ACL admin
*/
function getACLAdmin() external view returns (address);
/**
* @notice Updates the address of the ACL admin.
* @param newAclAdmin The address of the new ACL admin
*/
function setACLAdmin(address newAclAdmin) external;
/**
* @notice Returns the address of the price oracle sentinel.
* @return The address of the PriceOracleSentinel
*/
function getPriceOracleSentinel() external view returns (address);
/**
* @notice Updates the address of the price oracle sentinel.
* @param newPriceOracleSentinel The address of the new PriceOracleSentinel
**/
function setPriceOracleSentinel(address newPriceOracleSentinel) external;
/**
* @notice Returns the address of the data provider.
* @return The address of the DataProvider
*/
function getPoolDataProvider() external view returns (address);
/**
* @notice Updates the address of the data provider.
* @param newDataProvider The address of the new DataProvider
**/
function setPoolDataProvider(address newDataProvider) external;
}
library DataTypesV3 {
struct ReserveData {
//stores the reserve configuration
ReserveConfigurationMap configuration;
//the liquidity index. Expressed in ray
uint128 liquidityIndex;
//the current supply rate. Expressed in ray
uint128 currentLiquidityRate;
//variable borrow index. Expressed in ray
uint128 variableBorrowIndex;
//the current variable borrow rate. Expressed in ray
uint128 currentVariableBorrowRate;
//the current stable borrow rate. Expressed in ray
uint128 currentStableBorrowRate;
//timestamp of last update
uint40 lastUpdateTimestamp;
//the id of the reserve. Represents the position in the list of the active reserves
uint16 id;
//aToken address
address aTokenAddress;
//stableDebtToken address
address stableDebtTokenAddress;
//variableDebtToken address
address variableDebtTokenAddress;
//address of the interest rate strategy
address interestRateStrategyAddress;
//the current treasury balance, scaled
uint128 accruedToTreasury;
//the outstanding unbacked aTokens minted through the bridging feature
uint128 unbacked;
//the outstanding debt borrowed against this asset in isolation mode
uint128 isolationModeTotalDebt;
}
struct ReserveConfigurationMap {
//bit 0-15: LTV
//bit 16-31: Liq. threshold
//bit 32-47: Liq. bonus
//bit 48-55: Decimals
//bit 56: reserve is active
//bit 57: reserve is frozen
//bit 58: borrowing is enabled
//bit 59: stable rate borrowing enabled
//bit 60: asset is paused
//bit 61: borrowing in isolation mode is enabled
//bit 62-63: reserved
//bit 64-79: reserve factor
//bit 80-115 borrow cap in whole tokens, borrowCap == 0 => no cap
//bit 116-151 supply cap in whole tokens, supplyCap == 0 => no cap
//bit 152-167 liquidation protocol fee
//bit 168-175 eMode category
//bit 176-211 unbacked mint cap in whole tokens, unbackedMintCap == 0 => minting disabled
//bit 212-251 debt ceiling for isolation mode with (ReserveConfiguration::DEBT_CEILING_DECIMALS) decimals
//bit 252-255 unused
uint256 data;
}
struct UserConfigurationMap {
/**
* @dev Bitmap of the users collaterals and borrows. It is divided in pairs of bits, one pair per asset.
* The first bit indicates if an asset is used as collateral by the user, the second whether an
* asset is borrowed by the user.
*/
uint256 data;
}
struct EModeCategory {
// each eMode category has a custom ltv and liquidation threshold
uint16 ltv;
uint16 liquidationThreshold;
uint16 liquidationBonus;
// each eMode category may or may not have a custom oracle to override the individual assets price oracles
address priceSource;
string label;
}
enum InterestRateMode {
NONE,
STABLE,
VARIABLE
}
struct ReserveCache {
uint256 currScaledVariableDebt;
uint256 nextScaledVariableDebt;
uint256 currPrincipalStableDebt;
uint256 currAvgStableBorrowRate;
uint256 currTotalStableDebt;
uint256 nextAvgStableBorrowRate;
uint256 nextTotalStableDebt;
uint256 currLiquidityIndex;
uint256 nextLiquidityIndex;
uint256 currVariableBorrowIndex;
uint256 nextVariableBorrowIndex;
uint256 currLiquidityRate;
uint256 currVariableBorrowRate;
uint256 reserveFactor;
ReserveConfigurationMap reserveConfiguration;
address aTokenAddress;
address stableDebtTokenAddress;
address variableDebtTokenAddress;
uint40 reserveLastUpdateTimestamp;
uint40 stableDebtLastUpdateTimestamp;
}
struct ExecuteLiquidationCallParams {
uint256 reservesCount;
uint256 debtToCover;
address collateralAsset;
address debtAsset;
address user;
bool receiveAToken;
address priceOracle;
uint8 userEModeCategory;
address priceOracleSentinel;
}
struct ExecuteSupplyParams {
address asset;
uint256 amount;
address onBehalfOf;
uint16 referralCode;
}
struct ExecuteBorrowParams {
address asset;
address user;
address onBehalfOf;
uint256 amount;
InterestRateMode interestRateMode;
uint16 referralCode;
bool releaseUnderlying;
uint256 maxStableRateBorrowSizePercent;
uint256 reservesCount;
address oracle;
uint8 userEModeCategory;
address priceOracleSentinel;
}
struct ExecuteRepayParams {
address asset;
uint256 amount;
InterestRateMode interestRateMode;
address onBehalfOf;
bool useATokens;
}
struct ExecuteWithdrawParams {
address asset;
uint256 amount;
address to;
uint256 reservesCount;
address oracle;
uint8 userEModeCategory;
}
struct ExecuteSetUserEModeParams {
uint256 reservesCount;
address oracle;
uint8 categoryId;
}
struct FinalizeTransferParams {
address asset;
address from;
address to;
uint256 amount;
uint256 balanceFromBefore;
uint256 balanceToBefore;
uint256 reservesCount;
address oracle;
uint8 fromEModeCategory;
}
struct FlashloanParams {
address receiverAddress;
address[] assets;
uint256[] amounts;
uint256[] interestRateModes;
address onBehalfOf;
bytes params;
uint16 referralCode;
uint256 flashLoanPremiumToProtocol;
uint256 flashLoanPremiumTotal;
uint256 maxStableRateBorrowSizePercent;
uint256 reservesCount;
address addressesProvider;
uint8 userEModeCategory;
bool isAuthorizedFlashBorrower;
}
struct FlashloanSimpleParams {
address receiverAddress;
address asset;
uint256 amount;
bytes params;
uint16 referralCode;
uint256 flashLoanPremiumToProtocol;
uint256 flashLoanPremiumTotal;
}
struct FlashLoanRepaymentParams {
uint256 amount;
uint256 totalPremium;
uint256 flashLoanPremiumToProtocol;
address asset;
address receiverAddress;
uint16 referralCode;
}
struct CalculateUserAccountDataParams {
UserConfigurationMap userConfig;
uint256 reservesCount;
address user;
address oracle;
uint8 userEModeCategory;
}
struct ValidateBorrowParams {
ReserveCache reserveCache;
UserConfigurationMap userConfig;
address asset;
address userAddress;
uint256 amount;
InterestRateMode interestRateMode;
uint256 maxStableLoanPercent;
uint256 reservesCount;
address oracle;
uint8 userEModeCategory;
address priceOracleSentinel;
bool isolationModeActive;
address isolationModeCollateralAddress;
uint256 isolationModeDebtCeiling;
}
struct ValidateLiquidationCallParams {
ReserveCache debtReserveCache;
uint256 totalDebt;
uint256 healthFactor;
address priceOracleSentinel;
}
struct CalculateInterestRatesParams {
uint256 unbacked;
uint256 liquidityAdded;
uint256 liquidityTaken;
uint256 totalStableDebt;
uint256 totalVariableDebt;
uint256 averageStableBorrowRate;
uint256 reserveFactor;
address reserve;
address aToken;
}
struct InitReserveParams {
address asset;
address aTokenAddress;
address stableDebtAddress;
address variableDebtAddress;
address interestRateStrategyAddress;
uint16 reservesCount;
uint16 maxNumberReserves;
}
}
interface IPool {
/**
* @dev Emitted on mintUnbacked()
* @param reserve The address of the underlying asset of the reserve
* @param user The address initiating the supply
* @param onBehalfOf The beneficiary of the supplied assets, receiving the aTokens
* @param amount The amount of supplied assets
* @param referralCode The referral code used
**/
event MintUnbacked(
address indexed reserve,
address user,
address indexed onBehalfOf,
uint256 amount,
uint16 indexed referralCode
);
/**
* @dev Emitted on backUnbacked()
* @param reserve The address of the underlying asset of the reserve
* @param backer The address paying for the backing
* @param amount The amount added as backing
* @param fee The amount paid in fees
**/
event BackUnbacked(
address indexed reserve,
address indexed backer,
uint256 amount,
uint256 fee
);
/**
* @dev Emitted on supply()
* @param reserve The address of the underlying asset of the reserve
* @param user The address initiating the supply
* @param onBehalfOf The beneficiary of the supply, receiving the aTokens
* @param amount The amount supplied
* @param referralCode The referral code used
**/
event Supply(
address indexed reserve,
address user,
address indexed onBehalfOf,
uint256 amount,
uint16 indexed referralCode
);
/**
* @dev Emitted on withdraw()
* @param reserve The address of the underlying asset being withdrawn
* @param user The address initiating the withdrawal, owner of aTokens
* @param to The address that will receive the underlying
* @param amount The amount to be withdrawn
**/
event Withdraw(
address indexed reserve,
address indexed user,
address indexed to,
uint256 amount
);
/**
* @dev Emitted on borrow() and flashLoan() when debt needs to be opened
* @param reserve The address of the underlying asset being borrowed
* @param user The address of the user initiating the borrow(), receiving the funds on borrow() or just
* initiator of the transaction on flashLoan()
* @param onBehalfOf The address that will be getting the debt
* @param amount The amount borrowed out
* @param interestRateMode The rate mode: 1 for Stable, 2 for Variable
* @param borrowRate The numeric rate at which the user has borrowed, expressed in ray
* @param referralCode The referral code used
**/
event Borrow(
address indexed reserve,
address user,
address indexed onBehalfOf,
uint256 amount,
DataTypesV3.InterestRateMode interestRateMode,
uint256 borrowRate,
uint16 indexed referralCode
);
/**
* @dev Emitted on repay()
* @param reserve The address of the underlying asset of the reserve
* @param user The beneficiary of the repayment, getting his debt reduced
* @param repayer The address of the user initiating the repay(), providing the funds
* @param amount The amount repaid
* @param useATokens True if the rep...
// [truncated — 140919 bytes total]
Read Contract
getGateway 0xbda009fe → address
owner 0x8da5cb5b → address
Write Contract 9 functions
These functions modify contract state and require a wallet transaction to execute.
enterPositionWithFlashloan 0x7263716b
uint256 _principal
uint256 _leverage
address _borrowAsset
address _collateralAsset
address _silo
uint8 _flashLoanType
tuple _borrowAssetAndCollateral
tuple _borrowAssetAndSiloAsset
executeOperation 0x920f5c84
address[] assets
uint256[] amounts
uint256[] premiums
address initiator
bytes params
returns: bool
receiveFlashLoan 0xf04f2707
address[] tokens
uint256[] amounts
uint256[] feeAmounts
bytes userData
renounceOwnership 0x715018a6
No parameters
setGateways 0x06edfc63
address[] _silos
address[] _gateways
transferOwnership 0xf2fde38b
address newOwner
withdrawWithFlashloan 0x84f5fe8f
uint256 _repayAmount
uint256 _requiredAmount
address _borrowAsset
address _collateralAsset
address _silo
uint8 _flashLoanType
tuple _borrowAssetAndCollateral
tuple _borrowAssetAndSiloAsset
zapDeposit 0x73cfbde7
uint256 _principal
uint256 _borrowAmount
address _zappingAsset
address _collateralAsset
address _silo
tuple _zapAssetToCollateral
zapLeverageWithFlashloan 0xbf011843
uint256 _principal
uint256 _leverage
address _zappingAsset
address _collateralAsset
address _borrowAsset
address _silo
uint8 _flashLoanType
tuple _zapAssetToCollateral
tuple _borrowAssetAndCollateral
tuple _borrowAssetAndSiloAsset
Recent Transactions
No transactions found for this address