Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x134F6274013A57B5773c3305FeeC7AFE2ca19863
Balance 0.000438196 ETH
Nonce 1
Code Size 16971 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

16971 bytes
0x608060405260043610610375575f3560e01c806377004851116101ce578063a9059cbb11610100578063d8454a8211610099578063f2fde38b1161006b578063f2fde38b14610acd578063f3dc4f4814610aec578063f59c370814610b28578063f7de0e5714610b4757005b8063d8454a8214610a5c578063dd62ed3e14610a70578063edd286cf14610a8f578063f2cda82e14610aae57005b8063cc1776d3116100d2578063cc1776d3146109c8578063d232c220146109dc578063d505accf14610a1e578063d6a018eb14610a3d57005b8063a9059cbb14610959578063be5e49b214610978578063c292158314610997578063c78fe0d4146109b457005b806395101f90116101725780639c5ef8d7116101445780639c5ef8d7146108e8578063a457c2d7146108fc578063a4d8971a1461091b578063a5596b4f1461093a57005b806395101f901461087a57806395d89b411461089957806396ce0795146108ad57806397a26b9e146108c157005b80638a8c523c116101ab5780638a8c523c146108165780638bf1acff1461082a5780638d8350ca1461083e5780638da5cb5b1461085d57005b806377004851146107bb5780637ecebe00146107cf5780638324c3b91461080257005b8063370158ea116102a75780634f7041a51161024b5780635f6417581161021d5780635f641758146107335780636f05be971461075257806370a0823114610773578063715018a6146107a757005b80634f7041a51461069057806354fd4d50146106b85780635a0d4f88146106e55780635b90fe661461070257005b80633af32abf116102845780633af32abf146105f25780633b7854de1461062957806344b691ff1461065a5780634b7d9db41461067957005b8063370158ea1461059957806339137f8b146105bf57806339509351146105d357005b8063186488a8116103195780632cdf2c35116102eb5780632cdf2c35146104e7578063313ce5671461050657806332acf3de146105435780633644e5151461058557005b8063186488a81461046b57806323b872dd1461048a5780632623e975146104a95780632984207a146104c857005b806307e9652c1161035257806307e9652c146103f2578063095ea7b31461040f5780631171bda91461042e57806318160ddd1461044d57005b806301b38af51461037e578063064a59d01461039d57806306fdde03146103d157005b3661037c57005b005b348015610389575f80fd5b5061037c610398366004613b7e565b610b64565b3480156103a8575f80fd5b50600854600160381b900463ffffffff1615155b60405190151581526020015b60405180910390f35b3480156103dc575f80fd5b506103e5610be1565b6040516103c89190613c2b565b3480156103fd575f80fd5b5060075462010000900460ff166103bc565b34801561041a575f80fd5b506103bc610429366004613c58565b610c71565b348015610439575f80fd5b5061037c610448366004613c82565b610c87565b348015610458575f80fd5b506009545b6040519081526020016103c8565b348015610476575f80fd5b5061037c610485366004613d65565b610e1a565b348015610495575f80fd5b506103bc6104a4366004613c82565b610eb3565b3480156104b4575f80fd5b5061037c6104c3366004613dbb565b610ed4565b3480156104d3575f80fd5b5061037c6104e2366004613dd6565b610f72565b3480156104f2575f80fd5b5061037c610501366004613c82565b610fd0565b348015610511575f80fd5b5060405160ff7f00000000000000000000000000000000000000000000000000000000000000121681526020016103c8565b34801561054e575f80fd5b5060075462ffffff600160b01b8204811691600160c81b9004165b6040805162ffffff9384168152929091166020830152016103c8565b348015610590575f80fd5b50601f5461045d565b3480156105a4575f80fd5b506105ad611035565b6040516103c896959493929190613df9565b3480156105ca575f80fd5b5061037c6111c0565b3480156105de575f80fd5b506103bc6105ed366004613c58565b611221565b3480156105fd575f80fd5b506103bc61060c366004613e5d565b6001600160a01b03165f9081526002602052604090205460ff1690565b348015610634575f80fd5b50601b546001600160a01b03165b6040516001600160a01b0390911681526020016103c8565b348015610665575f80fd5b5061037c610674366004613e78565b611238565b348015610684575f80fd5b5060075460ff166103bc565b34801561069b575f80fd5b506106a4611383565b60405162ffffff90911681526020016103c8565b3480156106c3575f80fd5b50604080518082019091526005815264312e302e3360d81b60208201526103e5565b3480156106f0575f80fd5b506016546001600160a01b0316610642565b34801561070d575f80fd5b50600854600160781b900463ffffffff1660405163ffffffff90911681526020016103c8565b34801561073e575f80fd5b506106a461074d366004613e5d565b611392565b34801561075d575f80fd5b5061076661148d565b6040516103c89190613ed0565b34801561077e575f80fd5b5061045d61078d366004613e5d565b6001600160a01b03165f9081526020819052604090205490565b3480156107b2575f80fd5b5061037c61161e565b3480156107c6575f80fd5b5061037c611664565b3480156107da575f80fd5b5061045d6107e9366004613e5d565b6001600160a01b03165f90815260208052604090205490565b34801561080d575f80fd5b5061037c6116a5565b348015610821575f80fd5b5061037c611708565b348015610835575f80fd5b506106a46117e2565b348015610849575f80fd5b506106a4610858366004613e5d565b6117e8565b348015610868575f80fd5b50601c546001600160a01b0316610642565b348015610885575f80fd5b506106a4610894366004613e5d565b6118ac565b3480156108a4575f80fd5b506103e5611988565b3480156108b8575f80fd5b506103e86106a4565b3480156108cc575f80fd5b5060075460085462ffffff600160e01b90920482169116610569565b3480156108f3575f80fd5b5061037c611997565b348015610907575f80fd5b506103bc610916366004613c58565b611a0c565b348015610926575f80fd5b5061037c610935366004613dbb565b611a6c565b348015610945575f80fd5b5061037c610954366004613dbb565b611af8565b348015610964575f80fd5b506103bc610973366004613c58565b611b52565b348015610983575f80fd5b5061037c610992366004613e5d565b611b5e565b3480156109a2575f80fd5b506018546001600160a01b0316610642565b3480156109bf575f80fd5b5061037c611bbd565b3480156109d3575f80fd5b506106a4611c22565b3480156109e7575f80fd5b506015546040805160ff808416151582526201000084048116151560208301526101009093049092161515908201526060016103c8565b348015610a29575f80fd5b5061037c610a38366004613f4f565b611c2c565b348015610a48575f80fd5b5061037c610a57366004613e78565b611e12565b348015610a67575f80fd5b5060105461045d565b348015610a7b575f80fd5b5061045d610a8a366004613fb8565b611f2f565b348015610a9a575f80fd5b5061037c610aa9366004613e5d565b611f59565b348015610ab9575f80fd5b5061037c610ac8366004613c58565b611fa1565b348015610ad8575f80fd5b5061037c610ae7366004613e5d565b612086565b348015610af7575f80fd5b506103bc610b06366004613e5d565b6001600160a01b03165f90815260036020526040902054610100900460ff1690565b348015610b33575f80fd5b5061037c610b42366004613fef565b6120cb565b348015610b52575f80fd5b506017546001600160a01b0316610642565b601c546001600160a01b03163314610b975760405162461bcd60e51b8152600401610b8e9061401b565b60405180910390fd5b815f5b81811015610bda57610bd2858583818110610bb757610bb7614041565b9050602002016020810190610bcc9190613e5d565b846120fb565b600101610b9a565b5050505050565b6060601d8054610bf090614055565b80601f0160208091040260200160405190810160405280929190818152602001828054610c1c90614055565b8015610c675780601f10610c3e57610100808354040283529160200191610c67565b820191905f5260205f20905b815481529060010190602001808311610c4a57829003601f168201915b5050505050905090565b5f610c7d3384846121fd565b5060015b92915050565b601c546001600160a01b03163314610cb15760405162461bcd60e51b8152600401610b8e9061401b565b6040516370a0823160e01b81523060048201525f906001600160a01b038516906370a0823190602401602060405180830381865afa158015610cf5573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d199190614087565b90505f6001600160a01b0385163014610d66576016546001600160a01b03868116911614610d47575f610d6e565b6016546001600160a01b03165f90815260056020526040902054610d6e565b600e54601254015b90508282821015610d7f5781610d81565b825b83031015610da15760405162461bcd60e51b8152600401610b8e9061409e565b505060405163a9059cbb60e01b81526001600160a01b0383811660048301526024820183905284169063a9059cbb906044015b6020604051808303815f875af1158015610df0573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e1491906140c7565b50505050565b601c546001600160a01b03163314610e445760405162461bcd60e51b8152600401610b8e9061401b565b601554610100900460ff1615610e58575f80fd5b60018460ff1610158015610e70575060058460ff1611155b610ea75760405162461bcd60e51b815260206004820152600860248201526714995cd95c9d995960c21b6044820152606401610b8e565b610e148484848461225e565b5f610ebf8433846127bd565b610eca848484612820565b5060019392505050565b601c546001600160a01b03163314610efe5760405162461bcd60e51b8152600401610b8e9061401b565b60155462010000900460ff1615610f13575f80fd5b801580610f2a57506017546001600160a01b031615155b610f5f5760405162461bcd60e51b815260206004820152600660248201526509cde40888ab60d31b6044820152606401610b8e565b6007805460ff1916911515919091179055565b601c546001600160a01b03163314610f9c5760405162461bcd60e51b8152600401610b8e9061401b565b601554610100900460ff1615610fb0575f80fd5b6102588163ffffffff161115610fc4575f80fd5b610fcd81612d07565b50565b601c546001600160a01b03163314610ffa5760405162461bcd60e51b8152600401610b8e9061401b565b604051632142170760e11b81523060048201526001600160a01b038381166024830152604482018390528416906342842e0e90606401610dd4565b6060805f805f6060601d601e7f0000000000000000000000000000000000000000000000000000000000000012601c5f9054906101000a90046001600160a01b031660095460405180604001604052806005815260200164312e302e3360d81b8152508580546110a490614055565b80601f01602080910402602001604051908101604052809291908181526020018280546110d090614055565b801561111b5780601f106110f25761010080835404028352916020019161111b565b820191905f5260205f20905b8154815290600101906020018083116110fe57829003601f168201915b5050505050955084805461112e90614055565b80601f016020809104026020016040519081016040528092919081815260200182805461115a90614055565b80156111a55780601f1061117c576101008083540402835291602001916111a5565b820191905f5260205f20905b81548152906001019060200180831161118857829003601f168201915b50505050509450955095509550955095509550909192939495565b601c546001600160a01b031633146111ea5760405162461bcd60e51b8152600401610b8e9061401b565b6015805460ff191660011790556040517f951371dba26ef6174e32c5005af266bb9a0405124df206f136f85716d9c96093905f90a1565b5f610c7d3384846112323388611f2f565b016121fd565b601c546001600160a01b031633146112625760405162461bcd60e51b8152600401610b8e9061401b565b60155462010000900460ff1615611277575f80fd5b60018262ffffff161015801561129457506103e88262ffffff1611155b6112cf5760405162461bcd60e51b815260206004820152600c60248201526b302e3030312520746f20312560a01b6044820152606401610b8e565b8162ffffff168162ffffff16101580156112f057506103e88162ffffff1611155b61132b5760405162461bcd60e51b815260206004820152600c60248201526b302e3030312520746f20312560a01b6044820152606401610b8e565b6007805465ffffffffffff60b01b1916600160b01b62ffffff80861691820262ffffff60c81b191692909217600160c81b92851692830217909255600954620186a0928102839004600a550204600b555050565b5050565b5f61138d336118ac565b905090565b6007545f9062010000900460ff16156113ac57505f919050565b6001600160a01b0382163014806113da57506001600160a01b0382165f9081526002602052604090205460ff165b806113f257506018546001600160a01b038381169116145b8061140a57506017546001600160a01b038381169116145b611486576001600160a01b0382165f90815260036020526040902054610100900460ff168061145a575060085463ffffffff428116600160781b83048216600160381b9093048216929092011610155b61147257600754600160501b900462ffffff16610c81565b600754600160981b900462ffffff16610c81565b5f92915050565b60408051600680825260e08201909252606091816020015b6114ad613a70565b8152602001906001900390816114a55790505090505f5b60068160ff16101561161a576040805160808101825260ff83165f81815260046020818152858320805461010090046001600160a01b03168652938352908152845160608101958690529394908501939260010191600391908390855b82829054906101000a900462ffffff1662ffffff1681526020019060030190602082600201049283019260010382029150808411611521579050505050918352505060ff83165f9081526004602090815260409182902082516060810190935292019160020160038282826020028201915f905b82829054906101000a900462ffffff1662ffffff16815260200190600301906020826002010492830192600103820291508084116115955750505092845250505060ff83165f818152600460209081526040909120600301549201919091528351849190811061160757611607614041565b60209081029190910101526001016114c4565b5090565b601c546001600160a01b031633146116485760405162461bcd60e51b8152600401610b8e9061401b565b6015805462ffffff1916620101011790556116625f612d61565b565b60075460ff16801561167e5750600754610100900460ff16155b801561169457506007546301000000900460ff16155b61169c575f80fd5b6116625f612db2565b601c546001600160a01b031633146116cf5760405162461bcd60e51b8152600401610b8e9061401b565b6015805461ff0019166101001790556040517fb18b29d65a3b95dc80df0b9528f12b8592bd02395ca19228958e8b7cdf3ddd2b905f90a1565b601c546001600160a01b031633146117325760405162461bcd60e51b8152600401610b8e9061401b565b60155462010000900460ff1615611747575f80fd5b600854600160381b900463ffffffff16156117965760405162461bcd60e51b815260206004820152600f60248201526e105b1c9958591e48195b98589b1959608a1b6044820152606401610b8e565b600880546affffffff000000000000001916600160381b63ffffffff4216021790556040517f799663458a5ef2936f7fa0c99b3336c69c25890f82974f04e811e5bb359186c7905f90a1565b5f61138d335b5f6001600160a01b03821630148061181757506001600160a01b0382165f9081526002602052604090205460ff165b8061182f57506018546001600160a01b038381169116145b611486576001600160a01b0382165f90815260036020526040902054610100900460ff168061187f575060085463ffffffff428116600160781b83048216600160381b9093048216929092011610155b61189857600754640100000000900462ffffff16610c81565b600754600160681b900462ffffff16610c81565b6007545f9062010000900460ff16156118c657505f919050565b6001600160a01b0382163014806118f457506001600160a01b0382165f9081526002602052604090205460ff165b8061190c57506018546001600160a01b038381169116145b611486576001600160a01b0382165f90815260036020526040902054610100900460ff168061195c575060085463ffffffff428116600160781b83048216600160381b9093048216929092011610155b61197457600754600160381b900462ffffff16610c81565b600754600160801b900462ffffff16610c81565b6060601e8054610bf090614055565b601c546001600160a01b03163314806119be5750335f9081526002602052604090205460ff165b6119da5760405162461bcd60e51b8152600401610b8e9061401b565b600754610100900460ff161580156119fc57506007546301000000900460ff16155b611a04575f80fd5b6116626131ac565b5f80611a183385611f2f565b905082811015611a5f5760405162461bcd60e51b81526020600482015260126024820152714e6567617469766520616c6c6f77616e636560701b6044820152606401610b8e565b610eca33858584036121fd565b601c546001600160a01b0316331480611a935750335f9081526002602052604090205460ff165b611aaf5760405162461bcd60e51b8152600401610b8e9061401b565b8080611abd575060075460ff165b8015611ad15750600754610100900460ff16155b8015611ae757506007546301000000900460ff16155b611aef575f80fd5b610fcd81612db2565b601c546001600160a01b03163314611b225760405162461bcd60e51b8152600401610b8e9061401b565b601554610100900460ff1615611b36575f80fd5b60078054911515620100000262ff000019909216919091179055565b5f610c7d338484612820565b601c546001600160a01b03163314611b885760405162461bcd60e51b8152600401610b8e9061401b565b601554610100900460ff1615611b9c575f80fd5b6001600160a01b03165f908152600360205260409020805461ff0019169055565b601c546001600160a01b03163314611be75760405162461bcd60e51b8152600401610b8e9061401b565b6015805462ff00001916620100001790556040517ff7f7205ed48f7a35df9b5857667bdee0189d5d7cd80588f217a82641c3b4d08c905f90a1565b5f61138d33611392565b42841015611c705760405162461bcd60e51b815260206004820152601160248201527045787069726564207369676e617475726560781b6044820152606401610b8e565b601f546001600160a01b038881165f818152602080805260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e08501825280519083012061190160f01b6101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e280820193601f1981019281900390910190855afa158015611d86573d5f803e3d5ffd5b5050604051601f1901519150506001600160a01b03811615801590611dbc5750886001600160a01b0316816001600160a01b0316145b611dfc5760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964207369676e617475726560781b6044820152606401610b8e565b5050611e098787876121fd565b50505050505050565b601c546001600160a01b03163314611e3c5760405162461bcd60e51b8152600401610b8e9061401b565b60155462010000900460ff1615611e51575f80fd5b600a8262ffffff1610158015611e7d5750611e6f6103e860646140f6565b62ffffff168262ffffff1611155b611eb95760405162461bcd60e51b815260206004820152600d60248201526c302e30312520746f203130302560981b6044820152606401610b8e565b8162ffffff168162ffffff1610158015611ee95750611edb6103e860646140f6565b62ffffff168162ffffff1611155b611f255760405162461bcd60e51b815260206004820152600d60248201526c302e30312520746f203130302560981b6044820152606401610b8e565b61137f8282613306565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b601c546001600160a01b03163314611f835760405162461bcd60e51b8152600401610b8e9061401b565b601b80546001600160a01b0319166001600160a01b03831617905550565b601c546001600160a01b03163314611fcb5760405162461bcd60e51b8152600401610b8e9061401b565b601a5460165447915f916001600160a01b03908116911614611fed575f611ff1565b6014545b905082828210156120025781612004565b825b830310156120245760405162461bcd60e51b8152600401610b8e9061409e565b50505f826001600160a01b0316826040515f6040518083038185875af1925050503d805f811461206f576040519150601f19603f3d011682016040523d82523d5f602084013e612074565b606091505b5050905080612081575f80fd5b505050565b601c546001600160a01b031633146120b05760405162461bcd60e51b8152600401610b8e9061401b565b6001600160a01b0381166120c2575f80fd5b610fcd81612d61565b601c546001600160a01b031633146120f55760405162461bcd60e51b8152600401610b8e9061401b565b61137f82825b60155460ff161561210a575f80fd5b6001600160a01b03821661211c575f80fd5b6017546001600160a01b0383811691161480159061214857506018546001600160a01b03838116911614155b61219f5760405162461bcd60e51b815260206004820152602260248201527f44455820726f7574657220616e642070616972206172652070726976696c6567604482015261195960f21b6064820152608401610b8e565b6001600160a01b0382165f81815260026020908152604091829020805460ff191685151590811790915591519182527fa54714518c5d275fdcd3d2a461e4858e4e8cb04fb93cd0bca9d6d34115f26440910160405180910390a25050565b6001600160a01b038381165f8181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b60058460ff16111561226e575f80fd5b6001600160a01b038316301480159061229257506001600160a01b03831661dead14155b80156122a657506001600160a01b03831615155b6122ae575f80fd5b60ff84165f9081526004602090815260409182902060018101805486516007805464010000000080820462ffffff908116958116909403949094018316840266ffffff00000000198216811780845586548c8a0151600160381b928390048716630100000092839004881690910301861690910269ffffffffffff000000001990931669ffffff0000000000000019909216919091179190911780835594548a890151600160501b8088048616600160301b9384900487169092039190910185160262ffffff60501b19871681178085556002890180548d51600160681b938490048916918916900301871690910265ffffffffffff60501b1990981662ffffff60681b1990921691909117969096178084558654988b0151600160801b808304871694909a048616900392909201841690970262ffffff60801b19821681178084559554988a015165ffffffffffff60801b1990921662ffffff60981b1990911617969097048216909603600160981b938490048216018116909202939093179384905590926161a892900416118015906124a657506007546161a8600160381b90910462ffffff161180159061247757506007546161a8600160501b90910462ffffff1611155b80156124a657506007546161a8600160381b820462ffffff908116600160501b90930481169290920190911611155b6124dd5760405162461bcd60e51b8152602060048201526008602482015267090d2ced040a8c2f60c31b6044820152606401610b8e565b60075462015f90600160681b90910462ffffff1611801590612511575060075462015f90600160801b90910462ffffff1611155b801561252f575060075462015f90600160981b90910462ffffff1611155b61256d5760405162461bcd60e51b815260206004820152600f60248201526e496e76616c69642050656e616c747960881b6044820152606401610b8e565b8054610100600160a81b0319166101006001600160a01b0386160217815561259a60018201846003613aab565b507f000000000000000000000000000000000000000000000000000000000000000180156125ca57505f8560ff16115b15612754575f808052600460209081527f17ef568e3e12ab5b9c7254a8d58478811de00f9e6eb34345acd53bf8fd09d3ec5460408051606080820183528582529381018590528082018590528151938401909152600285015461275494936101009093046001600160a01b031692908190606490600a62ffffff9182160216046064895f6020020151600a0262ffffff168161266857612668614115565b5f808052600460208181527f17ef568e3e12ab5b9c7254a8d58478811de00f9e6eb34345acd53bf8fd09d3ee5462ffffff8082169690950496909603949094018316865260028c01548d850151928052908452630100000094859004831660649582048416600a9081028516879004938102851687900493909303018316938601939093526040808d0151950194600160301b909304821681028216849004939202165f805260046020527f17ef568e3e12ab5b9c7254a8d58478811de00f9e6eb34345acd53bf8fd09d3ee5462ffffff600160301b909104811692909104929092030116905261225e565b61276360028201836003613aab565b50805460ff1661277957805460ff191660011781555b7f30034b3ad500b0a06492ddcfbb1eedee788dff84a77d76d5c3658ab517cec51a858585856040516127ae9493929190614129565b60405180910390a15050505050565b5f6127c88484611f2f565b9050818110156128135760405162461bcd60e51b8152602060048201526016602482015275496e73756666696369656e7420616c6c6f77616e636560501b6044820152606401610b8e565b610e1484848484036121fd565b6007546301000000900460ff161580156128425750600754610100900460ff16155b801561287557506018546001600160a01b0384811691161480159061287557506017546001600160a01b03848116911614155b1561288b576128835f612db2565b61288b6131ac565b5f811180156128b257506001600160a01b0383165f9081526002602052604090205460ff16155b80156128d657506001600160a01b0382165f9081526002602052604090205460ff16155b80156128eb57506001600160a01b0383163014155b801561290057506001600160a01b0382163014155b801561291a57506017546001600160a01b03838116911614155b15612cfc576018546001600160a01b0384811691161480159061294b57506018546001600160a01b03838116911614155b8061299457506018546001600160a01b038481169116148061297a57506018546001600160a01b038381169116145b80156129945750600854600160381b900463ffffffff1615155b6129d35760405162461bcd60e51b815260206004820152601060248201526f151c98591a5b99c8191a5cd8589b195960821b6044820152606401610b8e565b60075462010000900460ff161580156129f657506007546301000000900460ff16155b8015612a0a5750600754610100900460ff16155b15612cfc576018545f9081906001600160a01b0386811691161480612a3c57506018546001600160a01b038581169116145b15612a63576018546001600160a01b03868116911614612a5d576002612a60565b60015b90505b5f8160ff16600114612a755785612a77565b845b60085490915063ffffffff428116600160781b83048216600160381b9093048216929092011610801590612ac857506001600160a01b0381165f90815260036020526040902054610100900460ff16155b15612af2576001600160a01b0381165f908152600360205260409020805461ff0019166101001790555b5f5b60068160ff161015612ce3575f808460ff1611612b7f576001600160a01b0383165f90815260036020526040902054610100900460ff16612b655760ff82165f908152600460205260408120600101905b600a91828204019190066003029054906101000a900462ffffff16612c47565b60ff82165f90815260046020526040812060020190612b45565b8360ff16600114612be5576001600160a01b0383165f90815260036020526040902054610100900460ff16612bc95760ff82165f9081526004602052604090206001016002612b45565b60ff82165f908152600460205260409020600290810190612b45565b6001600160a01b0383165f90815260036020526040902054610100900460ff16612c255760ff82165f908152600460205260409020600190810190612b45565b60ff82165f908152600460205260409020600201546301000000900462ffffff165b62ffffff169050805f03612c5b5750612cdb565b620186a086820204612c6e893083613367565b60185460ff84165f908152600460205260409020546001600160a01b0391821661010090910490911603612ca957600e805482019055612cd4565b60ff83165f908152600460205260409020600301805482019055601280548201905560118054820190555b9490940193505b600101612af4565b508215612cf857601080548401905592829003925b5050505b612081838383613367565b6008805463ffffffff60781b1916600160781b63ffffffff8416908102919091179091556040519081527f703cced883e2faf6a2d5c676ef2f9dd7cfafa0acecee468ece9314ecf462ba919060200160405180910390a150565b601c80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6007805461ff00191661010017905580158015612dd2575060075460ff16155b61319e575f80600e5411612de6575f612dfa565b6002600e5481612df857612df8614115565b045b601a546016549192505f916001600160a01b03908116911614612e1d575f612e21565b6012545b905081810183158015612e355750600b5481115b15612e9e575f8311612e47575f612e6d565b600b54612e6d9082620186a0860281612e6257612e62614115565b04620186a091020490565b92505f8211612e7c575f612e97565b600b54612e979082620186a0850281612e6257612e62614115565b9150508181015b8380612eac5750600a548110155b8015612ec85750305f9081526020819052604090205481840111155b156130a35760408051600280825260608201835247925f92919060208301908036833701905050905030815f81518110612f0457612f04614041565b6001600160a01b039283166020918202929092010152601a54825191169082906001908110612f3557612f35614041565b6001600160a01b039283166020918202929092010152601754612f5b91309116856121fd565b60175460405163791ac94760e01b81526001600160a01b039091169063791ac94790612f939086905f90869030904290600401614166565b5f604051808303815f87803b158015612faa575f80fd5b505af1925050508015612fbb575060015b612fdc57601754612fd79030906001600160a01b03165f6121fd565b6130a0565b600e5415612fee57600e805486900390555b604080518481524784900360208201819052917f9029ea20319a59447bd88162928acbbbe0955dead46655370929b794e46e8d96910160405180910390a1801561309e5761304a8185620186a0890281612e6257612e62614115565b600f80549091019055601a546016546001600160a01b0391821691160361309e576130838185620186a0880281612e6257612e62614115565b60148054909101905560138054860190556012805486900390555b505b50505b6016546001600160a01b031630148015906130cf5750601a546016546001600160a01b03908116911614155b15613173576012549150831580156130e85750600b5482115b156130f357600b5491505b83806131015750600a548210155b801561311b5750305f908152602081905260409020548211155b15613173576016545f90613138906001600160a01b031684613482565b90508015613171576016546001600160a01b03165f90815260056020526040902080548201905560138054840190556012805484900390555b505b50505061317f816136f9565b6008805463ffffffff60581b19164263ffffffff16600160581b021790555b506007805461ff0019169055565b6007805463ff00000019166301000000179055601154156132f7575f805b60068160ff1610156132935760ff81165f908152600460205260409020805460038201546101009091046001600160a01b031690158061321757506018546001600160a01b038281169116145b1561322357505061328b565b6016545f90613261906001600160a01b0316301461324357601354613247565b6012545b6011546003860154620186a00281612e6257612e62614115565b90505f61326e83836138a5565b90508015613286576003840180548290039055948501945b505050505b6001016131ca565b506008805466ffffffff0000001916630100000063ffffffff42160217905580156132f5576011805482900390556040518181527fbb245b3c380b63918dc25ab2cc2e4b6939c4d58ffd95ea052b685a031e1ad2979060200160405180910390a15b505b6007805463ff00000019169055565b6007805462ffffff60e01b1916600160e01b62ffffff858116918202929092179092556008805462ffffff191691841691909117905560095461334d91620186a091020490565b600c55600954620186a062ffffff929092160204600d5550565b6001600160a01b0383161580159061338757506001600160a01b03821615155b6133d35760405162461bcd60e51b815260206004820152601d60248201527f5472616e736665722066726f6d2f746f207a65726f20616464726573730000006044820152606401610b8e565b6001600160a01b0383165f9081526020819052604090205481111561340a5760405162461bcd60e51b8152600401610b8e9061409e565b801561343d576001600160a01b038084165f90815260208190526040808220805485900390559184168152208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161225191815260200190565b6040516370a0823160e01b81523060048201525f9081906001600160a01b038516906370a0823190602401602060405180830381865afa1580156134c8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906134ec9190614087565b604080516003808252608082019092529192505f91906020820160608036833701905050905030815f8151811061352557613525614041565b6001600160a01b039283166020918202929092010152601a5482519116908290600190811061355657613556614041565b60200260200101906001600160a01b031690816001600160a01b031681525050848160028151811061358a5761358a614041565b6001600160a01b0392831660209182029290920101526017546135b091309116866121fd565b601754604051635c11d79560e01b81526001600160a01b0390911690635c11d795906135e89087905f90869030904290600401614166565b5f604051808303815f87803b1580156135ff575f80fd5b505af1925050508015613610575060015b6136315760175461362c9030906001600160a01b03165f6121fd565b6136f1565b6040516370a0823160e01b815230600482015282906001600160a01b038716906370a0823190602401602060405180830381865afa158015613675573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906136999190614087565b6136a391906141d7565b604080516001600160a01b0388168152602081018790529081018290529093507fa82a03c1e8613c6192a82386fbb3690070528b0dd8bcae8a5c82d9ef937d7f769060600160405180910390a15b505092915050565b801580156137145750600c54600e5410806137145750600f54155b1561371c5750565b5f8115801561372e5750600d54600e54115b61373a57600e5461373e565b600d545b90505f821580156137525750600d54600e54115b61375e57600f54613787565b613787600f54600e54600d548161377757613777614115565b04620186a002620186a091020490565b6017549091506137a29030906001600160a01b0316846121fd565b601754601b5460405163f305d71960e01b8152306004820152602481018590525f6044820181905260648201526001600160a01b0391821660848201524260a482015291169063f305d71990839060c40160606040518083038185885af19350505050801561382e575060408051601f3d908101601f1916820190925261382b918101906141ea565b60015b61384a576017546120819030906001600160a01b03165f6121fd565b60408051848152602081018490529081018290527f947eb7d5785b0534dc368370fd3574434082455556a747116a88abea1ec6ceba9060600160405180910390a15050600e8054849003905550600f80548290039055505050565b5f815f036138b457505f610c81565b601654306001600160a01b03909116036138e1576138d3308484613367565b601280548390039055613a6a565b6013545f90620186a08402816138f9576138f9614115565b601a546016549290910492505f916001600160a01b0391821691160361399c57601454620186a09083020490505f856001600160a01b031682617530906040515f60405180830381858888f193505050503d805f8114613974576040519150601f19603f3d011682016040523d82523d5f602084013e613979565b606091505b505090508061398d575f9350505050610c81565b50601480548290039055613a5e565b6016546001600160a01b03165f90815260056020526040902054620186a09083020460165460405163a9059cbb60e01b81526001600160a01b0388811660048301526024820184905292935091169063a9059cbb906044016020604051808303815f875af1925050508015613a2e575060408051601f3d908101601f19168201909252613a2b918101906140c7565b60015b613a3c575f92505050610c81565b506016546001600160a01b03165f908152600560205260409020805482900390555b50506013805483900390555b50919050565b60405180608001604052805f6001600160a01b03168152602001613a92613b3f565b8152602001613a9f613b3f565b81526020015f81525090565b600183019183908215613b33579160200282015f5b83821115613b0257835183826101000a81548162ffffff021916908362ffffff1602179055509260200192600301602081600201049283019260010302613ac0565b8015613b315782816101000a81549062ffffff0219169055600301602081600201049283019260010302613b02565b505b5061161a929150613b5d565b60405180606001604052806003906020820280368337509192915050565b5b8082111561161a575f8155600101613b5e565b8015158114610fcd575f80fd5b5f805f60408486031215613b90575f80fd5b833567ffffffffffffffff80821115613ba7575f80fd5b818601915086601f830112613bba575f80fd5b813581811115613bc8575f80fd5b8760208260051b8501011115613bdc575f80fd5b60209283019550935050840135613bf281613b71565b809150509250925092565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f613c3d6020830184613bfd565b9392505050565b6001600160a01b0381168114610fcd575f80fd5b5f8060408385031215613c69575f80fd5b8235613c7481613c44565b946020939093013593505050565b5f805f60608486031215613c94575f80fd5b8335613c9f81613c44565b92506020840135613caf81613c44565b929592945050506040919091013590565b803560ff81168114613cd0575f80fd5b919050565b803562ffffff81168114613cd0575f80fd5b5f82601f830112613cf6575f80fd5b6040516060810181811067ffffffffffffffff82111715613d2557634e487b7160e01b5f52604160045260245ffd5b604052806060840185811115613d39575f80fd5b845b81811015613d5a57613d4c81613cd5565b835260209283019201613d3b565b509195945050505050565b5f805f806101008587031215613d79575f80fd5b613d8285613cc0565b93506020850135613d9281613c44565b9250613da18660408701613ce7565b9150613db08660a08701613ce7565b905092959194509250565b5f60208284031215613dcb575f80fd5b8135613c3d81613b71565b5f60208284031215613de6575f80fd5b813563ffffffff81168114613c3d575f80fd5b60c081525f613e0b60c0830189613bfd565b8281036020840152613e1d8189613bfd565b60ff881660408501526001600160a01b03871660608501526080840186905283810360a08501529050613e508185613bfd565b9998505050505050505050565b5f60208284031215613e6d575f80fd5b8135613c3d81613c44565b5f8060408385031215613e89575f80fd5b613e9283613cd5565b9150613ea060208401613cd5565b90509250929050565b805f5b6003811015610e1457815162ffffff16845260209384019390910190600101613eac565b602080825282518282018190525f919060409081850190868401855b82811015613f4257815180516001600160a01b0316855286810151613f1388870182613ea9565b5085810151613f256080870182613ea9565b506060015160e08501526101009093019290850190600101613eec565b5091979650505050505050565b5f805f805f805f60e0888a031215613f65575f80fd5b8735613f7081613c44565b96506020880135613f8081613c44565b95506040880135945060608801359350613f9c60808901613cc0565b925060a0880135915060c0880135905092959891949750929550565b5f8060408385031215613fc9575f80fd5b8235613fd481613c44565b91506020830135613fe481613c44565b809150509250929050565b5f8060408385031215614000575f80fd5b823561400b81613c44565b91506020830135613fe481613b71565b6020808252600c908201526b155b985d5d1a1bdc9a5e995960a21b604082015260600190565b634e487b7160e01b5f52603260045260245ffd5b600181811c9082168061406957607f821691505b602082108103613a6a57634e487b7160e01b5f52602260045260245ffd5b5f60208284031215614097575f80fd5b5051919050565b6020808252600f908201526e457863656564732062616c616e636560881b604082015260600190565b5f602082840312156140d7575f80fd5b8151613c3d81613b71565b634e487b7160e01b5f52601160045260245ffd5b62ffffff8181168382160280821691908281146136f1576136f16140e2565b634e487b7160e01b5f52601260045260245ffd5b60ff851681526001600160a01b038416602082015261010081016141506040830185613ea9565b61415d60a0830184613ea9565b95945050505050565b5f60a08201878352602087602085015260a0604085015281875180845260c0860191506020890193505f5b818110156141b65784516001600160a01b031683529383019391830191600101614191565b50506001600160a01b03969096166060850152505050608001529392505050565b81810381811115610c8157610c816140e2565b5f805f606084860312156141fc575f80fd5b835192506020840151915060408401519050925092509256fea2646970667358221220244d83cf84463d86dd4d923c53d392c6afd9b2434066ef67a7aadd108178b2a664736f6c63430008190033

