Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x5F6C3D30fFF320B4d559E448ABB1c70D9DF8F586
Balance 0 ETH
Nonce 1
Code Size 21784 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

21784 bytes
0x608060405234801561001057600080fd5b50600436106104cc5760003560e01c80638bbce00911610283578063ba019dab1161015c578063d73dd623116100ce578063ec52479311610092578063ec52479314610abe578063f1091b6e14610ad1578063f8b2cb4f14610ada578063f8d6aed414610aed578063fde924f714610b00578063ffc4fa2614610b13576104cc565b8063d73dd62314610a6a578063dd62ed3e14610a7d578063e4a28a521461056a578063ec09302114610ab6578063ec342ad014610647576104cc565b8063c6580d1211610120578063c6580d1214610a18578063cc14d68814610a20578063cc2cf6bc14610a33578063cdd9640514610a46578063cdfec52d14610a59578063d4cadf6814610a62576104cc565b8063ba019dab146109e2578063ba9530a6146109ea578063bc063e1a14610812578063bc694ea2146109fd578063c627fbfa14610a05576104cc565b8063a221ee49116101f5578063af4c8f83116101b9578063af4c8f8314610960578063af8d757b14610989578063b0e0d1361461099c578063b44ec921146109a4578063b7b800a4146109c7578063b7bbe0c8146109cf576104cc565b8063a221ee4914610915578063a2e70a2e14610928578063a2e73cb614610931578063a5a54ea514610944578063a9059cbb1461094d576104cc565b806395d89b411161024757806395d89b41146108c8578063992e2a92146108d05780639a78458a146108d85780639a86139b146108eb5780639f6d8474146108fa578063a16faa181461090d576104cc565b80638bbce009146108745780638d811d1f1461088757806392eefe9b1461089a5780639381cd2b146108ad578063948d8ce6146108b5576104cc565b8063313ce567116103b557806360ea602b1161032757806376c7a3c7116102eb57806376c7a3c7146108125780637c8849731461082057806382f652ad146108335780638656b65314610846578063867378c5146108595780638929801214610861576104cc565b806360ea602b1461079d57806366188463146107b057806370a08231146107c357806371a1e6dd146107ec57806372f1b6d7146107ff576104cc565b8063514b33cf11610379578063514b33cf146107295780635a6599491461073c5780635ac072d7146107455780635bcbce08146107585780635c7b55bd1461076b5780635e2abf8914610774576104cc565b8063313ce567146106c857806331705705146106dd578063390221d6146106f05780633c6d6997146107035780633fdddaa214610716576104cc565b806315e84af91161044e5780632140fb40116104125780632140fb401461061b578063218b53821461064757806323b872dd1461065657806329dfe3b2146106695780632f37b6241461067c5780633018205f146106a8576104cc565b806315e84af9146105dc57806318160ddd146105ef578063189d00ca146105f75780631fd96bdb146105ff57806320e5672e14610612576104cc565b8063095ea7b311610495578063095ea7b31461055757806309a3bbe41461056a578063103ff68d1461057257806312b69b5d1461058557806313233679146105c9576104cc565b8062f40db6146104d15780630149e5c7146104fe57806302ac816814610521578063036fe1bb1461052b57806306fdde0314610542575b600080fd5b6104e46104df366004614f33565b610b26565b604080519283526020830191909152015b60405180910390f35b61051161050c366004614e4d565b610fe9565b60405190151581526020016104f5565b61052961105a565b005b61053460195481565b6040519081526020016104f5565b61054a611155565b6040516104f59190615123565b610511610565366004614f0a565b6111e7565b610534611242565b610529610580366004614ed4565b611258565b6105b2610593366004614e4d565b601b602052600090815260409020805460019091015460ff9091169082565b6040805192151583526020830191909152016104f5565b6105296105d7366004614f0a565b6112e6565b6105346105ea366004614e67565b6113d5565b600a54610534565b6105346114aa565b61052961060d366004614f80565b6114c1565b61053460025481565b610511610629366004614e4d565b6001600160a01b03166000908152601b602052604090205460ff1690565b610534670de0b6b3a764000081565b610511610664366004614e99565b611639565b610529610677366004614ffe565b611792565b61051161068a366004614e4d565b6001600160a01b03166000908152601a602052604090205460ff1690565b6106b0611b89565b6040516001600160a01b0390911681526020016104f5565b600d5460405160ff90911681526020016104f5565b6012546106b0906001600160a01b031681565b6105296106fe366004614f0a565b611bb1565b610529610711366004614f0a565b611cf2565b610529610724366004614f80565b611db8565b610529610737366004614f80565b611ff3565b61053460055481565b6011546106b0906001600160a01b031681565b610529610766366004614f0a565b61213c565b61053460155481565b610534610782366004614e4d565b6001600160a01b03166000908152601e602052604090205490565b6105346107ab366004614f80565b612229565b6105116107be366004614f0a565b6125e0565b6105346107d1366004614e4d565b6001600160a01b031660009081526006602052604090205490565b6105296107fa366004614ffe565b6126b6565b61053461080d366004614f80565b612a3c565b61053466071afd498d000081565b6104e461082e366004614f33565b612c64565b6105346108413660046150b2565b6130d9565b6105346108543660046150b2565b613196565b61053461322c565b61053461086f3660046150b2565b613243565b6104e4610882366004614f33565b6132f9565b610529610895366004614fce565b613641565b6105296108a8366004614e4d565b613729565b6105346137cd565b6105346108c3366004614e4d565b6137e0565b61054a61383c565b61053461384b565b6003546106b0906001600160a01b031681565b6542524f4e5a4560d01b610534565b610529610908366004614fce565b613869565b610529613885565b610534610923366004615078565b6138b5565b61053460185481565b61052961093f366004614fce565b61391a565b61053460015481565b61051161095b366004614f0a565b613936565b61053461096e366004614e4d565b6001600160a01b03166000908152601d602052604090205490565b610529610997366004614f0a565b61398d565b610534600881565b6105116109b2366004614e4d565b601c6020526000908152604090205460ff1681565b610534600281565b6105296109dd366004614fce565b613a45565b610534600181565b6104e46109f83660046150b2565b613b33565b610534613bc4565b610529610a13366004614e4d565b613be3565b610534600081565b6010546106b0906001600160a01b031681565b610529610a41366004614ed4565b613c1c565b610534610a54366004614e4d565b613c5e565b61053460045481565b610534613cc4565b610511610a78366004614f0a565b613ce3565b610534610a8b366004614e67565b6001600160a01b03918216600090815260096020908152604080832093909416825291909152205490565b610534613d56565b610534610acc366004614e4d565b613d69565b61053460165481565b610534610ae8366004614e4d565b613dcf565b6104e4610afb3660046150b2565b613e2b565b610511601254600160a01b900460ff1690565b6104e4610b21366004614f33565b613ed5565b600080610b32336142a3565b15610b585760405162461bcd60e51b8152600401610b4f906152b2565b60405180910390fd5b336001600160a01b03166000356001600160e01b0319166001600160e01b031916600036604051610b8a9291906150f4565b60405180910390a2600d54610100900460ff1615610ba757600080fd5b600d805461ff0019166101001790556010546001600160a01b03888116911614610c0c5760405162461bcd60e51b8152602060048201526016602482015275086c2dc40dedcd8f240c4eaf240eed2e8d040cc8aa8960531b6044820152606401610b4f565b601254600160a01b900460ff16610c355760405162461bcd60e51b8152600401610b4f90615338565b336000908152601e6020526040902054861115610c945760405162461bcd60e51b815260206004820152601d60248201527f4e6f7420656e6f75676820664554482c206465706f736974206d6f72650000006044820152606401610b4f565b6001600160a01b038088166000908152601a6020526040808220928816825290206003820154610cd690610cd16002670de0b6b3a76400006153b4565b6142f5565b881115610cf55760405162461bcd60e51b8152600401610b4f906151e4565b6000610d1d8360030154846002015484600301548560020154601354600061092391906153c8565b905085811115610d3f5760405162461bcd60e51b8152600401610b4f90615285565b6000610d6884600301548560020154856003015486600201548e60135460006109f891906153c8565b909650905087861015610d8d5760405162461bcd60e51b8152600401610b4f90615237565b610db38460030154856002015485600301548660020154601354600061092391906153c8565b945086851115610dd55760405162461bcd60e51b8152600401610b4f9061530f565b604080518b8152602081018890526001600160a01b03808c1692908e169133916000805160206154a3833981519152910160405180910390a4336000908152601e6020526040902054610e29908b906153e7565b336000908152601e6020908152604080832093909355601d90522054610e5090879061539c565b336000908152601d6020526040902055601954610e6e908b906153e7565b601955601854610e7f90879061539c565b60188190556011546040516370a0823160e01b81523060048201526001600160a01b03909116906370a08231906024015b60206040518083038186803b158015610ec857600080fd5b505afa158015610edc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f009190614fe6565b610f0a91906153e7565b6011546001600160a01b039081166000908152601a6020526040908190206003019290925560195460105492516370a0823160e01b81523060048201529092909116906370a082319060240160206040518083038186803b158015610f6e57600080fd5b505afa158015610f82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa69190614fe6565b610fb091906153e7565b6010546001600160a01b03166000908152601a602052604090206003015550505050600d805461ff001916905590969095509350505050565b60006001600160a01b0382166110375760405162461bcd60e51b815260206004820152601360248201527273657474696e67203020616464726573733b3b60681b6044820152606401610b4f565b506001600160a01b0381166000908152601c602052604090205460ff165b919050565b336001600160a01b03166000356001600160e01b0319166001600160e01b03191660003660405161108c9291906150f4565b60405180910390a2600d54610100900460ff16156110a957600080fd5b600d805461ff001916610100179055600f54336001600160a01b03909116146110d157600080fd5b60145460ff16156110e157600080fd5b601754600211156110f157600080fd5b6014805460ff191660011790556012805460ff60a01b1916600160a01b17905561112c611127670de0b6b3a764000060646153c8565b6143da565b61114833611143670de0b6b3a764000060646153c8565b614413565b600d805461ff0019169055565b6060600b8054611164906153fe565b80601f0160208091040260200160405190810160405280929190818152602001828054611190906153fe565b80156111dd5780601f106111b2576101008083540402835291602001916111dd565b820191906000526020600020905b8154815290600101906020018083116111c057829003601f168201915b5050505050905090565b3360008181526009602090815260408083206001600160a01b038716808552925280832085905551919290916000805160206154c3833981519152906112309086815260200190565b60405180910390a35060015b92915050565b611255670de0b6b3a764000060326153c8565b81565b600e546001600160a01b0316331461126f57600080fd5b6001600160a01b0382166112bb5760405162461bcd60e51b815260206004820152601360248201527273657474696e67203020616464726573733b3b60681b6044820152606401610b4f565b6001600160a01b03919091166000908152601c60205260409020805460ff1916911515919091179055565b336000908152601d60205260409020548111156113365760405162461bcd60e51b815260206004820152600e60248201526d4e6f7420656e6f7567682054525960901b6044820152606401610b4f565b6011546001600160a01b038381169116146113865760405162461bcd60e51b815260206004820152601060248201526f13db9b1e4815149648185b1b1bddd95960821b6044820152606401610b4f565b8060185461139491906153e7565b601855336000908152601d60205260409020546113b29082906153e7565b336000818152601d60205260409020919091556113d19083908361444e565b5050565b600d54600090610100900460ff16156113ed57600080fd5b6001600160a01b0383166000908152601a602052604090205460ff166114255760405162461bcd60e51b8152600401610b4f9061525e565b6001600160a01b0382166000908152601a602052604090205460ff1661145d5760405162461bcd60e51b8152600401610b4f9061525e565b6001600160a01b038084166000908152601a60205260408082209285168252902060038083015460028085015492840154908401546013546114a1949291906138b5565b95945050505050565b6112556402540be400670de0b6b3a76400006153b4565b336001600160a01b03166000356001600160e01b0319166001600160e01b0319166000366040516114f39291906150f4565b60405180910390a26010546001600160a01b0384811691161461151557600080fd5b600f546001600160a01b0316331461152c57600080fd5b6001600160a01b0383166000908152601a602052604090205460ff161561155257600080fd5b60145460ff161561156257600080fd5b60175460081161157157600080fd5b6040805160808101825260018082526017805460208085019182526000858701818152606087018281526001600160a01b038c16808452601a9094529782209651875460ff1916901515178755925186860155915160028601559451600390940193909355805491820181559091527fc624b66cc0138b8fabc209247f72d758e1cf3343756d543badbf24212bed8c150180546001600160a01b03191690911790556116348360646116248560636153c8565b61162e91906153b4565b83611db8565b505050565b6000336001600160a01b038516148061167557506001600160a01b03841660009081526009602090815260408083203384529091529020548211155b61167e57600080fd5b336000908152601b60205260409020805460ff161515600114156116c05742816001015411156116c05760405162461bcd60e51b8152600401610b4f90615176565b6116cb858585614547565b336001600160a01b0386161480159061170657506001600160a01b038516600090815260096020908152604080832033845290915290205415155b15611787576001600160a01b03851660009081526009602090815260408083203384529091529020546117399084614657565b6001600160a01b0386811660009081526009602090815260408083203380855290835292819020859055519384529187169290916000805160206154c3833981519152910160405180910390a35b506001949350505050565b336001600160a01b03166000356001600160e01b0319166001600160e01b0319166000366040516117c49291906150f4565b60405180910390a2600d54610100900460ff16156117e157600080fd5b600d805461ff00191661010017905560145460ff166118355760405162461bcd60e51b815260206004820152601060248201526f11549497d393d517d310555390d2115160821b6044820152606401610b4f565b336000908152601b60205260409020805460ff161515600114156118775742816001015411156118775760405162461bcd60e51b8152600401610b4f90615176565b6000611882600a5490565b905060006118918660006142f5565b9050600061189f8783614657565b905060006118ad82856146b4565b9050806118cc5760405162461bcd60e51b8152600401610b4f9061520e565b6118d633896147cc565b600d546118f2906201000090046001600160a01b031684614413565b6118fb826147fe565b60005b601754811015611b735760006017828154811061192b57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b0316808352601a90915260408220600301549092509061196085836142f5565b90508061197f5760405162461bcd60e51b8152600401610b4f9061520e565b8a8a8581811061199f57634e487b7160e01b600052603260045260246000fd5b905060200201358110156119c55760405162461bcd60e51b8152600401610b4f90615237565b6040518181526001600160a01b0384169033907fe74c91552b64c2e2e7bd255639e004e693bd3e1d01cc33e65610b86afcc1ffed9060200160405180910390a3611a1083338361444e565b6018546011546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b158015611a5657600080fd5b505afa158015611a6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a8e9190614fe6565b611a9891906153e7565b6011546001600160a01b039081166000908152601a6020526040908190206003019290925560195460105492516370a0823160e01b81523060048201529092909116906370a082319060240160206040518083038186803b158015611afc57600080fd5b505afa158015611b10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b349190614fe6565b611b3e91906153e7565b6010546001600160a01b03166000908152601a602052604090206003015550829150611b6b905081615439565b9150506118fe565b5050600d805461ff001916905550505050505050565b600d54600090610100900460ff1615611ba157600080fd5b50600e546001600160a01b031690565b336001600160a01b03166000356001600160e01b0319166001600160e01b031916600036604051611be39291906150f4565b60405180910390a2600d54610100900460ff1615611c0057600080fd5b600d805461ff001916610100179055600e54336001600160a01b0390911614611c2857600080fd5b6001600160a01b0382166000908152601a602052604090205460ff1615611c4e57600080fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a082319060240160206040518083038186803b158015611c9057600080fd5b505afa158015611ca4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cc89190614fe6565b905080821115611cd757600080fd5b611ce283338461444e565b5050600d805461ff001916905550565b6011546001600160a01b03838116911614611d425760405162461bcd60e51b815260206004820152601060248201526f13db9b1e4815149648185b1b1bddd95960821b6044820152606401610b4f565b60006064611d518360626153c8565b611d5b91906153b4565b9050611d6883338461480a565b6000611d7482846153e7565b905080601854611d84919061539c565b601855336000908152601d6020526040902054611da290829061539c565b336000908152601d602052604090205550505050565b336001600160a01b03166000356001600160e01b0319166001600160e01b031916600036604051611dea9291906150f4565b60405180910390a2600d54610100900460ff1615611e0757600080fd5b600d805461ff001916610100179055600f54336001600160a01b0390911614611e2f57600080fd5b6001600160a01b0383166000908152601a602052604090205460ff16611e5457600080fd5b60145460ff1615611e6457600080fd5b670de0b6b3a7640000811015611e7957600080fd5b611e8c670de0b6b3a764000060326153c8565b811115611e9857600080fd5b611eaf64e8d4a51000670de0b6b3a76400006153b4565b821015611ebb57600080fd5b6001600160a01b0383166000908152601a602052604090206002015480821115611f1d57611ef4601f54611eef8484614657565b61486f565b601f55611f0a670de0b6b3a764000060326153c8565b601f541115611f1857600080fd5b611f3e565b80821015611f3e57611f3a601f54611f358385614657565b614657565b601f555b6001600160a01b0384166000908152601a602052604090206002810183905560030180549084905580841115611f8757611f828533611f7d8785614657565b61480a565b611fe1565b80841015611fe1576000611f9b8286614657565b90506000611faa8260006142f5565b9050611fc08733611fbb8585614657565b61444e565b600d54611fde9088906201000090046001600160a01b03168361444e565b50505b5050600d805461ff0019169055505050565b336001600160a01b03166000356001600160e01b0319166001600160e01b0319166000366040516120259291906150f4565b60405180910390a2600f546001600160a01b0316331461204457600080fd5b6001600160a01b0383166000908152601a602052604090205460ff161561206a57600080fd5b60145460ff161561207a57600080fd5b60175460081161208957600080fd5b6040805160808101825260018082526017805460208085019182526000858701818152606087018281526001600160a01b038c16808452601a9094529782209651875460ff1916901515178755925186860155915160028601559451600390940193909355805491820181559091527fc624b66cc0138b8fabc209247f72d758e1cf3343756d543badbf24212bed8c150180546001600160a01b03191690911790556116348360646116248560626153c8565b6010546001600160a01b0383811691161461218d5760405162461bcd60e51b815260206004820152601160248201527013db9b1e481991551208185b1b1bddd959607a1b6044820152606401610b4f565b336000908152601e60205260409020548111156121de5760405162461bcd60e51b815260206004820152600f60248201526e09cdee840cadcdeeaced040cc8aa89608b1b6044820152606401610b4f565b806019546121ec91906153e7565b601955336000908152601e602052604090205461220a9082906153e7565b336000818152601e60205260409020919091556113d19083908361444e565b6000612234336142a3565b156122515760405162461bcd60e51b8152600401610b4f906152b2565b336001600160a01b03166000356001600160e01b0319166001600160e01b0319166000366040516122839291906150f4565b60405180910390a2600d54610100900460ff16156122a057600080fd5b600d805461ff0019166101001790556010546001600160a01b038581169116146123005760405162461bcd60e51b8152602060048201526011602482015270086c2dc40dedcd8f240c2c8c840cc8aa89607b1b6044820152606401610b4f565b60145460ff166123465760405162461bcd60e51b815260206004820152601160248201527011549497d393d517d19253905312569151607a1b6044820152606401610b4f565b6001600160a01b0384166000908152601a602052604090205460ff1661237e5760405162461bcd60e51b8152600401610b4f9061525e565b6001600160a01b0384166000908152601a60205260409020600301546005546123a791906142f5565b8311156123c65760405162461bcd60e51b8152600401610b4f906151e4565b6001600160a01b0384166000908152601a60205260409020828210156123fe5760405162461bcd60e51b8152600401610b4f90615237565b600381015461241e9060646124148760636153c8565b611f3591906153b4565b60038201556040518481526001600160a01b0386169033907f63982df10efd8dfaaaa0fcc7f50b2d93b7cba26ccc48adee2873220d485dc39a9060200160405180910390a361246c826143da565b6124763383614413565b61248185338661480a565b6018546011546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b1580156124c757600080fd5b505afa1580156124db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124ff9190614fe6565b61250991906153e7565b6011546001600160a01b039081166000908152601a6020526040908190206003019290925560195460105492516370a0823160e01b81523060048201529092909116906370a082319060240160206040518083038186803b15801561256d57600080fd5b505afa158015612581573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125a59190614fe6565b6125af91906153e7565b6010546001600160a01b03166000908152601a602052604090206003015550600d805461ff00191690559392505050565b3360009081526009602090815260408083206001600160a01b038616845290915281205480831115612635573360009081526009602090815260408083206001600160a01b0388168452909152812055612664565b61263f8184614657565b3360009081526009602090815260408083206001600160a01b03891684529091529020555b3360008181526009602090815260408083206001600160a01b038916808552908352928190205490519081529192916000805160206154c3833981519152910160405180910390a35060019392505050565b336001600160a01b03166000356001600160e01b0319166001600160e01b0319166000366040516126e89291906150f4565b60405180910390a2600d54610100900460ff161561270557600080fd5b600d805461ff00191661010017905560145460ff166127595760405162461bcd60e51b815260206004820152601060248201526f11549497d393d517d310555390d2115160821b6044820152606401610b4f565b6000612764600a5490565b9050600061277285836146b4565b9050806127915760405162461bcd60e51b8152600401610b4f9061520e565b60005b601754811015612a28576000601782815481106127c157634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b0316808352601a9091526040822060030154909250906127f685836142f5565b9050806128155760405162461bcd60e51b8152600401610b4f9061520e565b87878581811061283557634e487b7160e01b600052603260045260246000fd5b9050602002013581111561287a5760405162461bcd60e51b815260206004820152600c60248201526b22a9292fa624a6a4aa2fa4a760a11b6044820152606401610b4f565b6040518181526001600160a01b0384169033907f63982df10efd8dfaaaa0fcc7f50b2d93b7cba26ccc48adee2873220d485dc39a9060200160405180910390a36128c583338361480a565b6018546011546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b15801561290b57600080fd5b505afa15801561291f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129439190614fe6565b61294d91906153e7565b6011546001600160a01b039081166000908152601a6020526040908190206003019290925560195460105492516370a0823160e01b81523060048201529092909116906370a082319060240160206040518083038186803b1580156129b157600080fd5b505afa1580156129c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129e99190614fe6565b6129f391906153e7565b6010546001600160a01b03166000908152601a602052604090206003015550829150612a20905081615439565b915050612794565b50612a32856143da565b611fe13386614413565b60405160009033906001600160e01b031983351690612a5e90849036906150f4565b60405180910390a2600d54610100900460ff1615612a7b57600080fd5b600d805461ff0019166101001790556011546001600160a01b03858116911614612ada5760405162461bcd60e51b815260206004820152601060248201526f43616e206f6e6c79206164642054525960801b6044820152606401610b4f565b60145460ff16612b205760405162461bcd60e51b815260206004820152601160248201527011549497d393d517d19253905312569151607a1b6044820152606401610b4f565b6001600160a01b0384166000908152601a602052604090205460ff16612b585760405162461bcd60e51b8152600401610b4f9061525e565b6001600160a01b0384166000908152601a6020526040902060030154600554612b8191906142f5565b831115612ba05760405162461bcd60e51b8152600401610b4f906151e4565b6001600160a01b0384166000908152601a6020526040902082821015612bd85760405162461bcd60e51b8152600401610b4f90615237565b6003810154612bee9060646124148760626153c8565b60038201556040518481526001600160a01b0386169033907f63982df10efd8dfaaaa0fcc7f50b2d93b7cba26ccc48adee2873220d485dc39a9060200160405180910390a3612c3c826143da565b612c463383614413565b612c5185338661480a565b50600d805461ff00191690559392505050565b600080612c70336142a3565b15612c8d5760405162461bcd60e51b8152600401610b4f906152b2565b336001600160a01b03166000356001600160e01b0319166001600160e01b031916600036604051612cbf9291906150f4565b60405180910390a2600d54610100900460ff1615612cdc57600080fd5b600d805461ff0019166101001790556011546001600160a01b03888116911614612d3c5760405162461bcd60e51b815260206004820152601160248201527043616e206f6e6c792073656c6c2054525960781b6044820152606401610b4f565b601254600160a01b900460ff16612d655760405162461bcd60e51b8152600401610b4f90615338565b6001600160a01b038088166000908152601a6020526040808220928816825290206003820154600454612d9891906142f5565b881115612dd85760405162461bcd60e51b815260206004820152600e60248201526d4552525f53454c4c5f524154494f60901b6044820152606401610b4f565b6000612df983600301548460020154846003015485600201546013546138b5565b905085811115612e1b5760405162461bcd60e51b8152600401610b4f90615285565b6000612e3d84600301548560020154856003015486600201548e601354613b33565b909650905087861015612e625760405162461bcd60e51b8152600401610b4f90615237565b612e8184600301548560020154856003015486600201546013546138b5565b945086851115612ea35760405162461bcd60e51b8152600401610b4f9061530f565b6001600160a01b03808a16908c16336000805160206154a38339815191526064612ece8f60626153c8565b612ed891906153b4565b6064612ee58c60636153c8565b612eef91906153b4565b6040805192835260208301919091520160405180910390a4612f128b338c61480a565b6000612f2687610cd16015546127106146b4565b90506000612f3c88610cd16016546127106146b4565b90506000612f4e89611f35858561486f565b9050612f5b8c338361444e565b612f658c846148c8565b612f6f8c836149c4565b6018546011546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b158015612fb557600080fd5b505afa158015612fc9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fed9190614fe6565b612ff791906153e7565b6011546001600160a01b039081166000908152601a6020526040908190206003019290925560195460105492516370a0823160e01b81523060048201529092909116906370a082319060240160206040518083038186803b15801561305b57600080fd5b505afa15801561306f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130939190614fe6565b61309d91906153e7565b6010546001600160a01b03166000908152601a602052604090206003015550505050505050600d805461ff001916905590969095509350505050565b6000806130e687866146b4565b905060006131056130ff670de0b6b3a764000084614657565b856142f5565b905060006131248661311f670de0b6b3a764000085614657565b6146b4565b905060006131328b83614657565b90506000613140828d6146b4565b9050600061314e8287614a27565b9050600061315c828d6142f5565b9050600061316a8d83614657565b90506131838161311f670de0b6b3a76400006000614657565b9f9e505050505050505050505050505050565b6000806131a387866146b4565b905060006131bc6130ff670de0b6b3a764000084614657565b905060006131d686610cd1670de0b6b3a764000085614657565b905060006131e48b8361486f565b905060006131f2828d6146b4565b905060006132008287614a27565b9050600061320e828d6142f5565b905061321a818d614657565b9e9d5050505050505050505050505050565b61125564e8d4a51000670de0b6b3a76400006153b4565b60008061325087866146b4565b9050600061326b85610cd1670de0b6b3a76400006000614657565b905060006132798883614657565b90506000613287828a6146b4565b905060006132a6826132a1670de0b6b3a7640000886146b4565b614a27565b905060006132b4828e6142f5565b905060006132c28e83614657565b905060006132e16132db670de0b6b3a76400008a614657565b8b6142f5565b905061318382610cd1670de0b6b3a764000084614657565b600080613305336142a3565b156133225760405162461bcd60e51b8152600401610b4f906152b2565b336001600160a01b03166000356001600160e01b0319166001600160e01b0319166000366040516133549291906150f4565b60405180910390a2600d54610100900460ff161561337157600080fd5b600d805461ff0019166101001790556010546001600160a01b038881169116146133d65760405162461bcd60e51b8152602060048201526016602482015275086c2dc40dedcd8f240c4eaf240eed2e8d040cc8aa8960531b6044820152606401610b4f565b601254600160a01b900460ff166133ff5760405162461bcd60e51b8152600401610b4f90615338565b6001600160a01b038088166000908152601a602052604080822092881682529020600382015461343c90610cd16002670de0b6b3a76400006153b4565b88111561345b5760405162461bcd60e51b8152600401610b4f906151e4565b60006134838360030154846002015484600301548560020154601354600061092391906153c8565b9050858111156134a55760405162461bcd60e51b8152600401610b4f90615285565b60006134e5846003015485600201548560030154866002015460648f60636134cd91906153c8565b6134d791906153b4565b6013546109f89060006153c8565b90965090508786101561350a5760405162461bcd60e51b8152600401610b4f90615237565b61352984600301548560020154856003015486600201546013546138b5565b94508185101561354b5760405162461bcd60e51b8152600401610b4f9061520e565b8685111561356b5760405162461bcd60e51b8152600401610b4f9061530f565b6135758a876146b4565b8211156135945760405162461bcd60e51b8152600401610b4f9061520e565b6001600160a01b03808a16908c16336000805160206154a383398151915260646135bf8f60636153c8565b6135c991906153b4565b60646135d68c60626153c8565b6135e091906153b4565b6040805192835260208301919091520160405180910390a46136038b338c61480a565b61360e89338861444e565b6018546011546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401610eb0565b600f546001600160a01b0316331461369b5760405162461bcd60e51b815260206004820152601a60248201527f596f7520646f206e6f742068617665207065726d697373696f6e0000000000006044820152606401610b4f565b600081116136dd5760405162461bcd60e51b815260206004820152600f60248201526e31b0b73737ba103a3ab9371037b33360891b6044820152606401610b4f565b60648111156137245760405162461bcd60e51b815260206004820152601360248201527263616e6e6f742073657420756e64657220312560681b6044820152606401610b4f565b600155565b336001600160a01b03166000356001600160e01b0319166001600160e01b03191660003660405161375b9291906150f4565b60405180910390a2600d54610100900460ff161561377857600080fd5b600d805461ff001916610100179055600e54336001600160a01b03909116146137a057600080fd5b600e80546001600160a01b0319166001600160a01b0392909216919091179055600d805461ff0019169055565b611255670de0b6b3a764000060646153c8565b600d54600090610100900460ff16156137f857600080fd5b6001600160a01b0382166000908152601a602052604090205460ff1661381d57600080fd5b506001600160a01b03166000908152601a602052604090206002015490565b6060600c8054611164906153fe565b61385e6003670de0b6b3a76400006153b4565b61125590600161539c565b600e546001600160a01b0316331461388057600080fd5b601555565b336000818152601b60205260409020805460ff191660011781556138ac426276a70061539c565b60019091015550565b6000806138c287876146b4565b905060006138d086866146b4565b905060006138de83836146b4565b90506000613900670de0b6b3a764000061311f670de0b6b3a764000089614657565b905061390c82826142f5565b9a9950505050505050505050565b600e546001600160a01b0316331461393157600080fd5b601655565b336000908152601b60205260408120805460ff161515600114156139785742816001015411156139785760405162461bcd60e51b8152600401610b4f90615176565b613983338585614547565b5060019392505050565b6010546001600160a01b038381169116146139de5760405162461bcd60e51b815260206004820152601160248201527013db9b1e481991551208185b1b1bddd959607a1b6044820152606401610b4f565b6139e982338361480a565b600060646139f88360636153c8565b613a0291906153b4565b905080601954613a12919061539c565b601955336000908152601e6020526040902054613a3090829061539c565b336000908152601e6020526040902055505050565b600f546001600160a01b03163314613a9f5760405162461bcd60e51b815260206004820152601a60248201527f596f7520646f206e6f742068617665207065726d697373696f6e0000000000006044820152606401610b4f565b600a8111613ae55760405162461bcd60e51b815260206004820152601360248201527263616e6e6f7420736574206f7665722031302560681b6044820152606401610b4f565b60c8811115613b2e5760405162461bcd60e51b815260206004820152601560248201527463616e6e6f742073657420756e64657220302e352560581b6044820152606401610b4f565b600255565b6000806000613b4288876146b4565b90506000613b58670de0b6b3a764000086614657565b9050613b6486826142f5565b90506000613b768b61311f8d8561486f565b90506000613b848285614a27565b90506000613b9a670de0b6b3a764000083614657565b9050613ba68b826142f5565b9650613bb28985614657565b95505050505050965096945050505050565b6001613bd9670de0b6b3a764000060026153c8565b61125591906153e7565b600e546001600160a01b03163314613bfa57600080fd5b601280546001600160a01b0319166001600160a01b0392909216919091179055565b600e546001600160a01b03163314613c3357600080fd5b6001600160a01b03919091166000908152601b60205260409020805460ff1916911515919091179055565b600d54600090610100900460ff1615613c7657600080fd5b6001600160a01b0382166000908152601a602052604090205460ff16613c9b57600080fd5b6019546001600160a01b0383166000908152601a602052604090206003015461123c919061539c565b600d54600090610100900460ff1615613cdc57600080fd5b5060135490565b3360009081526009602090815260408083206001600160a01b0386168452909152812054613d11908361486f565b3360008181526009602090815260408083206001600160a01b038916808552908352928190208590555193845290926000805160206154c38339815191529101611230565b6112556002670de0b6b3a76400006153b4565b600d54600090610100900460ff1615613d8157600080fd5b6001600160a01b0382166000908152601a602052604090205460ff16613da657600080fd5b6018546001600160a01b0383166000908152601a602052604090206003015461123c919061539c565b600d54600090610100900460ff1615613de757600080fd5b6001600160a01b0382166000908152601a602052604090205460ff16613e0c57600080fd5b506001600160a01b03166000908152601a602052604090206003015490565b6000806000613e3a86896146b4565b90506000613e488887614657565b90506000613e5689836146b4565b90506000613e648285614a27565b9050613e7881670de0b6b3a7640000614657565b9050613e848c826142f5565b9050613e98670de0b6b3a764000088614657565b9550613ea481876146b4565b9550613eb881670de0b6b3a76400006146b4565b9450613ec48686614657565b945050505050965096945050505050565b600080613ee1336142a3565b15613efe5760405162461bcd60e51b8152600401610b4f906152b2565b336001600160a01b03166000356001600160e01b0319166001600160e01b031916600036604051613f309291906150f4565b60405180910390a2600d54610100900460ff1615613f4d57600080fd5b600d805461ff0019166101001790556011546001600160a01b03888116911614613fad5760405162461bcd60e51b815260206004820152601160248201527043616e206f6e6c792073656c6c2054525960781b6044820152606401610b4f565b601254600160a01b900460ff16613fd65760405162461bcd60e51b8152600401610b4f90615338565b336000908152601d60205260409020548611156140265760405162461bcd60e51b815260206004820152600e60248201526d4e6f7420656e6f7567682054525960901b6044820152606401610b4f565b6001600160a01b038088166000908152601a602052604080822092881682529020600382015460045461405991906142f5565b8811156140995760405162461bcd60e51b815260206004820152600e60248201526d4552525f53454c4c5f524154494f60901b6044820152606401610b4f565b60006140ba83600301548460020154846003015485600201546013546138b5565b9050858111156140dc5760405162461bcd60e51b8152600401610b4f90615285565b60006140fe84600301548560020154856003015486600201548e601354613b33565b9096509050878610156141235760405162461bcd60e51b8152600401610b4f90615237565b61414284600301548560020154856003015486600201546013546138b5565b9450818510156141645760405162461bcd60e51b8152600401610b4f9061520e565b868511156141845760405162461bcd60e51b8152600401610b4f9061530f565b61418e8a876146b4565b8211156141ad5760405162461bcd60e51b8152600401610b4f9061520e565b604080518b8152602081018890526001600160a01b03808c1692908e169133916000805160206154a3833981519152910160405180910390a460006141fa87610cd16015546127106146b4565b9050600061421088610cd16016546127106146b4565b9050600061422289611f35858561486f565b336000908152601d6020526040902054909150614240908e906153e7565b336000908152601d6020908152604080832093909355601e9052205461426790829061539c565b336000908152601e602052604090205560195461428590829061539c565b601955601854614296908e906153e7565b601855612f658c846148c8565b60006142ae82610fe9565b156142bb57506000611055565b813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081158015906142ed5750808214155b949350505050565b60008061430283856153c8565b905083158061431957508261431785836153b4565b145b6143585760405162461bcd60e51b815260206004820152601060248201526f4552525f4d554c5f4f564552464c4f5760801b6044820152606401610b4f565b600061436d6002670de0b6b3a76400006153b4565b614377908361539c565b9050818110156143bc5760405162461bcd60e51b815260206004820152601060248201526f4552525f4d554c5f4f564552464c4f5760801b6044820152606401610b4f565b60006143d0670de0b6b3a7640000836153b4565b9695505050505050565b600260005414156143fd5760405162461bcd60e51b8152600401610b4f90615365565b600260005561440b81614b53565b506001600055565b600260005414156144365760405162461bcd60e51b8152600401610b4f90615365565b60026000556144458282614bc9565b50506001600055565b600260005414156144715760405162461bcd60e51b8152600401610b4f90615365565b6002600090815560405163a9059cbb60e01b81526001600160a01b0384811660048301526024820184905285169063a9059cbb906044015b602060405180830381600087803b1580156144c357600080fd5b505af11580156144d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144fb9190614fb2565b90508061453c5760405162461bcd60e51b815260206004820152600f60248201526e4552525f45524332305f46414c534560881b6044820152606401610b4f565b505060016000555050565b6001600160a01b0383166000908152600660205260409020548111156145a45760405162461bcd60e51b81526020600482015260126024820152716572726f723a204c6f772042616c616e636560701b6044820152606401610b4f565b6001600160a01b0383166000908152600660205260409020546145c79082614657565b6001600160a01b0380851660009081526006602052604080822093909355908416815220546145f6908261486f565b6001600160a01b0380841660008181526006602052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061464a9085815260200190565b60405180910390a3505050565b60008060006146668585614bd4565b9150915080156146ac5760405162461bcd60e51b81526020600482015260116024820152704552525f5355425f554e444552464c4f5760781b6044820152606401610b4f565b509392505050565b6000816146f25760405162461bcd60e51b815260206004820152600c60248201526b4552525f4449565f5a45524f60a01b6044820152606401610b4f565b6000614706670de0b6b3a7640000856153c8565b90508315806147255750670de0b6b3a764000061472385836153b4565b145b6147645760405162461bcd60e51b815260206004820152601060248201526f11549497d1125597d25395115493905360821b6044820152606401610b4f565b60006147716002856153b4565b61477b908361539c565b9050818110156147c05760405162461bcd60e51b815260206004820152601060248201526f11549497d1125597d25395115493905360821b6044820152606401610b4f565b60006143d085836153b4565b600260005414156147ef5760405162461bcd60e51b8152600401610b4f90615365565b60026000556144458282614c0b565b61480781614c16565b50565b6002600054141561482d5760405162461bcd60e51b8152600401610b4f90615365565b600260009081556040516323b872dd60e01b81526001600160a01b038481166004830152306024830152604482018490528516906323b872dd906064016144a9565b60008061487c838561539c565b9050838110156148c15760405162461bcd60e51b815260206004820152601060248201526f4552525f4144445f4f564552464c4f5760801b6044820152606401610b4f565b9392505050565b600260005414156148eb5760405162461bcd60e51b8152600401610b4f90615365565b6002600090815560035460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018490529084169063a9059cbb906044015b602060405180830381600087803b15801561494157600080fd5b505af1158015614955573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906149799190614fb2565b9050806149ba5760405162461bcd60e51b815260206004820152600f60248201526e4552525f45524332305f46414c534560881b6044820152606401610b4f565b5050600160005550565b600260005414156149e75760405162461bcd60e51b8152600401610b4f90615365565b6002600090815560125460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018490529084169063a9059cbb90604401614927565b60006001831015614a725760405162461bcd60e51b81526020600482015260156024820152744552525f42504f575f424153455f544f4f5f4c4f5760581b6044820152606401610b4f565b6001614a87670de0b6b3a764000060026153c8565b614a9191906153e7565b831115614ad95760405162461bcd60e51b815260206004820152601660248201527508aa4a4be84a09eaebe8482a68abea89e9ebe90928e960531b6044820152606401610b4f565b6000614ae483614ca1565b90506000614af28483614657565b90506000614b0886614b0385614cbf565b614cd3565b905081614b1957925061123c915050565b6000614b3c8784614b376402540be400670de0b6b3a76400006153b4565b614d46565b9050614b4882826142f5565b979650505050505050565b30600090815260066020526040902054614b6d908261486f565b30600090815260066020526040902055600a54614b8a908261486f565b600a5560405181815230906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020015b60405180910390a350565b6113d1308383614547565b600080828410614bf357614be883856153e7565b600091509150614c04565b614bfd84846153e7565b6001915091505b9250929050565b6113d1823083614547565b30600090815260066020526040902054811115614c3257600080fd5b30600090815260066020526040902054614c4c9082614657565b30600090815260066020526040902055600a54614c699082614657565b600a5560405181815260009030907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001614bbe565b6000670de0b6b3a7640000614cb583614cbf565b61123c91906153c8565b600061123c670de0b6b3a7640000836153b4565b600080614ce1600284615454565b614cf357670de0b6b3a7640000614cf5565b835b9050614d026002846153b4565b92505b82156148c157614d1584856142f5565b9350614d22600284615454565b15614d3457614d3181856142f5565b90505b614d3f6002846153b4565b9250614d05565b6000828180614d5d87670de0b6b3a7640000614bd4565b9092509050670de0b6b3a764000080600060015b888410614e27576000614d8c670de0b6b3a7640000836153c8565b9050600080614dac8a614da785670de0b6b3a7640000614657565b614bd4565b91509150614dbe87610cd1848c6142f5565b9650614dca87846146b4565b965086614dd957505050614e27565b8715614de3579315935b8015614ded579315935b8415614e0457614dfd8688614657565b9550614e11565b614e0e868861486f565b95505b5050508080614e1f90615439565b915050614d71565b50909998505050505050505050565b80356001600160a01b038116811461105557600080fd5b600060208284031215614e5e578081fd5b6148c182614e36565b60008060408385031215614e79578081fd5b614e8283614e36565b9150614e9060208401614e36565b90509250929050565b600080600060608486031215614ead578081fd5b614eb684614e36565b9250614ec460208501614e36565b9150604084013590509250925092565b60008060408385031215614ee6578182fd5b614eef83614e36565b91506020830135614eff81615494565b809150509250929050565b60008060408385031215614f1c578182fd5b614f2583614e36565b946020939093013593505050565b600080600080600060a08688031215614f4a578081fd5b614f5386614e36565b945060208601359350614f6860408701614e36565b94979396509394606081013594506080013592915050565b600080600060608486031215614f94578283fd5b614f9d84614e36565b95602085013595506040909401359392505050565b600060208284031215614fc3578081fd5b81516148c181615494565b600060208284031215614fdf578081fd5b5035919050565b600060208284031215614ff7578081fd5b5051919050565b600080600060408486031215615012578283fd5b83359250602084013567ffffffffffffffff80821115615030578384fd5b818601915086601f830112615043578384fd5b813581811115615051578485fd5b8760208260051b8501011115615065578485fd5b6020830194508093505050509250925092565b600080600080600060a0868803121561508f578081fd5b505083359560208501359550604085013594606081013594506080013592509050565b60008060008060008060c087890312156150ca578081fd5b505084359660208601359650604086013595606081013595506080810135945060a0013592509050565b60006020825282602083015282846040840137818301604090810191909152601f909201601f19160101919050565b6000602080835283518082850152825b8181101561514f57858101830151858201604001528201615133565b818111156151605783604083870101525b50601f01601f1916929092016040019392505050565b60208082526048908201527f4c6971756964697479206973206c6f636b65642c20796f752063616e6e6f742060408201527f72656d6f766564206c697175696469747920756e74696c206166746572206c6f60608201526731b5903a34b6b29760c11b608082015260a00190565b60208082526010908201526f4552525f4d41585f494e5f524154494f60801b604082015260600190565b6020808252600f908201526e08aa4a4be9a82a890be82a0a0a49eb608b1b604082015260600190565b6020808252600d908201526c11549497d31253525517d3d555609a1b604082015260600190565b6020808252600d908201526c11549497d393d517d093d55391609a1b604082015260600190565b6020808252601390820152724552525f4241445f4c494d49545f505249434560681b604082015260600190565b6020808252603e908201527f556e617070726f76656420636f6e74726163747320617265206e6f7420616c6c60408201527f6f77656420746f20696e74657261637420776974682074686520737761700000606082015260800190565b6020808252600f908201526e4552525f4c494d49545f505249434560881b604082015260600190565b6020808252601390820152724552525f535741505f4e4f545f5055424c494360681b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b600082198211156153af576153af615468565b500190565b6000826153c3576153c361547e565b500490565b60008160001904831182151516156153e2576153e2615468565b500290565b6000828210156153f9576153f9615468565b500390565b600181811c9082168061541257607f821691505b6020821081141561543357634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561544d5761544d615468565b5060010190565b6000826154635761546361547e565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b801515811461480757600080fdfe908fb5ee8f16c6bc9bc3690973819f32a4d4b10188134543c88706e0e1d433788c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925a2646970667358221220c17110c6e5af8c05798a645ebfb68b9a88d7508f14999baecdba1ee990ba270364736f6c63430008030033

Verified Source Code Full Match

Compiler: v0.8.3+commit.8d00100c EVM: istanbul Optimization: Yes (200 runs)
new farm.sol 1398 lines
/**
 *Submitted for verification at BscScan.com on 2021-04-14
*/

// SPDX-License-Identifier: UNLICENSED 
pragma solidity 0.8.3;     


/*
* Must wrap your BNB for fETH to use FEGex DEX

Built for fETH - FEG Wapped BNB - Built in 1% frictionless rewards of BNB!  Stake BNB with fETH and earn rewards!
*/


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;
    }
}

interface stakeContract {
    function DisributeTxFunds() external;
    function ADDFUNDS(uint256 tokens) external;
}

contract FSilver  {
     function getColor()
        external pure
        returns (bytes32) {
            return bytes32("BRONZE");
        }
}


contract FConst is FSilver, ReentrancyGuard {
    uint public constant BASE              = 10**18;

    uint public constant MIN_BOUND_TOKENS  = 2;
    uint public constant MAX_BOUND_TOKENS  = 8;

    uint public constant MIN_FEE           = 2000000000000000; 
    uint public constant MAX_FEE           = 2000000000000000; // FREE BUYS
    uint public constant EXIT_FEE          = 0;

    uint public constant MIN_WEIGHT        = BASE;
    uint public constant MAX_WEIGHT        = BASE * 50;
    uint public constant MAX_TOTAL_WEIGHT  = BASE * 50;
    uint public constant MIN_BALANCE       = BASE / 10**12;

    uint public constant INIT_POOL_SUPPLY  = BASE * 100;
    
    uint public  SM = 10;
    uint public  M1 = 10;
    address public FEGstake = 0x04788562Ab11eA3a5201d579e2b3Ee7A3F74F1fA;
    uint public constant MIN_BPOW_BASE     = 1 wei;
    uint public constant MAX_BPOW_BASE     = (2 * BASE) - 1 wei;
    uint public constant BPOW_PRECISION    = BASE / 10**10;

    uint public constant MAX_IN_RATIO      = BASE / 2;
    uint public constant MAX_OUT_RATIO     = (BASE / 3) + 1 wei;
    uint public MAX_SELL_RATIO             = BASE / SM;
    uint public MAX_1_RATIO             = BASE / M1;
}


contract FNum is ReentrancyGuard, FConst {

    function btoi(uint a)
        internal pure
        returns (uint)
    {
        return a / BASE;
    }

    function bfloor(uint a)
        internal pure
        returns (uint)
    {
        return btoi(a) * BASE;
    }

    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;
    }

    // DSMath.wpow
    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)
    {
        require(base >= MIN_BPOW_BASE, "ERR_BPOW_BASE_TOO_LOW");
        require(base <= MAX_BPOW_BASE, "ERR_BPOW_BASE_TOO_HIGH");

        uint whole  = bfloor(exp);
        uint remain = bsub(exp, whole);

        uint wholePow = bpowi(base, btoi(whole));

        if (remain == 0) {
            return wholePow;
        }

        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 FMath is FSilver, FConst, FNum {
    
    function calcSpotPrice(
        uint tokenBalanceIn,
        uint tokenWeightIn,
        uint tokenBalanceOut,
        uint tokenWeightOut,
        uint swapFee
    )
        public pure
        returns (uint spotPrice)
    {
        uint numer = bdiv(tokenBalanceIn, tokenWeightIn);
        uint denom = bdiv(tokenBalanceOut, tokenWeightOut);
        uint ratio = bdiv(numer, denom);
        uint scale = bdiv(BASE, bsub(BASE, swapFee));
        return  (spotPrice = bmul(ratio, scale));
    }
    
    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 tokenInFee)
    {
        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);
        tokenInFee = bdiv(foo, BASE);
        tokenInFee = bsub(tokenAmountIn, tokenInFee);
        return (tokenAmountIn, tokenInFee);
    }


    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 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, EXIT_FEE));
        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 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, EXIT_FEE));
        return (poolAmountIn);
    }
}
// Highly opinionated token implementation

interface IERC20 {

    function totalSupply() external view returns (uint);
    function balanceOf(address whom) external view returns (uint);
    function allowance(address src, address dst) external view returns (uint);

    function approve(address dst, uint amt) external returns (bool);
    function transfer(address dst, uint amt) external returns (bool);
    function transferFrom(
        address src, address dst, uint amt
    ) external returns (bool);
}

contract FTokenBase is ReentrancyGuard, FNum {

    mapping(address => uint)                   internal _balance;
    mapping(address => uint)                   internal _balance1;
    mapping(address => uint)                   internal _balance2;
    mapping(address => mapping(address=>uint)) internal _allowance;
    uint internal _totalSupply;
    

    event Approval(address indexed src, address indexed dst, uint amt);
    event Transfer(address indexed src, address indexed dst, uint amt);
    //event DepositFEG(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, "error: Low Balance");
        _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 ReentrancyGuard, FTokenBase {

    string  private _name     = " TRYfETH";
    string  private _symbol   = "fETHTRYeLP";
    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;
    }
}

contract FEGexSmartSwap is FSilver, ReentrancyGuard, FToken, FMath {

    struct Record {
        bool bound;   // is token bound to pool
        uint index;   // private
        uint denorm;  // denormalized weight
        uint balance;
    }
    
    struct userLock {
        bool setLock; // true = locked, false=unlocked
        uint unlockTime;
    }
    
    function getUserLock(address usr) public view returns(bool lock){
        return _userlock[usr].setLock;
    }
    
    event LOG_SWAP(
        address indexed caller,
        address indexed tokenIn,
        address indexed tokenOut,
        uint256         tokenAmountIn,
        uint256         tokenAmountOut
);

    event LOG_JOIN(
        address indexed caller,
        address indexed tokenIn,
        uint256         tokenAmountIn
);

    event LOG_EXIT(
        address indexed caller,
        address indexed tokenOut,
        uint256         tokenAmountOut
    );

    event LOG_CALL(
        bytes4  indexed sig,
        address indexed caller,
        bytes           data
    ) anonymous;

    modifier _logs_() {
        emit LOG_CALL(msg.sig, msg.sender, msg.data);
        _;
    }

    modifier _lock_() {
        require(!_mutex);
        _mutex = true;
        _;
        _mutex = false;
    } 

    modifier _viewlock_() {
        require(!_mutex);
        _;
    }

    bool private _mutex;


    address private _factory = 0xf6A12645453990bC2Fe2f39C5B662e16B7f1f430;    // BFactory address to push token exitFee to
    address private _controller =0x3B30Bac3c331168e40FC6338BA2295A2F3adDe52; // has CONTROL role 
    address private _poolOwner = 0x76EFf89CDe6ff68103E76dD492e8b25a058fcB2B;
    address public fETH = 0xf786c34106762Ab4Eeb45a51B42a62470E9D5332;
    address public TRY = 0xc12eCeE46ed65D970EE5C899FCC7AE133AfF9b03;
    address public pairRewardPool = 0x88aD06b773350c113093E5F9852e1FC57424A301;
    bool private _publicSwap; // true if PUBLIC can call SWAP functions

    uint private _swapFee;
    bool private _launched;
    uint public FSS = 25;
    uint public PSS = 500; // TRY has a 5% Sell Fee

    address[] private _tokens;
    uint256 public _totalSupply1;
    uint256 public _totalSupply2;
    mapping(address=>Record) private  _records;
    mapping(address=>userLock) public  _userlock;
    mapping(address=>bool) public whiteListContract;
    mapping(address => uint256) private _balances1;
    mapping(address => uint256) private _balances2;
    
    uint private _totalWeight;

    constructor() {
        _poolOwner = msg.sender;
        _swapFee = MIN_FEE;
        _publicSwap = false;
        _launched = false;
        
    }
    
    function userBalanceOfTRY(address account) public view returns (uint256) {
        return _balances1[account]; 
    }
    
    function userBalanceOffETH(address account) public view returns (uint256) {
        return _balances2[account]; 
    }
    
    function transfer(address dst, uint amt) external returns (bool) {
        userLock storage ulock = _userlock[msg.sender];
        
        if(ulock.setLock == true) {
            require(ulock.unlockTime <= block.timestamp, "Liquidity is locked, you cannot removed liquidity until after lock time.");
        }
        _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]);
        userLock storage ulock = _userlock[msg.sender];
        
        if(ulock.setLock == true) {
            require(ulock.unlockTime <= block.timestamp, "Liquidity is locked, you cannot removed liquidity until after lock time.");
        }
        
        _move(src, dst, amt);
        
        if (msg.sender != src && _allowance[src][msg.sender] > 0) {
            _allowance[src][msg.sender] = bsub(_allowance[src][msg.sender], amt);
            emit Approval(msg.sender, dst, _allowance[src][msg.sender]);
        }
       return true;
    }
    
    function isContract(address account) internal view returns (bool) {
        
        if(IsWhiteListContract(account)) {  return false; }
        bytes32 codehash;
        bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
        assembly { codehash := extcodehash(account) }
        return (codehash != 0x0 && codehash != accountHash);
    }
    
    function addWhiteListContract(address _addy, bool boolean) public {
        require(msg.sender == _controller);
        require(_addy != address(0), "setting 0 address;;");
        
        whiteListContract[_addy] = boolean;
    }
    
    function IsWhiteListContract(address _addy) public view returns(bool){
        require(_addy != address(0), "setting 0 address;;");
        
        return whiteListContract[_addy];
    }
    
    modifier noContract() {
        require(isContract(msg.sender) == false, 'Unapproved contracts are not allowed to interact with the swap');
        _;
    }
    
    function setMaxSellRatio(uint256 _amount) public {
        require(msg.sender == _poolOwner, "You do not have permission");
        require (_amount > 0, "cannot turn off");
        require (_amount <= 100, "cannot set under 1%");
        SM = _amount;
    }
    
    function setMax1SideLiquidityRatio(uint256 _amount) public {
        require(msg.sender == _poolOwner, "You do not have permission");
        require (_amount > 10, "cannot set over 10%");
        require (_amount <= 200, "cannot set under 0.5%");
        M1 = _amount;
    }
    
    /*function setStakePool(address _addy) public {
        require(msg.sender == _controller);
    TRYstake = _addy;
    }*/
    
    function setPairRewardPool(address _addy) public {
        require(msg.sender == _controller);
    pairRewardPool = _addy;
    }
    
    function isPublicSwap()
        external view
        returns (bool)
    {
        return _publicSwap;
        
    }    
    
    function isBound(address t)
        external view
        returns (bool)
    {
        return _records[t].bound;
    }

    /*function getFinalTokens()
        external view
        _viewlock_
        returns (address[] memory tokens)
    {
        require(_launched);
        return _tokens;
    }*/

    function getDenormalizedWeight(address token)
        external view
        _viewlock_
        returns (uint)
    {

        require(_records[token].bound);
        return _records[token].denorm;
    }

    function getBalance(address token)
        external view
        _viewlock_
        returns (uint)
    {

        require(_records[token].bound);
        return _records[token].balance;
    }
    
    function getTotalBalanceTRY(address token)
        external view
        _viewlock_
        returns (uint)
    {

        require(_records[token].bound);
        return _records[token].balance + _totalSupply1;
    }
    
    function getTotalBalancefETH(address token)
        external view
        _viewlock_
        returns (uint)
    {

        require(_records[token].bound);
        return _records[token].balance + _totalSupply2;
    }

    function getSwapFee()
        external view
        _viewlock_
        returns (uint)
    {
        return _swapFee;
    }

    function getController()
        external view
        _viewlock_
        returns (address)
    {
        return _controller;
    }

    function setController(address manager)
        external
        _logs_
        _lock_
    {
        require(msg.sender == _controller);
        _controller = manager;
    }


    function Launch()
        external
        _logs_
        _lock_
    {
        require(msg.sender == _poolOwner);
        require(!_launched);
        require(_tokens.length >= MIN_BOUND_TOKENS);

        _launched = true;
        _publicSwap = true;

        _mintPoolShare(INIT_POOL_SUPPLY);
        _pushPoolShare(msg.sender, INIT_POOL_SUPPLY);
    }


    function AddTokenInitial(address token, uint balance, uint denorm)
        external
        _logs_
    {
        require(msg.sender == _poolOwner);
        require(!_records[token].bound);
        require(!_launched);

        require(_tokens.length < MAX_BOUND_TOKENS);

        _records[token] = Record({
            bound: true,
            index: _tokens.length,
            denorm: 0,    // balance and denorm will be validated
            balance: 0  // and set by `rebind`
        });
        _tokens.push(token);
        rebind(token, balance * 98/100, denorm);
    }
    
    function AddfETHInitial(address token, uint balance, uint denorm)
        external
        _logs_
    {
        require(token == fETH);
        require(msg.sender == _poolOwner);
        require(!_records[token].bound);
        require(!_launched);

        require(_tokens.length < MAX_BOUND_TOKENS);

        _records[token] = Record({
            bound: true,
            index: _tokens.length,
            denorm: 0,    // balance and denorm will be validated
            balance: 0  // and set by `rebind`
        });
        _tokens.push(token);
        rebind(token, balance * 99/100, denorm);
    }

    function rebind(address token, uint balance, uint denorm)
        public
        _logs_
        _lock_
    {

        require(msg.sender == _poolOwner);
        require(_records[token].bound);
        require(!_launched);

        require(denorm >= MIN_WEIGHT);
        require(denorm <= MAX_WEIGHT);
        require(balance >= MIN_BALANCE);

        // Adjust the denorm and totalWeight
        uint oldWeight = _records[token].denorm;
        if (denorm > oldWeight) {
            _totalWeight = badd(_totalWeight, bsub(denorm, oldWeight));
            require(_totalWeight <= MAX_TOTAL_WEIGHT);
        } else if (denorm < oldWeight) {
            _totalWeight = bsub(_totalWeight, bsub(oldWeight, denorm));
        }
        _records[token].denorm = denorm;

        // Adjust the balance record and actual token balance
        uint oldBalance = _records[token].balance;
        _records[token].balance = balance;
        if (balance > oldBalance) {
            _pullUnderlying(token, msg.sender, bsub(balance, oldBalance));
        } else if (balance < oldBalance) {
            // In this case liquidity is being withdrawn, so charge EXIT_FEE if enabled
            uint tokenBalanceWithdrawn = bsub(oldBalance, balance);
            uint tokenExitFee = bmul(tokenBalanceWithdrawn, EXIT_FEE);
            _pushUnderlying(token, msg.sender, bsub(tokenBalanceWithdrawn, tokenExitFee));
            _pushUnderlying(token, _factory, tokenExitFee);
        }
    }
   
    function saveLostTokens(address token, uint amount)
        external
        _logs_
        _lock_
    {
        require(msg.sender == _controller);
        require(!_records[token].bound);

        uint bal = IERC20(token).balanceOf(address(this));
        require(amount <= bal);

        _pushUnderlying(token, msg.sender, amount);
    }

    function getSpotPrice(address tokenIn, address tokenOut)
        external view
        _viewlock_
        returns (uint spotPrice)
    {
        require(_records[tokenIn].bound, "ERR_NOT_BOUND");
        require(_records[tokenOut].bound, "ERR_NOT_BOUND");
        Record storage inRecord = _records[tokenIn];
        Record storage outRecord = _records[tokenOut];
        return calcSpotPrice(inRecord.balance, inRecord.denorm, outRecord.balance, outRecord.denorm, _swapFee);
    }

    function addBothLiquidity(uint poolAmountOut, uint[] calldata maxAmountsIn)
        external
        _logs_
        _lock_
    {
        require(_launched, "ERR_NOT_LAUNCHED");

        uint poolTotal = totalSupply();
        uint ratio = bdiv(poolAmountOut, poolTotal);
        require(ratio != 0, "ERR_MATH_APPROX");

        for (uint i = 0; i < _tokens.length; i++) {
            address t = _tokens[i];
            uint bal = _records[t].balance;
            uint tokenAmountIn = bmul(ratio, bal);
            require(tokenAmountIn != 0, "ERR_MATH_APPROX");
            require(tokenAmountIn <= maxAmountsIn[i], "ERR_LIMIT_IN");
            emit LOG_JOIN(msg.sender, t, tokenAmountIn);
            _pullUnderlying(t, msg.sender, tokenAmountIn);
            _records[TRY].balance = IERC20(TRY).balanceOf(address(this)) - _totalSupply1;
            _records[fETH].balance = IERC20(fETH).balanceOf(address(this)) - _totalSupply2;
        }
        _mintPoolShare(poolAmountOut);
        _pushPoolShare(msg.sender, poolAmountOut);
        
    }
   
    function removeBothLiquidity(uint poolAmountIn, uint[] calldata minAmountsOut)
        external
        _logs_
        _lock_
    {
        require(_launched, "ERR_NOT_LAUNCHED");
        userLock storage ulock = _userlock[msg.sender];
        
        if(ulock.setLock == true) {
            require(ulock.unlockTime <= block.timestamp, "Liquidity is locked, you cannot removed liquidity until after lock time.");
        }

        uint poolTotal = totalSupply();
        uint exitFee = bmul(poolAmountIn, EXIT_FEE);
        uint pAiAfterExitFee = bsub(poolAmountIn, exitFee);
        uint ratio = bdiv(pAiAfterExitFee, poolTotal);
        require(ratio != 0, "ERR_MATH_APPROX");

        _pullPoolShare(msg.sender, poolAmountIn);
        _pushPoolShare(_factory, exitFee);
        _burnPoolShare(pAiAfterExitFee);
        
        
        for (uint i = 0; i < _tokens.length; i++) {
            address t = _tokens[i];
            uint bal = _records[t].balance;
            uint tokenAmountOut = bmul(ratio, bal);
            require(tokenAmountOut != 0, "ERR_MATH_APPROX");
            require(tokenAmountOut >= minAmountsOut[i], "ERR_LIMIT_OUT");
            emit LOG_EXIT(msg.sender, t, tokenAmountOut);
            _pushUnderlying(t, msg.sender, tokenAmountOut);
            _records[TRY].balance = IERC20(TRY).balanceOf(address(this)) - _totalSupply1;
            _records[fETH].balance = IERC20(fETH).balanceOf(address(this)) - _totalSupply2;
        }

    }

    function DepositTRY(address tokenIn, uint256 amount) external  {
        //require(amount > 0, "Cannot deposit nothing");
        require(tokenIn == TRY, "Only TRY allowed"); 
        uint256 _txfee = amount * 98/100;
        _pullUnderlying(tokenIn, msg.sender, amount);
        
       
        uint256 finalAmount = amount - _txfee;
        _totalSupply1 = _totalSupply1 + finalAmount;
        _balances1[msg.sender] = _balances1[msg.sender] + finalAmount;
        
       // emit Transfer(tokenIn, msg.sender, finalAmount);
    }
    
    function DepositfETH(address tokenIn, uint256 amount) external  {
        require(tokenIn == fETH, "Only fETH allowed"); 
        //uint256 _txfee = 99/100;
        _pullUnderlying(tokenIn, msg.sender, amount);
        
       
        uint256 finalAmount = amount * 99/100;
        _totalSupply2 = _totalSupply2 + finalAmount;
        _balances2[msg.sender] = _balances2[msg.sender] + finalAmount;
        
       // emit Transfer(tokenIn, msg.sender, finalAmount);
    }
    
    function WithdrawTRY(address tokenIn, uint256 amount) external  {
        //require(amount > 0, "Cannot deposit nothing");
        require(_balances1[msg.sender] >= amount, "Not enough TRY");
        require(tokenIn == TRY, "Only TRY allowed");
        
        _totalSupply1 = _totalSupply1 - amount;
        _balances1[msg.sender] = _balances1[msg.sender] - amount;
        
        _pushUnderlying(tokenIn, msg.sender, amount);
        //emit Transfer(tokenIn, msg.sender, amount);
        
        
    }
    
    function WithdrawfETH(address tokenIn, uint256 amount) external  {
        require(tokenIn == fETH, "Only fETH allowed"); 
        require(_balances2[msg.sender] >= amount, "Not enough fETH");
        
        _totalSupply2 = _totalSupply2 - amount;
        _balances2[msg.sender] = _balances2[msg.sender] - amount;
        
        _pushUnderlying(tokenIn, msg.sender, amount);
        //emit Transfer(tokenIn, msg.sender, amount);
       
        
    }

    function BUYSmart(
        address tokenIn,
        uint tokenAmountIn,
        address tokenOut,
        uint minAmountOut,
        uint maxPrice
    ) noContract
        external
        _logs_
        _lock_
        returns (uint tokenAmountOut, uint spotPriceAfter)
    {
        
        require(tokenIn == fETH, "Can only buy with fETH");
        require(_publicSwap, "ERR_SWAP_NOT_PUBLIC");
        require(_balances2[msg.sender] >= tokenAmountIn, "Not enough fETH, deposit more");
        
        Record storage inRecord = _records[address(tokenIn)];
        Record storage outRecord = _records[address(tokenOut)];

        require(tokenAmountIn <= bmul(inRecord.balance, MAX_IN_RATIO), "ERR_MAX_IN_RATIO");

        uint spotPriceBefore = calcSpotPrice(
                                    inRecord.balance,
                                    inRecord.denorm,
                                    outRecord.balance,
                                    outRecord.denorm,
                                    _swapFee * 0
                                );
        require(spotPriceBefore <= maxPrice, "ERR_BAD_LIMIT_PRICE");

        uint tokenInFee;
        (tokenAmountOut, tokenInFee) = calcOutGivenIn(
                                            inRecord.balance,
                                            inRecord.denorm,
                                            outRecord.balance,
                                            outRecord.denorm,
                                            tokenAmountIn,
                                            _swapFee * 0
                                        );
                                        
        require(tokenAmountOut >= minAmountOut, "ERR_LIMIT_OUT");

        spotPriceAfter = calcSpotPrice(
                                inRecord.balance,
                                inRecord.denorm,
                                outRecord.balance,
                                outRecord.denorm,
                                _swapFee * 0
                            );
                            
        require(spotPriceAfter <= maxPrice, "ERR_LIMIT_PRICE");
        emit LOG_SWAP(msg.sender, tokenIn, tokenOut, tokenAmountIn, tokenAmountOut);

         _balances2[msg.sender] = _balances2[msg.sender] - tokenAmountIn;
        _balances1[msg.sender] = _balances1[msg.sender] + tokenAmountOut;
        _totalSupply2 = _totalSupply2 - tokenAmountIn;
        _totalSupply1 = _totalSupply1 + tokenAmountOut;
        _records[TRY].balance = IERC20(TRY).balanceOf(address(this)) - _totalSupply1;
        _records[fETH].balance = IERC20(fETH).balanceOf(address(this)) - _totalSupply2;
        return (tokenAmountOut, spotPriceAfter);
    }
    
    function BUY(
        address tokenIn,
        uint tokenAmountIn,
        address tokenOut,
        uint minAmountOut,
        uint maxPrice
    ) noContract
        external
        _logs_
        _lock_
        returns (uint tokenAmountOut, uint spotPriceAfter)
    {
        
        require(tokenIn == fETH, "Can only buy with fETH");
        require(_publicSwap, "ERR_SWAP_NOT_PUBLIC");
        
        Record storage inRecord = _records[address(tokenIn)];
        Record storage outRecord = _records[address(tokenOut)];

        require(tokenAmountIn <= bmul(inRecord.balance, MAX_IN_RATIO), "ERR_MAX_IN_RATIO");

        uint spotPriceBefore = calcSpotPrice(
                                    inRecord.balance,
                                    inRecord.denorm,
                                    outRecord.balance,
                                    outRecord.denorm,
                                    _swapFee * 0
                                );
        require(spotPriceBefore <= maxPrice, "ERR_BAD_LIMIT_PRICE");

        uint tokenInFee;
        (tokenAmountOut, tokenInFee) = calcOutGivenIn(
                                            inRecord.balance,
                                            inRecord.denorm,
                                            outRecord.balance,
                                            outRecord.denorm,
                                            tokenAmountIn * 99/100,
                                            _swapFee * 0
                                        );
                                        
        require(tokenAmountOut >= minAmountOut, "ERR_LIMIT_OUT");

        spotPriceAfter = calcSpotPrice(
                                inRecord.balance,
                                inRecord.denorm,
                                outRecord.balance,
                                outRecord.denorm,
                                _swapFee
                            );
                            
        require(spotPriceAfter >= spotPriceBefore, "ERR_MATH_APPROX");
        require(spotPriceAfter <= maxPrice, "ERR_LIMIT_PRICE");
        require(spotPriceBefore <= bdiv(tokenAmountIn, tokenAmountOut), "ERR_MATH_APPROX");

        emit LOG_SWAP(msg.sender, tokenIn, tokenOut, tokenAmountIn * 99/100, tokenAmountOut * 98/100);

        _pullUnderlying(tokenIn, msg.sender, tokenAmountIn);
        _pushUnderlying(tokenOut, msg.sender, tokenAmountOut);
        _records[TRY].balance = IERC20(TRY).balanceOf(address(this)) - _totalSupply1;
        _records[fETH].balance = IERC20(fETH).balanceOf(address(this)) - _totalSupply2;
        return (tokenAmountOut, spotPriceAfter);
    }

    function SELL(
        address tokenIn,
        uint tokenAmountIn,
        address tokenOut,
        uint minAmountOut,
        uint maxPrice
    ) noContract
        external
        _logs_
        _lock_
        returns (uint tokenAmountOut, uint spotPriceAfter)
    {
        
        require(tokenIn == TRY, "Can only sell TRY");
        require(_publicSwap, "ERR_SWAP_NOT_PUBLIC");

        Record storage inRecord = _records[address(tokenIn)];
        Record storage outRecord = _records[address(tokenOut)];

        require(tokenAmountIn <= bmul(inRecord.balance, MAX_SELL_RATIO), "ERR_SELL_RATIO");

        uint spotPriceBefore = calcSpotPrice(
                                    inRecord.balance,
                                    inRecord.denorm,
                                    outRecord.balance,
                                    outRecord.denorm,
                                    _swapFee
                                );
        require(spotPriceBefore <= maxPrice, "ERR_BAD_LIMIT_PRICE");

        uint tokenInFee;
        (tokenAmountOut, tokenInFee) = calcOutGivenIn(
                                            inRecord.balance,
                                            inRecord.denorm,
                                            outRecord.balance,
                                            outRecord.denorm,
                                            tokenAmountIn,
                                            _swapFee
                                        );
        require(tokenAmountOut >= minAmountOut, "ERR_LIMIT_OUT");

        spotPriceAfter = calcSpotPrice(
                                inRecord.balance,
                                inRecord.denorm,
                                outRecord.balance,
                                outRecord.denorm,
                                _swapFee
                            );
        require(spotPriceAfter <= maxPrice, "ERR_LIMIT_PRICE");
        emit LOG_SWAP(msg.sender, tokenIn, tokenOut, tokenAmountIn * 98/100, tokenAmountOut * 99/100);

        _pullUnderlying(tokenIn, msg.sender, tokenAmountIn);
        uint256 tokAmountI  = bmul(tokenAmountOut, bdiv(FSS, 10000));
        uint256 tokAmountI2 =  bmul(tokenAmountOut, bdiv(PSS, 10000));
        uint256 tokAmountI1 = bsub(tokenAmountOut, badd(tokAmountI, tokAmountI2));
        
        _pushUnderlying(tokenOut, msg.sender, tokAmountI1);
        _pushUnderlying1(tokenOut, tokAmountI);
        _pushUnderlying2(tokenOut, tokAmountI2);
        
        _records[TRY].balance = IERC20(TRY).balanceOf(address(this)) - _totalSupply1;
        _records[fETH].balance = IERC20(fETH).balanceOf(address(this)) - _totalSupply2;
        return (tokenAmountOut, spotPriceAfter);
    }
    
     function SELLSmart(
        address tokenIn,
        uint tokenAmountIn,
        address tokenOut,
        uint minAmountOut,
        uint maxPrice
    ) noContract
        external
        _logs_
        _lock_
        returns (uint tokenAmountOut, uint spotPriceAfter)
    {
        
        require(tokenIn == TRY, "Can only sell TRY");
        require(_publicSwap, "ERR_SWAP_NOT_PUBLIC");
        require(_balances1[msg.sender] >= tokenAmountIn, "Not enough TRY");
        
        Record storage inRecord = _records[address(tokenIn)];
        Record storage outRecord = _records[address(tokenOut)];

        require(tokenAmountIn <= bmul(inRecord.balance, MAX_SELL_RATIO), "ERR_SELL_RATIO");

        uint spotPriceBefore = calcSpotPrice(
                                    inRecord.balance,
                                    inRecord.denorm,
                                    outRecord.balance,
                                    outRecord.denorm,
                                    _swapFee
                                );
        require(spotPriceBefore <= maxPrice, "ERR_BAD_LIMIT_PRICE");

        uint tokenInFee;
        (tokenAmountOut, tokenInFee) = calcOutGivenIn(
                                            inRecord.balance,
                                            inRecord.denorm,
                                            outRecord.balance,
                                            outRecord.denorm,
                                            tokenAmountIn,
                                            _swapFee
                                        );
        require(tokenAmountOut >= minAmountOut, "ERR_LIMIT_OUT");

        spotPriceAfter = calcSpotPrice(
                                inRecord.balance,
                                inRecord.denorm,
                                outRecord.balance,
                                outRecord.denorm,
                                _swapFee
                            );
        require(spotPriceAfter >= spotPriceBefore, "ERR_MATH_APPROX");
        require(spotPriceAfter <= maxPrice, "ERR_LIMIT_PRICE");
        require(spotPriceBefore <= bdiv(tokenAmountIn, tokenAmountOut), "ERR_MATH_APPROX");

        emit LOG_SWAP(msg.sender, tokenIn, tokenOut, tokenAmountIn, tokenAmountOut);
        uint256 tokAmountI  = bmul(tokenAmountOut, bdiv(FSS, 10000));
        uint256 tokAmountI2 =  bmul(tokenAmountOut, bdiv(PSS, 10000));
        uint256 tokAmountI1 = bsub(tokenAmountOut, badd(tokAmountI, tokAmountI2));
        _balances1[msg.sender] = _balances1[msg.sender] - tokenAmountIn;
        
        _balances2[msg.sender] = _balances2[msg.sender] + tokAmountI1;
        _totalSupply2 = _totalSupply2 + tokAmountI1;
        _totalSupply1 = _totalSupply1 - tokenAmountIn;
        
        _pushUnderlying1(tokenOut, tokAmountI);
        _pushUnderlying2(tokenOut, tokAmountI2);
        
        _records[TRY].balance = IERC20(TRY).balanceOf(address(this)) - _totalSupply1;
        _records[fETH].balance = IERC20(fETH).balanceOf(address(this)) - _totalSupply2;
        
        return (tokenAmountOut, spotPriceAfter);
    }
    
    function setFSS(uint _FSS ) external {
        require(msg.sender == _controller);
        FSS = _FSS;
    }
    
    function setPSS(uint _PSS ) external {
        require(msg.sender == _controller);
        PSS = _PSS;
    }

    function setLockLiquidity() external {
        address user = msg.sender;
        userLock storage ulock = _userlock[user];
        
        ulock.setLock = true;
        ulock.unlockTime = block.timestamp + 90 days ; 
    }
    
    function emergencyLockOverride(address user, bool _bool) external {
        require(msg.sender == _controller);
        //address user = msg.sender;
        userLock storage ulock = _userlock[user];
        ulock.setLock = _bool;
    }
    
    function addLiquidityfETH(address tokenIn, uint tokenAmountIn, uint minPoolAmountOut)
        external noContract
        _logs_
        _lock_
        returns (uint poolAmountOut)
        
    {
        require(tokenIn == fETH, "Can only add fETH");
        require(_launched, "ERR_NOT_FINALIZED");
        require(_records[tokenIn].bound, "ERR_NOT_BOUND");
        require(tokenAmountIn <= bmul(_records[tokenIn].balance, MAX_1_RATIO), "ERR_MAX_IN_RATIO");

        Record storage inRecord = _records[tokenIn];

        require(poolAmountOut >= minPoolAmountOut, "ERR_LIMIT_OUT");
        
        inRecord.balance = bsub(inRecord.balance, tokenAmountIn * 99/100);

        emit LOG_JOIN(msg.sender, tokenIn, tokenAmountIn);

        _mintPoolShare(poolAmountOut);
        _pushPoolShare(msg.sender, poolAmountOut);
        _pullUnderlying(tokenIn, msg.sender, tokenAmountIn);
        _records[TRY].balance = IERC20(TRY).balanceOf(address(this)) - _totalSupply1;
        _records[fETH].balance = IERC20(fETH).balanceOf(address(this)) - _totalSupply2;
        return poolAmountOut;
    }

    function addLiquidityTRY(address tokenIn, uint tokenAmountIn, uint minPoolAmountOut)
        external
        _logs_
        _lock_
        returns (uint poolAmountOut)

    {
        require(tokenIn == TRY, "Can only add TRY");
        require(_launched, "ERR_NOT_FINALIZED");
        require(_records[tokenIn].bound, "ERR_NOT_BOUND");
        require(tokenAmountIn <= bmul(_records[tokenIn].balance, MAX_1_RATIO), "ERR_MAX_IN_RATIO");

        Record storage inRecord = _records[tokenIn];

        require(poolAmountOut >= minPoolAmountOut, "ERR_LIMIT_OUT");

        inRecord.balance = bsub(inRecord.balance, tokenAmountIn * 98/100);

        emit LOG_JOIN(msg.sender, tokenIn, tokenAmountIn);

        _mintPoolShare(poolAmountOut);
        _pushPoolShare(msg.sender, poolAmountOut);
        _pullUnderlying(tokenIn, msg.sender, tokenAmountIn);
    
        return poolAmountOut;
    }

    function _pullUnderlying(address erc20, address from, uint amount)
        internal
        nonReentrant
    {
        bool xfer = IERC20(erc20).transferFrom(from, address(this), amount);
        require(xfer, "ERR_ERC20_FALSE");
    }
    
    function _pushUnderlying(address erc20, address to, uint amount)
        internal
        nonReentrant
    {
        bool xfer = IERC20(erc20).transfer(to, amount);
        require(xfer, "ERR_ERC20_FALSE");
    }
    
    function _pushUnderlying1(address erc20, uint amount)
        internal
        nonReentrant
    {
        bool xfer = IERC20(erc20).transfer(FEGstake, amount);
        require(xfer, "ERR_ERC20_FALSE");
    }
    
    function _pushUnderlying2(address erc20, uint amount)
        internal
        nonReentrant
    {
        bool xfer = IERC20(erc20).transfer(pairRewardPool, amount);
        require(xfer, "ERR_ERC20_FALSE");
    }

    function _pullPoolShare(address from, uint amount)
        internal
        nonReentrant
    {
        _pull(from, amount);
    }

    function _pushPoolShare(address to, uint amount)
        internal
        nonReentrant
    {
        _push(to, amount);
    }

    function _mintPoolShare(uint amount)
        internal
        nonReentrant
    {
        _mint(amount);
    }

    function _burnPoolShare(uint amount)
        internal
    {
        _burn(amount);
    }
}

Read Contract

BASE 0xec342ad0 → uint256
BPOW_PRECISION 0x189d00ca → uint256
EXIT_FEE 0xc6580d12 → uint256
FEGstake 0x9a78458a → address
FSS 0x5c7b55bd → uint256
INIT_POOL_SUPPLY 0x9381cd2b → uint256
IsWhiteListContract 0x0149e5c7 → bool
M1 0x20e5672e → uint256
MAX_1_RATIO 0x5a659949 → uint256
MAX_BOUND_TOKENS 0xb0e0d136 → uint256
MAX_BPOW_BASE 0xbc694ea2 → uint256
MAX_FEE 0xbc063e1a → uint256
MAX_IN_RATIO 0xec093021 → uint256
MAX_OUT_RATIO 0x992e2a92 → uint256
MAX_SELL_RATIO 0xcdfec52d → uint256
MAX_TOTAL_WEIGHT 0x09a3bbe4 → uint256
MAX_WEIGHT 0xe4a28a52 → uint256
MIN_BALANCE 0x867378c5 → uint256
MIN_BOUND_TOKENS 0xb7b800a4 → uint256
MIN_BPOW_BASE 0xba019dab → uint256
MIN_FEE 0x76c7a3c7 → uint256
MIN_WEIGHT 0x218b5382 → uint256
PSS 0xf1091b6e → uint256
SM 0xa5a54ea5 → uint256
TRY 0x5ac072d7 → address
_totalSupply1 0xa2e70a2e → uint256
_totalSupply2 0x036fe1bb → uint256
_userlock 0x12b69b5d → bool, uint256
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
calcInGivenOut 0xf8d6aed4 → uint256, uint256
calcOutGivenIn 0xba9530a6 → uint256, uint256
calcPoolInGivenSingleOut 0x82f652ad → uint256
calcPoolOutGivenSingleIn 0x8656b653 → uint256
calcSingleOutGivenPoolIn 0x89298012 → uint256
calcSpotPrice 0xa221ee49 → uint256
decimals 0x313ce567 → uint8
fETH 0xcc14d688 → address
getBalance 0xf8b2cb4f → uint256
getColor 0x9a86139b → bytes32
getController 0x3018205f → address
getDenormalizedWeight 0x948d8ce6 → uint256
getSpotPrice 0x15e84af9 → uint256
getSwapFee 0xd4cadf68 → uint256
getTotalBalanceTRY 0xec524793 → uint256
getTotalBalancefETH 0xcdd96405 → uint256
getUserLock 0x2140fb40 → bool
isBound 0x2f37b624 → bool
isPublicSwap 0xfde924f7 → bool
name 0x06fdde03 → string
pairRewardPool 0x31705705 → address
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
userBalanceOfTRY 0xaf4c8f83 → uint256
userBalanceOffETH 0x5e2abf89 → uint256
whiteListContract 0xb44ec921 → bool

Write Contract 31 functions

These functions modify contract state and require a wallet transaction to execute.

AddTokenInitial 0x514b33cf
address token
uint256 balance
uint256 denorm
AddfETHInitial 0x1fd96bdb
address token
uint256 balance
uint256 denorm
BUY 0x8bbce009
address tokenIn
uint256 tokenAmountIn
address tokenOut
uint256 minAmountOut
uint256 maxPrice
returns: uint256, uint256
BUYSmart 0x00f40db6
address tokenIn
uint256 tokenAmountIn
address tokenOut
uint256 minAmountOut
uint256 maxPrice
returns: uint256, uint256
DepositTRY 0x3c6d6997
address tokenIn
uint256 amount
DepositfETH 0xaf8d757b
address tokenIn
uint256 amount
Launch 0x02ac8168
No parameters
SELL 0x7c884973
address tokenIn
uint256 tokenAmountIn
address tokenOut
uint256 minAmountOut
uint256 maxPrice
returns: uint256, uint256
SELLSmart 0xffc4fa26
address tokenIn
uint256 tokenAmountIn
address tokenOut
uint256 minAmountOut
uint256 maxPrice
returns: uint256, uint256
WithdrawTRY 0x13233679
address tokenIn
uint256 amount
WithdrawfETH 0x5bcbce08
address tokenIn
uint256 amount
addBothLiquidity 0x71a1e6dd
uint256 poolAmountOut
uint256[] maxAmountsIn
addLiquidityTRY 0x72f1b6d7
address tokenIn
uint256 tokenAmountIn
uint256 minPoolAmountOut
returns: uint256
addLiquidityfETH 0x60ea602b
address tokenIn
uint256 tokenAmountIn
uint256 minPoolAmountOut
returns: uint256
addWhiteListContract 0x103ff68d
address _addy
bool boolean
approve 0x095ea7b3
address dst
uint256 amt
returns: bool
decreaseApproval 0x66188463
address dst
uint256 amt
returns: bool
emergencyLockOverride 0xcc2cf6bc
address user
bool _bool
increaseApproval 0xd73dd623
address dst
uint256 amt
returns: bool
rebind 0x3fdddaa2
address token
uint256 balance
uint256 denorm
removeBothLiquidity 0x29dfe3b2
uint256 poolAmountIn
uint256[] minAmountsOut
saveLostTokens 0x390221d6
address token
uint256 amount
setController 0x92eefe9b
address manager
setFSS 0x9f6d8474
uint256 _FSS
setLockLiquidity 0xa16faa18
No parameters
setMax1SideLiquidityRatio 0xb7bbe0c8
uint256 _amount
setMaxSellRatio 0x8d811d1f
uint256 _amount
setPSS 0xa2e73cb6
uint256 _PSS
setPairRewardPool 0xc627fbfa
address _addy
transfer 0xa9059cbb
address dst
uint256 amt
returns: bool
transferFrom 0x23b872dd
address src
address dst
uint256 amt
returns: bool

Recent Transactions

No transactions found for this address