creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "src/pendle/accumulator/PendleAccumulatorV3.sol": {
        "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity 0.8.19;\n\nimport \"src/base/accumulator/AccumulatorV2.sol\";\nimport {ILocker} from \"src/base/interfaces/ILocker.sol\";\nimport {IStrategy} from \"herdaddy/interfaces/stake-dao/IStrategy.sol\";\nimport {IPendleFeeDistributor} from \"src/base/interfaces/IPendleFeeDistributor.sol\";\n\ninterface IWETH {\n    function deposit() external payable;\n}\n\n/// @title PendlAccumulatorV3 - Accumulator for Pendle\n/// @author StakeDAO\ncontract PendleAccumulatorV3 is AccumulatorV2 {\n    /// @notice Base fee (10_000 = 100%)\n    uint256 private constant BASE_FEE = 10_000;\n\n    address public constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n    address public constant PENDLE = 0x808507121B80c02388fAd14726482e061B8da827;\n    address public constant VE_PENDLE = 0x4f30A9D41B80ecC5B94306AB4364951AE3170210;\n    address public constant FEE_DISTRIBUTOR = 0x8C237520a8E14D658170A633D96F8e80764433b9;\n\n    address public strategy;\n\n    /// @notice WETH Distribution fee.\n    uint256 public periodsToAdd = 4;\n\n    /// @notice WETH Rewards period to notify.\n    uint256 public remainingPeriods;\n\n    /// @notice If false, the voters rewards will be distributed to the gauge\n    bool public transferVotersRewards;\n\n    /// @notice Address to receive the voters rewards.\n    address public votesRewardRecipient;\n\n    /// @notice Rewards for the period.\n    mapping(uint256 => uint256) public rewards; // period -> reward amount\n\n    ////////////////////////////////////////////////////////////////\n    /// --- EVENTS & ERRORS\n    ///////////////////////////////////////////////////////////////\n\n    /// @notice Error emitted when a token not supported is used.\n    error WRONG_TOKEN();\n\n    /// @notice Error emitted when there is no balance to claim.\n    error NO_REWARD();\n\n    /// @notice Error emitted when there is no balance to claim.\n    error NO_BALANCE();\n\n    /// @notice Error emitted when the claim is not successful.\n    error NOT_CLAIMED_ALL();\n\n    /// @notice Error emitted when the reward is ongoing.\n    error ONGOING_REWARD();\n\n    ////////////////////////////////////////////////////////////\n    /// --- CONSTRUCTOR\n    ////////////////////////////////////////////////////////////\n\n    constructor(address _gauge, address _locker, address _governance) AccumulatorV2(_gauge, _locker, _governance) {\n        SafeTransferLib.safeApprove(WETH, gauge, type(uint256).max);\n        SafeTransferLib.safeApprove(PENDLE, gauge, type(uint256).max);\n    }\n\n    function claimAndNotifyAll(address[] memory _pools, bool notifySDT, bool pullFromFeeReceiver, bool claimFeeStrategy)\n        external\n    {\n        // Sending strategy fees to fee receiver\n        if (claimFeeStrategy && strategy != address(0)) {\n            _claimFeeStrategy(address(strategy));\n        }\n\n        /// Check historical rewards.\n        uint256 totalAccrued = IPendleFeeDistributor(FEE_DISTRIBUTOR).getProtocolTotalAccrued(address(locker));\n\n        /// Check claimed rewards.\n        uint256 claimed = IPendleFeeDistributor(FEE_DISTRIBUTOR).claimed(address(locker));\n\n        address[] memory vePendle = new address[](1);\n        vePendle[0] = VE_PENDLE;\n\n        /// Check the native reward claimable.\n        uint256 nativeRewardClaimable =\n            IPendleFeeDistributor(FEE_DISTRIBUTOR).getProtocolClaimables(address(locker), vePendle)[0];\n\n        /// Claim on behalf of the locker.\n        uint256 totalReward = _claimReward(_pools);\n\n        /// There's 1e4 wei of tolerance to avoid rounding errors because of a mistake in the Pendle FEE_DISTRIBUTOR contract.\n        if (totalReward + 1e4 < totalAccrued - claimed) revert NOT_CLAIMED_ALL();\n\n        /// Update the remaining periods.\n        remainingPeriods += periodsToAdd;\n\n        /// Charge fee on the total reward.\n        totalReward -= _chargeFee(WETH, totalReward);\n\n        /// If the voters rewards are not transferred to the recipient, they will be distributed to the gauge.\n        if (transferVotersRewards) {\n            uint256 votersTotalReward = totalReward - nativeRewardClaimable;\n            // transfer the amount without charging fees\n            SafeTransferLib.safeTransfer(WETH, votesRewardRecipient, votersTotalReward);\n        }\n\n        /// We put 0 as the amount to notify, as it'll distribute the balance.\n        _notifyReward(WETH, 0, false);\n        _notifyReward(PENDLE, 0, pullFromFeeReceiver);\n\n        /// Just in case, but it should be needed anymore.\n        if (notifySDT) {\n            _distributeSDT();\n        }\n    }\n\n    /// @notice Notify the new reward to the LGV4\n    /// @param _tokenReward token to notify\n    /// @param _amount amount to notify\n    /// @param _pullFromFeeReceiver if pull tokens from the fee receiver or not (tokens already in that contract)\n    function _notifyReward(address _tokenReward, uint256 _amount, bool _pullFromFeeReceiver) internal override {\n        if (_pullFromFeeReceiver && feeReceiver != address(0)) {\n            // Split fees for the specified token using the fee receiver contract\n            // Function not permissionless, to prevent sending to that accumulator and re-splitting (_chargeFee)\n            IFeeReceiver(feeReceiver).split(_tokenReward);\n        }\n\n        if (_tokenReward == WETH && remainingPeriods != 0) {\n            uint256 currentWeek = block.timestamp * 1 weeks / 1 weeks;\n            if (rewards[currentWeek] != 0) revert ONGOING_REWARD();\n\n            _amount = ERC20(WETH).balanceOf(address(this)) / remainingPeriods;\n            rewards[currentWeek] = _amount;\n\n            remainingPeriods -= 1;\n        } else {\n            _amount = ERC20(_tokenReward).balanceOf(address(this));\n        }\n\n        if (_amount == 0) return;\n        ILiquidityGauge(gauge).deposit_reward_token(_tokenReward, _amount);\n    }\n\n    /// @notice Claim reward for the pools\n    /// @param _pools pools to claim the rewards\n    function _claimReward(address[] memory _pools) internal returns (uint256 claimed) {\n        uint256 balanceBefore = address(this).balance;\n        ILocker(locker).claimRewards(address(this), _pools);\n\n        // Wrap Eth to WETH\n        claimed = address(this).balance - balanceBefore;\n        if (claimed == 0) revert NO_BALANCE();\n        IWETH(WETH).deposit{value: address(this).balance}();\n    }\n\n    function setVotesRewardRecipient(address _votesRewardRecipient) external onlyGovernance {\n        votesRewardRecipient = _votesRewardRecipient;\n    }\n\n    function setTransferVotersRewards(bool _transferVotersRewards) external onlyGovernance {\n        transferVotersRewards = _transferVotersRewards;\n    }\n\n    function setPeriodsToAdd(uint256 _periodsToAdd) external onlyGovernance {\n        periodsToAdd = _periodsToAdd;\n    }\n\n    function setStrategy(address _strategy) external onlyGovernance {\n        strategy = _strategy;\n    }\n}\n"
      },
      "src/base/accumulator/AccumulatorV2.sol": {
        "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.19;\n\nimport {ERC20} from \"solady/src/tokens/ERC20.sol\";\nimport {SafeTransferLib} from \"solady/src/utils/SafeTransferLib.sol\";\n\nimport {IFeeReceiver} from \"herdaddy/interfaces/IFeeReceiver.sol\";\nimport {ILiquidityGauge} from \"src/base/interfaces/ILiquidityGauge.sol\";\nimport {ISDTDistributor} from \"src/base/interfaces/ISDTDistributor.sol\";\n\n/// @title Accumulator V2\n/// @notice Abstract contract used for any accumulator\n/// @dev Interacting with the FeeReceiver (receiving and splitting fees)\n/// @author StakeDAO\nabstract contract AccumulatorV2 {\n    /// @notice Denominator for fixed point math.\n    uint256 public constant DENOMINATOR = 10_000;\n\n    /// @notice Split struct\n    /// @param receivers Array of receivers\n    /// @param fees Array of fees\n    /// @dev First go to the first receiver, then the second, and so on\n    /// @dev Fee in basis points, where 10,000 basis points = 100%\n    struct Split {\n        address[] receivers;\n        uint256[] fees; // Fee in basis points, where 10,000 basis points = 100%\n    }\n\n    /// @notice Fee split.\n    Split feeSplit;\n\n    /// @notice SDT distributor\n    address public sdtDistributor;\n\n    /// @notice Claimer Fee.\n    uint256 public claimerFee;\n\n    /// @notice sd gauge\n    address public immutable gauge;\n\n    /// @notice sd locker\n    address public immutable locker;\n\n    /// @notice governance\n    address public governance;\n\n    /// @notice future governance\n    address public futureGovernance;\n\n    /// @notice Fee receiver contracts defined in Strategy\n    address public feeReceiver;\n\n    ////////////////////////////////////////////////////////////////\n    /// --- EVENTS & ERRORS\n    ///////////////////////////////////////////////////////////////\n\n    /// @notice Event emitted when the claimer fee is set\n    event ClaimerFeeSet(uint256 claimerFee);\n\n    /// @notice Emitted when the fee receiver is set\n    event FeeReceiverSet(address _feeReceiver);\n\n    /// @notice Event emitted when an ERC20 token is rescued\n    event ERC20Rescued(address token, uint256 amount);\n\n    /// @notice Event emitted when a new future governance has set\n    event TransferGovernance(address futureGovernance);\n\n    /// @notice Event emitted when the future governance accepts to be the governance\n    event GovernanceChanged(address governance);\n\n    /// @notice Error emitted when an onlyGovernance function has called by a different address\n    error GOVERNANCE();\n\n    /// @notice Error emitted when the total fee would be more than 100%\n    error FEE_TOO_HIGH();\n\n    /// @notice Error emitted when an onlyFutureGovernance function has called by a different address\n    error FUTURE_GOVERNANCE();\n\n    /// @notice Error emitted when a zero address is pass\n    error ZERO_ADDRESS();\n\n    /// @notice Error emitted when the fee is invalid\n    error INVALID_SPLIT();\n\n    //////////////////////////////////////////////////////\n    /// --- MODIFIERS\n    //////////////////////////////////////////////////////\n\n    /// @notice Modifier to check if the caller is the governance\n    modifier onlyGovernance() {\n        if (msg.sender != governance) revert GOVERNANCE();\n        _;\n    }\n\n    /// @notice Modifier to check if the caller is the future governance\n    modifier onlyFutureGovernance() {\n        if (msg.sender != futureGovernance) revert FUTURE_GOVERNANCE();\n        _;\n    }\n\n    //////////////////////////////////////////////////////\n    /// --- CONSTRUCTOR\n    //////////////////////////////////////////////////////\n\n    /// @notice Constructor\n    /// @param _gauge sd gauge\n    /// @param _locker sd locker\n    /// @param _governance governance\n    constructor(address _gauge, address _locker, address _governance) {\n        gauge = _gauge;\n        locker = _locker;\n\n        governance = _governance;\n\n        claimerFee = 10; // 0.1%\n    }\n\n    //////////////////////////////////////////////////////\n    /// --- MUTATIVE FUNCTIONS\n    //////////////////////////////////////////////////////\n\n    /// @notice Claims all rewards tokens for the locker and notify them to the LGV4\n    function claimAndNotifyAll(bool notifySDT, bool pullFromFeeReceiver, bool claimFeeStrategy) external virtual {}\n\n    /// @notice Claims a reward token for the locker and notify them to the LGV4\n    function claimTokenAndNotifyAll(address token, bool notifySDT, bool pullFromFeeReceiver, bool claimFeeStrategy)\n        external\n        virtual\n    {}\n\n    /// @notice Notify the whole acc balance of a token\n    /// @param _token token to notify\n    /// @param _notifySDT if notify SDT or not\n    /// @param _pullFromFeeReceiver if pull tokens from the fee receiver or not\n    function notifyReward(address _token, bool _notifySDT, bool _pullFromFeeReceiver) public virtual {\n        uint256 amount = ERC20(_token).balanceOf(address(this));\n        // notify token as reward in sdToken gauge\n        _notifyReward(_token, amount, _pullFromFeeReceiver);\n\n        if (_notifySDT) {\n            // notify SDT\n            _distributeSDT();\n        }\n    }\n\n    //////////////////////////////////////////////////////\n    /// --- INTERNAL FUNCTIONS\n    //////////////////////////////////////////////////////\n\n    /// @notice Notify the new reward to the LGV4\n    /// @param _tokenReward token to notify\n    /// @param _amount amount to notify\n    /// @param _pullFromFeeReceiver if pull tokens from the fee receiver or not (tokens already in that contract)\n    function _notifyReward(address _tokenReward, uint256 _amount, bool _pullFromFeeReceiver) internal virtual {\n        _chargeFee(_tokenReward, _amount);\n\n        if (_pullFromFeeReceiver && feeReceiver != address(0)) {\n            // Split fees for the specified token using the fee receiver contract\n            // Function not permissionless, to prevent sending to that accumulator and re-splitting (_chargeFee)\n            IFeeReceiver(feeReceiver).split(_tokenReward);\n        }\n\n        _amount = ERC20(_tokenReward).balanceOf(address(this));\n\n        if (_amount == 0) return;\n        ILiquidityGauge(gauge).deposit_reward_token(_tokenReward, _amount);\n    }\n\n    /// @notice Distribute SDT to the gauge\n    function _distributeSDT() internal {\n        if (sdtDistributor != address(0)) {\n            ISDTDistributor(sdtDistributor).distribute(gauge);\n        }\n    }\n\n    /// @notice Charge fee for dao, liquidity, claimer\n    /// @param _token token to charge fee for\n    /// @param _amount amount to charge fee for\n    function _chargeFee(address _token, uint256 _amount) internal returns (uint256 _charged) {\n        if (_amount == 0) return 0;\n\n        Split memory _feeSplit = getFeeSplit();\n        uint256 fee;\n        for (uint256 i = 0; i < _feeSplit.receivers.length; i++) {\n            fee = (_amount * _feeSplit.fees[i]) / DENOMINATOR;\n            SafeTransferLib.safeTransfer(_token, _feeSplit.receivers[i], fee);\n\n            _charged += fee;\n        }\n\n        /// Claimer fee.\n        fee = (_amount * claimerFee) / DENOMINATOR;\n        SafeTransferLib.safeTransfer(_token, msg.sender, fee);\n\n        _charged += fee;\n    }\n\n    /// @notice Take the fees accumulated from the strategy and sending to the fee receiver\n    /// @dev Need to be done before calling `split`, but claimProtocolFees is permissionless.\n    /// @dev Strategy not set in that abstract contract, must be implemented by child contracts\n    function _claimFeeStrategy(address _strategy) internal {\n        // Call the claimProtocolFees function from the strategy\n        (bool success, bytes memory returnData) = _strategy.call(abi.encodeWithSignature(\"claimProtocolFees()\"));\n\n        if (!success) {\n            if (returnData.length == 0) revert(\"Strategy call failed\");\n            assembly {\n                revert(add(returnData, 32), returnData) // Reverts with an error message from the returnData\n            }\n        }\n    }\n\n    //////////////////////////////////////////////////////\n    /// --- GOVERNANCE FUNCTIONS\n    //////////////////////////////////////////////////////\n\n    function getFeeSplit() public view returns (Split memory) {\n        return feeSplit;\n    }\n\n    function setClaimerFee(uint256 _claimerFee) external onlyGovernance {\n        if (_claimerFee > DENOMINATOR) revert FEE_TOO_HIGH();\n        emit ClaimerFeeSet(claimerFee = _claimerFee);\n    }\n\n    /// @notice Set SDT distributor.\n    /// @param _distributor SDT distributor address.\n    function setDistributor(address _distributor) external onlyGovernance {\n        sdtDistributor = _distributor;\n    }\n\n    /// @notice Set fee receiver (from Stategy)\n    /// @param _feeReceiver Fee receiver address\n    function setFeeReceiver(address _feeReceiver) external onlyGovernance {\n        emit FeeReceiverSet(feeReceiver = _feeReceiver);\n    }\n\n    /// @notice Set a new future governance that can accept it\n    /// @dev Can be called only by the governance\n    /// @param _futureGovernance future governance address\n    function transferGovernance(address _futureGovernance) external onlyGovernance {\n        if (_futureGovernance == address(0)) revert ZERO_ADDRESS();\n        futureGovernance = _futureGovernance;\n        emit TransferGovernance(_futureGovernance);\n    }\n\n    /// @notice Accept the governance\n    /// @dev Can be called only by future governance\n    function acceptGovernance() external onlyFutureGovernance {\n        governance = futureGovernance;\n        emit GovernanceChanged(governance);\n    }\n\n    /// @notice Approve the distribution of a new token reward from the Accumulator.\n    /// @param _newTokenReward New token reward to be approved.\n    function approveNewTokenReward(address _newTokenReward) external onlyGovernance {\n        SafeTransferLib.safeApprove(_newTokenReward, gauge, type(uint256).max);\n    }\n\n    /// @notice Set fee split\n    /// @param receivers array of receivers\n    /// @param fees array of fees\n    function setFeeSplit(address[] calldata receivers, uint256[] calldata fees) external onlyGovernance {\n        if (receivers.length == 0 || receivers.length != fees.length) revert INVALID_SPLIT();\n        feeSplit = Split(receivers, fees);\n    }\n\n    /// @notice A function that rescue any ERC20 token\n    /// @dev Can be called only by the governance\n    /// @param _token token address\n    /// @param _amount amount to rescue\n    /// @param _recipient address to send token rescued\n    function rescueERC20(address _token, uint256 _amount, address _recipient) external onlyGovernance {\n        if (_recipient == address(0)) revert ZERO_ADDRESS();\n        SafeTransferLib.safeTransfer(_token, _recipient, _amount);\n        emit ERC20Rescued(_token, _amount);\n    }\n\n    receive() external payable {}\n}\n"
      },
      "src/base/interfaces/ILocker.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.7;\n\ninterface ILocker {\n    function createLock(uint256, uint256) external;\n\n    function claimAllRewards(address[] calldata _tokens, address _recipient) external;\n\n    function increaseAmount(uint256) external;\n\n    function increaseAmount(uint128) external;\n\n    function increaseUnlockTime(uint256) external;\n\n    function release() external;\n\n    function claimRewards(address, address) external;\n\n    function claimRewards(address, address, address) external;\n\n    function claimFXSRewards(address) external;\n\n    function claimFPISRewards(address) external;\n\n    function execute(address, uint256, bytes calldata) external returns (bool, bytes memory);\n\n    function setGovernance(address) external;\n\n    function voteGaugeWeight(address, uint256) external;\n\n    function setAngleDepositor(address) external;\n\n    function setDepositor(address) external;\n\n    function setFxsDepositor(address) external;\n\n    function setYFIDepositor(address) external;\n\n    function setYieldDistributor(address) external;\n\n    function setGaugeController(address) external;\n\n    function setAccumulator(address _accumulator) external;\n\n    function governance() external view returns (address);\n\n    function increaseLock(uint256 _value, uint256 _duration) external;\n\n    function release(address _recipient) external;\n\n    function transferGovernance(address _governance) external;\n\n    function acceptGovernance() external;\n\n    function setStrategy(address _strategy) external;\n\n    function claimRewards(address _recipient, address[] calldata _pools) external;\n}\n"
      },
      "lib/herdaddy/src/interfaces/stake-dao/IStrategy.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.19;\n\ninterface IStrategy {\n    function locker() external view returns (address);\n\n    function deposit(address _token, uint256 amount) external;\n    function withdraw(address _token, uint256 amount) external;\n\n    function claimProtocolFees() external;\n    function claimNativeRewards() external;\n    function harvest(address _asset, bool _distributeSDT, bool _claimExtra) external;\n\n    function rewardDistributors(address _gauge) external view returns (address);\n\n    /// Factory functions\n    function toggleVault(address vault) external;\n    function setGauge(address token, address gauge) external;\n    function setLGtype(address gauge, uint256 gaugeType) external;\n    function addRewardToken(address _token, address _rewardDistributor) external;\n    function acceptRewardDistributorOwnership(address rewardDistributor) external;\n    function setRewardDistributor(address gauge, address rewardDistributor) external;\n    function addRewardReceiver(address gauge, address rewardReceiver) external;\n\n    // Governance \n    function setAccumulator(address newAccumulator) external;\n    function setFeeRewardToken(address newFeeRewardToken) external;\n    function setFeeDistributor(address newFeeDistributor) external;\n    function setFactory(address newFactory) external;\n}\n"
      },
      "src/base/interfaces/IPendleFeeDistributor.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.7;\n\ninterface IPendleFeeDistributor {\n    // ========================= STRUCT =========================\n    struct UpdateProtocolStruct {\n        address user;\n        bytes32[] proof;\n        address[] pools;\n        uint256[] topUps;\n    }\n\n    // ========================= EVENTS =========================\n    /// @notice Emit when a new merkleRoot is set & the fee is funded by the governance\n    event SetMerkleRootAndFund(bytes32 indexed merkleRoot, uint256 amountFunded);\n\n    /// @notice Emit when an user claims their fees\n    event Claimed(address indexed user, uint256 amountOut);\n\n    /// @notice Emit when the Pendle team populates data for a protocol\n    event UpdateProtocolClaimable(address indexed user, uint256 sumTopUp);\n\n    // ========================= FUNCTIONS =========================\n    /**\n     * @notice Submit total fee and proof to claim outstanding amount. Fee will be sent as raw ETH,\n     *  so receiver should be an EOA or have receive() function.\n     */\n    function claimRetail(address receiver, uint256 totalAccrued, bytes32[] calldata proof)\n        external\n        returns (uint256 amountOut);\n\n    /**\n     * @notice Claim all outstanding fees for the specified pools. This function is intended for use\n     * by protocols that have contacted the Pendle team. Note that the fee will be sent in raw ETH,\n     * so the receiver should be an EOA or have a receive() function.\n     * @notice Protocols should not use claimRetail, as it can make getProtocolFeeData unreliable.\n     */\n    function claimProtocol(address receiver, address[] calldata pools)\n        external\n        returns (uint256 totalAmountOut, uint256[] memory amountsOut);\n\n    ///@notice Returns the claimable fees per pool. This function is only available if the Pendle\n    ///team has specifically set up the data.\n    function getProtocolClaimables(address user, address[] calldata pools)\n        external\n        view\n        returns (uint256[] memory claimables);\n\n    ///@notice Returns the lifetime totalAccrued fees for protocols. This function is only available\n    ///if the Pendle team has specifically set up the data.\n    function getProtocolTotalAccrued(address user) external view returns (uint256);\n\n    function claimed(address user) external view returns (uint256);\n}\n"
      },
      "lib/solady/src/tokens/ERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Simple ERC20 + EIP-2612 implementation.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC20.sol)\n/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol)\n///\n/// @dev Note:\n/// The ERC20 standard allows minting and transferring to and from the zero address,\n/// minting and transferring zero tokens, as well as self-approvals.\n/// For performance, this implementation WILL NOT revert for such actions.\n/// Please add any checks with overrides if desired.\nabstract contract ERC20 {\n    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n    /*                       CUSTOM ERRORS                        */\n    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n    /// @dev The total supply has overflowed.\n    error TotalSupplyOverflow();\n\n    /// @dev The allowance has overflowed.\n    error AllowanceOverflow();\n\n    /// @dev The allowance has underflowed.\n    error AllowanceUnderflow();\n\n    /// @dev Insufficient balance.\n    error InsufficientBalance();\n\n    /// @dev Insufficient allowance.\n    error InsufficientAllowance();\n\n    /// @dev The permit is invalid.\n    error InvalidPermit();\n\n    /// @dev The permit has expired.\n    error PermitExpired();\n\n    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n    /*                           EVENTS                           */\n    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n    /// @dev Emitted when `amount` tokens is transferred from `from` to `to`.\n    event Transfer(address indexed from, address indexed to, uint256 amount);\n\n    /// @dev Emitted when `amount` tokens is approved by `owner` to be used by `spender`.\n    event Approval(address indexed owner, address indexed spender, uint256 amount);\n\n    /// @dev `keccak256(bytes(\"Transfer(address,address,uint256)\"))`.\n    uint256 private constant _TRANSFER_EVENT_SIGNATURE =\n        0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;\n\n    /// @dev `keccak256(bytes(\"Approval(address,address,uint256)\"))`.\n    uint256 private constant _APPROVAL_EVENT_SIGNATURE =\n        0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925;\n\n    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n    /*                          STORAGE                           */\n    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n    /// @dev The storage slot for the total supply.\n    uint256 private constant _TOTAL_SUPPLY_SLOT = 0x05345cdf77eb68f44c;\n\n    /// @dev The balance slot of `owner` is given by:\n    /// ```\n    ///     mstore(0x0c, _BALANCE_SLOT_SEED)\n    ///     mstore(0x00, owner)\n    ///     let balanceSlot := keccak256(0x0c, 0x20)\n    /// ```\n    uint256 private constant _BALANCE_SLOT_SEED = 0x87a211a2;\n\n    /// @dev The allowance slot of (`owner`, `spender`) is given by:\n    /// ```\n    ///     mstore(0x20, spender)\n    ///     mstore(0x0c, _ALLOWANCE_SLOT_SEED)\n    ///     mstore(0x00, owner)\n    ///     let allowanceSlot := keccak256(0x0c, 0x34)\n    /// ```\n    uint256 private constant _ALLOWANCE_SLOT_SEED = 0x7f5e9f20;\n\n    /// @dev The nonce slot of `owner` is given by:\n    /// ```\n    ///     mstore(0x0c, _NONCES_SLOT_SEED)\n    ///     mstore(0x00, owner)\n    ///     let nonceSlot := keccak256(0x0c, 0x20)\n    /// ```\n    uint256 private constant _NONCES_SLOT_SEED = 0x38377508;\n\n    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n    /*                       ERC20 METADATA                       */\n    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n    /// @dev Returns the name of the token.\n    function name() public view virtual returns (string memory);\n\n    /// @dev Returns the symbol of the token.\n    function symbol() public view virtual returns (string memory);\n\n    /// @dev Returns the decimals places of the token.\n    function decimals() public view virtual returns (uint8) {\n        return 18;\n    }\n\n    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n    /*                           ERC20                            */\n    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n    /// @dev Returns the amount of tokens in existence.\n    function totalSupply() public view virtual returns (uint256 result) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := sload(_TOTAL_SUPPLY_SLOT)\n        }\n    }\n\n    /// @dev Returns the amount of tokens owned by `owner`.\n    function balanceOf(address owner) public view virtual returns (uint256 result) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            mstore(0x0c, _BALANCE_SLOT_SEED)\n            mstore(0x00, owner)\n            result := sload(keccak256(0x0c, 0x20))\n        }\n    }\n\n    /// @dev Returns the amount of tokens that `spender` can spend on behalf of `owner`.\n    function allowance(address owner, address spender)\n        public\n        view\n        virtual\n        returns (uint256 result)\n    {\n        /// @solidity memory-safe-assembly\n        assembly {\n            mstore(0x20, spender)\n            mstore(0x0c, _ALLOWANCE_SLOT_SEED)\n            mstore(0x00, owner)\n            result := sload(keccak256(0x0c, 0x34))\n        }\n    }\n\n    /// @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n    ///\n    /// Emits a {Approval} event.\n    function approve(address spender, uint256 amount) public virtual returns (bool) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Compute the allowance slot and store the amount.\n            mstore(0x20, spender)\n            mstore(0x0c, _ALLOWANCE_SLOT_SEED)\n            mstore(0x00, caller())\n            sstore(keccak256(0x0c, 0x34), amount)\n            // Emit the {Approval} event.\n            mstore(0x00, amount)\n            log3(0x00, 0x20, _APPROVAL_EVENT_SIGNATURE, caller(), shr(96, mload(0x2c)))\n        }\n        return true;\n    }\n\n    /// @dev Atomically increases the allowance granted to `spender` by the caller.\n    ///\n    /// Emits a {Approval} event.\n    function increaseAllowance(address spender, uint256 difference) public virtual returns (bool) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Compute the allowance slot and load its value.\n            mstore(0x20, spender)\n            mstore(0x0c, _ALLOWANCE_SLOT_SEED)\n            mstore(0x00, caller())\n            let allowanceSlot := keccak256(0x0c, 0x34)\n            let allowanceBefore := sload(allowanceSlot)\n            // Add to the allowance.\n            let allowanceAfter := add(allowanceBefore, difference)\n            // Revert upon overflow.\n            if lt(allowanceAfter, allowanceBefore) {\n                mstore(0x00, 0xf9067066) // `AllowanceOverflow()`.\n                revert(0x1c, 0x04)\n            }\n            // Store the updated allowance.\n            sstore(allowanceSlot, allowanceAfter)\n            // Emit the {Approval} event.\n            mstore(0x00, allowanceAfter)\n            log3(0x00, 0x20, _APPROVAL_EVENT_SIGNATURE, caller(), shr(96, mload(0x2c)))\n        }\n        return true;\n    }\n\n    /// @dev Atomically decreases the allowance granted to `spender` by the caller.\n    ///\n    /// Emits a {Approval} event.\n    function decreaseAllowance(address spender, uint256 difference) public virtual returns (bool) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Compute the allowance slot and load its value.\n            mstore(0x20, spender)\n            mstore(0x0c, _ALLOWANCE_SLOT_SEED)\n            mstore(0x00, caller())\n            let allowanceSlot := keccak256(0x0c, 0x34)\n            let allowanceBefore := sload(allowanceSlot)\n            // Revert if will underflow.\n            if lt(allowanceBefore, difference) {\n                mstore(0x00, 0x8301ab38) // `AllowanceUnderflow()`.\n                revert(0x1c, 0x04)\n            }\n            // Subtract and store the updated allowance.\n            let allowanceAfter := sub(allowanceBefore, difference)\n            sstore(allowanceSlot, allowanceAfter)\n            // Emit the {Approval} event.\n            mstore(0x00, allowanceAfter)\n            log3(0x00, 0x20, _APPROVAL_EVENT_SIGNATURE, caller(), shr(96, mload(0x2c)))\n        }\n        return true;\n    }\n\n    /// @dev Transfer `amount` tokens from the caller to `to`.\n    ///\n    /// Requirements:\n    /// - `from` must at least have `amount`.\n    ///\n    /// Emits a {Transfer} event.\n    function transfer(address to, uint256 amount) public virtual returns (bool) {\n        _beforeTokenTransfer(msg.sender, to, amount);\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Compute the balance slot and load its value.\n            mstore(0x0c, _BALANCE_SLOT_SEED)\n            mstore(0x00, caller())\n            let fromBalanceSlot := keccak256(0x0c, 0x20)\n            let fromBalance := sload(fromBalanceSlot)\n            // Revert if insufficient balance.\n            if gt(amount, fromBalance) {\n                mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n                revert(0x1c, 0x04)\n            }\n            // Subtract and store the updated balance.\n            sstore(fromBalanceSlot, sub(fromBalance, amount))\n            // Compute the balance slot of `to`.\n            mstore(0x00, to)\n            let toBalanceSlot := keccak256(0x0c, 0x20)\n            // Add and store the updated balance of `to`.\n            // Will not overflow because the sum of all user balances\n            // cannot exceed the maximum uint256 value.\n            sstore(toBalanceSlot, add(sload(toBalanceSlot), amount))\n            // Emit the {Transfer} event.\n            mstore(0x20, amount)\n            log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, caller(), shr(96, mload(0x0c)))\n        }\n        _afterTokenTransfer(msg.sender, to, amount);\n        return true;\n    }\n\n    /// @dev Transfers `amount` tokens from `from` to `to`.\n    ///\n    /// Note: Does not update the allowance if it is the maximum uint256 value.\n    ///\n    /// Requirements:\n    /// - `from` must at least have `amount`.\n    /// - The caller must have at least `amount` of allowance to transfer the tokens of `from`.\n    ///\n    /// Emits a {Transfer} event.\n    function transferFrom(address from, address to, uint256 amount) public virtual returns (bool) {\n        _beforeTokenTransfer(from, to, amount);\n        /// @solidity memory-safe-assembly\n        assembly {\n            let from_ := shl(96, from)\n            // Compute the allowance slot and load its value.\n            mstore(0x20, caller())\n            mstore(0x0c, or(from_, _ALLOWANCE_SLOT_SEED))\n            let allowanceSlot := keccak256(0x0c, 0x34)\n            let allowance_ := sload(allowanceSlot)\n            // If the allowance is not the maximum uint256 value.\n            if iszero(eq(allowance_, not(0))) {\n                // Revert if the amount to be transferred exceeds the allowance.\n                if gt(amount, allowance_) {\n                    mstore(0x00, 0x13be252b) // `InsufficientAllowance()`.\n                    revert(0x1c, 0x04)\n                }\n                // Subtract and store the updated allowance.\n                sstore(allowanceSlot, sub(allowance_, amount))\n            }\n            // Compute the balance slot and load its value.\n            mstore(0x0c, or(from_, _BALANCE_SLOT_SEED))\n            let fromBalanceSlot := keccak256(0x0c, 0x20)\n            let fromBalance := sload(fromBalanceSlot)\n            // Revert if insufficient balance.\n            if gt(amount, fromBalance) {\n                mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n                revert(0x1c, 0x04)\n            }\n            // Subtract and store the updated balance.\n            sstore(fromBalanceSlot, sub(fromBalance, amount))\n            // Compute the balance slot of `to`.\n            mstore(0x00, to)\n            let toBalanceSlot := keccak256(0x0c, 0x20)\n            // Add and store the updated balance of `to`.\n            // Will not overflow because the sum of all user balances\n            // cannot exceed the maximum uint256 value.\n            sstore(toBalanceSlot, add(sload(toBalanceSlot), amount))\n            // Emit the {Transfer} event.\n            mstore(0x20, amount)\n            log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, from_), shr(96, mload(0x0c)))\n        }\n        _afterTokenTransfer(from, to, amount);\n        return true;\n    }\n\n    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n    /*                          EIP-2612                          */\n    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n    /// @dev Returns the current nonce for `owner`.\n    /// This value is used to compute the signature for EIP-2612 permit.\n    function nonces(address owner) public view virtual returns (uint256 result) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Compute the nonce slot and load its value.\n            mstore(0x0c, _NONCES_SLOT_SEED)\n            mstore(0x00, owner)\n            result := sload(keccak256(0x0c, 0x20))\n        }\n    }\n\n    /// @dev Sets `value` as the allowance of `spender` over the tokens of `owner`,\n    /// authorized by a signed approval by `owner`.\n    ///\n    /// Emits a {Approval} event.\n    function permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) public virtual {\n        bytes32 domainSeparator = DOMAIN_SEPARATOR();\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Grab the free memory pointer.\n            let m := mload(0x40)\n            // Revert if the block timestamp greater than `deadline`.\n            if gt(timestamp(), deadline) {\n                mstore(0x00, 0x1a15a3cc) // `PermitExpired()`.\n                revert(0x1c, 0x04)\n            }\n            // Clean the upper 96 bits.\n            owner := shr(96, shl(96, owner))\n            spender := shr(96, shl(96, spender))\n            // Compute the nonce slot and load its value.\n            mstore(0x0c, _NONCES_SLOT_SEED)\n            mstore(0x00, owner)\n            let nonceSlot := keccak256(0x0c, 0x20)\n            let nonceValue := sload(nonceSlot)\n            // Increment and store the updated nonce.\n            sstore(nonceSlot, add(nonceValue, 1))\n            // Prepare the inner hash.\n            // `keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\")`.\n            // forgefmt: disable-next-item\n            mstore(m, 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9)\n            mstore(add(m, 0x20), owner)\n            mstore(add(m, 0x40), spender)\n            mstore(add(m, 0x60), value)\n            mstore(add(m, 0x80), nonceValue)\n            mstore(add(m, 0xa0), deadline)\n            // Prepare the outer hash.\n            mstore(0, 0x1901)\n            mstore(0x20, domainSeparator)\n            mstore(0x40, keccak256(m, 0xc0))\n            // Prepare the ecrecover calldata.\n            mstore(0, keccak256(0x1e, 0x42))\n            mstore(0x20, and(0xff, v))\n            mstore(0x40, r)\n            mstore(0x60, s)\n            pop(staticcall(gas(), 1, 0, 0x80, 0x20, 0x20))\n            // If the ecrecover fails, the returndatasize will be 0x00,\n            // `owner` will be be checked if it equals the hash at 0x00,\n            // which evaluates to false (i.e. 0), and we will revert.\n            // If the ecrecover succeeds, the returndatasize will be 0x20,\n            // `owner` will be compared against the returned address at 0x20.\n            if iszero(eq(mload(returndatasize()), owner)) {\n                mstore(0x00, 0xddafbaef) // `InvalidPermit()`.\n                revert(0x1c, 0x04)\n            }\n            // Compute the allowance slot and store the value.\n            // The `owner` is already at slot 0x20.\n            mstore(0x40, or(shl(160, _ALLOWANCE_SLOT_SEED), spender))\n            sstore(keccak256(0x2c, 0x34), value)\n            // Emit the {Approval} event.\n            log3(add(m, 0x60), 0x20, _APPROVAL_EVENT_SIGNATURE, owner, spender)\n            mstore(0x40, m) // Restore the free memory pointer.\n            mstore(0x60, 0) // Restore the zero pointer.\n        }\n    }\n\n    /// @dev Returns the EIP-2612 domains separator.\n    function DOMAIN_SEPARATOR() public view virtual returns (bytes32 result) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := mload(0x40) // Grab the free memory pointer.\n        }\n        //  We simply calculate it on-the-fly to allow for cases where the `name` may change.\n        bytes32 nameHash = keccak256(bytes(name()));\n        /// @solidity memory-safe-assembly\n        assembly {\n            let m := result\n            // `keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\")`.\n            // forgefmt: disable-next-item\n            mstore(m, 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f)\n            mstore(add(m, 0x20), nameHash)\n            // `keccak256(\"1\")`.\n            // forgefmt: disable-next-item\n            mstore(add(m, 0x40), 0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6)\n            mstore(add(m, 0x60), chainid())\n            mstore(add(m, 0x80), address())\n            result := keccak256(m, 0xa0)\n        }\n    }\n\n    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n    /*                  INTERNAL MINT FUNCTIONS                   */\n    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n    /// @dev Mints `amount` tokens to `to`, increasing the total supply.\n    ///\n    /// Emits a {Transfer} event.\n    function _mint(address to, uint256 amount) internal virtual {\n        _beforeTokenTransfer(address(0), to, amount);\n        /// @solidity memory-safe-assembly\n        assembly {\n            let totalSupplyBefore := sload(_TOTAL_SUPPLY_SLOT)\n            let totalSupplyAfter := add(totalSupplyBefore, amount)\n            // Revert if the total supply overflows.\n            if lt(totalSupplyAfter, totalSupplyBefore) {\n                mstore(0x00, 0xe5cfe957) // `TotalSupplyOverflow()`.\n                revert(0x1c, 0x04)\n            }\n            // Store the updated total supply.\n            sstore(_TOTAL_SUPPLY_SLOT, totalSupplyAfter)\n            // Compute the balance slot and load its value.\n            mstore(0x0c, _BALANCE_SLOT_SEED)\n            mstore(0x00, to)\n            let toBalanceSlot := keccak256(0x0c, 0x20)\n            // Add and store the updated balance.\n            sstore(toBalanceSlot, add(sload(toBalanceSlot), amount))\n            // Emit the {Transfer} event.\n            mstore(0x20, amount)\n            log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, 0, shr(96, mload(0x0c)))\n        }\n        _afterTokenTransfer(address(0), to, amount);\n    }\n\n    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n    /*                  INTERNAL BURN FUNCTIONS                   */\n    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n    /// @dev Burns `amount` tokens from `from`, reducing the total supply.\n    ///\n    /// Emits a {Transfer} event.\n    function _burn(address from, uint256 amount) internal virtual {\n        _beforeTokenTransfer(from, address(0), amount);\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Compute the balance slot and load its value.\n            mstore(0x0c, _BALANCE_SLOT_SEED)\n            mstore(0x00, from)\n            let fromBalanceSlot := keccak256(0x0c, 0x20)\n            let fromBalance := sload(fromBalanceSlot)\n            // Revert if insufficient balance.\n            if gt(amount, fromBalance) {\n                mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n                revert(0x1c, 0x04)\n            }\n            // Subtract and store the updated balance.\n            sstore(fromBalanceSlot, sub(fromBalance, amount))\n            // Subtract and store the updated total supply.\n            sstore(_TOTAL_SUPPLY_SLOT, sub(sload(_TOTAL_SUPPLY_SLOT), amount))\n            // Emit the {Transfer} event.\n            mstore(0x00, amount)\n            log3(0x00, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, shl(96, from)), 0)\n        }\n        _afterTokenTransfer(from, address(0), amount);\n    }\n\n    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n    /*                INTERNAL TRANSFER FUNCTIONS                 */\n    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n    /// @dev Moves `amount` of tokens from `from` to `to`.\n    function _transfer(address from, address to, uint256 amount) internal virtual {\n        _beforeTokenTransfer(from, to, amount);\n        /// @solidity memory-safe-assembly\n        assembly {\n            let from_ := shl(96, from)\n            // Compute the balance slot and load its value.\n            mstore(0x0c, or(from_, _BALANCE_SLOT_SEED))\n            let fromBalanceSlot := keccak256(0x0c, 0x20)\n            let fromBalance := sload(fromBalanceSlot)\n            // Revert if insufficient balance.\n            if gt(amount, fromBalance) {\n                mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n                revert(0x1c, 0x04)\n            }\n            // Subtract and store the updated balance.\n            sstore(fromBalanceSlot, sub(fromBalance, amount))\n            // Compute the balance slot of `to`.\n            mstore(0x00, to)\n            let toBalanceSlot := keccak256(0x0c, 0x20)\n            // Add and store the updated balance of `to`.\n            // Will not overflow because the sum of all user balances\n            // cannot exceed the maximum uint256 value.\n            sstore(toBalanceSlot, add(sload(toBalanceSlot), amount))\n            // Emit the {Transfer} event.\n            mstore(0x20, amount)\n            log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, from_), shr(96, mload(0x0c)))\n        }\n        _afterTokenTransfer(from, to, amount);\n    }\n\n    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n    /*                INTERNAL ALLOWANCE FUNCTIONS                */\n    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n    /// @dev Updates the allowance of `owner` for `spender` based on spent `amount`.\n    function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Compute the allowance slot and load its value.\n            mstore(0x20, spender)\n            mstore(0x0c, _ALLOWANCE_SLOT_SEED)\n            mstore(0x00, owner)\n            let allowanceSlot := keccak256(0x0c, 0x34)\n            let allowance_ := sload(allowanceSlot)\n            // If the allowance is not the maximum uint256 value.\n            if iszero(eq(allowance_, not(0))) {\n                // Revert if the amount to be transferred exceeds the allowance.\n                if gt(amount, allowance_) {\n                    mstore(0x00, 0x13be252b) // `InsufficientAllowance()`.\n                    revert(0x1c, 0x04)\n                }\n                // Subtract and store the updated allowance.\n                sstore(allowanceSlot, sub(allowance_, amount))\n            }\n        }\n    }\n\n    /// @dev Sets `amount` as the allowance of `spender` over the tokens of `owner`.\n    ///\n    /// Emits a {Approval} event.\n    function _approve(address owner, address spender, uint256 amount) internal virtual {\n        /// @solidity memory-safe-assembly\n        assembly {\n            let owner_ := shl(96, owner)\n            // Compute the allowance slot and store the amount.\n            mstore(0x20, spender)\n            mstore(0x0c, or(owner_, _ALLOWANCE_SLOT_SEED))\n            sstore(keccak256(0x0c, 0x34), amount)\n            // Emit the {Approval} event.\n            mstore(0x00, amount)\n            log3(0x00, 0x20, _APPROVAL_EVENT_SIGNATURE, shr(96, owner_), shr(96, mload(0x2c)))\n        }\n    }\n\n    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n    /*                     HOOKS TO OVERRIDE                      */\n    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n    /// @dev Hook that is called before any transfer of tokens.\n    /// This includes minting and burning.\n    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n    /// @dev Hook that is called after any transfer of tokens.\n    /// This includes minting and burning.\n    function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n}\n"
      },
      "lib/solady/src/utils/SafeTransferLib.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeTransferLib.sol)\n/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)\n///\n/// @dev Note:\n/// - For ETH transfers, please use `forceSafeTransferETH` for gas griefing protection.\n/// - For ERC20s, this implementation won't check that a token has code,\n/// responsibility is delegated to the caller.\nlibrary SafeTransferLib {\n    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n    /*                       CUSTOM ERRORS                        */\n    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n    /// @dev The ETH transfer has failed.\n    error ETHTransferFailed();\n\n    /// @dev The ERC20 `transferFrom` has failed.\n    error TransferFromFailed();\n\n    /// @dev The ERC20 `transfer` has failed.\n    error TransferFailed();\n\n    /// @dev The ERC20 `approve` has failed.\n    error ApproveFailed();\n\n    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n    /*                         CONSTANTS                          */\n    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n    /// @dev Suggested gas stipend for contract receiving ETH\n    /// that disallows any storage writes.\n    uint256 internal constant _GAS_STIPEND_NO_STORAGE_WRITES = 2300;\n\n    /// @dev Suggested gas stipend for contract receiving ETH to perform a few\n    /// storage reads and writes, but low enough to prevent griefing.\n    /// Multiply by a small constant (e.g. 2), if needed.\n    uint256 internal constant _GAS_STIPEND_NO_GRIEF = 100000;\n\n    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n    /*                       ETH OPERATIONS                       */\n    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n    /// @dev Sends `amount` (in wei) ETH to `to`.\n    /// Reverts upon failure.\n    ///\n    /// Note: This implementation does NOT protect against gas griefing.\n    /// Please use `forceSafeTransferETH` for gas griefing protection.\n    function safeTransferETH(address to, uint256 amount) internal {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Transfer the ETH and check if it succeeded or not.\n            if iszero(call(gas(), to, amount, 0, 0, 0, 0)) {\n                // Store the function selector of `ETHTransferFailed()`.\n                mstore(0x00, 0xb12d13eb)\n                // Revert with (offset, size).\n                revert(0x1c, 0x04)\n            }\n        }\n    }\n\n    /// @dev Force sends `amount` (in wei) ETH to `to`, with a `gasStipend`.\n    /// The `gasStipend` can be set to a low enough value to prevent\n    /// storage writes or gas griefing.\n    ///\n    /// If sending via the normal procedure fails, force sends the ETH by\n    /// creating a temporary contract which uses `SELFDESTRUCT` to force send the ETH.\n    ///\n    /// Reverts if the current contract has insufficient balance.\n    function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // If insufficient balance, revert.\n            if lt(selfbalance(), amount) {\n                // Store the function selector of `ETHTransferFailed()`.\n                mstore(0x00, 0xb12d13eb)\n                // Revert with (offset, size).\n                revert(0x1c, 0x04)\n            }\n            // Transfer the ETH and check if it succeeded or not.\n            if iszero(call(gasStipend, to, amount, 0, 0, 0, 0)) {\n                mstore(0x00, to) // Store the address in scratch space.\n                mstore8(0x0b, 0x73) // Opcode `PUSH20`.\n                mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.\n                // We can directly use `SELFDESTRUCT` in the contract creation.\n                // Compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758\n                if iszero(create(amount, 0x0b, 0x16)) {\n                    // To coerce gas estimation to provide enough gas for the `create` above.\n                    if iszero(gt(gas(), 1000000)) { revert(0, 0) }\n                }\n            }\n        }\n    }\n\n    /// @dev Force sends `amount` (in wei) ETH to `to`, with a gas stipend\n    /// equal to `_GAS_STIPEND_NO_GRIEF`. This gas stipend is a reasonable default\n    /// for 99% of cases and can be overridden with the three-argument version of this\n    /// function if necessary.\n    ///\n    /// If sending via the normal procedure fails, force sends the ETH by\n    /// creating a temporary contract which uses `SELFDESTRUCT` to force send the ETH.\n    ///\n    /// Reverts if the current contract has insufficient balance.\n    function forceSafeTransferETH(address to, uint256 amount) internal {\n        // Manually inlined because the compiler doesn't inline functions with branches.\n        /// @solidity memory-safe-assembly\n        assembly {\n            // If insufficient balance, revert.\n            if lt(selfbalance(), amount) {\n                // Store the function selector of `ETHTransferFailed()`.\n                mstore(0x00, 0xb12d13eb)\n                // Revert with (offset, size).\n                revert(0x1c, 0x04)\n            }\n            // Transfer the ETH and check if it succeeded or not.\n            if iszero(call(_GAS_STIPEND_NO_GRIEF, to, amount, 0, 0, 0, 0)) {\n                mstore(0x00, to) // Store the address in scratch space.\n                mstore8(0x0b, 0x73) // Opcode `PUSH20`.\n                mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.\n                // We can directly use `SELFDESTRUCT` in the contract creation.\n                // Compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758\n                if iszero(create(amount, 0x0b, 0x16)) {\n                    // To coerce gas estimation to provide enough gas for the `create` above.\n                    if iszero(gt(gas(), 1000000)) { revert(0, 0) }\n                }\n            }\n        }\n    }\n\n    /// @dev Sends `amount` (in wei) ETH to `to`, with a `gasStipend`.\n    /// The `gasStipend` can be set to a low enough value to prevent\n    /// storage writes or gas griefing.\n    ///\n    /// Simply use `gasleft()` for `gasStipend` if you don't need a gas stipend.\n    ///\n    /// Note: Does NOT revert upon failure.\n    /// Returns whether the transfer of ETH is successful instead.\n    function trySafeTransferETH(address to, uint256 amount, uint256 gasStipend)\n        internal\n        returns (bool success)\n    {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Transfer the ETH and check if it succeeded or not.\n            success := call(gasStipend, to, amount, 0, 0, 0, 0)\n        }\n    }\n\n    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n    /*                      ERC20 OPERATIONS                      */\n    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n    /// @dev Sends `amount` of ERC20 `token` from `from` to `to`.\n    /// Reverts upon failure.\n    ///\n    /// The `from` account must have at least `amount` approved for\n    /// the current contract to manage.\n    function safeTransferFrom(address token, address from, address to, uint256 amount) internal {\n        /// @solidity memory-safe-assembly\n        assembly {\n            let m := mload(0x40) // Cache the free memory pointer.\n\n            mstore(0x60, amount) // Store the `amount` argument.\n            mstore(0x40, to) // Store the `to` argument.\n            mstore(0x2c, shl(96, from)) // Store the `from` argument.\n            // Store the function selector of `transferFrom(address,address,uint256)`.\n            mstore(0x0c, 0x23b872dd000000000000000000000000)\n\n            if iszero(\n                and( // The arguments of `and` are evaluated from right to left.\n                    // Set success to whether the call reverted, if not we check it either\n                    // returned exactly 1 (can't just be non-zero data), or had no return data.\n                    or(eq(mload(0x00), 1), iszero(returndatasize())),\n                    call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)\n                )\n            ) {\n                // Store the function selector of `TransferFromFailed()`.\n                mstore(0x00, 0x7939f424)\n                // Revert with (offset, size).\n                revert(0x1c, 0x04)\n            }\n\n            mstore(0x60, 0) // Restore the zero slot to zero.\n            mstore(0x40, m) // Restore the free memory pointer.\n        }\n    }\n\n    /// @dev Sends all of ERC20 `token` from `from` to `to`.\n    /// Reverts upon failure.\n    ///\n    /// The `from` account must have their entire balance approved for\n    /// the current contract to manage.\n    function safeTransferAllFrom(address token, address from, address to)\n        internal\n        returns (uint256 amount)\n    {\n        /// @solidity memory-safe-assembly\n        assembly {\n            let m := mload(0x40) // Cache the free memory pointer.\n\n            mstore(0x40, to) // Store the `to` argument.\n            mstore(0x2c, shl(96, from)) // Store the `from` argument.\n            // Store the function selector of `balanceOf(address)`.\n            mstore(0x0c, 0x70a08231000000000000000000000000)\n            if iszero(\n                and( // The arguments of `and` are evaluated from right to left.\n                    gt(returndatasize(), 0x1f), // At least 32 bytes returned.\n                    staticcall(gas(), token, 0x1c, 0x24, 0x60, 0x20)\n                )\n            ) {\n                // Store the function selector of `TransferFromFailed()`.\n                mstore(0x00, 0x7939f424)\n                // Revert with (offset, size).\n                revert(0x1c, 0x04)\n            }\n\n            // Store the function selector of `transferFrom(address,address,uint256)`.\n            mstore(0x00, 0x23b872dd)\n            // The `amount` argument is already written to the memory word at 0x60.\n            amount := mload(0x60)\n\n            if iszero(\n                and( // The arguments of `and` are evaluated from right to left.\n                    // Set success to whether the call reverted, if not we check it either\n                    // returned exactly 1 (can't just be non-zero data), or had no return data.\n                    or(eq(mload(0x00), 1), iszero(returndatasize())),\n                    call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)\n                )\n            ) {\n                // Store the function selector of `TransferFromFailed()`.\n                mstore(0x00, 0x7939f424)\n                // Revert with (offset, size).\n                revert(0x1c, 0x04)\n            }\n\n            mstore(0x60, 0) // Restore the zero slot to zero.\n            mstore(0x40, m) // Restore the free memory pointer.\n        }\n    }\n\n    /// @dev Sends `amount` of ERC20 `token` from the current contract to `to`.\n    /// Reverts upon failure.\n    function safeTransfer(address token, address to, uint256 amount) internal {\n        /// @solidity memory-safe-assembly\n        assembly {\n            mstore(0x14, to) // Store the `to` argument.\n            mstore(0x34, amount) // Store the `amount` argument.\n            // Store the function selector of `transfer(address,uint256)`.\n            mstore(0x00, 0xa9059cbb000000000000000000000000)\n\n            if iszero(\n                and( // The arguments of `and` are evaluated from right to left.\n                    // Set success to whether the call reverted, if not we check it either\n                    // returned exactly 1 (can't just be non-zero data), or had no return data.\n                    or(eq(mload(0x00), 1), iszero(returndatasize())),\n                    call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)\n                )\n            ) {\n                // Store the function selector of `TransferFailed()`.\n                mstore(0x00, 0x90b8ec18)\n                // Revert with (offset, size).\n                revert(0x1c, 0x04)\n            }\n            // Restore the part of the free memory pointer that was overwritten.\n            mstore(0x34, 0)\n        }\n    }\n\n    /// @dev Sends all of ERC20 `token` from the current contract to `to`.\n    /// Reverts upon failure.\n    function safeTransferAll(address token, address to) internal returns (uint256 amount) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            mstore(0x00, 0x70a08231) // Store the function selector of `balanceOf(address)`.\n            mstore(0x20, address()) // Store the address of the current contract.\n            if iszero(\n                and( // The arguments of `and` are evaluated from right to left.\n                    gt(returndatasize(), 0x1f), // At least 32 bytes returned.\n                    staticcall(gas(), token, 0x1c, 0x24, 0x34, 0x20)\n                )\n            ) {\n                // Store the function selector of `TransferFailed()`.\n                mstore(0x00, 0x90b8ec18)\n                // Revert with (offset, size).\n                revert(0x1c, 0x04)\n            }\n\n            mstore(0x14, to) // Store the `to` argument.\n            // The `amount` argument is already written to the memory word at 0x34.\n            amount := mload(0x34)\n            // Store the function selector of `transfer(address,uint256)`.\n            mstore(0x00, 0xa9059cbb000000000000000000000000)\n\n            if iszero(\n                and( // The arguments of `and` are evaluated from right to left.\n                    // Set success to whether the call reverted, if not we check it either\n                    // returned exactly 1 (can't just be non-zero data), or had no return data.\n                    or(eq(mload(0x00), 1), iszero(returndatasize())),\n                    call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)\n                )\n            ) {\n                // Store the function selector of `TransferFailed()`.\n                mstore(0x00, 0x90b8ec18)\n                // Revert with (offset, size).\n                revert(0x1c, 0x04)\n            }\n            // Restore the part of the free memory pointer that was overwritten.\n            mstore(0x34, 0)\n        }\n    }\n\n    /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract.\n    /// Reverts upon failure.\n    function safeApprove(address token, address to, uint256 amount) internal {\n        /// @solidity memory-safe-assembly\n        assembly {\n            mstore(0x14, to) // Store the `to` argument.\n            mstore(0x34, amount) // Store the `amount` argument.\n            // Store the function selector of `approve(address,uint256)`.\n            mstore(0x00, 0x095ea7b3000000000000000000000000)\n\n            if iszero(\n                and( // The arguments of `and` are evaluated from right to left.\n                    // Set success to whether the call reverted, if not we check it either\n                    // returned exactly 1 (can't just be non-zero data), or had no return data.\n                    or(eq(mload(0x00), 1), iszero(returndatasize())),\n                    call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)\n                )\n            ) {\n                // Store the function selector of `ApproveFailed()`.\n                mstore(0x00, 0x3e3f8f73)\n                // Revert with (offset, size).\n                revert(0x1c, 0x04)\n            }\n            // Restore the part of the free memory pointer that was overwritten.\n            mstore(0x34, 0)\n        }\n    }\n\n    /// @dev Returns the amount of ERC20 `token` owned by `account`.\n    /// Returns zero if the `token` does not exist.\n    function balanceOf(address token, address account) internal view returns (uint256 amount) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            mstore(0x14, account) // Store the `account` argument.\n            // Store the function selector of `balanceOf(address)`.\n            mstore(0x00, 0x70a08231000000000000000000000000)\n            amount :=\n                mul(\n                    mload(0x20),\n                    and( // The arguments of `and` are evaluated from right to left.\n                        gt(returndatasize(), 0x1f), // At least 32 bytes returned.\n                        staticcall(gas(), token, 0x10, 0x24, 0x20, 0x20)\n                    )\n                )\n        }\n    }\n}\n"
      },
      "lib/herdaddy/src/interfaces/IFeeReceiver.sol": {
        "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity ^0.8.19;\n\ninterface IFeeReceiver {\n    struct Repartition {\n        address[] receivers;\n        uint256[] fees; // Fee in basis points, where 10,000 basis points = 100%\n    }\n\n    function governance() external view returns (address);\n    function futureGovernance() external view returns (address);\n    function acceptGovernance() external;\n    function transferGovernance(address _futureGovernance) external;\n\n    function getRepartition(address rewardToken) external view returns (address[] memory receivers, uint256[] memory fees);\n    function setRepartition(address rewardToken, address[] calldata receivers, uint256[] calldata fees) external;\n    function setAccumulator(address rewardToken, address _accumulator) external;\n\n    function split(address rewardToken) external;\n}\n"
      },
      "src/base/interfaces/ILiquidityGauge.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.7;\n\ninterface ILiquidityGauge {\n    struct Reward {\n        address token;\n        address distributor;\n        // solhint-disable-next-line\n        uint256 period_finish;\n        uint256 rate;\n        // solhint-disable-next-line\n        uint256 last_update;\n        uint256 integral;\n    }\n\n    // solhint-disable-next-line\n    function deposit_reward_token(address _rewardToken, uint256 _amount) external;\n\n    // solhint-disable-next-line\n    function claim_rewards_for(address _user, address _recipient) external;\n\n    // solhint-disable-next-line\n    function working_balances(address _address) external view returns (uint256);\n\n    // solhint-disable-next-line\n    function deposit(uint256 _value, address _addr) external;\n\n    // solhint-disable-next-line\n    function reward_tokens(uint256 _i) external view returns (address);\n\n    // solhint-disable-next-line\n    function reward_data(address _tokenReward) external view returns (Reward memory);\n\n    function balanceOf(address) external returns (uint256);\n\n    // solhint-disable-next-line\n    function claimable_reward(address _user, address _reward_token) external view returns (uint256);\n\n    // solhint-disable-next-line\n    function claimable_tokens(address _user) external returns (uint256);\n\n    // solhint-disable-next-line\n    function user_checkpoint(address _user) external returns (bool);\n\n    // solhint-disable-next-line\n    function commit_transfer_ownership(address) external;\n\n    // solhint-disable-next-line\n    function claim_rewards() external;\n\n    // solhint-disable-next-line\n    function claim_rewards(address) external;\n\n    // solhint-disable-next-line\n    function claim_rewards(address, address) external;\n\n    // solhint-disable-next-line\n    function add_reward(address, address) external;\n\n    // solhint-disable-next-line\n    function set_claimer(address) external;\n\n    function admin() external view returns (address);\n\n    function future_admin() external view returns (address);\n\n    // solhint-disable-next-line\n    function set_reward_distributor(address _rewardToken, address _newDistrib) external;\n\n    function initialize(\n        // solhint-disable-next-line\n        address staking_token,\n        address admin,\n        address sdt,\n        // solhint-disable-next-line\n        address voting_escrow,\n        // solhint-disable-next-line\n        address veBoost_proxy,\n        address distributor\n    ) external;\n\n    function totalSupply() external returns (uint256);\n\n    function withdraw(uint256 _value, bool _claimReward) external;\n\n    function withdraw(uint256 _valut, address _user, bool _claimReward) external;\n\n    // solhint-disable-next-line\n    function accept_transfer_ownership() external;\n\n    // solhint-disable-next-line\n    function claimed_reward(address _addr, address _token) external view returns (uint256);\n\n    // solhint-disable-next-line\n    function set_rewards_receiver(address _receiver) external;\n}\n"
      },
      "src/base/interfaces/ISDTDistributor.sol": {
        "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.7;\n\ninterface ISDTDistributor {\n    function distribute(address gaugeAddr) external;\n}\n"
      }
    },
    "settings": {
      "remappings": [
        "utils/=lib/utils/",
        "solady/=lib/solady/",
        "herdaddy/=lib/herdaddy/src/",
        "forge-std/=lib/forge-std/src/",
        "address-book/=lib/address-book/src/",
        "@openzeppelin/=lib/openzeppelin-contracts/",
        "openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/",
        "solidity-examples/=lib/solidity-examples/contracts/",
        "murky/=lib/murky/src/",
        "LayerZero-v2/=lib/LayerZero-v2/",
        "ds-test/=lib/forge-std/lib/ds-test/src/",
        "solmate/=lib/solmate/src/"
      ],
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "metadata": {
        "useLiteralContent": false,
        "bytecodeHash": "ipfs",
        "appendCBOR": true
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "evmVersion": "paris",
      "viaIR": false,
      "libraries": {}
    }
  }}