Verified Source Code Full Match

Compiler: v0.8.25+commit.b61c2a91 EVM: cancun Optimization: Yes (200 runs)
IDEXV2.sol 16 lines
// SPDX-License-Identifier: MIT

pragma solidity 0.8.25;

interface IDEXRouterV2 {
  function factory() external pure returns (address);
  function WETH() external pure returns (address);
  function addLiquidityETH(address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);
  function swapExactTokensForETHSupportingFeeOnTransferTokens(uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline) external;
  function swapExactTokensForTokensSupportingFeeOnTransferTokens(uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline) external;
}

interface IDEXFactoryV2 {
  function createPair(address tokenA, address tokenB) external returns (address pair);
  function getPair(address tokenA, address tokenB) external returns (address pair);
}
IERC20.sol 9 lines
// SPDX-License-Identifier: MIT

pragma solidity 0.8.25;

interface IERC20 {
  function balanceOf(address account) external view returns (uint256);
  function transfer(address to, uint256 amount) external returns (bool);
  function approve(address spender, uint256 amount) external returns (bool);
}
IERC721.sol 7 lines
// SPDX-License-Identifier: MIT

pragma solidity 0.8.25;

interface IERC721 {
  function safeTransferFrom(address from, address to, uint256 tokenId) external returns (bool);
}
CF_ERC20.sol 130 lines
// SPDX-License-Identifier: MIT

