{"sources":{"src/DickLaunchpad.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\";\nimport {DickToken} from \"./DickToken.sol\";\n\ninterface IAgentRegistrar {\n    function handleOf(address account) external view returns (string memory);\n    function ownerOf(uint256 tokenId) external view returns (address);\n}\n\ninterface IPancakeRouterV2Like {\n    function factory() external view returns (address);\n    function WETH() external view returns (address);\n}\n\ninterface IPancakePairV2Like {\n    function getReserves() external view returns (uint112, uint112, uint32);\n    function token0() external view returns (address);\n    function token1() external view returns (address);\n    function mint(address to) external returns (uint256);\n}\n\ninterface IWBNB {\n    function deposit() external payable;\n    function withdraw(uint256 amount) external;\n}\n\n/// @title DICK mint launchpad\n/// @notice Adapted from the verified GANG AGENT launchpad (BSC 0x479a0AE38ee8fefa9c101F9261EAe114eB8dd842).\n///  - 10,000 shares at 0.002 BNB, Binance Agent ID holders only (SPACE ID Agent ID registry, `accountAgent` as GANG).\n///  - Each share: 50,000,000 DICK to the minter + 35,000,000 DICK reserved for the pool.\n///  - Quota: 10 shares per Agent ID, +1 for every invited Agent ID's first paid mint.\n///  - Payment split, held in this contract until open: 70% pool (as WBNB) / 10% valid referrer / 20% treasury;\n///    without a valid referrer 70% pool / 30% treasury.\n///  - The 10,000th share opens the PancakeSwap V2 pool in the same transaction (14 BNB + 350,000,000,000 DICK),\n///    LP minted to 0xdEaD. After open: treasury and referrers pull their accrued BNB.\n///  - Not filled by MINT_DEADLINE (deploy + 7 days): minting stops, every payer can claim a 100% refund\n///    (their DICK is burned), referral/treasury accruals are void.\n///  - Trading tax (in DickToken): 2% buy / 2% sell = 1% burned to 0xdEaD + 1% paid to holders as BNB dividends.\n///    Nothing from the tax goes to the treasury.\n///  - No owner, no pause, no early open, no parameter setters. One deviation from the original:\n///    the treasury (and only the treasury) can call `withdraw()` to sweep this contract's native\n///    BNB balance to itself at any time. The pool share of every mint is wrapped to WBNB at mint\n///    time and is NOT touched by the sweep, so pool seeding is unaffected; but treasury/referral\n///    accruals swept before they are claimed, and the non-pool part of refunds after a failed sale,\n///    become unbacked until the operator re-funds the contract. That re-funding duty rests on the\n///    operator, as in the operator's earlier operator-pot projects; no escrow or code guarantee\n///    stands behind it.\ncontract DickLaunchpad is ReentrancyGuard {\n    using SafeERC20 for IERC20;\n\n    // ---- fixed parameters -------------------------------------------------------------------\n    uint256 public constant BPS = 10_000;\n    uint256 public constant LP_BPS = 7_000;\n    uint256 public constant REFERRAL_BPS = 1_000;\n    uint256 public constant TREASURY_BPS_WITH_REFERRER = 2_000;\n    uint256 public constant TREASURY_BPS_NO_REFERRER = 3_000;\n    uint256 public constant MAX_SHARES = 10_000;\n    uint256 public constant BASE_QUOTA = 10;\n    uint256 public constant MAX_SHARES_PER_TX = 10;\n    uint256 public constant SHARE_PRICE = 0.002 ether;\n    uint256 public constant TOKENS_PER_SHARE = 50_000_000 ether;\n    uint256 public constant POOL_TOKENS_PER_SHARE = 35_000_000 ether;\n    uint256 public constant OPEN_BNB = MAX_SHARES * SHARE_PRICE * LP_BPS / BPS; // 14 BNB\n    uint256 public constant OPEN_TOKENS = MAX_SHARES * POOL_TOKENS_PER_SHARE; // 350,000,000,000 DICK\n    uint256 public constant MINT_WINDOW = 7 days;\n\n    address public constant DEAD = 0x000000000000000000000000000000000000dEaD;\n    address public constant AGENT_REGISTRY = 0x60B9262456dE011F7d15a54CdD8c48bAaa8B022F;\n    address public constant ROUTER = 0x10ED43C718714eb63d5aA57B78B54704E256024E;\n    address public constant WBNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\n\n    /// @notice No owner exists. Kept for explorers / scanners.\n    address public constant owner = address(0);\n    bool public constant paused = false;\n\n    address public immutable token;\n    address public immutable pair;\n    address public immutable treasury;\n    /// @notice Set once in the constructor: deployment time + 7 days. Minting is allowed while\n    /// block.timestamp <= MINT_DEADLINE; refunds open when block.timestamp > MINT_DEADLINE and the pool never opened.\n    uint256 public immutable MINT_DEADLINE;\n\n    // ---- state ------------------------------------------------------------------------------\n    uint256 public totalMinted;\n    uint256 public totalPaid;\n    uint256 public pendingPoolBnb; // WBNB held for the pool\n    uint256 public pendingPoolTokens; // DICK held for the pool\n    bool public opened;\n    uint256 public openedAt;\n\n    uint256 public treasuryAccrued; // native BNB owed to treasury (claimable after open)\n    uint256 public totalReferralAccrued; // native BNB owed to referrers (claimable after open)\n    mapping(address => uint256) public referralAccrued;\n\n    mapping(uint256 => uint256) public mintedByAgent;\n    mapping(uint256 => uint256) public extraQuota;\n    mapping(uint256 => bool) public paidOnce;\n\n    // per paying address, for refunds\n    mapping(address => uint256) public paidBy;\n    mapping(address => uint256) public poolBnbBy;\n    mapping(address => uint256) public sharesBy;\n    uint256 public totalRefunded;\n\n    // ---- errors / events --------------------------------------------------------------------\n    error ZeroAddress();\n    error RouterNotConfigured();\n    error InvalidPair();\n    error InvalidQuantity();\n    error SupplyExceeded();\n    error QuotaExceeded();\n    error AgentIdRequired();\n    error BadPayment();\n    error MintClosed();\n    error AlreadyOpen();\n    error NotOpen();\n    error RefundUnavailable();\n    error NothingToClaim();\n    error PayoutFailed();\n    error OnlyWBNB();\n    error NotTreasury();\n\n    event Minted(address indexed minter, uint256 indexed agentId, uint256 shares, uint256 paid, address indexed referrer, uint256 referralReward);\n    event QuotaGranted(address indexed referrer, uint256 indexed agentId, uint256 extra);\n    event PoolOpened(address indexed pair, uint256 bnbAmount, uint256 tokenAmount, uint256 liquidity);\n    event Refunded(address indexed minter, address to, uint256 shares, uint256 amount);\n    event ReferralClaimed(address indexed referrer, address to, uint256 amount);\n    event TreasuryClaimed(uint256 amount);\n    event Withdrawn(address to, uint256 amount);\n\n    constructor(address treasury_) {\n        if (treasury_ == address(0) || treasury_ == DEAD) revert ZeroAddress();\n        if (IPancakeRouterV2Like(ROUTER).WETH() != WBNB) revert RouterNotConfigured();\n        address factory = IPancakeRouterV2Like(ROUTER).factory();\n        if (factory.code.length == 0) revert RouterNotConfigured();\n        treasury = treasury_;\n        MINT_DEADLINE = block.timestamp + MINT_WINDOW;\n        DickToken t = new DickToken(address(this), WBNB, ROUTER);\n        token = address(t);\n        address p = t.pair();\n        address t0 = IPancakePairV2Like(p).token0();\n        address t1 = IPancakePairV2Like(p).token1();\n        if (!((t0 == address(t) && t1 == WBNB) || (t0 == WBNB && t1 == address(t)))) revert InvalidPair();\n        pair = p;\n    }\n\n    /// @dev Only WBNB unwraps. Plain BNB transfers are rejected: use mint().\n    receive() external payable {\n        if (msg.sender != WBNB) revert OnlyWBNB();\n    }\n\n    // ---- views ------------------------------------------------------------------------------\n    /// @notice Same lookup as GANG: handleOf(account) -> id = keccak256(handle) -> ownerOf(id) must be account.\n    function accountAgent(address account) public view returns (uint256) {\n        if (account == address(0)) return 0;\n        try IAgentRegistrar(AGENT_REGISTRY).handleOf(account) returns (string memory handle) {\n            if (bytes(handle).length == 0) return 0;\n            uint256 id = uint256(keccak256(bytes(handle)));\n            try IAgentRegistrar(AGENT_REGISTRY).ownerOf(id) returns (address holder) {\n                return holder == account ? id : 0;\n            } catch {\n                return 0;\n            }\n        } catch {\n            return 0;\n        }\n    }\n\n    function costOf(uint256 shares) public pure returns (uint256) { return shares * SHARE_PRICE; }\n    function quotaOf(uint256 agentId) public view returns (uint256) { return BASE_QUOTA + extraQuota[agentId]; }\n    function remainingQuota(address account) external view returns (uint256) {\n        uint256 id = accountAgent(account);\n        if (id == 0) return 0;\n        uint256 q = quotaOf(id);\n        uint256 m = mintedByAgent[id];\n        return q > m ? q - m : 0;\n    }\n    function isValidReferrer(address referrer, address minter) public view returns (bool) {\n        if (referrer == address(0) || referrer == minter) return false;\n        uint256 rid = accountAgent(referrer);\n        return rid != 0 && rid != accountAgent(minter);\n    }\n    function mintOpen() public view returns (bool) { return !opened && block.timestamp <= MINT_DEADLINE && totalMinted < MAX_SHARES; }\n    function refundMode() public view returns (bool) { return !opened && block.timestamp > MINT_DEADLINE; }\n    function reserves() public view returns (uint256 bnb, uint256 tokens) {\n        (uint112 r0, uint112 r1,) = IPancakePairV2Like(pair).getReserves();\n        return IPancakePairV2Like(pair).token0() == token ? (uint256(r1), uint256(r0)) : (uint256(r0), uint256(r1));\n    }\n\n    // ---- mint -------------------------------------------------------------------------------\n    /// @param shares 1..10 per transaction, msg.value must equal shares * 0.002 BNB.\n    /// @param referrer optional; valid when != msg.sender and holds a (different) Agent ID.\n    function mint(uint256 shares, address referrer) external payable nonReentrant {\n        if (opened) revert AlreadyOpen();\n        if (block.timestamp > MINT_DEADLINE) revert MintClosed();\n        if (shares == 0 || shares > MAX_SHARES_PER_TX) revert InvalidQuantity();\n        if (totalMinted + shares > MAX_SHARES) revert SupplyExceeded();\n        uint256 id = accountAgent(msg.sender);\n        if (id == 0) revert AgentIdRequired();\n        if (mintedByAgent[id] + shares > quotaOf(id)) revert QuotaExceeded();\n        uint256 cost = shares * SHARE_PRICE;\n        if (msg.value != cost) revert BadPayment();\n\n        // referral validity\n        address ref = address(0);\n        if (referrer != address(0) && referrer != msg.sender) {\n            uint256 rid = accountAgent(referrer);\n            if (rid != 0 && rid != id) {\n                ref = referrer;\n                if (!paidOnce[id]) {\n                    extraQuota[rid] += 1;\n                    emit QuotaGranted(referrer, rid, 1);\n                }\n            }\n        }\n        paidOnce[id] = true;\n        mintedByAgent[id] += shares;\n\n        uint256 toPool = cost * LP_BPS / BPS;\n        uint256 toRef = ref != address(0) ? cost * REFERRAL_BPS / BPS : 0;\n        uint256 toTreasury = cost - toPool - toRef;\n\n        if (toRef != 0) {\n            referralAccrued[ref] += toRef;\n            totalReferralAccrued += toRef;\n        }\n        treasuryAccrued += toTreasury;\n        pendingPoolBnb += toPool;\n        pendingPoolTokens += shares * POOL_TOKENS_PER_SHARE;\n        paidBy[msg.sender] += cost;\n        poolBnbBy[msg.sender] += toPool;\n        sharesBy[msg.sender] += shares;\n        totalPaid += cost;\n        totalMinted += shares;\n\n        IWBNB(WBNB).deposit{value: toPool}();\n        DickToken(payable(token)).mint(address(this), shares * POOL_TOKENS_PER_SHARE);\n        DickToken(payable(token)).mint(msg.sender, shares * TOKENS_PER_SHARE);\n        emit Minted(msg.sender, id, shares, cost, ref, toRef);\n\n        if (totalMinted == MAX_SHARES) _openPool();\n    }\n\n    function _openPool() private {\n        uint256 amountBnb = pendingPoolBnb;\n        uint256 amountTokens = pendingPoolTokens;\n        if (amountBnb != OPEN_BNB || amountTokens != OPEN_TOKENS) revert BadPayment();\n        pendingPoolBnb = 0;\n        pendingPoolTokens = 0;\n        opened = true;\n        openedAt = block.timestamp;\n        IERC20(WBNB).safeTransfer(pair, amountBnb);\n        IERC20(token).safeTransfer(pair, amountTokens);\n        uint256 liquidity = IPancakePairV2Like(pair).mint(DEAD);\n        DickToken(payable(token)).enableTrading();\n        emit PoolOpened(pair, amountBnb, amountTokens, liquidity);\n    }\n\n    // ---- refund (pool never opened, deadline passed) -----------------------------------------\n    function claimRefund() external { _refund(payable(msg.sender)); }\n    /// @notice Same as claimRefund but pays to `to` (for wallets that cannot receive BNB).\n    function claimRefundTo(address payable to) external { _refund(to); }\n\n    function _refund(address payable to) private nonReentrant {\n        if (!refundMode()) revert RefundUnavailable();\n        if (to == address(0)) revert ZeroAddress();\n        uint256 amount = paidBy[msg.sender];\n        if (amount == 0) revert NothingToClaim();\n        uint256 poolPart = poolBnbBy[msg.sender];\n        uint256 shares = sharesBy[msg.sender];\n        paidBy[msg.sender] = 0;\n        poolBnbBy[msg.sender] = 0;\n        sharesBy[msg.sender] = 0;\n        pendingPoolBnb -= poolPart;\n        pendingPoolTokens -= shares * POOL_TOKENS_PER_SHARE;\n        totalRefunded += amount;\n        DickToken(payable(token)).burnFrom(msg.sender, shares * TOKENS_PER_SHARE);\n        DickToken(payable(token)).burnFrom(address(this), shares * POOL_TOKENS_PER_SHARE);\n        IWBNB(WBNB).withdraw(poolPart);\n        (bool ok,) = to.call{value: amount}(\"\");\n        if (!ok) revert PayoutFailed();\n        emit Refunded(msg.sender, to, shares, amount);\n    }\n\n    // ---- pull payouts after open -------------------------------------------------------------\n    function claimReferral() external { _claimReferral(payable(msg.sender)); }\n    function claimReferralTo(address payable to) external { _claimReferral(to); }\n\n    function _claimReferral(address payable to) private nonReentrant {\n        if (!opened) revert NotOpen();\n        if (to == address(0)) revert ZeroAddress();\n        uint256 amount = referralAccrued[msg.sender];\n        if (amount == 0) revert NothingToClaim();\n        referralAccrued[msg.sender] = 0;\n        totalReferralAccrued -= amount;\n        (bool ok,) = to.call{value: amount}(\"\");\n        if (!ok) revert PayoutFailed(); // reverts keep the referrer's balance intact\n        emit ReferralClaimed(msg.sender, to, amount);\n    }\n\n    /// @notice Anyone may trigger; BNB always goes to the fixed treasury.\n    function claimTreasury() external nonReentrant {\n        if (!opened) revert NotOpen();\n        uint256 amount = treasuryAccrued;\n        if (amount == 0) revert NothingToClaim();\n        treasuryAccrued = 0;\n        (bool ok,) = payable(treasury).call{value: amount}(\"\");\n        if (!ok) revert PayoutFailed();\n        emit TreasuryClaimed(amount);\n    }\n\n    // ---- treasury sweep (DICK deviation from the original design) --------------------------\n    /// @notice Treasury only: sweeps this contract's entire native BNB balance to the treasury.\n    ///         The WBNB pool share is not touched, and the accrual counters (treasuryAccrued,\n    ///         referralAccrued, paidBy) are NOT reduced: swept amounts stay recorded as\n    ///         obligations and become payable again once the operator re-funds the contract.\n    ///         Plain BNB cannot be sent in (receive() stays shut, as in the original); the only\n    ///         re-funding route is a forced transfer, e.g. a one-shot helper selfdestruct.\n    function withdraw() external nonReentrant {\n        if (msg.sender != treasury) revert NotTreasury();\n        uint256 amount = address(this).balance;\n        if (amount == 0) revert NothingToClaim();\n        (bool ok,) = payable(treasury).call{value: amount}(\"\");\n        if (!ok) revert PayoutFailed();\n        emit Withdrawn(treasury, amount);\n    }\n}\n"},"src/DickToken.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\";\n\ninterface IPancakeFactoryLike {\n    function getPair(address a, address b) external view returns (address);\n    function createPair(address a, address b) external returns (address);\n}\n\ninterface IPancakeRouterLike {\n    function factory() external view returns (address);\n    function swapExactTokensForETHSupportingFeeOnTransferTokens(\n        uint256 amountIn,\n        uint256 amountOutMin,\n        address[] calldata path,\n        address to,\n        uint256 deadline\n    ) external;\n}\n\ninterface IPancakePairLike {\n    function getReserves() external view returns (uint112, uint112, uint32);\n    function token0() external view returns (address);\n}\n\n/// @title DICK token with BNB holder dividends\n/// @notice Adapted from the verified GANG AGENT token (BSC 0x97E415030780aAB6b15087D415479C2cE1c09B0A).\n/// After the pool opens, buy and sell each pay 2%: 1% is sent to 0xdEaD (burn) and 1% stays in this\n/// contract as the dividend pool. The pooled DICK is sold for BNB on PancakeSwap V2 (permissionless\n/// `swapDividends()`, plus a bounded opportunistic swap on sells that can never revert the sell and one\n/// on `claimDividend()`) and\n/// the BNB is distributed pro rata to every holder (magnified dividend-per-share accounting).\n/// Holders pull their BNB with `claimDividend()`.\n/// Before the pool opens only the launchpad can move tokens. No owner, no tax change, no blacklist,\n/// no exclusion setters.\ncontract DickToken is ERC20, ReentrancyGuard {\n    uint256 public constant MAX_SUPPLY = 850_000_000_000 ether;\n    uint256 public constant BUY_BURN_BPS = 100;\n    uint256 public constant BUY_DIVIDEND_BPS = 100;\n    uint256 public constant SELL_BURN_BPS = 100;\n    uint256 public constant SELL_DIVIDEND_BPS = 100;\n    uint256 private constant BPS = 10_000;\n    uint256 private constant PROBE_GAS = 20_000;\n    address public constant DEAD = 0x000000000000000000000000000000000000dEaD;\n    /// @dev PancakeSwap Infinity vault on BSC (holds tokens of every Infinity pool). Blocked so that\n    /// no side pool can bypass the tax, same purpose as GANG's `infinityVault` slot.\n    address public constant INFINITY_VAULT = 0x238a358808379702088667322f80aC48bAd5e6c4;\n\n    // ---- dividend parameters ----------------------------------------------------------------\n    /// @dev Standard magnified dividend-per-share precision (DividendPayingToken).\n    uint256 private constant MAGNITUDE = 2 ** 128;\n    /// @notice Each swap sells at most this share of the pool's DICK reserve (0.1%).\n    uint256 public constant SWAP_MAX_BPS = 10;\n    /// @notice A sell triggers the opportunistic swap only when the dividend pool holds at least\n    /// this share of the pool's DICK reserve (0.01%).\n    uint256 public constant AUTO_SWAP_MIN_BPS = 1;\n    /// @notice Gas forwarded to the opportunistic swap inside a sell, and the minimum gas left\n    /// before it is attempted at all.\n    uint256 public constant AUTO_SWAP_GAS = 300_000;\n    uint256 public constant AUTO_SWAP_GAS_FLOOR = 500_000;\n    /// @notice BNB is credited only while non-excluded holders own at least this much DICK\n    /// (keeps the per-share math far from overflow); otherwise it waits in `undistributedDividends`.\n    uint256 public constant MIN_SHARES_FOR_DISTRIBUTION = 1_000_000 ether;\n\n    address public immutable wbnb;\n    address public immutable router;\n    address public immutable pair;\n    /// @notice The launchpad. Only it can mint, burn (refunds, pre-open only) and enable trading.\n    address public immutable minter;\n    bool public tradingEnabled;\n\n    // ---- dividend state ---------------------------------------------------------------------\n    uint256 public magnifiedDividendPerShare;\n    mapping(address => int256) public magnifiedDividendCorrections;\n    mapping(address => uint256) public withdrawnDividends;\n    /// @notice Sum of DICK balances of all holders that earn dividends.\n    uint256 public totalDividendShares;\n    uint256 public totalDividendsDistributed;\n    uint256 public totalDividendsWithdrawn;\n    /// @notice BNB received from swaps but not yet credited (only while total shares are tiny).\n    uint256 public undistributedDividends;\n    uint256 public lastSwapBlock;\n    bool private _inSwap;\n\n    event TradingEnabled(uint256 at);\n    event DividendSwap(uint256 tokensIn, uint256 bnbOut);\n    event DividendsDistributed(uint256 amount, uint256 totalShares);\n    event DividendClaimed(address indexed holder, address to, uint256 amount);\n    event AutoSwapSkipped(uint256 tokens);\n\n    error NotMinter();\n    error ZeroAddress();\n    error TransfersClosed();\n    error PoolRejected();\n    error SupplyCap();\n    error TradingAlreadyOpen();\n    error NotOpen();\n    error NothingToSwap();\n    error SwappedThisBlock();\n    error NothingToClaim();\n    error PayoutFailed();\n    error OnlySelf();\n    error OnlyRouter();\n    error NeedMoreGas();\n\n    constructor(address minter_, address wbnb_, address router_) ERC20(\"DICK\", \"DICK\") {\n        if (minter_ == address(0) || wbnb_ == address(0) || router_ == address(0)) revert ZeroAddress();\n        minter = minter_;\n        wbnb = wbnb_;\n        router = router_;\n        address factory_ = IPancakeRouterLike(router_).factory();\n        // Tolerate a front-run createPair for the predictable token address.\n        address p = IPancakeFactoryLike(factory_).getPair(address(this), wbnb_);\n        if (p == address(0)) p = IPancakeFactoryLike(factory_).createPair(address(this), wbnb_);\n        pair = p;\n        _approve(address(this), router_, type(uint256).max);\n    }\n\n    /// @dev Only the router, during a dividend swap, can send BNB here.\n    receive() external payable {\n        if (msg.sender != router || !_inSwap) revert OnlyRouter();\n    }\n\n    modifier onlyMinter() {\n        if (msg.sender != minter) revert NotMinter();\n        _;\n    }\n\n    function owner() external pure returns (address) { return address(0); }\n    /// @notice The 1% dividend tax is held by the token contract itself.\n    function taxVault() external view returns (address) { return address(this); }\n\n    /// @notice Only before trading opens (all supply is created during the mint phase).\n    function mint(address to, uint256 amount) external onlyMinter {\n        if (tradingEnabled) revert TradingAlreadyOpen();\n        if (totalSupply() + amount > MAX_SUPPLY) revert SupplyCap();\n        _mint(to, amount);\n    }\n\n    /// @notice Refund path only: burns a refunded minter's DICK. Impossible once trading is open.\n    function burnFrom(address account, uint256 amount) external onlyMinter {\n        if (tradingEnabled) revert TradingAlreadyOpen();\n        _burn(account, amount);\n    }\n\n    function enableTrading() external onlyMinter {\n        if (tradingEnabled) return;\n        tradingEnabled = true;\n        emit TradingEnabled(block.timestamp);\n    }\n\n    function rejects(address to) public view returns (bool) {\n        if (to == pair) return false;\n        if (to == INFINITY_VAULT) return true;\n        return _isOtherPair(to);\n    }\n\n    function _isOtherPair(address a) private view returns (bool) {\n        uint256 size = a.code.length;\n        if (size == 0) return false;\n        if (size == 23) {\n            bytes memory code = a.code;\n            // EIP-7702 delegated EOA (e.g. smart agent wallets) is not a pool.\n            if (code[0] == 0xef && code[1] == 0x01 && code[2] == 0x00) return false;\n        }\n        address t0 = _probe(a, 0x0dfe1681); // token0()\n        if (t0 == address(this)) return _probe(a, 0xd21220a7) != address(0); // token1()\n        if (t0 == address(0)) return false;\n        return _probe(a, 0xd21220a7) == address(this);\n    }\n\n    function _probe(address a, bytes4 selector) private view returns (address out) {\n        (bool ok, bytes memory data) = a.staticcall{gas: PROBE_GAS}(abi.encodeWithSelector(selector));\n        if (!ok || data.length != 32) return address(0);\n        uint256 word = abi.decode(data, (uint256));\n        if (word >> 160 != 0) return address(0);\n        out = address(uint160(word));\n    }\n\n    // ---- dividend views ---------------------------------------------------------------------\n    /// @notice Fixed at deployment: the pair, 0xdEaD, address(0), the launchpad and this contract.\n    function isExcludedFromDividends(address a) public view returns (bool) {\n        return a == pair || a == DEAD || a == address(0) || a == minter || a == address(this);\n    }\n\n    /// @notice DICK balance that earns dividends (0 for excluded addresses). No minimum balance.\n    function dividendSharesOf(address a) public view returns (uint256) {\n        return isExcludedFromDividends(a) ? 0 : balanceOf(a);\n    }\n\n    function accumulativeDividendOf(address a) public view returns (uint256) {\n        if (isExcludedFromDividends(a)) return 0;\n        int256 v = int256(magnifiedDividendPerShare * balanceOf(a)) + magnifiedDividendCorrections[a];\n        return v <= 0 ? 0 : uint256(v) / MAGNITUDE;\n    }\n\n    /// @notice Unclaimed BNB dividends of `a`.\n    function withdrawableDividendOf(address a) public view returns (uint256) {\n        uint256 acc = accumulativeDividendOf(a);\n        uint256 w = withdrawnDividends[a];\n        return acc > w ? acc - w : 0;\n    }\n\n    /// @notice DICK collected by the 1% dividend tax, waiting to be sold for BNB.\n    function pendingDividendTokens() external view returns (uint256) { return balanceOf(address(this)); }\n\n    // ---- dividend actions -------------------------------------------------------------------\n    /// @notice Sends the caller's unclaimed BNB dividends to the caller.\n    function claimDividend() external { _claim(payable(msg.sender)); }\n\n    /// @notice Same as claimDividend but pays to `to` (for wallets/contracts that cannot receive BNB).\n    function claimDividendTo(address payable to) external { _claim(to); }\n\n    function _claim(address payable to) private nonReentrant {\n        if (to == address(0)) revert ZeroAddress();\n        // Convert a due dividend pool first so the claimer (and everyone) is credited. A failing swap\n        // never blocks the claim; only a claim sent with too little gas for a due swap reverts, so that\n        // wallets' gas estimates include the swap.\n        _tryAutoSwap(true);\n        uint256 amount = withdrawableDividendOf(msg.sender);\n        if (amount == 0) revert NothingToClaim();\n        withdrawnDividends[msg.sender] += amount;\n        totalDividendsWithdrawn += amount;\n        (bool ok,) = to.call{value: amount}(\"\");\n        if (!ok) revert PayoutFailed(); // the holder's balance stays intact\n        emit DividendClaimed(msg.sender, to, amount);\n    }\n\n    /// @notice Anyone may call (once per block): sells up to 0.1% of the pool's DICK reserve from the\n    /// dividend pool for BNB and distributes it pro rata to holders.\n    function swapDividends() external nonReentrant {\n        if (!tradingEnabled) revert NotOpen();\n        if (lastSwapBlock == block.number) revert SwappedThisBlock();\n        uint256 amount = _swapAmount();\n        if (amount == 0) revert NothingToSwap();\n        _swapAndDistribute(amount);\n    }\n\n    /// @dev External only so sells/claims can run it inside try/catch; callable by this contract only.\n    function autoSwap(uint256 amount) external {\n        if (msg.sender != address(this)) revert OnlySelf();\n        _swapAndDistribute(amount);\n    }\n\n    function _poolTokenReserve() private view returns (uint256) {\n        (uint112 r0, uint112 r1,) = IPancakePairLike(pair).getReserves();\n        return IPancakePairLike(pair).token0() == address(this) ? uint256(r0) : uint256(r1);\n    }\n\n    function _swapAmount() private view returns (uint256 amount) {\n        amount = balanceOf(address(this));\n        uint256 cap = _poolTokenReserve() * SWAP_MAX_BPS / BPS;\n        if (amount > cap) amount = cap;\n    }\n\n    function _swapAndDistribute(uint256 amount) private {\n        _inSwap = true;\n        lastSwapBlock = block.number;\n        uint256 before = address(this).balance;\n        address[] memory path = new address[](2);\n        path[0] = address(this);\n        path[1] = wbnb;\n        IPancakeRouterLike(router).swapExactTokensForETHSupportingFeeOnTransferTokens(\n            amount, 0, path, address(this), block.timestamp\n        );\n        uint256 out = address(this).balance - before;\n        _inSwap = false;\n        emit DividendSwap(amount, out);\n        _distribute(out);\n    }\n\n    function _distribute(uint256 amount) private {\n        uint256 total = undistributedDividends + amount;\n        if (total == 0) return;\n        uint256 shares = totalDividendShares;\n        if (shares < MIN_SHARES_FOR_DISTRIBUTION) {\n            undistributedDividends = total;\n            return;\n        }\n        undistributedDividends = 0;\n        magnifiedDividendPerShare += total * MAGNITUDE / shares;\n        totalDividendsDistributed += total;\n        emit DividendsDistributed(total, shares);\n    }\n\n    /// @dev Bounded and caught: skipped when in-swap, already swapped this block or under threshold;\n    /// any failure inside the swap is caught and the DICK simply stays in the dividend pool.\n    /// On sells (`strictGas` false) it is also skipped when gas is short, so it can never revert a trade.\n    /// On claims (`strictGas` true) a due swap with too little gas reverts with NeedMoreGas.\n    function _tryAutoSwap(bool strictGas) private {\n        if (_inSwap || lastSwapBlock == block.number || !tradingEnabled) return;\n        uint256 bal = balanceOf(address(this));\n        if (bal == 0) return;\n        (bool ok, bytes memory data) = pair.staticcall(abi.encodeWithSelector(IPancakePairLike.getReserves.selector));\n        if (!ok || data.length < 64) return;\n        (uint256 r0, uint256 r1) = abi.decode(data, (uint256, uint256));\n        uint256 reserve = address(this) < wbnb ? r0 : r1; // token0 is the lower address\n        if (bal < reserve * AUTO_SWAP_MIN_BPS / BPS) return;\n        uint256 cap = reserve * SWAP_MAX_BPS / BPS;\n        uint256 amount = bal > cap ? cap : bal;\n        if (amount == 0) return;\n        if (gasleft() < AUTO_SWAP_GAS_FLOOR) {\n            if (strictGas) revert NeedMoreGas();\n            return;\n        }\n        try this.autoSwap{gas: AUTO_SWAP_GAS}(amount) {}\n        catch {\n            lastSwapBlock = block.number; // at most one failed attempt per block\n            emit AutoSwapSkipped(amount);\n        }\n    }\n\n    // ---- transfers --------------------------------------------------------------------------\n    /// @dev Balance move + dividend share bookkeeping.\n    function _move(address from, address to, uint256 value) private {\n        super._update(from, to, value);\n        if (value == 0) return;\n        uint256 mdps = magnifiedDividendPerShare;\n        if (!isExcludedFromDividends(from)) {\n            totalDividendShares -= value;\n            magnifiedDividendCorrections[from] += int256(mdps * value);\n        }\n        if (!isExcludedFromDividends(to)) {\n            totalDividendShares += value;\n            magnifiedDividendCorrections[to] -= int256(mdps * value);\n        }\n    }\n\n    function _update(address from, address to, uint256 value) internal override {\n        // Mints and refund burns (both minter-only, pre-open only).\n        if (from == address(0) || to == address(0)) {\n            _move(from, to, value);\n            return;\n        }\n        address m = minter;\n        if (!tradingEnabled) {\n            if (from != m) revert TransfersClosed();\n            _move(from, to, value);\n            return;\n        }\n        if (rejects(to)) revert PoolRejected();\n        // Launchpad and the dividend swap itself are untaxed.\n        if (from == m || to == m || from == address(this)) {\n            _move(from, to, value);\n            return;\n        }\n        if (from == pair) {\n            uint256 burnt = (value * BUY_BURN_BPS) / BPS;\n            uint256 kept = (value * BUY_DIVIDEND_BPS) / BPS;\n            _move(from, DEAD, burnt);\n            _move(from, address(this), kept);\n            _move(from, to, value - burnt - kept);\n        } else if (to == pair) {\n            _tryAutoSwap(false);\n            uint256 burnt = (value * SELL_BURN_BPS) / BPS;\n            uint256 kept = (value * SELL_DIVIDEND_BPS) / BPS;\n            _move(from, DEAD, burnt);\n            _move(from, address(this), kept);\n            _move(from, to, value - burnt - kept);\n        } else {\n            _move(from, to, value);\n        }\n    }\n}\n"},"@openzeppelin/contracts/token/ERC20/IERC20.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the value of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the value of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the\n     * allowance mechanism. `value` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n"},"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\nimport {IERC1363} from \"../../../interfaces/IERC1363.sol\";\nimport {Address} from \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n    /**\n     * @dev An operation with an ERC-20 token failed.\n     */\n    error SafeERC20FailedOperation(address token);\n\n    /**\n     * @dev Indicates a failed `decreaseAllowance` request.\n     */\n    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n    /**\n     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     */\n    function safeTransfer(IERC20 token, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\n    }\n\n    /**\n     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n     */\n    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\n    }\n\n    /**\n     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     *\n     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the \"client\"\n     * smart contract uses ERC-7674 to set temporary allowances, then the \"client\" smart contract should avoid using\n     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract\n     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.\n     */\n    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n        uint256 oldAllowance = token.allowance(address(this), spender);\n        forceApprove(token, spender, oldAllowance + value);\n    }\n\n    /**\n     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no\n     * value, non-reverting calls are assumed to be successful.\n     *\n     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the \"client\"\n     * smart contract uses ERC-7674 to set temporary allowances, then the \"client\" smart contract should avoid using\n     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract\n     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.\n     */\n    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n        unchecked {\n            uint256 currentAllowance = token.allowance(address(this), spender);\n            if (currentAllowance < requestedDecrease) {\n                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);\n            }\n            forceApprove(token, spender, currentAllowance - requestedDecrease);\n        }\n    }\n\n    /**\n     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n     * to be set to zero before setting it to a non-zero value, such as USDT.\n     *\n     * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function\n     * only sets the \"standard\" allowance. Any temporary allowance will remain active, in addition to the value being\n     * set here.\n     */\n    function forceApprove(IERC20 token, address spender, uint256 value) internal {\n        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n        if (!_callOptionalReturnBool(token, approvalCall)) {\n            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n            _callOptionalReturn(token, approvalCall);\n        }\n    }\n\n    /**\n     * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no\n     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\n     * targeting contracts.\n     *\n     * Reverts if the returned value is other than `true`.\n     */\n    function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {\n        if (to.code.length == 0) {\n            safeTransfer(token, to, value);\n        } else if (!token.transferAndCall(to, value, data)) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target\n     * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\n     * targeting contracts.\n     *\n     * Reverts if the returned value is other than `true`.\n     */\n    function transferFromAndCallRelaxed(\n        IERC1363 token,\n        address from,\n        address to,\n        uint256 value,\n        bytes memory data\n    ) internal {\n        if (to.code.length == 0) {\n            safeTransferFrom(token, from, to, value);\n        } else if (!token.transferFromAndCall(from, to, value, data)) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no\n     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\n     * targeting contracts.\n     *\n     * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.\n     * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}\n     * once without retrying, and relies on the returned value to be true.\n     *\n     * Reverts if the returned value is other than `true`.\n     */\n    function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {\n        if (to.code.length == 0) {\n            forceApprove(token, to, value);\n        } else if (!token.approveAndCall(to, value, data)) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     *\n     * This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.\n     */\n    function _callOptionalReturn(IERC20 token, bytes memory data) private {\n        uint256 returnSize;\n        uint256 returnValue;\n        assembly (\"memory-safe\") {\n            let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)\n            // bubble errors\n            if iszero(success) {\n                let ptr := mload(0x40)\n                returndatacopy(ptr, 0, returndatasize())\n                revert(ptr, returndatasize())\n            }\n            returnSize := returndatasize()\n            returnValue := mload(0)\n        }\n\n        if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     *\n     * This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead.\n     */\n    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n        bool success;\n        uint256 returnSize;\n        uint256 returnValue;\n        assembly (\"memory-safe\") {\n            success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)\n            returnSize := returndatasize()\n            returnValue := mload(0)\n        }\n        return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);\n    }\n}\n"},"@openzeppelin/contracts/utils/ReentrancyGuard.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,\n * consider using {ReentrancyGuardTransient} instead.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n    // Booleans are more expensive than uint256 or any type that takes up a full\n    // word because each write operation emits an extra SLOAD to first read the\n    // slot's contents, replace the bits taken up by the boolean, and then write\n    // back. This is the compiler's defense against contract upgrades and\n    // pointer aliasing, and it cannot be disabled.\n\n    // The values being non-zero value makes deployment a bit more expensive,\n    // but in exchange the refund on every call to nonReentrant will be lower in\n    // amount. Since refunds are capped to a percentage of the total\n    // transaction's gas, it is best to keep them low in cases like this one, to\n    // increase the likelihood of the full refund coming into effect.\n    uint256 private constant NOT_ENTERED = 1;\n    uint256 private constant ENTERED = 2;\n\n    uint256 private _status;\n\n    /**\n     * @dev Unauthorized reentrant call.\n     */\n    error ReentrancyGuardReentrantCall();\n\n    constructor() {\n        _status = NOT_ENTERED;\n    }\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and making it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        _nonReentrantBefore();\n        _;\n        _nonReentrantAfter();\n    }\n\n    function _nonReentrantBefore() private {\n        // On the first call to nonReentrant, _status will be NOT_ENTERED\n        if (_status == ENTERED) {\n            revert ReentrancyGuardReentrantCall();\n        }\n\n        // Any calls to nonReentrant after this point will fail\n        _status = ENTERED;\n    }\n\n    function _nonReentrantAfter() private {\n        // By storing the original value once again, a refund is triggered (see\n        // https://eips.ethereum.org/EIPS/eip-2200)\n        _status = NOT_ENTERED;\n    }\n\n    /**\n     * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n     * `nonReentrant` function in the call stack.\n     */\n    function _reentrancyGuardEntered() internal view returns (bool) {\n        return _status == ENTERED;\n    }\n}\n"},"@openzeppelin/contracts/token/ERC20/ERC20.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"./IERC20.sol\";\nimport {IERC20Metadata} from \"./extensions/IERC20Metadata.sol\";\nimport {Context} from \"../../utils/Context.sol\";\nimport {IERC20Errors} from \"../../interfaces/draft-IERC6093.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC-20\n * applications.\n */\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n    mapping(address account => uint256) private _balances;\n\n    mapping(address account => mapping(address spender => uint256)) private _allowances;\n\n    uint256 private _totalSupply;\n\n    string private _name;\n    string private _symbol;\n\n    /**\n     * @dev Sets the values for {name} and {symbol}.\n     *\n     * All two of these values are immutable: they can only be set once during\n     * construction.\n     */\n    constructor(string memory name_, string memory symbol_) {\n        _name = name_;\n        _symbol = symbol_;\n    }\n\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() public view virtual returns (string memory) {\n        return _name;\n    }\n\n    /**\n     * @dev Returns the symbol of the token, usually a shorter version of the\n     * name.\n     */\n    function symbol() public view virtual returns (string memory) {\n        return _symbol;\n    }\n\n    /**\n     * @dev Returns the number of decimals used to get its user representation.\n     * For example, if `decimals` equals `2`, a balance of `505` tokens should\n     * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n     *\n     * Tokens usually opt for a value of 18, imitating the relationship between\n     * Ether and Wei. This is the default value returned by this function, unless\n     * it's overridden.\n     *\n     * NOTE: This information is only used for _display_ purposes: it in\n     * no way affects any of the arithmetic of the contract, including\n     * {IERC20-balanceOf} and {IERC20-transfer}.\n     */\n    function decimals() public view virtual returns (uint8) {\n        return 18;\n    }\n\n    /**\n     * @dev See {IERC20-totalSupply}.\n     */\n    function totalSupply() public view virtual returns (uint256) {\n        return _totalSupply;\n    }\n\n    /**\n     * @dev See {IERC20-balanceOf}.\n     */\n    function balanceOf(address account) public view virtual returns (uint256) {\n        return _balances[account];\n    }\n\n    /**\n     * @dev See {IERC20-transfer}.\n     *\n     * Requirements:\n     *\n     * - `to` cannot be the zero address.\n     * - the caller must have a balance of at least `value`.\n     */\n    function transfer(address to, uint256 value) public virtual returns (bool) {\n        address owner = _msgSender();\n        _transfer(owner, to, value);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-allowance}.\n     */\n    function allowance(address owner, address spender) public view virtual returns (uint256) {\n        return _allowances[owner][spender];\n    }\n\n    /**\n     * @dev See {IERC20-approve}.\n     *\n     * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n     * `transferFrom`. This is semantically equivalent to an infinite approval.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     */\n    function approve(address spender, uint256 value) public virtual returns (bool) {\n        address owner = _msgSender();\n        _approve(owner, spender, value);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-transferFrom}.\n     *\n     * Skips emitting an {Approval} event indicating an allowance update. This is not\n     * required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve].\n     *\n     * NOTE: Does not update the allowance if the current allowance\n     * is the maximum `uint256`.\n     *\n     * Requirements:\n     *\n     * - `from` and `to` cannot be the zero address.\n     * - `from` must have a balance of at least `value`.\n     * - the caller must have allowance for ``from``'s tokens of at least\n     * `value`.\n     */\n    function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\n        address spender = _msgSender();\n        _spendAllowance(from, spender, value);\n        _transfer(from, to, value);\n        return true;\n    }\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to`.\n     *\n     * This internal function is equivalent to {transfer}, and can be used to\n     * e.g. implement automatic token fees, slashing mechanisms, etc.\n     *\n     * Emits a {Transfer} event.\n     *\n     * NOTE: This function is not virtual, {_update} should be overridden instead.\n     */\n    function _transfer(address from, address to, uint256 value) internal {\n        if (from == address(0)) {\n            revert ERC20InvalidSender(address(0));\n        }\n        if (to == address(0)) {\n            revert ERC20InvalidReceiver(address(0));\n        }\n        _update(from, to, value);\n    }\n\n    /**\n     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\n     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\n     * this function.\n     *\n     * Emits a {Transfer} event.\n     */\n    function _update(address from, address to, uint256 value) internal virtual {\n        if (from == address(0)) {\n            // Overflow check required: The rest of the code assumes that totalSupply never overflows\n            _totalSupply += value;\n        } else {\n            uint256 fromBalance = _balances[from];\n            if (fromBalance < value) {\n                revert ERC20InsufficientBalance(from, fromBalance, value);\n            }\n            unchecked {\n                // Overflow not possible: value <= fromBalance <= totalSupply.\n                _balances[from] = fromBalance - value;\n            }\n        }\n\n        if (to == address(0)) {\n            unchecked {\n                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.\n                _totalSupply -= value;\n            }\n        } else {\n            unchecked {\n                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\n                _balances[to] += value;\n            }\n        }\n\n        emit Transfer(from, to, value);\n    }\n\n    /**\n     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\n     * Relies on the `_update` mechanism\n     *\n     * Emits a {Transfer} event with `from` set to the zero address.\n     *\n     * NOTE: This function is not virtual, {_update} should be overridden instead.\n     */\n    function _mint(address account, uint256 value) internal {\n        if (account == address(0)) {\n            revert ERC20InvalidReceiver(address(0));\n        }\n        _update(address(0), account, value);\n    }\n\n    /**\n     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\n     * Relies on the `_update` mechanism.\n     *\n     * Emits a {Transfer} event with `to` set to the zero address.\n     *\n     * NOTE: This function is not virtual, {_update} should be overridden instead\n     */\n    function _burn(address account, uint256 value) internal {\n        if (account == address(0)) {\n            revert ERC20InvalidSender(address(0));\n        }\n        _update(account, address(0), value);\n    }\n\n    /**\n     * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.\n     *\n     * This internal function is equivalent to `approve`, and can be used to\n     * e.g. set automatic allowances for certain subsystems, etc.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `owner` cannot be the zero address.\n     * - `spender` cannot be the zero address.\n     *\n     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n     */\n    function _approve(address owner, address spender, uint256 value) internal {\n        _approve(owner, spender, value, true);\n    }\n\n    /**\n     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\n     *\n     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\n     * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any\n     * `Approval` event during `transferFrom` operations.\n     *\n     * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to\n     * true using the following override:\n     *\n     * ```solidity\n     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\n     *     super._approve(owner, spender, value, true);\n     * }\n     * ```\n     *\n     * Requirements are the same as {_approve}.\n     */\n    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\n        if (owner == address(0)) {\n            revert ERC20InvalidApprover(address(0));\n        }\n        if (spender == address(0)) {\n            revert ERC20InvalidSpender(address(0));\n        }\n        _allowances[owner][spender] = value;\n        if (emitEvent) {\n            emit Approval(owner, spender, value);\n        }\n    }\n\n    /**\n     * @dev Updates `owner` s allowance for `spender` based on spent `value`.\n     *\n     * Does not update the allowance value in case of infinite allowance.\n     * Revert if not enough allowance is available.\n     *\n     * Does not emit an {Approval} event.\n     */\n    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\n        uint256 currentAllowance = allowance(owner, spender);\n        if (currentAllowance != type(uint256).max) {\n            if (currentAllowance < value) {\n                revert ERC20InsufficientAllowance(spender, currentAllowance, value);\n            }\n            unchecked {\n                _approve(owner, spender, currentAllowance - value, false);\n            }\n        }\n    }\n}\n"},"@openzeppelin/contracts/interfaces/IERC1363.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"./IERC20.sol\";\nimport {IERC165} from \"./IERC165.sol\";\n\n/**\n * @title IERC1363\n * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].\n *\n * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract\n * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.\n */\ninterface IERC1363 is IERC20, IERC165 {\n    /*\n     * Note: the ERC-165 identifier for this interface is 0xb0202a11.\n     * 0xb0202a11 ===\n     *   bytes4(keccak256('transferAndCall(address,uint256)')) ^\n     *   bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^\n     *   bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^\n     *   bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^\n     *   bytes4(keccak256('approveAndCall(address,uint256)')) ^\n     *   bytes4(keccak256('approveAndCall(address,uint256,bytes)'))\n     */\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`\n     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n     * @param to The address which you want to transfer to.\n     * @param value The amount of tokens to be transferred.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function transferAndCall(address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`\n     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n     * @param to The address which you want to transfer to.\n     * @param value The amount of tokens to be transferred.\n     * @param data Additional data with no specified format, sent in call to `to`.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n     * @param from The address which you want to send tokens from.\n     * @param to The address which you want to transfer to.\n     * @param value The amount of tokens to be transferred.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function transferFromAndCall(address from, address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n     * @param from The address which you want to send tokens from.\n     * @param to The address which you want to transfer to.\n     * @param value The amount of tokens to be transferred.\n     * @param data Additional data with no specified format, sent in call to `to`.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n     * @param spender The address which will spend the funds.\n     * @param value The amount of tokens to be spent.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function approveAndCall(address spender, uint256 value) external returns (bool);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n     * @param spender The address which will spend the funds.\n     * @param value The amount of tokens to be spent.\n     * @param data Additional data with no specified format, sent in call to `spender`.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);\n}\n"},"@openzeppelin/contracts/utils/Address.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/Address.sol)\n\npragma solidity ^0.8.20;\n\nimport {Errors} from \"./Errors.sol\";\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev There's no code at `target` (it is not a contract).\n     */\n    error AddressEmptyCode(address target);\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        if (address(this).balance < amount) {\n            revert Errors.InsufficientBalance(address(this).balance, amount);\n        }\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        if (!success) {\n            revert Errors.FailedCall();\n        }\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain `call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason or custom error, it is bubbled\n     * up by this function (like regular Solidity function calls). However, if\n     * the call reverted with no returned reason, this function reverts with a\n     * {Errors.FailedCall} error.\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     */\n    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n        if (address(this).balance < value) {\n            revert Errors.InsufficientBalance(address(this).balance, value);\n        }\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResultFromTarget(target, success, returndata);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResultFromTarget(target, success, returndata);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a delegate call.\n     */\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return verifyCallResultFromTarget(target, success, returndata);\n    }\n\n    /**\n     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n     * was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case\n     * of an unsuccessful call.\n     */\n    function verifyCallResultFromTarget(\n        address target,\n        bool success,\n        bytes memory returndata\n    ) internal view returns (bytes memory) {\n        if (!success) {\n            _revert(returndata);\n        } else {\n            // only check if target is a contract if the call was successful and the return data is empty\n            // otherwise we already know that it was a contract\n            if (returndata.length == 0 && target.code.length == 0) {\n                revert AddressEmptyCode(target);\n            }\n            return returndata;\n        }\n    }\n\n    /**\n     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n     * revert reason or with a default {Errors.FailedCall} error.\n     */\n    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n        if (!success) {\n            _revert(returndata);\n        } else {\n            return returndata;\n        }\n    }\n\n    /**\n     * @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}.\n     */\n    function _revert(bytes memory returndata) private pure {\n        // Look for revert reason and bubble it up if present\n        if (returndata.length > 0) {\n            // The easiest way to bubble the revert reason is using memory via assembly\n            assembly (\"memory-safe\") {\n                let returndata_size := mload(returndata)\n                revert(add(32, returndata), returndata_size)\n            }\n        } else {\n            revert Errors.FailedCall();\n        }\n    }\n}\n"},"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC-20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the decimals places of the token.\n     */\n    function decimals() external view returns (uint8);\n}\n"},"@openzeppelin/contracts/utils/Context.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n\n    function _contextSuffixLength() internal view virtual returns (uint256) {\n        return 0;\n    }\n}\n"},"@openzeppelin/contracts/interfaces/draft-IERC6093.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/draft-IERC6093.sol)\npragma solidity ^0.8.20;\n\n/**\n * @dev Standard ERC-20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.\n */\ninterface IERC20Errors {\n    /**\n     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param balance Current balance for the interacting account.\n     * @param needed Minimum amount required to perform a transfer.\n     */\n    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC20InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC20InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n     * @param spender Address that may be allowed to operate on tokens without being their owner.\n     * @param allowance Amount of tokens a `spender` is allowed to operate with.\n     * @param needed Minimum amount required to perform a transfer.\n     */\n    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC20InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n     * @param spender Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC-721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.\n */\ninterface IERC721Errors {\n    /**\n     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20.\n     * Used in balance queries.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC721InvalidOwner(address owner);\n\n    /**\n     * @dev Indicates a `tokenId` whose `owner` is the zero address.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC721NonexistentToken(uint256 tokenId);\n\n    /**\n     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param tokenId Identifier number of a token.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC721InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC721InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC721InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC-1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.\n */\ninterface IERC1155Errors {\n    /**\n     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param balance Current balance for the interacting account.\n     * @param needed Minimum amount required to perform a transfer.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC1155InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC1155InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC1155MissingApprovalForAll(address operator, address owner);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC1155InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC1155InvalidOperator(address operator);\n\n    /**\n     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n     * Used in batch transfers.\n     * @param idsLength Length of the array of token identifiers\n     * @param valuesLength Length of the array of token amounts\n     */\n    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\n}\n"},"@openzeppelin/contracts/interfaces/IERC20.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../token/ERC20/IERC20.sol\";\n"},"@openzeppelin/contracts/interfaces/IERC165.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165} from \"../utils/introspection/IERC165.sol\";\n"},"@openzeppelin/contracts/utils/Errors.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Collection of common custom errors used in multiple contracts\n *\n * IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.\n * It is recommended to avoid relying on the error API for critical functionality.\n *\n * _Available since v5.1._\n */\nlibrary Errors {\n    /**\n     * @dev The ETH balance of the account is not enough to perform the operation.\n     */\n    error InsufficientBalance(uint256 balance, uint256 needed);\n\n    /**\n     * @dev A call to an address target failed. The target may have reverted.\n     */\n    error FailedCall();\n\n    /**\n     * @dev The deployment failed.\n     */\n    error FailedDeployment();\n\n    /**\n     * @dev A necessary precompile is missing.\n     */\n    error MissingPrecompile(address);\n}\n"},"@openzeppelin/contracts/utils/introspection/IERC165.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30 000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"}},"abi":[{"type":"constructor","inputs":[{"name":"treasury_","type":"address","internalType":"address"}],"stateMutability":"nonpayable"},{"name":"AgentIdRequired","type":"error","inputs":[]},{"name":"AlreadyOpen","type":"error","inputs":[]},{"name":"BadPayment","type":"error","inputs":[]},{"name":"InvalidPair","type":"error","inputs":[]},{"name":"InvalidQuantity","type":"error","inputs":[]},{"name":"MintClosed","type":"error","inputs":[]},{"name":"NotOpen","type":"error","inputs":[]},{"name":"NotTreasury","type":"error","inputs":[]},{"name":"NothingToClaim","type":"error","inputs":[]},{"name":"OnlyWBNB","type":"error","inputs":[]},{"name":"PayoutFailed","type":"error","inputs":[]},{"name":"QuotaExceeded","type":"error","inputs":[]},{"name":"ReentrancyGuardReentrantCall","type":"error","inputs":[]},{"name":"RefundUnavailable","type":"error","inputs":[]},{"name":"RouterNotConfigured","type":"error","inputs":[]},{"name":"SafeERC20FailedOperation","type":"error","inputs":[{"name":"token","type":"address","internalType":"address"}]},{"name":"SupplyExceeded","type":"error","inputs":[]},{"name":"ZeroAddress","type":"error","inputs":[]},{"name":"Minted","type":"event","inputs":[{"name":"minter","type":"address","indexed":true,"internalType":"address"},{"name":"agentId","type":"uint256","indexed":true,"internalType":"uint256"},{"name":"shares","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"paid","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"referrer","type":"address","indexed":true,"internalType":"address"},{"name":"referralReward","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"name":"PoolOpened","type":"event","inputs":[{"name":"pair","type":"address","indexed":true,"internalType":"address"},{"name":"bnbAmount","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"tokenAmount","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"liquidity","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"name":"QuotaGranted","type":"event","inputs":[{"name":"referrer","type":"address","indexed":true,"internalType":"address"},{"name":"agentId","type":"uint256","indexed":true,"internalType":"uint256"},{"name":"extra","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"name":"ReferralClaimed","type":"event","inputs":[{"name":"referrer","type":"address","indexed":true,"internalType":"address"},{"name":"to","type":"address","indexed":false,"internalType":"address"},{"name":"amount","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"name":"Refunded","type":"event","inputs":[{"name":"minter","type":"address","indexed":true,"internalType":"address"},{"name":"to","type":"address","indexed":false,"internalType":"address"},{"name":"shares","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"amount","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"name":"TreasuryClaimed","type":"event","inputs":[{"name":"amount","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"name":"Withdrawn","type":"event","inputs":[{"name":"to","type":"address","indexed":false,"internalType":"address"},{"name":"amount","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"name":"AGENT_REGISTRY","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"name":"BASE_QUOTA","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"BPS","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"DEAD","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"name":"LP_BPS","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"MAX_SHARES","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"MAX_SHARES_PER_TX","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"MINT_DEADLINE","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"MINT_WINDOW","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"OPEN_BNB","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"OPEN_TOKENS","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"POOL_TOKENS_PER_SHARE","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"REFERRAL_BPS","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"ROUTER","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"name":"SHARE_PRICE","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"TOKENS_PER_SHARE","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"TREASURY_BPS_NO_REFERRER","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"TREASURY_BPS_WITH_REFERRER","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"WBNB","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"name":"accountAgent","type":"function","inputs":[{"name":"account","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"claimReferral","type":"function","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"name":"claimReferralTo","type":"function","inputs":[{"name":"to","type":"address","internalType":"address payable"}],"outputs":[],"stateMutability":"nonpayable"},{"name":"claimRefund","type":"function","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"name":"claimRefundTo","type":"function","inputs":[{"name":"to","type":"address","internalType":"address payable"}],"outputs":[],"stateMutability":"nonpayable"},{"name":"claimTreasury","type":"function","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"name":"costOf","type":"function","inputs":[{"name":"shares","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"pure"},{"name":"extraQuota","type":"function","inputs":[{"name":"","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"isValidReferrer","type":"function","inputs":[{"name":"referrer","type":"address","internalType":"address"},{"name":"minter","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"name":"mint","type":"function","inputs":[{"name":"shares","type":"uint256","internalType":"uint256"},{"name":"referrer","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"payable"},{"name":"mintOpen","type":"function","inputs":[],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"name":"mintedByAgent","type":"function","inputs":[{"name":"","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"opened","type":"function","inputs":[],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"name":"openedAt","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"owner","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"name":"paidBy","type":"function","inputs":[{"name":"","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"paidOnce","type":"function","inputs":[{"name":"","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"name":"pair","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"name":"paused","type":"function","inputs":[],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"name":"pendingPoolBnb","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"pendingPoolTokens","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"poolBnbBy","type":"function","inputs":[{"name":"","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"quotaOf","type":"function","inputs":[{"name":"agentId","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"referralAccrued","type":"function","inputs":[{"name":"","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"refundMode","type":"function","inputs":[],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"name":"remainingQuota","type":"function","inputs":[{"name":"account","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"reserves","type":"function","inputs":[],"outputs":[{"name":"bnb","type":"uint256","internalType":"uint256"},{"name":"tokens","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"sharesBy","type":"function","inputs":[{"name":"","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"token","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"name":"totalMinted","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"totalPaid","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"totalReferralAccrued","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"totalRefunded","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"treasury","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"name":"treasuryAccrued","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"withdraw","type":"function","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"type":"receive","stateMutability":"payable"}],"matchId":"58993435","creationMatch":"exact_match","runtimeMatch":"exact_match","verifiedAt":"2026-11-10T09:08:50Z","match":"exact_match","chainId":"56","address":"0x28068564170Cb6598BB3e37084e337a584Dc3580"}