Address Contract Partially Verified
Address
0x4a9D6b95459eb9532B7E4d82Ca214a3b20fa2358
Balance
0 ETH
Nonce
1
Code Size
22689 bytes
Creator
0x3B30Bac3...De52 at tx 0x0c67f34d...7509dd
Indexed Transactions
0
Contract Bytecode
22689 bytes
0x6080604052600436106104da5760003560e01c8063891e99d811610281578063bd52e6101161015a578063d73dd623116100cc578063f06a29c911610085578063f06a29c914611173578063f2c2c0fc1461119d578063f2fde38b146111b2578063f6a7f6bb146111e5578063f8d6aed41461120f578063f8ebd04e14611257576104e1565b8063d73dd6231461106f578063dd62ed3e146110a8578063dff49b0b146110e3578063ec342ad014611116578063ede238851461112b578063ef037b9014611140576104e1565b8063ca84d5911161011e578063ca84d59114610f94578063cc14d68814610fbe578063cc8ead9b14610fd3578063cfb1c5eb14610ffd578063d246e27614611012578063d41c04fd1461103c576104e1565b8063bd52e61014610efc578063c3f344a814610f11578063c54e44eb14610f44578063c87341f214610f59578063c9faa7c514610f61576104e1565b8063997664d7116101f3578063a9059cbb116101b7578063a9059cbb14610df0578063ab6ed42814610e29578063b121d68114610e3e578063b147f40c14610e53578063ba9530a614610e68578063bb5f747b14610ec9576104e1565b8063997664d714610d875780639acfe6ef14610d9c578063a5b84a1714610db1578063a5d6fe0a14610dc6578063a7ec1bcd14610ddb576104e1565b806391e78dfa1161024557806391e78dfa14610cbc57806392273f3714610ce6578063957aa58c14610cfb57806395d89b4114610d105780639651e6b914610d255780639806e07c14610d51576104e1565b8063891e99d814610c205780638929801214610c355780638ade8d8c14610c7d5780638c25f24914610c925780638da5cb5b14610ca7576104e1565b80634baf782e116103b35780636f47caa1116103255780637a75572c116102e95780637a75572c14610b275780637d5a236d14610b5157806382f652ad14610b66578063834d472514610bae578063836e818014610bc35780638656b65314610bd8576104e1565b80636f47caa114610a5657806370a0823114610a825780637225ae9814610ab5578063722b2dd714610adf5780637362d9c814610af4576104e1565b8063522c906911610377578063522c906914610996578063532b581c146109c9578063582069df146109de5780635ac072d7146109f35780636618846314610a085780636bc01b5a14610a41576104e1565b80634baf782e146108d45780634bc76334146108e95780634c5a628c1461091c5780634f14ea4e146109315780634f49e6551461096a576104e1565b806323b872dd1161044c5780632ae331f2116104105780632ae331f2146107fc578063313ce56714610811578063337704a81461083c5780633d436214146108515780633df737f2146108845780633eaaf86b146108bf576104e1565b806323b872dd1461070b578063274217c91461074e5780632792949d14610793578063281be43f146107a857806329652e86146107d2576104e1565b80630e1cc0ee1161049e5780630e1cc0ee146106185780631336ffeb1461063f578063146ca5311461068457806318160ddd146106995780631f75d80d146106ae5780631ff1bfa1146106e1576104e1565b80630147435b146104e657806304943c0d1461050f57806306fdde0314610540578063093a9fbc146105ca578063095ea7b3146105df576104e1565b366104e157005b600080fd5b3480156104f257600080fd5b506104fb61126c565b604080519115158252519081900360200190f35b34801561051b57600080fd5b5061052461127c565b604080516001600160a01b039092168252519081900360200190f35b34801561054c57600080fd5b5061055561128b565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561058f578181015183820152602001610577565b50505050905090810190601f1680156105bc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156105d657600080fd5b50610524611321565b3480156105eb57600080fd5b506104fb6004803603604081101561060257600080fd5b506001600160a01b038135169060200135611335565b34801561062457600080fd5b5061062d61138a565b60408051918252519081900360200190f35b34801561064b57600080fd5b506106826004803603606081101561066257600080fd5b506001600160a01b03813581169160208101359091169060400135611390565b005b34801561069057600080fd5b5061062d61164c565b3480156106a557600080fd5b5061062d611652565b3480156106ba57600080fd5b5061062d600480360360208110156106d157600080fd5b50356001600160a01b0316611658565b3480156106ed57600080fd5b506106826004803603602081101561070457600080fd5b5035611802565b34801561071757600080fd5b506104fb6004803603606081101561072e57600080fd5b506001600160a01b03813581169160208101359091169060400135611866565b34801561075a57600080fd5b506106826004803603606081101561077157600080fd5b506001600160a01b038135811691602081013582169160409091013516611980565b34801561079f57600080fd5b506105246119d6565b3480156107b457600080fd5b50610682600480360360208110156107cb57600080fd5b50356119e5565b3480156107de57600080fd5b5061062d600480360360208110156107f557600080fd5b5035611aa5565b34801561080857600080fd5b5061062d611ab7565b34801561081d57600080fd5b50610826611abd565b6040805160ff9092168252519081900360200190f35b34801561084857600080fd5b50610682611ac6565b34801561085d57600080fd5b5061062d6004803603602081101561087457600080fd5b50356001600160a01b0316611c9c565b34801561089057600080fd5b50610682600480360360408110156108a757600080fd5b506001600160a01b0381358116916020013516611e1d565b3480156108cb57600080fd5b5061062d611eb5565b3480156108e057600080fd5b50610682611ebb565b3480156108f557600080fd5b506106826004803603602081101561090c57600080fd5b50356001600160a01b0316612089565b34801561092857600080fd5b50610682612115565b34801561093d57600080fd5b5061062d6004803603604081101561095457600080fd5b506001600160a01b038135169060200135612120565b34801561097657600080fd5b506106826004803603602081101561098d57600080fd5b503515156124d0565b3480156109a257600080fd5b5061062d600480360360208110156109b957600080fd5b50356001600160a01b0316612505565b3480156109d557600080fd5b5061062d612681565b3480156109ea57600080fd5b5061062d612687565b3480156109ff57600080fd5b5061052461268d565b348015610a1457600080fd5b506104fb60048036036040811015610a2b57600080fd5b506001600160a01b03813516906020013561269c565b348015610a4d57600080fd5b5061062d612774565b348015610a6257600080fd5b5061068260048036036020811015610a7957600080fd5b5035151561277a565b348015610a8e57600080fd5b5061062d60048036036020811015610aa557600080fd5b50356001600160a01b03166127af565b348015610ac157600080fd5b5061062d60048036036020811015610ad857600080fd5b50356127ca565b348015610aeb57600080fd5b5061062d6127dc565b348015610b0057600080fd5b5061068260048036036020811015610b1757600080fd5b50356001600160a01b03166127e2565b348015610b3357600080fd5b5061068260048036036020811015610b4a57600080fd5b5035612832565b348015610b5d57600080fd5b5061062d612967565b348015610b7257600080fd5b5061062d600480360360c0811015610b8957600080fd5b5080359060208101359060408101359060608101359060808101359060a0013561296d565b348015610bba57600080fd5b5061062d612a2a565b348015610bcf57600080fd5b5061062d612a30565b348015610be457600080fd5b5061062d600480360360c0811015610bfb57600080fd5b5080359060208101359060408101359060608101359060808101359060a00135612a36565b348015610c2c57600080fd5b50610682612acc565b348015610c4157600080fd5b5061062d600480360360c0811015610c5857600080fd5b5080359060208101359060408101359060608101359060808101359060a00135612ca1565b348015610c8957600080fd5b50610524612d57565b348015610c9e57600080fd5b5061062d612d66565b348015610cb357600080fd5b50610524612d6c565b348015610cc857600080fd5b5061068260048036036020811015610cdf57600080fd5b5035612d7b565b348015610cf257600080fd5b5061062d612eac565b348015610d0757600080fd5b506104fb612eb2565b348015610d1c57600080fd5b50610555612ec2565b348015610d3157600080fd5b5061068260048036036020811015610d4857600080fd5b50351515612f23565b348015610d5d57600080fd5b5061068260048036036060811015610d7457600080fd5b5080359060208101359060400135612f58565b348015610d9357600080fd5b5061062d613059565b348015610da857600080fd5b5061062d61305f565b348015610dbd57600080fd5b50610682613065565b348015610dd257600080fd5b5061062d61310f565b348015610de757600080fd5b5061062d613115565b348015610dfc57600080fd5b506104fb60048036036040811015610e1357600080fd5b506001600160a01b03813516906020013561311b565b348015610e3557600080fd5b5061062d613131565b348015610e4a57600080fd5b50610682613137565b348015610e5f57600080fd5b506104fb61325d565b348015610e7457600080fd5b50610eb0600480360360c0811015610e8b57600080fd5b5080359060208101359060408101359060608101359060808101359060a0013561326d565b6040805192835260208301919091528051918290030190f35b348015610ed557600080fd5b506104fb60048036036020811015610eec57600080fd5b50356001600160a01b03166132fe565b348015610f0857600080fd5b5061052461330b565b348015610f1d57600080fd5b5061062d60048036036020811015610f3457600080fd5b50356001600160a01b031661331a565b348015610f5057600080fd5b5061052461332c565b61068261333b565b348015610f6d57600080fd5b506104fb60048036036020811015610f8457600080fd5b50356001600160a01b0316613453565b348015610fa057600080fd5b5061062d60048036036020811015610fb757600080fd5b503561348c565b348015610fca57600080fd5b506105246138f6565b348015610fdf57600080fd5b5061062d60048036036020811015610ff657600080fd5b5035613905565b34801561100957600080fd5b50610682613917565b34801561101e57600080fd5b506106826004803603602081101561103557600080fd5b5035613956565b34801561104857600080fd5b506106826004803603602081101561105f57600080fd5b50356001600160a01b03166139ba565b34801561107b57600080fd5b506104fb6004803603604081101561109257600080fd5b506001600160a01b0381351690602001356139f3565b3480156110b457600080fd5b5061062d600480360360408110156110cb57600080fd5b506001600160a01b0381358116916020013516613a74565b3480156110ef57600080fd5b5061062d6004803603602081101561110657600080fd5b50356001600160a01b0316613a9f565b34801561112257600080fd5b5061062d613c20565b34801561113757600080fd5b5061062d613c2c565b34801561114c57600080fd5b506104fb6004803603602081101561116357600080fd5b50356001600160a01b0316613c32565b34801561117f57600080fd5b5061062d6004803603602081101561119657600080fd5b5035613c5e565b3480156111a957600080fd5b5061062d613f30565b3480156111be57600080fd5b50610682600480360360208110156111d557600080fd5b50356001600160a01b0316613f36565b3480156111f157600080fd5b506106826004803603602081101561120857600080fd5b5035613fdd565b34801561121b57600080fd5b5061062d600480360360c081101561123257600080fd5b5080359060208101359060408101359060608101359060808101359060a0013561410e565b34801561126357600080fd5b506104fb614194565b600f54600160b81b900460ff1681565b600e546001600160a01b031681565b60068054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156113175780601f106112ec57610100808354040283529160200191611317565b820191906000526020600020905b8154815290600101906020018083116112fa57829003601f168201915b5050505050905090565b60085461010090046001600160a01b031681565b3360008181526004602090815260408083206001600160a01b0387168085529083528184208690558151868152915193949093909260008051602061581c833981519152928290030190a35060015b92915050565b601b5481565b6000546001600160a01b031633146113a757600080fd5b6008546001600160a01b0383811661010090920416141561140f576040805162461bcd60e51b815260206004820152601760248201527f43616e6e6f742072656d6f766520757365727320464547000000000000000000604482015290519081900360640190fd5b6009546001600160a01b0383811691161415611472576040805162461bcd60e51b815260206004820152601860248201527f43616e6e6f742072656d6f766520757365727320664554480000000000000000604482015290519081900360640190fd5b600a546001600160a01b03838116911614156114d5576040805162461bcd60e51b815260206004820152601960248201527f43616e6e6f742072656d6f766520757365727320665553445400000000000000604482015290519081900360640190fd5b600d546001600160a01b0383811691161415611538576040805162461bcd60e51b815260206004820152601860248201527f43616e6e6f742072656d6f766520757365727320664254430000000000000000604482015290519081900360640190fd5b816001600160a01b031663a9059cbb84836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561158f57600080fd5b505af11580156115a3573d6000803e3d6000fd5b505050506040513d60208110156115b957600080fd5b505161160c576040805162461bcd60e51b815260206004820152601a60248201527f4572726f7220696e2072657472696576696e6720746f6b656e73000000000000604482015290519081900360640190fd5b600080546040516001600160a01b03909116914780156108fc02929091818181858888f19350505050158015611646573d6000803e3d6000fd5b50505050565b60165481565b60055490565b60006001600160a01b03821661169f5760405162461bcd60e51b815260040180806020018281038252602281526020018061574a6022913960400191505060405180910390fd5b600e54604080516370a0823160e01b81526001600160a01b038581166004830152915160009392909216916370a0823191602480820192602092909190829003018186803b1580156116f057600080fd5b505afa158015611704573d6000803e3d6000fd5b505050506040513d602081101561171a57600080fd5b50516001600160a01b0384166000908152602b602090815260408083206006015460155460001982018552602d909352908320546017549495509093611777929161177191879161176b9190614225565b9061426e565b906142c7565b90506015546117ab8461176b602d60006001880381526020019081526020016000205460175461422590919063ffffffff16565b816117b257fe5b6001600160a01b0387166000908152602b602052604090206007015491900691909101906117f7906117e5908390614309565b6117f26021546064614363565b614476565b93505050505b919050565b6000546001600160a01b0316331461181957600080fd5b80611861576040805162461bcd60e51b81526020600482015260136024820152722cb7ba9031b0b73737ba103a3ab9371037b33360691b604482015290519081900360640190fd5b601355565b6000336001600160a01b03851614806118a257506001600160a01b03841660009081526004602090815260408083203384529091529020548211155b6118ab57600080fd5b6118b6848484614538565b336001600160a01b038516148015906118f457506001600160a01b038416600090815260046020908152604080832033845290915290205460001914155b15611976576001600160a01b0384166000908152600460209081526040808320338452909152902054611927908361460b565b6001600160a01b038581166000908152600460209081526040808320338085529083529281902085905580519485525192871693919260008051602061581c8339815191529281900390910190a35b5060019392505050565b6000546001600160a01b0316331461199757600080fd5b600d80546001600160a01b039485166001600160a01b0319918216179091556009805493851693821693909317909255600a8054919093169116179055565b600d546001600160a01b031681565b6000546001600160a01b031633146119fc57600080fd5b601254611a42576040805162461bcd60e51b815260206004820152600f60248201526e043616e6e6f742073657420746f203608c1b604482015290519081900360640190fd5b660aa87bee5380006012541115611aa0576040805162461bcd60e51b815260206004820152601a60248201527f43616e6e6f7420736574206f76657220302e3030332066455448000000000000604482015290519081900360640190fd5b601255565b602c6020526000908152604090205481565b60265481565b60085460ff1690565b60026001541415611b1e576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026001556000611b2e3361466d565b90508015611c9557336000908152602b6020526040902060070154611b54908290614309565b336000818152602b60209081526040808320600701839055600a54815163a9059cbb60e01b815260048101959095526024850186905290519495506001600160a01b03169363a9059cbb93604480820194918390030190829087803b158015611bbc57600080fd5b505af1158015611bd0573d6000803e3d6000fd5b505050506040513d6020811015611be657600080fd5b5051611c235760405162461bcd60e51b815260040180806020018281038252602c8152602001806156fd602c913960400191505060405180910390fd5b604080513381526020810183905281517f63dea4778b4fa18f878b07a9bfec3e95f506efb9d4078c4cdfac77cd013398d9929181900390910190a1611c6a6026548261460b565b602655336000908152602b6020526040902060048101829055601a5460068201556017546005909101555b5060018055565b60006001600160a01b038216611ce35760405162461bcd60e51b815260040180806020018281038252602281526020018061574a6022913960400191505060405180910390fd5b600e54604080516370a0823160e01b81526001600160a01b038581166004830152915160009392909216916370a0823191602480820192602092909190829003018186803b158015611d3457600080fd5b505afa158015611d48573d6000803e3d6000fd5b505050506040513d6020811015611d5e57600080fd5b50516001600160a01b0384166000908152602b60209081526040808320600a015460155460001982018552602e90935290832054601b549495509093611daf929161177191879161176b9190614225565b9050601554611de38461176b602e600060018803815260200190815260200160002054601b5461422590919063ffffffff16565b81611dea57fe5b6001600160a01b0387166000908152602b60205260409020600b015491900691909101906117f7906117e5908390614309565b6000546001600160a01b03163314611e3457600080fd5b6001600160a01b038216611e87576040805162461bcd60e51b81526020600482015260156024820152741cd95d1d1a5b99c80c081d1bc818dbdb9d1c9858dd605a1b604482015290519081900360640190fd5b602f80546001600160a01b039384166001600160a01b031991821617909155600c8054929093169116179055565b60055481565b60026001541415611f13576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026001556000611f23336147ef565b90508015611c9557336000908152602b6020526040902060030154611f49908290614309565b336000818152602b60209081526040808320600301839055600954815163a9059cbb60e01b815260048101959095526024850186905290519495506001600160a01b03169363a9059cbb93604480820194918390030190829087803b158015611fb157600080fd5b505af1158015611fc5573d6000803e3d6000fd5b505050506040513d6020811015611fdb57600080fd5b50516120185760405162461bcd60e51b815260040180806020018281038252602c8152602001806156fd602c913960400191505060405180910390fd5b604080513381526020810183905281517f8a0128b5f12decc7d739e546c0521c3388920368915393f80120bc5b408c7c9e929181900390910190a161205f6025548261460b565b602555336000908152602b6020526040902090815560165460028201556011546001918201558055565b6000546001600160a01b031633146120a057600080fd5b6001600160a01b0381166120f3576040805162461bcd60e51b81526020600482015260156024820152741cd95d1d1a5b99c80c081d1bc818dbdb9d1c9858dd605a1b604482015290519081900360640190fd5b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b61211e33614971565b565b600080600860019054906101000a90046001600160a01b03166001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561218557600080fd5b505afa158015612199573d6000803e3d6000fd5b505050506040513d60208110156121af57600080fd5b5051336000908152602b60205260409020600c015490915060ff6101009091041615156001146121de57600080fd5b600f54600160a81b900460ff1615156001141561225e57600f60009054906101000a90046001600160a01b03166001600160a01b031663dda6ae206040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561224557600080fd5b505af1158015612259573d6000803e3d6000fd5b505050505b612266613917565b600061229d8261227f670de0b6b3a76400006019614476565b600554612295670de0b6b3a76400006019614476565b88600061296d565b90506122d4826122b6670de0b6b3a76400006019614476565b6005546122cc670de0b6b3a76400006019614476565b856000612ca1565b600e54604080516370a0823160e01b815233600482015290519295506001600160a01b03909116916370a0823191602480820192602092909190829003018186803b15801561232257600080fd5b505afa158015612336573d6000803e3d6000fd5b505050506040513d602081101561234c57600080fd5b50518111156123a2576040805162461bcd60e51b815260206004820152601960248201527f596f7520646f6e2774206861766520656e6f7567682046454700000000000000604482015290519081900360640190fd5b6123ab816149b3565b6123b481614a7e565b6008546040805163a9059cbb60e01b81526001600160a01b0388811660048301526024820187905291516101009093049091169163a9059cbb916044808201926020929091908290030181600087803b15801561241057600080fd5b505af1158015612424573d6000803e3d6000fd5b505050506040513d602081101561243a57600080fd5b505161248d576040805162461bcd60e51b815260206004820152601a60248201527f4572726f7220696e20756e2d7374616b696e6720746f6b656e73000000000000604482015290519081900360640190fd5b604080513381526020810183905281517f4c48d8823de8aa74e6ea4bed3a0c422e95a3d1e10f8f3e47dc7e2fe779be9514929181900390910190a1505092915050565b6000546001600160a01b031633146124e757600080fd5b600f8054911515600160a81b0260ff60a81b19909216919091179055565b60006001600160a01b03821661254c5760405162461bcd60e51b815260040180806020018281038252602281526020018061574a6022913960400191505060405180910390fd5b600854604080516370a0823160e01b8152306004820152905160009261010090046001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561259c57600080fd5b505afa1580156125b0573d6000803e3d6000fd5b505050506040513d60208110156125c657600080fd5b505190506000612679826125e3670de0b6b3a76400006019614476565b6005546125f9670de0b6b3a76400006019614476565b600e54604080516370a0823160e01b81526001600160a01b038c81166004830152915191909216916370a08231916024808301926020929190829003018186803b15801561264657600080fd5b505afa15801561265a573d6000803e3d6000fd5b505050506040513d602081101561267057600080fd5b50516000612ca1565b949350505050565b601e5481565b60135481565b600b546001600160a01b031681565b3360009081526004602090815260408083206001600160a01b0386168452909152812054808311156126f1573360009081526004602090815260408083206001600160a01b0388168452909152812055612720565b6126fb818461460b565b3360009081526004602090815260408083206001600160a01b03891684529091529020555b3360008181526004602090815260408083206001600160a01b03891680855290835292819020548151908152905192939260008051602061581c833981519152929181900390910190a35060019392505050565b60255481565b6000546001600160a01b0316331461279157600080fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6001600160a01b031660009081526003602052604090205490565b602d6020526000908152604090205481565b60235481565b6127eb336132fe565b6128265760405162461bcd60e51b81526004018080602001828103825260408152602001806157af6040913960400191505060405180910390fd5b61282f81614b0f565b50565b61283b336132fe565b6128765760405162461bcd60e51b81526004018080602001828103825260408152602001806157af6040913960400191505060405180910390fd5b600954604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b1580156128d057600080fd5b505af11580156128e4573d6000803e3d6000fd5b505050506040513d60208110156128fa57600080fd5b50516129375760405162461bcd60e51b815260040180806020018281038252603081526020018061583c6030913960400191505060405180910390fd5b6000612949826117f260636064614363565b905061295760255482614b51565b60255561296381614b9e565b5050565b60285481565b60008061297a8786614363565b90506000612999612993670de0b6b3a76400008461460b565b85614476565b905060006129b8866129b3670de0b6b3a76400008561460b565b614363565b905060006129c68b8361460b565b905060006129d4828d614363565b905060006129e28287614c72565b905060006129f0828d614476565b905060006129fe8d8361460b565b9050612a17816129b3670de0b6b3a7640000600061460b565b9f9e505050505050505050505050505050565b60175481565b601a5481565b600080612a438786614363565b90506000612a5c612993670de0b6b3a76400008461460b565b90506000612a76866117f2670de0b6b3a76400008561460b565b90506000612a848b83614b51565b90506000612a92828d614363565b90506000612aa08287614c72565b90506000612aae828d614476565b9050612aba818d61460b565b9e9d5050505050505050505050505050565b60026001541415612b24576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026001556000612b3433614cdd565b90508015611c9557336000908152602b60205260409020600b0154612b5a908290614309565b336000818152602b60209081526040808320600b01839055600d54815163a9059cbb60e01b815260048101959095526024850186905290519495506001600160a01b03169363a9059cbb93604480820194918390030190829087803b158015612bc257600080fd5b505af1158015612bd6573d6000803e3d6000fd5b505050506040513d6020811015612bec57600080fd5b5051612c295760405162461bcd60e51b815260040180806020018281038252602c8152602001806156fd602c913960400191505060405180910390fd5b604080513381526020810183905281517fa6c44e9cd31aeb4add8b7c7e7edf3f3ed16d5384424237062b8f44853ff764b2929181900390910190a1612c706027548261460b565b602755336000908152602b6020526040902060088101829055601e54600a820155601b546009909101555060018055565b600080612cae8786614363565b90506000612cc9856117f2670de0b6b3a7640000600061460b565b90506000612cd7888361460b565b90506000612ce5828a614363565b90506000612d0482612cff670de0b6b3a764000088614363565b614c72565b90506000612d12828e614476565b90506000612d208e8361460b565b90506000612d3f612d39670de0b6b3a76400008a61460b565b8b614476565b9050612a17826117f2670de0b6b3a76400008461460b565b600f546001600160a01b031681565b60225481565b6000546001600160a01b031681565b612d84336132fe565b612dbf5760405162461bcd60e51b81526004018080602001828103825260408152602001806157af6040913960400191505060405180910390fd5b600d54604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b158015612e1957600080fd5b505af1158015612e2d573d6000803e3d6000fd5b505050506040513d6020811015612e4357600080fd5b5051612e805760405162461bcd60e51b815260040180806020018281038252603081526020018061583c6030913960400191505060405180910390fd5b6000612e92826117f260636064614363565b9050612ea060275482614b51565b60275561296381614e5f565b602a5481565b600f54600160a01b900460ff1681565b60078054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156113175780601f106112ec57610100808354040283529160200191611317565b6000546001600160a01b03163314612f3a57600080fd5b600f8054911515600160b01b0260ff60b01b19909216919091179055565b6000546001600160a01b03163314612f6f57600080fd5b8215801590612f7d57508115155b8015612f8857508015155b612fcf576040805162461bcd60e51b81526020600482015260136024820152722cb7ba9031b0b73737ba103a3ab9371037b33360691b604482015290519081900360640190fd5b6706f05b59d3b200008310158015612ff057506801158e460913d000008210155b8015613003575066038d7ea4c680008110155b61304b576040805162461bcd60e51b81526020600482015260146024820152734d757374206265206f766572206d696e696d756d60601b604482015290519081900360640190fd5b602292909255602355602455565b60115481565b60125481565b600f54600160b81b900460ff1615156001141561211e5761308a602754602454614b51565b600d54604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b1580156130d557600080fd5b505afa1580156130e9573d6000803e3d6000fd5b505050506040513d60208110156130ff57600080fd5b5051111561211e5761211e614f2d565b60105481565b60295481565b6000613128338484614538565b50600192915050565b60215481565b613145602554602254614b51565b600954604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561319057600080fd5b505afa1580156131a4573d6000803e3d6000fd5b505050506040513d60208110156131ba57600080fd5b505111156131ca576131ca614fcd565b6131d8602654602354614b51565b600a54604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561322357600080fd5b505afa158015613237573d6000803e3d6000fd5b505050506040513d602081101561324d57600080fd5b5051111561211e5761211e61506d565b600f54600160a81b900460ff1681565b600080600061327c8887614363565b90506000613292670de0b6b3a76400008661460b565b905061329e8682614476565b905060006132b08b6129b38d85614b51565b905060006132be8285614c72565b905060006132d4670de0b6b3a76400008361460b565b90506132e08b82614476565b96506132ec898561460b565b95505050505050965096945050505050565b600061138460028361510d565b600c546001600160a01b031681565b601f6020526000908152604090205481565b600a546001600160a01b031681565b601254341461337b5760405162461bcd60e51b815260040180806020018281038252602d8152602001806157ef602d913960400191505060405180910390fd5b602f54604080516311c42a9960e01b81523360048201526064602482015281516001600160a01b03909316926311c42a999234926044808201939182900301818588803b1580156133cb57600080fd5b505af11580156133df573d6000803e3d6000fd5b50505050506040513d60408110156133f657600080fd5b5050336000818152602b6020908152604091829020600c01805461ff0019166101001790558151928352349083015280517feb679799ce0ccbaa7912a3e313e4d8216146af50a959d75b356da3d4f9635aa99281900390910190a1565b6001600160a01b0381166000908152602b60205260408120600c0154610100900460ff1615613484575060016117fd565b5060006117fd565b600081600860019054906101000a90046001600160a01b03166001600160a01b03166370a08231336040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156134f157600080fd5b505afa158015613505573d6000803e3d6000fd5b505050506040513d602081101561351b57600080fd5b50511015613570576040805162461bcd60e51b815260206004820152601a60248201527f596f7520646f206e6f74206861766520656e6f75676820464547000000000000604482015290519081900360640190fd5b336000908152602b60205260409020600c015460ff61010090910416151560011461359a57600080fd5b600f54600160a01b900460ff1615156001146135b557600080fd5b60006135cb600a61177160105461176b87615174565b905060006135d98483614225565b90506000600860019054906101000a90046001600160a01b03166001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561363f57600080fd5b505afa158015613653573d6000803e3d6000fd5b505050506040513d602081101561366957600080fd5b5051905061367633615197565b6000613681336147ef565b336000818152602b602052604081206003810180548501905583815560115460018201556016546002909101559192506136ba9061466d565b336000818152602b6020526040812060078101805485019055600481018490556017546005820155601a546006909101559192506136f790614cdd565b336000908152602b60205260409020600b810180548301905560088101829055601b546009820155601e54600a90910155905061375f84613741670de0b6b3a76400006019614476565b600554613757670de0b6b3a76400006019614476565b896000612a36565b600854604080516323b872dd60e01b8152336004820152306024820152604481018c905290519299506101009091046001600160a01b0316916323b872dd916064808201926020929091908290030181600087803b1580156137c057600080fd5b505af11580156137d4573d6000803e3d6000fd5b505050506040513d60208110156137ea57600080fd5b50516138275760405162461bcd60e51b81526004018080602001828103825260328152602001806156cb6032913960400191505060405180910390fd5b613830876151e3565b600e546040805163a9059cbb60e01b8152336004820152602481018a905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561388457600080fd5b505af1158015613898573d6000803e3d6000fd5b505050506040513d60208110156138ae57600080fd5b505060408051338152602081018a905281517f4031c63bb53dc5dfada7ef8d75bef8c44d0283658c1585fc74107ed5b75e97c8929181900390910190a1505050505050919050565b6009546001600160a01b031681565b602e6020526000908152604090205481565b61391f613137565b613927611ebb565b61392f611ac6565b600f54600160b81b900460ff1615156001141561211e5761394e613065565b61211e612acc565b6000546001600160a01b0316331461396d57600080fd5b806139b5576040805162461bcd60e51b81526020600482015260136024820152722cb7ba9031b0b73737ba103a3ab9371037b33360691b604482015290519081900360640190fd5b602155565b6000546001600160a01b031633146139d157600080fd5b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b3360009081526004602090815260408083206001600160a01b0386168452909152812054613a219083614b51565b3360008181526004602090815260408083206001600160a01b03891680855290835292819020859055805194855251919360008051602061581c833981519152929081900390910190a350600192915050565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006001600160a01b038216613ae65760405162461bcd60e51b815260040180806020018281038252602281526020018061574a6022913960400191505060405180910390fd5b600e54604080516370a0823160e01b81526001600160a01b038581166004830152915160009392909216916370a0823191602480820192602092909190829003018186803b158015613b3757600080fd5b505afa158015613b4b573d6000803e3d6000fd5b505050506040513d6020811015613b6157600080fd5b50516001600160a01b0384166000908152602b602090815260408083206002015460155460001982018552602c909352908320546011549495509093613bb2929161177191879161176b9190614225565b9050601554613be68461176b602c60006001880381526020019081526020016000205460115461422590919063ffffffff16565b81613bed57fe5b6001600160a01b0387166000908152602b602052604090206003015491900691909101906117f7906117e5908390614309565b670de0b6b3a764000081565b60275481565b6001600160a01b0381166000908152602b60205260408120600c015460ff1615613484575060016117fd565b600080546001600160a01b03163314613c7657600080fd5b600f54600160a01b900460ff1615613cc9576040805162461bcd60e51b815260206004820152601160248201527043616e206f6e6c7920757365206f6e636560781b604482015290519081900360640190fd5b600854604080516323b872dd60e01b81523360048201523060248201526044810185905290516101009092046001600160a01b0316916323b872dd916064808201926020929091908290030181600087803b158015613d2757600080fd5b505af1158015613d3b573d6000803e3d6000fd5b505050506040513d6020811015613d5157600080fd5b5051613d8e5760405162461bcd60e51b81526004018080602001828103825260328152602001806156cb6032913960400191505060405180910390fd5b6000613da4600a61177160105461176b87615174565b90506000613db28483614225565b9050613dbd33615197565b613dc6816151e3565b600f805460ff60a01b1916600160a01b179055600e546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b158015613e2d57600080fd5b505af1158015613e41573d6000803e3d6000fd5b505050506040513d6020811015613e5757600080fd5b5050600954600c546040805163095ea7b360e01b81526001600160a01b0392831660048201527002f050fe938943acc45f6556800000000060248201529051919092169163095ea7b39160448083019260209291908290030181600087803b158015613ec257600080fd5b505af1158015613ed6573d6000803e3d6000fd5b505050506040513d6020811015613eec57600080fd5b5050604080513381526020810183905281517f3150d58b3cd38451a3dd7d23dda6c3234fad144a05d309c8327e688c61bfda51929181900390910190a15050919050565b60245481565b6000546001600160a01b03163314613f4d57600080fd5b6001600160a01b038116613f925760405162461bcd60e51b815260040180806020018281038252602281526020018061574a6022913960400191505060405180910390fd5b600080546001600160a01b0319166001600160a01b0383169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b613fe6336132fe565b6140215760405162461bcd60e51b81526004018080602001828103825260408152602001806157af6040913960400191505060405180910390fd5b600a54604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b15801561407b57600080fd5b505af115801561408f573d6000803e3d6000fd5b505050506040513d60208110156140a557600080fd5b50516140e25760405162461bcd60e51b815260040180806020018281038252603081526020018061583c6030913960400191505060405180910390fd5b60006140f4826117f260636064614363565b905061410260265482614b51565b60265561296381615258565b60008061411b8588614363565b90506000614129878661460b565b905060006141378883614363565b905060006141458285614c72565b905061415981670de0b6b3a764000061460b565b90506141658b82614476565b9050614179670de0b6b3a76400008761460b565b94506141858186614363565b9b9a5050505050505050505050565b600f54600160b01b900460ff1681565b6141ae828261510d565b15614200576040805162461bcd60e51b815260206004820152601f60248201527f526f6c65733a206163636f756e7420616c72656164792068617320726f6c6500604482015290519081900360640190fd5b6001600160a01b0316600090815260209190915260409020805460ff19166001179055565b600061426783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250615326565b9392505050565b60008261427d57506000611384565b8282028284828161428a57fe5b04146142675760405162461bcd60e51b815260040180806020018281038252602181526020018061576c6021913960400191505060405180910390fd5b600061426783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506153bd565b600082820183811015614267576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000816143a6576040805162461bcd60e51b815260206004820152600c60248201526b4552525f4449565f5a45524f60a01b604482015290519081900360640190fd5b670de0b6b3a764000083028315806143ce5750670de0b6b3a76400008482816143cb57fe5b04145b614412576040805162461bcd60e51b815260206004820152601060248201526f11549497d1125597d25395115493905360821b604482015290519081900360640190fd5b60028304810181811015614460576040805162461bcd60e51b815260206004820152601060248201526f11549497d1125597d25395115493905360821b604482015290519081900360640190fd5b600084828161446b57fe5b049695505050505050565b600082820283158061449057508284828161448d57fe5b04145b6144d4576040805162461bcd60e51b815260206004820152601060248201526f4552525f4d554c5f4f564552464c4f5760801b604482015290519081900360640190fd5b6706f05b59d3b20000810181811015614527576040805162461bcd60e51b815260206004820152601060248201526f4552525f4d554c5f4f564552464c4f5760801b604482015290519081900360640190fd5b6000670de0b6b3a76400008261446b565b6001600160a01b03831660009081526003602052604090205481111561455d57600080fd5b6001600160a01b038316600090815260036020526040902054614580908261460b565b6001600160a01b0380851660009081526003602052604080822093909355908416815220546145af9082614b51565b6001600160a01b0380841660008181526003602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600061461a8585615422565b915091508015614665576040805162461bcd60e51b81526020600482015260116024820152704552525f5355425f554e444552464c4f5760781b604482015290519081900360640190fd5b509392505050565b60006001600160a01b0382166146b45760405162461bcd60e51b815260040180806020018281038252602281526020018061574a6022913960400191505060405180910390fd5b600e54604080516370a0823160e01b815233600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156146ff57600080fd5b505afa158015614713573d6000803e3d6000fd5b505050506040513d602081101561472957600080fd5b50516001600160a01b0384166000908152602b602090815260408083206006015460155460001982018552602d90935290832054601754949550909361477a929161177191879161176b9190614225565b90506015546147ae8461176b602d60006001880381526020019081526020016000205460175461422590919063ffffffff16565b816147b557fe5b6001600160a01b0387166000908152602b6020526040902060070180549290910690910190556021546117f79082906117f2906064614363565b60006001600160a01b0382166148365760405162461bcd60e51b815260040180806020018281038252602281526020018061574a6022913960400191505060405180910390fd5b600e54604080516370a0823160e01b815233600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561488157600080fd5b505afa158015614895573d6000803e3d6000fd5b505050506040513d60208110156148ab57600080fd5b50516001600160a01b0384166000908152602b602090815260408083206002015460155460001982018552602c9093529083205460115494955090936148fc929161177191879161176b9190614225565b90506015546149308461176b602c60006001880381526020019081526020016000205460115461422590919063ffffffff16565b8161493757fe5b6001600160a01b0387166000908152602b6020526040902060030180549290910690910190556021546117f79082906117f2906064614363565b61497c600282615447565b6040516001600160a01b038216907f0a8eb35e5ca14b3d6f28e4abf2f128dbab231a58b56e89beb5d636115001e16590600090a250565b600e54604080516323b872dd60e01b81523360048201523060248201526044810184905290516000926001600160a01b0316916323b872dd91606480830192602092919082900301818787803b158015614a0c57600080fd5b505af1158015614a20573d6000803e3d6000fd5b505050506040513d6020811015614a3657600080fd5b5051905080612963576040805162461bcd60e51b815260206004820152600f60248201526e4552525f45524332305f46414c534560881b604482015290519081900360640190fd5b30600090815260036020526040902054811115614a9a57600080fd5b30600090815260036020526040902054614ab4908261460b565b30600090815260036020526040902055600554614ad1908261460b565b60055560408051828152905160009130917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350565b614b1a6002826141a4565b6040516001600160a01b038216907f22380c05984257a1cb900161c713dd71d39e74820f1aea43bd3f1bdd2096129990600090a250565b600082820183811015614267576040805162461bcd60e51b815260206004820152601060248201526f4552525f4144445f4f564552464c4f5760801b604482015290519081900360640190fd5b600554601454601554600091614bbf91614bb990869061426e565b90614309565b90506000614bcd82846142c7565b9050614bd982846154ae565b601455601154614be99082614309565b601155601654600019016000908152602c6020526040902054614c0c9082614309565b601680546000908152602c602090815260409182902093909355905481519081529182018690523382820152517fddf8c05dcee82ec75482e095e6c06768c848d5a7df7147686033433d141328b69181900360600190a150506016805460010190555050565b600080614c7e836154f0565b90506000614c8c848361460b565b90506000614ca286614c9d8561550b565b615519565b905081614cb3579250611384915050565b6305f5e1006000614cc5888584615570565b9050614cd18382614476565b98975050505050505050565b60006001600160a01b038216614d245760405162461bcd60e51b815260040180806020018281038252602281526020018061574a6022913960400191505060405180910390fd5b600e54604080516370a0823160e01b815233600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015614d6f57600080fd5b505afa158015614d83573d6000803e3d6000fd5b505050506040513d6020811015614d9957600080fd5b50516001600160a01b0384166000908152602b60209081526040808320600a015460155460001982018552602e90935290832054601b549495509093614dea929161177191879161176b9190614225565b9050601554614e1e8461176b602e600060018803815260200190815260200160002054601b5461422590919063ffffffff16565b81614e2557fe5b6001600160a01b0387166000908152602b60205260409020600b0180549290910690910190556021546117f79082906117f2906064614363565b600554601c54601554600091614e7a91614bb990869061426e565b90506000614e8882846142c7565b9050614e9482846154ae565b601c55601b54614ea49082614309565b601b55601e54600019016000908152602e6020526040902054614ec79082614309565b601e80546000908152602e602090815260409182902093909355905481519081529182018690523382820152517f94cccf17fe4ce41005009d430aef95ed21c30f57532c2291f2d53f61476b1b0d9181900360600190a15050601e805460010190555050565b600d54604080516370a0823160e01b81523060048201529051600092614fb3926001600160a01b03909116916370a0823191602480820192602092909190829003018186803b158015614f7f57600080fd5b505afa158015614f93573d6000803e3d6000fd5b505050506040513d6020811015614fa957600080fd5b505160275461460b565b9050614fc160275482614b51565b60275561282f81614e5f565b600954604080516370a0823160e01b81523060048201529051600092615053926001600160a01b03909116916370a0823191602480820192602092909190829003018186803b15801561501f57600080fd5b505afa158015615033573d6000803e3d6000fd5b505050506040513d602081101561504957600080fd5b505160255461460b565b905061506160255482614b51565b60255561282f81614b9e565b600a54604080516370a0823160e01b815230600482015290516000926150f3926001600160a01b03909116916370a0823191602480820192602092909190829003018186803b1580156150bf57600080fd5b505afa1580156150d3573d6000803e3d6000fd5b505050506040513d60208110156150e957600080fd5b505160265461460b565b905061510160265482614b51565b60265561282f81615258565b60006001600160a01b0382166151545760405162461bcd60e51b815260040180806020018281038252602281526020018061578d6022913960400191505060405180910390fd5b506001600160a01b03166000908152602091909152604090205460ff1690565b60008061518283606461564e565b9050600061267961271061177184606461426e565b60006151a282613c32565b90508061296357336000908152601f602090815260408083204290556001600160a01b0385168352602b9091529020600c01805460ff191660011790555050565b306000908152600360205260409020546151fd9082614b51565b3060009081526003602052604090205560055461521a9082614b51565b60055560408051828152905130916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350565b60055460185460155460009161527391614bb990869061426e565b9050600061528182846142c7565b905061528d82846154ae565b60185560175461529d9082614309565b601755601a54600019016000908152602d60205260409020546152c09082614309565b601a80546000908152602d602090815260409182902093909355905481519081529182018690523382820152517fdcd344349dc4f4c9aac80cae728f21723d5adf5224b31d3a7f6f33f36adda5209181900360600190a15050601a805460010190555050565b600081848411156153b55760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561537a578181015183820152602001615362565b50505050905090810190601f1680156153a75780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000818361540c5760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561537a578181015183820152602001615362565b50600083858161541857fe5b0495945050505050565b6000808284106154385750508082036000615440565b505081810360015b9250929050565b615451828261510d565b61548c5760405162461bcd60e51b81526004018080602001828103825260218152602001806157296021913960400191505060405180910390fd5b6001600160a01b0316600090815260209190915260409020805460ff19169055565b600061426783836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250615668565b6000670de0b6b3a76400006155048361550b565b0292915050565b670de0b6b3a7640000900490565b6000806002830661553257670de0b6b3a7640000615534565b835b90506002830492505b82156142675761554d8485614476565b93506002830615615565576155628185614476565b90505b60028304925061553d565b600082818061558787670de0b6b3a7640000615422565b9092509050670de0b6b3a764000080600060015b88841061563f576000670de0b6b3a7640000820290506000806155cf8a6155ca85670de0b6b3a764000061460b565b615422565b915091506155e1876117f2848c614476565b96506155ed8784614363565b9650866155fc5750505061563f565b8715615606579315935b8015615610579315935b841561562757615620868861460b565b9550615634565b6156318688614b51565b95505b50505060010161559b565b50909998505050505050505050565b600081826001848601038161565f57fe5b04029392505050565b600081836156b75760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561537a578181015183820152602001615362565b508284816156c157fe5b0694935050505056fe546f6b656e732063616e6e6f74206265207472616e736665727265642066726f6d207573657220666f72206c6f636b696e674552524f523a206572726f7220696e2073656e64696e67207265776172642066726f6d20636f6e7472616374526f6c65733a206163636f756e7420646f6573206e6f74206861766520726f6c6545524332303a2073656e64696e6720746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77526f6c65733a206163636f756e7420697320746865207a65726f206164647265737357686974656c69737441646d696e526f6c653a2063616c6c657220646f6573206e6f742068617665207468652057686974656c69737441646d696e20726f6c65596f75206d757374206465706f7369742074686520726967687420616d6f756e7420746f2061637469766174658c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925546f6b656e732063616e6e6f74206265207472616e736665727265642066726f6d2066756e646572206163636f756e74a2646970667358221220166f05584d011fabf94648975701bd376286f2525e8a76c3d5387dcc00cf6e7564736f6c63430007060033
Verified Source Code Partial Match
Compiler: v0.7.6+commit.7338295f
EVM: istanbul
Optimization: Yes (200 runs)
FEGstakeV2.sol 1243 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.7.6;
abstract contract ReentrancyGuard {
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor () {
_status = _NOT_ENTERED;
}
modifier nonReentrant() {
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
_status = _ENTERED;
_;
_status = _NOT_ENTERED;
}
}
// ----------------------------------------------------------------------------
// SafeMath library
// ----------------------------------------------------------------------------
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
function ceil(uint a, uint m) internal pure returns (uint r) {
return (a + m - 1) / m * m;
}
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address payable _newOwner) public onlyOwner {
require(_newOwner != address(0), "ERC20: sending to the zero address");
owner = _newOwner;
emit OwnershipTransferred(msg.sender, _newOwner);
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// ----------------------------------------------------------------------------
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address tokenOwner) external view returns (uint256 balance);
function allowance(address tokenOwner, address spender) external view returns (uint256 remaining);
function transfer(address to, uint256 tokens) external returns (bool success);
function approve(address spender, uint256 tokens) external returns (bool success);
function transferFrom(address from, address to, uint256 tokens) external returns (bool success);
function burnTokens(uint256 _amount) external;
function calculateFeesBeforeSend(
address sender,
address recipient,
uint256 amount
) external view returns (uint256, uint256);
event Transfer(address indexed from, address indexed to, uint256 tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint256 tokens);
}
interface regreward {
function distributeV2() external;
}
interface FEGex2 {
function BUY(
address to,
uint minAmountOut
)
external payable
returns (uint tokenAmountOut, uint spotPriceAfter);
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and assisted
// token transfers
// ----------------------------------------------------------------------------
library Roles {
struct Role {
mapping (address => bool) bearer;
}
function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true;
}
function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}
function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0), "Roles: account is the zero address");
return role.bearer[account];
}
}
contract WhitelistAdminRole is Owned {
using Roles for Roles.Role;
event WhitelistAdminAdded(address indexed account);
event WhitelistAdminRemoved(address indexed account);
Roles.Role private _whitelistAdmins;
constructor () {
_addWhitelistAdmin(msg.sender);
}
modifier onlyWhitelistAdmin() {
require(isWhitelistAdmin(msg.sender), "WhitelistAdminRole: caller does not have the WhitelistAdmin role");
_;
}
function isWhitelistAdmin(address account) public view returns (bool) {
return _whitelistAdmins.has(account);
}
function addWhitelistAdmin(address account) public onlyWhitelistAdmin {
_addWhitelistAdmin(account);
}
function renounceWhitelistAdmin() public {
_removeWhitelistAdmin(msg.sender);
}
function _addWhitelistAdmin(address account) internal {
_whitelistAdmins.add(account);
emit WhitelistAdminAdded(account);
}
function _removeWhitelistAdmin(address account) internal {
_whitelistAdmins.remove(account);
emit WhitelistAdminRemoved(account);
}
}
contract FNum is ReentrancyGuard{
uint public constant BASE = 10**18;
function badd(uint a, uint b)
internal pure
returns (uint)
{
uint c = a + b;
require(c >= a, "ERR_ADD_OVERFLOW");
return c;
}
function bsub(uint a, uint b)
internal pure
returns (uint)
{
(uint c, bool flag) = bsubSign(a, b);
require(!flag, "ERR_SUB_UNDERFLOW");
return c;
}
function bsubSign(uint a, uint b)
internal pure
returns (uint, bool)
{
if (a >= b) {
return (a - b, false);
} else {
return (b - a, true);
}
}
function bmul(uint a, uint b)
internal pure
returns (uint)
{
uint c0 = a * b;
require(a == 0 || c0 / a == b, "ERR_MUL_OVERFLOW");
uint c1 = c0 + (BASE / 2);
require(c1 >= c0, "ERR_MUL_OVERFLOW");
uint c2 = c1 / BASE;
return c2;
}
function bdiv(uint a, uint b)
internal pure
returns (uint)
{
require(b != 0, "ERR_DIV_ZERO");
uint c0 = a * BASE;
require(a == 0 || c0 / a == BASE, "ERR_DIV_INTERNAL"); // bmul overflow
uint c1 = c0 + (b / 2);
require(c1 >= c0, "ERR_DIV_INTERNAL"); // badd require
uint c2 = c1 / b;
return c2;
}
function btoi(uint a)
internal pure
returns (uint)
{
return a / BASE;
}
function bfloor(uint a)
internal pure
returns (uint)
{
return btoi(a) * BASE;
}
function bpowi(uint a, uint n)
internal pure
returns (uint)
{
uint z = n % 2 != 0 ? a : BASE;
for (n /= 2; n != 0; n /= 2) {
a = bmul(a, a);
if (n % 2 != 0) {
z = bmul(z, a);
}
}
return z;
}
function bpow(uint base, uint exp)
internal pure
returns (uint)
{
uint whole = bfloor(exp);
uint remain = bsub(exp, whole);
uint wholePow = bpowi(base, btoi(whole));
if (remain == 0) {
return wholePow;
}
uint BPOW_PRECISION = BASE / 10**10;
uint partialResult = bpowApprox(base, remain, BPOW_PRECISION);
return bmul(wholePow, partialResult);
}
function bpowApprox(uint base, uint exp, uint precision)
internal pure
returns (uint)
{
// term 0:
uint a = exp;
(uint x, bool xneg) = bsubSign(base, BASE);
uint term = BASE;
uint sum = term;
bool negative = false;
for (uint i = 1; term >= precision; i++) {
uint bigK = i * BASE;
(uint c, bool cneg) = bsubSign(a, bsub(bigK, BASE));
term = bmul(term, bmul(c, x));
term = bdiv(term, bigK);
if (term == 0) break;
if (xneg) negative = !negative;
if (cneg) negative = !negative;
if (negative) {
sum = bsub(sum, term);
} else {
sum = badd(sum, term);
}
}
return sum;
}
}
contract FTokenBase is FNum {
mapping(address => uint) internal _balance;
mapping(address => mapping(address=>uint)) internal _allowance;
uint public _totalSupply;
event Approval(address indexed src, address indexed dst, uint amt);
event Transfer(address indexed src, address indexed dst, uint amt);
function _mint(uint amt) internal {
_balance[address(this)] = badd(_balance[address(this)], amt);
_totalSupply = badd(_totalSupply, amt);
emit Transfer(address(0), address(this), amt);
}
function _burn(uint amt) internal {
require(_balance[address(this)] >= amt);
_balance[address(this)] = bsub(_balance[address(this)], amt);
_totalSupply = bsub(_totalSupply, amt);
emit Transfer(address(this), address(0), amt);
}
function _move(address src, address dst, uint amt) internal {
require(_balance[src] >= amt);
_balance[src] = bsub(_balance[src], amt);
_balance[dst] = badd(_balance[dst], amt);
emit Transfer(src, dst, amt);
}
function _push(address to, uint amt) internal {
_move(address(this), to, amt);
}
function _pull(address from, uint amt) internal {
_move(from, address(this), amt);
}
}
contract FToken is FTokenBase {
string private _name = "FEG Stake Shares";
string private _symbol = "FSS";
uint8 private _decimals = 18;
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns(uint8) {
return _decimals;
}
function allowance(address src, address dst) external view returns (uint) {
return _allowance[src][dst];
}
function balanceOf(address whom) external view returns (uint) {
return _balance[whom];
}
function totalSupply() public view returns (uint) {
return _totalSupply;
}
function approve(address dst, uint amt) external returns (bool) {
_allowance[msg.sender][dst] = amt;
emit Approval(msg.sender, dst, amt);
return true;
}
function increaseApproval(address dst, uint amt) external returns (bool) {
_allowance[msg.sender][dst] = badd(_allowance[msg.sender][dst], amt);
emit Approval(msg.sender, dst, _allowance[msg.sender][dst]);
return true;
}
function decreaseApproval(address dst, uint amt) external returns (bool) {
uint oldValue = _allowance[msg.sender][dst];
if (amt > oldValue) {
_allowance[msg.sender][dst] = 0;
} else {
_allowance[msg.sender][dst] = bsub(oldValue, amt);
}
emit Approval(msg.sender, dst, _allowance[msg.sender][dst]);
return true;
}
function transfer(address dst, uint amt) external returns (bool) {
_move(msg.sender, dst, amt);
return true;
}
function transferFrom(address src, address dst, uint amt) external returns (bool) {
require(msg.sender == src || amt <= _allowance[src][msg.sender]);
_move(src, dst, amt);
if (msg.sender != src && _allowance[src][msg.sender] != uint256(-1)) {
_allowance[src][msg.sender] = bsub(_allowance[src][msg.sender], amt);
emit Approval(msg.sender, dst, _allowance[src][msg.sender]);
}
return true;
}
}
contract FEGstakeV2 is Owned, ReentrancyGuard, WhitelistAdminRole, FNum, FTokenBase, FToken{
using SafeMath for uint256;
address public FEG = 0x389999216860AB8E0175387A0c90E5c52522C945;
address public fETH = 0xf786c34106762Ab4Eeb45a51B42a62470E9D5332;
address public USDT = 0x979838c9C16FD365C9fE028B0bEa49B1750d86e9;
address public TRY = 0xc12eCeE46ed65D970EE5C899FCC7AE133AfF9b03;
address public FETP = 0xa40462266dC28dB1d570FC8F8a0F4B72B8618f7a;
address public BTC = 0xe3cDB92b094a3BeF3f16103b53bECfb17A3558ad;
address public poolShares = address(this);
address public regrewardContract; //Signs The Checks
bool public live = false;
bool public perform = false; //if true then distribution of rewards from the pool to stakers via the withdraw function is enabled
bool public perform2 = true; //if true then distribution of TX rewards from unclaimed 1 and 2 wrap's will distribute to stakers
bool public perform3 = true; //if true then distribution of TX rewards from unclaimed 3rd wrap's will distribute to stakers
uint256 public scailment = 20; // FEG has TX fee, deduct this fee to not break maths
uint256 public totalDividends = 0;
uint256 public must = 3e15;
uint256 public scaleatize = 99;
uint256 private scaledRemainder = 0;
uint256 private scaling = uint256(10) ** 12;
uint public round = 1;
uint256 public totalDividends1 = 0;
uint256 private scaledRemainder1 = 0;
uint256 private scaling1 = uint256(10) ** 12;
uint public round1 = 1;
uint256 public totalDividends2 = 0;
uint256 private scaledRemainder2 = 0;
uint256 private scaling2 = uint256(10) ** 12;
uint public round2 = 1;
mapping(address => uint) public farmTime; // When you staked
struct USER{
uint256 lastDividends;
uint256 fromTotalDividend;
uint round;
uint256 remainder;
uint256 lastDividends1;
uint256 fromTotalDividend1;
uint round1;
uint256 remainder1;
uint256 lastDividends2;
uint256 fromTotalDividend2;
uint round2;
uint256 remainder2;
bool initialized;
bool activated;
}
address[] internal stakeholders;
uint public scalerize = 98;
uint256 public scaletor = 1e17;
uint256 public scaletor1 = 20e18;
uint256 public scaletor2 = 1e15;
uint256 public totalWrap; // total unclaimed fETH rewards
uint256 public totalWrap1; // total unclaimed usdt rewards
uint256 public totalWrap2; // total unclaimed btc rewards
uint256 public totalWrapRef = bsub(IERC20(fETH).balanceOf(address(this)), totalWrap); //total fETH reflections unclaimed
uint256 public totalWrapRef1 = bsub(IERC20(USDT).balanceOf(address(this)), totalWrap1); //total usdt reflections unclaimed
uint256 public totalWrapRef2 = bsub(IERC20(BTC).balanceOf(address(this)), totalWrap2); //total BTC reflections unclaimed
mapping(address => USER) stakers;
mapping (uint => uint256) public payouts; // keeps record of each payout
mapping (uint => uint256) public payouts1; // keeps record of each payout
mapping (uint => uint256) public payouts2; // keeps record of each payout
FEGex2 fegexpair;
event STAKED(address staker, uint256 tokens);
event ACTIVATED(address staker, uint256 cost);
event START(address staker, uint256 tokens);
event EARNED(address staker, uint256 tokens);
event UNSTAKED(address staker, uint256 tokens);
event PAYOUT(uint256 round, uint256 tokens, address sender);
event PAYOUT1(uint256 round, uint256 tokens, address sender);
event PAYOUT2(uint256 round, uint256 tokens, address sender);
event CLAIMEDREWARD(address staker, uint256 reward);
event CLAIMEDREWARD1(address staker, uint256 reward);
event CLAIMEDREWARD2(address staker, uint256 reward);
constructor(){
fegexpair = FEGex2(FETP);
}
receive() external payable {
}
function changeFEGExPair(FEGex2 _fegexpair, address addy) external onlyOwner{ // Incase FEGex updates in future
require(address(_fegexpair) != address(0), "setting 0 to contract");
fegexpair = _fegexpair;
FETP = addy;
}
function changeTRY(address _try) external onlyOwner{ // Incase TRY updates in future
TRY = _try;
}
function changeScalerize(uint _sca) public onlyOwner{
require(_sca != 0, "You cannot turn off");
scalerize = _sca;
}
function changeScalatize(uint _scm) public onlyOwner {
require(_scm != 0, "You cannot turn off");
scaleatize = _scm;
}
function isStakeholder(address _address)
public
view
returns(bool)
{
if(stakers[_address].initialized) return true;
else return false;
}
function addStakeholder(address _stakeholder)
internal
{
(bool _isStakeholder) = isStakeholder(_stakeholder);
if(!_isStakeholder) {
farmTime[msg.sender] = block.timestamp;
stakers[_stakeholder].initialized = true;
}
}
// ------------------------------------------------------------------------
// Token holders can stake their tokens using this function
// @param tokens number of tokens to stake
// ------------------------------------------------------------------------
function calcPoolInGivenSingleOut(
uint tokenBalanceOut,
uint tokenWeightOut,
uint poolSupply,
uint totalWeight,
uint tokenAmountOut,
uint swapFee
)
public pure
returns (uint poolAmountIn)
{
uint normalizedWeight = bdiv(tokenWeightOut, totalWeight);
uint zar = bmul(bsub(BASE, normalizedWeight), swapFee);
uint tokenAmountOutBeforeSwapFee = bdiv(tokenAmountOut, bsub(BASE, zar));
uint newTokenBalanceOut = bsub(tokenBalanceOut, tokenAmountOutBeforeSwapFee);
uint tokenOutRatio = bdiv(newTokenBalanceOut, tokenBalanceOut);
uint poolRatio = bpow(tokenOutRatio, normalizedWeight);
uint newPoolSupply = bmul(poolRatio, poolSupply);
uint poolAmountInAfterExitFee = bsub(poolSupply, newPoolSupply);
poolAmountIn = bdiv(poolAmountInAfterExitFee, bsub(BASE, 0));
return (poolAmountIn);
}
function calcSingleOutGivenPoolIn(
uint tokenBalanceOut,
uint tokenWeightOut,
uint poolSupply,
uint totalWeight,
uint poolAmountIn,
uint swapFee
)
public pure
returns (uint tokenAmountOut)
{
uint normalizedWeight = bdiv(tokenWeightOut, totalWeight);
uint poolAmountInAfterExitFee = bmul(poolAmountIn, bsub(BASE, 0));
uint newPoolSupply = bsub(poolSupply, poolAmountInAfterExitFee);
uint poolRatio = bdiv(newPoolSupply, poolSupply);
uint tokenOutRatio = bpow(poolRatio, bdiv(BASE, normalizedWeight));
uint newTokenBalanceOut = bmul(tokenOutRatio, tokenBalanceOut);
uint tokenAmountOutBeforeSwapFee = bsub(tokenBalanceOut, newTokenBalanceOut);
uint zaz = bmul(bsub(BASE, normalizedWeight), swapFee);
tokenAmountOut = bmul(tokenAmountOutBeforeSwapFee, bsub(BASE, zaz));
return tokenAmountOut;
}
function calcPoolOutGivenSingleIn(
uint tokenBalanceIn,
uint tokenWeightIn,
uint poolSupply,
uint totalWeight,
uint tokenAmountIn,
uint swapFee
)
public pure
returns (uint poolAmountOut)
{
uint normalizedWeight = bdiv(tokenWeightIn, totalWeight);
uint zaz = bmul(bsub(BASE, normalizedWeight), swapFee);
uint tokenAmountInAfterFee = bmul(tokenAmountIn, bsub(BASE, zaz));
uint newTokenBalanceIn = badd(tokenBalanceIn, tokenAmountInAfterFee);
uint tokenInRatio = bdiv(newTokenBalanceIn, tokenBalanceIn);
uint poolRatio = bpow(tokenInRatio, normalizedWeight);
uint newPoolSupply = bmul(poolRatio, poolSupply);
poolAmountOut = bsub(newPoolSupply, poolSupply);
return (poolAmountOut);
}
function calcOutGivenIn(
uint tokenBalanceIn,
uint tokenWeightIn,
uint tokenBalanceOut,
uint tokenWeightOut,
uint tokenAmountIn,
uint swapFee
)
public pure
returns (uint tokenAmountOut, uint tokenInFee)
{
uint weightRatio = bdiv(tokenWeightIn, tokenWeightOut);
uint adjustedIn = bsub(BASE, swapFee);
adjustedIn = bmul(tokenAmountIn, adjustedIn);
uint y = bdiv(tokenBalanceIn, badd(tokenBalanceIn, adjustedIn));
uint foo = bpow(y, weightRatio);
uint bar = bsub(BASE, foo);
tokenAmountOut = bmul(tokenBalanceOut, bar);
tokenInFee = bsub(tokenAmountIn, adjustedIn);
return (tokenAmountOut, tokenInFee);
}
function calcInGivenOut(
uint tokenBalanceIn,
uint tokenWeightIn,
uint tokenBalanceOut,
uint tokenWeightOut,
uint tokenAmountOut,
uint swapFee
)
public pure
returns (uint tokenAmountIn)
{
uint weightRatio = bdiv(tokenWeightOut, tokenWeightIn);
uint diff = bsub(tokenBalanceOut, tokenAmountOut);
uint y = bdiv(tokenBalanceOut, diff);
uint foo = bpow(y, weightRatio);
foo = bsub(foo, BASE);
foo = bmul(tokenBalanceIn, foo);
tokenAmountIn = bsub(BASE, swapFee);
tokenAmountIn = bdiv(foo, tokenAmountIn);
return (tokenAmountIn);
}
function activateUserStaking() public payable{ // Activation of FEGstake costs 0.02 fETH which is automatically refunded to your wallet in the form of TRY.
require(msg.value == must, "You must deposit the right amount to activate");
fegexpair.BUY{value: msg.value }(msg.sender, 100);
stakers[msg.sender].activated = true;
emit ACTIVATED(msg.sender, msg.value);
}
function isActivated(address staker) public view returns(bool){
if(stakers[staker].activated) return true;
else return false;
}
function Start(uint256 tokens) public onlyOwner returns(uint poolAmountOut){
require(live == false, "Can only use once");
require(IERC20(FEG).transferFrom(msg.sender, address(this), tokens), "Tokens cannot be transferred from user for locking");
uint256 transferTxFee = (onePercent(tokens).mul(scailment)).div(10);
uint256 tokensToStake = (tokens.sub(transferTxFee));
addStakeholder(msg.sender);
_mint(tokensToStake);
live = true;
IERC20(poolShares).transfer(msg.sender, tokensToStake);
IERC20(address(fETH)).approve(address(FETP), 1000000000000000000000e18);
emit START(msg.sender, tokensToStake);
return poolAmountOut;
}
function STAKE(uint256 tokens) public returns(uint poolAmountOut){
require(IERC20(FEG).balanceOf(msg.sender) >= tokens, "You do not have enough FEG");
require(stakers[msg.sender].activated == true);
require(live == true);
uint256 transferTxFee = (onePercent(tokens).mul(scailment)).div(10);
uint256 tokensToStake = (tokens.sub(transferTxFee));
uint256 totalFEG = IERC20(FEG).balanceOf(address(this));
addStakeholder(msg.sender);
// add pending rewards to remainder to be claimed by user later, if there is any existing stake
uint256 owing = pendingReward(msg.sender);
stakers[msg.sender].remainder += owing;
stakers[msg.sender].lastDividends = owing;
stakers[msg.sender].fromTotalDividend = totalDividends;
stakers[msg.sender].round = round;
uint256 owing1 = pendingReward1(msg.sender);
stakers[msg.sender].remainder1 += owing1;
stakers[msg.sender].lastDividends1 = owing1;
stakers[msg.sender].fromTotalDividend1 = totalDividends1;
stakers[msg.sender].round1 = round1;
uint256 owing2 = pendingReward2(msg.sender);
stakers[msg.sender].remainder2 += owing2;
stakers[msg.sender].lastDividends2 = owing2;
stakers[msg.sender].fromTotalDividend2 = totalDividends2;
stakers[msg.sender].round2 = round2;
poolAmountOut = calcPoolOutGivenSingleIn(
totalFEG,
bmul(BASE, 25),
_totalSupply,
bmul(BASE, 25),
tokensToStake,
0
);
require(IERC20(FEG).transferFrom(msg.sender, address(this), tokens), "Tokens cannot be transferred from user for locking");
_mint(poolAmountOut);
IERC20(poolShares).transfer(msg.sender, poolAmountOut);
emit STAKED(msg.sender, tokens);
return poolAmountOut;
}
// ------------------------------------------------------------------------
// Owners can send the funds to be distributed to stakers using this function
// @param tokens number of tokens to distribute
// ------------------------------------------------------------------------
function ADDFUNDS1(uint256 tokens) public onlyWhitelistAdmin{
require(IERC20(fETH).transferFrom(msg.sender, address(this), tokens), "Tokens cannot be transferred from funder account");
uint256 tokens_ = bmul(tokens, bdiv(99, 100));
totalWrap = badd(totalWrap, tokens_);
_addPayout(tokens_);
}
function ADDFUNDS2(uint256 tokens) public onlyWhitelistAdmin{
require(IERC20(USDT).transferFrom(msg.sender, address(this), tokens), "Tokens cannot be transferred from funder account");
uint256 tokens_ = bmul(tokens, bdiv(99, 100));
totalWrap1 = badd(totalWrap1, tokens_);
_addPayout1(tokens_);
}
function ADDFUNDS3(uint256 tokens) public onlyWhitelistAdmin{
require(IERC20(BTC).transferFrom(msg.sender, address(this), tokens), "Tokens cannot be transferred from funder account");
uint256 tokens_ = bmul(tokens, bdiv(99, 100));
totalWrap2 = badd(totalWrap2, tokens_);
_addPayout2(tokens_);
}
// ------------------------------------------------------------------------
// Private function to register payouts
// ------------------------------------------------------------------------
function _addPayout(uint256 tokens_) private {
// divide the funds among the currently staked tokens
// scale the deposit and add the previous remainder
uint256 totalShares = _totalSupply;
uint256 available = (tokens_.mul(scaling)).add(scaledRemainder);
uint256 dividendPerToken = available.div(totalShares);
scaledRemainder = available.mod(totalShares);
totalDividends = totalDividends.add(dividendPerToken);
payouts[round] = payouts[round - 1].add(dividendPerToken);
emit PAYOUT(round, tokens_, msg.sender);
round++;
}
function _addPayout1(uint256 tokens_1) private{
// divide the funds among the currently staked tokens
// scale the deposit and add the previous remainder
uint256 totalShares = _totalSupply;
uint256 available = (tokens_1.mul(scaling)).add(scaledRemainder1);
uint256 dividendPerToken = available.div(totalShares);
scaledRemainder1 = available.mod(totalShares);
totalDividends1 = totalDividends1.add(dividendPerToken);
payouts1[round1] = payouts1[round1 - 1].add(dividendPerToken);
emit PAYOUT1(round1, tokens_1, msg.sender);
round1++;
}
function _addPayout2(uint256 tokens_2) private{
// divide the funds among the currently staked tokens
// scale the deposit and add the previous remainder
uint256 totalShares = _totalSupply;
uint256 available = (tokens_2.mul(scaling)).add(scaledRemainder2);
uint256 dividendPerToken = available.div(totalShares);
scaledRemainder2 = available.mod(totalShares);
totalDividends2 = totalDividends2.add(dividendPerToken);
payouts2[round2] = payouts2[round2 - 1].add(dividendPerToken);
emit PAYOUT2(round2, tokens_2, msg.sender);
round2++;
}
// ------------------------------------------------------------------------
// Stakers can claim their pending rewards using this function
// ------------------------------------------------------------------------
function CLAIMREWARD() public nonReentrant{
uint256 owing = pendingReward(msg.sender);
if(owing > 0){
owing = owing.add(stakers[msg.sender].remainder);
stakers[msg.sender].remainder = 0;
require(IERC20(fETH).transfer(msg.sender,owing), "ERROR: error in sending reward from contract");
emit CLAIMEDREWARD(msg.sender, owing);
totalWrap = bsub(totalWrap, owing);
stakers[msg.sender].lastDividends = owing; // unscaled
stakers[msg.sender].round = round; // update the round
stakers[msg.sender].fromTotalDividend = totalDividends; // scaled
}
}
function CLAIMREWARD1() public nonReentrant {
uint256 owing1 = pendingReward1(msg.sender);
if(owing1 > 0){
owing1 = owing1.add(stakers[msg.sender].remainder1);
stakers[msg.sender].remainder1 = 0;
require(IERC20(USDT).transfer(msg.sender,owing1), "ERROR: error in sending reward from contract");
emit CLAIMEDREWARD1(msg.sender, owing1);
totalWrap1 = bsub(totalWrap1, owing1);
stakers[msg.sender].lastDividends1 = owing1; // unscaled
stakers[msg.sender].round1 = round1; // update the round
stakers[msg.sender].fromTotalDividend1 = totalDividends1; // scaled
}
}
function CLAIMREWARD2() public nonReentrant {
uint256 owing2 = pendingReward2(msg.sender);
if(owing2 > 0){
owing2 = owing2.add(stakers[msg.sender].remainder2);
stakers[msg.sender].remainder2 = 0;
require(IERC20(BTC).transfer(msg.sender, owing2), "ERROR: error in sending reward from contract");
emit CLAIMEDREWARD2(msg.sender, owing2);
totalWrap2 = bsub(totalWrap2, owing2);
stakers[msg.sender].lastDividends2 = owing2; // unscaled
stakers[msg.sender].round2 = round2; // update the round
stakers[msg.sender].fromTotalDividend2 = totalDividends2; // scaled
}
}
function CLAIMALLREWARD() public {
distribute12();
CLAIMREWARD();
CLAIMREWARD1();
if(perform3==true){
distribute23();
CLAIMREWARD2();
}
}
// ------------------------------------------------------------------------
// Get the pending rewards of the staker
// @param _staker the address of the staker
// ------------------------------------------------------------------------
function pendingReward(address staker) private returns (uint256) {
require(staker != address(0), "ERC20: sending to the zero address");
uint256 yourBase = IERC20(poolShares).balanceOf(msg.sender);
uint stakersRound = stakers[staker].round;
uint256 amount = ((totalDividends.sub(payouts[stakersRound - 1])).mul(yourBase)).div(scaling);
stakers[staker].remainder += ((totalDividends.sub(payouts[stakersRound - 1])).mul(yourBase)) % scaling;
return (bmul(amount, bdiv(scalerize, 100)));
}
function pendingReward1(address staker) private returns (uint256) {
require(staker != address(0), "ERC20: sending to the zero address");
uint256 yourBase = IERC20(poolShares).balanceOf(msg.sender);
uint stakersRound = stakers[staker].round1;
uint256 amount1 = ((totalDividends1.sub(payouts1[stakersRound - 1])).mul(yourBase)).div(scaling);
stakers[staker].remainder1 += ((totalDividends1.sub(payouts1[stakersRound - 1])).mul(yourBase)) % scaling;
return (bmul(amount1, bdiv(scalerize, 100)));
}
function pendingReward2(address staker) private returns (uint256) {
require(staker != address(0), "ERC20: sending to the zero address");
uint256 yourBase = IERC20(poolShares).balanceOf(msg.sender);
uint stakersRound = stakers[staker].round2;
uint256 amount2 = ((totalDividends2.sub(payouts2[stakersRound - 1])).mul(yourBase)).div(scaling);
stakers[staker].remainder2 += ((totalDividends2.sub(payouts2[stakersRound - 1])).mul(yourBase)) % scaling;
return (bmul(amount2, bdiv(scalerize, 100)));
}
function getPending1(address staker) public view returns(uint256 _pendingReward) {
require(staker != address(0), "ERC20: sending to the zero address");
uint256 yourBase = IERC20(poolShares).balanceOf(staker);
uint stakersRound = stakers[staker].round;
uint256 amount = ((totalDividends.sub(payouts[stakersRound - 1])).mul(yourBase)).div(scaling);
amount += ((totalDividends.sub(payouts[stakersRound - 1])).mul(yourBase)) % scaling;
return (bmul(amount.add(stakers[staker].remainder), bdiv(scalerize, 100)));
}
function getPending2(address staker) public view returns(uint256 _pendingReward) {
require(staker != address(0), "ERC20: sending to the zero address");
uint256 yourBase = IERC20(poolShares).balanceOf(staker);
uint stakersRound = stakers[staker].round1;
uint256 amount1 = ((totalDividends1.sub(payouts1[stakersRound - 1])).mul(yourBase)).div(scaling);
amount1 += ((totalDividends1.sub(payouts1[stakersRound - 1])).mul(yourBase)) % scaling;
return (bmul(amount1.add(stakers[staker].remainder1), bdiv(scalerize, 100)));
}
function getPending3(address staker) public view returns(uint256 _pendingReward) {
require(staker != address(0), "ERC20: sending to the zero address");
uint256 yourBase = IERC20(poolShares).balanceOf(staker);
uint stakersRound = stakers[staker].round2;
uint256 amount2 = ((totalDividends2.sub(payouts2[stakersRound - 1])).mul(yourBase)).div(scaling);
amount2 += ((totalDividends2.sub(payouts2[stakersRound - 1])).mul(yourBase)) % scaling;
return (bmul(amount2.add(stakers[staker].remainder2), bdiv(scalerize, 100)));
}
// ------------------------------------------------------------------------
// Get the FEG balance of the token holder
// @param user the address of the token holder
// ------------------------------------------------------------------------
function userStakedFEG(address user) external view returns(uint256 StakedFEG){
require(user != address(0), "ERC20: sending to the zero address");
uint256 totalFEG = IERC20(FEG).balanceOf(address(this));
uint256 yourStakedFEG = calcSingleOutGivenPoolIn(
totalFEG,
bmul(BASE, 25),
_totalSupply,
bmul(BASE, 25),
IERC20(poolShares).balanceOf(address(user)),
0
);
return yourStakedFEG;
}
// ------------------------------------------------------------------------
// Stakers can un stake the staked tokens using this function
// @param tokens the number of tokens to withdraw
// ------------------------------------------------------------------------
function WITHDRAW(address to, uint256 _tokens) external returns (uint tokenAmountOut) {
uint256 totalFEG = IERC20(FEG).balanceOf(address(this));
require(stakers[msg.sender].activated == true);
if(perform==true) {
regreward(regrewardContract).distributeV2();
}
CLAIMALLREWARD();
uint256 tokens = calcPoolInGivenSingleOut(
totalFEG,
bmul(BASE, 25),
_totalSupply,
bmul(BASE, 25),
_tokens,
0
);
tokenAmountOut = calcSingleOutGivenPoolIn(
totalFEG,
bmul(BASE, 25),
_totalSupply,
bmul(BASE, 25),
tokens,
0
);
require(tokens <= IERC20(poolShares).balanceOf(msg.sender), "You don't have enough FEG");
_pullPoolShare(tokens);
_burn(tokens);
require(IERC20(FEG).transfer(to, tokenAmountOut), "Error in un-staking tokens");
emit UNSTAKED(msg.sender, tokens);
return tokenAmountOut;
}
function _pullPoolShare(uint amount)
internal
{
bool xfer = IERC20(poolShares).transferFrom(msg.sender, address(this), amount);
require(xfer, "ERR_ERC20_FALSE");
}
// ------------------------------------------------------------------------
// Private function to calculate 1% percentage
// ------------------------------------------------------------------------
function onePercent(uint256 _tokens) private pure returns (uint256){
uint256 roundValue = _tokens.ceil(100);
uint onePercentofTokens = roundValue.mul(100).div(100 * 10**uint(2));
return onePercentofTokens;
}
function emergencySaveLostTokens(address to, address _token, uint256 _amt) public onlyOwner {
require(_token != FEG, "Cannot remove users FEG");
require(_token != fETH, "Cannot remove users fETH");
require(_token != USDT, "Cannot remove users fUSDT");
require(_token != BTC, "Cannot remove users fBTC");
require(IERC20(_token).transfer(to, _amt), "Error in retrieving tokens");
payable(owner).transfer(address(this).balance);
}
function changeregrewardContract(address _regrewardContract) external onlyOwner{
require(address(_regrewardContract) != address(0), "setting 0 to contract");
regrewardContract = _regrewardContract;
}
function changePerform(bool _bool) external onlyOwner{
perform = _bool;
}
function changePerform2(bool _bool) external onlyOwner{
perform2 = _bool;
}
function changePerform3(bool _bool) external onlyOwner{
perform3 = _bool;
}
function changeMust(uint256 _must) external onlyOwner{
require(must !=0, "Cannot set to 0");
require(must <= 3e15, "Cannot set over 0.003 fETH");
must = _must;
}
function updateBase(address _BTC, address _ETH, address _USDT) external onlyOwner{ // Incase wraps ever update
BTC = _BTC;
fETH = _ETH;
USDT = _USDT;
}
function distribute12() public {
if (IERC20(fETH).balanceOf(address(this)) > badd(totalWrap, scaletor)) {
distributeWrap1();
}
if(IERC20(USDT).balanceOf(address(this)) > badd(totalWrap1, scaletor1)){
distributeWrap2();
}
}
function distribute23() public {
if(perform3==true){
if(IERC20(BTC).balanceOf(address(this)) > badd(totalWrap2, scaletor2)){
distributeWrap3();}
}
}
function changeScaletor(uint256 _sca, uint256 _sca1, uint256 _sca2) public onlyOwner {
require(_sca !=0 && _sca1 !=0 && _sca2 !=0, "You cannot turn off");
require(_sca >= 5e17 && _sca1 >= 20e18 && _sca2 >= 1e15, "Must be over minimum");
scaletor = _sca;
scaletor1 = _sca1;
scaletor2 = _sca2;
}
function distributeWrap1() internal {
uint256 wrapped = bsub(IERC20(fETH).balanceOf(address(this)), totalWrap);
totalWrap = badd(totalWrap, wrapped);
_addPayout(wrapped);
}
function distributeWrap2() internal {
uint256 wrapped = bsub(IERC20(USDT).balanceOf(address(this)), totalWrap1);
totalWrap1 = badd(totalWrap1, wrapped);
_addPayout1(wrapped);
}
function distributeWrap3() internal {
uint256 wrapped = bsub(IERC20(BTC).balanceOf(address(this)), totalWrap2);
totalWrap2 = badd(totalWrap2, wrapped);
_addPayout2(wrapped);
}
}
Read Contract
BASE 0xec342ad0 → uint256
BTC 0x2792949d → address
FEG 0x093a9fbc → address
FETP 0xbd52e610 → address
TRY 0x5ac072d7 → address
USDT 0xc54e44eb → address
_totalSupply 0x3eaaf86b → uint256
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
calcInGivenOut 0xf8d6aed4 → uint256
calcOutGivenIn 0xba9530a6 → uint256, uint256
calcPoolInGivenSingleOut 0x82f652ad → uint256
calcPoolOutGivenSingleIn 0x8656b653 → uint256
calcSingleOutGivenPoolIn 0x89298012 → uint256
decimals 0x313ce567 → uint8
fETH 0xcc14d688 → address
farmTime 0xc3f344a8 → uint256
getPending1 0xdff49b0b → uint256
getPending2 0x1f75d80d → uint256
getPending3 0x3d436214 → uint256
isActivated 0xc9faa7c5 → bool
isStakeholder 0xef037b90 → bool
isWhitelistAdmin 0xbb5f747b → bool
live 0x957aa58c → bool
must 0x9acfe6ef → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
payouts 0x29652e86 → uint256
payouts1 0x7225ae98 → uint256
payouts2 0xcc8ead9b → uint256
perform 0xb147f40c → bool
perform2 0xf8ebd04e → bool
perform3 0x0147435b → bool
poolShares 0x04943c0d → address
regrewardContract 0x8ade8d8c → address
round 0x146ca531 → uint256
round1 0x836e8180 → uint256
round2 0x532b581c → uint256
scailment 0xa5d6fe0a → uint256
scaleatize 0x582069df → uint256
scalerize 0xab6ed428 → uint256
scaletor 0x8c25f249 → uint256
scaletor1 0x722b2dd7 → uint256
scaletor2 0xf2c2c0fc → uint256
symbol 0x95d89b41 → string
totalDividends 0x997664d7 → uint256
totalDividends1 0x834d4725 → uint256
totalDividends2 0x0e1cc0ee → uint256
totalSupply 0x18160ddd → uint256
totalWrap 0x6bc01b5a → uint256
totalWrap1 0x2ae331f2 → uint256
totalWrap2 0xede23885 → uint256
totalWrapRef 0x7d5a236d → uint256
totalWrapRef1 0xa7ec1bcd → uint256
totalWrapRef2 0x92273f37 → uint256
userStakedFEG 0x522c9069 → uint256
Write Contract 33 functions
These functions modify contract state and require a wallet transaction to execute.
ADDFUNDS1 0x7a75572c
uint256 tokens
ADDFUNDS2 0xf6a7f6bb
uint256 tokens
ADDFUNDS3 0x91e78dfa
uint256 tokens
CLAIMALLREWARD 0xcfb1c5eb
No parameters
CLAIMREWARD 0x4baf782e
No parameters
CLAIMREWARD1 0x337704a8
No parameters
CLAIMREWARD2 0x891e99d8
No parameters
STAKE 0xca84d591
uint256 tokens
returns: uint256
Start 0xf06a29c9
uint256 tokens
returns: uint256
WITHDRAW 0x4f14ea4e
address to
uint256 _tokens
returns: uint256
activateUserStaking 0xc87341f2
No parameters
addWhitelistAdmin 0x7362d9c8
address account
approve 0x095ea7b3
address dst
uint256 amt
returns: bool
changeFEGExPair 0x3df737f2
address _fegexpair
address addy
changeMust 0x281be43f
uint256 _must
changePerform 0x4f49e655
bool _bool
changePerform2 0x9651e6b9
bool _bool
changePerform3 0x6f47caa1
bool _bool
changeScalatize 0x1ff1bfa1
uint256 _scm
changeScalerize 0xd246e276
uint256 _sca
changeScaletor 0x9806e07c
uint256 _sca
uint256 _sca1
uint256 _sca2
changeTRY 0xd41c04fd
address _try
changeregrewardContract 0x4bc76334
address _regrewardContract
decreaseApproval 0x66188463
address dst
uint256 amt
returns: bool
distribute12 0xb121d681
No parameters
distribute23 0xa5b84a17
No parameters
emergencySaveLostTokens 0x1336ffeb
address to
address _token
uint256 _amt
increaseApproval 0xd73dd623
address dst
uint256 amt
returns: bool
renounceWhitelistAdmin 0x4c5a628c
No parameters
transfer 0xa9059cbb
address dst
uint256 amt
returns: bool
transferFrom 0x23b872dd
address src
address dst
uint256 amt
returns: bool
transferOwnership 0xf2fde38b
address _newOwner
updateBase 0x274217c9
address _BTC
address _ETH
address _USDT
Recent Transactions
No transactions found for this address