Address Contract Partially Verified
Address
0x9b74774f55C0351fD064CfdfFd35dB002C433092
Balance
0 ETH
Nonce
1
Code Size
11401 bytes
Creator
0x7Be4D5A9...3c7f at tx 0x24fe62d6...5f1535
Indexed Transactions
0 (1 on-chain, 1.3% indexed)
Contract Bytecode
11401 bytes
0x608060405234801561001057600080fd5b50600436106102b95760003560e01c8063715018a611610182578063a56dfe4a116100e9578063df136d65116100a2578063e9fad8ee1161007c578063e9fad8ee1461062f578063ebe2b12b14610637578063f2fde38b1461063f578063ffe4890214610665576102b9565b8063df136d65146105f9578063e68e035b14610601578063e9b46e6d14610609576102b9565b8063a56dfe4a146105c9578063c3dee20b146105d1578063c8333bb2146105d9578063c8f33c91146105e1578063cd3daf9d146105e9578063dc8d3683146105f1576102b9565b806380faa57d1161013b57806380faa57d1461057b5780638b876347146105835780638da58897146105a95780638da5cb5b146105b15780638f32d59b146105b9578063a457536c146105c1576102b9565b8063715018a6146105275780637318a7301461052f578063766718081461053757806379a7d1be1461053f5780637acb7757146105475780637b0a47ee14610573576102b9565b80631d8a6d10116102265780633d18b912116101df5780633d18b912146104895780633d62bbe1146104915780634e8999ed146104b757806353220a42146104bf57806367b37b7a146104c757806370a0823114610501576102b9565b80631d8a6d10146103fa578063207e821d146104025780632e1a7d4d1461040a5780632e329bd3146104275780632f38c8a1146104465780633c6b16ab1461046c576102b9565b806313eb6c881161027857806313eb6c881461038e57806314f47dcc1461039657806318160ddd1461039e5780631961eaf9146103a65780631be05289146103cc5780631d6851c6146103d4576102b9565b80622dcfb9146102be5780628cc262146102e657806304e01d871461031e5780630700037d146103265780630cdb43c41461034c5780630fcfc6a814610370575b600080fd5b6102e4600480360360208110156102d457600080fd5b50356001600160a01b031661068b565b005b61030c600480360360208110156102fc57600080fd5b50356001600160a01b03166106f4565b60408051918252519081900360200190f35b61030c61080e565b61030c6004803603602081101561033c57600080fd5b50356001600160a01b0316610814565b610354610826565b604080516001600160a01b039092168252519081900360200190f35b610378610835565b6040805160ff9092168252519081900360200190f35b61030c61083a565b6102e4610848565b61030c610cd1565b6102e4600480360360208110156103bc57600080fd5b50356001600160a01b0316610cd8565b61030c610d41565b6102e4600480360360208110156103ea57600080fd5b50356001600160a01b0316610d48565b6102e4610e2b565b61030c610f58565b6102e46004803603602081101561042057600080fd5b5035610f5e565b61042f611333565b6040805161ffff9092168252519081900360200190f35b61030c6004803603602081101561045c57600080fd5b50356001600160a01b03166113e3565b6102e46004803603602081101561048257600080fd5b50356113fa565b61030c611749565b61030c600480360360208110156104a757600080fd5b50356001600160a01b0316611d3d565b610354611d4e565b61030c611d5d565b6104ed600480360360208110156104dd57600080fd5b50356001600160a01b0316611d62565b604080519115158252519081900360200190f35b61030c6004803603602081101561051757600080fd5b50356001600160a01b0316611d77565b6102e4611d92565b610354611e23565b610378611e32565b610354611e3b565b6102e46004803603604081101561055d57600080fd5b50803590602001356001600160a01b0316611e4a565b61030c61230f565b61030c612315565b61030c6004803603602081101561059957600080fd5b50356001600160a01b0316612328565b61030c61233a565b610354612340565b6104ed61234f565b610354612375565b610354612384565b610354612393565b61030c6123a2565b61030c6123b1565b61030c6123b7565b61030c61240b565b61030c612411565b61030c612417565b61030c6004803603602081101561061f57600080fd5b50356001600160a01b031661241d565b6102e461242f565b61030c612448565b6102e46004803603602081101561065557600080fd5b50356001600160a01b031661244e565b61030c6004803603602081101561067b57600080fd5b50356001600160a01b031661249e565b61069361234f565b6106d2576040805162461bcd60e51b81526020600482018190526024820152600080516020612bb9833981519152604482015290519081900360640190fd5b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038116600090815260146020908152604080832054601390925282205482916107759161076990670de0b6b3a76400009061075d906107489061073c6123b7565b9063ffffffff6124d116565b61075189611d77565b9063ffffffff61251a16565b9063ffffffff61257316565b9063ffffffff6125b516565b600654604080516370a0823160e01b815230600482015290519293506000926001600160a01b03909216916370a0823191602480820192602092909190829003018186803b1580156107c657600080fd5b505afa1580156107da573d6000803e3d6000fd5b505050506040513d60208110156107f057600080fd5b50519050808211156108055791506108099050565b5090505b919050565b600a5481565b60146020526000908152604090205481565b6004546001600160a01b031681565b600a81565b691aae7943876392c0000081565b336108516123b7565b60125561085c612315565b6011556001600160a01b038116156108a357610877816106f4565b6001600160a01b0382166000908152601460209081526040808320939093556012546013909152919020555b600f544210610b4f5760006108b6611333565b90506108db606461075d691aae7943876392c0000061ffff851663ffffffff61251a16565b600b819055600c546a010ad0bca349e3bb80000091610900919063ffffffff6125b516565b111561092957600c54610925906a010ad0bca349e3bb8000009063ffffffff6124d116565b600b555b600b5415610af557600654600b54604080516340c10f1960e01b81523060048201526024810192909252516001600160a01b03909216916340c10f199160448082019260009290919082900301818387803b15801561098757600080fd5b505af115801561099b573d6000803e3d6000fd5b5050600754600954600b546001600160a01b0390921693506340c10f19925030916109cb9163ffffffff61257316565b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015610a1a57600080fd5b505af1158015610a2e573d6000803e3d6000fd5b5050600854600a54600b546001600160a01b0390921693506340c10f1992503091610a5e9163ffffffff61257316565b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015610aad57600080fd5b505af1158015610ac1573d6000803e3d6000fd5b5050600b54600c54610adb9350915063ffffffff6125b516565b600c55600d805460ff8082166001011660ff199091161790555b600b54610b0b9062093a8063ffffffff61257316565b601055426011819055610b279062093a8063ffffffff6125b516565b600f55600b546040805191825251600080516020612b788339815191529181900360200190a1505b600e544211610b91576040805162461bcd60e51b81526020600482015260096024820152681b9bdd081cdd185c9d60ba1b604482015290519081900360640190fd5b6017546001600160a01b0316610bee576040805162461bcd60e51b815260206004820152601a60248201527f446f6e74206b6e6f7720746865207374616b696e6720706f6f6c000000000000604482015290519081900360640190fd5b6000610bf8611749565b600654909150610c19906001600160a01b031633308463ffffffff61260f16565b60018111610c62576040805162461bcd60e51b81526020600482015260116024820152704561726e656420746f6f206c6974746c6560781b604482015290519081900360640190fd5b60175460408051632305af7160e11b81523360048201526024810184905290516001600160a01b039092169163460b5ee29160448082019260009290919082900301818387803b158015610cb557600080fd5b505af1158015610cc9573d6000803e3d6000fd5b505050505050565b6001545b90565b610ce061234f565b610d1f576040805162461bcd60e51b81526020600482018190526024820152600080516020612bb9833981519152604482015290519081900360640190fd5b600580546001600160a01b0319166001600160a01b0392909216919091179055565b62093a8081565b610d5061234f565b610d8f576040805162461bcd60e51b81526020600482018190526024820152600080516020612bb9833981519152604482015290519081900360640190fd5b601780546001600160a01b0319166001600160a01b0383811691909117918290556006546040805163095ea7b360e01b8152938316600485015260001960248501525191169163095ea7b39160448083019260209291908290030181600087803b158015610dfc57600080fd5b505af1158015610e10573d6000803e3d6000fd5b505050506040513d6020811015610e2657600080fd5b505050565b60105415610e6a5760405162461bcd60e51b815260040180806020018281038252602f815260200180612c26602f913960400191505060405180910390fd5b6000610e7533611d3d565b905060008111610ecc576040805162461bcd60e51b815260206004820152601960248201527f596f752068617665206e6f207645544820746f20636c61696d00000000000000604482015290519081900360640190fd5b3360009081526015602052604090205460ff1615610f1b5760405162461bcd60e51b8152600401808060200182810382526022815260200180612b566022913960400191505060405180910390fd5b336000818152601560205260409020805460ff19166001179055600854610f55916001600160a01b0391909116908363ffffffff61266f16565b50565b600c5481565b33610f676123b7565b601255610f72612315565b6011556001600160a01b03811615610fb957610f8d816106f4565b6001600160a01b0382166000908152601460209081526040808320939093556012546013909152919020555b600f544210611265576000610fcc611333565b9050610ff1606461075d691aae7943876392c0000061ffff851663ffffffff61251a16565b600b819055600c546a010ad0bca349e3bb80000091611016919063ffffffff6125b516565b111561103f57600c5461103b906a010ad0bca349e3bb8000009063ffffffff6124d116565b600b555b600b541561120b57600654600b54604080516340c10f1960e01b81523060048201526024810192909252516001600160a01b03909216916340c10f199160448082019260009290919082900301818387803b15801561109d57600080fd5b505af11580156110b1573d6000803e3d6000fd5b5050600754600954600b546001600160a01b0390921693506340c10f19925030916110e19163ffffffff61257316565b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561113057600080fd5b505af1158015611144573d6000803e3d6000fd5b5050600854600a54600b546001600160a01b0390921693506340c10f19925030916111749163ffffffff61257316565b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156111c357600080fd5b505af11580156111d7573d6000803e3d6000fd5b5050600b54600c546111f19350915063ffffffff6125b516565b600c55600d805460ff8082166001011660ff199091161790555b600b546112219062093a8063ffffffff61257316565b60105542601181905561123d9062093a8063ffffffff6125b516565b600f55600b546040805191825251600080516020612b788339815191529181900360200190a1505b600e5442116112a7576040805162461bcd60e51b81526020600482015260096024820152681b9bdd081cdd185c9d60ba1b604482015290519081900360640190fd5b600082116112f0576040805162461bcd60e51b8152602060048201526011602482015270043616e6e6f74207769746864726177203607c1b604482015290519081900360640190fd5b6112f9826126c1565b60408051838152905133917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a25050565b6005546000906001600160a01b0316156113dd57600554600f54604080516397ec0ffd60e01b81523060048201526024810192909252516000926001600160a01b0316916397ec0ffd916044808301926020929190829003018186803b15801561139c57600080fd5b505afa1580156113b0573d6000803e3d6000fd5b505050506040513d60208110156113c657600080fd5b5051905061ffff8116156113db579050610cd5565b505b50606490565b60006113f460095461075d846106f4565b92915050565b61140261234f565b611441576040805162461bcd60e51b81526020600482018190526024820152600080516020612bb9833981519152604482015290519081900360640190fd5b600061144b6123b7565b601255611456612315565b6011556001600160a01b0381161561149d57611471816106f4565b6001600160a01b0382166000908152601460209081526040808320939093556012546013909152919020555b600f54156114dc5760405162461bcd60e51b8152600401808060200182810382526023815260200180612c036023913960400191505060405180910390fd5b600b829055600c546a010ad0bca349e3bb80000090611501908463ffffffff6125b516565b111561152a57600c54611526906a010ad0bca349e3bb8000009063ffffffff6124d116565b600b555b600b546115409062093a8063ffffffff61257316565b601055600654600b54604080516340c10f1960e01b81523060048201526024810192909252516001600160a01b03909216916340c10f199160448082019260009290919082900301818387803b15801561159957600080fd5b505af11580156115ad573d6000803e3d6000fd5b5050600754600954600b546001600160a01b0390921693506340c10f19925030916115dd9163ffffffff61257316565b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561162c57600080fd5b505af1158015611640573d6000803e3d6000fd5b5050600854600a54600b546001600160a01b0390921693506340c10f19925030916116709163ffffffff61257316565b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156116bf57600080fd5b505af11580156116d3573d6000803e3d6000fd5b5050600b54600c546116ed9350915063ffffffff6125b516565b600c55600d805460ff8082166001011660ff1990911617905542601181905561171f9062093a8063ffffffff6125b516565b600f55600b546040805191825251600080516020612b788339815191529181900360200190a15050565b6000336117546123b7565b60125561175f612315565b6011556001600160a01b038116156117a65761177a816106f4565b6001600160a01b0382166000908152601460209081526040808320939093556012546013909152919020555b600f544210611a525760006117b9611333565b90506117de606461075d691aae7943876392c0000061ffff851663ffffffff61251a16565b600b819055600c546a010ad0bca349e3bb80000091611803919063ffffffff6125b516565b111561182c57600c54611828906a010ad0bca349e3bb8000009063ffffffff6124d116565b600b555b600b54156119f857600654600b54604080516340c10f1960e01b81523060048201526024810192909252516001600160a01b03909216916340c10f199160448082019260009290919082900301818387803b15801561188a57600080fd5b505af115801561189e573d6000803e3d6000fd5b5050600754600954600b546001600160a01b0390921693506340c10f19925030916118ce9163ffffffff61257316565b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561191d57600080fd5b505af1158015611931573d6000803e3d6000fd5b5050600854600a54600b546001600160a01b0390921693506340c10f19925030916119619163ffffffff61257316565b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156119b057600080fd5b505af11580156119c4573d6000803e3d6000fd5b5050600b54600c546119de9350915063ffffffff6125b516565b600c55600d805460ff8082166001011660ff199091161790555b600b54611a0e9062093a8063ffffffff61257316565b601055426011819055611a2a9062093a8063ffffffff6125b516565b600f55600b546040805191825251600080516020612b788339815191529181900360200190a1505b600e544211611a94576040805162461bcd60e51b81526020600482015260096024820152681b9bdd081cdd185c9d60ba1b604482015290519081900360640190fd5b6000611a9f336106f4565b90506001811115611d335733600090815260146020908152604080832054601690925290912054611ad59163ffffffff6125b516565b3360009081526016602090815260408083209390935560149052908120819055611b0b606461075d84606363ffffffff61251a16565b60065490915081830390611b2f906001600160a01b0316338463ffffffff61266f16565b60408051838152905133917fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486919081900360200190a26004546000906001600160a01b031615611bf4576004805460408051634a9fefc760e01b81523393810193909352516001600160a01b0390911691634a9fefc7916024808301926020929190829003018186803b158015611bc557600080fd5b505afa158015611bd9573d6000803e3d6000fd5b505050506040513d6020811015611bef57600080fd5b505190505b6001600160a01b03811615611c5b57600654611c20906001600160a01b0316828463ffffffff61266f16565b60408051838152905133917fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486919081900360200190a2611cf5565b60065460408051630852cd8d60e31b81526004810185905290516001600160a01b03909216916342966c689160248082019260009290919082900301818387803b158015611ca857600080fd5b505af1158015611cbc573d6000803e3d6000fd5b50506040805185815290517fd83c63197e8e676d80ab0122beba9a9d20f3828839e9a1d6fe81d242e9cd7e6e9350908190036020019150a15b611d2733611d0e6009548761257390919063ffffffff16565b6007546001600160a01b0316919063ffffffff61266f16565b82955050505050611d39565b60009250505b5090565b60006113f4600a5461075d8461249e565b6017546001600160a01b031681565b600181565b60156020526000908152604090205460ff1681565b6001600160a01b031660009081526002602052604090205490565b611d9a61234f565b611dd9576040805162461bcd60e51b81526020600482018190526024820152600080516020612bb9833981519152604482015290519081900360640190fd5b6003546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600380546001600160a01b0319169055565b6006546001600160a01b031681565b600d5460ff1681565b6008546001600160a01b031681565b33611e536123b7565b601255611e5e612315565b6011556001600160a01b03811615611ea557611e79816106f4565b6001600160a01b0382166000908152601460209081526040808320939093556012546013909152919020555b600f544210612151576000611eb8611333565b9050611edd606461075d691aae7943876392c0000061ffff851663ffffffff61251a16565b600b819055600c546a010ad0bca349e3bb80000091611f02919063ffffffff6125b516565b1115611f2b57600c54611f27906a010ad0bca349e3bb8000009063ffffffff6124d116565b600b555b600b54156120f757600654600b54604080516340c10f1960e01b81523060048201526024810192909252516001600160a01b03909216916340c10f199160448082019260009290919082900301818387803b158015611f8957600080fd5b505af1158015611f9d573d6000803e3d6000fd5b5050600754600954600b546001600160a01b0390921693506340c10f1992503091611fcd9163ffffffff61257316565b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561201c57600080fd5b505af1158015612030573d6000803e3d6000fd5b5050600854600a54600b546001600160a01b0390921693506340c10f19925030916120609163ffffffff61257316565b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156120af57600080fd5b505af11580156120c3573d6000803e3d6000fd5b5050600b54600c546120dd9350915063ffffffff6125b516565b600c55600d805460ff8082166001011660ff199091161790555b600b5461210d9062093a8063ffffffff61257316565b6010554260118190556121299062093a8063ffffffff6125b516565b600f55600b546040805191825251600080516020612b788339815191529181900360200190a1505b600e544211612193576040805162461bcd60e51b81526020600482015260096024820152681b9bdd081cdd185c9d60ba1b604482015290519081900360640190fd5b600083116121d9576040805162461bcd60e51b815260206004820152600e60248201526d043616e6e6f74207374616b6520360941b604482015290519081900360640190fd5b6001600160a01b038216331415612237576040805162461bcd60e51b815260206004820152601a60248201527f596f752063616e6e6f7420726566657220796f757273656c662e000000000000604482015290519081900360640190fd5b61224083612722565b60408051848152905133917f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d919081900360200190a26004546001600160a01b03161580159061229857506001600160a01b03821615155b15610e2657600480546040805163bbddaca360e01b815233938101939093526001600160a01b038581166024850152905191169163bbddaca391604480830192600092919082900301818387803b1580156122f257600080fd5b505af1158015612306573d6000803e3d6000fd5b50505050505050565b60105481565b600061232342600f54612784565b905090565b60136020526000908152604090205481565b600e5481565b6003546001600160a01b031690565b6003546000906001600160a01b031661236661279a565b6001600160a01b031614905090565b6007546001600160a01b031681565b6000546001600160a01b031681565b6005546001600160a01b031681565b6a010ad0bca349e3bb80000081565b60115481565b60006123c1610cd1565b6123ce5750601254610cd5565b6123236123fc6123dc610cd1565b61075d670de0b6b3a764000061075160105461075160115461073c612315565b6012549063ffffffff6125b516565b60095481565b60125481565b600b5481565b60166020526000908152604090205481565b61244061243b33611d77565b610f5e565b610f55611749565b600f5481565b61245661234f565b612495576040805162461bcd60e51b81526020600482018190526024820152600080516020612bb9833981519152604482015290519081900360640190fd5b610f558161279e565b60006113f46124ac836106f4565b6001600160a01b0384166000908152601660205260409020549063ffffffff6125b516565b600061251383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061283f565b9392505050565b600082612529575060006113f4565b8282028284828161253657fe5b04146125135760405162461bcd60e51b8152600401808060200182810382526021815260200180612b986021913960400191505060405180910390fd5b600061251383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506128d6565b600082820183811015612513576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261266990859061293b565b50505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610e2690849061293b565b6001546126d4908263ffffffff6124d116565b600155336000908152600260205260409020546126f7908263ffffffff6124d116565b336000818152600260205260408120929092559054610f55916001600160a01b03909116908361266f565b600154612735908263ffffffff6125b516565b60015533600090815260026020526040902054612758908263ffffffff6125b516565b336000818152600260205260408120929092559054610f55916001600160a01b0390911690308461260f565b60008183106127935781612513565b5090919050565b3390565b6001600160a01b0381166127e35760405162461bcd60e51b8152600401808060200182810382526026815260200180612b306026913960400191505060405180910390fd5b6003546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600380546001600160a01b0319166001600160a01b0392909216919091179055565b600081848411156128ce5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561289357818101518382015260200161287b565b50505050905090810190601f1680156128c05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836129255760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561289357818101518382015260200161287b565b50600083858161293157fe5b0495945050505050565b61294d826001600160a01b0316612af3565b61299e576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b602083106129dc5780518252601f1990920191602091820191016129bd565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612a3e576040519150601f19603f3d011682016040523d82523d6000602084013e612a43565b606091505b509150915081612a9a576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b80511561266957808060200190516020811015612ab657600080fd5b50516126695760405162461bcd60e51b815260040180806020018281038252602a815260200180612bd9602a913960400191505060405180910390fd5b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708115801590612b275750808214155b94935050505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373596f75206861766520636c61696d656420616c6c2070656e64696e6720764554482ede88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565644f6e6c792063616e2063616c6c206f6e636520746f207374617274207374616b696e677645544820636f756c6420626520636c61696d6564206f6e6c792061667465722074686520706f6f6c20656e64732ea265627a7a72315820f71f727c8166e37bf6930f736c7aebfa6d6efe72b06248c210e1b1e9d02b97d464736f6c63430005110032
Verified Source Code Partial Match
Compiler: v0.5.17+commit.d19bba13
EVM: istanbul
Optimization: Yes (200 runs)
YFVRewardsKNCPool.sol 855 lines
/*
____ __ __ __ _
/ __/__ __ ___ / /_ / / ___ / /_ (_)__ __
_\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ /
/___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\
/___/
* Synthetix: YFIRewards.sol
*
* Docs: https://docs.synthetix.io/
*
*
* MIT License
* ===========
*
* Copyright (c) 2020 Synthetix
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
*/
// File: @openzeppelin/contracts/math/Math.sol
pragma solidity ^0.5.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow, so we distribute
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
}
// File: @openzeppelin/contracts/math/SafeMath.sol
pragma solidity ^0.5.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
// File: @openzeppelin/contracts/GSN/Context.sol
pragma solidity ^0.5.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 GSN 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.
*/
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal {}
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this;
// silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
// File: @openzeppelin/contracts/ownership/Ownable.sol
pragma solidity ^0.5.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
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 () internal {
_owner = _msgSender();
emit OwnershipTransferred(address(0), _owner);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.5.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
function mint(address account, uint amount) external;
function burn(uint amount) external;
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: @openzeppelin/contracts/utils/Address.sol
pragma solidity ^0.5.5;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* This test is non-exhaustive, and there may be false-negatives: during the
* execution of a contract's constructor, its address will be reported as
* not containing 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.
*/
function isContract(address account) internal view returns (bool) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly {codehash := extcodehash(account)}
return (codehash != 0x0 && codehash != accountHash);
}
/**
* @dev Converts an `address` into `address payable`. Note that this is
* simply a type cast: the actual underlying value is not changed.
*
* _Available since v2.4.0._
*/
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
/**
* @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].
*
* _Available since v2.4.0._
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-call-value
(bool success,) = recipient.call.value(amount)("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
// File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol
pragma solidity ^0.5.0;
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
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'
// solhint-disable-next-line max-line-length
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));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
/**
* @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.
// A Solidity high level call has three parts:
// 1. The target address is checked to verify it contains contract code
// 2. The call itself is made, and success asserted
// 3. The return value is decoded, which in turn checks the size of the returned data.
// solhint-disable-next-line max-line-length
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) {// Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
// File: contracts/IRewardDistributionRecipient.sol
pragma solidity ^0.5.0;
contract IRewardDistributionRecipient is Ownable {
address public rewardReferral;
address public rewardVote;
function notifyRewardAmount(uint256 reward) external;
function setRewardReferral(address _rewardReferral) external onlyOwner {
rewardReferral = _rewardReferral;
}
function setRewardVote(address _rewardVote) external onlyOwner {
rewardVote = _rewardVote;
}
}
// File: contracts/CurveRewards.sol
pragma solidity ^0.5.0;
contract LPTokenWrapper {
using SafeMath for uint256;
using SafeERC20 for IERC20;
using Address for address;
IERC20 public y = IERC20(0xbfDef139103033990082245C24FF4B23Dafd88cf);
uint256 private _totalSupply;
mapping(address => uint256) private _balances;
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function tokenStake(uint256 amount) internal {
_totalSupply = _totalSupply.add(amount);
_balances[msg.sender] = _balances[msg.sender].add(amount);
y.safeTransferFrom(msg.sender, address(this), amount);
}
function tokenWithdraw(uint256 amount) internal {
_totalSupply = _totalSupply.sub(amount);
_balances[msg.sender] = _balances[msg.sender].sub(amount);
y.safeTransfer(msg.sender, amount);
}
}
interface IYFVReferral {
function setReferrer(address farmer, address referrer) external;
function getReferrer(address farmer) external view returns (address);
}
interface IYFVVote {
function averageVotingValue(address poolAddress, uint256 votingItem) external view returns (uint16);
}
interface IYFVStake {
function stakeOnBehalf(address stakeFor, uint256 amount) external;
}
contract YFVRewardsKNCPool is LPTokenWrapper, IRewardDistributionRecipient {
IERC20 public yfv = IERC20(0x45f24BaEef268BB6d63AEe5129015d69702BCDfa);
IERC20 public vUSD = IERC20(0x1B8E12F839BD4e73A47adDF76cF7F0097d74c14C);
IERC20 public vETH = IERC20(0x76A034e76Aa835363056dd418611E4f81870f16e);
uint256 public vUSD_REWARD_FRACTION_RATE = 21000000000; // 21 * 1e9 (vUSD decimals = 9)
uint256 public vETH_REWARD_FRACTION_RATE = 21000000000000; // 21000 * 1e9 (vETH decimals = 9)
uint256 public constant DURATION = 7 days;
uint8 public constant NUMBER_EPOCHS = 10;
uint256 public constant REFERRAL_COMMISSION_PERCENT = 1;
uint256 public constant EPOCH_REWARD = 126000 ether;
uint256 public constant TOTAL_REWARD = EPOCH_REWARD * NUMBER_EPOCHS;
uint256 public currentEpochReward = EPOCH_REWARD;
uint256 public totalAccumulatedReward = 0;
uint8 public currentEpoch = 0;
uint256 public starttime = 1597944600; // Thursday, August 20, 2020 5:30:00 PM (GMT+0)
uint256 public periodFinish = 0;
uint256 public rewardRate = 0;
uint256 public lastUpdateTime;
uint256 public rewardPerTokenStored;
mapping(address => uint256) public userRewardPerTokenPaid;
mapping(address => uint256) public rewards;
mapping(address => bool) public claimedVETHRewards; // account -> has claimed vETH?
mapping(address => uint256) public accumulatedStakingPower; // will accumulate every time staker does getReward()
address public rewardStake;
event RewardAdded(uint256 reward);
event Burned(uint256 reward);
event Staked(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
event RewardPaid(address indexed user, uint256 reward);
event CommissionPaid(address indexed user, uint256 reward);
modifier updateReward(address account) {
rewardPerTokenStored = rewardPerToken();
lastUpdateTime = lastTimeRewardApplicable();
if (account != address(0)) {
rewards[account] = earned(account);
userRewardPerTokenPaid[account] = rewardPerTokenStored;
}
_;
}
function lastTimeRewardApplicable() public view returns (uint256) {
return Math.min(block.timestamp, periodFinish);
}
function rewardPerToken() public view returns (uint256) {
if (totalSupply() == 0) {
return rewardPerTokenStored;
}
return
rewardPerTokenStored.add(
lastTimeRewardApplicable()
.sub(lastUpdateTime)
.mul(rewardRate)
.mul(1e18)
.div(totalSupply())
);
}
function earned(address account) public view returns (uint256) {
uint256 calculatedEarned = balanceOf(account)
.mul(rewardPerToken().sub(userRewardPerTokenPaid[account]))
.div(1e18)
.add(rewards[account]);
uint256 poolBalance = yfv.balanceOf(address(this));
// some rare case the reward can be slightly bigger than real number, we need to check against how much we have left in pool
if (calculatedEarned > poolBalance) return poolBalance;
return calculatedEarned;
}
function stakingPower(address account) public view returns (uint256) {
return accumulatedStakingPower[account].add(earned(account));
}
function vUSDBalance(address account) public view returns (uint256) {
return earned(account).div(vUSD_REWARD_FRACTION_RATE);
}
function vETHBalance(address account) public view returns (uint256) {
return stakingPower(account).div(vETH_REWARD_FRACTION_RATE);
}
function claimVETHReward() public {
require(rewardRate == 0, "vETH could be claimed only after the pool ends.");
uint256 claimAmount = vETHBalance(msg.sender);
require(claimAmount > 0, "You have no vETH to claim");
require(!claimedVETHRewards[msg.sender], "You have claimed all pending vETH.");
claimedVETHRewards[msg.sender] = true;
vETH.safeTransfer(msg.sender, claimAmount);
}
function setRewardStake(address _rewardStake) external onlyOwner {
rewardStake = _rewardStake;
yfv.approve(rewardStake, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
}
function stake(uint256 amount, address referrer) public updateReward(msg.sender) checkNextEpoch checkStart {
require(amount > 0, "Cannot stake 0");
require(referrer != msg.sender, "You cannot refer yourself.");
super.tokenStake(amount);
emit Staked(msg.sender, amount);
if (rewardReferral != address(0) && referrer != address(0)) {
IYFVReferral(rewardReferral).setReferrer(msg.sender, referrer);
}
}
function stakeReward() public updateReward(msg.sender) checkNextEpoch checkStart {
require(rewardStake != address(0), "Dont know the staking pool");
uint256 reward = getReward();
yfv.safeTransferFrom(msg.sender, address(this), reward);
require(reward > 1, "Earned too little");
IYFVStake(rewardStake).stakeOnBehalf(msg.sender, reward);
}
function withdraw(uint256 amount) public updateReward(msg.sender) checkNextEpoch checkStart {
require(amount > 0, "Cannot withdraw 0");
super.tokenWithdraw(amount);
emit Withdrawn(msg.sender, amount);
}
function exit() external {
withdraw(balanceOf(msg.sender));
getReward();
}
function getReward() public updateReward(msg.sender) checkNextEpoch checkStart returns (uint256) {
uint256 reward = earned(msg.sender);
if (reward > 1) {
accumulatedStakingPower[msg.sender] = accumulatedStakingPower[msg.sender].add(rewards[msg.sender]);
rewards[msg.sender] = 0;
uint256 actualPaid = reward.mul(100 - REFERRAL_COMMISSION_PERCENT).div(100); // 99%
uint256 commission = reward - actualPaid; // 1%
yfv.safeTransfer(msg.sender, actualPaid);
emit RewardPaid(msg.sender, actualPaid);
address referrer = address(0);
if (rewardReferral != address(0)) {
referrer = IYFVReferral(rewardReferral).getReferrer(msg.sender);
}
if (referrer != address(0)) { // send commission to referrer
yfv.safeTransfer(referrer, commission);
emit RewardPaid(msg.sender, commission);
} else {// or burn
yfv.burn(commission);
emit Burned(commission);
}
vUSD.safeTransfer(msg.sender, reward.div(vUSD_REWARD_FRACTION_RATE));
return actualPaid;
}
return 0;
}
function nextRewardMultiplier() public view returns (uint16) {
if (rewardVote != address(0)) {
uint16 votingValue = IYFVVote(rewardVote).averageVotingValue(address(this), periodFinish);
if (votingValue > 0) return votingValue;
}
return 100;
}
modifier checkNextEpoch() {
if (block.timestamp >= periodFinish) {
uint16 rewardMultiplier = nextRewardMultiplier(); // 50% -> 200% (by vote)
currentEpochReward = EPOCH_REWARD.mul(rewardMultiplier).div(100); // x0.50 -> x2.00 (by vote)
if (totalAccumulatedReward.add(currentEpochReward) > TOTAL_REWARD) {
currentEpochReward = TOTAL_REWARD.sub(totalAccumulatedReward); // limit total reward
}
if (currentEpochReward > 0) {
yfv.mint(address(this), currentEpochReward);
vUSD.mint(address(this), currentEpochReward.div(vUSD_REWARD_FRACTION_RATE));
vETH.mint(address(this), currentEpochReward.div(vETH_REWARD_FRACTION_RATE));
totalAccumulatedReward = totalAccumulatedReward.add(currentEpochReward);
currentEpoch++;
}
rewardRate = currentEpochReward.div(DURATION);
lastUpdateTime = block.timestamp;
periodFinish = block.timestamp.add(DURATION);
emit RewardAdded(currentEpochReward);
}
_;
}
modifier checkStart() {
require(block.timestamp > starttime, "not start");
_;
}
function notifyRewardAmount(uint256 reward) external onlyOwner updateReward(address(0)) {
require(periodFinish == 0, "Only can call once to start staking");
currentEpochReward = reward;
if (totalAccumulatedReward.add(currentEpochReward) > TOTAL_REWARD) {
currentEpochReward = TOTAL_REWARD.sub(totalAccumulatedReward); // limit total reward
}
rewardRate = currentEpochReward.div(DURATION);
yfv.mint(address(this), currentEpochReward);
vUSD.mint(address(this), currentEpochReward.div(vUSD_REWARD_FRACTION_RATE));
vETH.mint(address(this), currentEpochReward.div(vETH_REWARD_FRACTION_RATE));
totalAccumulatedReward = totalAccumulatedReward.add(currentEpochReward);
currentEpoch++;
lastUpdateTime = block.timestamp;
periodFinish = block.timestamp.add(DURATION);
emit RewardAdded(currentEpochReward);
}
}
Read Contract
DURATION 0x1be05289 → uint256
EPOCH_REWARD 0x13eb6c88 → uint256
NUMBER_EPOCHS 0x0fcfc6a8 → uint8
REFERRAL_COMMISSION_PERCENT 0x53220a42 → uint256
TOTAL_REWARD 0xc8333bb2 → uint256
accumulatedStakingPower 0xe9b46e6d → uint256
balanceOf 0x70a08231 → uint256
claimedVETHRewards 0x67b37b7a → bool
currentEpoch 0x76671808 → uint8
currentEpochReward 0xe68e035b → uint256
earned 0x008cc262 → uint256
isOwner 0x8f32d59b → bool
lastTimeRewardApplicable 0x80faa57d → uint256
lastUpdateTime 0xc8f33c91 → uint256
nextRewardMultiplier 0x2e329bd3 → uint16
owner 0x8da5cb5b → address
periodFinish 0xebe2b12b → uint256
rewardPerToken 0xcd3daf9d → uint256
rewardPerTokenStored 0xdf136d65 → uint256
rewardRate 0x7b0a47ee → uint256
rewardReferral 0x0cdb43c4 → address
rewardStake 0x4e8999ed → address
rewardVote 0xc3dee20b → address
rewards 0x0700037d → uint256
stakingPower 0xffe48902 → uint256
starttime 0x8da58897 → uint256
totalAccumulatedReward 0x207e821d → uint256
totalSupply 0x18160ddd → uint256
userRewardPerTokenPaid 0x8b876347 → uint256
vETH 0x79a7d1be → address
vETHBalance 0x3d62bbe1 → uint256
vETH_REWARD_FRACTION_RATE 0x04e01d87 → uint256
vUSD 0xa457536c → address
vUSDBalance 0x2f38c8a1 → uint256
vUSD_REWARD_FRACTION_RATE 0xdc8d3683 → uint256
y 0xa56dfe4a → address
yfv 0x7318a730 → address
Write Contract 12 functions
These functions modify contract state and require a wallet transaction to execute.
claimVETHReward 0x1d8a6d10
No parameters
exit 0xe9fad8ee
No parameters
getReward 0x3d18b912
No parameters
returns: uint256
notifyRewardAmount 0x3c6b16ab
uint256 reward
renounceOwnership 0x715018a6
No parameters
setRewardReferral 0x002dcfb9
address _rewardReferral
setRewardStake 0x1d6851c6
address _rewardStake
setRewardVote 0x1961eaf9
address _rewardVote
stake 0x7acb7757
uint256 amount
address referrer
stakeReward 0x14f47dcc
No parameters
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x2e1a7d4d
uint256 amount
Recent Transactions
This address has 1 on-chain transactions, but only 1.3% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →