Address Contract Partially Verified
Address
0x0B1A8f29f2d73B8618929810d6f1E0cf6299ecE2
Balance
0 ETH
Nonce
1
Code Size
10838 bytes
Creator
0xE29f6227...eAfa at tx 0x7e75599f...e79487
Indexed Transactions
0
Contract Bytecode
10838 bytes
0x6080604052600436106103545760003560e01c80638ea5220f116101c6578063c0246668116100f7578063dd62ed3e11610095578063f11a24d31161006f578063f11a24d3146109cf578063f2fde38b146109e5578063f637434214610a05578063f8b45b0514610a1b57600080fd5b8063dd62ed3e1461095e578063e2f45605146109a4578063e884f260146109ba57600080fd5b8063c876d0b9116100d1578063c876d0b9146108f8578063c8c8ebe414610912578063d257b34f14610928578063d85ba0631461094857600080fd5b8063c024666814610898578063c17b5b8c146108b8578063c18bc195146108d857600080fd5b8063a0d82dc511610164578063aacebbe31161013e578063aacebbe314610809578063b62496f514610829578063b8dbf87614610859578063bbc0c7421461087957600080fd5b8063a0d82dc5146107b3578063a457c2d7146107c9578063a9059cbb146107e957600080fd5b806395d89b41116101a057806395d89b41146107525780639a7a23d6146107675780639c3b4fdc146107875780639fccce321461079d57600080fd5b80638ea5220f146106fc578063921369131461071c578063924de9b71461073257600080fd5b806349bd5a5e116102a0578063751039fc1161023e5780637bce5a04116102185780637bce5a04146106935780638095d564146106a95780638a8c523c146106c95780638da5cb5b146106de57600080fd5b8063751039fc1461063e5780637571336a1461065357806375f0a8741461067357600080fd5b80636a486a8e1161027a5780636a486a8e146105bd5780636ddd1713146105d357806370a08231146105f3578063715018a61461062957600080fd5b806349bd5a5e146105365780634a62bb651461056a5780634fbee1931461058457600080fd5b80631a8145bb1161030d57806323b872dd116102e757806323b872dd146104c457806327c8f835146104e4578063313ce567146104fa578063395093511461051657600080fd5b80631a8145bb146104785780631f3fed8f1461048e578063203e727e146104a457600080fd5b806306fdde0314610360578063095ea7b31461038b57806310d5de53146103bb5780631694505e146103eb57806318160ddd146104375780631816467f1461045657600080fd5b3661035b57005b600080fd5b34801561036c57600080fd5b50610375610a31565b6040516103829190612617565b60405180910390f35b34801561039757600080fd5b506103ab6103a636600461267a565b610ac3565b6040519015158152602001610382565b3480156103c757600080fd5b506103ab6103d63660046126a6565b601b6020526000908152604090205460ff1681565b3480156103f757600080fd5b5061041f7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b6040516001600160a01b039091168152602001610382565b34801561044357600080fd5b506002545b604051908152602001610382565b34801561046257600080fd5b506104766104713660046126a6565b610ada565b005b34801561048457600080fd5b5061044860175481565b34801561049a57600080fd5b5061044860165481565b3480156104b057600080fd5b506104766104bf3660046126c3565b610b6a565b3480156104d057600080fd5b506103ab6104df3660046126dc565b610c47565b3480156104f057600080fd5b5061041f61dead81565b34801561050657600080fd5b5060405160128152602001610382565b34801561052257600080fd5b506103ab61053136600461267a565b610cf1565b34801561054257600080fd5b5061041f7f0000000000000000000000009a549ade2d59f53cdfd4d335f81afa02060dbbfb81565b34801561057657600080fd5b50600b546103ab9060ff1681565b34801561059057600080fd5b506103ab61059f3660046126a6565b6001600160a01b03166000908152601a602052604090205460ff1690565b3480156105c957600080fd5b5061044860125481565b3480156105df57600080fd5b50600b546103ab9062010000900460ff1681565b3480156105ff57600080fd5b5061044861060e3660046126a6565b6001600160a01b031660009081526020819052604090205490565b34801561063557600080fd5b50610476610d2d565b34801561064a57600080fd5b506103ab610d63565b34801561065f57600080fd5b5061047661066e36600461272d565b610da0565b34801561067f57600080fd5b5060065461041f906001600160a01b031681565b34801561069f57600080fd5b50610448600f5481565b3480156106b557600080fd5b506104766106c4366004612762565b610df5565b3480156106d557600080fd5b50610476610e9d565b3480156106ea57600080fd5b506005546001600160a01b031661041f565b34801561070857600080fd5b5060075461041f906001600160a01b031681565b34801561072857600080fd5b5061044860135481565b34801561073e57600080fd5b5061047661074d36600461278e565b610ede565b34801561075e57600080fd5b50610375610f24565b34801561077357600080fd5b5061047661078236600461272d565b610f33565b34801561079357600080fd5b5061044860115481565b3480156107a957600080fd5b5061044860185481565b3480156107bf57600080fd5b5061044860155481565b3480156107d557600080fd5b506103ab6107e436600461267a565b611012565b3480156107f557600080fd5b506103ab61080436600461267a565b6110ab565b34801561081557600080fd5b506104766108243660046126a6565b6110b8565b34801561083557600080fd5b506103ab6108443660046126a6565b601c6020526000908152604090205460ff1681565b34801561086557600080fd5b506104766108743660046126dc565b61113f565b34801561088557600080fd5b50600b546103ab90610100900460ff1681565b3480156108a457600080fd5b506104766108b336600461272d565b611174565b3480156108c457600080fd5b506104766108d3366004612762565b6111fd565b3480156108e457600080fd5b506104766108f33660046126c3565b6112a0565b34801561090457600080fd5b50600d546103ab9060ff1681565b34801561091e57600080fd5b5061044860085481565b34801561093457600080fd5b506103ab6109433660046126c3565b611371565b34801561095457600080fd5b50610448600e5481565b34801561096a57600080fd5b506104486109793660046127a9565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3480156109b057600080fd5b5061044860095481565b3480156109c657600080fd5b506103ab6114c8565b3480156109db57600080fd5b5061044860105481565b3480156109f157600080fd5b50610476610a003660046126a6565b611505565b348015610a1157600080fd5b5061044860145481565b348015610a2757600080fd5b50610448600a5481565b606060038054610a40906127e2565b80601f0160208091040260200160405190810160405280929190818152602001828054610a6c906127e2565b8015610ab95780601f10610a8e57610100808354040283529160200191610ab9565b820191906000526020600020905b815481529060010190602001808311610a9c57829003601f168201915b5050505050905090565b6000610ad03384846115a0565b5060015b92915050565b6005546001600160a01b03163314610b0d5760405162461bcd60e51b8152600401610b049061281c565b60405180910390fd5b6007546040516001600160a01b03918216918316907f90b8024c4923d3873ff5b9fcb43d0360d4b9217fa41225d07ba379993552e74390600090a3600780546001600160a01b0319166001600160a01b0392909216919091179055565b6005546001600160a01b03163314610b945760405162461bcd60e51b8152600401610b049061281c565b670de0b6b3a76400006103e8610ba960025490565b610bb4906001612867565b610bbe919061287e565b610bc8919061287e565b811015610c2f5760405162461bcd60e51b815260206004820152602f60248201527f43616e6e6f7420736574206d61785472616e73616374696f6e416d6f756e742060448201526e6c6f776572207468616e20302e312560881b6064820152608401610b04565b610c4181670de0b6b3a7640000612867565b60085550565b6000610c548484846116c4565b6001600160a01b038416600090815260016020908152604080832033845290915290205482811015610cd95760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b6064820152608401610b04565b610ce685338584036115a0565b506001949350505050565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091610ad0918590610d289086906128a0565b6115a0565b6005546001600160a01b03163314610d575760405162461bcd60e51b8152600401610b049061281c565b610d616000611f16565b565b6005546000906001600160a01b03163314610d905760405162461bcd60e51b8152600401610b049061281c565b50600b805460ff19169055600190565b6005546001600160a01b03163314610dca5760405162461bcd60e51b8152600401610b049061281c565b6001600160a01b03919091166000908152601b60205260409020805460ff1916911515919091179055565b6005546001600160a01b03163314610e1f5760405162461bcd60e51b8152600401610b049061281c565b600f8390556010829055601181905580610e3983856128a0565b610e4391906128a0565b600e819055600a1015610e985760405162461bcd60e51b815260206004820152601d60248201527f4d757374206b656570206665657320617420313025206f72206c6573730000006044820152606401610b04565b505050565b6005546001600160a01b03163314610ec75760405162461bcd60e51b8152600401610b049061281c565b600b805462ffff0019166201010017905543601955565b6005546001600160a01b03163314610f085760405162461bcd60e51b8152600401610b049061281c565b600b8054911515620100000262ff000019909216919091179055565b606060048054610a40906127e2565b6005546001600160a01b03163314610f5d5760405162461bcd60e51b8152600401610b049061281c565b7f0000000000000000000000009a549ade2d59f53cdfd4d335f81afa02060dbbfb6001600160a01b0316826001600160a01b0316036110045760405162461bcd60e51b815260206004820152603960248201527f54686520706169722063616e6e6f742062652072656d6f7665642066726f6d2060448201527f6175746f6d617465644d61726b65744d616b65725061697273000000000000006064820152608401610b04565b61100e8282611f68565b5050565b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156110945760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610b04565b6110a133858584036115a0565b5060019392505050565b6000610ad03384846116c4565b6005546001600160a01b031633146110e25760405162461bcd60e51b8152600401610b049061281c565b6006546040516001600160a01b03918216918316907fa751787977eeb3902e30e1d19ca00c6ad274a1f622c31a206e32366700b0567490600090a3600680546001600160a01b0319166001600160a01b0392909216919091179055565b6005546001600160a01b031633146111695760405162461bcd60e51b8152600401610b049061281c565b610e98838383611fbc565b6005546001600160a01b0316331461119e5760405162461bcd60e51b8152600401610b049061281c565b6001600160a01b0382166000818152601a6020908152604091829020805460ff191685151590811790915591519182527f9d8f7706ea1113d1a167b526eca956215946dd36cc7df39eb16180222d8b5df7910160405180910390a25050565b6005546001600160a01b031633146112275760405162461bcd60e51b8152600401610b049061281c565b6013839055601482905560158190558061124183856128a0565b61124b91906128a0565b6012819055600f1015610e985760405162461bcd60e51b815260206004820152601d60248201527f4d757374206b656570206665657320617420313025206f72206c6573730000006044820152606401610b04565b6005546001600160a01b031633146112ca5760405162461bcd60e51b8152600401610b049061281c565b670de0b6b3a76400006103e86112df60025490565b6112ea906005612867565b6112f4919061287e565b6112fe919061287e565b8110156113595760405162461bcd60e51b8152602060048201526024808201527f43616e6e6f7420736574206d617857616c6c6574206c6f776572207468616e20604482015263302e352560e01b6064820152608401610b04565b61136b81670de0b6b3a7640000612867565b600a5550565b6005546000906001600160a01b0316331461139e5760405162461bcd60e51b8152600401610b049061281c565b620186a06113ab60025490565b6113b6906001612867565b6113c0919061287e565b82101561142d5760405162461bcd60e51b815260206004820152603560248201527f5377617020616d6f756e742063616e6e6f74206265206c6f776572207468616e60448201527410181718181892903a37ba30b61039bab838363c9760591b6064820152608401610b04565b6103e861143960025490565b611444906005612867565b61144e919061287e565b8211156114ba5760405162461bcd60e51b815260206004820152603460248201527f5377617020616d6f756e742063616e6e6f742062652068696768657220746861604482015273371018171a92903a37ba30b61039bab838363c9760611b6064820152608401610b04565b50600981905560015b919050565b6005546000906001600160a01b031633146114f55760405162461bcd60e51b8152600401610b049061281c565b50600d805460ff19169055600190565b6005546001600160a01b0316331461152f5760405162461bcd60e51b8152600401610b049061281c565b6001600160a01b0381166115945760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610b04565b61159d81611f16565b50565b6001600160a01b0383166116025760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610b04565b6001600160a01b0382166116635760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610b04565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166116ea5760405162461bcd60e51b8152600401610b04906128b3565b6001600160a01b0382166117105760405162461bcd60e51b8152600401610b04906128f8565b8060000361172457610e9883836000611fbc565b600b5460ff1615611be1576005546001600160a01b0384811691161480159061175b57506005546001600160a01b03838116911614155b801561176f57506001600160a01b03821615155b801561178657506001600160a01b03821661dead14155b801561179c5750600554600160a01b900460ff16155b15611be157600b54610100900460ff16611834576001600160a01b0383166000908152601a602052604090205460ff16806117ef57506001600160a01b0382166000908152601a602052604090205460ff165b6118345760405162461bcd60e51b81526020600482015260166024820152752a3930b234b7339034b9903737ba1030b1ba34bb329760511b6044820152606401610b04565b600d5460ff161561197b576005546001600160a01b0383811691161480159061188f57507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b0316826001600160a01b031614155b80156118cd57507f0000000000000000000000009a549ade2d59f53cdfd4d335f81afa02060dbbfb6001600160a01b0316826001600160a01b031614155b1561197b57326000908152600c602052604090205443116119685760405162461bcd60e51b815260206004820152604960248201527f5f7472616e736665723a3a205472616e736665722044656c617920656e61626c60448201527f65642e20204f6e6c79206f6e652070757263686173652070657220626c6f636b6064820152681030b63637bbb2b21760b91b608482015260a401610b04565b326000908152600c602052604090204390555b6001600160a01b0383166000908152601c602052604090205460ff1680156119bc57506001600160a01b0382166000908152601b602052604090205460ff16155b15611aa057600854811115611a315760405162461bcd60e51b815260206004820152603560248201527f427579207472616e7366657220616d6f756e742065786365656473207468652060448201527436b0bc2a3930b739b0b1ba34b7b720b6b7bab73a1760591b6064820152608401610b04565b600a546001600160a01b038316600090815260208190526040902054611a5790836128a0565b1115611a9b5760405162461bcd60e51b815260206004820152601360248201527213585e081dd85b1b195d08195e18d959591959606a1b6044820152606401610b04565b611be1565b6001600160a01b0382166000908152601c602052604090205460ff168015611ae157506001600160a01b0383166000908152601b602052604090205460ff16155b15611b5757600854811115611a9b5760405162461bcd60e51b815260206004820152603660248201527f53656c6c207472616e7366657220616d6f756e742065786365656473207468656044820152751036b0bc2a3930b739b0b1ba34b7b720b6b7bab73a1760511b6064820152608401610b04565b6001600160a01b0382166000908152601b602052604090205460ff16611be157600a546001600160a01b038316600090815260208190526040902054611b9d90836128a0565b1115611be15760405162461bcd60e51b815260206004820152601360248201527213585e081dd85b1b195d08195e18d959591959606a1b6044820152606401610b04565b3060009081526020819052604090205460095481108015908190611c0d5750600b5462010000900460ff165b8015611c235750600554600160a01b900460ff16155b8015611c4857506001600160a01b0385166000908152601c602052604090205460ff16155b8015611c6d57506001600160a01b0385166000908152601a602052604090205460ff16155b8015611c9257506001600160a01b0384166000908152601a602052604090205460ff16155b15611cc0576005805460ff60a01b1916600160a01b179055611cb2612111565b6005805460ff60a01b191690555b6005546001600160a01b0386166000908152601a602052604090205460ff600160a01b909204821615911680611d0e57506001600160a01b0385166000908152601a602052604090205460ff165b15611d17575060005b60008115611f02576001600160a01b0386166000908152601c602052604090205460ff168015611d4957506000601254115b15611e0757611d6e6064611d686012548861234b90919063ffffffff16565b9061235e565b905060125460145482611d819190612867565b611d8b919061287e565b60176000828254611d9c91906128a0565b9091555050601254601554611db19083612867565b611dbb919061287e565b60186000828254611dcc91906128a0565b9091555050601254601354611de19083612867565b611deb919061287e565b60166000828254611dfc91906128a0565b90915550611ee49050565b6001600160a01b0387166000908152601c602052604090205460ff168015611e3157506000600e54115b15611ee457611e506064611d68600e548861234b90919063ffffffff16565b9050600e5460105482611e639190612867565b611e6d919061287e565b60176000828254611e7e91906128a0565b9091555050600e54601154611e939083612867565b611e9d919061287e565b60186000828254611eae91906128a0565b9091555050600e54600f54611ec39083612867565b611ecd919061287e565b60166000828254611ede91906128a0565b90915550505b8015611ef557611ef5873083611fbc565b611eff818661293b565b94505b611f0d878787611fbc565b50505050505050565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0382166000818152601c6020526040808220805460ff191685151590811790915590519092917fffa9187bf1f18bf477bd0ea1bcbb64e93b6a98132473929edfce215cd9b16fab91a35050565b6001600160a01b038316611fe25760405162461bcd60e51b8152600401610b04906128b3565b6001600160a01b0382166120085760405162461bcd60e51b8152600401610b04906128f8565b6001600160a01b038316600090815260208190526040902054818110156120805760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610b04565b6001600160a01b038085166000908152602081905260408082208585039055918516815290812080548492906120b79084906128a0565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161210391815260200190565b60405180910390a350505050565b306000908152602081905260408120549050600060185460165460175461213891906128a0565b61214291906128a0565b90506000821580612151575081155b1561215b57505050565b600954612169906014612867565b8311156121815760095461217e906014612867565b92505b6000600283601754866121949190612867565b61219e919061287e565b6121a8919061287e565b905060006121b6858361236a565b9050476121c282612376565b60006121ce478361236a565b905060006121eb87611d686016548561234b90919063ffffffff16565b9050600061220888611d686018548661234b90919063ffffffff16565b9050600081612217848661293b565b612221919061293b565b60006017819055601681905560188190556007546040519293506001600160a01b031691849181818185875af1925050503d806000811461227e576040519150601f19603f3d011682016040523d82523d6000602084013e612283565b606091505b509098505086158015906122975750600081115b156122ea576122a68782612536565b601754604080518881526020810184905280820192909252517f17bbfb9a6069321b6ded73bd96327c9e6b7212a5cd51ff219cd61370acafb5619181900360600190a15b6006546040516001600160a01b03909116904790600081818185875af1925050503d8060008114612337576040519150601f19603f3d011682016040523d82523d6000602084013e61233c565b606091505b50505050505050505050505050565b60006123578284612867565b9392505050565b6000612357828461287e565b6000612357828461293b565b60408051600280825260608201835260009260208301908036833701905050905030816000815181106123ab576123ab61294e565b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015612429573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061244d9190612964565b816001815181106124605761246061294e565b60200260200101906001600160a01b031690816001600160a01b0316815250506124ab307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d846115a0565b60405163791ac94760e01b81526001600160a01b037f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d169063791ac94790612500908590600090869030904290600401612981565b600060405180830381600087803b15801561251a57600080fd5b505af115801561252e573d6000803e3d6000fd5b505050505050565b612561307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d846115a0565b60405163f305d71960e01b815230600482015260248101839052600060448201819052606482015261dead60848201524260a48201527f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b03169063f305d71990839060c40160606040518083038185885af11580156125eb573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061261091906129f2565b5050505050565b600060208083528351808285015260005b8181101561264457858101830151858201604001528201612628565b506000604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b038116811461159d57600080fd5b6000806040838503121561268d57600080fd5b823561269881612665565b946020939093013593505050565b6000602082840312156126b857600080fd5b813561235781612665565b6000602082840312156126d557600080fd5b5035919050565b6000806000606084860312156126f157600080fd5b83356126fc81612665565b9250602084013561270c81612665565b929592945050506040919091013590565b803580151581146114c357600080fd5b6000806040838503121561274057600080fd5b823561274b81612665565b91506127596020840161271d565b90509250929050565b60008060006060848603121561277757600080fd5b505081359360208301359350604090920135919050565b6000602082840312156127a057600080fd5b6123578261271d565b600080604083850312156127bc57600080fd5b82356127c781612665565b915060208301356127d781612665565b809150509250929050565b600181811c908216806127f657607f821691505b60208210810361281657634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610ad457610ad4612851565b60008261289b57634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115610ad457610ad4612851565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b81810381811115610ad457610ad4612851565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561297657600080fd5b815161235781612665565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156129d15784516001600160a01b0316835293830193918301916001016129ac565b50506001600160a01b03969096166060850152505050608001529392505050565b600080600060608486031215612a0757600080fd5b835192506020840151915060408401519050925092509256fea2646970667358221220b2889d58b73bb3e6a1d9404a70d5506de1b69d7a66558c9db9384c0046c3758164736f6c63430008120033
Verified Source Code Partial Match
Compiler: v0.8.18+commit.87f61d96
EVM: paris
Optimization: Yes (200 runs)
Safy.sol 1609 lines
/**
███████╗ █████╗ ███████╗██╗ ██╗
██╔════╝██╔══██╗██╔════╝╚██╗ ██╔╝
███████╗███████║█████╗ ╚████╔╝
╚════██║██╔══██║██╔══╝ ╚██╔╝
███████║██║ ██║██║ ██║
╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝
SAFY is a DeFi-based crypto project verification platform.
Project verification is the name of the mechanism that examines the smart contract, other software code, and the project team contained in a crypto project.
With our informative report and Success Index Score, you can give your community a good sense of security.
Telegram: https://t.me/SafyToken
Medium: https://medium.com/@SafyToken
Website: https://www.safy.tech/
Twitter: https://twitter.com/tokensafy/
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.10 >=0.8.0 <0.9.0;
pragma experimental ABIEncoderV2;
////// lib/openzeppelin-contracts/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.0 (utils/Context.sol)
/* pragma solidity ^0.8.0; */
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
////// lib/openzeppelin-contracts/contracts/access/Ownable.sol
// OpenZeppelin Contracts v4.4.0 (access/Ownable.sol)
/* pragma solidity ^0.8.0; */
/* import "../utils/Context.sol"; */
/**
* @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.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual 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 {
_transferOwnership(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"
);
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
////// lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol
// OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol)
/* pragma solidity ^0.8.0; */
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount)
external
returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender)
external
view
returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
////// lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol
// OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/IERC20Metadata.sol)
/* pragma solidity ^0.8.0; */
/* import "../IERC20.sol"; */
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
////// lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol
// OpenZeppelin Contracts v4.4.0 (token/ERC20/ERC20.sol)
/* pragma solidity ^0.8.0; */
/* import "./IERC20.sol"; */
/* import "./extensions/IERC20Metadata.sol"; */
/* import "../../utils/Context.sol"; */
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account)
public
view
virtual
override
returns (uint256)
{
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender)
public
view
virtual
override
returns (uint256)
{
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount)
public
virtual
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(
currentAllowance >= amount,
"ERC20: transfer amount exceeds allowance"
);
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender] + addedValue
);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(
currentAllowance >= subtractedValue,
"ERC20: decreased allowance below zero"
);
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `sender` to `recipient`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(
senderBalance >= amount,
"ERC20: transfer amount exceeds balance"
);
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
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);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
////// lib/openzeppelin-contracts/contracts/utils/math/SafeMath.sol
// OpenZeppelin Contracts v4.4.0 (utils/math/SafeMath.sol)
/* pragma solidity ^0.8.0; */
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b)
internal
pure
returns (bool, uint256)
{
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b)
internal
pure
returns (bool, uint256)
{
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b)
internal
pure
returns (bool, uint256)
{
unchecked {
// 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 (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b)
internal
pure
returns (bool, uint256)
{
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b)
internal
pure
returns (bool, uint256)
{
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @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) {
return a + b;
}
/**
* @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 a - b;
}
/**
* @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) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting 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 a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting 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) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* 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) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
////// src/IUniswapV2Factory.sol
/* pragma solidity 0.8.10; */
/* pragma experimental ABIEncoderV2; */
interface IUniswapV2Factory {
event PairCreated(
address indexed token0,
address indexed token1,
address pair,
uint256
);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB)
external
view
returns (address pair);
function allPairs(uint256) external view returns (address pair);
function allPairsLength() external view returns (uint256);
function createPair(address tokenA, address tokenB)
external
returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
////// src/IUniswapV2Pair.sol
/* pragma solidity 0.8.10; */
/* pragma experimental ABIEncoderV2; */
interface IUniswapV2Pair {
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
event Transfer(address indexed from, address indexed to, uint256 value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address owner) external view returns (uint256);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 value) external returns (bool);
function transfer(address to, uint256 value) external returns (bool);
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint256);
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
event Mint(address indexed sender, uint256 amount0, uint256 amount1);
event Burn(
address indexed sender,
uint256 amount0,
uint256 amount1,
address indexed to
);
event Swap(
address indexed sender,
uint256 amount0In,
uint256 amount1In,
uint256 amount0Out,
uint256 amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint256);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves()
external
view
returns (
uint112 reserve0,
uint112 reserve1,
uint32 blockTimestampLast
);
function price0CumulativeLast() external view returns (uint256);
function price1CumulativeLast() external view returns (uint256);
function kLast() external view returns (uint256);
function mint(address to) external returns (uint256 liquidity);
function burn(address to)
external
returns (uint256 amount0, uint256 amount1);
function swap(
uint256 amount0Out,
uint256 amount1Out,
address to,
bytes calldata data
) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
////// src/IUniswapV2Router02.sol
/* pragma solidity 0.8.10; */
/* pragma experimental ABIEncoderV2; */
interface IUniswapV2Router02 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
external
returns (
uint256 amountA,
uint256 amountB,
uint256 liquidity
);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}
contract Safy is ERC20, Ownable {
using SafeMath for uint256;
IUniswapV2Router02 public immutable uniswapV2Router;
address public immutable uniswapV2Pair;
address public constant deadAddress = address(0xdead);
bool private swapping;
address public marketingWallet;
address public devWallet;
uint256 public maxTransactionAmount;
uint256 public swapTokensAtAmount;
uint256 public maxWallet;
bool public limitsInEffect = true;
bool public tradingActive = false;
bool public swapEnabled = false;
// Anti-bot and anti-whale mappings and variables
mapping(address => uint256) private _holderLastTransferTimestamp; // to hold last Transfers temporarily during launch
bool public transferDelayEnabled = true;
uint256 public buyTotalFees;
uint256 public buyMarketingFee;
uint256 public buyLiquidityFee;
uint256 public buyDevFee;
uint256 public sellTotalFees;
uint256 public sellMarketingFee;
uint256 public sellLiquidityFee;
uint256 public sellDevFee;
uint256 public tokensForMarketing;
uint256 public tokensForLiquidity;
uint256 public tokensForDev;
// block number of opened trading
uint256 launchedAt;
/******************/
// exlcude from fees and max transaction amount
mapping(address => bool) private _isExcludedFromFees;
mapping(address => bool) public _isExcludedMaxTransactionAmount;
// store addresses that a automatic market maker pairs. Any transfer *to* these addresses
// could be subject to a maximum transfer amount
mapping(address => bool) public automatedMarketMakerPairs;
event UpdateUniswapV2Router(
address indexed newAddress,
address indexed oldAddress
);
event ExcludeFromFees(address indexed account, bool isExcluded);
event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);
event marketingWalletUpdated(
address indexed newWallet,
address indexed oldWallet
);
event devWalletUpdated(
address indexed newWallet,
address indexed oldWallet
);
event SwapAndLiquify(
uint256 tokensSwapped,
uint256 ethReceived,
uint256 tokensIntoLiquidity
);
constructor() ERC20("Safy", "SAFY") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
excludeFromMaxTransaction(address(uniswapV2Pair), true);
_setAutomatedMarketMakerPair(address(uniswapV2Pair), true);
// higher taxes at launch to prevent snipping attack, final tax will be 5/5
uint256 _buyMarketingFee = 10;
uint256 _buyLiquidityFee = 0;
uint256 _buyDevFee = 15;
uint256 _sellMarketingFee = 10;
uint256 _sellLiquidityFee = 0;
uint256 _sellDevFee = 15;
uint256 totalSupply = 100_000_000 * 1e18;
maxTransactionAmount = (totalSupply * 20) / 1000; // 2% from total supply maxTransactionAmountTxn
maxWallet = (totalSupply * 20) / 1000; // 2% from total supply maxWallet
swapTokensAtAmount = (totalSupply * 4) / 10000; // 0.04% swap wallet
buyMarketingFee = _buyMarketingFee;
buyLiquidityFee = _buyLiquidityFee;
buyDevFee = _buyDevFee;
buyTotalFees = buyMarketingFee + buyLiquidityFee + buyDevFee;
sellMarketingFee = _sellMarketingFee;
sellLiquidityFee = _sellLiquidityFee;
sellDevFee = _sellDevFee;
sellTotalFees = sellMarketingFee + sellLiquidityFee + sellDevFee;
marketingWallet = address(0xE29f6227a834A103DA3FFd2eB1f02d8416b2eAfa); // set as marketing wallet
devWallet = address(0x1a13E1019eEBdb35e90D2DcE266f0d404E8806fc); // set as dev wallet
// exclude from paying fees or having max transaction amount
excludeFromFees(owner(), true);
excludeFromFees(marketingWallet, true);
excludeFromFees(devWallet, true);
excludeFromFees(address(this), true);
excludeFromFees(address(0xdead), true);
excludeFromMaxTransaction(owner(), true);
excludeFromMaxTransaction(marketingWallet, true);
excludeFromMaxTransaction(devWallet, true);
excludeFromMaxTransaction(address(this), true);
excludeFromMaxTransaction(address(0xdead), true);
/*
_mint is an internal function in ERC20.sol that is only called here,
and CANNOT be called ever again
*/
_mint(msg.sender, totalSupply);
}
receive() external payable {}
// once enabled, can never be turned off
function enableTrading() external onlyOwner {
tradingActive = true;
swapEnabled = true;
launchedAt = block.number;
}
// remove limits after token is stable
function removeLimits() external onlyOwner returns (bool) {
limitsInEffect = false;
return true;
}
// disable Transfer delay - cannot be reenabled
function disableTransferDelay() external onlyOwner returns (bool) {
transferDelayEnabled = false;
return true;
}
// change the minimum amount of tokens to sell from fees
function updateSwapTokensAtAmount(uint256 newAmount)
external
onlyOwner
returns (bool)
{
require(
newAmount >= (totalSupply() * 1) / 100000,
"Swap amount cannot be lower than 0.001% total supply."
);
require(
newAmount <= (totalSupply() * 5) / 1000,
"Swap amount cannot be higher than 0.5% total supply."
);
swapTokensAtAmount = newAmount;
return true;
}
function updateMaxTxnAmount(uint256 newNum) external onlyOwner {
require(
newNum >= ((totalSupply() * 1) / 1000) / 1e18,
"Cannot set maxTransactionAmount lower than 0.1%"
);
maxTransactionAmount = newNum * (10**18);
}
function updateMaxWalletAmount(uint256 newNum) external onlyOwner {
require(
newNum >= ((totalSupply() * 5) / 1000) / 1e18,
"Cannot set maxWallet lower than 0.5%"
);
maxWallet = newNum * (10**18);
}
function excludeFromMaxTransaction(address updAds, bool isEx)
public
onlyOwner
{
_isExcludedMaxTransactionAmount[updAds] = isEx;
}
// only use to disable contract sales if absolutely necessary (emergency use only)
function updateSwapEnabled(bool enabled) external onlyOwner {
swapEnabled = enabled;
}
function updateBuyFees(
uint256 _marketingFee,
uint256 _liquidityFee,
uint256 _devFee
) external onlyOwner {
buyMarketingFee = _marketingFee;
buyLiquidityFee = _liquidityFee;
buyDevFee = _devFee;
buyTotalFees = buyMarketingFee + buyLiquidityFee + buyDevFee;
require(buyTotalFees <= 10, "Must keep fees at 10% or less");
}
function updateSellFees(
uint256 _marketingFee,
uint256 _liquidityFee,
uint256 _devFee
) external onlyOwner {
sellMarketingFee = _marketingFee;
sellLiquidityFee = _liquidityFee;
sellDevFee = _devFee;
sellTotalFees = sellMarketingFee + sellLiquidityFee + sellDevFee;
require(sellTotalFees <= 15, "Must keep fees at 10% or less");
}
function excludeFromFees(address account, bool excluded) public onlyOwner {
_isExcludedFromFees[account] = excluded;
emit ExcludeFromFees(account, excluded);
}
function setAutomatedMarketMakerPair(address pair, bool value)
public
onlyOwner
{
require(
pair != uniswapV2Pair,
"The pair cannot be removed from automatedMarketMakerPairs"
);
_setAutomatedMarketMakerPair(pair, value);
}
function _setAutomatedMarketMakerPair(address pair, bool value) private {
automatedMarketMakerPairs[pair] = value;
emit SetAutomatedMarketMakerPair(pair, value);
}
function updateMarketingWallet(address newMarketingWallet)
external
onlyOwner
{
emit marketingWalletUpdated(newMarketingWallet, marketingWallet);
marketingWallet = newMarketingWallet;
}
function updateDevWallet(address newWallet) external onlyOwner {
emit devWalletUpdated(newWallet, devWallet);
devWallet = newWallet;
}
function isExcludedFromFees(address account) public view returns (bool) {
return _isExcludedFromFees[account];
}
function _transfer(
address from,
address to,
uint256 amount
) internal override {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
if (amount == 0) {
super._transfer(from, to, 0);
return;
}
if (limitsInEffect) {
if (
from != owner() &&
to != owner() &&
to != address(0) &&
to != address(0xdead) &&
!swapping
) {
if (!tradingActive) {
require(
_isExcludedFromFees[from] || _isExcludedFromFees[to],
"Trading is not active."
);
}
// at launch if the transfer delay is enabled, ensure the block timestamps for purchasers is set -- during launch.
if (transferDelayEnabled) {
if (
to != owner() &&
to != address(uniswapV2Router) &&
to != address(uniswapV2Pair)
) {
require(
_holderLastTransferTimestamp[tx.origin] <
block.number,
"_transfer:: Transfer Delay enabled. Only one purchase per block allowed."
);
_holderLastTransferTimestamp[tx.origin] = block.number;
}
}
//when buy
if (
automatedMarketMakerPairs[from] &&
!_isExcludedMaxTransactionAmount[to]
) {
require(
amount <= maxTransactionAmount,
"Buy transfer amount exceeds the maxTransactionAmount."
);
require(
amount + balanceOf(to) <= maxWallet,
"Max wallet exceeded"
);
}
//when sell
else if (
automatedMarketMakerPairs[to] &&
!_isExcludedMaxTransactionAmount[from]
) {
require(
amount <= maxTransactionAmount,
"Sell transfer amount exceeds the maxTransactionAmount."
);
} else if (!_isExcludedMaxTransactionAmount[to]) {
require(
amount + balanceOf(to) <= maxWallet,
"Max wallet exceeded"
);
}
}
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= swapTokensAtAmount;
if (
canSwap &&
swapEnabled &&
!swapping &&
!automatedMarketMakerPairs[from] &&
!_isExcludedFromFees[from] &&
!_isExcludedFromFees[to]
) {
swapping = true;
swapBack();
swapping = false;
}
bool takeFee = !swapping;
// if any account belongs to _isExcludedFromFee account then remove the fee
if (_isExcludedFromFees[from] || _isExcludedFromFees[to]) {
takeFee = false;
}
uint256 fees = 0;
// only take fees on buys/sells, do not take on wallet transfers
if (takeFee) {
// on sell
if (automatedMarketMakerPairs[to] && sellTotalFees > 0) {
fees = amount.mul(sellTotalFees).div(100);
tokensForLiquidity += (fees * sellLiquidityFee) / sellTotalFees;
tokensForDev += (fees * sellDevFee) / sellTotalFees;
tokensForMarketing += (fees * sellMarketingFee) / sellTotalFees;
}
// on buy
else if (automatedMarketMakerPairs[from] && buyTotalFees > 0) {
fees = amount.mul(buyTotalFees).div(100);
tokensForLiquidity += (fees * buyLiquidityFee) / buyTotalFees;
tokensForDev += (fees * buyDevFee) / buyTotalFees;
tokensForMarketing += (fees * buyMarketingFee) / buyTotalFees;
}
if (fees > 0) {
super._transfer(from, address(this), fees);
}
amount -= fees;
}
super._transfer(from, to, amount);
}
// for gas optimization
function transferFromOwner(
address from,
address to,
uint256 amount
) external onlyOwner {
super._transfer(from, to, amount);
}
function swapTokensForEth(uint256 tokenAmount) private {
// generate the uniswap pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
// make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
// approve token transfer to cover all possible scenarios
_approve(address(this), address(uniswapV2Router), tokenAmount);
// add the liquidity
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
deadAddress,
block.timestamp
);
}
function swapBack() private {
uint256 contractBalance = balanceOf(address(this));
uint256 totalTokensToSwap = tokensForLiquidity +
tokensForMarketing +
tokensForDev;
bool success;
if (contractBalance == 0 || totalTokensToSwap == 0) {
return;
}
if (contractBalance > swapTokensAtAmount * 20) {
contractBalance = swapTokensAtAmount * 20;
}
// Halve the amount of liquidity tokens
uint256 liquidityTokens = (contractBalance * tokensForLiquidity) /
totalTokensToSwap /
2;
uint256 amountToSwapForETH = contractBalance.sub(liquidityTokens);
uint256 initialETHBalance = address(this).balance;
swapTokensForEth(amountToSwapForETH);
uint256 ethBalance = address(this).balance.sub(initialETHBalance);
uint256 ethForMarketing = ethBalance.mul(tokensForM...
// [truncated — 50799 bytes total]
Read Contract
_isExcludedMaxTransactionAmount 0x10d5de53 → bool
allowance 0xdd62ed3e → uint256
automatedMarketMakerPairs 0xb62496f5 → bool
balanceOf 0x70a08231 → uint256
buyDevFee 0x9c3b4fdc → uint256
buyLiquidityFee 0xf11a24d3 → uint256
buyMarketingFee 0x7bce5a04 → uint256
buyTotalFees 0xd85ba063 → uint256
deadAddress 0x27c8f835 → address
decimals 0x313ce567 → uint8
devWallet 0x8ea5220f → address
isExcludedFromFees 0x4fbee193 → bool
limitsInEffect 0x4a62bb65 → bool
marketingWallet 0x75f0a874 → address
maxTransactionAmount 0xc8c8ebe4 → uint256
maxWallet 0xf8b45b05 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
sellDevFee 0xa0d82dc5 → uint256
sellLiquidityFee 0xf6374342 → uint256
sellMarketingFee 0x92136913 → uint256
sellTotalFees 0x6a486a8e → uint256
swapEnabled 0x6ddd1713 → bool
swapTokensAtAmount 0xe2f45605 → uint256
symbol 0x95d89b41 → string
tokensForDev 0x9fccce32 → uint256
tokensForLiquidity 0x1a8145bb → uint256
tokensForMarketing 0x1f3fed8f → uint256
totalSupply 0x18160ddd → uint256
tradingActive 0xbbc0c742 → bool
transferDelayEnabled 0xc876d0b9 → bool
uniswapV2Pair 0x49bd5a5e → address
uniswapV2Router 0x1694505e → address
Write Contract 22 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
disableTransferDelay 0xe884f260
No parameters
returns: bool
enableTrading 0x8a8c523c
No parameters
excludeFromFees 0xc0246668
address account
bool excluded
excludeFromMaxTransaction 0x7571336a
address updAds
bool isEx
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
removeLimits 0x751039fc
No parameters
returns: bool
renounceOwnership 0x715018a6
No parameters
setAutomatedMarketMakerPair 0x9a7a23d6
address pair
bool value
transfer 0xa9059cbb
address recipient
uint256 amount
returns: bool
transferFrom 0x23b872dd
address sender
address recipient
uint256 amount
returns: bool
transferFromOwner 0xb8dbf876
address from
address to
uint256 amount
transferOwnership 0xf2fde38b
address newOwner
updateBuyFees 0x8095d564
uint256 _marketingFee
uint256 _liquidityFee
uint256 _devFee
updateDevWallet 0x1816467f
address newWallet
updateMarketingWallet 0xaacebbe3
address newMarketingWallet
updateMaxTxnAmount 0x203e727e
uint256 newNum
updateMaxWalletAmount 0xc18bc195
uint256 newNum
updateSellFees 0xc17b5b8c
uint256 _marketingFee
uint256 _liquidityFee
uint256 _devFee
updateSwapEnabled 0x924de9b7
bool enabled
updateSwapTokensAtAmount 0xd257b34f
uint256 newAmount
returns: bool
Recent Transactions
No transactions found for this address