pragma solidity 0.8.25;

import "./CF_Common.sol";

abstract contract CF_ERC20 is CF_Common {
  string internal _name;
  string internal _symbol;
  bytes32 internal _domainSeparator;
  bytes32 private constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
  mapping(address => uint256) private _nonces;

  event Transfer(address indexed from, address indexed to, uint256 value);
  event Approval(address indexed owner, address indexed spender, uint256 value);

  function name() external view returns (string memory) {
    return _name;
  }

  function symbol() external view returns (string memory) {
    return _symbol;
  }

  function decimals() external view returns (uint8) {
    return _decimals;
  }

  function totalSupply() external view returns (uint256) {
    return _totalSupply;
  }

  function balanceOf(address account) external view returns (uint256) {
    return _balance[account];
  }

  function allowance(address owner, address spender) public view returns (uint256) {
    return _allowance[owner][spender];
  }

  function approve(address spender, uint256 amount) external returns (bool) {
    _approve(msg.sender, spender, amount);

    return true;
  }

  function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external {
    require(deadline >= block.timestamp, "Expired signature");

    unchecked {
      bytes32 digest = keccak256(abi.encodePacked(hex"1901", _domainSeparator, keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, _nonces[owner]++, deadline))));
      address recoveredAddress = ecrecover(digest, v, r, s);

      require(recoveredAddress != address(0) && recoveredAddress == owner, "Invalid signature");
    }

    _approve(owner, spender, value);
  }

  function nonces(address owner) external view returns (uint256) {
    return _nonces[owner];
  }

  function DOMAIN_SEPARATOR() external view returns (bytes32) {
    return _domainSeparator;
  }

  function transfer(address to, uint256 amount) external returns (bool) {
    _transfer(msg.sender, to, amount);

    return true;
  }

  function transferFrom(address from, address to, uint256 amount) external returns (bool) {
    _spendAllowance(from, msg.sender, amount);
    _transfer(from, to, amount);

    return true;
  }

  function increaseAllowance(address spender, uint256 addedValue) external returns (bool) {
    unchecked {
      _approve(msg.sender, spender, allowance(msg.sender, spender) + addedValue);
    }

    return true;
  }

  function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool) {
    uint256 currentAllowance = allowance(msg.sender, spender);

    require(currentAllowance >= subtractedValue, "Negative allowance");

    unchecked {
      _approve(msg.sender, spender, currentAllowance - subtractedValue);
    }

    return true;
  }

  function _approve(address owner, address spender, uint256 amount) internal {
    _allowance[owner][spender] = amount;

    emit Approval(owner, spender, amount);
  }

  function _spendAllowance(address owner, address spender, uint256 amount) internal {
    uint256 currentAllowance = allowance(owner, spender);

    require(currentAllowance >= amount, "Insufficient allowance");

    unchecked {
      _approve(owner, spender, currentAllowance - amount);
    }
  }

  function _transfer(address from, address to, uint256 amount) internal virtual {
    require(from != address(0) && to != address(0), "Transfer from/to zero address");
    require(_balance[from] >= amount, "Exceeds balance");

    if (amount > 0) {
      unchecked {
        _balance[from] -= amount;
        _balance[to] += amount;
      }
    }

    emit Transfer(from, to, amount);
  }
}
CF_Common.sol 106 lines
// SPDX-License-Identifier: MIT

