Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0xb189073001fEbbDDE85e3E936d0E63af842df93D
Balance 0 ETH
Nonce 1
Code Size 21380 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

21380 bytes
0x608060405234801561001057600080fd5b50600436106103775760003560e01c806370a08231116101d3578063af465a2711610104578063de0060ca116100a2578063f820f5671161007c578063f820f56714610a32578063f8afaba514610a50578063f91f825d14610a6c578063ffa1ad7414610a8857610377565b8063de0060ca146109dc578063f19c4e3b146109fa578063f2fde38b14610a1657610377565b8063bfcf7355116100de578063bfcf735514610954578063d48e412714610972578063d8f6785114610990578063dd62ed3e146109ac57610377565b8063af465a27146108fc578063b609995e1461091a578063b7bda68f1461093657610377565b806395d89b4111610171578063a457c2d71161014b578063a457c2d714610862578063a476df6114610892578063a9059cbb146108ae578063a9d86685146108de57610377565b806395d89b41146108085780639703a19d14610826578063a32f69761461084457610377565b80638da5cb5b116101ad5780638da5cb5b146107905780638dac7191146107ae5780638e8c10a2146107cc57806393fbda99146107ea57610377565b806370a0823114610738578063715018a614610768578063883356d91461077257610377565b80632fa782eb116102ad57806349a602db1161024b578063542e966711610225578063542e9667146106c05780635514c832146106de5780635a3990ce146106fc578063614d08f81461071a57610377565b806349a602db146106545780634a88266c146106725780634ac0bc32146106a257610377565b8063395093511161028757806339509351146105ce57806340c10f19146105fe57806342966c681461061a57806346b45af71461063657610377565b80632fa782eb14610574578063313ce56714610592578063378dc3dc146105b057610377565b8063154af8e71161031a57806323bbbd6a116102f457806323bbbd6a146104d85780632ab4d052146105085780632d838119146105265780632e0ee48e1461055657610377565b8063154af8e71461046c57806318160ddd1461048a57806323b872dd146104a857610377565b806306fdde031161035657806306fdde03146103e6578063095ea7b3146104045780630bd9275614610434578063111e03761461045057610377565b8062af2d9d1461037c57806302252c4d146103ac578063044ab74e146103c8575b600080fd5b61039660048036038101906103919190614264565b610aa6565b6040516103a391906142d2565b60405180910390f35b6103c660048036038101906103c19190614264565b610ae5565b005b6103d0610ba7565b6040516103dd919061437d565b60405180910390f35b6103ee610c35565b6040516103fb919061437d565b60405180910390f35b61041e600480360381019061041991906143cb565b610cc7565b60405161042b9190614426565b60405180910390f35b61044e60048036038101906104499190614441565b610cea565b005b61046a60048036038101906104659190614441565b610fa0565b005b610474610fb4565b604051610481919061452c565b60405180910390f35b610492611042565b60405161049f919061455d565b60405180910390f35b6104c260048036038101906104bd9190614578565b61104c565b6040516104cf9190614426565b60405180910390f35b6104f260048036038101906104ed9190614264565b6111a4565b6040516104ff91906142d2565b60405180910390f35b6105106111e3565b60405161051d919061455d565b60405180910390f35b610540600480360381019061053b9190614264565b6111e9565b60405161054d919061455d565b60405180910390f35b61055e611247565b60405161056b9190614426565b60405180910390f35b61057c611261565b604051610589919061455d565b60405180910390f35b61059a611267565b6040516105a791906145e7565b60405180910390f35b6105b861128f565b6040516105c5919061455d565b60405180910390f35b6105e860048036038101906105e391906143cb565b6112b3565b6040516105f59190614426565b60405180910390f35b610618600480360381019061061391906143cb565b6112ea565b005b610634600480360381019061062f9190614264565b611458565b005b61063e6114ab565b60405161064b9190614426565b60405180910390f35b61065c6114c5565b604051610669919061455d565b60405180910390f35b61068c60048036038101906106879190614441565b6114ca565b6040516106999190614426565b60405180910390f35b6106aa6114ea565b6040516106b79190614426565b60405180910390f35b6106c8611504565b6040516106d5919061455d565b60405180910390f35b6106e661150a565b6040516106f3919061455d565b60405180910390f35b61070461150f565b6040516107119190614426565b60405180910390f35b610722611529565b60405161072f919061437d565b60405180910390f35b610752600480360381019061074d9190614441565b611562565b60405161075f919061455d565b60405180910390f35b610770611683565b005b61077a611695565b6040516107879190614426565b60405180910390f35b6107986116af565b6040516107a591906142d2565b60405180910390f35b6107b66116d9565b6040516107c391906142d2565b60405180910390f35b6107d46116fd565b6040516107e19190614426565b60405180910390f35b6107f2611717565b6040516107ff919061452c565b60405180910390f35b6108106117a5565b60405161081d919061437d565b60405180910390f35b61082e611837565b60405161083b919061455d565b60405180910390f35b61084c61183d565b604051610859919061455d565b60405180910390f35b61087c600480360381019061087791906143cb565b611861565b6040516108899190614426565b60405180910390f35b6108ac60048036038101906108a79190614737565b6118d8565b005b6108c860048036038101906108c391906143cb565b611968565b6040516108d59190614426565b60405180910390f35b6108e6611abe565b6040516108f3919061437d565b60405180910390f35b610904611b4c565b604051610911919061455d565b60405180910390f35b610934600480360381019061092f9190614441565b611b5b565b005b61093e611b6f565b60405161094b91906142d2565b60405180910390f35b61095c611b95565b6040516109699190614799565b60405180910390f35b61097a611bbc565b604051610987919061455d565b60405180910390f35b6109aa60048036038101906109a59190614264565b611bc2565b005b6109c660048036038101906109c191906147b4565b611ca6565b6040516109d3919061455d565b60405180910390f35b6109e4611d2d565b6040516109f19190614426565b60405180910390f35b610a146004803603810190610a0f91906143cb565b611d47565b005b610a306004803603810190610a2b9190614441565b611e8d565b005b610a3a611ea1565b604051610a479190614426565b60405180910390f35b610a6a6004803603810190610a659190614441565b611ebb565b005b610a866004803603810190610a819190614264565b612087565b005b610a90612106565b604051610a9d919061437d565b60405180910390f35b60128181548110610ab657600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610aed612331565b610af561150f565b610b2b576040517f6273340f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600f548111610b66576040517fa43d2d7600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80600f819055507f2905481c6fd1a037492016c4760435a52203d82a6f34dc3de40f464c1bf42d5981604051610b9c919061455d565b60405180910390a150565b600e8054610bb490614823565b80601f0160208091040260200160405190810160405280929190818152602001828054610be090614823565b8015610c2d5780601f10610c0257610100808354040283529160200191610c2d565b820191906000526020600020905b815481529060010190602001808311610c1057829003601f168201915b505050505081565b606060038054610c4490614823565b80601f0160208091040260200160405190810160405280929190818152602001828054610c7090614823565b8015610cbd5780601f10610c9257610100808354040283529160200191610cbd565b820191906000526020600020905b815481529060010190602001808311610ca057829003601f168201915b5050505050905090565b600080610cd26123af565b9050610cdf8185856123b7565b600191505092915050565b610cf2612331565b601160008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610d75576040517fed68fdd600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b601280549050811015610f9c578173ffffffffffffffffffffffffffffffffffffffff1660128281548110610db057610daf614854565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1603610f895760126001601280549050610e0a91906148b2565b81548110610e1b57610e1a614854565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660128281548110610e5a57610e59614854565b5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506012805480610f0c57610f0b6148e6565b5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905590558173ffffffffffffffffffffffffffffffffffffffff167f98bab529cae32acf2e47348750c372f438f475b15be0136f55544297ef96bd2c60405160405180910390a2610f9c565b8080610f9490614915565b915050610d78565b5050565b610fa8612331565b610fb181612580565b50565b6060600b80548060200260200160405190810160405280929190818152602001828054801561103857602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610fee575b5050505050905090565b6000600254905090565b60008061105a85858561286f565b905060006110698686866129a7565b9050600081838661107a91906148b2565b61108491906148b2565b905061108e61150f565b80156110e45750601160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561114457600f54816110f688611562565b611100919061495d565b111561114357856040517ff6202a8f00000000000000000000000000000000000000000000000000000000815260040161113a91906142d2565b60405180910390fd5b5b6000831461117a5761117987601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685612a85565b5b6000821461118d5761118c8783612b59565b5b611198878783612bbf565b93505050509392505050565b600b81815481106111b457600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60105481565b6000600754821115611227576040517fc91fa8bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611231612bee565b9050808361123f91906149c0565b915050919050565b6000601360000160079054906101000a900460ff16905090565b60155481565b60007f0000000000000000000000000000000000000000000000000000000000000012905090565b7f000000000000000000000000000000000000000000000000000000003b9aca0081565b6000806112be6123af565b90506112df8185856112d08589611ca6565b6112da919061495d565b6123b7565b600191505092915050565b6112f2612331565b6112fa6114ab565b611330576040517f3990ac6800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61133861150f565b801561138e5750601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156113ee57600f54816113a084611562565b6113aa919061495d565b11156113ed57816040517ff6202a8f0000000000000000000000000000000000000000000000000000000081526004016113e491906142d2565b60405180910390fd5b5b6113f6611d2d565b1561144a5760105481611407611042565b611411919061495d565b1115611449576040517f44ea8ea500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b6114548282612c12565b5050565b611460612331565b611468611695565b61149e576040517f6cb5913900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6114a83382612b59565b50565b6000601360000160009054906101000a900460ff16905090565b606481565b60116020528060005260406000206000915054906101000a900460ff1681565b6000601360000160059054906101000a900460ff16905090565b60165481565b606481565b6000601360000160039054906101000a900460ff16905090565b6040518060400160405280600681526020017f5350414e4441000000000000000000000000000000000000000000000000000081525081565b60007f00000000000000000000000000000000000000000000000000000000000000001561167257600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561162357600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061167e565b61166b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111e9565b905061167e565b61167b82612c78565b90505b919050565b61168b612331565b611693612cc0565b565b6000601360000160019054906101000a900460ff16905090565b6000600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f00000000000000000000000023bbcdfde37ee912fc524d1fa64e06f67f3e21d681565b6000601360000160069054906101000a900460ff16905090565b6060601280548060200260200160405190810160405280929190818152602001828054801561179b57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611751575b5050505050905090565b6060600480546117b490614823565b80601f01602080910402602001604051908101604052809291908181526020018280546117e090614823565b801561182d5780601f106118025761010080835404028352916020019161182d565b820191906000526020600020905b81548152906001019060200180831161181057829003601f168201915b5050505050905090565b60095481565b7f000000000000000000000000000000000000000000000000000000000000000081565b60008061186c6123af565b9050600061187a8286611ca6565b9050838110156118bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118b690614a63565b60405180910390fd5b6118cc82868684036123b7565b60019250505092915050565b6118e0612331565b6118e8611ea1565b61191e576040517f70a43fce00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80600e908161192d9190614c2f565b507f4456a0b562609d67398ddb488f136db285cd3c92343e0a7ba684925669237ade8160405161195d919061437d565b60405180910390a150565b60008061197633858561286f565b905060006119853386866129a7565b9050600081838661199691906148b2565b6119a091906148b2565b90506119aa61150f565b8015611a005750601160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611a6057600f5481611a1288611562565b611a1c919061495d565b1115611a5f57856040517ff6202a8f000000000000000000000000000000000000000000000000000000008152600401611a5691906142d2565b60405180910390fd5b5b60008314611a9657611a9533601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685612a85565b5b60008214611aa957611aa83383612b59565b5b611ab38682612cd4565b935050505092915050565b600d8054611acb90614823565b80601f0160208091040260200160405190810160405280929190818152602001828054611af790614823565b8015611b445780601f10611b1957610100808354040283529160200191611b44565b820191906000526020600020905b815481529060010190602001808311611b2757829003601f168201915b505050505081565b6000611b56611042565b905090565b611b63612331565b611b6c81612cf7565b50565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b7f93074d9f9841a9864d767cb3036d78541d8c82b17a0cf2661f9ba080781eb7f060001b81565b600f5481565b611bca612331565b611bd26116fd565b611c08576040517fcd9e529800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600081600954601654611c1b919061495d565b611c25919061495d565b90506107d0811115611c6e57806040517f3e474e0d000000000000000000000000000000000000000000000000000000008152600401611c65919061455d565b60405180910390fd5b81601681905550817fc1ff65ee907dc079b64ed9913d53f4bd593bd6ebd9b2a2708db2916d49e17ec360405160405180910390a25050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000601360000160049054906101000a900460ff16905090565b611d4f612331565b611d576114ea565b611d8d576040517fc8a478a500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600081600954601654611da0919061495d565b611daa919061495d565b90506107d0811115611df357806040517f3e474e0d000000000000000000000000000000000000000000000000000000008152600401611dea919061455d565b60405180910390fd5b611dfc83612295565b82601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081601581905550818373ffffffffffffffffffffffffffffffffffffffff167facc44e32fd5ca4240f6dbe6e8cf4eb49349c17c5ce5f80f1919a9c97b50d398a60405160405180910390a3505050565b611e95612331565b611e9e816122ae565b50565b6000601360000160029054906101000a900460ff16905090565b611ec3612331565b601160008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611f47576040517ff20d03d600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606460128054905010611f86576040517fc92787fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506012819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f94f5dc0e322a0a7c5af09958609aeb2384692e22922827ff9595db226c01dfa560405160405180910390a250565b61208f612331565b612097611247565b6120cd576040517f800e34b000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6120d681613041565b807f76e1296412dac7b50002658bf9aab02d0cfe366f373222d5c14d0168ee8199e360405160405180910390a250565b6040518060400160405280600881526020017f646566695f765f3500000000000000000000000000000000000000000000000081525081565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036121ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121a590614d4d565b60405180910390fd5b6121ba600083836130a2565b80600260008282546121cc919061495d565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161227d919061455d565b60405180910390a3612291600083836130a7565b5050565b8060601b6122ab5763d92e233d6000526004601cfd5b50565b6122b6612331565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603612325576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161231c90614ddf565b60405180910390fd5b61232e816130ac565b50565b6123396123af565b73ffffffffffffffffffffffffffffffffffffffff166123576116af565b73ffffffffffffffffffffffffffffffffffffffff16146123ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123a490614e4b565b60405180910390fd5b565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603612426576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161241d90614edd565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603612495576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161248c90614f6f565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051612573919061455d565b60405180910390a3505050565b7f00000000000000000000000000000000000000000000000000000000000000006125d7576040517f800e34b000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600a60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561265b576040517fe2f18de900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6064600b805490501061269a576040517ff266e36200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054111561276e5761272a600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111e9565b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6001600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600b819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f743dcd4a012534912a3350f3ed8937d3b4f0771c62892ed15e4373dc2c5f584a60405160405180910390a250565b600080601554141580156128d15750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156129275750601160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561297d5750601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156129a057612710601554836129939190614f8f565b61299d91906149c0565b90505b9392505050565b60008060165414158015612a055750601160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015612a5b5750601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15612a7e5761271060165483612a719190614f8f565b612a7b91906149c0565b90505b9392505050565b7f000000000000000000000000000000000000000000000000000000000000000015612b485760008114612b43576000612abd612bee565b905060008183612acd9190614f8f565b9050612adb85858384613172565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612b38919061455d565b60405180910390a350505b612b54565b612b53838383613322565b5b505050565b7f000000000000000000000000000000000000000000000000000000000000000015612bb1576040517f6cb5913900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612bbb8282613598565b5050565b600080612bca6123af565b9050612bd7858285613765565b612be28585856137f1565b60019150509392505050565b6000806000612bfb613b68565b915091508082612c0b91906149c0565b9250505090565b7f000000000000000000000000000000000000000000000000000000000000000015612c6a576040517f3990ac6800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612c74828261213f565b5050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b612cc8612331565b612cd260006130ac565b565b600080612cdf6123af565b9050612cec8185856137f1565b600191505092915050565b7f0000000000000000000000000000000000000000000000000000000000000000612d4e576040517f800e34b000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600a60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16612dd1576040517f1214f5e700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b600b8054905081101561303d578173ffffffffffffffffffffffffffffffffffffffff16600b8281548110612e0c57612e0b614854565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff160361302a57600b6001600b80549050612e6691906148b2565b81548110612e7757612e76614854565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600b8281548110612eb657612eb5614854565b5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600b805480612fad57612fac6148e6565b5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905590558173ffffffffffffffffffffffffffffffffffffffff167f9ccbe1146da67d2d78acc466156a4860eecd4209be8b75a9370e8bf3e949ed1f60405160405180910390a261303d565b808061303590614915565b915050612dd4565b5050565b7f0000000000000000000000000000000000000000000000000000000000000000613098576040517f800e34b000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060098190555050565b505050565b505050565b6000600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050828110156131ff578381846040517fe450d38c0000000000000000000000000000000000000000000000000000000081526004016131f693929190614fd1565b60405180910390fd5b82600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461324a91906148b2565b600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546132d8919061495d565b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603613391576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016133889061507a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603613400576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016133f79061510c565b60405180910390fd5b61340b8383836130a2565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015613491576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016134889061519e565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161357f919061455d565b60405180910390a36135928484846130a7565b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603613607576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016135fe90615230565b60405180910390fd5b613613826000836130a2565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015613699576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613690906152c2565b60405180910390fd5b8181036000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600260008282540392505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161374c919061455d565b60405180910390a3613760836000846130a7565b505050565b60006137718484611ca6565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146137eb57818110156137dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016137d49061532e565b60405180910390fd5b6137ea84848484036123b7565b5b50505050565b7f000000000000000000000000000000000000000000000000000000000000000015613b575761382083612295565b61382982612295565b60008103613863576040517f76c4f5b300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156139065750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561391b57613916838383613b7e565b613b52565b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156139be5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156139d3576139ce838383613ccf565b613b51565b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015613a775750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15613a8c57613a87838383613e20565b613b50565b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015613b2e5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15613b4357613b3e838383613ee3565b613b4f565b613b4e838383613e20565b5b5b5b5b613b63565b613b62838383613322565b5b505050565b600080600754613b76611b4c565b915091509091565b6000613b8b8285856140c2565b905060008183613b9b91906148b2565b90506000806000613bad868686614198565b92509250925060008614613cc557613bc788888584613172565b85600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613c1291906148b2565b600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613c5f82866141ee565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef88604051613cbc919061455d565b60405180910390a35b5050505050505050565b6000613cdc8285856140c2565b905060008183613cec91906148b2565b90506000806000613cfe868686614198565b92509250925060008614613e1657613d1888888584613172565b83600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613d63919061495d565b600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613db082866141ee565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef88604051613e0d919061455d565b60405180910390a35b5050505050505050565b6000613e2d8285856140c2565b905060008183613e3d91906148b2565b90506000806000613e4f868686614198565b92509250925060008614613ed957613e6988888584613172565b613e7382866141ee565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef88604051613ed0919061455d565b60405180910390a35b5050505050505050565b6000613ef08285856140c2565b905060008183613f0091906148b2565b90506000806000613f12868686614198565b925092509250600086146140b857613f2c88888584613172565b85600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613f7791906148b2565b600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555083600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054614005919061495d565b600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061405282866141ee565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef886040516140af919061455d565b60405180910390a35b5050505050505050565b6000600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806141655750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156141735760009050614191565b612710600954856141849190614f8f565b61418e91906149c0565b90505b9392505050565b6000806000806141a6612bee565b9050600081886141b69190614f8f565b9050600082886141c69190614f8f565b9050600083886141d69190614f8f565b90508282829650965096505050505093509350939050565b816007546141fc91906148b2565b60078190555080600854614210919061495d565b6008819055505050565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b6142418161422e565b811461424c57600080fd5b50565b60008135905061425e81614238565b92915050565b60006020828403121561427a57614279614224565b5b60006142888482850161424f565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006142bc82614291565b9050919050565b6142cc816142b1565b82525050565b60006020820190506142e760008301846142c3565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561432757808201518184015260208101905061430c565b60008484015250505050565b6000601f19601f8301169050919050565b600061434f826142ed565b61435981856142f8565b9350614369818560208601614309565b61437281614333565b840191505092915050565b600060208201905081810360008301526143978184614344565b905092915050565b6143a8816142b1565b81146143b357600080fd5b50565b6000813590506143c58161439f565b92915050565b600080604083850312156143e2576143e1614224565b5b60006143f0858286016143b6565b92505060206144018582860161424f565b9150509250929050565b60008115159050919050565b6144208161440b565b82525050565b600060208201905061443b6000830184614417565b92915050565b60006020828403121561445757614456614224565b5b6000614465848285016143b6565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6144a3816142b1565b82525050565b60006144b5838361449a565b60208301905092915050565b6000602082019050919050565b60006144d98261446e565b6144e38185614479565b93506144ee8361448a565b8060005b8381101561451f57815161450688826144a9565b9750614511836144c1565b9250506001810190506144f2565b5085935050505092915050565b6000602082019050818103600083015261454681846144ce565b905092915050565b6145578161422e565b82525050565b6000602082019050614572600083018461454e565b92915050565b60008060006060848603121561459157614590614224565b5b600061459f868287016143b6565b93505060206145b0868287016143b6565b92505060406145c18682870161424f565b9150509250925092565b600060ff82169050919050565b6145e1816145cb565b82525050565b60006020820190506145fc60008301846145d8565b92915050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61464482614333565b810181811067ffffffffffffffff821117156146635761466261460c565b5b80604052505050565b600061467661421a565b9050614682828261463b565b919050565b600067ffffffffffffffff8211156146a2576146a161460c565b5b6146ab82614333565b9050602081019050919050565b82818337600083830152505050565b60006146da6146d584614687565b61466c565b9050828152602081018484840111156146f6576146f5614607565b5b6147018482856146b8565b509392505050565b600082601f83011261471e5761471d614602565b5b813561472e8482602086016146c7565b91505092915050565b60006020828403121561474d5761474c614224565b5b600082013567ffffffffffffffff81111561476b5761476a614229565b5b61477784828501614709565b91505092915050565b6000819050919050565b61479381614780565b82525050565b60006020820190506147ae600083018461478a565b92915050565b600080604083850312156147cb576147ca614224565b5b60006147d9858286016143b6565b92505060206147ea858286016143b6565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061483b57607f821691505b60208210810361484e5761484d6147f4565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006148bd8261422e565b91506148c88361422e565b92508282039050818111156148e0576148df614883565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60006149208261422e565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361495257614951614883565b5b600182019050919050565b60006149688261422e565b91506149738361422e565b925082820190508082111561498b5761498a614883565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006149cb8261422e565b91506149d68361422e565b9250826149e6576149e5614991565b5b828204905092915050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6000614a4d6025836142f8565b9150614a58826149f1565b604082019050919050565b60006020820190508181036000830152614a7c81614a40565b9050919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302614ae57fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82614aa8565b614aef8683614aa8565b95508019841693508086168417925050509392505050565b6000819050919050565b6000614b2c614b27614b228461422e565b614b07565b61422e565b9050919050565b6000819050919050565b614b4683614b11565b614b5a614b5282614b33565b848454614ab5565b825550505050565b600090565b614b6f614b62565b614b7a818484614b3d565b505050565b5b81811015614b9e57614b93600082614b67565b600181019050614b80565b5050565b601f821115614be357614bb481614a83565b614bbd84614a98565b81016020851015614bcc578190505b614be0614bd885614a98565b830182614b7f565b50505b505050565b600082821c905092915050565b6000614c0660001984600802614be8565b1980831691505092915050565b6000614c1f8383614bf5565b9150826002028217905092915050565b614c38826142ed565b67ffffffffffffffff811115614c5157614c5061460c565b5b614c5b8254614823565b614c66828285614ba2565b600060209050601f831160018114614c995760008415614c87578287015190505b614c918582614c13565b865550614cf9565b601f198416614ca786614a83565b60005b82811015614ccf57848901518255600182019150602085019450602081019050614caa565b86831015614cec5784890151614ce8601f891682614bf5565b8355505b6001600288020188555050505b505050505050565b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b6000614d37601f836142f8565b9150614d4282614d01565b602082019050919050565b60006020820190508181036000830152614d6681614d2a565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000614dc96026836142f8565b9150614dd482614d6d565b604082019050919050565b60006020820190508181036000830152614df881614dbc565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000614e356020836142f8565b9150614e4082614dff565b602082019050919050565b60006020820190508181036000830152614e6481614e28565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000614ec76024836142f8565b9150614ed282614e6b565b604082019050919050565b60006020820190508181036000830152614ef681614eba565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000614f596022836142f8565b9150614f6482614efd565b604082019050919050565b60006020820190508181036000830152614f8881614f4c565b9050919050565b6000614f9a8261422e565b9150614fa58361422e565b9250828202614fb38161422e565b91508282048414831517614fca57614fc9614883565b5b5092915050565b6000606082019050614fe660008301866142c3565b614ff3602083018561454e565b615000604083018461454e565b949350505050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006150646025836142f8565b915061506f82615008565b604082019050919050565b6000602082019050818103600083015261509381615057565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b60006150f66023836142f8565b91506151018261509a565b604082019050919050565b60006020820190508181036000830152615125816150e9565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b60006151886026836142f8565b91506151938261512c565b604082019050919050565b600060208201905081810360008301526151b78161517b565b9050919050565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b600061521a6021836142f8565b9150615225826151be565b604082019050919050565b600060208201905081810360008301526152498161520d565b9050919050565b7f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b60006152ac6022836142f8565b91506152b782615250565b604082019050919050565b600060208201905081810360008301526152db8161529f565b9050919050565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b6000615318601d836142f8565b9150615323826152e2565b602082019050919050565b600060208201905081810360008301526153478161530b565b905091905056fea2646970667358221220f8e67cfe32350fbdb71e10e2983eb935ccb32583f8d962daf72e9f824527ace864736f6c63430008110033

