Address Contract Verified
Address
0x90D1964873dDD741f49eD3Ca9c47CEb470313A09
Balance
0 ETH
Nonce
1
Code Size
8891 bytes
Creator
0x72c3c8b0...4cCb at tx 0x7b47a14f...ea46bf
Indexed Transactions
0
Contract Bytecode
8891 bytes
0x6080806040526004361015610012575f80fd5b5f3560e01c90816304beaeb8146116d45750806304c2b59f146116b857806306fdde03146115fd578063095ea7b31461157b5780630dc59a3a1461155e5780630f19ce521461154157806318160ddd146115245780631d053daf1461050f5780631e293c10146114d857806322c168b1146114b057806323b872dd14611361578063259a28cf146113435780632e7a923f1461126957806330b99e5b14611221578063313ce5671461120657806333039d3d146111de578063406680ee14611189578063453c23101461116c578063458efde314611140578063479510e2146111235780634a62bb65146111015780634bb2c785146110c457806352f200b81461107d57806353a65f8d14610e99578063670171fd146102a3578063679ca6e914610e1d57806370a0823114610de6578063715018a614610d755780637ca8448a14610c775780637fa8e5e414610c505780638da5cb5b14610c2a578063959bd6c214610b7257806395d89b4114610a2f5780639679afaa14610a12578063983657d9146109b757806398cd1f651461097a5780639a7a23d61461086b578063a82ed9ec14610828578063a9059cbb146107f7578063b410da25146107bd578063ba5b99ba146102a3578063bbc0c74214610798578063bc205ad314610629578063c8c8ebe41461060c578063ce20b822146105e2578063d299c66f146105b4578063dd62ed3e14610560578063e268e4d314610514578063f000d9821461050f578063f2fde38b14610459578063f364c90c1461040b578063f3c5f51e14610307578063f40acc3d146102c4578063f475fbf3146102a8578063f7a33861146102a35763fae9b66014610284575f80fd5b3461029f575f60031936011261029f57602060405160c88152f35b5f80fd5b611839565b3461029f575f60031936011261029f5760206040516102ee8152f35b3461029f575f60031936011261029f5760206040516001600160a01b037f0000000000000000000000007f3ad71f1b36f00177c1bddea85db80439c390fa168152f35b3461029f57602060031936011261029f5761032061173c565b610328611aa5565b6d0109ed9c536cdaca14a1c8000000600d5410156103e357610348611b68565b6001600955600254906d0a63481b42408be4ce51d000000061036a8284611870565b11156103d357506d0a63481b42408be4ce51d0000000036d0a63481b42408be4ce51d000000081116103a65761039f916120c5565b6002600955005b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b90506103de916120c5565b61039f565b7f646cf558000000000000000000000000000000000000000000000000000000005f5260045ffd5b3461029f57604060031936011261029f57602061044f602435600435905f52601060205260405f208160081c5f52602052600160ff60405f205492161b8091161490565b6040519015158152f35b3461029f57602060031936011261029f576001600160a01b0361047a61173c565b610482611aa5565b1680156104e3576001600160a01b03600554827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617600555167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3005b7f1e4fbdf7000000000000000000000000000000000000000000000000000000005f525f60045260245ffd5b611768565b3461029f57602060031936011261029f577f40532828d73d53d59eb97977ab23ce325d9da71d8e0b4b861fa4ec8b1e625ff16020600435610553611aa5565b80600755604051908152a1005b3461029f57604060031936011261029f5761057961173c565b6001600160a01b03610589611752565b91165f5260016020526001600160a01b0360405f2091165f52602052602060405f2054604051908152f35b3461029f575f60031936011261029f576020604051737a250d5630b4cf539739df2c5dacb4c659f2488d8152f35b3461029f57602060031936011261029f576004355f52600f602052602060405f2054604051908152f35b3461029f575f60031936011261029f576020600654604051908152f35b3461029f57604060031936011261029f5761064261173c565b6001600160a01b03610652611752565b9161065b611aa5565b1690811561077057604051907f70a08231000000000000000000000000000000000000000000000000000000008252306004830152602082602481865afa918215610730575f9261073b575b5060446001600160a01b03915f6020949560405196879586947fa9059cbb00000000000000000000000000000000000000000000000000000000865216600485015260248401525af18015610730576106fc57005b6020813d602011610728575b8161071560209383611783565b8101031261029f57518015150361029f57005b3d9150610708565b6040513d5f823e3d90fd5b91506020823d602011610768575b8161075660209383611783565b8101031261029f5790519060446106a7565b3d9150610749565b7f6b093aad000000000000000000000000000000000000000000000000000000005f5260045ffd5b3461029f575f60031936011261029f57602060ff60085460081c166040519015158152f35b3461029f575f60031936011261029f5760206040517f00000000000000000000000000000000000000000000000000000000673801df8152f35b3461029f57604060031936011261029f5761081d61081361173c565b6024359033611ae5565b602060405160018152f35b3461029f575f60031936011261029f5760206040516001600160a01b037f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d168152f35b3461029f57604060031936011261029f5761088461173c565b602435801591821580920361029f576001600160a01b03906108a4611aa5565b16916001600160a01b037f0000000000000000000000007f3ad71f1b36f00177c1bddea85db80439c390fa1683149081610972575b5061094657816040917fffa9187bf1f18bf477bd0ea1bcbb64e93b6a98132473929edfce215cd9b16fab935f52600b602052825f207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0081541660ff831617905582519182526020820152a1005b507fa3b4dfaf000000000000000000000000000000000000000000000000000000005f5260045260245ffd5b9050836108d9565b3461029f57602060031936011261029f576001600160a01b0361099b61173c565b165f52600a602052602060ff60405f2054166040519015158152f35b3461029f5760a060031936011261029f5760043567ffffffffffffffff811161029f576109e89036906004016117dc565b6084356001600160a01b038116810361029f57610a10916064359060443590602435906118cb565b005b3461029f575f60031936011261029f576020600954604051908152f35b3461029f575f60031936011261029f576040515f6004548060011c90600181168015610b68575b602083108114610b3b57828552908115610af95750600114610a9b575b610a9783610a8381850382611783565b6040519182916020835260208301906116f9565b0390f35b91905060045f527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b915f905b808210610adf57509091508101602001610a83610a73565b919260018160209254838588010152019101909291610ac7565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660208086019190915291151560051b84019091019150610a839050610a73565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b91607f1691610a56565b3461029f57602060031936011261029f57610b8b611861565b610b93611aa5565b6008549060ff8260081c16610c02577f4fa3af35030a6d531e010728ded75e43818c3b10f563bec547fff22472898da0916020911515907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff61ff008360081b16911617600855604051908152a1005b7f14bcbf63000000000000000000000000000000000000000000000000000000005f5260045ffd5b3461029f575f60031936011261029f5760206001600160a01b0360055416604051908152f35b3461029f575f60031936011261029f5760206040516c1a97c2d5247c476876940000008152f35b3461029f57602060031936011261029f575f808080610c9461173c565b610c9c611aa5565b47905af13d15610d6d573d9067ffffffffffffffff8211610d405760405191610ced60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160184611783565b82523d5f602084013e5b15610cfe57005b610d3c906040519182917f788498dc0000000000000000000000000000000000000000000000000000000083526020600484015260248301906116f9565b0390fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b606090610cf7565b3461029f575f60031936011261029f57610d8d611aa5565b5f6001600160a01b036005547fffffffffffffffffffffffff00000000000000000000000000000000000000008116600555167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b3461029f57602060031936011261029f576001600160a01b03610e0761173c565b165f525f602052602060405f2054604051908152f35b3461029f57602060031936011261029f577f783c68f45f1cc97710ac752a41f6329f7f1c0a426030627b003237422175b0596020610e59611861565b610e61611aa5565b15157fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff006008541660ff821617600855604051908152a1005b3461029f57604060031936011261029f5760043567ffffffffffffffff811161029f573660238201121561029f578060040135610ed5816117c4565b91610ee36040519384611783565b8183526024602084019260051b8201019036821161029f57602401915b81831061105d5783610f10611752565b90610f19611aa5565b6001600160a01b038216905f5b8151811015611050576001600160a01b03610f41828461188a565b5116610f4b611aa5565b8015610770576040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152602081602481855afa908115610730575f9161101f575b505f91604460209260405194859384927fa9059cbb0000000000000000000000000000000000000000000000000000000084528a600485015260248401525af1801561073057610fe8575b50600101610f26565b6020813d8211611017575b8161100060209383611783565b8101031261029f57518015150361029f5784610fdf565b3d9150610ff3565b90506020813d8211611048575b8161103960209383611783565b8101031261029f57515f610f94565b3d915061102c565b5f80808087610c9c611aa5565b82356001600160a01b038116810361029f57815260209283019201610f00565b3461029f57608060031936011261029f5760043567ffffffffffffffff811161029f576110b1610a109136906004016117dc565b33906064359060443590602435906118cb565b3461029f57602060031936011261029f576001600160a01b036110e561173c565b165f52600b602052602060ff60405f2054166040519015158152f35b3461029f575f60031936011261029f57602060ff600854166040519015158152f35b3461029f575f60031936011261029f576020600c54604051908152f35b3461029f575f60031936011261029f57611158611aa5565b6001600160a01b0360055416610328611aa5565b3461029f575f60031936011261029f576020600754604051908152f35b3461029f57602060031936011261029f577f52714c8bd610cc36fd5d264bf539fe6c8ea3642623ade098541bfe55b4e8702660206004356111c8611aa5565b805f52600f82525f6040812055604051908152a1005b3461029f575f60031936011261029f5760206040516d0a63481b42408be4ce51d00000008152f35b3461029f575f60031936011261029f57602060405160128152f35b3461029f575f60031936011261029f57611239611aa5565b6d0109ed9c536cdaca14a1c8000000600d5410156103e35761126461125c611b68565b600c54611870565b600c55005b3461029f57606060031936011261029f5760043560443560243561128b611aa5565b6002546d0a63481b42408be4ce51d00000006112a78483611870565b116112f3577fde49d57224698f2bbd1e9af55c0843c36efc636b2f8d26aeba996760aae813406060858585825f52600f6020528060405f205560405192835260208301526040820152a1005b6d0a63481b42408be4ce51d0000000036d0a63481b42408be4ce51d000000081116103a6577fd183ebbc000000000000000000000000000000000000000000000000000000005f5260045260245ffd5b3461029f575f60031936011261029f5760206040516301dfe2008152f35b3461029f57606060031936011261029f5761137a61173c565b611382611752565b604435906001600160a01b03831692835f52600160205260405f206001600160a01b0333165f5260205260405f20547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81036113e4575b5061081d9350611ae5565b83811061147c5784156114505733156114245761081d945f52600160205260405f206001600160a01b0333165f526020528360405f2091039055846113d9565b7f94280d62000000000000000000000000000000000000000000000000000000005f525f60045260245ffd5b7fe602df05000000000000000000000000000000000000000000000000000000005f525f60045260245ffd5b83907ffb8f41b2000000000000000000000000000000000000000000000000000000005f523360045260245260445260645ffd5b3461029f575f60031936011261029f5760206040516d07457f4647f9fb86906c780000008152f35b3461029f57602060031936011261029f577f97ab21c06137f3c46fb0fe64a6b691e86433e8aff6abc7fda74f6d23b3d139616020600435611517611aa5565b80600655604051908152a1005b3461029f575f60031936011261029f576020600254604051908152f35b3461029f575f60031936011261029f576020600e54604051908152f35b3461029f575f60031936011261029f576020600d54604051908152f35b3461029f57604060031936011261029f5761159461173c565b602435903315611450576001600160a01b031690811561142457335f52600160205260405f20825f526020528060405f20556040519081527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560203392a3602060405160018152f35b3461029f575f60031936011261029f576040515f6003548060011c906001811680156116ae575b602083108114610b3b57828552908115610af9575060011461165057610a9783610a8381850382611783565b91905060035f527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b915f905b80821061169457509091508101602001610a83610a73565b91926001816020925483858801015201910190929161167c565b91607f1691611624565b3461029f575f60031936011261029f5760206040516127108152f35b3461029f575f60031936011261029f57806c27e3a43fb6ba6b1cb1de00000060209252f35b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f602080948051918291828752018686015e5f8582860101520116010190565b600435906001600160a01b038216820361029f57565b602435906001600160a01b038216820361029f57565b3461029f575f60031936011261029f57602060405160198152f35b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117610d4057604052565b67ffffffffffffffff8111610d405760051b60200190565b9080601f8301121561029f5781356117f3816117c4565b926118016040519485611783565b81845260208085019260051b82010192831161029f57602001905b8282106118295750505090565b813581526020918201910161181c565b3461029f575f60031936011261029f5760206040516d0109ed9c536cdaca14a1c80000008152f35b60043590811515820361029f57565b919082018092116103a657565b919082039182116103a657565b805182101561189e5760209160051b010190565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b929491949390936118ff8686905f52601060205260405f208160081c5f52602052600160ff60405f205492161b8091161490565b6103e357855f52600f60205260405f20549460405160208101908282523360601b604082015288605482015283607482015260748152611940609482611783565b519020965f975b86518910156119895761195a898861188a565b519081811015611978575f52602052600160405f205b980197611947565b905f52602052600160405f20611970565b91949750929591945003611a7d57816080917f45c072aa05b9853b5a993de7a28bc332ee01404a628cec1a23ce0f659f842ef19360081c815f52601060205260405f20815f5260205260405f205490825f52601060205260405f20905f52602052600160ff84161b1760405f20556040519133835260208301526040820152836060820152a16001600955600254906d0a63481b42408be4ce51d0000000611a318284611870565b1115611a6d57506d0a63481b42408be4ce51d0000000036d0a63481b42408be4ce51d000000081116103a657611a66916120c5565b6002600955565b9050611a78916120c5565b611a66565b7f09bde339000000000000000000000000000000000000000000000000000000005f5260045ffd5b6001600160a01b03600554163303611ab957565b7f118cdaa7000000000000000000000000000000000000000000000000000000005f523360045260245ffd5b91906001600160a01b03831615611b3c576001600160a01b03811615611b1057611b0e92611ec7565b565b7fec442f05000000000000000000000000000000000000000000000000000000005f525f60045260245ffd5b7f96c6fd1e000000000000000000000000000000000000000000000000000000005f525f60045260245ffd5b611b74600e544261187d565b806d0109ed9c536cdaca14a1c800000002906d0109ed9c536cdaca14a1c80000008204036103a6576301dfe200900442600e55611bb381600d54611870565b80600d556d0109ed9c536cdaca14a1c80000008111611c32575b50600d546d0a63481b42408be4ce51d00000008111611bea575090565b7ffffffffffffffffffffffffffffffffffffff59cb7e4bdbf741b31ae3000000081019081116103a657611c1d9161187d565b906d0a63481b42408be4ce51d0000000600d55565b7ffffffffffffffffffffffffffffffffffffffef61263ac932535eb5e3800000081019081116103a657611c659161187d565b6d0109ed9c536cdaca14a1c8000000600d555f611bcd565b8115611ebc57600160095414611eb15760085460ff8116611ca5575b5090611b0e915f612187565b6001600160a01b03600554168015159081611e9d575b5080611e88575b15611c995760081c60ff1615611e06575b6001600160a01b038116805f52600b60205260ff60405f205416155f14611d8957600654808411611d5a57505f525f602052611d1360405f205483611870565b600754809111611d2b575090611b0e915b9091611c99565b827fd9c02eae000000000000000000000000000000000000000000000000000000005f5260045260245260445ffd5b837f42b517e3000000000000000000000000000000000000000000000000000000005f5260045260245260445ffd5b505f8052600b6020527fdf7de25b7f1fd6d0b5205f0e18f1f35bd7b8d84cce336588d184533ce43a6f765460ff1615611dc7575b90611b0e91611d24565b600654808311611dd75750611dbd565b827f42b517e3000000000000000000000000000000000000000000000000000000005f5260045260245260445ffd5b5f8052600a6020527f13da86008ba1c6922daee3e07db95305ef49ebced9f5467a0b8613fcc6b343e35460ff16158015611e68575b15611cd3577fa491421c000000000000000000000000000000000000000000000000000000005f5260045ffd5b506001600160a01b0381165f52600a60205260ff60405f20541615611e3b565b5061dead6001600160a01b0383161415611cc2565b90506001600160a01b03831614155f611cbb565b90611b0e915f612187565b611b0e91505f6120de565b92919081156120b9576001600954146120af5760085460ff8116611ef1575b50611b0e9293612187565b6001600160a01b0360055416906001600160a01b0386169180831415908161209b575b5080612086575b611f26575b50611ee6565b60081c60ff1615612021575b6001600160a01b03821690815f52600b60205260ff60405f205416155f14611fbe5750600654808411611d5a57505f525f602052611f7460405f205483611870565b93600754809511611f8e57611b0e9394505b93925f611f20565b84837fd9c02eae000000000000000000000000000000000000000000000000000000005f5260045260245260445ffd5b90505f52600b60205260ff60405f20541615611fdf575b611b0e9293611f86565b60065493848311611ff1579350611fd5565b84837f42b517e3000000000000000000000000000000000000000000000000000000005f5260045260245260445ffd5b805f52600a60205260ff60405f205416158015612066575b15611f32577fa491421c000000000000000000000000000000000000000000000000000000005f5260045ffd5b506001600160a01b0382165f52600a60205260ff60405f20541615612039565b5061dead6001600160a01b0384161415611f1b565b90506001600160a01b03841614155f611f14565b611b0e9293612187565b9050611b0e91926120de565b906001600160a01b03821615611b1057611b0e91611c7d565b906001600160a01b035f92169081155f1461214b5760206001600160a01b037fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9261212b86600254611870565b6002555b169384612140575b604051908152a3565b848152808252612137565b5f82815260208181529093507fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef916001600160a01b039061212f565b6001600160a01b031690816121ff5760206001600160a01b037fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef926121ce86600254611870565b6002555b1693846121ea578060025403600255604051908152a3565b845f525f825260405f20818154019055612137565b815f525f60205260405f2054838110612251576001600160a01b037fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9285602093865f525f85520360405f20556121d2565b9190507fe450d38c000000000000000000000000000000000000000000000000000000005f5260045260245260445260645ffdfea2646970667358221220997b6f46d1fb91fca5f20c5e0cbd7b725f36595427518e6e22386fe46f0e95e164736f6c634300081a0033
Verified Source Code Full Match
Compiler: v0.8.26+commit.8a97fa7a
EVM: cancun
Optimization: Yes (10000 runs)
HenloToken.sol 148 lines
/// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import {IUniswapV2Router02} from "./vendor/uniswap/interfaces/IUniswapV2Router02.sol";
import {Memecoin} from './vendor/Memecoin.sol';
contract HenloToken is Memecoin {
uint256 public constant MAX_TOTAL_SUPPLY = 210_690_000_000_000 ether;
uint256 public constant LP_SUPPLY = 21_069_000_000_000 ether; // 10%
uint256 public constant CREATOR_VEST = 21_069_000_000_000 ether; // 10%
uint256 public constant CLAIM_SUPPLY = 147_483_000_000_000 ether; // 70%
uint256 public constant NFT_CLAIM_SUPPLY = 21_069_000_000_000 ether; // 10%
uint256 public constant UNLOCK_PERIOD = 52 weeks;
uint256 public immutable CREATION_TIME;
uint256 public constant GAIAS_NFT_SPLIT = 750; // 7.5%
uint256 public constant SCROLLS_NFT_SPLIT = 25; // 0.25%
uint256 public constant MEDIA_NFT_SPLIT = 25; // 0.25%
uint256 public constant PAPERS_NFT_SPLIT = 200; // 2%
uint256 public constant NFT_SPLIT_DENOMINATOR = 10000;
IUniswapV2Router02 public constant _UNISWAP_V2_ROUTER = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uint256 public constant _maxTransactionAmount = 3_160_350_000_000 ether; // 1.5% of total supply
uint256 public constant _maxPerWallet = 2_106_900_000_000 ether; // 1% of total supply
uint256 public vestBurned;
uint256 public vestClaimed;
uint256 public lastVestTime;
mapping(uint256 => bytes32) public weeklyClaimMerkleRoots;
// @dev: This is a packed array of booleans for each week
mapping(uint256 week => mapping (uint256 => uint256)) private claimedBitMap;
event SetWeeklyClaimMerkleRoot(uint256 week, bytes32 merkleRoot, uint256 claimTotal);
event EndWeeklyClaim(uint256 week);
event Claim(address user, uint256 index, uint256 week, uint256 amount);
error InvalidProof();
error AlreadyClaimed();
error ClaimTotalTooHigh(uint256 maxClaimTotal);
modifier withMint() {
_isMinting = 1;
_;
_isMinting = 2;
}
constructor() Memecoin("Henlo", "HENLO", _UNISWAP_V2_ROUTER, _maxTransactionAmount, _maxPerWallet) {
CREATION_TIME = block.timestamp;
lastVestTime = block.timestamp;
_mint(msg.sender, LP_SUPPLY);
}
function setMerkleRoot(uint256 week, bytes32 merkleRoot, uint256 claimTotal) external onlyOwner {
uint256 _totalSupply = totalSupply();
if (_totalSupply + claimTotal > MAX_TOTAL_SUPPLY) {
revert ClaimTotalTooHigh(MAX_TOTAL_SUPPLY - _totalSupply);
}
weeklyClaimMerkleRoots[week] = merkleRoot;
emit SetWeeklyClaimMerkleRoot(week, merkleRoot, claimTotal);
}
function endClaimWeek(uint256 week) external onlyOwner {
weeklyClaimMerkleRoots[week] = bytes32(0);
emit EndWeeklyClaim(week);
}
function isClaimed(uint256 index, uint256 week) public view returns (bool) {
uint256 claimedWordIndex = index / 256;
uint256 claimedBitIndex = index % 256;
uint256 claimedWord = claimedBitMap[week][claimedWordIndex];
uint256 mask = (1 << claimedBitIndex);
return claimedWord & mask == mask;
}
function claim(bytes32[] memory proof, uint256 index, uint256 week, uint256 amount) external {
claim(proof, index, week, amount, msg.sender);
}
function claim(bytes32[] memory proof, uint256 index, uint256 week, uint256 amount, address to) public {
if (isClaimed(index, week)) revert AlreadyClaimed();
bytes32 merkleRoot = weeklyClaimMerkleRoots[week];
bytes32 leaf = keccak256(abi.encodePacked(index, msg.sender, week, amount));
if (!MerkleProof.verify(proof, merkleRoot, leaf)) revert InvalidProof();
_setClaimed(index, week);
emit Claim(msg.sender, index, week, amount);
_safeMint(amount, to);
}
function vest() external onlyOwner {
vest(owner());
}
function vest(address to) public onlyOwner {
if (vestClaimed >= CREATOR_VEST) revert AlreadyClaimed();
uint256 claimAmount = _updateVest();
_safeMint(claimAmount, to);
}
function forfeitVest() external onlyOwner() {
if (vestClaimed >= CREATOR_VEST) revert AlreadyClaimed();
uint256 claimAmount = _updateVest();
vestBurned += claimAmount;
}
function _updateVest() private returns (uint256 claimAmount) {
claimAmount = CREATOR_VEST * (block.timestamp - lastVestTime) / UNLOCK_PERIOD;
lastVestTime = block.timestamp;
vestClaimed += claimAmount;
if (vestClaimed > CREATOR_VEST) {
claimAmount -= vestClaimed - CREATOR_VEST;
vestClaimed = CREATOR_VEST;
}
if (vestClaimed > MAX_TOTAL_SUPPLY) {
claimAmount -= vestClaimed - MAX_TOTAL_SUPPLY;
vestClaimed = MAX_TOTAL_SUPPLY;
}
}
function _setClaimed(uint256 index, uint256 week) private {
uint256 claimedWordIndex = index / 256;
uint256 claimedBitIndex = index % 256;
claimedBitMap[week][claimedWordIndex] = claimedBitMap[week][claimedWordIndex] | (1 << claimedBitIndex);
}
function _safeMint(uint256 amount, address to) private withMint {
uint256 _totalSupply = totalSupply();
if (_totalSupply + amount > MAX_TOTAL_SUPPLY) {
_mint(to, MAX_TOTAL_SUPPLY - _totalSupply);
} else {
_mint(to, amount);
}
}
}
MerkleProof.sol 232 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.20;
/**
* @dev These functions deal with verification of Merkle Tree proofs.
*
* The tree and the proofs can be generated using our
* https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
* You will find a quickstart guide in the readme.
*
* WARNING: You should avoid using leaf values that are 64 bytes long prior to
* hashing, or use a hash function other than keccak256 for hashing leaves.
* This is because the concatenation of a sorted pair of internal nodes in
* the Merkle tree could be reinterpreted as a leaf value.
* OpenZeppelin's JavaScript library generates Merkle trees that are safe
* against this attack out of the box.
*/
library MerkleProof {
/**
*@dev The multiproof provided is not valid.
*/
error MerkleProofInvalidMultiproof();
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Calldata version of {verify}
*/
function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
return processProofCalldata(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leafs & pre-images are assumed to be sorted.
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Calldata version of {processProof}
*/
function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by
* `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
*
* CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
*/
function multiProofVerify(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProof(proof, proofFlags, leaves) == root;
}
/**
* @dev Calldata version of {multiProofVerify}
*
* CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
*/
function multiProofVerifyCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProofCalldata(proof, proofFlags, leaves) == root;
}
/**
* @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
* proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
* leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
* respectively.
*
* CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
* is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
* tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
*/
function processMultiProof(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the Merkle tree.
uint256 leavesLen = leaves.length;
uint256 proofLen = proof.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
if (leavesLen + proofLen != totalHashes + 1) {
revert MerkleProofInvalidMultiproof();
}
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
if (proofPos != proofLen) {
revert MerkleProofInvalidMultiproof();
}
unchecked {
return hashes[totalHashes - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @dev Calldata version of {processMultiProof}.
*
* CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
*/
function processMultiProofCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the Merkle tree.
uint256 leavesLen = leaves.length;
uint256 proofLen = proof.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
if (leavesLen + proofLen != totalHashes + 1) {
revert MerkleProofInvalidMultiproof();
}
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
if (proofPos != proofLen) {
revert MerkleProofInvalidMultiproof();
}
unchecked {
return hashes[totalHashes - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @dev Sorts the pair (a, b) and hashes the result.
*/
function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
}
/**
* @dev Implementation of keccak256(abi.encode(a, b)) that doesn't allocate or expand memory.
*/
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}
IUniswapV2Router02.sol 68 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
import "./IUniswapV2Router01.sol";
interface IUniswapV2Router02 is IUniswapV2Router01 {
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;
}
Memecoin.sol 166 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "./uniswap/interfaces/IUniswapV2Router02.sol";
import "./uniswap/interfaces/IUniswapV2Factory.sol";
contract Memecoin is ERC20, Ownable {
IUniswapV2Router02 public immutable UNISWAP_V2_ROUTER;
address public immutable UNISWAP_V2_PAIR;
uint256 public maxTransactionAmount;
uint256 public maxPerWallet;
bool public limitsInEffect = true;
bool public tradingActive = false;
uint256 public _isMinting = 2; // 2 = false, 1 = true
mapping(address => bool) public isEarlyTransferAllowed;
mapping(address => bool) public isExcludedMaxTransactionAmount;
event SetAutomatedMarketMakerPair(address pair, bool value);
event SetMaxTransactionAmount(uint256 amount);
event SetMaxPerWallet(uint256 amount);
event SetLimitsInEffect(bool limitsInEffect);
event SetTradingActive(bool tradingActive);
error MaxTransactionAmountExceedsMaxWalletAmount();
error CannotRemovePair(address pair);
error ZeroTokenAddress();
error EthTransferFailed(bytes response);
error TradingAlreadyActive();
error TradingNotActive();
error MaxTransactionAmountExceeded(uint256 amount, uint256 maxTransactionAmount);
error MaxPerWalletExceeded(uint256 amount, uint256 maxPerWallet);
constructor(
string memory _name,
string memory _symbol,
IUniswapV2Router02 _router,
uint256 _maxTransactionAmount,
uint256 _maxPerWallet
) ERC20(_name, _symbol) Ownable(msg.sender) {
UNISWAP_V2_ROUTER = _router;
UNISWAP_V2_PAIR = IUniswapV2Factory(UNISWAP_V2_ROUTER.factory())
.createPair(address(this), UNISWAP_V2_ROUTER.WETH());
maxTransactionAmount = _maxTransactionAmount;
maxPerWallet = _maxPerWallet;
isEarlyTransferAllowed[msg.sender] = true;
isEarlyTransferAllowed[address(this)] = true;
isEarlyTransferAllowed[address(UNISWAP_V2_ROUTER)] = true;
isEarlyTransferAllowed[UNISWAP_V2_PAIR] = true;
isExcludedMaxTransactionAmount[address(UNISWAP_V2_ROUTER)] = true;
setAutomatedMarketMakerPair(UNISWAP_V2_PAIR, true);
}
function setAutomatedMarketMakerPair(address pair, bool value) public onlyOwner {
if (pair == UNISWAP_V2_PAIR && !value) {
revert CannotRemovePair(pair);
}
isExcludedMaxTransactionAmount[pair] = value;
emit SetAutomatedMarketMakerPair(pair, value);
}
function setMaxTransactionAmount(uint256 _maxTransactionAmount) external onlyOwner {
maxTransactionAmount = _maxTransactionAmount;
emit SetMaxTransactionAmount(_maxTransactionAmount);
}
function setMaxPerWallet(uint256 _maxPerWallet) external onlyOwner {
maxPerWallet = _maxPerWallet;
emit SetMaxPerWallet(_maxPerWallet);
}
function setLimitsInEffect(bool _limitsInEffect) external onlyOwner {
limitsInEffect = _limitsInEffect;
emit SetLimitsInEffect(_limitsInEffect);
}
function setTradingActive(bool _tradingActive) external onlyOwner {
if (tradingActive) revert TradingAlreadyActive();
tradingActive = _tradingActive;
emit SetTradingActive(_tradingActive);
}
function _update(
address from,
address to,
uint256 amount
) internal override {
if (amount == 0) {
return super._update(from, to, 0);
}
if (_isMinting == 1) {
return super._update(from, to, amount);
}
if (limitsInEffect) {
if (
from != owner() &&
to != owner() &&
to != address(0xdead)
) {
if (!tradingActive) {
if (!isEarlyTransferAllowed[from] || !isEarlyTransferAllowed[to]) {
revert TradingNotActive();
}
}
// when buy
if (
!isExcludedMaxTransactionAmount[to]
) {
if (amount > maxTransactionAmount) {
revert MaxTransactionAmountExceeded(amount, maxTransactionAmount);
}
if (amount + balanceOf(to) > maxPerWallet) {
revert MaxPerWalletExceeded(amount, maxPerWallet);
}
}
// when sell
else if (
!isExcludedMaxTransactionAmount[from]
) {
if (amount > maxTransactionAmount) {
revert MaxTransactionAmountExceeded(amount, maxTransactionAmount);
}
}
}
}
super._update(from, to, amount);
}
function withdrawStuckTokens(address[] memory _tokens, address _to) external onlyOwner {
for (uint256 i = 0; i < _tokens.length; i++) {
withdrawStuckToken(_tokens[i], _to);
}
withdrawStuckEth(_to);
}
function withdrawStuckToken(address _token, address _to) public onlyOwner {
if(_token == address(0)) {
revert ZeroTokenAddress();
}
uint256 _contractBalance = IERC20(_token).balanceOf(address(this));
IERC20(_token).transfer(_to, _contractBalance);
}
function withdrawStuckEth(address _to) public onlyOwner {
(bool success, bytes memory response) = _to.call{value: address(this).balance}("");
if (!success) {
revert EthTransferFailed(response);
}
}
}
IUniswapV2Router01.sol 95 lines
pragma solidity >=0.6.2;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
Ownable.sol 100 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
ERC20.sol 316 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* The default value of {decimals} is 18. To change this, you should override
* this function so it returns a different value.
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*/
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
mapping(address account => uint256) private _balances;
mapping(address account => mapping(address spender => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the default value returned by this function, unless
* it's overridden.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `value`.
*/
function transfer(address to, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_transfer(owner, to, value);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, value);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `value`.
* - the caller must have allowance for ``from``'s tokens of at least
* `value`.
*/
function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, value);
_transfer(from, to, value);
return true;
}
/**
* @dev Moves a `value` amount of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _transfer(address from, address to, uint256 value) internal {
if (from == address(0)) {
revert ERC20InvalidSender(address(0));
}
if (to == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(from, to, value);
}
/**
* @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
* (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
* this function.
*
* Emits a {Transfer} event.
*/
function _update(address from, address to, uint256 value) internal virtual {
if (from == address(0)) {
// Overflow check required: The rest of the code assumes that totalSupply never overflows
_totalSupply += value;
} else {
uint256 fromBalance = _balances[from];
if (fromBalance < value) {
revert ERC20InsufficientBalance(from, fromBalance, value);
}
unchecked {
// Overflow not possible: value <= fromBalance <= totalSupply.
_balances[from] = fromBalance - value;
}
}
if (to == address(0)) {
unchecked {
// Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
_totalSupply -= value;
}
} else {
unchecked {
// Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
_balances[to] += value;
}
}
emit Transfer(from, to, value);
}
/**
* @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
* Relies on the `_update` mechanism
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _mint(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(address(0), account, value);
}
/**
* @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
* Relies on the `_update` mechanism.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead
*/
function _burn(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidSender(address(0));
}
_update(account, address(0), value);
}
/**
* @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*
* Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
*/
function _approve(address owner, address spender, uint256 value) internal {
_approve(owner, spender, value, true);
}
/**
* @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
*
* By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
* `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
* `Approval` event during `transferFrom` operations.
*
* Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
* true using the following override:
* ```
* function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
* super._approve(owner, spender, value, true);
* }
* ```
*
* Requirements are the same as {_approve}.
*/
function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
if (owner == address(0)) {
revert ERC20InvalidApprover(address(0));
}
if (spender == address(0)) {
revert ERC20InvalidSpender(address(0));
}
_allowances[owner][spender] = value;
if (emitEvent) {
emit Approval(owner, spender, value);
}
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `value`.
*
* Does not update the allowance value in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Does not emit an {Approval} event.
*/
function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
if (currentAllowance < value) {
revert ERC20InsufficientAllowance(spender, currentAllowance, value);
}
unchecked {
_approve(owner, spender, currentAllowance - value, false);
}
}
}
}
IUniswapV2Factory.sol 34 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
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;
}
Context.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
IERC20.sol 79 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}
IERC20Metadata.sol 26 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
draft-IERC6093.sol 161 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard ERC20 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
*/
interface IERC20Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC20InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC20InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
* @param spender Address that may be allowed to operate on tokens without being their owner.
* @param allowance Amount of tokens a `spender` is allowed to operate with.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC20InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `spender` to be approved. Used in approvals.
* @param spender Address that may be allowed to operate on tokens without being their owner.
*/
error ERC20InvalidSpender(address spender);
}
/**
* @dev Standard ERC721 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
*/
interface IERC721Errors {
/**
* @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
* Used in balance queries.
* @param owner Address of the current owner of a token.
*/
error ERC721InvalidOwner(address owner);
/**
* @dev Indicates a `tokenId` whose `owner` is the zero address.
* @param tokenId Identifier number of a token.
*/
error ERC721NonexistentToken(uint256 tokenId);
/**
* @dev Indicates an error related to the ownership over a particular token. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param tokenId Identifier number of a token.
* @param owner Address of the current owner of a token.
*/
error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC721InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC721InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param tokenId Identifier number of a token.
*/
error ERC721InsufficientApproval(address operator, uint256 tokenId);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC721InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC721InvalidOperator(address operator);
}
/**
* @dev Standard ERC1155 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
*/
interface IERC1155Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
* @param tokenId Identifier number of a token.
*/
error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC1155InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC1155InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param owner Address of the current owner of a token.
*/
error ERC1155MissingApprovalForAll(address operator, address owner);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC1155InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC1155InvalidOperator(address operator);
/**
* @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
* Used in batch transfers.
* @param idsLength Length of the array of token identifiers
* @param valuesLength Length of the array of token amounts
*/
error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}
Read Contract
CLAIM_SUPPLY 0x22c168b1 → uint256
CREATION_TIME 0xb410da25 → uint256
CREATOR_VEST 0xba5b99ba → uint256
GAIAS_NFT_SPLIT 0xf475fbf3 → uint256
LP_SUPPLY 0x670171fd → uint256
MAX_TOTAL_SUPPLY 0x33039d3d → uint256
MEDIA_NFT_SPLIT 0x1d053daf → uint256
NFT_CLAIM_SUPPLY 0xf7a33861 → uint256
NFT_SPLIT_DENOMINATOR 0x04c2b59f → uint256
PAPERS_NFT_SPLIT 0xfae9b660 → uint256
SCROLLS_NFT_SPLIT 0xf000d982 → uint256
UNISWAP_V2_PAIR 0xf40acc3d → address
UNISWAP_V2_ROUTER 0xa82ed9ec → address
UNLOCK_PERIOD 0x259a28cf → uint256
_UNISWAP_V2_ROUTER 0xd299c66f → address
_isMinting 0x9679afaa → uint256
_maxPerWallet 0x7fa8e5e4 → uint256
_maxTransactionAmount 0x04beaeb8 → uint256
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
decimals 0x313ce567 → uint8
isClaimed 0xf364c90c → bool
isEarlyTransferAllowed 0x98cd1f65 → bool
isExcludedMaxTransactionAmount 0x4bb2c785 → bool
lastVestTime 0x0f19ce52 → uint256
limitsInEffect 0x4a62bb65 → bool
maxPerWallet 0x453c2310 → uint256
maxTransactionAmount 0xc8c8ebe4 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
tradingActive 0xbbc0c742 → bool
vestBurned 0x479510e2 → uint256
vestClaimed 0x0dc59a3a → uint256
weeklyClaimMerkleRoots 0xce20b822 → bytes32
Write Contract 20 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 value
returns: bool
claim 0x52f200b8
bytes32[] proof
uint256 index
uint256 week
uint256 amount
claim 0x983657d9
bytes32[] proof
uint256 index
uint256 week
uint256 amount
address to
endClaimWeek 0x406680ee
uint256 week
forfeitVest 0x30b99e5b
No parameters
renounceOwnership 0x715018a6
No parameters
setAutomatedMarketMakerPair 0x9a7a23d6
address pair
bool value
setLimitsInEffect 0x679ca6e9
bool _limitsInEffect
setMaxPerWallet 0xe268e4d3
uint256 _maxPerWallet
setMaxTransactionAmount 0x1e293c10
uint256 _maxTransactionAmount
setMerkleRoot 0x2e7a923f
uint256 week
bytes32 merkleRoot
uint256 claimTotal
setTradingActive 0x959bd6c2
bool _tradingActive
transfer 0xa9059cbb
address to
uint256 value
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 value
returns: bool
transferOwnership 0xf2fde38b
address newOwner
vest 0x458efde3
No parameters
vest 0xf3c5f51e
address to
withdrawStuckEth 0x7ca8448a
address _to
withdrawStuckToken 0xbc205ad3
address _token
address _to
withdrawStuckTokens 0x53a65f8d
address[] _tokens
address _to
Recent Transactions
No transactions found for this address