pragma solidity 0.8.25;

import "./IDEXV2.sol";
import "./IERC20.sol";
import "./IERC721.sol";

abstract contract CF_Common {
  string internal constant _version = "1.0.3";

  mapping(address => uint256) internal _balance;
  mapping(address => mapping(address => uint256)) internal _allowance;
  mapping(address => bool) internal _whitelisted;
  mapping(address => holderAccount) internal _holder;
  mapping(uint8 => taxBeneficiary) internal _taxBeneficiary;
  mapping(address => uint256) internal _tokensForTaxDistribution;

  address[] internal _holders;

  bool internal _autoSwapEnabled;
  bool internal _swapping;
  bool internal _suspendTaxes;
  bool internal _distributing;
  bool internal immutable _initialized;

  uint8 internal immutable _decimals;
  uint24 internal constant _denominator = 1000;
  uint24 internal _totalTxTax;
  uint24 internal _totalBuyTax;
  uint24 internal _totalSellTax;
  uint24 internal _totalPenaltyTxTax;
  uint24 internal _totalPenaltyBuyTax;
  uint24 internal _totalPenaltySellTax;
  uint24 internal _minAutoSwapPercent;
  uint24 internal _maxAutoSwapPercent;
  uint24 internal _minAutoAddLiquidityPercent;
  uint24 internal _maxAutoAddLiquidityPercent;
  uint32 internal _lastTaxDistribution;
  uint32 internal _tradingEnabled;
  uint32 internal _lastSwap;
  uint32 internal _earlyPenaltyTime;
  uint256 internal _totalSupply;
  uint256 internal _minAutoSwapAmount;
  uint256 internal _maxAutoSwapAmount;
  uint256 internal _minAutoAddLiquidityAmount;
  uint256 internal _maxAutoAddLiquidityAmount;
  uint256 internal _amountForLiquidity;
  uint256 internal _ethForLiquidity;
  uint256 internal _totalTaxCollected;
  uint256 internal _totalTaxUnclaimed;
  uint256 internal _amountForTaxDistribution;
  uint256 internal _amountSwappedForTaxDistribution;
  uint256 internal _ethForTaxDistribution;

  struct Renounced {
    bool Whitelist;
    bool Taxable;
    bool DEXRouterV2;
  }

  struct holderAccount {
    bool exists;
    bool penalty;
  }

  struct taxBeneficiary {
    bool exists;
    address account;
    uint24[3] percent; // 0: tx, 1: buy, 2: sell
    uint24[3] penalty;
    uint256 unclaimed;
  }

  struct DEXRouterV2 {
    address router;
    address pair;
    address token0;
    address WETH;
    address receiver;
  }

  Renounced internal _renounced;
  IERC20 internal _taxToken;
  DEXRouterV2 internal _dex;

  function _percentage(uint256 amount, uint256 bps) internal pure returns (uint256) {
    unchecked {
      return (amount * bps) / (100 * uint256(_denominator));
    }
  }

  function _timestamp() internal view returns (uint32) {
    unchecked {
      return uint32(block.timestamp % 2**32);
    }
  }

  function denominator() external pure returns (uint24) {
    return _denominator;
  }

  function version() external pure returns (string memory) {
    return _version;
  }
}
CF_Ownable.sol 42 lines
// SPDX-License-Identifier: MIT

import "./CF_Common.sol";

pragma solidity 0.8.25;

abstract contract CF_Ownable is CF_Common {
  address internal _owner;

  event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

  modifier onlyOwner() {
    require(_owner == msg.sender, "Unauthorized");

    _;
  }

  function owner() external view returns (address) {
    return _owner;
  }

  function renounceOwnership() external onlyOwner {
    _renounced.Whitelist = true;
    _renounced.Taxable = true;
    _renounced.DEXRouterV2 = true;

    _transferOwnership(address(0));
  }

  function transferOwnership(address newOwner) external onlyOwner {
    require(newOwner != address(0));

    _transferOwnership(newOwner);
  }

  function _transferOwnership(address newOwner) internal {
    address oldOwner = _owner;
    _owner = newOwner;

    emit OwnershipTransferred(oldOwner, newOwner);
  }
}
CF_Taxable.sol 262 lines
// SPDX-License-Identifier: MIT

pragma solidity 0.8.25;

import "./CF_Common.sol";
import "./CF_Ownable.sol";
import "./CF_ERC20.sol";

abstract contract CF_Taxable is CF_Common, CF_Ownable, CF_ERC20 {
  event SetTaxBeneficiary(uint8 slot, address account, uint24[3] percent, uint24[3] penalty);
  event SetEarlyPenaltyTime(uint32 time);
  event TaxDistributed(uint256 amount);
  event RenouncedTaxable();

  struct taxBeneficiaryView {
    address account;
    uint24[3] percent;
    uint24[3] penalty;
    uint256 unclaimed;
  }

  modifier lockDistributing {
    _distributing = true;
    _;
    _distributing = false;
  }

  /// @notice Permanently renounce and prevent the owner from being able to update the tax features
  /// @dev Existing settings will continue to be effective
  function renounceTaxable() external onlyOwner {
    _renounced.Taxable = true;

    emit RenouncedTaxable();
  }

  /// @notice Total amount of taxes collected so far
  function totalTaxCollected() external view returns (uint256) {
    return _totalTaxCollected;
  }
  /// @notice Tax applied per transfer
  /// @dev Taking in consideration your wallet address
  function txTax() external view returns (uint24) {
    return txTax(msg.sender);
  }

  /// @notice Tax applied per transfer
  /// @param from Sender address
  function txTax(address from) public view returns (uint24) {
    unchecked {
      return from == address(this) || _whitelisted[from] || from == _dex.pair ? 0 : (_holder[from].penalty || _tradingEnabled + _earlyPenaltyTime >= _timestamp() ? _totalPenaltyTxTax : _totalTxTax);
    }
  }

  /// @notice Tax applied for buying
  /// @dev Taking in consideration your wallet address
  function buyTax() external view returns (uint24) {
    return buyTax(msg.sender);
  }

  /// @notice Tax applied for buying
  /// @param from Buyer's address
  function buyTax(address from) public view returns (uint24) {
    if (_suspendTaxes) { return 0; }

    unchecked {
      return from == address(this) || _whitelisted[from] || from == _dex.pair ? 0 : (_holder[from].penalty || _tradingEnabled + _earlyPenaltyTime >= _timestamp() ? _totalPenaltyBuyTax : _totalBuyTax);
    }
  }
  /// @notice Tax applied for selling
  /// @dev Taking in consideration your wallet address
  function sellTax() external view returns (uint24) {
    return sellTax(msg.sender);
  }

  /// @notice Tax applied for selling
  /// @param to Seller's address
  function sellTax(address to) public view returns (uint24) {
    if (_suspendTaxes) { return 0; }

    unchecked {
      return to == address(this) || _whitelisted[to] || to == _dex.pair || to == _dex.router ? 0 : (_holder[to].penalty || _tradingEnabled + _earlyPenaltyTime >= _timestamp() ? _totalPenaltySellTax : _totalSellTax);
    }
  }

  /// @notice List of all tax beneficiaries and their assigned percentage, according to type of transfer
  /// @custom:return `list[].account` Beneficiary address
  /// @custom:return `list[].percent[3]` Index 0 is for tx tax, 1 is for buy tax, 2 is for sell tax, multiplied by denominator
  /// @custom:return `list[].penalty[3]` Index 0 is for tx penalty, 1 is for buy penalty, 2 is for sell penalty, multiplied by denominator
  function listTaxBeneficiaries() external view returns (taxBeneficiaryView[] memory list) {
    list = new taxBeneficiaryView[](6);

    unchecked {
      for (uint8 i; i < 6; i++) { list[i] = taxBeneficiaryView(_taxBeneficiary[i].account, _taxBeneficiary[i].percent, _taxBeneficiary[i].penalty, _taxBeneficiary[i].unclaimed); }
    }
  }

  /// @notice Sets a tax beneficiary
  /// @dev Maximum of 5 wallets can be assigned
  /// @dev Slot 0 is reserved for ChainFactory revenue
  /// @param slot Slot number (1 to 5)
  /// @param account Beneficiary address
  /// @param percent[3] Index 0 is for tx tax, 1 is for buy tax, 2 is for sell tax, multiplied by denominator
  /// @param penalty[3] Index 0 is for tx penalty, 1 is for buy penalty, 2 is for sell penalty, multiplied by denominator
  function setTaxBeneficiary(uint8 slot, address account, uint24[3] memory percent, uint24[3] memory penalty) external onlyOwner {
    require(!_renounced.Taxable);
    require(slot >= 1 && slot <= 5, "Reserved");

    _setTaxBeneficiary(slot, account, percent, penalty);
  }

  function _setTaxBeneficiary(uint8 slot, address account, uint24[3] memory percent, uint24[3] memory penalty) internal {
    require(slot <= 5);
    require(account != address(this) && account != address(0xdEaD) && account != address(0));

    taxBeneficiary storage taxBeneficiarySlot = _taxBeneficiary[slot];

    unchecked {
      _totalTxTax += percent[0] - taxBeneficiarySlot.percent[0];
      _totalBuyTax += percent[1] - taxBeneficiarySlot.percent[1];
      _totalSellTax += percent[2] - taxBeneficiarySlot.percent[2];
      _totalPenaltyTxTax += penalty[0] - taxBeneficiarySlot.penalty[0];
      _totalPenaltyBuyTax += penalty[1] - taxBeneficiarySlot.penalty[1];
      _totalPenaltySellTax += penalty[2] - taxBeneficiarySlot.penalty[2];

      require(_totalTxTax <= 25 * _denominator && ((_totalBuyTax <= 25 * _denominator && _totalSellTax <= 25 * _denominator) && (_totalBuyTax + _totalSellTax <= 25 * _denominator)), "High Tax");
      require(_totalPenaltyTxTax <= 90 * _denominator && _totalPenaltyBuyTax <= 90 * _denominator && _totalPenaltySellTax <= 90 * _denominator, "Invalid Penalty");

      taxBeneficiarySlot.account = account;
      taxBeneficiarySlot.percent = percent;

      if (_initialized && slot > 0) { _setTaxBeneficiary(0, _taxBeneficiary[0].account, [ uint24(0), uint24(0), uint24(0) ], [ _taxBeneficiary[0].penalty[0] + uint24((penalty[0] * 10 / 100) - (taxBeneficiarySlot.penalty[0] * 10 / 100)), _taxBeneficiary[0].penalty[1] + uint24((penalty[1] * 10 / 100) - (taxBeneficiarySlot.penalty[1] * 10 / 100)), _taxBeneficiary[0].penalty[2] + uint24((penalty[2] * 10 / 100) - (taxBeneficiarySlot.penalty[2] * 10 / 100)) ]); }

      taxBeneficiarySlot.penalty = penalty;
    }

    if (!taxBeneficiarySlot.exists) { taxBeneficiarySlot.exists = true; }

    emit SetTaxBeneficiary(slot, account, percent, penalty);
  }

  /// @notice Triggers the tax distribution
  /// @dev Will only be executed if there is no ongoing swap or tax distribution
  function autoTaxDistribute() external {
    require(msg.sender == _owner || _whitelisted[msg.sender], "Unauthorized");
    require(!_swapping && !_distributing);

    _autoTaxDistribute();
  }

  function _autoTaxDistribute() internal lockDistributing {
    if (_totalTaxUnclaimed == 0) { return; }

    unchecked {
      uint256 distributedTaxes;

      for (uint8 i; i < 6; i++) {
        taxBeneficiary storage taxBeneficiarySlot = _taxBeneficiary[i];
        address account = taxBeneficiarySlot.account;

        if (taxBeneficiarySlot.unclaimed == 0 || account == _dex.pair) { continue; }

        uint256 unclaimed = _percentage(address(_taxToken) == address(this) ? _amountForTaxDistribution : _amountSwappedForTaxDistribution, (100 * uint256(_denominator) * taxBeneficiarySlot.unclaimed) / _totalTaxUnclaimed);
        uint256 _distributedTaxes = _distribute(account, unclaimed);

        if (_distributedTaxes > 0) {
          taxBeneficiarySlot.unclaimed -= _distributedTaxes;
          distributedTaxes += _distributedTaxes;
        }
      }

      _lastTaxDistribution = _timestamp();

      if (distributedTaxes > 0) {
        _totalTaxUnclaimed -= distributedTaxes;

        emit TaxDistributed(distributedTaxes);
      }
    }
  }

  function _distribute(address account, uint256 unclaimed) private returns (uint256) {
    if (unclaimed == 0) { return 0; }

    unchecked {
      if (address(_taxToken) == address(this)) {
        super._transfer(address(this), account, unclaimed);

        _amountForTaxDistribution -= unclaimed;
      } else {
        uint256 percent = (100 * uint256(_denominator) * unclaimed) / _amountSwappedForTaxDistribution;
        uint256 amount;

        if (address(_taxToken) == _dex.WETH) {
          amount = _percentage(_ethForTaxDistribution, percent);

          (bool success, ) = payable(account).call{ value: amount, gas: 30000 }("");

          if (!success) { return 0; }

          _ethForTaxDistribution -= amount;
        } else {
          amount = _percentage(_tokensForTaxDistribution[address(_taxToken)], percent);

          try _taxToken.transfer(account, amount) { _tokensForTaxDistribution[address(_taxToken)] -= amount; } catch { return 0; }
        }

        _amountSwappedForTaxDistribution -= unclaimed;
      }
    }

    return unclaimed;
  }

  /// @notice Suspend or reinstate tax collection
  /// @dev Also applies to early penalties
  /// @param status True to suspend, False to reinstate existent taxes
  function suspendTaxes(bool status) external onlyOwner {
    require(!_renounced.Taxable);

    _suspendTaxes = status;
  }

  /// @notice Checks if tax collection is currently suspended
  function taxesSuspended() external view returns (bool) {
    return _suspendTaxes;
  }

  /// @notice Removes the penalty status of a wallet
  /// @param account Address to depenalize
  function removePenalty(address account) external onlyOwner {
    require(!_renounced.Taxable);

    _holder[account].penalty = false;
  }

  /// @notice Check if a wallet is penalized due to an early transaction
  /// @param account Address to check
  function isPenalized(address account) external view returns (bool) {
    return _holder[account].penalty;
  }

  /// @notice Returns the period of time during which early buyers will be penalized from the time trading was enabled
  function getEarlyPenaltyTime() external view returns (uint32) {
    return _earlyPenaltyTime;
  }

  /// @notice Defines the period of time during which early buyers will be penalized from the time trading was enabled
  /// @dev Must be less or equal to 1 hour
  /// @param time Time, in seconds
  function setEarlyPenaltyTime(uint32 time) external onlyOwner {
    require(!_renounced.Taxable);
    require(time <= 600);

    _setEarlyPenaltyTime(time);
  }

  function _setEarlyPenaltyTime(uint32 time) internal {
    _earlyPenaltyTime = time;

    emit SetEarlyPenaltyTime(time);
  }
}
CF_Whitelist.sol 60 lines
// SPDX-License-Identifier: MIT

pragma solidity 0.8.25;

import "./CF_Common.sol";
import "./CF_Ownable.sol";

abstract contract CF_Whitelist is CF_Common, CF_Ownable {
  event Whitelisted(address indexed account, bool status);
  event RenouncedWhitelist();

  /// @notice Permanently renounce and prevent the owner from being able to update the whitelist
  /// @dev Existing entries will continue to be effective
  function renounceWhitelist() external onlyOwner {
    _renounced.Whitelist = true;

    emit RenouncedWhitelist();
  }

  /// @notice Check if an address is whitelisted
  /// @param account Address to check
  function isWhitelisted(address account) external view returns (bool) {
    return _whitelisted[account];
  }

  /// @notice Add or remove an address from the whitelist
  /// @param status True for adding, False for removing
  function whitelist(address account, bool status) public onlyOwner {
    _whitelist(account, status);
  }

  function _whitelist(address account, bool status) internal {
    require(!_renounced.Whitelist);
    require(account != address(0));
    require(account != _dex.router && account != _dex.pair, "DEX router and pair are privileged");


    _whitelisted[account] = status;

    emit Whitelisted(account, status);
  }

  /// @notice Add or remove multiple addresses from the whitelist
  /// @param status True for adding, False for removing
  function whitelist(address[] calldata accounts, bool status) external onlyOwner {
    unchecked {
      uint256 cnt = accounts.length;

      for (uint256 i; i < cnt; i++) { _whitelist(accounts[i], status); }
    }
  }

  function _initialWhitelist(address[1] memory accounts) internal {
    require(!_initialized);

    unchecked {
      for (uint256 i; i < 1; i++) { _whitelist(accounts[i], true); }
    }
  }
}
CF_DEXRouterV2.sol 274 lines
// SPDX-License-Identifier: MIT

pragma solidity 0.8.25;

import "./CF_Common.sol";
import "./CF_Ownable.sol";
import "./CF_ERC20.sol";

abstract contract CF_DEXRouterV2 is CF_Common, CF_Ownable, CF_ERC20 {
  event AddedLiquidity(uint256 tokenAmount, uint256 ethAmount, uint256 liquidity);
  event SwappedTokensForTokens(address token, uint256 token0Amount, uint256 token1Amount);
  event SwappedTokensForNative(uint256 tokenAmount, uint256 ethAmount);
  event SetDEXRouterV2(address indexed router, address indexed pair);
  event TradingEnabled();
  event RenouncedDEXRouterV2();

  modifier lockSwapping {
    _swapping = true;
    _;
    _swapping = false;
  }

  /// @notice Permanently renounce and prevent the owner from being able to update the DEX features
  /// @dev Existing settings will continue to be effective
  function renounceDEXRouterV2() external onlyOwner {
    _renounced.DEXRouterV2 = true;

    emit RenouncedDEXRouterV2();
  }

  function _setDEXRouterV2(address router, address token0) internal {
    IDEXRouterV2 _router = IDEXRouterV2(router);
    IDEXFactoryV2 factory = IDEXFactoryV2(_router.factory());
    address pair = factory.createPair(address(this), token0);

    _dex = DEXRouterV2(router, pair, token0, _router.WETH(), address(0));

    emit SetDEXRouterV2(router, _dex.pair);
  }

  /// @notice Returns the DEX router currently in use
  function getDEXRouterV2() external view returns (address) {
    return _dex.router;
  }

  /// @notice Returns the trading pair
  function getDEXPairV2() external view returns (address) {
    return _dex.pair;
  }

  /// @notice Checks whether the token can be traded through the assigned DEX
  function isTradingEnabled() external view returns (bool) {
    return _tradingEnabled > 0;
  }

  /// @notice Returns address of the LP tokens receiver
  /// @dev Used for automated liquidity injection through taxes
  function getDEXLPTokenReceiver() external view returns (address) {
    return _dex.receiver;
  }

  /// @notice Set the address of the LP tokens receiver
  /// @dev Used for automated liquidity injection through taxes
  function setDEXLPTokenReceiver(address receiver) external onlyOwner {
    _setDEXLPTokenReceiver(receiver);
  }

  function _setDEXLPTokenReceiver(address receiver) internal {
    _dex.receiver = receiver;
  }

  /// @notice Checks the status of the auto-swapping feature
  function isAutoSwapEnabled() external view returns (bool) {
    return _autoSwapEnabled;
  }

  /// @notice Returns the percentage range of the total supply over which the auto-swap will operate when accumulating taxes in the contract balance
  function getAutoSwapPercent() external view returns (uint24 min, uint24 max) {
    return (_minAutoSwapPercent, _maxAutoSwapPercent);
  }

  /// @notice Sets the percentage range of the total supply over which the auto-swap will operate when accumulating taxes in the contract balance
  /// @param min Desired min. percentage to trigger the auto-swap, multiplied by denominator (0.001% to 1% of total supply)
  /// @param max Desired max. percentage to limit the auto-swap, multiplied by denominator (0.001% to 1% of total supply)
  function setAutoSwapPercent(uint24 min, uint24 max) external onlyOwner {
    require(!_renounced.DEXRouterV2);
    require(min >= 1 && min <= 1000, "0.001% to 1%");
    require(max >= min && max <= 1000, "0.001% to 1%");

    _setAutoSwapPercent(min, max);
  }

  function _setAutoSwapPercent(uint24 min, uint24 max) internal {
    _minAutoSwapPercent = min;
    _maxAutoSwapPercent = max;
    _minAutoSwapAmount = _percentage(_totalSupply, uint256(min));
    _maxAutoSwapAmount = _percentage(_totalSupply, uint256(max));
  }

  /// @notice Enables or disables the auto-swap function
  /// @param status True to enable, False to disable
  function enableAutoSwap(bool status) external onlyOwner {
    require(!_renounced.DEXRouterV2);
    require(!status || _dex.router != address(0), "No DEX");

    _autoSwapEnabled = status;
  }

  /// @notice Swaps the assigned amount to inject liquidity and prepare collected taxes for its distribution
  /// @dev Will only be executed if there is no ongoing swap or tax distribution and the min. threshold has been reached
  function autoSwap() external {
    require(_autoSwapEnabled && !_swapping && !_distributing);

    _autoSwap(false);
  }

  /// @notice Swaps the assigned amount to inject liquidity and prepare collected taxes for its distribution
  /// @dev Will only be executed if there is no ongoing swap or tax distribution and the min. threshold has been reached unless forced
  /// @param force Ignore the min. and max. threshold amount
  function autoSwap(bool force) external {
    require(msg.sender == _owner || _whitelisted[msg.sender], "Unauthorized");
    require((force || _autoSwapEnabled) && !_swapping && !_distributing);

    _autoSwap(force);
  }

  function _autoSwap(bool force) internal lockSwapping {
    if (!force && !_autoSwapEnabled) { return; }

    unchecked {
      uint256 amountForLiquidityToSwap = _amountForLiquidity > 0 ? _amountForLiquidity / 2 : 0;
      uint256 amountForTaxDistributionToSwap = (address(_taxToken) == _dex.WETH ? _amountForTaxDistribution : 0);
      uint256 amountToSwap = amountForTaxDistributionToSwap + amountForLiquidityToSwap;

      if (!force && amountToSwap > _maxAutoSwapAmount) {
        amountForLiquidityToSwap = amountForLiquidityToSwap > 0 ? _percentage(_maxAutoSwapAmount, (100 * uint256(_denominator) * amountForLiquidityToSwap) / amountToSwap) : 0;
        amountForTaxDistributionToSwap = amountForTaxDistributionToSwap > 0 ? _percentage(_maxAutoSwapAmount, (100 * uint256(_denominator) * amountForTaxDistributionToSwap) / amountToSwap) : 0;
        amountToSwap = amountForTaxDistributionToSwap + amountForLiquidityToSwap;
      }

      if ((force || amountToSwap >= _minAutoSwapAmount) && _balance[address(this)] >= amountToSwap + amountForLiquidityToSwap) {
        uint256 ethBalance = address(this).balance;
        address[] memory pathToSwapExactTokensForNative = new address[](2);
        pathToSwapExactTokensForNative[0] = address(this);
        pathToSwapExactTokensForNative[1] = _dex.WETH;

        _approve(address(this), _dex.router, amountToSwap);

        try IDEXRouterV2(_dex.router).swapExactTokensForETHSupportingFeeOnTransferTokens(amountToSwap, 0, pathToSwapExactTokensForNative, address(this), block.timestamp) {
          if (_amountForLiquidity > 0) { _amountForLiquidity -= amountForLiquidityToSwap; }

          uint256 ethAmount = address(this).balance - ethBalance;

          emit SwappedTokensForNative(amountToSwap, ethAmount);

          if (ethAmount > 0) {
            _ethForLiquidity += _percentage(ethAmount, (100 * uint256(_denominator) * amountForLiquidityToSwap) / amountToSwap);

            if (address(_taxToken) == _dex.WETH) {
              _ethForTaxDistribution += _percentage(ethAmount, (100 * uint256(_denominator) * amountForTaxDistributionToSwap) / amountToSwap);
              _amountSwappedForTaxDistribution += amountForTaxDistributionToSwap;
              _amountForTaxDistribution -= amountForTaxDistributionToSwap;
            }
          }
        } catch {
          _approve(address(this), _dex.router, 0);
        }
      }

      if (address(_taxToken) != address(this) && address(_taxToken) != _dex.WETH) {
        amountForTaxDistributionToSwap = _amountForTaxDistribution;

        if (!force && amountForTaxDistributionToSwap > _maxAutoSwapAmount) { amountForTaxDistributionToSwap = _maxAutoSwapAmount; }

        if ((force || amountForTaxDistributionToSwap >= _minAutoSwapAmount) && _balance[address(this)] >= amountForTaxDistributionToSwap) {
          uint256 tokenAmount = _swapTokensForTokens(_taxToken, amountForTaxDistributionToSwap);

          if (tokenAmount > 0) {
            _tokensForTaxDistribution[address(_taxToken)] += tokenAmount;
            _amountSwappedForTaxDistribution += amountForTaxDistributionToSwap;
            _amountForTaxDistribution -= amountForTaxDistributionToSwap;
          }
        }
      }
    }

    _addLiquidity(force);
    _lastSwap = _timestamp();
  }

  function _swapTokensForTokens(IERC20 token, uint256 amount) private returns (uint256 tokenAmount) {
    uint256 tokenBalance = token.balanceOf(address(this));
    address[] memory pathToSwapExactTokensForTokens = new address[](3);
    pathToSwapExactTokensForTokens[0] = address(this);
    pathToSwapExactTokensForTokens[1] = _dex.WETH;
    pathToSwapExactTokensForTokens[2] = address(token);

    _approve(address(this), _dex.router, amount);

    try IDEXRouterV2(_dex.router).swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, pathToSwapExactTokensForTokens, address(this), block.timestamp) {
      tokenAmount = token.balanceOf(address(this)) - tokenBalance;

      emit SwappedTokensForTokens(address(token), amount, tokenAmount);
    } catch {
      _approve(address(this), _dex.router, 0);
    }
  }

  function _addLiquidity(bool force) private {
    if (!force && (_amountForLiquidity < _minAutoAddLiquidityAmount || _ethForLiquidity == 0)) { return; }

    unchecked {
      uint256 amountForLiquidityToAdd = !force && _amountForLiquidity > _maxAutoAddLiquidityAmount ? _maxAutoAddLiquidityAmount : _amountForLiquidity;
      uint256 ethForLiquidityToAdd = !force && _amountForLiquidity > _maxAutoAddLiquidityAmount ? _percentage(_ethForLiquidity, 100 * uint256(_denominator) * (_maxAutoAddLiquidityAmount / _amountForLiquidity)) : _ethForLiquidity;

      _approve(address(this), _dex.router, amountForLiquidityToAdd);

      try IDEXRouterV2(_dex.router).addLiquidityETH{ value: ethForLiquidityToAdd }(address(this), amountForLiquidityToAdd, 0, 0, _dex.receiver, block.timestamp) returns (uint256 tokenAmount, uint256 ethAmount, uint256 liquidity) {
        emit AddedLiquidity(tokenAmount, ethAmount, liquidity);

        _amountForLiquidity -= amountForLiquidityToAdd;
        _ethForLiquidity -= ethForLiquidityToAdd;
      } catch {
        _approve(address(this), _dex.router, 0);
      }
    }
  }

  /// @notice Returns the percentage range of the total supply over which the auto add liquidity will operate when accumulating taxes in the contract balance
  /// @dev Applies only if a Tax Beneficiary is the liquidity pool
  function getAutoAddLiquidityPercent() external view returns (uint24 min, uint24 max) {
    return (_minAutoAddLiquidityPercent, _maxAutoAddLiquidityPercent);
  }

  /// @notice Sets the percentage range of the total supply over which the auto add liquidity will operate when accumulating taxes in the contract balance
  /// @param min Desired min. percentage to trigger the auto add liquidity, multiplied by denominator (0.01% to 100% of total supply)
  /// @param max Desired max. percentage to limit the auto add liquidity, multiplied by denominator (0.01% to 100% of total supply)
  function setAutoAddLiquidityPercent(uint24 min, uint24 max) external onlyOwner {
    require(!_renounced.DEXRouterV2);
    require(min >= 10 && min <= 100 * _denominator, "0.01% to 100%");
    require(max >= min && max <= 100 * _denominator, "0.01% to 100%");

    _setAutoAddLiquidityPercent(min, max);
  }

  function _setAutoAddLiquidityPercent(uint24 min, uint24 max) internal {
    _minAutoAddLiquidityPercent = min;
    _maxAutoAddLiquidityPercent = max;
    _minAutoAddLiquidityAmount = _percentage(_totalSupply, uint256(min));
    _maxAutoAddLiquidityAmount = _percentage(_totalSupply, uint256(max));
  }

  /// @notice Returns the token for tax distribution
  function getTaxToken() external view returns (address) {
    return address(_taxToken);
  }

  function _setTaxToken(address token) internal {
    require((!_initialized && token == address(0)) || token == address(this) || token == _dex.WETH || IDEXFactoryV2(IDEXRouterV2(_dex.router).factory()).getPair(_dex.WETH, token) != address(0), "No Pair");

    _taxToken = IERC20(token == address(0) ? address(this) : token);
  }

  /// @notice Enables the trading capability via the DEX set up
  /// @dev Once enabled, it cannot be reverted
  function enableTrading() external onlyOwner {
    require(!_renounced.DEXRouterV2);
    require(_tradingEnabled == 0, "Already enabled");

    _tradingEnabled = _timestamp();

    emit TradingEnabled();
  }
}
CF_Recoverable.sol 51 lines
// SPDX-License-Identifier: MIT

pragma solidity 0.8.25;

import "./CF_Common.sol";
import "./CF_Ownable.sol";

abstract contract CF_Recoverable is CF_Common, CF_Ownable {
  /// @notice Recovers a misplaced amount of an ERC-20 token sitting in the contract balance
  /// @dev Beware of scam tokens!
  /// @dev Note that if the token of this contract is specified, amounts allocated for tax distribution and liquidity are reserved
  /// @param token Address of the ERC-20 token
  /// @param to Recipient
  /// @param amount Amount to be transferred
  function recoverERC20(address token, address to, uint256 amount) external onlyOwner {
    unchecked {
      uint256 balance = IERC20(token).balanceOf(address(this));
      uint256 allocated = token == address(this) ? _amountForTaxDistribution + _amountForLiquidity : (address(_taxToken) == token ? _tokensForTaxDistribution[address(_taxToken)] : 0);

      require(balance - (allocated >= balance ? balance : allocated) >= amount, "Exceeds balance");
    }

    IERC20(token).transfer(to, amount);
  }

  /// @notice Recovers a misplaced ERC-721 (NFT) sitting in the contract
  /// @dev Beware of scam tokens!
  /// @param token Address of the ERC-721 token
  /// @param to Recipient
  /// @param tokenId Unique identifier of the NFT
  function recoverERC721(address token, address to, uint256 tokenId) external onlyOwner {
    IERC721(token).safeTransferFrom(address(this), to, tokenId);
  }

  /// @notice Recovers a misplaced amount of native tokens sitting in the contract balance
  /// @dev Note that if the reflection token is the wrapped native, amounts allocated for tax distribution and/or liquidity are reserved
  /// @param to Recipient
  /// @param amount Amount of native tokens to be transferred
  function recoverNative(address payable to, uint256 amount) external onlyOwner {
    unchecked {
      uint256 balance = address(this).balance;
      uint256 allocated = address(_taxToken) == _dex.WETH ? _ethForTaxDistribution : 0;

      require(balance - (allocated >= balance ? balance : allocated) >= amount, "Exceeds balance");
    }

    (bool success, ) = to.call{ value: amount }("");

    require(success);
  }
}
ChainFactory_ERC20.sol 130 lines
/*

  LINE

  A Line That Lives Everywhere. Just a line—no limits, no restrictions. It can be any colour, any size, part of  something or standalone, as a word in a sentence, or purely as a visual element—anything, really.
  
  Web: https//www.justaline.xyz
  X: https://x.com/alineoneth
  Telegram: t.me/alineoneth
  YouTube: https://www.youtube.com/@alineoneth

*/