Verified Source Code Partial Match

Compiler: v0.8.17+commit.8df45f5f EVM: london Optimization: No
SPANDA.sol 519 lines
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.17;

import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { LibCommon } from "./lib/LibCommon.sol";
import { ReflectiveV2ERC20 } from "./ReflectiveV2ERC20.sol";

/// @title A Defi Token implementation with extended functionalities
/// @notice Implements ERC20 standards with additional features like tax and deflation
contract SPANDA is ReflectiveV2ERC20, Ownable {
  // Constants
  uint256 private constant MAX_BPS_AMOUNT = 10_000;
  uint256 private constant MAX_ALLOWED_BPS = 2_000;
  uint256 public constant MAX_EXCLUSION_LIMIT = 100;
  string public constant VERSION = "defi_v_5";
  string public constant CONTRACT_NAME = "SPANDA";
  bytes32 public constant CONTRACT_HASH = 0x93074d9f9841a9864d767cb3036d78541d8c82b17a0cf2661f9ba080781eb7f0;

  // State Variables
  string public initialDocumentUri;
  string public documentUri;
  uint256 public immutable initialSupply;
  uint256 public immutable initialMaxTokenAmountPerAddress;
  uint256 public maxTokenAmountPerAddress;
  uint256 public maxTotalSupply;

  mapping(address => bool) public isFeesAndLimitsExcluded;
  address[] public feesAndLimitsExcluded;

  /// @notice Configuration properties for the ERC20 token
  struct ERC20ConfigProps {
    bool _isMintable;
    bool _isBurnable;
    bool _isDocumentAllowed;
    bool _isMaxAmountOfTokensSet;
    bool _isMaxSupplySet;
    bool _isTaxable;
    bool _isDeflationary;
    bool _isReflective;
  }
  ERC20ConfigProps private configProps;

  address public immutable initialTokenOwner;
  uint8 private immutable _decimals;
  address public taxAddress;
  uint256 public taxBPS;
  uint256 public deflationBPS;

  // Events
  event DocumentUriSet(string newDocUri);
  event MaxTokenAmountPerSet(uint256 newMaxTokenAmount);
  event TaxConfigSet(address indexed _taxAddress, uint256 indexed _taxBPS);
  event DeflationConfigSet(uint256 indexed _deflationBPS);
  event ReflectionConfigSet(uint256 indexed _feeBPS);
  event ExcludeFromFeesAndLimits(address indexed account);
  event IncludedInFeesAndLimits(address indexed account);

  // Custom Errors
  error InvalidMaxTokenAmount(uint256 maxTokenAmount);
  error InvalidDecimals(uint8 decimals);
  error MaxTokenAmountPerAddrLtPrevious();
  error DestBalanceExceedsMaxAllowed(address addr);
  error DocumentUriNotAllowed();
  error MaxTokenAmountNotAllowed();
  error TokenIsNotTaxable();
  error TokenIsNotDeflationary();
  error InvalidTotalBPS(uint256 bps);
  error InvalidReflectiveConfig();
  error InvalidMaxSupplyConfig();
  error TotalSupplyExceedsMaxAllowedAmount();
  error AlreadyExcludedFromFeesAndLimits();
  error AlreadyIncludedInFeesAndLimits();
  error ReachedMaxExclusionLimit();

  /// @notice Constructor to initialize the DeFi token
  /// @param name_ Name of the token
  /// @param symbol_ Symbol of the token
  /// @param initialSupplyToSet Initial supply of tokens
  /// @param decimalsToSet Number of decimals for the token
  /// @param tokenOwner Address of the initial token owner
  /// @param customConfigProps Configuration properties for the token
  /// @param newDocumentUri URI for the document associated with the token
  /// @param _taxAddress Address where tax will be sent
  /// @param bpsParams array of BPS values in this order:
  ///           taxBPS = bpsParams[0],
  ///           deflationBPS = bpsParams[1],
  ///           rewardFeeBPS = bpsParams[2],
  /// @param amountParams array of amounts for amount specific config:
  ///           maxTokenAmount = amountParams[0], Maximum token amount per address
  ///           maxSupplyAmount = amountParams[1], Maximum token token supply amount

  constructor(
    string memory name_,
    string memory symbol_,
    uint256 initialSupplyToSet,
    uint8 decimalsToSet,
    address tokenOwner,
    ERC20ConfigProps memory customConfigProps,
    string memory newDocumentUri,
    address _taxAddress,
    uint256[3] memory bpsParams,
    uint256[2] memory amountParams
  )
    ReflectiveV2ERC20(
      name_,
      symbol_,
      tokenOwner,
      initialSupplyToSet,
      decimalsToSet,
      initialSupplyToSet != 0 ? bpsParams[2] : 0,
      customConfigProps._isReflective
    )
  {
    // reflection feature can't be used in combination with burning/minting/deflation
    // or reflection config is invalid if no reflection BPS amount is provided
    if (
      (customConfigProps._isReflective &&
        (customConfigProps._isBurnable ||
          customConfigProps._isMintable ||
          customConfigProps._isDeflationary)) ||
      (!customConfigProps._isReflective && bpsParams[2] != 0)
    ) {
      revert InvalidReflectiveConfig();
    }

    if (customConfigProps._isMaxAmountOfTokensSet) {
      if (amountParams[0] == 0) {
        revert InvalidMaxTokenAmount(amountParams[0]);
      }
    }
    if (decimalsToSet > 18) {
      revert InvalidDecimals(decimalsToSet);
    }

    if (
      customConfigProps._isMaxSupplySet &&
      (!customConfigProps._isMintable || (totalSupply() > amountParams[1]))
    ) {
      revert InvalidMaxSupplyConfig();
    }

    bpsInitChecks(customConfigProps, bpsParams, _taxAddress);

    LibCommon.validateAddress(tokenOwner);

    taxAddress = _taxAddress;

    taxBPS = bpsParams[0];
    deflationBPS = bpsParams[1];
    initialSupply = initialSupplyToSet;
    initialMaxTokenAmountPerAddress = amountParams[0];
    initialDocumentUri = newDocumentUri;
    initialTokenOwner = tokenOwner;
    _decimals = decimalsToSet;
    configProps = customConfigProps;
    documentUri = newDocumentUri;
    maxTokenAmountPerAddress = amountParams[0];
    maxTotalSupply = amountParams[1];

    if (tokenOwner != msg.sender) {
      transferOwnership(tokenOwner);
    }
  }

  function bpsInitChecks(
    ERC20ConfigProps memory customConfigProps,
    uint256[3] memory bpsParams,
    address _taxAddress
  ) private pure {
    uint256 totalBPS = 0;
    if (customConfigProps._isTaxable) {
      LibCommon.validateAddress(_taxAddress);

      totalBPS += bpsParams[0];
    }
    if (customConfigProps._isDeflationary) {
      totalBPS += bpsParams[1];
    }
    if (customConfigProps._isReflective) {
      totalBPS += bpsParams[2];
    }
    if (totalBPS > MAX_ALLOWED_BPS) {
      revert InvalidTotalBPS(totalBPS);
    }
  }

  // Public and External Functions

  function getFeesAndLimitsExclusionList() external view returns (address[] memory) {
    return feesAndLimitsExcluded;
  }

  /// @notice Checks if the token is mintable
  /// @return True if the token can be minted
  function isMintable() public view returns (bool) {
    return configProps._isMintable;
  }

  /// @notice Checks if the token is burnable
  /// @return True if the token can be burned
  function isBurnable() public view returns (bool) {
    return configProps._isBurnable;
  }

  function getRewardsExclusionList() public view returns (address[] memory) {
    return rewardsExcluded;
  }

  /// @notice Checks if the maximum amount of tokens per address is set
  /// @return True if there is a maximum limit for token amount per address
  function isMaxAmountOfTokensSet() public view returns (bool) {
    return configProps._isMaxAmountOfTokensSet;
  }

  /// @notice Checks if the maximum amount of token supply is set
  /// @return True if there is a maximum limit for token supply
  function isMaxSupplySet() public view returns (bool) {
    return configProps._isMaxSupplySet;
  }

  /// @notice Checks if setting a document URI is allowed
  /// @return True if setting a document URI is allowed
  function isDocumentUriAllowed() public view returns (bool) {
    return configProps._isDocumentAllowed;
  }

  /// @notice Returns the number of decimals used for the token
  /// @return The number of decimals
  function decimals() public view virtual override returns (uint8) {
    return _decimals;
  }

  /// @notice Checks if the token is taxable
  /// @return True if the token has tax applied on transfers
  function isTaxable() public view returns (bool) {
    return configProps._isTaxable;
  }

  /// @notice Checks if the token is deflationary
  /// @return True if the token has deflation applied on transfers
  function isDeflationary() public view returns (bool) {
    return configProps._isDeflationary;
  }

  /// @notice Checks if the token is reflective
  /// @return True if the token has reflection (ie. holder rewards) applied on transfers
  function isReflective() public view returns (bool) {
    return configProps._isReflective;
  }

  /// @notice Sets a new document URI
  /// @dev Can only be called by the contract owner
  /// @param newDocumentUri The new URI to be set
  function setDocumentUri(string memory newDocumentUri) external onlyOwner {
    if (!isDocumentUriAllowed()) {
      revert DocumentUriNotAllowed();
    }
    documentUri = newDocumentUri;
    emit DocumentUriSet(newDocumentUri);
  }

  /// @notice Sets a new maximum token amount per address
  /// @dev Can only be called by the contract owner
  /// @param newMaxTokenAmount The new maximum token amount per address
  function setMaxTokenAmountPerAddress(
    uint256 newMaxTokenAmount
  ) external onlyOwner {
    if (!isMaxAmountOfTokensSet()) {
      revert MaxTokenAmountNotAllowed();
    }
    if (newMaxTokenAmount <= maxTokenAmountPerAddress) {
      revert MaxTokenAmountPerAddrLtPrevious();
    }

    maxTokenAmountPerAddress = newMaxTokenAmount;
    emit MaxTokenAmountPerSet(newMaxTokenAmount);
  }

  /// @notice Sets a new reflection fee
  /// @dev Can only be called by the contract owner
  /// @param _feeBPS The reflection fee in basis points
  function setReflectionConfig(uint256 _feeBPS) external onlyOwner {
    if (!isReflective()) {
      revert TokenIsNotReflective();
    }
    super._setReflectionFee(_feeBPS);

    emit ReflectionConfigSet(_feeBPS);
  }

  /// @notice Sets a new tax configuration
  /// @dev Can only be called by the contract owner
  /// @param _taxAddress The address where tax will be sent
  /// @param _taxBPS The tax rate in basis points
  function setTaxConfig(
    address _taxAddress,
    uint256 _taxBPS
  ) external onlyOwner {
    if (!isTaxable()) {
      revert TokenIsNotTaxable();
    }

    uint256 totalBPS = deflationBPS + tFeeBPS + _taxBPS;
    if (totalBPS > MAX_ALLOWED_BPS) {
      revert InvalidTotalBPS(totalBPS);
    }
    LibCommon.validateAddress(_taxAddress);
    taxAddress = _taxAddress;
    taxBPS = _taxBPS;
    emit TaxConfigSet(_taxAddress, _taxBPS);
  }

  /// @notice Sets a new deflation configuration
  /// @dev Can only be called by the contract owner
  /// @param _deflationBPS The deflation rate in basis points
  function setDeflationConfig(uint256 _deflationBPS) external onlyOwner {
    if (!isDeflationary()) {
      revert TokenIsNotDeflationary();
    }
    uint256 totalBPS = deflationBPS + tFeeBPS + _deflationBPS;
    if (totalBPS > MAX_ALLOWED_BPS) {
      revert InvalidTotalBPS(totalBPS);
    }
    deflationBPS = _deflationBPS;
    emit DeflationConfigSet(_deflationBPS);
  }

  /// @notice Transfers tokens to a specified address
  /// @dev Overrides the ERC20 transfer function with added tax and deflation logic
  /// @param to The address to transfer tokens to
  /// @param amount The amount of tokens to be transferred
  /// @return True if the transfer was successful
  function transfer(
    address to,
    uint256 amount
  ) public virtual override returns (bool) {
    uint256 taxAmount = _taxAmount(msg.sender, to, amount);
    uint256 deflationAmount = _deflationAmount(msg.sender, to, amount);
    uint256 amountToTransfer = amount - taxAmount - deflationAmount;

    if (isMaxAmountOfTokensSet() && !isFeesAndLimitsExcluded[to]) {
      if (balanceOf(to) + amountToTransfer > maxTokenAmountPerAddress) {
        revert DestBalanceExceedsMaxAllowed(to);
      }
    }

    if (taxAmount != 0) {
      _transferNonReflectedTax(msg.sender, taxAddress, taxAmount);
    }
    if (deflationAmount != 0) {
      _burn(msg.sender, deflationAmount);
    }
    return super.transfer(to, amountToTransfer);
  }

  /// @notice Transfers tokens from one address to another
  /// @dev Overrides the ERC20 transferFrom function with added tax and deflation logic
  /// @param from The address which you want to send tokens from
  /// @param to The address which you want to transfer to
  /// @param amount The amount of tokens to be transferred
  /// @return True if the transfer was successful
  function transferFrom(
    address from,
    address to,
    uint256 amount
  ) public virtual override returns (bool) {
    uint256 taxAmount = _taxAmount(from, to, amount);
    uint256 deflationAmount = _deflationAmount(from, to ,amount);
    uint256 amountToTransfer = amount - taxAmount - deflationAmount;

    if (isMaxAmountOfTokensSet() && !isFeesAndLimitsExcluded[to]) {
      if (balanceOf(to) + amountToTransfer > maxTokenAmountPerAddress) {
        revert DestBalanceExceedsMaxAllowed(to);
      }
    }

    if (taxAmount != 0) {
      _transferNonReflectedTax(from, taxAddress, taxAmount);
    }
    if (deflationAmount != 0) {
      _burn(from, deflationAmount);
    }

    return super.transferFrom(from, to, amountToTransfer);
  }

  /// @notice Mints new tokens to a specified address
  /// @dev Can only be called by the contract owner and if minting is enabled
  /// @param to The address to mint tokens to
  /// @param amount The amount of tokens to mint
  function mint(address to, uint256 amount) external onlyOwner {
    if (!isMintable()) {
      revert MintingNotEnabled();
    }
    if (isMaxAmountOfTokensSet() && !isFeesAndLimitsExcluded[to]) {
      if (balanceOf(to) + amount > maxTokenAmountPerAddress) {
        revert DestBalanceExceedsMaxAllowed(to);
      }
    }
    if (isMaxSupplySet()) {
      if (totalSupply() + amount > maxTotalSupply) {
        revert TotalSupplyExceedsMaxAllowedAmount();
      }
    }

    super._mint(to, amount);
  }

  /// @notice Burns a specific amount of tokens
  /// @dev Can only be called by the contract owner and if burning is enabled
  /// @param amount The amount of tokens to be burned
  function burn(uint256 amount) external onlyOwner {
    if (!isBurnable()) {
      revert BurningNotEnabled();
    }
    _burn(msg.sender, amount);
  }

  /// @notice Renounces ownership of the contract
  /// @dev Leaves the contract without an owner, disabling any functions that require the owner's authorization
  function renounceOwnership() public override onlyOwner {
    super.renounceOwnership();
  }

  /// @notice Transfers ownership of the contract to a new account
  /// @dev Can only be called by the current owner
  /// @param newOwner The address of the new owner
  function transferOwnership(address newOwner) public override onlyOwner {
    super.transferOwnership(newOwner);
  }

  /// @notice method for adding a new account to the exclusion list
  /// @param account account to add to the exclusion list
  /// @dev only callable by owner
  function excludeFromFeesAndLimits(
    address account
  ) external onlyOwner {
    if (isFeesAndLimitsExcluded[account]) {
      revert AlreadyExcludedFromFeesAndLimits();
    }
    if (feesAndLimitsExcluded.length >= MAX_EXCLUSION_LIMIT) {
      revert ReachedMaxExclusionLimit();
    }

    isFeesAndLimitsExcluded[account] = true;
    feesAndLimitsExcluded.push(account);

    emit ExcludeFromFeesAndLimits(account);
  }

  /// @notice method for adding a new account to the reflection exclusion list
  /// @param account account to add to the exclusion list
  /// @dev only callable by owner
  function excludeFromRewards(address account) external onlyOwner {
    super._excludeFromRewards(account);
  }

  /// @notice method for removing an account from the fees exclusion list
  /// @param account account to remove from the exclusion list
  /// @dev only callable by owner
  function includeInFeesAndLimits(address account) external onlyOwner() {
    if (!isFeesAndLimitsExcluded[account]) {
      revert AlreadyIncludedInFeesAndLimits();
    }

    for (uint256 i = 0; i < feesAndLimitsExcluded.length; i++) {
      if (feesAndLimitsExcluded[i] == account) {
        feesAndLimitsExcluded[i] = feesAndLimitsExcluded[feesAndLimitsExcluded.length - 1];
        isFeesAndLimitsExcluded[account] = false;
        feesAndLimitsExcluded.pop();
        emit IncludedInFeesAndLimits(account);

        break;
      }
    }
  }

  /// @notice method for removing an account from the reflection exclusion list
  /// @param account account to remove from the exclusion list
  /// @dev only callable by owner
  function includeInRewards(address account) external onlyOwner() {
    super._includeInRewards(account);
  }

  // Internal Functions

  /// @notice Calculates the tax amount for a transfer
  /// @param sender The address initiating the transfer
  /// @param recipient The address receiving the transfer
  /// @param amount The amount of tokens being transferred
  /// @return taxAmount The calculated tax amount
  function _taxAmount(
    address sender,
    address recipient,
    uint256 amount
  ) internal view returns (uint256 taxAmount) {
    taxAmount = 0;
    if (taxBPS != 0 && sender != taxAddress && !isFeesAndLimitsExcluded[sender] && !isFeesAndLimitsExcluded[recipient]) {
      taxAmount = (amount * taxBPS) / MAX_BPS_AMOUNT;
    }
  }

  /// @notice Calculates the deflation amount for a transfer
  /// @param sender The address receiving the transfer
  /// @param recipient The address receiving the transfer
  /// @param amount The amount of tokens being transferred
  /// @return deflationAmount The calculated deflation amount
  function _deflationAmount(
    address sender,
    address recipient,
    uint256 amount
  ) internal view returns (uint256 deflationAmount) {
    deflationAmount = 0;
    if (deflationBPS != 0 && !isFeesAndLimitsExcluded[sender] && !isFeesAndLimitsExcluded[recipient]) {
      deflationAmount = (amount * deflationBPS) / MAX_BPS_AMOUNT;
    }
  }
}
Ownable.sol 83 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling 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);
    }
}
Context.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}
LibCommon.sol 118 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

library LibCommon {
  /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
  /*                       CUSTOM ERRORS                        */
  /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

  /// @dev The ETH transfer has failed.
  error ETHTransferFailed();

  /// @dev The address is the zero address.
  error ZeroAddress();

  /// @notice raised when an ERC20 transfer fails
  error TransferFailed();

  /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
  /*                       ETH OPERATIONS                       */
  /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

  /// @notice Taken from Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeTransferLib.sol)
  /// @dev Sends `amount` (in wei) ETH to `to`.
  /// Reverts upon failure.
  function safeTransferETH(address to, uint256 amount) internal {
    // solhint-disable-next-line no-inline-assembly
    assembly {
      // Transfer the ETH and check if it succeeded or not.
      if iszero(call(gas(), to, amount, 0, 0, 0, 0)) {
        // Store the function selector of `ETHTransferFailed()`.
        // bytes4(keccak256(bytes("ETHTransferFailed()"))) = 0xb12d13eb
        mstore(0x00, 0xb12d13eb)
        // Revert with (offset, size).
        revert(0x1c, 0x04)
      }
    }
  }

  /// @notice Validates that the address is not the zero address using assembly.
  /// @dev Reverts if the address is the zero address.
  function validateAddress(address addr) internal pure {
    // solhint-disable-next-line no-inline-assembly
    assembly {
      if iszero(shl(96, addr)) {
        // Store the function selector of `ZeroAddress()`.
        // bytes4(keccak256(bytes("ZeroAddress()"))) = 0xd92e233d
        mstore(0x00, 0xd92e233d)
        // Revert with (offset, size).
        revert(0x1c, 0x04)
      }
    }
  }

  /// @notice Helper function to transfer ERC20 tokens without the need for SafeERC20.
  /// @dev Reverts if the ERC20 transfer fails.
  /// @param tokenAddress The address of the ERC20 token.
  /// @param from The address to transfer the tokens from.
  /// @param to The address to transfer the tokens to.
  /// @param amount The amount of tokens to transfer.
  function safeTransferFrom(
    address tokenAddress,
    address from,
    address to,
    uint256 amount
  ) internal returns (bool) {
    // solhint-disable-next-line avoid-low-level-calls
    (bool success, bytes memory data) = tokenAddress.call(
      abi.encodeWithSignature(
        "transferFrom(address,address,uint256)",
        from,
        to,
        amount
      )
    );
    if (!success) {
      if (data.length != 0) {
        // bubble up error
        // solhint-disable-next-line no-inline-assembly
        assembly {
          let returndata_size := mload(data)
          revert(add(32, data), returndata_size)
        }
      } else {
        revert TransferFailed();
      }
    }
    return true;
  }

  /// @notice Helper function to transfer ERC20 tokens without the need for SafeERC20.
  /// @dev Reverts if the ERC20 transfer fails.
  /// @param tokenAddress The address of the ERC20 token.
  /// @param to The address to transfer the tokens to.
  /// @param amount The amount of tokens to transfer.
  function safeTransfer(
    address tokenAddress,
    address to,
    uint256 amount
  ) internal returns (bool) {
    // solhint-disable-next-line avoid-low-level-calls
    (bool success, bytes memory data) = tokenAddress.call(
      abi.encodeWithSignature("transfer(address,uint256)", to, amount)
    );
    if (!success) {
      if (data.length != 0) {
        // bubble up error
        // solhint-disable-next-line no-inline-assembly
        assembly {
          let returndata_size := mload(data)
          revert(add(32, data), returndata_size)
        }
      } else {
        revert TransferFailed();
      }
    }
    return true;
  }
}
ReflectiveV2ERC20.sol 441 lines
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.17;

import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { LibCommon } from "./lib/LibCommon.sol";

/// @title ERC20 Token with Extended Reflection Mechanism
/// @notice This contract implements ERC20 standards along with an additional reward feature for token holders
abstract contract ReflectiveV2ERC20 is ERC20 {
  // Constants
  uint256 private constant BPS_DIVISOR = 10_000;
  uint256 public constant MAX_REWARDS_EXCLUSION_LIMIT = 100;

  mapping(address => uint256) private _rOwned;
  mapping(address => uint256) private _tOwned;

  uint256 private constant UINT_256_MAX = type(uint256).max;
  uint256 private _rTotal;
  uint256 private _tFeeTotal;

  uint256 public tFeeBPS;
  bool private immutable isReflective;

  mapping (address => bool) private _isRewardsExcluded;
  address[] public rewardsExcluded;

  // events
  event ExcludedFromRewards(address indexed account);
  event IncludedInRewards(address indexed account);

  // custom errors
  error TokenIsNotReflective();
  error TotalReflectionTooSmall();
  error ZeroTransferError();
  error MintingNotEnabled();
  error BurningNotEnabled();
  error ERC20InsufficientBalance(
    address recipient,
    uint256 fromBalance,
    uint256 balance
  );
  error AlreadyExcludedFromRewards();
  error AlreadyIncludedInRewards();
  error ReachedMaxRewardExclusionLimit();

  /// @notice Returns the total supply of the token
  /// @return The total supply of the token
  function _tTotal() public view virtual returns (uint256) {
    return totalSupply();
  }

  /// @notice Constructor to initialize the ReflectiveV2ERC20 token
  /// @param name_ The name of the token
  /// @param symbol_ The symbol of the token
  /// @param tokenOwner The address of the token owner
  /// @param totalSupply_ The initial total supply of the token
  /// @param decimalsToSet The number of decimal places for the token
  /// @param tFeeBPS_ The reflection fee in basis points
  /// @param isReflective_ Indicates if the token is reflective
  constructor(
    string memory name_,
    string memory symbol_,
    address tokenOwner,
    uint256 totalSupply_,
    uint8 decimalsToSet,
    uint256 tFeeBPS_,
    bool isReflective_
  ) ERC20(name_, symbol_) {
    if (totalSupply_ != 0) {
      super._mint(tokenOwner, totalSupply_ * 10 ** decimalsToSet);
      _rTotal = (UINT_256_MAX - (UINT_256_MAX % totalSupply_));
    }

    _rOwned[tokenOwner] = _rTotal;
    tFeeBPS = tFeeBPS_;
    isReflective = isReflective_;
  }

  /// @notice Returns the balance of tokens for a specific address
  /// @param account The address to query the balance of
  /// @return The balance of tokens
  function balanceOf(address account) public view override returns (uint256) {
    if (isReflective) {
      if (_isRewardsExcluded[account]) return _tOwned[account];

      return tokenFromReflection(_rOwned[account]);
    } else {
      return super.balanceOf(account);
    }
  }

  /// @notice Transfers tokens from one account to another
  /// @param from The address to transfer tokens from
  /// @param to The address to transfer tokens to
  /// @param value The amount of tokens to transfer
  /// @return A boolean indicating success
  function transferFrom(
    address from,
    address to,
    uint256 value
  ) public virtual override returns (bool) {
    address spender = super._msgSender();
    _spendAllowance(from, spender, value);
    _transfer(from, to, value);
    return true;
  }

  /// @notice Transfers tokens to a specified address
  /// @param to The address to transfer tokens to
  /// @param value The amount of tokens to transfer
  /// @return A boolean indicating success
  function transfer(
    address to,
    uint256 value
  ) public virtual override returns (bool) {
    address owner = super._msgSender();
    _transfer(owner, to, value);
    return true;
  }

  // override internal OZ standard ERC20 functions related to transfer

  /// @notice Internal function to transfer tokens from one account to another
  /// @param from The address to transfer tokens from
  /// @param to The address to transfer tokens to
  /// @param amount The amount of tokens to transfer
  function _transfer(
    address from,
    address to,
    uint256 amount
  ) internal override {
    if (isReflective) {
      LibCommon.validateAddress(from);
      LibCommon.validateAddress(to);
      if (amount == 0) {
        revert ZeroTransferError();
      }

      if (_isRewardsExcluded[from] && !_isRewardsExcluded[to]) {
          _transferFromExcluded(from, to, amount);
      } else if (!_isRewardsExcluded[from] && _isRewardsExcluded[to]) {
          _transferToExcluded(from, to, amount);
      } else if (!_isRewardsExcluded[from] && !_isRewardsExcluded[to]) {
          _transferStandard(from, to, amount);
      } else if (_isRewardsExcluded[from] && _isRewardsExcluded[to]) {
          _transferBothExcluded(from, to, amount);
      } else {
          _transferStandard(from, to, amount);
      }
    } else {
      super._transfer(from, to, amount);
    }
  }

  /// @notice Internal function to mint new tokens, disallowed if reflection mechanism is used
  /// @param account The account to receive the minted tokens
  /// @param value The amount of tokens to mint
  function _mint(address account, uint256 value) internal override {
    if (isReflective) {
      revert MintingNotEnabled();
    } else {
      super._mint(account, value);
    }
  }

  /// @notice Internal function to burn tokens, disallowed if reflection mechanism is used
  /// @param account The account to burn tokens from
  /// @param value The amount of tokens to burn
  function _burn(address account, uint256 value) internal override {
    if (isReflective) {
      revert BurningNotEnabled();
    } else {
      super._burn(account, value);
    }
  }

  /// @notice Sets a new reflection fee
  /// @dev Should only be called by the contract owner
  /// @param _tFeeBPS The reflection fee in basis points
  function _setReflectionFee(uint256 _tFeeBPS) internal {
    if (!isReflective) {
      revert TokenIsNotReflective();
    }

    tFeeBPS = _tFeeBPS;
  }

  /// @notice Calculates the number of tokens from a reflection amount
  /// @param rAmount The reflection amount
  /// @return The number of tokens corresponding to the reflection amount
  function tokenFromReflection(uint256 rAmount) public view returns (uint256) {
    if (rAmount > _rTotal) {
      revert TotalReflectionTooSmall();
    }

    uint256 currentRate = _getRate();
    return rAmount / currentRate;
  }

  /// @notice Excludes an account from receiving rewards
  /// @param account The account to exclude from rewards
  function _excludeFromRewards(
    address account
  ) internal {
    if (!isReflective) {
      revert TokenIsNotReflective();
    }
    if (_isRewardsExcluded[account]) {
      revert AlreadyExcludedFromRewards();
    }
    if (rewardsExcluded.length >= MAX_REWARDS_EXCLUSION_LIMIT) {
      revert ReachedMaxRewardExclusionLimit();
    }

    if(_rOwned[account] > 0) {
        _tOwned[account] = tokenFromReflection(_rOwned[account]);
    }

    _isRewardsExcluded[account] = true;
    rewardsExcluded.push(account);

    emit ExcludedFromRewards(account);
  }

  /// @notice Includes an account to receive rewards
  /// @param account The account to include for rewards
  function _includeInRewards(address account) internal {
    if (!isReflective) {
      revert TokenIsNotReflective();
    }
    if (!_isRewardsExcluded[account]) {
      revert AlreadyIncludedInRewards();
    }

    for (uint256 i = 0; i < rewardsExcluded.length; i++) {
      if (rewardsExcluded[i] == account) {
        rewardsExcluded[i] = rewardsExcluded[rewardsExcluded.length - 1];
        _isRewardsExcluded[account] = false;
        _tOwned[account] = 0;
        rewardsExcluded.pop();
        emit IncludedInRewards(account);

        break;
      }
    }
  }

  /// @notice Transfers a standard amount of tokens with reflection applied
  /// @param sender The address sending the tokens
  /// @param recipient The address receiving the tokens
  /// @param tAmount The total token amount to transfer
  function _transferStandard(
    address sender,
    address recipient,
    uint256 tAmount
  ) private {
    uint256 tFee = calculateFee(tAmount, sender, recipient);
    uint256 tTransferAmount = tAmount - tFee;
    (uint256 rAmount, uint256 rFee, uint256 rTransferAmount) = _getRValues(
      tAmount,
      tFee,
      tTransferAmount
    );

    if (tAmount != 0) {
      _rUpdate(sender, recipient, rAmount, rTransferAmount);

      _reflectFee(rFee, tFee);
      emit Transfer(sender, recipient, tAmount);
    }
  }

  /// @notice Transfers a token amount from an excluded account
  /// @param sender The address sending the tokens
  /// @param recipient The address receiving the tokens
  /// @param tAmount The total token amount to transfer
  function _transferFromExcluded(
    address sender,
    address recipient,
    uint256 tAmount
  ) private {
    uint256 tFee = calculateFee(tAmount, sender, recipient);
    uint256 tTransferAmount = tAmount - tFee;
    (uint256 rAmount, uint256 rFee, uint256 rTransferAmount) = _getRValues(
      tAmount,
      tFee,
      tTransferAmount
    );

    if (tAmount != 0) {
      _rUpdate(sender, recipient, rAmount, rTransferAmount);
      _tOwned[sender] = _tOwned[sender] - (tAmount);

      _reflectFee(rFee, tFee);
      emit Transfer(sender, recipient, tAmount);
    }
  }

  /// @notice Transfers a token amount to an excluded account
  /// @param sender The address sending the tokens
  /// @param recipient The address receiving the tokens
  /// @param tAmount The total token amount to transfer
  function _transferToExcluded(
    address sender,
    address recipient,
    uint256 tAmount
  ) private {
    uint256 tFee = calculateFee(tAmount, sender, recipient);
    uint256 tTransferAmount = tAmount - tFee;
    (uint256 rAmount, uint256 rFee, uint256 rTransferAmount) = _getRValues(
      tAmount,
      tFee,
      tTransferAmount
    );

    if (tAmount != 0) {
      _rUpdate(sender, recipient, rAmount, rTransferAmount);
      _tOwned[recipient] = _tOwned[recipient] + (tTransferAmount);

      _reflectFee(rFee, tFee);
      emit Transfer(sender, recipient, tAmount);
    }
  }

  /// @notice Transfers a token amount between two excluded accounts
  /// @param sender The address sending the tokens
  /// @param recipient The address receiving the tokens
  /// @param tAmount The total token amount to transfer
  function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
    uint256 tFee = calculateFee(tAmount, sender, recipient);
    uint256 tTransferAmount = tAmount - tFee;
    (uint256 rAmount, uint256 rFee, uint256 rTransferAmount) = _getRValues(
      tAmount,
      tFee,
      tTransferAmount
    );

    if (tAmount != 0) {
      _rUpdate(sender, recipient, rAmount, rTransferAmount);
      _tOwned[sender] = _tOwned[sender] - (tAmount);
      _tOwned[recipient] = _tOwned[recipient] + (tTransferAmount);

      _reflectFee(rFee, tFee);
      emit Transfer(sender, recipient, tAmount);
    }
  }

  /// @notice Reflects the fee to all holders by deducting it from the total reflections
  /// @param rFee The reflection fee amount
  /// @param tFee The token fee amount
  function _reflectFee(uint256 rFee, uint256 tFee) private {
    _rTotal = _rTotal - rFee;
    _tFeeTotal = _tFeeTotal + tFee;
  }

  /// @notice Calculates the reflection fee from a token amount
  /// @param amount The token amount to calculate the fee from
  /// @param sender The address of the sender
  /// @param recipient The address of the recipient
  /// @return The calculated fee amount
  function calculateFee(uint256 amount, address sender, address recipient) private view returns (uint256) {
    if (_isRewardsExcluded[sender] || _isRewardsExcluded[recipient]) {
      return 0;
    } else {
      return (amount * tFeeBPS) / BPS_DIVISOR;
    }
  }

  /// @notice Transfers tokens without applying reflection fees
  /// @param from The address to transfer tokens from
  /// @param to The address to transfer tokens to
  /// @param tAmount The total token amount to transfer
  function _transferNonReflectedTax(
    address from,
    address to,
    uint256 tAmount
  ) internal {
    if (isReflective) {
      if (tAmount != 0) {
        uint256 currentRate = _getRate();
        uint256 rAmount = tAmount * currentRate;

        _rUpdate(from, to, rAmount, rAmount);
        emit Transfer(from, to, tAmount);
      }
    } else {
      super._transfer(from, to, tAmount);
    }
  }

  /// @notice Retrieves the reflection values from token values
  /// @param tAmount The token amount
  /// @param tFee The token fee amount
  /// @param tTransferAmount The transfer amount
  /// @return The reflection values (rAmount, rFee, rTransferAmount)
  function _getRValues(
    uint256 tAmount,
    uint256 tFee,
    uint256 tTransferAmount
  ) private view returns (uint256, uint256, uint256) {
    uint256 currentRate = _getRate();
    uint256 rAmount = tAmount * currentRate;
    uint256 rFee = tFee * currentRate;
    uint256 rTransferAmount = tTransferAmount * currentRate;

    return (rAmount, rFee, rTransferAmount);
  }

  /// @notice Retrieves the current reflection rate
  /// @return The current reflection rate
  function _getRate() private view returns (uint256) {
    (uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
    return rSupply / tSupply;
  }

  /// @notice Retrieves the current reflection and token supplies
  /// @return The current reflection and token supplies
  function _getCurrentSupply() private view returns (uint256, uint256) {
    return (_rTotal, _tTotal());
  }

  /// @notice Updates the reflection balances for a transfer
  /// @param sender The address sending the tokens
  /// @param recipient The address receiving the tokens
  /// @param rSubAmount The amount to be deducted from the sender
  /// @param rTransferAmount The amount to be added to the recipient
  function _rUpdate(
    address sender,
    address recipient,
    uint256 rSubAmount,
    uint256 rTransferAmount
  ) private {
    uint256 fromBalance = _rOwned[sender];
    if (fromBalance < rSubAmount) {
      revert ERC20InsufficientBalance(recipient, fromBalance, rSubAmount);
    }
    _rOwned[sender] = _rOwned[sender] - rSubAmount;
    _rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
  }
}
ERC20.sol 365 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * 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}.
     *
     * 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 default value returned by this function, unless
     * it's 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:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, 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}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, 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}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, 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) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, 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) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `from` to `to`.
     *
     * 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:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(address from, address to, uint256 amount) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
            // decrementing then incrementing.
            _balances[to] += amount;
        }

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, 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;
        unchecked {
            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
            _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;
            // Overflow not possible: amount <= accountBalance <= totalSupply.
            _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 Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - 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 {}
}
IERC20.sol 78 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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);

    /**
     * @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 `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, 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 `from` to `to` 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 from, address to, uint256 amount) external returns (bool);
}
IERC20Metadata.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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);
}

Read Contract

CONTRACT_HASH 0xbfcf7355 → bytes32
CONTRACT_NAME 0x614d08f8 → string
MAX_EXCLUSION_LIMIT 0x5514c832 → uint256
MAX_REWARDS_EXCLUSION_LIMIT 0x49a602db → uint256
VERSION 0xffa1ad74 → string
_tTotal 0xaf465a27 → uint256
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
decimals 0x313ce567 → uint8
deflationBPS 0x542e9667 → uint256
documentUri 0x044ab74e → string
feesAndLimitsExcluded 0x00af2d9d → address
getFeesAndLimitsExclusionList 0x93fbda99 → address[]
getRewardsExclusionList 0x154af8e7 → address[]
initialDocumentUri 0xa9d86685 → string
initialMaxTokenAmountPerAddress 0xa32f6976 → uint256
initialSupply 0x378dc3dc → uint256
initialTokenOwner 0x8dac7191 → address
isBurnable 0x883356d9 → bool
isDeflationary 0x8e8c10a2 → bool
isDocumentUriAllowed 0xf820f567 → bool
isFeesAndLimitsExcluded 0x4a88266c → bool
isMaxAmountOfTokensSet 0x5a3990ce → bool
isMaxSupplySet 0xde0060ca → bool
isMintable 0x46b45af7 → bool
isReflective 0x2e0ee48e → bool
isTaxable 0x4ac0bc32 → bool
maxTokenAmountPerAddress 0xd48e4127 → uint256
maxTotalSupply 0x2ab4d052 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
rewardsExcluded 0x23bbbd6a → address
symbol 0x95d89b41 → string
tFeeBPS 0x9703a19d → uint256
taxAddress 0xb7bda68f → address
taxBPS 0x2fa782eb → uint256
tokenFromReflection 0x2d838119 → uint256
totalSupply 0x18160ddd → uint256

Write Contract 18 functions

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

approve 0x095ea7b3
address spender
uint256 amount
returns: bool
burn 0x42966c68
uint256 amount
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
excludeFromFeesAndLimits 0xf8afaba5
address account
excludeFromRewards 0x111e0376
address account
includeInFeesAndLimits 0x0bd92756
address account
includeInRewards 0xb609995e
address account
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
mint 0x40c10f19
address to
uint256 amount
renounceOwnership 0x715018a6
No parameters
setDeflationConfig 0xd8f67851
uint256 _deflationBPS
setDocumentUri 0xa476df61
string newDocumentUri
setMaxTokenAmountPerAddress 0x02252c4d
uint256 newMaxTokenAmount
setReflectionConfig 0xf91f825d
uint256 _feeBPS
setTaxConfig 0xf19c4e3b
address _taxAddress
uint256 _taxBPS
transfer 0xa9059cbb
address to
uint256 amount
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 amount
returns: bool
transferOwnership 0xf2fde38b
address newOwner

Recent Transactions

No transactions found for this address