Address Contract Verified
Address
0x580d3159adE0e95558d10A0Dc9d55A9Ee84F3E27
Balance
0.030000 ETH
Nonce
1
Code Size
11963 bytes
Creator
0xf0B595d1...35Ea at tx 0xf10b339b...6fe2ce
Indexed Transactions
0
Contract Bytecode
11963 bytes
0x6080604052600436106101dc5760003560e01c806375829def1161010257806391d1485411610095578063b911135f11610064578063b911135f146106f0578063cc48b9471461072d578063d547741f14610758578063e0af361614610781576101e3565b806391d14854146106345780639a202d4714610671578063a217fddf14610688578063a9241042146106b3576101e3565b806389f395de116100d157806389f395de146105645780638b8f4a651461058f5780638d4fdb40146105cc5780638d62d94914610609576101e3565b806375829def146104be57806375b238fc146104e75780637cb00d25146105125780637cd5f6631461053b576101e3565b80634a5df50f1161017a5780635cc797d8116101495780635cc797d81461041657806363a8fd891461043f578063704802751461046a578063735de9f714610493576101e3565b80634a5df50f1461034857806350d2a27614610371578063550d01a3146103ae5780635c60da1b146103eb576101e3565b806324d7806c116101b657806324d7806c146102905780632f2ff15d146102cd57806336568abe146102f65780633659cfe61461031f576101e3565b806301ffc9a7146101ed5780631459457a1461022a578063248a9ca314610253576101e3565b366101e357005b6101eb6107ac565b005b3480156101f957600080fd5b50610214600480360381019061020f9190612086565b61088c565b60405161022191906120ce565b60405180910390f35b34801561023657600080fd5b50610251600480360381019061024c9190612147565b61089e565b005b34801561025f57600080fd5b5061027a600480360381019061027591906121f8565b610a31565b6040516102879190612234565b60405180910390f35b34801561029c57600080fd5b506102b760048036038101906102b2919061224f565b610a51565b6040516102c491906120ce565b60405180910390f35b3480156102d957600080fd5b506102f460048036038101906102ef919061227c565b610a84565b005b34801561030257600080fd5b5061031d6004803603810190610318919061227c565b610aa5565b005b34801561032b57600080fd5b506103466004803603810190610341919061224f565b610b28565b005b34801561035457600080fd5b5061036f600480360381019061036a9190612321565b610cab565b005b34801561037d57600080fd5b5061039860048036038101906103939190612086565b611034565b6040516103a59190612390565b60405180910390f35b3480156103ba57600080fd5b506103d560048036038101906103d0919061224f565b611067565b6040516103e291906120ce565b60405180910390f35b3480156103f757600080fd5b50610400611087565b60405161040d9190612390565b60405180910390f35b34801561042257600080fd5b5061043d600480360381019061043891906123d7565b611098565b005b34801561044b57600080fd5b506104546110ee565b60405161046191906120ce565b60405180910390f35b34801561047657600080fd5b50610491600480360381019061048c919061224f565b611101565b005b34801561049f57600080fd5b506104a8611176565b6040516104b59190612476565b60405180910390f35b3480156104ca57600080fd5b506104e560048036038101906104e0919061224f565b61119c565b005b3480156104f357600080fd5b506104fc61131a565b6040516105099190612234565b60405180910390f35b34801561051e57600080fd5b5061053960048036038101906105349190612491565b61133e565b005b34801561054757600080fd5b50610562600480360381019061055d91906124f4565b6113a3565b005b34801561057057600080fd5b506105796113fb565b6040516105869190612390565b60405180910390f35b34801561059b57600080fd5b506105b660048036038101906105b19190612547565b611421565b6040516105c39190612390565b60405180910390f35b3480156105d857600080fd5b506105f360048036038101906105ee9190612086565b611433565b6040516106009190612390565b60405180910390f35b34801561061557600080fd5b5061061e61168d565b60405161062b9190612390565b60405180910390f35b34801561064057600080fd5b5061065b6004803603810190610656919061227c565b6116b1565b60405161066891906120ce565b60405180910390f35b34801561067d57600080fd5b5061068661171c565b005b34801561069457600080fd5b5061069d611790565b6040516106aa9190612234565b60405180910390f35b3480156106bf57600080fd5b506106da60048036038101906106d5919061224f565b611797565b6040516106e791906120ce565b60405180910390f35b3480156106fc57600080fd5b5061071760048036038101906107129190612547565b6117b7565b6040516107249190612390565b60405180910390f35b34801561073957600080fd5b506107426117ea565b60405161074f9190612390565b60405180910390f35b34801561076457600080fd5b5061077f600480360381019061077a919061227c565b611810565b005b34801561078d57600080fd5b50610796611831565b6040516107a39190612595565b60405180910390f35b60006107db6000357fffffffff0000000000000000000000000000000000000000000000000000000016611433565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141580156108275750600760009054906101000a900460ff16155b610866576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085d9061260d565b60405180910390fd5b3660008037600080366000845af43d6000803e8060008114610887573d6000f35b3d6000fd5b600061089782611857565b9050919050565b6108a733610a51565b6108e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108dd9061269f565b60405180910390fd5b846000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555083600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050505050565b600060066000838152602001908152602001600020600101549050919050565b6000610a7d7fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec42836116b1565b9050919050565b610a8d82610a31565b610a96816118cf565b610aa083836118e3565b505050565b610aad6119c4565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610b1a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b1190612731565b60405180910390fd5b610b2482826119cc565b5050565b610b3133610a51565b610b70576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b679061269f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610be0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bd79061279d565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610c016000611aae565b73ffffffffffffffffffffffffffffffffffffffff161415610c58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c4f90612809565b60405180910390fd5b610c658160006001611aeb565b8073ffffffffffffffffffffffffffffffffffffffff167fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b60405160405180910390a250565b610cb433610a51565b610cf3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cea9061269f565b60405180910390fd5b60008383905011610d39576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d3090612875565b60405180910390fd5b600960008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610dc5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dbc906128e1565b60405180910390fd5b60005b8383905081101561102e578173ffffffffffffffffffffffffffffffffffffffff16600a6000868685818110610e0157610e00612901565b5b9050602002016020810190610e169190612086565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610eda576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ed19061297c565b60405180910390fd5b81600a6000868685818110610ef257610ef1612901565b5b9050602002016020810190610f079190612086565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff16848483818110610fbb57610fba612901565b5b9050602002016020810190610fd09190612086565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167f14ebc1c32aa68f4d766e89f3e546cee249f7df25183fc10ab1568d91c2ce9b7b60405160405180910390a38080611026906129cb565b915050610dc8565b50505050565b600a6020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60096020528060005260406000206000915054906101000a900460ff1681565b60006110936000611aae565b905090565b6110a133610a51565b6110e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110d79061269f565b60405180910390fd5b6110ea8282611b9b565b5050565b600760009054906101000a900460ff1681565b61110a33610a51565b611149576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111409061269f565b60405180910390fd5b6111737fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec4282610a84565b50565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6111a533610a51565b6111e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111db9061269f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611254576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161124b90612a60565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156112c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ba90612acc565b60405180910390fd5b6112ed7fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec4282610a84565b6113177fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec4233610aa5565b50565b7fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec4281565b61134733610a51565b611386576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137d9061269f565b60405180910390fd5b80600760006101000a81548160ff02191690831515021790555050565b6113ac33610a51565b6113eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113e29061269f565b60405180910390fd5b6113f6838383611aeb565b505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600061142c82611aae565b9050919050565b60008073ffffffffffffffffffffffffffffffffffffffff16600a6000847bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611515576008600080815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050611688565b60096000600a6000857bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561165157600a6000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050611688565b6008600080815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690505b919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006006600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b61172533610a51565b611764576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161175b9061269f565b60405180910390fd5b61178e7fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec4233610aa5565b565b6000801b81565b60056020528060005260406000206000915054906101000a900460ff1681565b60086020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61181982610a31565b611822816118cf565b61182c83836119cc565b505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600061186282611c44565b806118c85750600b6000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900460ff165b9050919050565b6118e0816118db6119c4565b611cbe565b50565b6118ed82826116b1565b6119c05760016006600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506119656119c4565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b600033905090565b6119d682826116b1565b15611aaa5760006006600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611a4f6119c4565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45b5050565b60006008600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b611af483611d5b565b611b33576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b2a90612b38565b60405180910390fd5b8015611b8c57826008600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b611b968382611b9b565b505050565b80600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff167f72558d9bfba4210f9ef095c782589484151f6d90f7a81bb3cb9b33efc695d32482604051611c3891906120ce565b60405180910390a25050565b60007f7965db0b000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611cb75750611cb682611d7e565b5b9050919050565b611cc882826116b1565b611d5757611ced8173ffffffffffffffffffffffffffffffffffffffff166014611de8565b611cfb8360001c6020611de8565b604051602001611d0c929190612c6a565b6040516020818303038152906040526040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d4e9190612cee565b60405180910390fd5b5050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b606060006002836002611dfb9190612d10565b611e059190612d6a565b67ffffffffffffffff811115611e1e57611e1d612dc0565b5b6040519080825280601f01601f191660200182016040528015611e505781602001600182028036833780820191505090505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611e8857611e87612901565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611eec57611eeb612901565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060006001846002611f2c9190612d10565b611f369190612d6a565b90505b6001811115611fd6577f3031323334353637383961626364656600000000000000000000000000000000600f861660108110611f7857611f77612901565b5b1a60f81b828281518110611f8f57611f8e612901565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c945080611fcf90612def565b9050611f39565b506000841461201a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161201190612e65565b60405180910390fd5b8091505092915050565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6120638161202e565b811461206e57600080fd5b50565b6000813590506120808161205a565b92915050565b60006020828403121561209c5761209b612024565b5b60006120aa84828501612071565b91505092915050565b60008115159050919050565b6120c8816120b3565b82525050565b60006020820190506120e360008301846120bf565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612114826120e9565b9050919050565b61212481612109565b811461212f57600080fd5b50565b6000813590506121418161211b565b92915050565b600080600080600060a0868803121561216357612162612024565b5b600061217188828901612132565b955050602061218288828901612132565b945050604061219388828901612132565b93505060606121a488828901612132565b92505060806121b588828901612132565b9150509295509295909350565b6000819050919050565b6121d5816121c2565b81146121e057600080fd5b50565b6000813590506121f2816121cc565b92915050565b60006020828403121561220e5761220d612024565b5b600061221c848285016121e3565b91505092915050565b61222e816121c2565b82525050565b60006020820190506122496000830184612225565b92915050565b60006020828403121561226557612264612024565b5b600061227384828501612132565b91505092915050565b6000806040838503121561229357612292612024565b5b60006122a1858286016121e3565b92505060206122b285828601612132565b9150509250929050565b600080fd5b600080fd5b600080fd5b60008083601f8401126122e1576122e06122bc565b5b8235905067ffffffffffffffff8111156122fe576122fd6122c1565b5b60208301915083602082028301111561231a576123196122c6565b5b9250929050565b60008060006040848603121561233a57612339612024565b5b600084013567ffffffffffffffff81111561235857612357612029565b5b612364868287016122cb565b9350935050602061237786828701612132565b9150509250925092565b61238a81612109565b82525050565b60006020820190506123a56000830184612381565b92915050565b6123b4816120b3565b81146123bf57600080fd5b50565b6000813590506123d1816123ab565b92915050565b600080604083850312156123ee576123ed612024565b5b60006123fc85828601612132565b925050602061240d858286016123c2565b9150509250929050565b6000819050919050565b600061243c612437612432846120e9565b612417565b6120e9565b9050919050565b600061244e82612421565b9050919050565b600061246082612443565b9050919050565b61247081612455565b82525050565b600060208201905061248b6000830184612467565b92915050565b6000602082840312156124a7576124a6612024565b5b60006124b5848285016123c2565b91505092915050565b6000819050919050565b6124d1816124be565b81146124dc57600080fd5b50565b6000813590506124ee816124c8565b92915050565b60008060006060848603121561250d5761250c612024565b5b600061251b86828701612132565b935050602061252c868287016124df565b925050604061253d868287016123c2565b9150509250925092565b60006020828403121561255d5761255c612024565b5b600061256b848285016124df565b91505092915050565b600061257f82612443565b9050919050565b61258f81612574565b82525050565b60006020820190506125aa6000830184612586565b92915050565b600082825260208201905092915050565b7f50726f78793a20696d706c204f522070726f78792069732066616c7365000000600082015250565b60006125f7601d836125b0565b9150612602826125c1565b602082019050919050565b60006020820190508181036000830152612626816125ea565b9050919050565b7f41636365737369626c653a2043616c6c6572206973206e6f7420616e2061646d60008201527f696e000000000000000000000000000000000000000000000000000000000000602082015250565b60006126896022836125b0565b91506126948261262d565b604082019050919050565b600060208201905081810360008301526126b88161267c565b9050919050565b7f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560008201527f20726f6c657320666f722073656c660000000000000000000000000000000000602082015250565b600061271b602f836125b0565b9150612726826126bf565b604082019050919050565b6000602082019050818103600083015261274a8161270e565b9050919050565b7f696e707574206973207a65726f00000000000000000000000000000000000000600082015250565b6000612787600d836125b0565b915061279282612751565b602082019050919050565b600060208201905081810360008301526127b68161277a565b9050919050565b7f73616d6520616464720000000000000000000000000000000000000000000000600082015250565b60006127f36009836125b0565b91506127fe826127bd565b602082019050919050565b60006020820190508181036000830152612822816127e6565b9050919050565b7f50726f78793a205f73656c6563746f727327732073697a65206973207a65726f600082015250565b600061285f6020836125b0565b915061286a82612829565b602082019050919050565b6000602082019050818103600083015261288e81612852565b9050919050565b7f50726f78793a205f696d70206973206e6f7420616c6976650000000000000000600082015250565b60006128cb6018836125b0565b91506128d682612895565b602082019050919050565b600060208201905081810360008301526128fa816128be565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4c69717569646974795661756c7450726f78793a2073616d6520696d70000000600082015250565b6000612966601d836125b0565b915061297182612930565b602082019050919050565b6000602082019050818103600083015261299581612959565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006129d6826124be565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612a0957612a0861299c565b5b600182019050919050565b7f41636365737369626c653a207a65726f20616464726573730000000000000000600082015250565b6000612a4a6018836125b0565b9150612a5582612a14565b602082019050919050565b60006020820190508181036000830152612a7981612a3d565b9050919050565b7f41636365737369626c653a2073616d652061646d696e00000000000000000000600082015250565b6000612ab66016836125b0565b9150612ac182612a80565b602082019050919050565b60006020820190508181036000830152612ae581612aa9565b9050919050565b7f50726f78793a206e6f7420636f6e747261637420616464726573730000000000600082015250565b6000612b22601b836125b0565b9150612b2d82612aec565b602082019050919050565b60006020820190508181036000830152612b5181612b15565b9050919050565b600081905092915050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000600082015250565b6000612b99601783612b58565b9150612ba482612b63565b601782019050919050565b600081519050919050565b60005b83811015612bd8578082015181840152602081019050612bbd565b83811115612be7576000848401525b50505050565b6000612bf882612baf565b612c028185612b58565b9350612c12818560208601612bba565b80840191505092915050565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000600082015250565b6000612c54601183612b58565b9150612c5f82612c1e565b601182019050919050565b6000612c7582612b8c565b9150612c818285612bed565b9150612c8c82612c47565b9150612c988284612bed565b91508190509392505050565b6000601f19601f8301169050919050565b6000612cc082612baf565b612cca81856125b0565b9350612cda818560208601612bba565b612ce381612ca4565b840191505092915050565b60006020820190508181036000830152612d088184612cb5565b905092915050565b6000612d1b826124be565b9150612d26836124be565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612d5f57612d5e61299c565b5b828202905092915050565b6000612d75826124be565b9150612d80836124be565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612db557612db461299c565b5b828201905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000612dfa826124be565b91506000821415612e0e57612e0d61299c565b5b600182039050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e74600082015250565b6000612e4f6020836125b0565b9150612e5a82612e19565b602082019050919050565b60006020820190508181036000830152612e7e81612e42565b905091905056fea264697066735822122074381f9d88d77ba5c7e434d1f973b1c535a37cf53f98edf4b9f9a966c4e9bd9364736f6c634300080c0033
Verified Source Code Full Match
Compiler: v0.8.12+commit.f00d7308
EVM: london
Optimization: No
Strings.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 Strings {
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);
}
}
SwapperProxy.sol 41 lines
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.1;
import "./SwapperStorage.sol";
import "./proxy/BaseProxy.sol";
import { ERC165Storage } from "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";
contract SwapperProxy is
SwapperStorage,
BaseProxy,
ERC165Storage
{
constructor() {
bytes4 OnApproveSelector= bytes4(keccak256("onApprove(address,address,uint256,bytes)"));
_registerInterface(OnApproveSelector);
}
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Storage, AccessControl) returns (bool) {
return super.supportsInterface(interfaceId);
}
function initialize(
address _wton,
address _ton,
address _tos,
address _uniswapRouter,
address _weth
)
external onlyOwner
{
wton = _wton;
ton = _ton;
tos = _tos;
uniswapRouter = ISwapRouter(_uniswapRouter);
_WETH = IWETH(_weth);
}
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @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;
}
}
IAccessControl.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 IAccessControl {
/**
* @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;
}
IUniswapV3SwapCallback.sol 21 lines
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
/// @title Callback for IUniswapV3PoolActions#swap
/// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface
interface IUniswapV3SwapCallback {
/// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.
/// @dev In the implementation you must pay the pool tokens owed for the swap.
/// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.
/// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.
/// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by
/// the end of the swap. If positive, the callback must send that amount of token0 to the pool.
/// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by
/// the end of the swap. If positive, the callback must send that amount of token1 to the pool.
/// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call
function uniswapV3SwapCallback(
int256 amount0Delta,
int256 amount1Delta,
bytes calldata data
) external;
}
ProxyAccessCommon.sol 39 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "./AccessRoleCommon.sol";
contract ProxyAccessCommon is AccessRoleCommon, AccessControl {
modifier onlyOwner() {
require(isAdmin(msg.sender), "Accessible: Caller is not an admin");
_;
}
/// @dev add admin
/// @param account address to add
function addAdmin(address account) public virtual onlyOwner {
grantRole(ADMIN_ROLE, account);
}
/// @dev remove admin
function removeAdmin() public virtual onlyOwner {
renounceRole(ADMIN_ROLE, msg.sender);
}
/// @dev transfer admin
/// @param newAdmin new admin address
function transferAdmin(address newAdmin) external virtual onlyOwner {
require(newAdmin != address(0), "Accessible: zero address");
require(msg.sender != newAdmin, "Accessible: same admin");
grantRole(ADMIN_ROLE, newAdmin);
renounceRole(ADMIN_ROLE, msg.sender);
}
/// @dev whether admin
/// @param account address to check
function isAdmin(address account) public view virtual returns (bool) {
return hasRole(ADMIN_ROLE, account);
}
}
AccessControl.sol 247 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.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 AccessControl is Context, IAccessControl, ERC165 {
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(IAccessControl).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 ",
Strings.toHexString(uint160(account), 20),
" is missing role ",
Strings.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());
}
}
}
AccessRoleCommon.sol 6 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract AccessRoleCommon {
bytes32 public constant ADMIN_ROLE = keccak256("ADMIN");
}
ERC165Storage.sol 42 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165Storage.sol)
pragma solidity ^0.8.0;
import "./ERC165.sol";
/**
* @dev Storage based implementation of the {IERC165} interface.
*
* Contracts may inherit from this and call {_registerInterface} to declare
* their support of an interface.
*/
abstract contract ERC165Storage is ERC165 {
/**
* @dev Mapping of interface ids to whether or not it's supported.
*/
mapping(bytes4 => bool) private _supportedInterfaces;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return super.supportsInterface(interfaceId) || _supportedInterfaces[interfaceId];
}
/**
* @dev Registers the contract as an implementer of the interface defined by
* `interfaceId`. Support of the actual ERC165 interface is automatic and
* registering its interface id is not required.
*
* See {IERC165-supportsInterface}.
*
* Requirements:
*
* - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
*/
function _registerInterface(bytes4 interfaceId) internal virtual {
require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
_supportedInterfaces[interfaceId] = true;
}
}
ISwapRouter.sol 67 lines
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma abicoder v2;
import '@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol';
/// @title Router token swapping functionality
/// @notice Functions for swapping tokens via Uniswap V3
interface ISwapRouter is IUniswapV3SwapCallback {
struct ExactInputSingleParams {
address tokenIn;
address tokenOut;
uint24 fee;
address recipient;
uint256 deadline;
uint256 amountIn;
uint256 amountOutMinimum;
uint160 sqrtPriceLimitX96;
}
/// @notice Swaps `amountIn` of one token for as much as possible of another token
/// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata
/// @return amountOut The amount of the received token
function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);
struct ExactInputParams {
bytes path;
address recipient;
uint256 deadline;
uint256 amountIn;
uint256 amountOutMinimum;
}
/// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path
/// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata
/// @return amountOut The amount of the received token
function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);
struct ExactOutputSingleParams {
address tokenIn;
address tokenOut;
uint24 fee;
address recipient;
uint256 deadline;
uint256 amountOut;
uint256 amountInMaximum;
uint160 sqrtPriceLimitX96;
}
/// @notice Swaps as little as possible of one token for `amountOut` of another token
/// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata
/// @return amountIn The amount of the input token
function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);
struct ExactOutputParams {
bytes path;
address recipient;
uint256 deadline;
uint256 amountOut;
uint256 amountInMaximum;
}
/// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)
/// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata
/// @return amountIn The amount of the input token
function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);
}
IWETH.sol 9 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IWETH {
function deposit() external payable;
function transfer(address to, uint value) external returns (bool);
function withdraw(uint256 wad) external;
function approve(address guy, uint wad) external returns (bool);
}
Address.sol 222 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)
pragma solidity ^0.8.0;
/**
* @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
* ====
*
* [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 Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(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);
}
}
}
}
IProxyEvent.sol 14 lines
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
/// @title IProxyEvent
interface IProxyEvent {
event Upgraded(address indexed implementation);
event SetAliveImplementation(address indexed impl, bool alive);
event SetSelectorImplementation(bytes4 indexed selector, address indexed impl);
}
IProxyAction.sol 61 lines
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
/// @title IProxyAction
interface IProxyAction {
/// onlyProxyOwner
/// @dev set the implementation address and status of the proxy[index]
/// @param newImplementation Address of the new implementation.
/// @param _index index
/// @param _alive _alive
function setImplementation2(
address newImplementation,
uint256 _index,
bool _alive
) external;
/// @dev set alive status of implementation
/// @param newImplementation Address of the new implementation.
/// @param _alive alive status
function setAliveImplementation2(address newImplementation, bool _alive)
external;
/// @dev set selectors of Implementation
/// @param _selectors being added selectors
/// @param _imp implementation address
function setSelectorImplementations2(
bytes4[] calldata _selectors,
address _imp
) external ;
/// onlyOwner
/// @notice Set pause state
/// @param _pause true:pause or false:resume
function setProxyPause(bool _pause) external ;
/// anybody
/// @dev view implementation address of selector of function
/// @param _selector selector of function
/// @return impl address of the implementation
function getSelectorImplementation2(bytes4 _selector)
external
view
returns (address impl);
/// @dev view implementation address of the proxy[index]
/// @param _index index of proxy
/// @return address of the implementation
function implementation2(uint256 _index) external view returns (address) ;
}
BaseProxyStorage.sol 12 lines
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
contract BaseProxyStorage {
bool public pauseProxy;
mapping(uint256 => address) public proxyImplementation;
mapping(address => bool) public aliveImplementation;
mapping(bytes4 => address) public selectorImplementation;
}
SwapperStorage.sol 21 lines
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.1;
import "@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol";
import "@uniswap/v3-periphery/contracts/interfaces/IQuoter.sol";
import "./interfaces/IWETH.sol";
contract SwapperStorage {
address public wton; //decimal = 27 (RAY)
address public ton; //decimal = 18 (WAD)
address public tos; //decimal = 18 (WAD)
IWETH public _WETH;
ISwapRouter public uniswapRouter;
bool check;
mapping (address => bool) public tokenCheck;
}
ERC165.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.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 ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
IERC165.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 IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IQuoter.sol 51 lines
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma abicoder v2;
/// @title Quoter Interface
/// @notice Supports quoting the calculated amounts from exact input or exact output swaps
/// @dev These functions are not marked view because they rely on calling non-view functions and reverting
/// to compute the result. They are also not gas efficient and should not be called on-chain.
interface IQuoter {
/// @notice Returns the amount out received for a given exact input swap without executing the swap
/// @param path The path of the swap, i.e. each token pair and the pool fee
/// @param amountIn The amount of the first token to swap
/// @return amountOut The amount of the last token that would be received
function quoteExactInput(bytes memory path, uint256 amountIn) external returns (uint256 amountOut);
/// @notice Returns the amount out received for a given exact input but for a swap of a single pool
/// @param tokenIn The token being swapped in
/// @param tokenOut The token being swapped out
/// @param fee The fee of the token pool to consider for the pair
/// @param amountIn The desired input amount
/// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap
/// @return amountOut The amount of `tokenOut` that would be received
function quoteExactInputSingle(
address tokenIn,
address tokenOut,
uint24 fee,
uint256 amountIn,
uint160 sqrtPriceLimitX96
) external returns (uint256 amountOut);
/// @notice Returns the amount in required for a given exact output swap without executing the swap
/// @param path The path of the swap, i.e. each token pair and the pool fee. Path must be provided in reverse order
/// @param amountOut The amount of the last token to receive
/// @return amountIn The amount of first token required to be paid
function quoteExactOutput(bytes memory path, uint256 amountOut) external returns (uint256 amountIn);
/// @notice Returns the amount in required to receive the given exact output amount but for a swap of a single pool
/// @param tokenIn The token being swapped in
/// @param tokenOut The token being swapped out
/// @param fee The fee of the token pool to consider for the pair
/// @param amountOut The desired output amount
/// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap
/// @return amountIn The amount required as the input for the swap in order to receive `amountOut`
function quoteExactOutputSingle(
address tokenIn,
address tokenOut,
uint24 fee,
uint256 amountOut,
uint160 sqrtPriceLimitX96
) external returns (uint256 amountIn);
}
BaseProxy.sol 185 lines
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import "../interfaces/IProxyEvent.sol";
import "../interfaces/IProxyAction.sol";
import "./BaseProxyStorage.sol";
import "../common/ProxyAccessCommon.sol";
// import "hardhat/console.sol";
contract BaseProxy is ProxyAccessCommon, BaseProxyStorage, IProxyEvent, IProxyAction
{
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor () {
_setRoleAdmin(ADMIN_ROLE, ADMIN_ROLE);
_setupRole(ADMIN_ROLE, msg.sender);
}
/// @inheritdoc IProxyAction
function setProxyPause(bool _pause) external override onlyOwner {
pauseProxy = _pause;
}
/// @dev returns the implementation
function implementation() external view returns (address) {
return _implementation2(0);
}
/// @notice Set implementation contract
/// @param impl New implementation contract address
function upgradeTo(address impl) external onlyOwner {
require(impl != address(0), "input is zero");
require(
_implementation2(0) != impl,
"same addr"
);
_setImplementation2(impl, 0, true);
emit Upgraded(impl);
}
/// @inheritdoc IProxyAction
function implementation2(uint256 _index) external override view returns (address) {
return _implementation2(_index);
}
/// @inheritdoc IProxyAction
function setImplementation2(
address newImplementation,
uint256 _index,
bool _alive
) external override onlyOwner {
_setImplementation2(newImplementation, _index, _alive);
}
/// @inheritdoc IProxyAction
function setAliveImplementation2(address newImplementation, bool _alive)
public override
onlyOwner
{
_setAliveImplementation2(newImplementation, _alive);
}
/// @inheritdoc IProxyAction
function setSelectorImplementations2(
bytes4[] calldata _selectors,
address _imp
) public override onlyOwner {
require(
_selectors.length > 0,
"Proxy: _selectors's size is zero"
);
require(aliveImplementation[_imp], "Proxy: _imp is not alive");
for (uint256 i = 0; i < _selectors.length; i++) {
require(
selectorImplementation[_selectors[i]] != _imp,
"LiquidityVaultProxy: same imp"
);
selectorImplementation[_selectors[i]] = _imp;
emit SetSelectorImplementation(_selectors[i], _imp);
}
}
/// @dev set the implementation address and status of the proxy[index]
/// @param newImplementation Address of the new implementation.
/// @param _index index of proxy
/// @param _alive alive status
function _setImplementation2(
address newImplementation,
uint256 _index,
bool _alive
) internal {
require(
Address.isContract(newImplementation),
"Proxy: not contract address"
);
if (_alive) proxyImplementation[_index] = newImplementation;
_setAliveImplementation2(newImplementation, _alive);
}
/// @dev set alive status of implementation
/// @param newImplementation Address of the new implementation.
/// @param _alive alive status
function _setAliveImplementation2(address newImplementation, bool _alive)
internal
{
aliveImplementation[newImplementation] = _alive;
emit SetAliveImplementation(newImplementation, _alive);
}
/// @dev view implementation address of the proxy[index]
/// @param _index index of proxy
/// @return impl address of the implementation
function _implementation2(uint256 _index)
internal
view
returns (address impl)
{
return proxyImplementation[_index];
}
/// @inheritdoc IProxyAction
function getSelectorImplementation2(bytes4 _selector)
public override
view
returns (address impl)
{
if (selectorImplementation[_selector] == address(0))
return proxyImplementation[0];
else if (aliveImplementation[selectorImplementation[_selector]]){
return selectorImplementation[_selector];
}
else return proxyImplementation[0];
}
/// @dev receive ether
receive() external payable {
}
/// @dev fallback function , execute on undefined function call
fallback() external payable {
_fallback();
}
/// @dev fallback function , execute on undefined function call
function _fallback() internal {
address _impl = getSelectorImplementation2(msg.sig);
require(
_impl != address(0) && !pauseProxy,
"Proxy: impl OR proxy is false"
);
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), _impl, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 {
revert(0, returndatasize())
}
default {
return(0, returndatasize())
}
}
}
}
Read Contract
ADMIN_ROLE 0x75b238fc → bytes32
DEFAULT_ADMIN_ROLE 0xa217fddf → bytes32
_WETH 0xe0af3616 → address
aliveImplementation 0x550d01a3 → bool
getRoleAdmin 0x248a9ca3 → bytes32
getSelectorImplementation2 0x8d4fdb40 → address
hasRole 0x91d14854 → bool
implementation 0x5c60da1b → address
implementation2 0x8b8f4a65 → address
isAdmin 0x24d7806c → bool
pauseProxy 0x63a8fd89 → bool
proxyImplementation 0xb911135f → address
selectorImplementation 0x50d2a276 → address
supportsInterface 0x01ffc9a7 → bool
tokenCheck 0xa9241042 → bool
ton 0xcc48b947 → address
tos 0x89f395de → address
uniswapRouter 0x735de9f7 → address
wton 0x8d62d949 → address
Write Contract 12 functions
These functions modify contract state and require a wallet transaction to execute.
addAdmin 0x70480275
address account
grantRole 0x2f2ff15d
bytes32 role
address account
initialize 0x1459457a
address _wton
address _ton
address _tos
address _uniswapRouter
address _weth
removeAdmin 0x9a202d47
No parameters
renounceRole 0x36568abe
bytes32 role
address account
revokeRole 0xd547741f
bytes32 role
address account
setAliveImplementation2 0x5cc797d8
address newImplementation
bool _alive
setImplementation2 0x7cd5f663
address newImplementation
uint256 _index
bool _alive
setProxyPause 0x7cb00d25
bool _pause
setSelectorImplementations2 0x4a5df50f
bytes4[] _selectors
address _imp
transferAdmin 0x75829def
address newAdmin
upgradeTo 0x3659cfe6
address impl
Recent Transactions
No transactions found for this address