// SPDX-License-Identifier: MIT

pragma solidity 0.8.25;

import "./CF_Common.sol";
import "./CF_Ownable.sol";
import "./CF_ERC20.sol";
import "./CF_Recoverable.sol";
import "./CF_Whitelist.sol";
import "./CF_Taxable.sol";
import "./CF_DEXRouterV2.sol";

contract ChainFactory_ERC20 is CF_Common, CF_Ownable, CF_ERC20, CF_Recoverable, CF_Whitelist, CF_Taxable, CF_DEXRouterV2 {
  constructor() {
    _name = unicode"LINE";
    _symbol = unicode"LINE";
    _decimals = 18;
    _totalSupply = 1000000000000000000000000000; // 1,000,000,000 LINE
    _transferOwnership(0x31D6baA2C643a8DaBCaa6D5b3e0660EAcc9E3355);
    _transferInitialSupply(0x31D6baA2C643a8DaBCaa6D5b3e0660EAcc9E3355, 50000); // 50%
    _transferInitialSupply(0x15d3454f9f0404820A7efF246c8c8D5a687C6f10, 10000); // 10%
    _transferInitialSupply(0x12c2b4490E895bAFa477c7129dC75D7f74F08afd, 13000); // 13%
    _transferInitialSupply(0x7A49083E35b80d4BB5d53144Ee2838C2d02cb839, 13000); // 13%
    _transferInitialSupply(0xAD9c2101249E2e4fe4321925f504EE0d2d62cd35, 14000); // 14%
    _setDEXRouterV2(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
    _setDEXLPTokenReceiver(0x31D6baA2C643a8DaBCaa6D5b3e0660EAcc9E3355);
    _setEarlyPenaltyTime(260); // 4min 20sec
    _setTaxToken(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
    _autoSwapEnabled = true;
    _setAutoSwapPercent(50, 100); // 0.05% -> 0.1% of total supply
    _setAutoAddLiquidityPercent(100, 1000); // 0.1% -> 1% of total supply
    _setTaxBeneficiary(0, 0x8881d9869aC7C7840971cAac043D7f4D144Abd10, [ uint24(0), uint24(0), uint24(0) ], [ uint24(0), uint24(7000), uint24(7000) ]); // ChainFactory Anti-Sniper revenue (10%)
    _setTaxBeneficiary(1, 0x15d3454f9f0404820A7efF246c8c8D5a687C6f10, [ uint24(0), uint24(1000), uint24(1000) ], [ uint24(0), uint24(70000), uint24(70000) ]); // marketing
    _setTaxBeneficiary(2, _dex.pair, [ uint24(0), uint24(1000), uint24(1000) ], [ uint24(0), uint24(0), uint24(0) ]); // LP
    _initialWhitelist([ 0x15d3454f9f0404820A7efF246c8c8D5a687C6f10 ]);
    _domainSeparator = keccak256(abi.encode(keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(bytes(_name)), keccak256(bytes("1")), block.chainid, address(this)));

    _initialized = true;
  }

  function _transfer(address from, address to, uint256 amount) internal virtual override {
    if (!_distributing && !_swapping && (from != _dex.pair && from != _dex.router)) {
      _autoSwap(false);
      _autoTaxDistribute();
    }

    if (amount > 0 && !_whitelisted[from] && !_whitelisted[to] && from != address(this) && to != address(this) && to != _dex.router) {
      require((from != _dex.pair && to != _dex.pair) || ((from == _dex.pair || to == _dex.pair) && _tradingEnabled > 0), "Trading disabled");

      unchecked {
        if (!_suspendTaxes && !_distributing && !_swapping) {
          uint256 appliedTax;
          uint8 taxType;

          if (from == _dex.pair || to == _dex.pair) { taxType = from == _dex.pair ? 1 : 2; }

          address _account = taxType == 1 ? to : from;

          if (_tradingEnabled + _earlyPenaltyTime >= _timestamp() && !_holder[_account].penalty) { _holder[_account].penalty = true; }

          for (uint8 i; i < 6; i++) {
            uint256 percent = uint256(taxType > 0 ? (taxType == 1 ? (_holder[_account].penalty ? _taxBeneficiary[i].penalty[1] : _taxBeneficiary[i].percent[1]) : (_holder[_account].penalty ? _taxBeneficiary[i].penalty[2] : _taxBeneficiary[i].percent[2])) : (_holder[_account].penalty ? _taxBeneficiary[i].penalty[0] : _taxBeneficiary[i].percent[0]));

            if (percent == 0) { continue; }

            uint256 taxAmount = _percentage(amount, percent);

            super._transfer(from, address(this), taxAmount);

            if (_taxBeneficiary[i].account == _dex.pair) {
              _amountForLiquidity += taxAmount;
            } else {
              _taxBeneficiary[i].unclaimed += taxAmount;
              _amountForTaxDistribution += taxAmount;
              _totalTaxUnclaimed += taxAmount;
            }

            appliedTax += taxAmount;
          }

          if (appliedTax > 0) {
            _totalTaxCollected += appliedTax;

            amount -= appliedTax;
          }
        }
      }
    }

    super._transfer(from, to, amount);
  }

  function _transferInitialSupply(address account, uint24 percent) private {
    require(!_initialized);

    uint256 amount = _percentage(_totalSupply, uint256(percent));

    _balance[account] = amount;

    emit Transfer(address(0), account, amount);
  }

  /// @notice Returns a list specifying the renounce status of each feature
  function renounced() external view returns (bool Whitelist, bool DEXRouterV2, bool Taxable) {
    return (_renounced.Whitelist, _renounced.DEXRouterV2, _renounced.Taxable);
  }

  /// @notice Returns basic information about this Smart-Contract
  function info() external view returns (string memory name, string memory symbol, uint8 decimals, address owner, uint256 totalSupply, string memory version) {
    return (_name, _symbol, _decimals, _owner, _totalSupply, _version);
  }

  receive() external payable { }
  fallback() external payable { }
}


Read Contract

DOMAIN_SEPARATOR 0x3644e515 → bytes32
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
buyTax 0x4f7041a5 → uint24
buyTax 0x95101f90 → uint24
decimals 0x313ce567 → uint8
denominator 0x96ce0795 → uint24
getAutoAddLiquidityPercent 0x97a26b9e → uint24, uint24
getAutoSwapPercent 0x32acf3de → uint24, uint24
getDEXLPTokenReceiver 0x3b7854de → address
getDEXPairV2 0xc2921583 → address
getDEXRouterV2 0xf7de0e57 → address
getEarlyPenaltyTime 0x5b90fe66 → uint32
getTaxToken 0x5a0d4f88 → address
info 0x370158ea → string, string, uint8, address, uint256, string
isAutoSwapEnabled 0x4b7d9db4 → bool
isPenalized 0xf3dc4f48 → bool
isTradingEnabled 0x064a59d0 → bool
isWhitelisted 0x3af32abf → bool
listTaxBeneficiaries 0x6f05be97 → tuple[]
name 0x06fdde03 → string
nonces 0x7ecebe00 → uint256
owner 0x8da5cb5b → address
renounced 0xd232c220 → bool, bool, bool
sellTax 0x5f641758 → uint24
sellTax 0xcc1776d3 → uint24
symbol 0x95d89b41 → string
taxesSuspended 0x07e9652c → bool
totalSupply 0x18160ddd → uint256
totalTaxCollected 0xd8454a82 → uint256
txTax 0x8bf1acff → uint24
txTax 0x8d8350ca → uint24
version 0x54fd4d50 → string

Write Contract 28 functions

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

approve 0x095ea7b3
address spender
uint256 amount
returns: bool
autoSwap 0x77004851
No parameters
autoSwap 0xa4d8971a
bool force
autoTaxDistribute 0x9c5ef8d7
No parameters
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
enableAutoSwap 0x2623e975
bool status
enableTrading 0x8a8c523c
No parameters
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
permit 0xd505accf
address owner
address spender
uint256 value
uint256 deadline
uint8 v
bytes32 r
bytes32 s
recoverERC20 0x1171bda9
address token
address to
uint256 amount
recoverERC721 0x2cdf2c35
address token
address to
uint256 tokenId
recoverNative 0xf2cda82e
address to
uint256 amount
removePenalty 0xbe5e49b2
address account
renounceDEXRouterV2 0xc78fe0d4
No parameters
renounceOwnership 0x715018a6
No parameters
renounceTaxable 0x8324c3b9
No parameters
renounceWhitelist 0x39137f8b
No parameters
setAutoAddLiquidityPercent 0xd6a018eb
uint24 min
uint24 max
setAutoSwapPercent 0x44b691ff
uint24 min
uint24 max
setDEXLPTokenReceiver 0xedd286cf
address receiver
setEarlyPenaltyTime 0x2984207a
uint32 time
setTaxBeneficiary 0x186488a8
uint8 slot
address account
uint24[3] percent
uint24[3] penalty
suspendTaxes 0xa5596b4f
bool status
transfer 0xa9059cbb
address to
uint256 amount
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 amount
returns: bool
transferOwnership 0xf2fde38b
address newOwner
whitelist 0x01b38af5
address[] accounts
bool status
whitelist 0xf59c3708
address account
bool status

Recent Transactions

No transactions found for this address