Address Contract Verified
Address
0x23b586C0e79fb291ccb0244D468847EaE9Bb90f6
ENS Name
r4re-contract.eth
Balance
0 ETH
Nonce
1
Code Size
10291 bytes
Creator
0x68D1b53C...4c28 at tx 0x541ad195...e1e5b7
Indexed Transactions
0
Contract Bytecode
10291 bytes
0x608060408181526004908136101561001f575b505050361561001d57005b005b600092833560e01c90816306fdde03146117745750806308695b41146116d95780630902f1ac146116a2578063095ea7b3146116715780631419841d146115e85780631694505e146115c057806318160ddd146115a157806323b872dd146113c457806328b13b61146113a7578063299bd19314611383578063313ce567146113675780633ccfd60b1461130e57806349bd5a5e146112e65780634f7041a5146112be57806356cf37b7146112875780636b34f554146110d75780636ff732011461108457806370a082311461104e578063715018a614610ff3578063786f17d714610ea35780638119c06514610e475780638da5cb5b14610e1f5780638f3fa86014610dfb57806395d89b4114610cde578063961d3cd314610c6057806398118cb414610c38578063a29a608914610b96578063a9059cbb146109a7578063b319c6b714610988578063bb1789d614610824578063bdc75762146107e6578063bea1dcf8146107be578063cba0e99614610782578063cc1776d31461075a578063d4f46716146105ae578063db932ae21461047a578063dd62ed3e1461042d578063e20cb19e146103d4578063f2fde38b146103325763f45e90c603610012573461032e57602036600319011261032e576101f96118db565b916102026121fd565b600a549060025463ffffffff8360081c16116102a4575064ffffffff001916600883901b64ffffffff001617600a558051692a30bc102330b1ba37b960b11b90525163ffffffff90911680825260208201527fea23f88d5ba80dfbee969efaa89e1cf77bafbaad839cc9eb7e4b14e16d71cc0e907f97d4140ef4441bb58ac55974ae7dbbd537f34a138c046ce2c064f37c02d916279080604081015b0390a280f35b60e4908380519163674604c960e11b8352820152600a6044820152692a30bc102330b1ba37b960b11b606482015260806024820152602560848201527f54617820666163746f722063616e6e6f742065786365656420746f74616c207360a48201527f7570706c7900000000000000000000000000000000000000000000000000000060c4820152fd5b8280fd5b50903461032e57602036600319011261032e5761034d6118aa565b906103566121fd565b6001600160a01b038092169283156103a5575050600554826001600160a01b0319821617600555167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b908460249251917f1e4fbdf7000000000000000000000000000000000000000000000000000000008352820152fd5b833461042a578060031936011261042a576103ed6121fd565b600a5460ff8082161516809160ff191617600a5515157f1ee0a4785bcc74a35dc388f433bcfa0f5e2a6ec23f639e0ffd3bebaef6b2320c8280a280f35b80fd5b8382346104765780600319360112610476578060209261044b6118aa565b6104536118c5565b6001600160a01b0391821683526001865283832091168252845220549051908152f35b5080fd5b503461032e57602036600319011261032e576104946118db565b61049c6121fd565b600a549163ffffffff93848460081c168584161161054e575068ffffffff0000000000198316602883811b68ffffffff00000000001691909117600a55815166084eaf240a8c2f60cb1b9052905163ffffffff9390911c909316821683521660208201527f277116d2fcddc7b92723dd54c3316df20c2a86ab5034e94a9a9686f670417ff2907f0a3f97784e6e6c10ef94d1ce709c6ecb248f5f3a223eaa40823d45b34eabb1aa90806040810161029e565b8160c492519163674604c960e11b83528201526007604482015266084eaf240a8c2f60cb1b606482015260806024820152602060848201527f427579207461782063616e6e6f74206578636565642074617820666163746f7260a4820152fd5b503461032e57602036600319011261032e576105c86118db565b6105d06121fd565b6002549263ffffffff93848316116106bd5750917f97d4140ef4441bb58ac55974ae7dbbd537f34a138c046ce2c064f37c02d916279161029e7f7a87c450164f3e4adbcbcd47a104ded23ee565f45f5a2e4b750c4875fbeb0478946007549277ffffffff00000000000000000000000000000000000000008260a01b167fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff8516176007557f4d61782057616c6c657420466163746f720000000000000000000000000000008151525193849360a01c168390602090939293604083019463ffffffff809216845216910152565b60e4908380519163674604c960e11b8352820152601160448201527f4d61782077616c6c657420666163746f72000000000000000000000000000000606482015260806024820152602c60848201527f4d61782077616c6c657420666163746f722063616e6e6f74206578636565642060a48201527f746f74616c20737570706c79000000000000000000000000000000000000000060c4820152fd5b83823461047657816003193601126104765760209063ffffffff600a5460481c169051908152f35b8382346104765760203660031901126104765760ff816020936001600160a01b036107ab6118aa565b168152600c855220541690519015158152f35b8382346104765781600319360112610476576020906001600160a01b03600b54169051908152f35b50903461032e578160031936011261032e576024359063ffffffff821682036108205790610814913561218e565b82519182526020820152f35b8380fd5b503461032e57602036600319011261032e5761083e6118db565b6108466121fd565b600a549163ffffffff93848460081c168584161161090157506cffffffff000000000000000000198316604883811b6cffffffff0000000000000000001691909117600a558151670a6cad8d840a8c2f60c31b9052905163ffffffff9390911c909316821683521660208201527fb888ae9d8008b71fedf1d337fe9a3cd33b6f60ee6dc909c75346200b05299450907f0a3f97784e6e6c10ef94d1ce709c6ecb248f5f3a223eaa40823d45b34eabb1aa90806040810161029e565b8160e492519163674604c960e11b835282015260086044820152670a6cad8d840a8c2f60c31b606482015260806024820152602160848201527f53656c6c207461782063616e6e6f74206578636565642074617820666163746f60a48201527f720000000000000000000000000000000000000000000000000000000000000060c4820152fd5b8382346104765781600319360112610476576020906009549051908152f35b50903461032e578160031936011261032e576109c16118aa565b602435903315610b87576001600160a01b0381168015610b785733865284602096600c885260ff82822054161580610b69575b610b29575b610a0233612228565b80610b14575b610ab6575b828152600c885260ff828220541615610a7a575b610a489550338152600c885260ff82822054161580610a69575b610a51575b5050506120b0565b90519015158152f35b33815260088852818120549281522055388481610a40565b5082815260ff828220541615610a3b565b809293949591508752610a908587842054611a14565b610a98612098565b10610aa857509084849392610a21565b855163d873da4960e01b8152fd5b9050610ac0612040565b8411610b055781815260088752610add8682205460095490611a14565b4210610af6578082879252600888524282822055610a0d565b84865163b94483e160e01b8152fd5b848651633f59fe5760e11b8152fd5b50828152600c885260ff828220541615610a08565b9050610b33612040565b8411610b055733815260088752610b508682205460095490611a14565b4210610af65785903381526008885242828220556109f9565b50610b7384612228565b6109f4565b838551633a954ecd60e21b8152fd5b828451630b07e54560e11b8152fd5b50903461032e57602036600319011261032e57610bb16118aa565b90610bba6121fd565b6001600160a01b03809216928315610c09575050600754826001600160a01b0319821617600755167f32e65821e4609464dd250a7fcb47fd6fdbfed51fc2b69d819832d61453cde55c8380a380f35b908460249251917fc1dd8fa0000000000000000000000000000000000000000000000000000000008352820152fd5b83823461047657816003193601126104765760209063ffffffff600a5460681c169051908152f35b838234610476578060031936011261047657610c7a6118aa565b60243590811515809203610820577ff3a7c8242f0708821ed31a47f066fc7fa42f2ae65ed3e4d1d7cb5b3765d2939c916001600160a01b03602092610cbd6121fd565b1693848652600c835280862060ff1981541660ff841617905551908152a280f35b50823461042a578060031936011261042a578151918184549260018460011c9160018616958615610df1575b6020968785108114610dde579087899a92868b999a9b529182600014610db4575050600114610d59575b8588610d5589610d46848a03856118ee565b5192828493845283019061186a565b0390f35b815286935091907f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b828410610d9c5750505082010181610d46610d5588610d34565b8054848a018601528895508794909301928101610d82565b60ff19168882015294151560051b87019094019450859350610d469250610d559150899050610d34565b60248360228c634e487b7160e01b835252fd5b92607f1692610d0a565b838234610476578160031936011261047657602090610e18612098565b9051908152f35b8382346104765781600319360112610476576020906001600160a01b03600554169051908152f35b838234610476578160031936011261047657610e7490610e656121fd565b3083528260205282205461246b565b610e7c61263e565b7f3ebfdaaf4031bec9a2b7b0a1c594d2d03f3d0b8d68531c9164c2829bac00fefa8180a180f35b503461032e57602036600319011261032e57610ebd6118db565b610ec56121fd565b600a549163ffffffff93848460081c1685841611610f9457507fffffffffffffffffffffffffffffff00000000ffffffffffffffffffffffffff8316606883811b70ffffffff000000000000000000000000001691909117600a55815165098a040a8c2f60d31b9052905163ffffffff9390911c909316821683521660208201527f7d304c7695ddaddd328f5c4f42cbeaf237cfb1e87941b598b9324d346841cfa8907f0a3f97784e6e6c10ef94d1ce709c6ecb248f5f3a223eaa40823d45b34eabb1aa90806040810161029e565b8160c492519163674604c960e11b83528201526006604482015265098a040a8c2f60d31b606482015260806024820152601f60848201527f4c50207461782063616e6e6f74206578636565642074617820666163746f720060a4820152fd5b833461042a578060031936011261042a5761100c6121fd565b806001600160a01b036005546001600160a01b03198116600555167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b83823461047657602036600319011261047657806020926001600160a01b036110756118aa565b16815280845220549051908152f35b503461032e57602036600319011261032e577f4ee50c92f8b1c553d200a0c383ed3026fad1a314380364319d56211aa260d09291356110c16121fd565b600954908060095582519182526020820152a180f35b503461032e57602036600319011261032e576110f16118db565b6110f96121fd565b6002549263ffffffff93848316116111ea5750917f97d4140ef4441bb58ac55974ae7dbbd537f34a138c046ce2c064f37c02d916279161029e7f770b4fa5f5e16b8257498bdfed61327d77bfb5919c4bfa5b177e247d44c1002c94600754927bffffffff0000000000000000000000000000000000000000000000008260c01b167fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff8516176007557f4d6178205472616e73616374696f6e20466163746f72000000000000000000008151525193849360c01c168390602090939293604083019463ffffffff809216845216910152565b60e4908380519163674604c960e11b8352820152601660448201527f4d6178207472616e73616374696f6e20666163746f7200000000000000000000606482015260806024820152603160848201527f4d6178207472616e73616374696f6e20666163746f722063616e6e6f7420657860a48201527f6365656420746f74616c20737570706c7900000000000000000000000000000060c4820152fd5b83823461047657602036600319011261047657806020926001600160a01b036112ae6118aa565b1681526008845220549051908152f35b83823461047657816003193601126104765760209063ffffffff600a5460281c169051908152f35b8382346104765781600319360112610476576020906001600160a01b03600754169051908152f35b503461032e578260031936011261032e576113276121fd565b8280808047335af1611337612058565b5015611341578280f35b517fbaa89171000000000000000000000000000000000000000000000000000000008152fd5b8382346104765781600319360112610476576020905160128152f35b83823461047657816003193601126104765760209060ff600a541690519015158152f35b838234610476578160031936011261047657602090610e18612040565b503461032e57606036600319011261032e576113de6118aa565b6113e66118c5565b604435916001600160a01b0380821690811561159257831690811561158357808852602096600c885260ff878a2054161580611574575b611538575b61142b84612228565b80611523575b6114cb575b828952600c885260ff878a2054161561149f575b50948786610a489783999a52600c8a5260ff8383205416158061148e575b611476575b50505050611a57565b8152600889528181205492815220553885818061146d565b5083825260ff838320541615611468565b8888526114af86888b2054611a14565b6114b7612098565b101561144a57865163d873da4960e01b8152fd5b6114d3612040565b861161151557828952600888526114f0878a205460095490611a14565b4210611507578289526008885242878a2055611436565b865163b94483e160e01b8152fd5b8651633f59fe5760e11b8152fd5b50828952600c885260ff878a20541615611431565b611540612040565b8611611515578189526008885261155d878a205460095490611a14565b4210611507578189526008885242878a2055611422565b5061157e85612228565b61141d565b868651633a954ecd60e21b8152fd5b868651630b07e54560e11b8152fd5b8382346104765781600319360112610476576020906002549051908152f35b8382346104765781600319360112610476576020906001600160a01b03600654169051908152f35b50903461032e57602036600319011261032e576116036118aa565b9061160c6121fd565b6001600160a01b0380921692831561165b575050600654826001600160a01b0319821617600655167ffa4937d0799f87945796348ce98077a83f6a274d6a88335536792683985cd3258380a380f35b90846024925191637eff088160e01b8352820152fd5b83823461047657806003193601126104765760209061169b6116916118aa565b60243590336126e6565b5160018152f35b50823461042a578060031936011261042a57606063ffffffff836116c4611941565b90839492945194855260208501521690820152f35b50919034610476576020366003190112610476576116f56118aa565b92600b546001600160a01b038082169333850361175d57506001600160a01b03199495169384911617600b55828452600c6020528320600160ff198254161790557f92b0a6c35a7725942f911dadba0d72be31d02967844649a1beb00efae0c195698380a380f35b60249084519063118cdaa760e01b82523390820152fd5b9184915034610476578160031936011261047657816003549260018460011c9160018616958615611860575b6020968785108114610dde578899509688969785829a5291826000146118395750506001146117dd575b505050610d559291610d469103856118ee565b9190869350600383527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b8284106118215750505082010181610d46610d556117ca565b8054848a018601528895508794909301928101611808565b60ff19168782015293151560051b86019093019350849250610d469150610d5590506117ca565b92607f16926117a0565b919082519283825260005b848110611896575050826000602080949584010152601f8019910116010190565b602081830181015184830182015201611875565b600435906001600160a01b03821682036118c057565b600080fd5b602435906001600160a01b03821682036118c057565b6004359063ffffffff821682036118c057565b90601f8019910116810190811067ffffffffffffffff82111761191057604052565b634e487b7160e01b600052604160045260246000fd5b51906dffffffffffffffffffffffffffff821682036118c057565b60049060606001600160a01b0360075416604051938480927f0902f1ac0000000000000000000000000000000000000000000000000000000082525afa908115611a08576000809381936119a9575b506dffffffffffffffffffffffffffff80911693169190565b925092506060823d606011611a00575b816119c6606093836118ee565b8101031261032e576119d782611926565b60406119e560208501611926565b9301519363ffffffff8516850361042a575091929138611990565b3d91506119b9565b6040513d6000823e3d90fd5b91908201809211611a2157565b634e487b7160e01b600052601160045260246000fd5b8115611a41570490565b634e487b7160e01b600052601260045260246000fd5b9291906000936001600160a01b03806007541690808316918214611fa357806007541681851614611a92575050611a8f939450612251565b90565b81600052602096600c885260409060ff82600020541615611f9b575b15611f8d57611aca63ffffffff9687600a5460481c169061218e565b92909683611ae3575b5050505050611a8f939450612251565b611aee843088612336565b600a5460ff1615611f4157611b2c903060005260008b52611b1b846000205491600a5460681c168261218e565b6002811015611f2c575b505061246b565b60ff600a5416611b78575b50967f9174fcf222375951e43519967bd54a1083271e61dab0b523b644cdf98c975f3491611a8f9798611b6861263e565b51908152a2849338808080611ad3565b30600052600089528160002054906000611b90611941565b5090918415611f035782158015611efb575b611ed25760048d85600754168851928380927f0dfe16810000000000000000000000000000000000000000000000000000000082525afa918215611ec757908e8693611e9a575b5050163014600014611e875790611c03611c08928561216e565b611a37565b905b8351838152602081018390524760408201527f2f5621f2b7bdf78b7b6c286d6572447868217a52b7dce9881a3b09be941bd94690606090a1814711611c51575b5050611b37565b80600654168015611e705783611c6791306126e6565b806006541690600b541690610258420193844211611a215760609360c492875196879586947ff305d71900000000000000000000000000000000000000000000000000000000865230600487015260248601526000604486015260006064860152608485015260a48401525af19060008281928294611e2f575b50917f9174fcf222375951e43519967bd54a1083271e61dab0b523b644cdf98c975f34959391611a8f9b9c959315600014611dee575050506001600060033d11611ddc575b6308c379a014611d85575b611d40575b9198978193611c4a565b7f1720a75363f50383662268a09272021aa57d321b3e621a8e19d508964230c3d1611d7d611d6c612058565b83519182918783528783019061186a565b0390a1611d36565b611d8d612677565b80611d99575b50611d31565b90507f16f910bbc684c1469a47cc2b21887a6e1cf0c0a2b1ee03b4539c3a5cbd7e0e20611dd360009284519182918883528883019061186a565b0390a138611d93565b5060046000803e60005160e01c611d26565b611d7d7fd7f28048575eead8851d024ead087913957dfb4fd1a02b4d1573f5352a5a2be3938551938493846040919493926060820195825260208201520152565b925092506060823d606011611e68575b81611e4c606093836118ee565b8101031261042a575080518a8201519184015192611a8f611ce1565b3d9150611e3f565b60248551637eff088160e01b815260006004820152fd5b611c03611e94928561216e565b90611c0a565b611eb99250803d10611ec0575b611eb181836118ee565b81019061244c565b388e611be9565b503d611ea7565b8751903d90823e3d90fd5b600486517f7bba511d000000000000000000000000000000000000000000000000000000008152fd5b508115611ba2565b600486517f98e3e2c5000000000000000000000000000000000000000000000000000000008152fd5b611f3a925060011c90611a14565b3880611b25565b5050967f9174fcf222375951e43519967bd54a1083271e61dab0b523b644cdf98c975f3491611a8f97983060005260008352611f80816000205461246b565b611f8861263e565b611b68565b505050611a8f939450612251565b506001611aae565b905082959394951692838152600c60205260ff60408220541615612038575b1561202d57611fe0611a8f9463ffffffff600a5460281c169061218e565b80949194611ff0575b5050612251565b60208161201f7f9174fcf222375951e43519967bd54a1083271e61dab0b523b644cdf98c975f34933087612336565b604051908152a23880611fe9565b611a8f939250612251565b506001611fc2565b611a8f60025463ffffffff60075460c01c1690611a37565b3d15612093573d9067ffffffffffffffff82116119105760405191612087601f8201601f1916602001846118ee565b82523d6000602084013e565b606090565b611a8f60025463ffffffff60075460a01c1690611a37565b9060006001600160a01b03806007541633146120d75750506120d29133612777565b600190565b8316600052600c60205260ff6040600020541615612166575b1561215c579061210f6120d29263ffffffff600a5460281c169061218e565b8092919261211f575b5033612777565b61212a813033612336565b6040519081527f9174fcf222375951e43519967bd54a1083271e61dab0b523b644cdf98c975f3460203392a238612118565b6120d29133612777565b5060016120f0565b81810292918115918404141715611a2157565b91908203918211611a2157565b919063ffffffff80911680156121f6576121a8818561216e565b91600a5460081c168092106121d3576121cf91611c036121c8928661216e565b8093612181565b9190565b505090600281106000146121e75790600090565b906121cf8260011c8093612181565b5050600090565b6001600160a01b0360055416330361221157565b602460405163118cdaa760e01b8152336004820152fd5b6006546001600160a01b03918216908216811491821561224757505090565b6007541614919050565b9291906001600160a01b038416936000858152600160205260409586822033835260205286822054906000198203612292575b5050506120d2939450612777565b8582106122f85780156122e15733156122ca576120d29697918691845260016020528284203385526020520391205584933880612284565b602483895190634a1406b160e11b82526004820152fd5b60248389519063e602df0560e01b82526004820152fd5b87517ffb8f41b20000000000000000000000000000000000000000000000000000000081523360048201526024810183905260448101879052606490fd5b6001600160a01b03808216929091836123b057507fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9160209161237b86600254611a14565b6002555b1693846123985780600254036002555b604051908152a3565b8460005260008252604060002081815401905561238f565b6000908482528160205260408220549086821061240157509181604087602095887fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9896528387520391205561237f565b6040517fe450d38c0000000000000000000000000000000000000000000000000000000081526001600160a01b03919091166004820152602481019190915260448101869052606490fd5b908160209103126118c057516001600160a01b03811681036118c05790565b6001600160a01b0380600654168015612626578261248991306126e6565b604090815192606084019167ffffffffffffffff92858110848211176119105784526002855260209081860191853684378651156125e6573083528160065416938651917fad5c46480000000000000000000000000000000000000000000000000000000083528083600481895afa92831561261b576000936125fc575b50885192600193600110156125e6578416888a0152610258420193844211611a2157863b156118c057918899959493919951998a967f791ac94700000000000000000000000000000000000000000000000000000000885260a488019260048901526000602489015260a060448901525180925260c4870195936000905b8382106125cc575050505050506000838195938193306064840152608483015203925af180156125c1576125b857505050565b82116119105752565b82513d6000823e3d90fd5b8551811688528c9850968201969482019490840190612585565b634e487b7160e01b600052603260045260246000fd5b816126149294503d8511611ec057611eb181836118ee565b9138612507565b88513d6000823e3d90fd5b6024604051637eff088160e01b815260006004820152fd5b478015801561264b575050565b600080809381936001600160a01b03600b541690839061266e575bf115611a0857565b506108fc612666565b600060443d10611a8f57604051600319913d83016004833e815167ffffffffffffffff918282113d6024840111176126d5578184019485519384116126dd573d850101602084870101116126d55750611a8f929101602001906118ee565b949350505050565b50949350505050565b6001600160a01b0380911691821561275f57169182156127475760207f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925918360005260018252604060002085600052825280604060002055604051908152a3565b6024604051634a1406b160e11b815260006004820152fd5b602460405163e602df0560e01b815260006004820152fd5b91906001600160a01b03808416156127cc5781161561279b5761279992612336565b565b60246040517fec442f0500000000000000000000000000000000000000000000000000000000815260006004820152fd5b60246040517f96c6fd1e00000000000000000000000000000000000000000000000000000000815260006004820152fdfea2646970667358221220a5bf66f5666b55eccbf9edd0e78382b2b919dd26d1b5e0ae8c3aa11caafacc0e64736f6c63430008170033
Verified Source Code Full Match
Compiler: v0.8.23+commit.f704f362
EVM: paris
Optimization: Yes (1000 runs)
R4RE.sol 763 lines
// SPDX-License-Identifier: MIT
// Author: A.P
// Organization: Rare Art
// Development: Kibernacia
// Product: R4RE
// Version: 1.0.0
// Link: https://linktr.ee/rareuniverse
pragma solidity >=0.8.23 <0.9.0;
// OpenZeppelin
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
// Uniswap V2
import {IUniswapV2Factory} from "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol";
import {IUniswapV2Router02} from "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
// R4RE
import {R4REPool} from "./R4REPool.sol";
contract R4RE is ERC20, Ownable, R4REPool {
/// @notice Stores token name.
/// @dev Stores constant string.
string private constant _NAME = "R4RE";
/// @notice Stores token symbol.
/// @dev Stores constant string.
string private constant _SYMBOL = "R4RE";
/// @notice Stores max wallet factor.
/// @dev Stores number.
uint32 private _maxWalletFactor = 50;
/// @notice Stores max transaction factor.
/// @dev Stores number.
uint32 private _maxTransactionFactor = 50;
/// @notice Stores time-based restriction per address.
/// @dev Stores map from address to timestamp.
mapping(address => uint256) public lastTransactionTimestamp;
/// @notice Stores cooldown time per address.
/// @dev Stores timestamp.
uint256 public cooldownTime = 5 seconds;
/// @notice Indicates whether automatic liquidity provision to the pool is enabled.
/// @dev Set to `true` by default, allowing the contract to automatically add liquidity. This can be toggled to enable or disable the feature.
bool public autoLiquidityProviding = true;
/// @notice Stores tax factor.
/// @dev Stores number.
uint32 private _taxFactor = 100;
/// @notice Stores buy tax.
/// @dev Stores number.
uint32 public buyTax = 6; // 6.00% (default)
/// @notice Stores sell tax.
/// @dev Stores number.
uint32 public sellTax = 6; // 6.00% (default)
/// @notice Defines the fee percentage for liquidity provision.
/// @notice LP tax will be fractionated from both buy and sell tax.
/// @dev Stored number.
uint32 public liquidityFee = 50; // 50.00% (default)
/// @notice Stores tax collecting address.
/// @dev Stores address.
address payable public taxCollector;
/// @notice Stores excluded from fee addresses.
/// @dev Stores map from address to bool.
mapping(address => bool) public isExcluded;
constructor(
uint256 initialSupply
) ERC20(_NAME, _SYMBOL) Ownable(_msgSender()) {
// Create token supply
_mint(_msgSender(), initialSupply);
// Set tax collection address
taxCollector = payable(_msgSender());
// Setup uniswap v2 router
uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
// Set uniswap v2 factory
IUniswapV2Factory uniswapV2Factory = IUniswapV2Factory(
uniswapV2Router.factory()
);
// Create uniswap v2 pair
uniswapV2Pair = uniswapV2Factory.createPair(
address(this),
uniswapV2Router.WETH()
);
// Exclude owner, contract, uniswap v2 router and pair from fees by default
isExcluded[_msgSender()] = true;
isExcluded[address(this)] = true;
isExcluded[address(uniswapV2Router)] = true;
isExcluded[uniswapV2Pair] = true;
}
// Modifiers
/**
* @dev Throws if called by any account other than the tax collector.
*/
modifier onlyTaxCollector() {
if (taxCollector != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
_;
}
/**
* @dev Throws if transaction conditions are not valid.
* @param from The address to which tokens are being transferred.
* @param to The address to which tokens are being transferred.
* @param value The amount of tokens being transferred.
*/
modifier validateTransfer(
address from,
address to,
uint256 value
) {
// Validation
if (from == address(0)) {
revert TransferFromZeroAddress();
}
if (to == address(0)) {
revert TransferToZeroAddress();
}
if (!isExcluded[from] && isUniswap(to)) {
// Max transaction size validation
if (value > maxTransactionSize()) {
revert MaxTransactionSizeExceeded();
}
// Time-based restriction validation
uint256 timestamp = lastTransactionTimestamp[from];
uint256 restriction = timestamp + cooldownTime;
if (block.timestamp < restriction) {
revert TransferTimeRestriction();
}
// Set timestamp
lastTransactionTimestamp[from] = block.timestamp;
}
if (isUniswap(from) && !isExcluded[to]) {
// Max transaction size validation
if (value > maxTransactionSize()) {
revert MaxTransactionSizeExceeded();
}
// Time-based restriction validation
uint256 timestamp = lastTransactionTimestamp[to];
uint256 restriction = timestamp + cooldownTime;
if (block.timestamp < restriction) {
revert TransferTimeRestriction();
}
// Set timestamp
lastTransactionTimestamp[to] = block.timestamp;
}
if (!isExcluded[to]) {
// Max wallet size validation
if ((balanceOf(to) + value) > maxWalletSize()) {
revert MaxWalletSizeExceeded();
}
}
// Cooldown transfer
if (!isExcluded[from] && !isExcluded[to]) {
lastTransactionTimestamp[to] = lastTransactionTimestamp[from];
}
_;
}
/**
* @dev Overrides transfer function to add custom logic for trading protections and taxes.
* @notice This function is used to transfer tokens with additional features such as trading protections and taxes.
* @param to The address to which tokens are transferred.
* @param value The amount of tokens to be transferred.
* @return A boolean that indicates whether the operation succeeded.
*/
function transfer(
address to,
uint256 value
) public override validateTransfer(_msgSender(), to, value) returns (bool) {
// Parameters
uint256 amountAfterTax = value;
uint256 taxedAmount = 0;
bool deductTax = false;
// Swap Token to ETH
if (_msgSender() == uniswapV2Pair) {
// Verification
if (!isExcluded[to]) {
deductTax = true;
}
if (deductTax) {
// Taxation
(amountAfterTax, taxedAmount) = calculateTax(value, buyTax);
// Collect tax
if (taxedAmount > 0) {
// Update
super._update(_msgSender(), address(this), taxedAmount);
// Event
emit Taxed(_msgSender(), taxedAmount);
}
return super.transfer(to, amountAfterTax);
} else {
return super.transfer(to, value);
}
}
return super.transfer(to, value);
}
/**
* @dev Overrides transferFrom function to add custom logic for trading protections and taxes.
* @notice This function is used to transfer tokens from one address to another with additional features such as trading protections and taxes.
* @param from The address from which tokens are transferred.
* @param to The address to which tokens are transferred.
* @param value The amount of tokens to be transferred.
* @return A boolean that indicates whether the operation succeeded.
*/
function transferFrom(
address from,
address to,
uint256 value
) public override validateTransfer(from, to, value) returns (bool) {
// Parameters
uint256 amountAfterTax = value;
uint256 taxedAmount = 0;
bool deductTax = false;
// Swap ETH to Token
if (from == uniswapV2Pair) {
// Verification
if (!isExcluded[to]) {
deductTax = true;
}
if (deductTax) {
// Taxation
(amountAfterTax, taxedAmount) = calculateTax(value, buyTax);
// Collect tax
if (taxedAmount > 0) {
// Update
super._update(from, address(this), taxedAmount);
// Event
emit Taxed(to, taxedAmount);
}
return super.transferFrom(from, to, amountAfterTax);
} else {
return super.transferFrom(from, to, value);
}
}
// Swap Token to ETH
if (to == uniswapV2Pair) {
// Verification
if (!isExcluded[from]) {
deductTax = true;
}
if (deductTax) {
// Taxation
(amountAfterTax, taxedAmount) = calculateTax(value, sellTax);
// Collect tax
if (taxedAmount > 0) {
// Update
super._update(from, address(this), taxedAmount);
if (autoLiquidityProviding) {
// Tax
uint256 amountTax = 0;
uint256 amountLiquidity = 0;
uint256 amountSwap = balanceOf(address(this));
// Distribution
(amountTax, amountLiquidity) = calculateTax(
balanceOf(address(this)),
liquidityFee
);
// Validation
if (amountLiquidity >= 2) {
amountSwap = amountTax + amountLiquidity / 2;
}
// Swap
swapTokensForEth(amountSwap);
if (autoLiquidityProviding) {
// Distribution
uint amountToken = balanceOf(address(this));
uint amountETH = quote(amountToken);
emit Quote(
amountToken,
amountETH,
address(this).balance
);
// Add Liquidity
if (address(this).balance > amountETH) {
addLiquidity(amountToken, amountETH);
}
}
// Distribute
transferTax();
} else {
// Swap
swapTokensForEth(balanceOf(address(this)));
// Distribute
transferTax();
}
// Event
emit Taxed(from, taxedAmount);
}
return super.transferFrom(from, to, amountAfterTax);
} else {
return super.transferFrom(from, to, value);
}
}
return super.transferFrom(from, to, value);
}
/**
* @dev Checks if the given address is either the Uniswap V2 Router or the Uniswap V2 Pair.
* @param sender The address to be checked.
* @return Whether the address is associated with Uniswap.
*/
function isUniswap(address sender) private view returns (bool) {
return sender == address(uniswapV2Router) || sender == uniswapV2Pair;
}
/**
* @notice Returns the max wallet size per address.
* @dev Returns a number calculated based on supply divided by the factor.
*/
function maxWalletSize() public view returns (uint256) {
return totalSupply() / _maxWalletFactor;
}
/**
* @notice Returns the max transaction size per transfer.
* @dev Returns a number calculated based on supply divided by the factor.
*/
function maxTransactionSize() public view returns (uint256) {
return totalSupply() / _maxTransactionFactor;
}
/**
* @dev Calculates the amount after applying a tax to the given amount.
* @param amount The original amount on which tax is to be applied.
* @param tax The tax rate to be applied, represented as a percentage (e.g., 5 for 5%).
* @return amountAfterTax The amount after applying the tax.
* @return taxedAmount The calculated tax amount.
*
* @notice This function is a view function, meaning it does not modify the state of the contract.
* @notice If the tax is set to 0, the original amount is returned with no tax applied.
* @notice If the product of amount and tax is less than a predefined factor (_taxFactor),
* the tax is considered negligible and the amount is returned with no tax applied.
* @notice If the original amount is less than 2, no tax is applied, and the original amount is returned.
* @notice If none of the above conditions are met, the tax is calculated and subtracted from the original amount.
*/
function calculateTax(
uint256 amount,
uint32 tax
) public view returns (uint256 amountAfterTax, uint256 taxedAmount) {
// Validation Zero Tax
if (tax == 0) return (amount, 0);
// Validation Small Amount
if ((amount * tax) < _taxFactor) {
if (amount < 2) {
return (amount, 0);
} else {
taxedAmount = amount / 2;
amountAfterTax = amount - taxedAmount;
return (amountAfterTax, taxedAmount);
}
}
taxedAmount = (amount * tax) / _taxFactor;
amountAfterTax = amount - taxedAmount;
return (amountAfterTax, taxedAmount);
}
/**
* @dev Sets a new tax collector for the contract.
* @param newTaxCollector The address of the new tax collector.
*
* @notice This function is external and can be called by anyone, but it is restricted to only the current tax collector.
* @notice Only the current tax collector has the authority to set a new tax collector.
* @notice The new tax collector's address is stored, and the old tax collector is replaced with the new one.
* @notice The new tax collector is marked as excluded to prevent taxation on themselves.
* @notice Emits a TaxCollectorModified event with details about the modification, including the old and new tax collector's addresses.
*/
function setTaxCollector(
address newTaxCollector
) external onlyTaxCollector {
// Set
address oldTaxCollector = taxCollector;
taxCollector = payable(newTaxCollector);
// Exclude
isExcluded[newTaxCollector] = true;
// Event
emit TaxCollectorModified(oldTaxCollector, newTaxCollector);
}
/**
* @dev Sets the exclusion status for a given account from tax calculations.
* @param account The address of the account to be excluded or included.
* @param exclude A boolean flag indicating whether the account should be excluded (true) or included (false).
*
* @notice This function is external, meaning it can only be called from outside the contract.
* @notice Only the owner of the contract has the authority to exclude or include accounts.
* @notice The exclusion status is updated for the specified account, affecting tax calculations.
* @notice Emits an Excluded event with details about the modification, including the account address and exclusion status.
*/
function setExclude(address account, bool exclude) external onlyOwner {
// Set
isExcluded[account] = exclude;
// Event
emit Excluded(account, exclude);
}
/**
* @dev Sets the maximum wallet factor for the contract, which is used as a threshold for wallet balance validation.
* @param newFactor The new maximum wallet factor to be set.
*
* @notice This function is external, meaning it can only be called from outside the contract.
* @notice Only the owner of the contract has the authority to set the maximum wallet factor.
* @notice The new maximum wallet factor must not exceed the total supply of the contract's token.
* @notice If the new maximum wallet factor is invalid, the function reverts and emits an error message.
* @notice Emits a FactorModified event with details about the modification, including the factor type, old factor, and new factor.
*/
function setMaxWalletFactor(uint32 newFactor) external onlyOwner {
// Validation
if (newFactor > totalSupply()) {
revert InvalidInput(
"Max wallet factor",
"Max wallet factor cannot exceed total supply"
);
}
// Set
uint32 oldFactor = _maxWalletFactor;
_maxWalletFactor = newFactor;
// Event
emit FactorModified("Max Wallet Factor", oldFactor, newFactor);
}
/**
* @dev Sets the maximum transaction factor for the contract, which is used as a threshold for transaction validation.
* @param newFactor The new maximum transaction factor to be set.
*
* @notice This function is external, meaning it can only be called from outside the contract.
* @notice Only the owner of the contract has the authority to set the maximum transaction factor.
* @notice The new maximum transaction factor must not exceed the total supply of the contract's token.
* @notice If the new maximum transaction factor is invalid, the function reverts and emits an error message.
* @notice Emits a FactorModified event with details about the modification, including the factor type, old factor, and new factor.
*/
function setMaxTransactionFactor(uint32 newFactor) external onlyOwner {
// Validation
if (newFactor > totalSupply()) {
revert InvalidInput(
"Max transaction factor",
"Max transaction factor cannot exceed total supply"
);
}
// Set
uint32 oldFactor = _maxTransactionFactor;
_maxTransactionFactor = newFactor;
// Event
emit FactorModified("Max Transaction Factor", oldFactor, newFactor);
}
/**
* @dev Sets the cooldown time for transactions in the contract.
* @param newCooldownTime The new cooldown time, representing the duration in seconds.
*
* @notice This function is external, meaning it can only be called from outside the contract.
* @notice Only the owner of the contract has the authority to set the cooldown time.
* @notice The new cooldown time is stored, affecting the time duration between transactions.
* @notice Emits a CooldownTimeModified event with details about the modification, including the old and new cooldown times.
*/
function setCooldownTime(uint256 newCooldownTime) external onlyOwner {
// Set
uint256 oldCooldownTime = cooldownTime;
cooldownTime = newCooldownTime;
// Event
emit CooldownTimeModified(oldCooldownTime, newCooldownTime);
}
/**
* @dev Toggles the automatic liquidity provision feature of the contract. This feature, when enabled, allows the contract to automatically provide liquidity to a paired liquidity pool.
*
* @notice This function is external, meaning it can only be called from outside the contract.
* @notice Only the owner of the contract has the authority to toggle the automatic liquidity provision feature.
* @notice Toggling this feature inverses the current state of the autoLiquidityProviding variable.
* @notice Emits an AutoLiquiditySwitch event indicating the new state of the automatic liquidity provision feature.
*/
function switchAutoLiquidity() external onlyOwner {
// Set
autoLiquidityProviding = !autoLiquidityProviding;
// Event
emit AutoLiquiditySwitch(autoLiquidityProviding);
}
/**
* @dev Sets the tax factor for the contract, which is used as a threshold for tax division.
* @param newTaxFactor The new tax factor to be set.
*
* @notice This function is external, meaning it can only be called from outside the contract.
* @notice Only the owner of the contract has the authority to set the tax factor.
* @notice The new tax factor must not exceed the total supply of the contract's token.
* @notice If the new tax factor is invalid, the function reverts and emits an error message.
* @notice Emits a FactorModified event with details about the modification, including the factor type, old factor, and new factor.
*/
function setTaxFactor(uint32 newTaxFactor) external onlyOwner {
// Validation
if (_taxFactor > totalSupply()) {
revert InvalidInput(
"Tax Factor",
"Tax factor cannot exceed total supply"
);
}
// Set
uint32 oldTaxFactor = newTaxFactor;
_taxFactor = newTaxFactor;
// Event
emit FactorModified("Tax Factor", oldTaxFactor, newTaxFactor);
}
/**
* @dev Sets the buying tax rate for the contract.
* @param newTax The new tax rate to be set, represented as a percentage (e.g., 5 for 5%).
*
* @notice This function is external, meaning it can only be called from outside the contract.
* @notice Only the owner of the contract has the authority to set the buying tax rate.
* @notice The new tax rate must not exceed a predefined factor (_taxFactor) to prevent excessive taxation.
* @notice If the new tax rate is invalid, the function reverts and emits an error message.
* @notice Emits a TaxModified event with details about the modification, including the tax type, old tax rate, and new tax rate.
*/
function setBuyTax(uint32 newTax) external onlyOwner {
// Validation
if (newTax > _taxFactor) {
revert InvalidInput("Buy Tax", "Buy tax cannot exceed tax factor");
}
// Set
uint32 oldTax = buyTax;
buyTax = newTax;
// Event
emit TaxModified("Buy Tax", oldTax, newTax);
}
/**
* @dev Sets the selling tax rate for the contract.
* @param newTax The new tax rate to be set, represented as a percentage.
*
* @notice This function is external, meaning it can only be called from outside the contract.
* @notice Only the owner of the contract has the authority to set the selling tax rate.
* @notice The new tax rate must not exceed a predefined factor (_taxFactor) to prevent excessive taxation.
* @notice If the new tax rate is invalid, the function reverts and emits an error message.
* @notice Emits a TaxModified event with details about the modification, including the tax type, old tax rate, and new tax rate.
*/
function setSellTax(uint32 newTax) external onlyOwner {
// Validation
if (newTax > _taxFactor) {
revert InvalidInput(
"Sell Tax",
"Sell tax cannot exceed tax factor"
);
}
// Set
uint32 oldTax = sellTax;
sellTax = newTax;
// Event
emit TaxModified("Sell Tax", oldTax, newTax);
}
/**
* @dev Sets a new liquidity fee for the contract, which is applied to transactions for liquidity provision.
* @param newTax The new liquidity fee to be set, expressed in basis points (bps). For example, a value of 50 represents a 0.5% fee.
*
* @notice This function is external, meaning it can only be called from outside the contract.
* @notice Only the owner of the contract has the authority to set the liquidity fee.
* @notice The new liquidity fee must not exceed the predefined tax factor limit. If it does, the function reverts with an "InvalidInput" error.
* @notice Emits a `TaxModified` event with details about the modification, including the tax type ("LP Tax"), old tax rate, and new tax rate.
*/
function setliquidityFee(uint32 newTax) external onlyOwner {
// Validation
if (newTax > _taxFactor) {
revert InvalidInput("LP Tax", "LP tax cannot exceed tax factor");
}
// Set
uint32 oldTax = liquidityFee;
liquidityFee = newTax;
// Event
emit TaxModified("LP Tax", oldTax, newTax);
}
/**
* @dev Adds liquidity to the Uniswap V2 liquidity pool using a specified amount of tokens and ETH.
* The function first verifies the Uniswap V2 Router's address, then approves the router to spend the tokens,
* and finally attempts to add liquidity to the pool. It handles success or failure of liquidity addition.
* @param amountToken The amount of tokens to add to the pool.
* @param amountETH The amount of ETH to add to the pool, sent along with the transaction.
*
* @notice This function is private, meaning it can only be called from within the contract itself.
* @notice Before calling this function, ensure that the Uniswap V2 Router is set and valid.
* @notice The function approves the Uniswap V2 Router to spend the specified `amountToken`.
* @notice Attempts to add `amountToken` tokens and `amountETH` ETH to the Uniswap V2 liquidity pool.
* If successful, emits a `LiquidityAdded` event with the amounts used and liquidity tokens received.
* @notice If the attempt to add liquidity fails due to a revert with a reason, emits a `LiquidityAdditionFailed` event with the reason.
* @notice If the attempt fails without a revert reason, emits a `LiquidityAdditionFailedBytes` event with the low-level data.
*/
function addLiquidity(uint amountToken, uint amountETH) private {
// Verification
if (address(uniswapV2Router) == address(0)) {
revert UniswapV2InvalidRouter(address(0));
}
// Approve the Uniswap V2 router to spend the token amount
_approve(address(this), address(uniswapV2Router), amountToken);
// Add tokens and ETH to the liquidity pool
try
uniswapV2Router.addLiquidityETH{value: amountETH}(
address(this),
amountToken,
0, // Consider setting non-zero slippage limits for production
0, // Consider setting non-zero slippage limits for production
address(taxCollector),
block.timestamp + 600
)
returns (uint amountTokenUsed, uint amountETHUsed, uint liquidity) {
// Handle successful liquidity addition
// e.g., Emit an event or execute further logic as needed
emit LiquidityAdded(amountTokenUsed, amountETHUsed, liquidity);
} catch Error(string memory reason) {
// Handle a revert with a reason from the Uniswap V2 Router
// e.g., Emit an event or revert the transaction
emit LiquidityAdditionFailed(reason);
} catch (bytes memory lowLevelData) {
// Handle a failure without a revert reason from the Uniswap V2 Router
// e.g., Emit an event or revert the transaction
emit LiquidityAdditionFailedBytes(lowLevelData);
}
}
/**
* @dev Initiates the swap of Tokens for ETH and distributes the resulting ETH.
* @dev Accessible only by the contract owner.
*/
function swap() external onlyOwner {
// Swap
swapTokensForEth(balanceOf(address(this)));
// Distribute
transferTax();
// Event
emit Swap();
}
/**
* @dev Internal function to swap Tokens for ETH using the Uniswap V2 Router.
* @param amount The amount of tokens to be swapped.
*/
function swapTokensForEth(uint256 amount) private {
// Verification
if (address(uniswapV2Router) == address(0)) {
revert UniswapV2InvalidRouter(address(0));
}
// Approve the Uniswap V2 router to spend the token amount
_approve(address(this), address(uniswapV2Router), amount);
// Parameters
address[] memory path = new address[](2);
// Configuration
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
// Swap tokens for ETH
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
amount,
0,
path,
address(this),
block.timestamp + 600
);
}
/**
* @dev Internal function to transfer collected tax to the designated tax collector address.
*/
function transferTax() private {
// Parameter
uint256 tax = address(this).balance;
if (tax > 0) {
taxCollector.transfer(tax);
}
}
/**
* @dev Fallback function to receive ETH.
*/
receive() external payable {}
/**
* @dev Fallback function to receive ETH.
*/
fallback() external payable {}
}
R4REPool.sol 150 lines
// SPDX-License-Identifier: MIT
// Author: A.P
// Organization: Rare Art
// Development: Kibernacia
// Product: R4RE
// Version: 1.0.0
// Link: https://linktr.ee/rareuniverse
pragma solidity >=0.8.23 <0.9.0;
// OpenZeppelin
import {Context} from "@openzeppelin/contracts/utils/Context.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
// Uniswap V2
import {IUniswapV2Pair} from "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol";
import {IUniswapV2Router02} from "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
// R4RE
import {R4REEvents} from "./R4REEvents.sol";
import {R4REErrors} from "./R4REErrors.sol";
/**
* @dev R4RE Pool
*/
abstract contract R4REPool is Context, Ownable, R4REEvents, R4REErrors {
/// @notice Stores Uniswap V2 router interface.
/// @dev Stores IUniswapV2Router02 interface.
IUniswapV2Router02 public uniswapV2Router;
/// @notice Stores Uniswap V2 pair address.
/// @dev Stores address.
address public uniswapV2Pair;
/**
* @dev Sets the UniswapV2Router for the contract to enable interactions with the Uniswap decentralized exchange.
* @param newUniswapV2Router The address of the new UniswapV2Router contract.
*
* @notice This function is external, meaning it can only be called from outside the contract.
* @notice Only the owner of the contract has the authority to set the UniswapV2Router.
* @notice The new UniswapV2Router address must be a valid address and not equal to address(0).
* @notice If the new UniswapV2Router address is invalid, the function reverts and emits an error message.
* @notice Emits a UniswapV2RouterModified event with details about the modification, including the old and new UniswapV2Router addresses.
*/
function setUniswapV2Router(address newUniswapV2Router) external onlyOwner {
// Verification
if (newUniswapV2Router == address(0)) {
revert UniswapV2InvalidRouter(address(0));
}
// Parameter
address oldUniswapV2Router = address(uniswapV2Router);
// Configuration
uniswapV2Router = IUniswapV2Router02(newUniswapV2Router);
// Event
emit UniswapV2RouterModified(oldUniswapV2Router, newUniswapV2Router);
}
/**
* @dev Sets the UniswapV2Pair for the contract to define the trading pair with the Uniswap decentralized exchange.
* @param newUniswapV2Pair The address of the new UniswapV2Pair contract representing the trading pair.
*
* @notice This function is external, meaning it can only be called from outside the contract.
* @notice Only the owner of the contract has the authority to set the UniswapV2Pair.
* @notice The new UniswapV2Pair address must be a valid address and not equal to address(0).
* @notice If the new UniswapV2Pair address is invalid, the function reverts and emits an error message.
* @notice Emits a UniswapV2PairModified event with details about the modification, including the old and new UniswapV2Pair addresses.
*/
function setUniswapV2Pair(address newUniswapV2Pair) external onlyOwner {
// Verification
if (newUniswapV2Pair == address(0)) {
revert UniswapV2InvalidPool(address(0));
}
// Parameter
address oldUniswapV2Pair = uniswapV2Pair;
// Configuration
uniswapV2Pair = newUniswapV2Pair;
// Event
emit UniswapV2PairModified(oldUniswapV2Pair, uniswapV2Pair);
}
/**
* @dev Retrieves the reserve amounts of the two tokens in the Uniswap V2 pair, along with the last block timestamp when these reserves were updated.
* This function interfaces with the Uniswap V2 pair contract to fetch its current state, which is essential for calculating accurate trading prices, understanding liquidity depth, and more.
* The reserves and timestamp can be used by external contracts or callers to make informed decisions in DeFi operations such as swaps, liquidity provision, or arbitrage.
*
* @return _reserve0 The reserve amount of the first token in the Uniswap V2 pair. Token pairs in Uniswap are ordered by their contract addresses.
* @return _reserve1 The reserve amount of the second token in the Uniswap V2 pair.
* @return _blockTimestampLast The last block timestamp when the reserves were recorded by the pair contract. This can be used to assess the freshness of the data.
*/
function getReserves()
public
view
returns (uint _reserve0, uint _reserve1, uint32 _blockTimestampLast)
{
// Parameter
IUniswapV2Pair iPair = IUniswapV2Pair(uniswapV2Pair);
return iPair.getReserves();
}
/**
* @dev Calculates the equivalent amount of ETH for a given amount of tokens based on the reserves in the liquidity pool.
* @param amountToken The amount of tokens to convert to an equivalent amount of ETH.
* @return amountETH The equivalent amount of ETH based on the current reserves.
*/
function quote(uint amountToken) internal view returns (uint amountETH) {
// Get the reserves from the liquidity pool
(uint reserveA, uint reserveB, ) = getReserves();
if (amountToken <= 0) revert UniswapV2InsufficientAmount();
if (reserveA <= 0 || reserveB <= 0) {
revert UniswapV2InsufficientLiquidity();
}
// Parameter
IUniswapV2Pair iPair = IUniswapV2Pair(uniswapV2Pair);
if (address(this) == iPair.token0()) {
// Calculate the equivalent amount of ETH based on the reserves and the amount of tokens
amountETH = (amountToken * reserveB) / reserveA;
} else {
// Calculate the equivalent amount of ETH based on the reserves and the amount of tokens
amountETH = (amountToken * reserveA) / reserveB;
}
}
/**
* @dev Allows the owner of the contract to withdraw the contract's balance.
*
* @notice This function is external, meaning it can only be called from outside the contract.
* @notice Only the owner of the contract has the authority to withdraw funds.
* @notice The entire balance of the contract is transferred to the owner's address.
* @notice If the withdrawal is unsuccessful, the function reverts and emits an error message.
*/
function withdraw() external onlyOwner {
// Withdraw
(bool success, ) = msg.sender.call{value: address(this).balance}("");
// Verification
if (!success) {
revert WidthdrawInvalid();
}
}
}
R4REErrors.sol 72 lines
// SPDX-License-Identifier: MIT
// Author: A.P
// Organization: Rare Art
// Development: Kibernacia
// Product: R4RE
// Version: 1.0.0
// Link: https://linktr.ee/rareuniverse
pragma solidity >=0.8.23 <0.9.0;
/**
* @dev R4RE Errors
*/
interface R4REErrors {
/**
* @dev Error indicating that the provided UniswapV2Router address is invalid.
* @param newUniswapV2Router The address of the invalid UniswapV2Router.
*/
error UniswapV2InvalidRouter(address newUniswapV2Router);
/**
* @dev Error indicating that the provided UniswapV2Pair address is invalid.
* @param newUniswapV2Pair The address of the invalid UniswapV2Pair.
*/
error UniswapV2InvalidPool(address newUniswapV2Pair);
/**
* @dev Error indicating that an operation failed because the provided amount is insufficient.
*/
error UniswapV2InsufficientAmount();
/**
* @dev Error indicating that an operation failed due to insufficient liquidity in the Uniswap V2 pool.
*/
error UniswapV2InsufficientLiquidity();
/**
* @dev Error indicating that a transfer from the zero address is not allowed.
*/
error TransferFromZeroAddress();
/**
* @dev Error indicating that a transfer to the zero address is not allowed.
*/
error TransferToZeroAddress();
/**
* @dev Error indicating that the maximum wallet size has been exceeded.
*/
error MaxWalletSizeExceeded();
/**
* @dev Error indicating that the maximum transaction size has been exceeded.
*/
error MaxTransactionSizeExceeded();
/**
* @dev Error indicating that a transfer is not allowed due to transfer time restrictions.
*/
error TransferTimeRestriction();
/**
* @dev Error indicating that a withdrawal operation is invalid.
*/
error WidthdrawInvalid();
/**
* @dev Error indicating that an input parameter is invalid.
* @param index The index or identifier of the invalid input.
* @param message A message describing the reason for the invalid input.
*/
error InvalidInput(string index, string message);
}
R4REEvents.sol 131 lines
// SPDX-License-Identifier: MIT
// Author: A.P
// Organization: Rare Art
// Development: Kibernacia
// Product: R4RE
// Version: 1.0.0
// Link: https://linktr.ee/rareuniverse
pragma solidity >=0.8.23 <0.9.0;
/**
* @dev R4RE Events
*/
interface R4REEvents {
/**
* @dev Emitted when an account is excluded or included from tax calculations.
* @param account The address of the account being excluded or included.
* @param exclude A boolean flag indicating whether the account is excluded (true) or included (false).
*/
event Excluded(address indexed account, bool exclude);
/**
* @dev Emitted when the tax collector address is modified.
* @param oldTaxCollector The old tax collector address before modification.
* @param newTaxCollector The new tax collector address after modification.
*/
event TaxCollectorModified(
address indexed oldTaxCollector,
address indexed newTaxCollector
);
/**
* @dev Emitted when a factor (e.g., tax factor, max transaction factor, max wallet factor) is modified.
* @param factor The type of factor being modified.
* @param oldFactor The old value of the factor before modification.
* @param newFactor The new value of the factor after modification.
*/
event FactorModified(
string indexed factor,
uint32 oldFactor,
uint32 newFactor
);
/**
* @dev Emitted when a tax rate is modified.
* @param tax The type of tax being modified.
* @param oldTax The old tax rate before modification.
* @param newTax The new tax rate after modification.
*/
event TaxModified(string indexed tax, uint32 oldTax, uint32 newTax);
/**
* @dev Emitted when a swap operation occurs (e.g., in the Uniswap decentralized exchange).
*/
event Swap();
/**
* @dev Emitted when a recipient address is taxed.
* @param receiver The address of the recipient being taxed.
* @param amount The amount of the tax applied.
*/
event Taxed(address indexed receiver, uint256 amount);
/**
* @dev Emitted when the UniswapV2Router address is modified.
* @param oldUniswapV2Router The old UniswapV2Router address before modification.
* @param newUniswapV2Router The new UniswapV2Router address after modification.
*/
event UniswapV2RouterModified(
address indexed oldUniswapV2Router,
address indexed newUniswapV2Router
);
/**
* @dev Emitted when the UniswapV2Pair address is modified.
* @param oldUniswapV2Pair The old UniswapV2Pair address before modification.
* @param newUniswapV2Pair The new UniswapV2Pair address after modification.
*/
event UniswapV2PairModified(
address indexed oldUniswapV2Pair,
address indexed newUniswapV2Pair
);
/**
* @dev Emitted when the cooldown time for transactions is modified.
* @param oldCooldownTime The old cooldown time before modification.
* @param newCooldownTime The new cooldown time after modification.
*/
event CooldownTimeModified(
uint256 oldCooldownTime,
uint256 newCooldownTime
);
/**
* @dev Emitted when the automatic liquidity provision setting is toggled.
* @param autoLiquidityProviding Indicates whether automatic liquidity providing is enabled (true) or disabled (false).
*/
event AutoLiquiditySwitch(bool indexed autoLiquidityProviding);
/**
* @dev Emitted when liquidity is successfully added to the liquidity pool.
* @param amountTokenUsed The amount of tokens used to add liquidity.
* @param amountETHUsed The amount of ETH used to add liquidity.
* @param liquidity The amount of liquidity tokens received in return for adding liquidity.
*/
event LiquidityAdded(
uint256 amountTokenUsed,
uint256 amountETHUsed,
uint256 liquidity
);
/**
* @dev Emitted when adding liquidity to the liquidity pool fails due to a reason that can be expressed in a string.
* @param reason The reason why adding liquidity failed, described as a string.
*/
event LiquidityAdditionFailed(string reason);
/**
* @dev Emitted when adding liquidity to the liquidity pool fails due to a reason that is captured in low-level bytes data.
* @param lowLevelData The low-level bytes data representing the reason for the liquidity addition failure.
*/
event LiquidityAdditionFailedBytes(bytes lowLevelData);
/**
* @dev Emitted after calculating the equivalent amount of ETH for a given amount of tokens.
* This event helps in tracking the outcomes of quote operations, providing insights into the value conversions and the state of balances after the operation.
* @param amountToken The amount of tokens for which the quote was calculated.
* @param amountETH The equivalent amount of ETH for the given amount of tokens as per the current conversion rate.
* @param balance The balance after the operation, potentially reflecting changes in reserves or liquidity.
*/
event Quote(uint amountToken, uint amountETH, uint balance);
}
Context.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @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;
}
}
Ownable.sol 100 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../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.
*
* The initial owner is set to the address provided by the deployer. 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;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @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 {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @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 {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_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);
}
}
ERC20.sol 316 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.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}.
*
* 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.
*/
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
mapping(address account => uint256) private _balances;
mapping(address account => mapping(address spender => 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 returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual 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 returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual 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 `value`.
*/
function transfer(address to, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_transfer(owner, to, value);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `value` 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 value) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, value);
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 `value`.
* - the caller must have allowance for ``from``'s tokens of at least
* `value`.
*/
function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, value);
_transfer(from, to, value);
return true;
}
/**
* @dev Moves a `value` 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.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _transfer(address from, address to, uint256 value) internal {
if (from == address(0)) {
revert ERC20InvalidSender(address(0));
}
if (to == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(from, to, value);
}
/**
* @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
* (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
* this function.
*
* Emits a {Transfer} event.
*/
function _update(address from, address to, uint256 value) internal virtual {
if (from == address(0)) {
// Overflow check required: The rest of the code assumes that totalSupply never overflows
_totalSupply += value;
} else {
uint256 fromBalance = _balances[from];
if (fromBalance < value) {
revert ERC20InsufficientBalance(from, fromBalance, value);
}
unchecked {
// Overflow not possible: value <= fromBalance <= totalSupply.
_balances[from] = fromBalance - value;
}
}
if (to == address(0)) {
unchecked {
// Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
_totalSupply -= value;
}
} else {
unchecked {
// Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
_balances[to] += value;
}
}
emit Transfer(from, to, value);
}
/**
* @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
* Relies on the `_update` mechanism
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _mint(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(address(0), account, value);
}
/**
* @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
* Relies on the `_update` mechanism.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead
*/
function _burn(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidSender(address(0));
}
_update(account, address(0), value);
}
/**
* @dev Sets `value` 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.
*
* Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
*/
function _approve(address owner, address spender, uint256 value) internal {
_approve(owner, spender, value, true);
}
/**
* @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
*
* By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
* `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
* `Approval` event during `transferFrom` operations.
*
* Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
* true using the following override:
* ```
* function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
* super._approve(owner, spender, value, true);
* }
* ```
*
* Requirements are the same as {_approve}.
*/
function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
if (owner == address(0)) {
revert ERC20InvalidApprover(address(0));
}
if (spender == address(0)) {
revert ERC20InvalidSpender(address(0));
}
_allowances[owner][spender] = value;
if (emitEvent) {
emit Approval(owner, spender, value);
}
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `value`.
*
* Does not update the allowance value in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Does not emit an {Approval} event.
*/
function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
if (currentAllowance < value) {
revert ERC20InsufficientAllowance(spender, currentAllowance, value);
}
unchecked {
_approve(owner, spender, currentAllowance - value, false);
}
}
}
}
IERC20.sol 79 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @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 value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` 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 value) external returns (bool);
}
draft-IERC6093.sol 161 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard ERC20 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
*/
interface IERC20Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC20InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC20InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
* @param spender Address that may be allowed to operate on tokens without being their owner.
* @param allowance Amount of tokens a `spender` is allowed to operate with.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC20InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `spender` to be approved. Used in approvals.
* @param spender Address that may be allowed to operate on tokens without being their owner.
*/
error ERC20InvalidSpender(address spender);
}
/**
* @dev Standard ERC721 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
*/
interface IERC721Errors {
/**
* @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
* Used in balance queries.
* @param owner Address of the current owner of a token.
*/
error ERC721InvalidOwner(address owner);
/**
* @dev Indicates a `tokenId` whose `owner` is the zero address.
* @param tokenId Identifier number of a token.
*/
error ERC721NonexistentToken(uint256 tokenId);
/**
* @dev Indicates an error related to the ownership over a particular token. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param tokenId Identifier number of a token.
* @param owner Address of the current owner of a token.
*/
error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC721InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC721InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param tokenId Identifier number of a token.
*/
error ERC721InsufficientApproval(address operator, uint256 tokenId);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC721InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC721InvalidOperator(address operator);
}
/**
* @dev Standard ERC1155 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
*/
interface IERC1155Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
* @param tokenId Identifier number of a token.
*/
error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC1155InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC1155InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param owner Address of the current owner of a token.
*/
error ERC1155MissingApprovalForAll(address operator, address owner);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC1155InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC1155InvalidOperator(address operator);
/**
* @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
* Used in batch transfers.
* @param idsLength Length of the array of token identifiers
* @param valuesLength Length of the array of token amounts
*/
error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}
IUniswapV2Pair.sol 52 lines
pragma solidity >=0.5.0;
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
IUniswapV2Factory.sol 17 lines
pragma solidity >=0.5.0;
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
IERC20Metadata.sol 26 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*/
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);
}
IUniswapV2Router01.sol 95 lines
pragma solidity >=0.6.2;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
IUniswapV2Router02.sol 44 lines
pragma solidity >=0.6.2;
import './IUniswapV2Router01.sol';
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
Read Contract
allowance 0xdd62ed3e → uint256
autoLiquidityProviding 0x299bd193 → bool
balanceOf 0x70a08231 → uint256
buyTax 0x4f7041a5 → uint32
calculateTax 0xbdc75762 → uint256, uint256
cooldownTime 0xb319c6b7 → uint256
decimals 0x313ce567 → uint8
getReserves 0x0902f1ac → uint256, uint256, uint32
isExcluded 0xcba0e996 → bool
lastTransactionTimestamp 0x56cf37b7 → uint256
liquidityFee 0x98118cb4 → uint32
maxTransactionSize 0x28b13b61 → uint256
maxWalletSize 0x8f3fa860 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
sellTax 0xcc1776d3 → uint32
symbol 0x95d89b41 → string
taxCollector 0xbea1dcf8 → address
totalSupply 0x18160ddd → uint256
uniswapV2Pair 0x49bd5a5e → address
uniswapV2Router 0x1694505e → address
Write Contract 19 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 value
returns: bool
renounceOwnership 0x715018a6
No parameters
setBuyTax 0xdb932ae2
uint32 newTax
setCooldownTime 0x6ff73201
uint256 newCooldownTime
setExclude 0x961d3cd3
address account
bool exclude
setMaxTransactionFactor 0x6b34f554
uint32 newFactor
setMaxWalletFactor 0xd4f46716
uint32 newFactor
setSellTax 0xbb1789d6
uint32 newTax
setTaxCollector 0x08695b41
address newTaxCollector
setTaxFactor 0xf45e90c6
uint32 newTaxFactor
setUniswapV2Pair 0xa29a6089
address newUniswapV2Pair
setUniswapV2Router 0x1419841d
address newUniswapV2Router
setliquidityFee 0x786f17d7
uint32 newTax
swap 0x8119c065
No parameters
switchAutoLiquidity 0xe20cb19e
No parameters
transfer 0xa9059cbb
address to
uint256 value
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 value
returns: bool
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address