Address Contract Partially Verified
Address
0x3d81E2Be8E05B538cB5136F28c574Fb65a4182DB
Balance
0 ETH
Nonce
1
Code Size
11342 bytes
Creator
0x19918a0A...8dc1 at tx 0x8d3108e8...055bb8
Indexed Transactions
0
Contract Bytecode
11342 bytes
0x608060405234801561001057600080fd5b50600436106102275760003560e01c8063771a0b2811610130578063c0d78655116100b8578063e4d73e591161007c578063e4d73e59146107be578063eba116d8146107f0578063edae876f14610816578063f2fde38b1461081e578063ffc877d81461084457610227565b8063c0d786551461072c578063c9f1f47f14610752578063d5215d1114610780578063da91b76e14610788578063dd62ed3e1461079057610227565b80639ad3a7ba116100ff5780639ad3a7ba14610656578063a457c2d71461065e578063a77cac7a1461068a578063a9059cbb146106c0578063aab954d0146106ec57610227565b8063771a0b281461061057806386a22eff146106185780638da5cb5b1461064657806395d89b411461064e57610227565b806340c10f19116101b3578063532f1fed11610182578063532f1fed146104e2578063688a0942146105b457806370a08231146105bc57806371088c6d146105e2578063715018a61461060857610227565b806340c10f19146103f057806342966c681461041c57806344ade3c51461043957806349448898146104be57610227565b806323b872dd116101fa57806323b872dd146103405780632e15e5c714610376578063313ce5671461039e578063355274ea146103bc57806339509351146103c457610227565b806306fdde031461022c578063095ea7b3146102a957806318160ddd146102e95780631b29b0cd14610303575b600080fd5b61023461084c565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561026e578181015183820152602001610256565b50505050905090810190601f16801561029b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102d5600480360360408110156102bf57600080fd5b506001600160a01b0381351690602001356108e2565b604080519115158252519081900360200190f35b6102f1610900565b60408051918252519081900360200190f35b61030b610906565b6040805196875260208701959095528585019390935260608501919091521515608084015260a0830152519081900360c00190f35b6102d56004803603606081101561035657600080fd5b506001600160a01b03813581169160208101359091169060400135610a14565b61039c6004803603602081101561038c57600080fd5b50356001600160a01b0316610a9b565b005b6103a6610aff565b6040805160ff9092168252519081900360200190f35b6102f1610b08565b6102d5600480360360408110156103da57600080fd5b506001600160a01b038135169060200135610b0e565b61039c6004803603604081101561040657600080fd5b506001600160a01b038135169060200135610b5c565b61039c6004803603602081101561043257600080fd5b5035610bc2565b61039c600480360360a081101561044f57600080fd5b8135916020810135916040820135919081019060808101606082013564010000000081111561047d57600080fd5b82018360208201111561048f57600080fd5b803590602001918460208302840111640100000000831117156104b157600080fd5b9193509150351515610be3565b6104c6610dd2565b604080516001600160a01b039092168252519081900360200190f35b61039c600480360360608110156104f857600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561052357600080fd5b82018360208201111561053557600080fd5b8035906020019184602083028401116401000000008311171561055757600080fd5b91939092909160208101903564010000000081111561057557600080fd5b82018360208201111561058757600080fd5b803590602001918460208302840111640100000000831117156105a957600080fd5b509092509050610de1565b6102f1610f31565b6102f1600480360360208110156105d257600080fd5b50356001600160a01b0316610f37565b6102d5600480360360208110156105f857600080fd5b50356001600160a01b0316610f52565b61039c610f67565b6102f1611009565b61039c6004803603604081101561062e57600080fd5b506001600160a01b038135169060200135151561100f565b6104c6611092565b6102346110a1565b61039c611102565b6102d56004803603604081101561067457600080fd5b506001600160a01b0381351690602001356111a4565b6106a7600480360360208110156106a057600080fd5b503561120c565b6040805192835260208301919091528051918290030190f35b6102d5600480360360408110156106d657600080fd5b506001600160a01b038135169060200135611237565b61039c600480360360a081101561070257600080fd5b508035906020810135906040810135906001600160a01b036060820135811691608001351661124b565b61039c6004803603602081101561074257600080fd5b50356001600160a01b0316611405565b61039c6004803603604081101561076857600080fd5b506001600160a01b038135169060200135151561147f565b6104c6611502565b6102f1611511565b6102f1600480360360408110156107a657600080fd5b506001600160a01b0381358116916020013516611517565b61039c600480360360608110156107d457600080fd5b50803590602081013590604001356001600160a01b0316611542565b6102d56004803603602081101561080657600080fd5b50356001600160a01b0316611653565b6104c6611668565b61039c6004803603602081101561083457600080fd5b50356001600160a01b0316611677565b6104c6611770565b609f8054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156108d85780601f106108ad576101008083540402835291602001916108d8565b820191906000526020600020905b8154815290600101906020018083116108bb57829003601f168201915b5050505050905090565b60006108f66108ef61177f565b8484611783565b5060015b92915050565b609d5490565b600080600080600080600060985411156109f95760985460005b6097548110156109f65760006097828154811061093957fe5b9060005260206000209060040201905061096081600001548461186f90919063ffffffff16565b92508242116109ed5761097482600161186f565b81546001830154859060028501600061098b61177f565b6001600160a01b03168152602081019190915260400160009081205460ff169060038701906109b861177f565b6001600160a01b03166001600160a01b0316815260200190815260200160002054985098509850985098509850505050610a0c565b50600101610920565b50505b5060009450849350839250829150819050805b909192939495565b6000610a218484846118d0565b610a9184610a2d61177f565b610a8c85604051806060016040528060288152602001612aaf602891396001600160a01b038a166000908152609c6020526040812090610a6b61177f565b6001600160a01b031681526020810191909152604001600020549190611de8565b611783565b5060019392505050565b610aa361177f565b609a546001600160a01b03908116911614610af3576040805162461bcd60e51b815260206004820152601d6024820152600080516020612a48833981519152604482015290519081900360640190fd5b610afc81611e7f565b50565b60a15460ff1690565b609e5490565b60006108f6610b1b61177f565b84610a8c85609c6000610b2c61177f565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549061186f565b610b6461177f565b6065546001600160a01b03908116911614610bb4576040805162461bcd60e51b81526020600482018190526024820152600080516020612ad7833981519152604482015290519081900360640190fd5b610bbe8282611f20565b5050565b609e54610bcf9082612000565b609e55610afc610bdd61177f565b82612042565b610beb61177f565b609a546001600160a01b03908116911614610c3b576040805162461bcd60e51b815260206004820152601d6024820152600080516020612a48833981519152604482015290519081900360640190fd5b6097548610610c81576040805162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c840d2dcc8caf609b1b604482015290519081900360640190fd5b60008411610cca576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840c2dadeeadce89ac2f607b1b604482015290519081900360640190fd5b60978681548110610cd757fe5b9060005260206000209060040201600001548514610d0f578460978781548110610cfd57fe5b60009182526020909120600490910201555b60978681548110610d1c57fe5b9060005260206000209060040201600101548414610d58578360978781548110610d4257fe5b9060005260206000209060040201600101819055505b60005b82811015610dc9578160978881548110610d7157fe5b90600052602060002090600402016002016000868685818110610d9057fe5b602090810292909201356001600160a01b0316835250810191909152604001600020805460ff1916911515919091179055600101610d5b565b50505050505050565b6099546001600160a01b031681565b610de961177f565b609a546001600160a01b03908116911614610e39576040805162461bcd60e51b815260206004820152601d6024820152600080516020612a48833981519152604482015290519081900360640190fd5b828114610e84576040805162461bcd60e51b8152602060048201526014602482015273496e76616c69642077686974656c69737428732960601b604482015290519081900360640190fd5b609980546001600160a01b0319166001600160a01b0387161790558215610f2a57610eb16097600061289a565b60005b83811015610f285760976040518060400160405280878785818110610ed557fe5b905060200201358152602001858585818110610eed57fe5b602090810292909201359092528354600181810186556000958652948290208451600490920201908155920151918301919091555001610eb4565b505b5050505050565b60a45481565b6001600160a01b03166000908152609b602052604090205490565b60a26020526000908152604090205460ff1681565b610f6f61177f565b6065546001600160a01b03908116911614610fbf576040805162461bcd60e51b81526020600482018190526024820152600080516020612ad7833981519152604482015290519081900360640190fd5b6065546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3606580546001600160a01b0319169055565b60a35481565b61101761177f565b6065546001600160a01b03908116911614611067576040805162461bcd60e51b81526020600482018190526024820152600080516020612ad7833981519152604482015290519081900360640190fd5b6001600160a01b0391909116600090815260a660205260409020805460ff1916911515919091179055565b6065546001600160a01b031690565b60a08054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156108d85780601f106108ad576101008083540402835291602001916108d8565b61110a61177f565b609a546001600160a01b0390811691161461115a576040805162461bcd60e51b815260206004820152601d6024820152600080516020612a48833981519152604482015290519081900360640190fd5b609a546040516000916001600160a01b0316907f4e78506f3260e366dc9440ee0b4eca2d03aa91536b7605deb90e873d3fc4e5b4908390a3609a80546001600160a01b0319169055565b60006108f66111b161177f565b84610a8c85604051806060016040528060258152602001612bf460259139609c60006111db61177f565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190611de8565b6097818154811061121957fe5b60009182526020909120600490910201805460019091015490915082565b60006108f661124461177f565b84846118d0565b600054610100900460ff1680611264575061126461212c565b80611272575060005460ff16155b6112ad5760405162461bcd60e51b815260040180806020018281038252602e815260200180612af7602e913960400191505060405180910390fd5b600054610100900460ff161580156112d8576000805460ff1961ff0019909116610100171660011790555b60008611611325576040805162461bcd60e51b8152602060048201526015602482015274045524332304361707065643a20636170206973203605c1b604482015290519081900360640190fd5b60408051808201909152600d8082526c43726f7373537761702e636f6d60981b602090920191825261135991609f916128bb565b5060408051808201909152600580825264043535741560dc1b60209092019182526113869160a0916128bb565b5060a1805460ff19166012179055609e8690556113a1612132565b6113a96121e3565b6113b4858585611542565b60a780546001600160a01b0319166001600160a01b0384161790556113e16113da61177f565b600161147f565b6113ec30600161147f565b8015610f28576000805461ff0019169055505050505050565b61140d61177f565b6065546001600160a01b0390811691161461145d576040805162461bcd60e51b81526020600482018190526024820152600080516020612ad7833981519152604482015290519081900360640190fd5b60a780546001600160a01b0319166001600160a01b0392909216919091179055565b61148761177f565b6065546001600160a01b039081169116146114d7576040805162461bcd60e51b81526020600482018190526024820152600080516020612ad7833981519152604482015290519081900360640190fd5b6001600160a01b0391909116600090815260a260205260409020805460ff1916911515919091179055565b609a546001600160a01b031681565b60985481565b6001600160a01b039182166000908152609c6020908152604080832093909416825291909152205490565b61154a61177f565b6065546001600160a01b0390811691161461159a576040805162461bcd60e51b81526020600482018190526024820152600080516020612ad7833981519152604482015290519081900360640190fd5b6127106115a7848461186f565b11156115e45760405162461bcd60e51b8152600401808060200182810382526022815260200180612bd26022913960400191505060405180910390fd5b6001600160a01b0381166116295760405162461bcd60e51b815260040180806020018281038252602b8152602001806129f7602b913960400191505060405180910390fd5b60a39290925560a45560a580546001600160a01b0319166001600160a01b03909216919091179055565b60a66020526000908152604090205460ff1681565b60a7546001600160a01b031681565b61167f61177f565b6065546001600160a01b039081169116146116cf576040805162461bcd60e51b81526020600482018190526024820152600080516020612ad7833981519152604482015290519081900360640190fd5b6001600160a01b0381166117145760405162461bcd60e51b81526004018080602001828103825260268152602001806129af6026913960400191505060405180910390fd5b6065546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3606580546001600160a01b0319166001600160a01b0392909216919091179055565b60a5546001600160a01b031681565b3390565b6001600160a01b0383166117c85760405162461bcd60e51b8152600401808060200182810382526024815260200180612bae6024913960400191505060405180910390fd5b6001600160a01b03821661180d5760405162461bcd60e51b81526004018080602001828103825260228152602001806129d56022913960400191505060405180910390fd5b6001600160a01b038084166000818152609c6020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6000828201838110156118c9576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6001600160a01b0383166119155760405162461bcd60e51b8152600401808060200182810382526025815260200180612b666025913960400191505060405180910390fd5b6001600160a01b03821661195a5760405162461bcd60e51b815260040180806020018281038252602381526020018061296a6023913960400191505060405180910390fd5b611965838383612280565b6119a281604051806060016040528060268152602001612a22602691396001600160a01b0386166000908152609b60205260409020549190611de8565b6001600160a01b038085166000908152609b6020908152604080832094909455918516815260a6909152205460ff1680156119f657506001600160a01b038316600090815260a2602052604090205460ff16155b15611d7b5760a35460009015611a7a57611a27612710611a2160a3548561230690919063ffffffff16565b9061235f565b609e54909150611a379082612000565b609e55609d54611a479082612000565b609d556040805182815290516000916001600160a01b03871691600080516020612b258339815191529181900360200190a35b60008060a454118015611a97575060a5546001600160a01b031615155b15611d6257611ab7612710611a2160a4548661230690919063ffffffff16565b60a7549091506001600160a01b031615611cef57306000908152609b6020526040902054611ae5908261186f565b306000818152609b6020908152604091829020939093558051848152905191926001600160a01b03891692600080516020612b258339815191529281900390910190a360a754604080516002808252606080830184526001600160a01b0390941693926020830190803683370190505090503081600081518110611b6557fe5b60200260200101906001600160a01b031690816001600160a01b031681525050816001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611bbe57600080fd5b505afa158015611bd2573d6000803e3d6000fd5b505050506040513d6020811015611be857600080fd5b5051815182906001908110611bf957fe5b6001600160a01b03928316602091820292909201015260a754611c1f9130911685611783565b60a554604051635c11d79560e01b8152600481018581526000602483018190526001600160a01b0393841660648401819052426084850181905260a060448601908152875160a4870152875196891696635c11d795968b968a9594939092909160c40190602080880191028083838b5b83811015611ca7578181015183820152602001611c8f565b505050509050019650505050505050600060405180830381600087803b158015611cd057600080fd5b505af1158015611ce4573d6000803e3d6000fd5b505050505050611d62565b60a5546001600160a01b03166000908152609b6020526040902054611d14908261186f565b60a580546001600160a01b039081166000908152609b6020908152604091829020949094559154825185815292519082169391891692600080516020612b2583398151915292908290030190a35b611d7681611d708585612000565b90612000565b925050505b6001600160a01b0382166000908152609b6020526040902054611d9e908261186f565b6001600160a01b038084166000818152609b60209081526040918290209490945580518581529051919392871692600080516020612b2583398151915292918290030190a3505050565b60008184841115611e775760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611e3c578181015183820152602001611e24565b50505050905090810190601f168015611e695780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b038116611ec45760405162461bcd60e51b8152600401808060200182810382526023815260200180612b8b6023913960400191505060405180910390fd5b609a546040516001600160a01b038084169216907f4e78506f3260e366dc9440ee0b4eca2d03aa91536b7605deb90e873d3fc4e5b490600090a3609a80546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038216611f7b576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b611f8760008383612280565b609d54611f94908261186f565b609d556001600160a01b0382166000908152609b6020526040902054611fba908261186f565b6001600160a01b0383166000818152609b60209081526040808320949094558351858152935192939192600080516020612b258339815191529281900390910190a35050565b60006118c983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611de8565b6001600160a01b0382166120875760405162461bcd60e51b8152600401808060200182810382526021815260200180612b456021913960400191505060405180910390fd5b61209382600083612280565b6120d08160405180606001604052806022815260200161298d602291396001600160a01b0385166000908152609b60205260409020549190611de8565b6001600160a01b0383166000908152609b6020526040902055609d546120f69082612000565b609d556040805182815290516000916001600160a01b03851691600080516020612b258339815191529181900360200190a35050565b303b1590565b600054610100900460ff168061214b575061214b61212c565b80612159575060005460ff16155b6121945760405162461bcd60e51b815260040180806020018281038252602e815260200180612af7602e913960400191505060405180910390fd5b600054610100900460ff161580156121bf576000805460ff1961ff0019909116610100171660011790555b6121c76123a1565b6121cf612441565b8015610afc576000805461ff001916905550565b600054610100900460ff16806121fc57506121fc61212c565b8061220a575060005460ff16155b6122455760405162461bcd60e51b815260040180806020018281038252602e815260200180612af7602e913960400191505060405180910390fd5b600054610100900460ff16158015612270576000805460ff1961ff0019909116610100171660011790555b6122786123a1565b6121cf61253a565b61228b838383612603565b6001600160a01b03831661230157609e546122ae826122a8610900565b9061186f565b1115612301576040805162461bcd60e51b815260206004820152601960248201527f45524332304361707065643a2063617020657863656564656400000000000000604482015290519081900360640190fd5b505050565b600082612315575060006108fa565b8282028284828161232257fe5b04146118c95760405162461bcd60e51b8152600401808060200182810382526021815260200180612a8e6021913960400191505060405180910390fd5b60006118c983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612835565b600054610100900460ff16806123ba57506123ba61212c565b806123c8575060005460ff16155b6124035760405162461bcd60e51b815260040180806020018281038252602e815260200180612af7602e913960400191505060405180910390fd5b600054610100900460ff161580156121cf576000805460ff1961ff0019909116610100171660011790558015610afc576000805461ff001916905550565b600054610100900460ff168061245a575061245a61212c565b80612468575060005460ff16155b6124a35760405162461bcd60e51b815260040180806020018281038252602e815260200180612af7602e913960400191505060405180910390fd5b600054610100900460ff161580156124ce576000805460ff1961ff0019909116610100171660011790555b60006124d861177f565b606580546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3508015610afc576000805461ff001916905550565b600054610100900460ff1680612553575061255361212c565b80612561575060005460ff16155b61259c5760405162461bcd60e51b815260040180806020018281038252602e815260200180612af7602e913960400191505060405180910390fd5b600054610100900460ff161580156125c7576000805460ff1961ff0019909116610100171660011790555b6125cf61177f565b609a80546001600160a01b0319166001600160a01b03929092169190911790558015610afc576000805461ff001916905550565b6099546001600160a01b0316158061261b5750609754155b1561262557612301565b60985415801561264357506099546001600160a01b03848116911614155b801561265c57506099546001600160a01b038381169116145b80156126685750600081115b1561267257426098555b6099546001600160a01b03848116911614801561269d57506099546001600160a01b03838116911614155b156123015760006126ac610906565b50505050509050600081111561282f57600060976126cb836001612000565b815481106126d557fe5b600091825260208083206001600160a01b03881684526002600490930201918201905260409091205490915060ff16612755576040805162461bcd60e51b815260206004820152601e60248201527f4c4745202d204275796572206973206e6f742077686974656c69737465640000604482015290519081900360640190fd5b60018101546001600160a01b0385166000908152600383016020526040812054909111156127a9576001600160a01b038516600090815260038301602052604090205460018301546127a691612000565b90505b808411156127e85760405162461bcd60e51b8152600401808060200182810382526026815260200180612a686026913960400191505060405180910390fd5b6001600160a01b038516600090815260038301602052604090205461280d908561186f565b6001600160a01b03861660009081526003909301602052604090922091909155505b50505050565b600081836128845760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611e3c578181015183820152602001611e24565b50600083858161289057fe5b0495945050505050565b5080546000825560040290600052602060002090810190610afc9190612939565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106128fc57805160ff1916838001178555612929565b82800160010185558215612929579182015b8281111561292957825182559160200191906001019061290e565b50612935929150612954565b5090565b5b80821115612935576000808255600182015560040161293a565b5b80821115612935576000815560010161295556fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f2061646472657373466565207265776172642061646472657373206d757374206e6f74206265207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636543616c6c6572206973206e6f74207468652077686974656c69737465720000004c4745202d20416d6f756e7420657863656564732077686974656c697374206d6178696d756d536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572436f6e747261637420696e7374616e63652068617320616c7265616479206265656e20696e697469616c697a6564ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef45524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f20616464726573734e65772077686974656c697374657220697320746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737346656573206d757374206e6f7420746f74616c206d6f7265207468616e203130302545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa264697066735822122030b437ad811d18f3465e64df18254758973c7f13d9fed4cfb2a591bd5e7ffc9964736f6c634300060c0033
Verified Source Code Partial Match
Compiler: v0.6.12+commit.27d51765
EVM: istanbul
Optimization: Yes (200 runs)
CSWAP.sol 1092 lines
// File: @openzeppelin/contracts-ethereum-package/contracts/utils/SafeCast.sol
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's uintXX casting operators with added overflow
* checks.
*
* Downcasting from uint256 in Solidity does not revert on overflow. This can
* easily result in undesired exploitation or bugs, since developers usually
* assume that overflows raise errors. `SafeCast` restores this intuition by
* reverting the transaction when such an operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*
* Can be combined with {SafeMath} to extend it to smaller types, by performing
* all math on `uint256` and then downcasting.
*/
library SafeCast {
/**
* @dev Returns the downcasted uint128 from uint256, reverting on
* overflow (when the input is greater than largest uint128).
*
* Counterpart to Solidity's `uint128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*/
function toUint128(uint256 value) internal pure returns (uint128) {
require(value < 2**128, "SafeCast: value doesn\'t fit in 128 bits");
return uint128(value);
}
/**
* @dev Returns the downcasted uint64 from uint256, reverting on
* overflow (when the input is greater than largest uint64).
*
* Counterpart to Solidity's `uint64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*/
function toUint64(uint256 value) internal pure returns (uint64) {
require(value < 2**64, "SafeCast: value doesn\'t fit in 64 bits");
return uint64(value);
}
/**
* @dev Returns the downcasted uint32 from uint256, reverting on
* overflow (when the input is greater than largest uint32).
*
* Counterpart to Solidity's `uint32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*/
function toUint32(uint256 value) internal pure returns (uint32) {
require(value < 2**32, "SafeCast: value doesn\'t fit in 32 bits");
return uint32(value);
}
/**
* @dev Returns the downcasted uint16 from uint256, reverting on
* overflow (when the input is greater than largest uint16).
*
* Counterpart to Solidity's `uint16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*/
function toUint16(uint256 value) internal pure returns (uint16) {
require(value < 2**16, "SafeCast: value doesn\'t fit in 16 bits");
return uint16(value);
}
/**
* @dev Returns the downcasted uint8 from uint256, reverting on
* overflow (when the input is greater than largest uint8).
*
* Counterpart to Solidity's `uint8` operator.
*
* Requirements:
*
* - input must fit into 8 bits.
*/
function toUint8(uint256 value) internal pure returns (uint8) {
require(value < 2**8, "SafeCast: value doesn\'t fit in 8 bits");
return uint8(value);
}
/**
* @dev Converts a signed int256 into an unsigned uint256.
*
* Requirements:
*
* - input must be greater than or equal to 0.
*/
function toUint256(int256 value) internal pure returns (uint256) {
require(value >= 0, "SafeCast: value must be positive");
return uint256(value);
}
/**
* @dev Converts an unsigned uint256 into a signed int256.
*
* Requirements:
*
* - input must be less than or equal to maxInt256.
*/
function toInt256(uint256 value) internal pure returns (int256) {
require(value < 2**255, "SafeCast: value doesn't fit in an int256");
return int256(value);
}
}
// File: @openzeppelin/contracts-ethereum-package/contracts/Initializable.sol
pragma solidity >=0.4.24 <0.7.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constructors, initializer functions must be manually
* invoked. This applies both to deploying an Initializable contract, as well
* as extending an Initializable contract via inheritance.
* WARNING: When used with inheritance, manual care must be taken to not invoke
* a parent initializer twice, or ensure that all initializers are idempotent,
* because this is not dealt with automatically as with constructors.
*/
contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
*/
bool private initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private initializing;
/**
* @dev Modifier to use in the initializer function of a contract.
*/
modifier initializer() {
require(initializing || isConstructor() || !initialized, "Contract instance has already been initialized");
bool isTopLevelCall = !initializing;
if (isTopLevelCall) {
initializing = true;
initialized = true;
}
_;
if (isTopLevelCall) {
initializing = false;
}
}
/// @dev Returns true if and only if the function is running in the constructor
function isConstructor() private view returns (bool) {
// extcodesize checks the size of the code stored in an address, and
// address returns the current address. Since the code is still not
// deployed when running a constructor, any checks on its code size will
// yield zero, making it an effective way to detect if a contract is
// under construction or not.
address self = address(this);
uint256 cs;
assembly { cs := extcodesize(self) }
return cs == 0;
}
// Reserved storage space to allow for layout changes in the future.
uint256[50] private ______gap;
}
// File: @openzeppelin/contracts-ethereum-package/contracts/GSN/Context.sol
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
contract ContextUpgradeSafe is Initializable {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
function __Context_init() internal initializer {
__Context_init_unchained();
}
function __Context_init_unchained() internal initializer {
}
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
uint256[50] private __gap;
}
// File: @openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol
pragma solidity ^0.6.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract OwnableUpgradeSafe is Initializable, ContextUpgradeSafe {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal initializer {
__Context_init_unchained();
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal initializer {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
uint256[49] private __gap;
}
// File: @openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
// File: @openzeppelin/contracts-ethereum-package/contracts/utils/Address.sol
pragma solidity ^0.6.2;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
function name() external view returns (string memory);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address _owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
contract LGEWhitelisted is ContextUpgradeSafe {
using SafeMath for uint256;
struct WhitelistRound {
uint256 duration;
uint256 amountMax;
mapping(address => bool) addresses;
mapping(address => uint256) purchased;
}
WhitelistRound[] public _lgeWhitelistRounds;
uint256 public _lgeTimestamp;
address public _lgePairAddress;
address public _whitelister;
event WhitelisterTransferred(address indexed previousWhitelister, address indexed newWhitelister);
function __LGEWhitelisted_init() internal initializer {
__Context_init_unchained();
__LGEWhitelisted_init_unchained();
}
function __LGEWhitelisted_init_unchained() internal initializer {
_whitelister = _msgSender();
}
modifier onlyWhitelister() {
require(_whitelister == _msgSender(), "Caller is not the whitelister");
_;
}
function renounceWhitelister() external onlyWhitelister {
emit WhitelisterTransferred(_whitelister, address(0));
_whitelister = address(0);
}
function transferWhitelister(address newWhitelister) external onlyWhitelister {
_transferWhitelister(newWhitelister);
}
function _transferWhitelister(address newWhitelister) internal {
require(newWhitelister != address(0), "New whitelister is the zero address");
emit WhitelisterTransferred(_whitelister, newWhitelister);
_whitelister = newWhitelister;
}
/*
* createLGEWhitelist - Call this after initial Token Generation Event (TGE)
*
* pairAddress - address generated from createPair() event on DEX
* durations - array of durations (seconds) for each whitelist rounds
* amountsMax - array of max amounts (TOKEN decimals) for each whitelist round
*
*/
function createLGEWhitelist(address pairAddress, uint256[] calldata durations, uint256[] calldata amountsMax) external onlyWhitelister() {
require(durations.length == amountsMax.length, "Invalid whitelist(s)");
_lgePairAddress = pairAddress;
if(durations.length > 0) {
delete _lgeWhitelistRounds;
for (uint256 i = 0; i < durations.length; i++) {
_lgeWhitelistRounds.push(WhitelistRound(durations[i], amountsMax[i]));
}
}
}
/*
* modifyLGEWhitelistAddresses - Define what addresses are included/excluded from a whitelist round
*
* index - 0-based index of round to modify whitelist
* duration - period in seconds from LGE event or previous whitelist round
* amountMax - max amount (TOKEN decimals) for each whitelist round
*
*/
function modifyLGEWhitelist(uint256 index, uint256 duration, uint256 amountMax, address[] calldata addresses, bool enabled) external onlyWhitelister() {
require(index < _lgeWhitelistRounds.length, "Invalid index");
require(amountMax > 0, "Invalid amountMax");
if(duration != _lgeWhitelistRounds[index].duration)
_lgeWhitelistRounds[index].duration = duration;
if(amountMax != _lgeWhitelistRounds[index].amountMax)
_lgeWhitelistRounds[index].amountMax = amountMax;
for (uint256 i = 0; i < addresses.length; i++) {
_lgeWhitelistRounds[index].addresses[addresses[i]] = enabled;
}
}
/*
* getLGEWhitelistRound
*
* returns:
*
* 1. whitelist round number ( 0 = no active round now )
* 2. duration, in seconds, current whitelist round is active for
* 3. timestamp current whitelist round closes at
* 4. maximum amount a whitelister can purchase in this round
* 5. is caller whitelisted
* 6. how much caller has purchased in current whitelist round
*
*/
function getLGEWhitelistRound() public view returns (uint256, uint256, uint256, uint256, bool, uint256) {
if(_lgeTimestamp > 0) {
uint256 wlCloseTimestampLast = _lgeTimestamp;
for (uint256 i = 0; i < _lgeWhitelistRounds.length; i++) {
WhitelistRound storage wlRound = _lgeWhitelistRounds[i];
wlCloseTimestampLast = wlCloseTimestampLast.add(wlRound.duration);
if(now <= wlCloseTimestampLast)
return (i.add(1), wlRound.duration, wlCloseTimestampLast, wlRound.amountMax, wlRound.addresses[_msgSender()], wlRound.purchased[_msgSender()]);
}
}
return (0, 0, 0, 0, false, 0);
}
/*
* _applyLGEWhitelist - internal function to be called initially before any transfers
*
*/
function _applyLGEWhitelist(address sender, address recipient, uint256 amount) internal {
if(_lgePairAddress == address(0) || _lgeWhitelistRounds.length == 0)
return;
if(_lgeTimestamp == 0 && sender != _lgePairAddress && recipient == _lgePairAddress && amount > 0)
_lgeTimestamp = now;
if(sender == _lgePairAddress && recipient != _lgePairAddress) {
//buying
(uint256 wlRoundNumber,,,,,) = getLGEWhitelistRound();
if(wlRoundNumber > 0) {
WhitelistRound storage wlRound = _lgeWhitelistRounds[wlRoundNumber.sub(1)];
require(wlRound.addresses[recipient], "LGE - Buyer is not whitelisted");
uint256 amountRemaining = 0;
if(wlRound.purchased[recipient] < wlRound.amountMax)
amountRemaining = wlRound.amountMax.sub(wlRound.purchased[recipient]);
require(amount <= amountRemaining, "LGE - Amount exceeds whitelist maximum");
wlRound.purchased[recipient] = wlRound.purchased[recipient].add(amount);
}
}
}
}
contract CSWAP is IERC20, OwnableUpgradeSafe, LGEWhitelisted {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
uint256 private _cap;
string private _name;
string private _symbol;
uint8 private _decimals;
mapping(address => bool) public _feeExcluded;
uint256 public _feeBurnPct;
uint256 public _feeRewardPct;
address public _feeRewardAddress;
mapping(address => bool) public _pair;
address public _router;
function initialize(uint256 cap, uint256 feeBurnPct, uint256 feeRewardPct, address feeRewardAddress, address router)
public
initializer
{
require(cap > 0, "ERC20Capped: cap is 0");
_name = "CrossSwap.com";
_symbol = "CSWAP";
_decimals = 18;
_cap = cap;
__Ownable_init();
__LGEWhitelisted_init();
setFees(feeBurnPct, feeRewardPct, feeRewardAddress);
_router = router;
setFeeExcluded(_msgSender(), true);
setFeeExcluded(address(this), true);
}
function setRouter(address r) public onlyOwner {
_router = r;
}
function setFees(uint256 feeBurnPct, uint256 feeRewardPct, address feeRewardAddress) public onlyOwner {
require(feeBurnPct.add(feeRewardPct) <= 10000, "Fees must not total more than 100%");
require(feeRewardAddress != address(0), "Fee reward address must not be zero address");
_feeBurnPct = feeBurnPct;
_feeRewardPct = feeRewardPct;
_feeRewardAddress = feeRewardAddress;
}
function setPair(address a, bool pair) public onlyOwner {
_pair[a] = pair;
}
function setFeeExcluded(address a, bool excluded) public onlyOwner {
_feeExcluded[a] = excluded;
}
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
}
function _beforeTokenTransfer(address sender, address recipient, uint256 amount) internal {
LGEWhitelisted._applyLGEWhitelist(sender, recipient, amount);
if (sender == address(0)) { // When minting tokens
require(totalSupply().add(amount) <= _cap, "ERC20Capped: cap exceeded");
}
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
if(_pair[recipient] && !_feeExcluded[sender]) {
uint256 feeBurnAmount = 0;
if(_feeBurnPct > 0) {
feeBurnAmount = amount.mul(_feeBurnPct).div(10000);
_cap = _cap.sub(feeBurnAmount);
_totalSupply = _totalSupply.sub(feeBurnAmount);
emit Transfer(sender, address(0), feeBurnAmount);
}
uint256 feeRewardAmount = 0;
if(_feeRewardPct > 0 && _feeRewardAddress != address(0)) {
feeRewardAmount = amount.mul(_feeRewardPct).div(10000);
if(_router != address(0)) {
_balances[address(this)] = _balances[address(this)].add(feeRewardAmount);
emit Transfer(sender, address(this), feeRewardAmount);
IUniswapV2Router02 r = IUniswapV2Router02(_router);
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = r.WETH();
_approve(address(this), _router, feeRewardAmount);
r.swapExactTokensForTokensSupportingFeeOnTransferTokens(
feeRewardAmount,
0,
path,
_feeRewardAddress,
block.timestamp
);
} else {
_balances[_feeRewardAddress] = _balances[_feeRewardAddress].add(feeRewardAmount);
emit Transfer(sender, _feeRewardAddress, feeRewardAmount);
}
}
amount = amount.sub(feeBurnAmount).sub(feeRewardAmount);
}
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function burn(uint256 amount) external {
_cap=_cap.sub(amount);
_burn(_msgSender(), amount);
}
function name() public view override returns (string memory) {
return _name;
}
function symbol() public view override returns (string memory) {
return _symbol;
}
function cap() public view returns (uint256) {
return _cap;
}
function decimals() public view override returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
Read Contract
_feeBurnPct 0x771a0b28 → uint256
_feeExcluded 0x71088c6d → bool
_feeRewardAddress 0xffc877d8 → address
_feeRewardPct 0x688a0942 → uint256
_lgePairAddress 0x49448898 → address
_lgeTimestamp 0xda91b76e → uint256
_lgeWhitelistRounds 0xa77cac7a → uint256, uint256
_pair 0xeba116d8 → bool
_router 0xedae876f → address
_whitelister 0xd5215d11 → address
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
cap 0x355274ea → uint256
decimals 0x313ce567 → uint8
getLGEWhitelistRound 0x1b29b0cd → uint256, uint256, uint256, uint256, bool, uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
Write Contract 18 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
burn 0x42966c68
uint256 amount
createLGEWhitelist 0x532f1fed
address pairAddress
uint256[] durations
uint256[] amountsMax
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
initialize 0xaab954d0
uint256 cap
uint256 feeBurnPct
uint256 feeRewardPct
address feeRewardAddress
address router
mint 0x40c10f19
address _to
uint256 _amount
modifyLGEWhitelist 0x44ade3c5
uint256 index
uint256 duration
uint256 amountMax
address[] addresses
bool enabled
renounceOwnership 0x715018a6
No parameters
renounceWhitelister 0x9ad3a7ba
No parameters
setFeeExcluded 0xc9f1f47f
address a
bool excluded
setFees 0xe4d73e59
uint256 feeBurnPct
uint256 feeRewardPct
address feeRewardAddress
setPair 0x86a22eff
address a
bool pair
setRouter 0xc0d78655
address r
transfer 0xa9059cbb
address recipient
uint256 amount
returns: bool
transferFrom 0x23b872dd
address sender
address recipient
uint256 amount
returns: bool
transferOwnership 0xf2fde38b
address newOwner
transferWhitelister 0x2e15e5c7
address newWhitelister
Recent Transactions
No transactions found for this address