Address Contract Verified
Address
0x384fD1519e63D077567e17A461f4C7F78dE0Cc1c
Balance
0 ETH
Nonce
1
Code Size
13204 bytes
Creator
0x4429e164...4C5d at tx 0xa6d146d4...9beaeb
Indexed Transactions
0
Contract Bytecode
13204 bytes
0x60806040526004361061039b5760003560e01c80638a8c523c116101dc578063c8c8ebe411610102578063e9c50333116100a0578063f8b45b051161006f578063f8b45b0514610ab6578063f9f92be414610a1f578063fde83a3414610acc578063fe575a8714610ae257600080fd5b8063e9c5033314610a55578063f11a24d314610a6a578063f2fde38b14610a80578063f637434214610aa057600080fd5b8063d85ba063116100dc578063d85ba063146109c3578063dd62ed3e146109d9578063e19b282314610a1f578063e2f4560514610a3f57600080fd5b8063c8c8ebe414610977578063d257b34f1461098d578063d729715f146109ad57600080fd5b8063a9059cbb1161017a578063bc205ad311610149578063bc205ad3146108f7578063c024666814610917578063c17b5b8c14610937578063c18bc1951461095757600080fd5b8063a9059cbb14610868578063adee28ff14610888578063b62496f5146108a8578063bbc0c742146108d857600080fd5b806395d89b41116101b657806395d89b41146107fd5780639a7a23d6146108125780639c2e4ac614610832578063a457c2d71461084857600080fd5b80638a8c523c146107aa5780638da5cb5b146107bf578063924de9b7146107dd57600080fd5b80634a62bb65116102c1578063715018a61161025f578063782c4e991161022e578063782c4e991461072a5780637ca8448a1461074a5780637cb332bb1461076a5780638095d5641461078a57600080fd5b8063715018a6146106c0578063751039fc146106d55780637571336a146106ea57806375e3661e1461070a57600080fd5b80635f1893611161029b5780635f1893611461063f5780636a486a8e146106545780636ddd17131461066a57806370a082311461068a57600080fd5b80634a62bb65146105cc5780634fbee193146105e6578063599270441461061f57600080fd5b80631a8145bb11610339578063313ce56711610308578063313ce5671461053b57806339509351146105575780633dc599ff1461057757806349bd5a5e1461059857600080fd5b80631a8145bb146104cd578063203e727e146104e357806323b872dd1461050557806324b9f3c11461052557600080fd5b8063156c2f3511610375578063156c2f35146104325780631694505e1461045657806318160ddd146104a257806319eab042146104b757600080fd5b806306fdde03146103a7578063095ea7b3146103d257806310d5de531461040257600080fd5b366103a257005b600080fd5b3480156103b357600080fd5b506103bc610b1b565b6040516103c99190612fc3565b60405180910390f35b3480156103de57600080fd5b506103f26103ed366004613026565b610bad565b60405190151581526020016103c9565b34801561040e57600080fd5b506103f261041d366004613052565b60196020526000908152604090205460ff1681565b34801561043e57600080fd5b50610448600e5481565b6040519081526020016103c9565b34801561046257600080fd5b5061048a7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b6040516001600160a01b0390911681526020016103c9565b3480156104ae57600080fd5b50600254610448565b3480156104c357600080fd5b5061044860125481565b3480156104d957600080fd5b5061044860165481565b3480156104ef57600080fd5b506105036104fe36600461306f565b610bc4565b005b34801561051157600080fd5b506103f2610520366004613088565b610cd2565b34801561053157600080fd5b5061044860155481565b34801561054757600080fd5b50604051601281526020016103c9565b34801561056357600080fd5b506103f2610572366004613026565b610d91565b34801561058357600080fd5b50600b546103f2906301000000900460ff1681565b3480156105a457600080fd5b5061048a7f000000000000000000000000a43f4fb06cc0e1d771178ad077acd25113e6bcd081565b3480156105d857600080fd5b50600b546103f29060ff1681565b3480156105f257600080fd5b506103f2610601366004613052565b6001600160a01b031660009081526018602052604090205460ff1690565b34801561062b57600080fd5b5060075461048a906001600160a01b031681565b34801561064b57600080fd5b50610503610dcd565b34801561066057600080fd5b5061044860115481565b34801561067657600080fd5b50600b546103f29062010000900460ff1681565b34801561069657600080fd5b506104486106a5366004613052565b6001600160a01b031660009081526020819052604090205490565b3480156106cc57600080fd5b50610503610e2a565b3480156106e157600080fd5b506103f2610e7e565b3480156106f657600080fd5b506105036107053660046130d7565b610ed9565b34801561071657600080fd5b50610503610725366004613052565b610f4c565b34801561073657600080fd5b5060065461048a906001600160a01b031681565b34801561075657600080fd5b50610503610765366004613052565b610fb5565b34801561077657600080fd5b50610503610785366004613052565b611061565b34801561079657600080fd5b506105036107a5366004613110565b611113565b3480156107b657600080fd5b506105036111d9565b3480156107cb57600080fd5b506005546001600160a01b031661048a565b3480156107e957600080fd5b506105036107f836600461313c565b611234565b34801561080957600080fd5b506103bc611298565b34801561081e57600080fd5b5061050361082d3660046130d7565b6112a7565b34801561083e57600080fd5b5061044860105481565b34801561085457600080fd5b506103f2610863366004613026565b6113a0565b34801561087457600080fd5b506103f2610883366004613026565b611451565b34801561089457600080fd5b506105036108a3366004613052565b61145e565b3480156108b457600080fd5b506103f26108c3366004613052565b601a6020526000908152604090205460ff1681565b3480156108e457600080fd5b50600b546103f290610100900460ff1681565b34801561090357600080fd5b50610503610912366004613159565b611510565b34801561092357600080fd5b506105036109323660046130d7565b611696565b34801561094357600080fd5b50610503610952366004613110565b61173d565b34801561096357600080fd5b5061050361097236600461306f565b6117fe565b34801561098357600080fd5b5061044860085481565b34801561099957600080fd5b506103f26109a836600461306f565b6118ed565b3480156109b957600080fd5b5061044860145481565b3480156109cf57600080fd5b50610448600d5481565b3480156109e557600080fd5b506104486109f4366004613159565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b348015610a2b57600080fd5b50610503610a3a366004613052565b611a6e565b348015610a4b57600080fd5b5061044860095481565b348015610a6157600080fd5b50610503611c0f565b348015610a7657600080fd5b50610448600f5481565b348015610a8c57600080fd5b50610503610a9b366004613052565b611d51565b348015610aac57600080fd5b5061044860135481565b348015610ac257600080fd5b50610448600a5481565b348015610ad857600080fd5b5061044860175481565b348015610aee57600080fd5b506103f2610afd366004613052565b6001600160a01b03166000908152600c602052604090205460ff1690565b606060038054610b2a90613187565b80601f0160208091040260200160405190810160405280929190818152602001828054610b5690613187565b8015610ba35780601f10610b7857610100808354040283529160200191610ba3565b820191906000526020600020905b815481529060010190602001808311610b8657829003601f168201915b5050505050905090565b6000610bba338484611e21565b5060015b92915050565b6005546001600160a01b03163314610c115760405162461bcd60e51b8152602060048201819052602482015260008051602061333f83398151915260448201526064015b60405180910390fd5b670de0b6b3a76400006103e8610c2660025490565b610c319060056131d7565b610c3b91906131ee565b610c4591906131ee565b811015610cba5760405162461bcd60e51b815260206004820152602f60248201527f43616e6e6f7420736574206d61785472616e73616374696f6e416d6f756e742060448201527f6c6f776572207468616e20302e352500000000000000000000000000000000006064820152608401610c08565b610ccc81670de0b6b3a76400006131d7565b60085550565b6000610cdf848484611f45565b6001600160a01b038416600090815260016020908152604080832033845290915290205482811015610d795760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206160448201527f6c6c6f77616e63650000000000000000000000000000000000000000000000006064820152608401610c08565b610d868533858403611e21565b506001949350505050565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091610bba918590610dc8908690613210565b611e21565b6005546001600160a01b03163314610e155760405162461bcd60e51b8152602060048201819052602482015260008051602061333f8339815191526044820152606401610c08565b600b805463ff00000019166301000000179055565b6005546001600160a01b03163314610e725760405162461bcd60e51b8152602060048201819052602482015260008051602061333f8339815191526044820152606401610c08565b610e7c60006127c6565b565b6005546000906001600160a01b03163314610ec95760405162461bcd60e51b8152602060048201819052602482015260008051602061333f8339815191526044820152606401610c08565b50600b805460ff19169055600190565b6005546001600160a01b03163314610f215760405162461bcd60e51b8152602060048201819052602482015260008051602061333f8339815191526044820152606401610c08565b6001600160a01b03919091166000908152601960205260409020805460ff1916911515919091179055565b6005546001600160a01b03163314610f945760405162461bcd60e51b8152602060048201819052602482015260008051602061333f8339815191526044820152606401610c08565b6001600160a01b03166000908152600c60205260409020805460ff19169055565b6005546001600160a01b03163314610ffd5760405162461bcd60e51b8152602060048201819052602482015260008051602061333f8339815191526044820152606401610c08565b6000816001600160a01b03164760405160006040518083038185875af1925050503d806000811461104a576040519150601f19603f3d011682016040523d82523d6000602084013e61104f565b606091505b505090508061105d57600080fd5b5050565b6005546001600160a01b031633146110a95760405162461bcd60e51b8152602060048201819052602482015260008051602061333f8339815191526044820152606401610c08565b6007546040516001600160a01b03918216918316907f8aa0f85050aca99be43beb823e0457e77966b3baf697a289b03681978f96166890600090a36007805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6005546001600160a01b0316331461115b5760405162461bcd60e51b8152602060048201819052602482015260008051602061333f8339815191526044820152606401610c08565b600e839055600f8290556010819055806111758385613210565b61117f9190613210565b600d819055600510156111d45760405162461bcd60e51b815260206004820152601660248201527f4275792066656573206d757374206265203c3d20352e000000000000000000006044820152606401610c08565b505050565b6005546001600160a01b031633146112215760405162461bcd60e51b8152602060048201819052602482015260008051602061333f8339815191526044820152606401610c08565b600b805462ffff00191662010100179055565b6005546001600160a01b0316331461127c5760405162461bcd60e51b8152602060048201819052602482015260008051602061333f8339815191526044820152606401610c08565b600b8054911515620100000262ff000019909216919091179055565b606060048054610b2a90613187565b6005546001600160a01b031633146112ef5760405162461bcd60e51b8152602060048201819052602482015260008051602061333f8339815191526044820152606401610c08565b7f000000000000000000000000a43f4fb06cc0e1d771178ad077acd25113e6bcd06001600160a01b0316826001600160a01b0316036113965760405162461bcd60e51b815260206004820152603960248201527f54686520706169722063616e6e6f742062652072656d6f7665642066726f6d2060448201527f6175746f6d617465644d61726b65744d616b65725061697273000000000000006064820152608401610c08565b61105d8282612825565b3360009081526001602090815260408083206001600160a01b03861684529091528120548281101561143a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610c08565b6114473385858403611e21565b5060019392505050565b6000610bba338484611f45565b6005546001600160a01b031633146114a65760405162461bcd60e51b8152602060048201819052602482015260008051602061333f8339815191526044820152606401610c08565b6006546040516001600160a01b03918216918316907fc9f2d63eee8632b33d7a7db5252eb29036e81ee4fbe29260febe0c49ffb8a7bb90600090a36006805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6005546001600160a01b031633146115585760405162461bcd60e51b8152602060048201819052602482015260008051602061333f8339815191526044820152606401610c08565b6001600160a01b0382166115ae5760405162461bcd60e51b815260206004820152601a60248201527f5f746f6b656e20616464726573732063616e6e6f7420626520300000000000006044820152606401610c08565b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa1580156115f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116199190613223565b60405163a9059cbb60e01b81526001600160a01b038481166004830152602482018390529192509084169063a9059cbb906044016020604051808303816000875af115801561166c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611690919061323c565b50505050565b6005546001600160a01b031633146116de5760405162461bcd60e51b8152602060048201819052602482015260008051602061333f8339815191526044820152606401610c08565b6001600160a01b038216600081815260186020908152604091829020805460ff191685151590811790915591519182527f9d8f7706ea1113d1a167b526eca956215946dd36cc7df39eb16180222d8b5df7910160405180910390a25050565b6005546001600160a01b031633146117855760405162461bcd60e51b8152602060048201819052602482015260008051602061333f8339815191526044820152606401610c08565b6012839055601382905560148190558061179f8385613210565b6117a99190613210565b6011819055600510156111d45760405162461bcd60e51b815260206004820152601760248201527f53656c6c2066656573206d757374206265203c3d20352e0000000000000000006044820152606401610c08565b6005546001600160a01b031633146118465760405162461bcd60e51b8152602060048201819052602482015260008051602061333f8339815191526044820152606401610c08565b670de0b6b3a76400006103e861185b60025490565b61186690600a6131d7565b61187091906131ee565b61187a91906131ee565b8110156118d55760405162461bcd60e51b8152602060048201526024808201527f43616e6e6f7420736574206d617857616c6c6574206c6f776572207468616e20604482015263312e302560e01b6064820152608401610c08565b6118e781670de0b6b3a76400006131d7565b600a5550565b6005546000906001600160a01b031633146119385760405162461bcd60e51b8152602060048201819052602482015260008051602061333f8339815191526044820152606401610c08565b620186a061194560025490565b6119509060016131d7565b61195a91906131ee565b8210156119cf5760405162461bcd60e51b815260206004820152603560248201527f5377617020616d6f756e742063616e6e6f74206265206c6f776572207468616e60448201527f20302e3030312520746f74616c20737570706c792e00000000000000000000006064820152608401610c08565b6103e86119db60025490565b6119e69060056131d7565b6119f091906131ee565b821115611a655760405162461bcd60e51b815260206004820152603460248201527f5377617020616d6f756e742063616e6e6f74206265206869676865722074686160448201527f6e20302e352520746f74616c20737570706c792e0000000000000000000000006064820152608401610c08565b50600955600190565b6005546001600160a01b03163314611ab65760405162461bcd60e51b8152602060048201819052602482015260008051602061333f8339815191526044820152606401610c08565b600b546301000000900460ff1615611b1a5760405162461bcd60e51b815260206004820152602160248201527f5465616d20686173207265766f6b656420626c61636b6c6973742072696768746044820152607360f81b6064820152608401610c08565b7f000000000000000000000000a43f4fb06cc0e1d771178ad077acd25113e6bcd06001600160a01b0316816001600160a01b031614158015611b7957506001600160a01b038116737a250d5630b4cf539739df2c5dacb4c659f2488d14155b611beb5760405162461bcd60e51b815260206004820152602e60248201527f43616e6e6f7420626c61636b6c69737420746f6b656e277320763220726f757460448201527f6572206f7220763220706f6f6c2e0000000000000000000000000000000000006064820152608401610c08565b6001600160a01b03166000908152600c60205260409020805460ff19166001179055565b6005546001600160a01b03163314611c575760405162461bcd60e51b8152602060048201819052602482015260008051602061333f8339815191526044820152606401610c08565b6040516370a0823160e01b815230600482018190526000916370a0823190602401602060405180830381865afa158015611c95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cb99190613223565b60405163a9059cbb60e01b815233600482015260248101829052909150309063a9059cbb906044016020604051808303816000875af1158015611d00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d24919061323c565b5060405133904780156108fc02916000818181858888f1935050505015801561105d573d6000803e3d6000fd5b6005546001600160a01b03163314611d995760405162461bcd60e51b8152602060048201819052602482015260008051602061333f8339815191526044820152606401610c08565b6001600160a01b038116611e155760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610c08565b611e1e816127c6565b50565b6001600160a01b038316611e835760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610c08565b6001600160a01b038216611ee45760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610c08565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316611fa95760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610c08565b6001600160a01b03821661200b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610c08565b6001600160a01b0383166000908152600c602052604090205460ff16156120745760405162461bcd60e51b815260206004820152601260248201527f53656e64657220626c61636b6c697374656400000000000000000000000000006044820152606401610c08565b6001600160a01b0382166000908152600c602052604090205460ff16156120dd5760405162461bcd60e51b815260206004820152601460248201527f526563656976657220626c61636b6c69737465640000000000000000000000006044820152606401610c08565b806000036120f1576111d483836000612879565b600b5460ff1615612491576005546001600160a01b0384811691161480159061212857506005546001600160a01b03838116911614155b801561213c57506001600160a01b03821615155b801561215357506001600160a01b03821661dead14155b80156121695750600554600160a01b900460ff16155b1561249157600b54610100900460ff16612208576001600160a01b03831660009081526018602052604090205460ff16806121bc57506001600160a01b03821660009081526018602052604090205460ff165b6122085760405162461bcd60e51b815260206004820152601660248201527f54726164696e67206973206e6f74206163746976652e000000000000000000006044820152606401610c08565b6001600160a01b0383166000908152601a602052604090205460ff16801561224957506001600160a01b03821660009081526019602052604090205460ff16155b1561233f576008548111156122c65760405162461bcd60e51b815260206004820152603560248201527f427579207472616e7366657220616d6f756e742065786365656473207468652060448201527f6d61785472616e73616374696f6e416d6f756e742e00000000000000000000006064820152608401610c08565b600a546001600160a01b0383166000908152602081905260409020546122ec9083613210565b111561233a5760405162461bcd60e51b815260206004820152601360248201527f4d61782077616c6c6574206578636565646564000000000000000000000000006044820152606401610c08565b612491565b6001600160a01b0382166000908152601a602052604090205460ff16801561238057506001600160a01b03831660009081526019602052604090205460ff16155b156123fd5760085481111561233a5760405162461bcd60e51b815260206004820152603660248201527f53656c6c207472616e7366657220616d6f756e7420657863656564732074686560448201527f206d61785472616e73616374696f6e416d6f756e742e000000000000000000006064820152608401610c08565b6001600160a01b03821660009081526019602052604090205460ff1661249157600a546001600160a01b0383166000908152602081905260409020546124439083613210565b11156124915760405162461bcd60e51b815260206004820152601360248201527f4d61782077616c6c6574206578636565646564000000000000000000000000006044820152606401610c08565b30600090815260208190526040902054600954811080159081906124bd5750600b5462010000900460ff165b80156124d35750600554600160a01b900460ff16155b80156124f857506001600160a01b0385166000908152601a602052604090205460ff16155b801561251d57506001600160a01b03851660009081526018602052604090205460ff16155b801561254257506001600160a01b03841660009081526018602052604090205460ff16155b15612570576005805460ff60a01b1916600160a01b179055612562612a5e565b6005805460ff60a01b191690555b6005546001600160a01b03861660009081526018602052604090205460ff600160a01b9092048216159116806125be57506001600160a01b03851660009081526018602052604090205460ff165b156125c7575060005b600081156127b2576001600160a01b0386166000908152601a602052604090205460ff1680156125f957506000601154115b156126b75761261e606461261860115488612cba90919063ffffffff16565b90612ccd565b90506011546013548261263191906131d7565b61263b91906131ee565b6016600082825461264c9190613210565b909155505060115460145461266190836131d7565b61266b91906131ee565b6017600082825461267c9190613210565b909155505060115460125461269190836131d7565b61269b91906131ee565b601560008282546126ac9190613210565b909155506127949050565b6001600160a01b0387166000908152601a602052604090205460ff1680156126e157506000600d54115b15612794576127006064612618600d5488612cba90919063ffffffff16565b9050600d54600f548261271391906131d7565b61271d91906131ee565b6016600082825461272e9190613210565b9091555050600d5460105461274390836131d7565b61274d91906131ee565b6017600082825461275e9190613210565b9091555050600d54600e5461277390836131d7565b61277d91906131ee565b6015600082825461278e9190613210565b90915550505b80156127a5576127a5873083612879565b6127af8186613259565b94505b6127bd878787612879565b50505050505050565b600580546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0382166000818152601a6020526040808220805460ff191685151590811790915590519092917fffa9187bf1f18bf477bd0ea1bcbb64e93b6a98132473929edfce215cd9b16fab91a35050565b6001600160a01b0383166128dd5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610c08565b6001600160a01b03821661293f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610c08565b6001600160a01b038316600090815260208190526040902054818110156129ce5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610c08565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290612a05908490613210565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051612a5191815260200190565b60405180910390a3611690565b3060009081526020819052604081205490506000601754601554601654612a859190613210565b612a8f9190613210565b90506000821580612a9e575081155b15612aa857505050565b600954612ab69060146131d7565b831115612ace57600954612acb9060146131d7565b92505b600060028360165486612ae191906131d7565b612aeb91906131ee565b612af591906131ee565b90506000612b038583612cd9565b905047612b0f82612ce5565b6000612b1b4783612cd9565b90506000612b496002601654612b3191906131ee565b612b3b9089613259565b601554612618908590612cba565b90506000612b776002601654612b5f91906131ee565b612b69908a613259565b601754612618908690612cba565b9050600081612b868486613259565b612b909190613259565b60006016819055601581905560178190556007546040519293506001600160a01b031691849181818185875af1925050503d8060008114612bed576040519150601f19603f3d011682016040523d82523d6000602084013e612bf2565b606091505b50909850508615801590612c065750600081115b15612c5957612c158782612ea5565b601654604080518881526020810184905280820192909252517f17bbfb9a6069321b6ded73bd96327c9e6b7212a5cd51ff219cd61370acafb5619181900360600190a15b6006546040516001600160a01b03909116904790600081818185875af1925050503d8060008114612ca6576040519150601f19603f3d011682016040523d82523d6000602084013e612cab565b606091505b50505050505050505050505050565b6000612cc682846131d7565b9392505050565b6000612cc682846131ee565b6000612cc68284613259565b6040805160028082526060820183526000926020830190803683370190505090503081600081518110612d1a57612d1a61326c565b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015612d98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dbc9190613282565b81600181518110612dcf57612dcf61326c565b60200260200101906001600160a01b031690816001600160a01b031681525050612e1a307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84611e21565b60405163791ac94760e01b81526001600160a01b037f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d169063791ac94790612e6f90859060009086903090429060040161329f565b600060405180830381600087803b158015612e8957600080fd5b505af1158015612e9d573d6000803e3d6000fd5b505050505050565b612ed0307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84611e21565b7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663f305d719823085600080612f176005546001600160a01b031690565b60405160e088901b7fffffffff000000000000000000000000000000000000000000000000000000001681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015612f97573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190612fbc9190613310565b5050505050565b600060208083528351808285015260005b81811015612ff057858101830151858201604001528201612fd4565b506000604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b0381168114611e1e57600080fd5b6000806040838503121561303957600080fd5b823561304481613011565b946020939093013593505050565b60006020828403121561306457600080fd5b8135612cc681613011565b60006020828403121561308157600080fd5b5035919050565b60008060006060848603121561309d57600080fd5b83356130a881613011565b925060208401356130b881613011565b929592945050506040919091013590565b8015158114611e1e57600080fd5b600080604083850312156130ea57600080fd5b82356130f581613011565b91506020830135613105816130c9565b809150509250929050565b60008060006060848603121561312557600080fd5b505081359360208301359350604090920135919050565b60006020828403121561314e57600080fd5b8135612cc6816130c9565b6000806040838503121561316c57600080fd5b823561317781613011565b9150602083013561310581613011565b600181811c9082168061319b57607f821691505b6020821081036131bb57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610bbe57610bbe6131c1565b60008261320b57634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115610bbe57610bbe6131c1565b60006020828403121561323557600080fd5b5051919050565b60006020828403121561324e57600080fd5b8151612cc6816130c9565b81810381811115610bbe57610bbe6131c1565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561329457600080fd5b8151612cc681613011565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156132ef5784516001600160a01b0316835293830193918301916001016132ca565b50506001600160a01b03969096166060850152505050608001529392505050565b60008060006060848603121561332557600080fd5b835192506020840151915060408401519050925092509256fe4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a26469706673582212209d1501318dc5a21dd0fc93d5934242a4eba5daa56b30f54675cc4404dc1e6ae264736f6c63430008110033
Verified Source Code Full Match
Compiler: v0.8.17+commit.8df45f5f
EVM: london
Optimization: Yes (800 runs)
contract.sol 1481 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
pragma experimental ABIEncoderV2;
/**
* @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;
}
}
/**
* @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);
}
/**
* @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 {}
}
/**
* @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;
}
}
}
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;
}
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 Gembot is ERC20, Ownable {
using SafeMath for uint256;
IUniswapV2Router02 public immutable uniswapV2Router;
address public immutable uniswapV2Pair;
bool private swapping;
address public revShareWallet;
address public teamWallet;
uint256 public maxTransactionAmount;
uint256 public swapTokensAtAmount;
uint256 public maxWallet;
bool public limitsInEffect = true;
bool public tradingActive = false;
bool public swapEnabled = false;
bool public blacklistRenounced = false;
// Anti-bot and anti-whale mappings and variables
mapping(address => bool) blacklisted;
uint256 public buyTotalFees;
uint256 public buyRevShareFee;
uint256 public buyLiquidityFee;
uint256 public buyTeamFee;
uint256 public sellTotalFees;
uint256 public sellRevShareFee;
uint256 public sellLiquidityFee;
uint256 public sellTeamFee;
uint256 public tokensForRevShare;
uint256 public tokensForLiquidity;
uint256 public tokensForTeam;
/******************/
// exclude 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 revShareWalletUpdated(
address indexed newWallet,
address indexed oldWallet
);
event teamWalletUpdated(
address indexed newWallet,
address indexed oldWallet
);
event SwapAndLiquify(
uint256 tokensSwapped,
uint256 ethReceived,
uint256 tokensIntoLiquidity
);
constructor() ERC20("Gembot", "GEM") {
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);
uint256 _buyRevShareFee = 2;
uint256 _buyLiquidityFee = 2;
uint256 _buyTeamFee = 6;
uint256 _sellRevShareFee = 2;
uint256 _sellLiquidityFee = 2;
uint256 _sellTeamFee = 6;
uint256 totalSupply = 1_000_000 * 1e18;
maxTransactionAmount = 10_000 * 1e18; // 1%
maxWallet = 10_000 * 1e18; // 1%
swapTokensAtAmount = (totalSupply * 5) / 10000; // 0.05%
buyRevShareFee = _buyRevShareFee;
buyLiquidityFee = _buyLiquidityFee;
buyTeamFee = _buyTeamFee;
buyTotalFees = buyRevShareFee + buyLiquidityFee + buyTeamFee;
sellRevShareFee = _sellRevShareFee;
sellLiquidityFee = _sellLiquidityFee;
sellTeamFee = _sellTeamFee;
sellTotalFees = sellRevShareFee + sellLiquidityFee + sellTeamFee;
revShareWallet = address(0x6A998E85a9Fc4AEe7640289A93439b38BEd8dd70); // set as revShare wallet
teamWallet = owner(); // set as team wallet
// exclude from paying fees or having max transaction amount
excludeFromFees(owner(), true);
excludeFromFees(address(this), true);
excludeFromFees(address(0xdead), true);
excludeFromMaxTransaction(owner(), 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;
}
// remove limits after token is stable
function removeLimits() external onlyOwner returns (bool) {
limitsInEffect = 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() * 5) / 1000) / 1e18,
"Cannot set maxTransactionAmount lower than 0.5%"
);
maxTransactionAmount = newNum * (10**18);
}
function updateMaxWalletAmount(uint256 newNum) external onlyOwner {
require(
newNum >= ((totalSupply() * 10) / 1000) / 1e18,
"Cannot set maxWallet lower than 1.0%"
);
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 _revShareFee,
uint256 _liquidityFee,
uint256 _teamFee
) external onlyOwner {
buyRevShareFee = _revShareFee;
buyLiquidityFee = _liquidityFee;
buyTeamFee = _teamFee;
buyTotalFees = buyRevShareFee + buyLiquidityFee + buyTeamFee;
require(buyTotalFees <= 5, "Buy fees must be <= 5.");
}
function updateSellFees(
uint256 _revShareFee,
uint256 _liquidityFee,
uint256 _teamFee
) external onlyOwner {
sellRevShareFee = _revShareFee;
sellLiquidityFee = _liquidityFee;
sellTeamFee = _teamFee;
sellTotalFees = sellRevShareFee + sellLiquidityFee + sellTeamFee;
require(sellTotalFees <= 5, "Sell fees must be <= 5.");
}
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 updateRevShareWallet(address newRevShareWallet) external onlyOwner {
emit revShareWalletUpdated(newRevShareWallet, revShareWallet);
revShareWallet = newRevShareWallet;
}
function updateTeamWallet(address newWallet) external onlyOwner {
emit teamWalletUpdated(newWallet, teamWallet);
teamWallet = newWallet;
}
function isExcludedFromFees(address account) public view returns (bool) {
return _isExcludedFromFees[account];
}
function isBlacklisted(address account) public view returns (bool) {
return blacklisted[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");
require(!blacklisted[from],"Sender blacklisted");
require(!blacklisted[to],"Receiver blacklisted");
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."
);
}
//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;
tokensForTeam += (fees * sellTeamFee) / sellTotalFees;
tokensForRevShare += (fees * sellRevShareFee) / sellTotalFees;
}
// on buy
else if (automatedMarketMakerPairs[from] && buyTotalFees > 0) {
fees = amount.mul(buyTotalFees).div(100);
tokensForLiquidity += (fees * buyLiquidityFee) / buyTotalFees;
tokensForTeam += (fees * buyTeamFee) / buyTotalFees;
tokensForRevShare += (fees * buyRevShareFee) / buyTotalFees;
}
if (fees > 0) {
super._transfer(from, address(this), fees);
}
amount -= fees;
}
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
owner(),
block.timestamp
);
}
function swapBack() private {
uint256 contractBalance = balanceOf(address(this));
uint256 totalTokensToSwap = tokensForLiquidity +
tokensForRevShare +
tokensForTeam;
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 ethForRevShare = ethBalance.mul(tokensForRevShare).div(totalTokensToSwap - (tokensForLiquidity / 2));
uint256 ethForTeam = ethBalance.mul(tokensForTeam).div(totalTokensToSwap - (tokensForLiquidity / 2));
uint256 ethForLiquidity = ethBalance - ethForRevShare - ethForTeam;
tokensForLiquidity = 0;
tokensForRevShare = 0;
tokensForTeam = 0;
(success, ) = address(teamWallet).call{value: ethForTeam}("");
if (liquidityTokens > 0 && ethForLiquidity > 0) {
addLiquidity(liquidityTokens, ethForLiquidity);
emit SwapAndLiquify(
amountToSwapForETH,
ethForLiquidity,
tokensForLiquidity
);
}
(success, ) = address(revShareWallet).call{value: address(this).balance}("");
}
function withdrawStuckGembot() external onlyOwner {
uint256 balance = IERC20(address(this)).balanceOf(address(this));
IERC20(address(this)).transfer(msg.sender, balance);
payable(msg.sender).transfer(address(this).balance);
}
function withdrawStuckToken(address _token, address _to) external onlyOwner {
require(_token != address(0), "_token address cannot be 0");
uint256 _contractBalance = IERC20(_token).balanceOf(address(this));
IERC20(_token).transfer(_to, _contractBalance);
}
function withdrawStuckEth(address toAddr) external onlyOwner {
(bool success, ) = toAddr.call{
value: address(this).balance
} ("");
require(success);
}
// @dev team renounce blacklist commands
function renounceBlacklist() public onlyOwner {
blacklistRenounced = true;
}
function blacklist(address _addr) public onlyOwner {
require(!blacklistRenounced, "Team has revoked blacklist rights");
require(
_addr != address(uniswapV2Pair) && _addr != address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D),
"Cannot blacklist token's v2 router or v2 pool."
);
blacklisted[_addr] = true;
}
// @dev blacklist v3 pools; can unblacklist() down the road to suit project and community
function blacklistLiquidityPool(address lpAddress) public onlyOwner {
require(!blacklistRenounced, "Team has revoked blacklist rights");
require(
lpAddress != address(uniswapV2Pair) && lpAddress != address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D),
"Cannot blacklist token's v2 router or v2 pool."
);
blacklisted[lpAddress] = true;
}
// @dev unblacklist address; not affected by blacklistRenounced incase team wants to unblacklist v3 pools down the road
function unblacklist(address _addr) public onlyOwner {
blacklisted[_addr] = false;
}
}
Read Contract
_isExcludedMaxTransactionAmount 0x10d5de53 → bool
allowance 0xdd62ed3e → uint256
automatedMarketMakerPairs 0xb62496f5 → bool
balanceOf 0x70a08231 → uint256
blacklistRenounced 0x3dc599ff → bool
buyLiquidityFee 0xf11a24d3 → uint256
buyRevShareFee 0x156c2f35 → uint256
buyTeamFee 0x9c2e4ac6 → uint256
buyTotalFees 0xd85ba063 → uint256
decimals 0x313ce567 → uint8
isBlacklisted 0xfe575a87 → bool
isExcludedFromFees 0x4fbee193 → bool
limitsInEffect 0x4a62bb65 → bool
maxTransactionAmount 0xc8c8ebe4 → uint256
maxWallet 0xf8b45b05 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
revShareWallet 0x782c4e99 → address
sellLiquidityFee 0xf6374342 → uint256
sellRevShareFee 0x19eab042 → uint256
sellTeamFee 0xd729715f → uint256
sellTotalFees 0x6a486a8e → uint256
swapEnabled 0x6ddd1713 → bool
swapTokensAtAmount 0xe2f45605 → uint256
symbol 0x95d89b41 → string
teamWallet 0x59927044 → address
tokensForLiquidity 0x1a8145bb → uint256
tokensForRevShare 0x24b9f3c1 → uint256
tokensForTeam 0xfde83a34 → uint256
totalSupply 0x18160ddd → uint256
tradingActive 0xbbc0c742 → bool
uniswapV2Pair 0x49bd5a5e → address
uniswapV2Router 0x1694505e → address
Write Contract 27 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
blacklist 0xf9f92be4
address _addr
blacklistLiquidityPool 0xe19b2823
address lpAddress
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
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
renounceBlacklist 0x5f189361
No parameters
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
transferOwnership 0xf2fde38b
address newOwner
unblacklist 0x75e3661e
address _addr
updateBuyFees 0x8095d564
uint256 _revShareFee
uint256 _liquidityFee
uint256 _teamFee
updateMaxTxnAmount 0x203e727e
uint256 newNum
updateMaxWalletAmount 0xc18bc195
uint256 newNum
updateRevShareWallet 0xadee28ff
address newRevShareWallet
updateSellFees 0xc17b5b8c
uint256 _revShareFee
uint256 _liquidityFee
uint256 _teamFee
updateSwapEnabled 0x924de9b7
bool enabled
updateSwapTokensAtAmount 0xd257b34f
uint256 newAmount
returns: bool
updateTeamWallet 0x7cb332bb
address newWallet
withdrawStuckEth 0x7ca8448a
address toAddr
withdrawStuckGembot 0xe9c50333
No parameters
withdrawStuckToken 0xbc205ad3
address _token
address _to
Recent Transactions
No transactions found for this address