S Price: $0.536341 (-10.15%)

Contract

0x7E26956597c5E24243fF3c988f1122d6202a23ae

Overview

S Balance

Sonic LogoSonic LogoSonic Logo0 S

S Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
RedOTCMarket

Compiler Version
v0.8.28+commit.7893614a

Optimization Enabled:
Yes with 999999 runs

Other Settings:
paris EvmVersion
File 1 of 16 : RedOTCMarket.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.28;

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

import "../interfaces/ITreasury.sol";
import "../interfaces/IBasisAsset.sol";
import "../interfaces/IOracle.sol";
import "../interfaces/ITokenTradingRouter.sol";

/**
 * @title RedOTCMarket
 * @notice This contract is used by the DAO Fund to sell RED tokens over‐the‐counter.
 * Users send USDC.e to purchase RED tokens at a discounted price (default: 20% discount).
 * The purchased RED tokens vest linearly over a configurable number of treasury epochs (default: 21).
 * The Treasury provides RED price and epoch information.
 */
contract RedOTCMarket is ReentrancyGuard, OwnableUpgradeable {
    using SafeERC20 for IERC20;

    // ------------------------------------------------------------------------
    //                         DATA STRUCTURES
    // ------------------------------------------------------------------------
    /// @notice Represents a vesting schedule for a user's OTC purchase.
    struct VestingScheduleByEpoch {
        uint256 totalAmount; // Total RED tokens locked in vesting.
        uint256 claimedAmount; // Amount of RED tokens already claimed.
        uint256 startEpoch; // Treasury epoch when vesting starts.
        uint256 vestingEpochs; // Number of treasury epochs over which vesting occurs.
    }

    // ------------------------------------------------------------------------
    //                          STATE VARIABLES
    // ------------------------------------------------------------------------
    ITreasury public treasury; // Treasury contract (provides RED price and epoch info).
    ITokenTradingRouter public router; // Router for token swapping.

    address public red; // RED token address.
    address public green; // GREEN token address.
    address public blue; // BLUE token address.
    address public usdc; // USDC.e token address (used for payment).
    IOracle public usdcInSonicOracle; // Oracle to convert USDC.e to SONIC.
    uint256 public redInDebt; // Total RED tokens sold but not yet claimed.

    // TWAP price floor (in SONIC, scaled by 1e18) below which buyback & burn is triggered.
    // For example, a value of 95e16 represents a floor of 0.95.
    uint256 public twapPriceFloorToBuyBack;

    // Mapping for buyback & burn rates (in basis points) per peg token.
    // Example: buybackAndBurnBPs[green] = 4000 means 40% of USDC.e is used for GREEN buyback & burn.
    mapping(address => uint256) public buybackAndBurnBPs;

    uint256 public discountBP; // Discount on RED price (e.g., 2000 for 20% discount).
    uint256 public vestingEpochs; // Number of treasury epochs over which RED vests (default: 21).

    // Mapping from user address to their vesting schedule.
    mapping(address => VestingScheduleByEpoch) public vestingScheduleByEpochs;

    // Statistics.
    uint256 public totalRedSelling;
    uint256 public totalRedPurchased;
    uint256 public totalUsdcCollected;
    uint256 public totalUsdcToDao;
    uint256 public totalGreenBurned;
    uint256 public totalBlueBurned;

    // Store the current selling batch infos.
    uint256 public currentBatchRedSelling;
    uint256 public currentBatchRedPurchased;

    // ------------------------------------------------------------------------
    //                              EVENTS
    // ------------------------------------------------------------------------
    event GreenPurchasedAndBurned(address indexed user, uint256 usdcUsed, uint256 tokenBurned);
    event RedPurchased(address indexed user, uint256 usdcAmount, uint256 redAmount);
    event VestingUpdated(address indexed user, uint256 totalVestingAmount, uint256 startEpoch, uint256 vestingEpochs);
    event RedClaimed(address indexed user, uint256 amountClaimed);
    event TreasuryUpdated(address indexed newTreasury);
    event RouterUpdated(address indexed newRouter);
    event DiscountRateUpdated(uint256 newDiscountBP);
    event VestingEpochsUpdated(uint256 newVestingEpochs);
    event BuybackAndBurnBPUpdated(address pegToken, uint256 newBuybackAndBurnBP);
    event TwapPriceFloorUpdated(uint256 newPriceFloor);

    // ------------------------------------------------------------------------
    //                           INITIALIZER
    // ------------------------------------------------------------------------
    /**
     * @notice Initializes the RedOTCMarket contract.
     * @param _usdc The USDC.e token address.
     * @param _usdcInSonicOracle The oracle to convert USDC.e to SONIC.
     * @param _treasury The Treasury contract address.
     * @param _router The token trading router address.
     */
    function initialize(address _usdc, IOracle _usdcInSonicOracle, ITreasury _treasury, ITokenTradingRouter _router) external initializer {
        OwnableUpgradeable.__Ownable_init(msg.sender);

        require(_usdc != address(0), "RedOTCMarket: invalid USDC address");
        require(address(_usdcInSonicOracle) != address(0), "RedOTCMarket: invalid USDC oracle");
        require(address(_treasury) != address(0), "RedOTCMarket: invalid treasury");
        require(address(_router) != address(0), "RedOTCMarket: invalid router");

        usdc = _usdc;
        usdcInSonicOracle = _usdcInSonicOracle;
        treasury = _treasury;
        router = _router;

        // Retrieve token addresses from the Treasury.
        red = treasury.red();
        green = treasury.green();
        blue = treasury.blue();

        // Set a default TWAP price floor for buyback (0.95 in SONIC terms).
        twapPriceFloorToBuyBack = 95e16;

        // Set default buyback & burn rates.
        buybackAndBurnBPs[green] = 4000; // 40% for GREEN.
        buybackAndBurnBPs[blue] = 1000; // 10% for BLUE.

        discountBP = 2000; // 20% discount.
        vestingEpochs = 21; // Vest over 21 treasury epochs.
    }

    // ------------------------------------------------------------------------
    //                    CONFIGURATION FUNCTIONS
    // ------------------------------------------------------------------------
    /**
     * @notice Sets the Treasury contract.
     * @param _treasury The new Treasury contract address.
     */
    function setTreasury(ITreasury _treasury) external onlyOwner {
        require(address(_treasury) != address(0), "RedOTCMarket: invalid treasury address");
        treasury = _treasury;
        red = treasury.red();
        green = treasury.green();
        blue = treasury.blue();
        emit TreasuryUpdated(address(_treasury));
    }

    /**
     * @notice Sets the token trading router.
     * @param _router The new router address.
     */
    function setRouter(ITokenTradingRouter _router) external onlyOwner {
        require(address(_router) != address(0), "RedOTCMarket: invalid router address");
        router = _router;
        emit RouterUpdated(address(_router));
    }

    /**
     * @notice Updates the discount rate applied on RED token price.
     * @param _discountBP The new discount rate in basis points (e.g., 2000 for 20%).
     */
    function setDiscountBP(uint256 _discountBP) external onlyOwner {
        require(_discountBP <= 10000, "RedOTCMarket: discount cannot exceed 100%");
        discountBP = _discountBP;
        emit DiscountRateUpdated(_discountBP);
    }

    /**
     * @notice Updates the vesting duration in treasury epochs.
     * @param _vestingEpochs The new number of epochs over which RED tokens vest.
     */
    function setVestingEpochs(uint256 _vestingEpochs) external onlyOwner {
        require(_vestingEpochs > 0, "RedOTCMarket: vesting epochs must be > 0");
        vestingEpochs = _vestingEpochs;
        emit VestingEpochsUpdated(_vestingEpochs);
    }

    /**
     * @notice Updates the buyback and burn rate for a given peg token.
     * @param _pegToken The peg token address (e.g., GREEN or BLUE).
     * @param _buybackAndBurnBP The new rate in basis points.
     */
    function setBuybackAndBurnBP(address _pegToken, uint256 _buybackAndBurnBP) external onlyOwner {
        require(_buybackAndBurnBP <= 10000, "RedOTCMarket: rate cannot exceed 100%");
        buybackAndBurnBPs[_pegToken] = _buybackAndBurnBP;
        emit BuybackAndBurnBPUpdated(_pegToken, _buybackAndBurnBP);
    }

    /**
     * @notice Sets the TWAP price floor for triggering buyback & burn operations.
     * @dev This value (scaled by 1e18) represents the minimum TWAP (in SONIC) for a peg token
     * below which the system will trigger buyback & burn actions.
     * For example, a value of 95e16 represents 0.95.
     * @param _priceFloor The new TWAP price floor.
     */
    function setTwapPriceFloorToBuyBack(uint256 _priceFloor) external onlyOwner {
        require(_priceFloor > 0, "RedOTCMarket: price floor must be > 0");
        twapPriceFloorToBuyBack = _priceFloor;
        emit TwapPriceFloorUpdated(_priceFloor);
    }

    // ------------------------------------------------------------------------
    //                  PURCHASE & VESTING FUNCTIONS
    // ------------------------------------------------------------------------
    /**
     * @notice Allows a user to add additional RED tokens for sale OTC.
     * @param _redAmount The amount of RED tokens to add.
     */
    function addRedForSale(uint256 _redAmount) external nonReentrant {
        IERC20(red).safeTransferFrom(msg.sender, address(this), _redAmount);
        totalRedSelling += _redAmount;
        currentBatchRedSelling = totalRedSelling - totalRedPurchased;
        currentBatchRedPurchased = 0;
    }

    /**
     * @notice Allows a user to purchase RED tokens OTC by sending USDC.e.
     * The user's USDC.e is partially used to buy back and burn a peg token (GREEN or BLUE),
     * and the remainder is forwarded to the DAO Fund. The purchased RED tokens are then vested linearly.
     * @param _usdcAmount The amount of USDC.e sent by the user.
     * @param pegToken The peg token used for buyback & burn (must be GREEN or BLUE).
     */
    function buyRed(uint256 _usdcAmount, address pegToken) external nonReentrant {
        require(_usdcAmount > 0, "RedOTCMarket: amount must be > 0");
        require(pegToken == green || pegToken == blue, "RedOTCMarket: invalid peg token");

        // Retrieve updated TWAP for the specified peg token.
        uint256 pegTokenTWAP = getPegTokenUpdatedPrice(pegToken);
        require(pegTokenTWAP > 0, "RedOTCMarket: invalid peg token TWAP");

        // Transfer USDC.e from the user.
        IERC20 usdcToken = IERC20(usdc);
        usdcToken.safeTransferFrom(msg.sender, address(this), _usdcAmount);
        totalUsdcCollected += _usdcAmount;

        // If the peg token's TWAP is below the configured floor, trigger buyback & burn.
        if (pegTokenTWAP < twapPriceFloorToBuyBack) {
            // Use a portion of USDC.e for buyback & burn of the peg token.
            uint256 usdcForBuyback = (_usdcAmount * buybackAndBurnBPs[pegToken]) / 10000;
            if (usdcForBuyback > 0) {
                usdcToken.approve(address(router), usdcForBuyback);
                router.swapToken(usdc, pegToken, usdcForBuyback);
                usdcToken.approve(address(router), 0);
                uint256 pegTokenBalance = IERC20(pegToken).balanceOf(address(this));
                if (pegTokenBalance > 0) {
                    IBasisAsset(pegToken).burn(pegTokenBalance);
                    if (pegToken == green) {
                        totalGreenBurned += pegTokenBalance;
                    } else if (pegToken == blue) {
                        totalBlueBurned += pegTokenBalance;
                    }
                    emit GreenPurchasedAndBurned(msg.sender, usdcForBuyback, pegTokenBalance);
                }
            }
        }

        // Forward any remaining USDC.e to the DAO Fund.
        uint256 remainingUsdc = usdcToken.balanceOf(address(this));
        if (remainingUsdc > 0) {
            usdcToken.safeTransfer(treasury.daoFund(), remainingUsdc);
            totalUsdcToDao += remainingUsdc;
        }

        // Convert the USDC.e amount to its SONIC value.
        uint256 inSonicValue = getUsdcToSonic(_usdcAmount);

        // Calculate the discounted RED price (in SONIC) and the corresponding RED amount.
        uint256 discountedPrice = getRedDiscountedPrice();
        uint256 redAmount = (inSonicValue * 1e18) / discountedPrice;
        require(redAmount > 0, "RedOTCMarket: redAmount is 0");

        redInDebt += redAmount;
        require(redInDebt <= IERC20(red).balanceOf(address(this)), "RedOTCMarket: insufficient RED in contract");

        // Update the purchaser's vesting schedule.
        VestingScheduleByEpoch storage schedule = vestingScheduleByEpochs[msg.sender];
        if (schedule.totalAmount > 0) {
            uint256 _claimable = availableToClaim(msg.sender);
            if (_claimable > 0) {
                _claim(_claimable); // Claim any available vested RED tokens before merging.
            }
            uint256 unvested = schedule.totalAmount - schedule.claimedAmount;
            schedule.totalAmount = redAmount + unvested; // Merge new purchase with remaining unvested.
        } else {
            schedule.totalAmount = redAmount;
        }
        // Reset vesting schedule parameters.
        schedule.claimedAmount = 0;
        schedule.startEpoch = treasury.epoch();
        schedule.vestingEpochs = vestingEpochs;

        totalRedPurchased += redAmount;
        currentBatchRedPurchased += redAmount;

        emit RedPurchased(msg.sender, _usdcAmount, redAmount);
        emit VestingUpdated(msg.sender, redAmount, schedule.startEpoch, schedule.vestingEpochs);
    }

    // ------------------------------------------------------------------------
    //                 VESTING & CLAIMING FUNCTIONS
    // ------------------------------------------------------------------------
    /**
     * @notice Returns the amount of RED tokens currently claimable by a user.
     * @param user The address of the user.
     * @return claimableAmount The claimable RED token amount.
     */
    function availableToClaim(address user) public view returns (uint256 claimableAmount) {
        VestingScheduleByEpoch memory schedule = vestingScheduleByEpochs[user];
        uint256 currentEpoch = treasury.epoch();
        if (currentEpoch <= schedule.startEpoch) {
            return 0;
        }
        uint256 elapsedEpochs = currentEpoch - schedule.startEpoch;
        if (elapsedEpochs >= schedule.vestingEpochs) {
            claimableAmount = schedule.totalAmount - schedule.claimedAmount;
        } else {
            uint256 vested = (schedule.totalAmount * elapsedEpochs) / schedule.vestingEpochs;
            claimableAmount = vested > schedule.claimedAmount ? vested - schedule.claimedAmount : 0;
        }
    }

    /**
     * @notice Returns the treasury epoch at which the user's vesting schedule will be fully vested.
     * @param user The address of the user.
     * @return fullEpoch The treasury epoch when vesting completes.
     */
    function fullVestingEpoch(address user) external view returns (uint256 fullEpoch) {
        fullEpoch = vestingScheduleByEpochs[user].startEpoch + vestingScheduleByEpochs[user].vestingEpochs;
    }

    /**
     * @notice Returns the updated TWAP for a given peg token (GREEN or BLUE).
     * @param _token The peg token address.
     * @return The updated TWAP.
     */
    function getPegTokenUpdatedPrice(address _token) public view returns (uint256) {
        require(_token == green || _token == blue, "RedOTCMarket: invalid peg token");
        return treasury.getPegTokenUpdatedPrice(_token);
    }

    /**
     * @notice Returns the vesting schedule for a user.
     * @param _member The address of the user.
     * @return _claimable The amount of RED tokens currently claimable.
     * @return _remaining The amount of RED tokens remaining in the vesting schedule.
     * @return _startEpoch The treasury epoch when vesting started.
     * @return _endEpoch The treasury epoch when vesting completes.
     * @return _currentEpoch The current treasury epoch.
     * @return _nextEpochPoint The timestamp for the next treasury epoch.
     */
    function vestingSchedule(address _member) external view returns (uint256 _claimable, uint256 _remaining, uint256 _startEpoch, uint256 _endEpoch, uint256 _currentEpoch, uint256 _nextEpochPoint) {
        VestingScheduleByEpoch memory schedule = vestingScheduleByEpochs[_member];
        _claimable = _remaining = _startEpoch = _endEpoch = 0;
        _currentEpoch = treasury.epoch();
        _nextEpochPoint = treasury.nextEpochPoint();
        if (schedule.vestingEpochs > 0) {
            _startEpoch = schedule.startEpoch;
            _remaining = schedule.totalAmount - schedule.claimedAmount;
            _endEpoch = _startEpoch + schedule.vestingEpochs;
            if (_currentEpoch > _startEpoch) {
                uint256 elapsedEpochs = _currentEpoch - _startEpoch;
                if (elapsedEpochs >= schedule.vestingEpochs) {
                    _claimable = _remaining;
                } else {
                    uint256 vested = (schedule.totalAmount * elapsedEpochs) / schedule.vestingEpochs;
                    _claimable = vested > schedule.claimedAmount ? vested - schedule.claimedAmount : 0;
                }
            }
        }
    }

    /**
     * @notice Allows a user to claim their vested RED tokens.
     */
    function claim() external nonReentrant {
        uint256 _claimable = availableToClaim(msg.sender);
        require(_claimable > 0, "RedOTCMarket: no vested tokens to claim");
        _claim(_claimable);
    }

    /**
     * @dev Internal function that claims vested RED tokens for msg.sender.
     * Updates the user's vesting schedule and transfers claimable RED tokens.
     * @param _claimable The amount of tokens to claim.
     */
    function _claim(uint256 _claimable) internal {
        VestingScheduleByEpoch storage schedule = vestingScheduleByEpochs[msg.sender];
        schedule.claimedAmount += _claimable;
        require(schedule.claimedAmount <= schedule.totalAmount, "RedOTCMarket: claimed amount exceeds total");
        redInDebt -= _claimable;
        IERC20(red).safeTransfer(msg.sender, _claimable);
        emit RedClaimed(msg.sender, _claimable);
    }

    // ------------------------------------------------------------------------
    //                    UTILITY FUNCTIONS
    // ------------------------------------------------------------------------
    /**
     * @notice Returns the current RED price in SONIC as provided by the Treasury's RED oracle.
     * @return The RED price in SONIC (scaled by 1e18).
     */
    function getRedPriceInSonic() public view returns (uint256) {
        return uint256(IOracle(treasury.redOracle()).twap(red, 1e18));
    }

    /**
     * @notice Converts a given USDC.e amount into its SONIC value.
     * @param usdcAmount The USDC.e amount.
     * @return The corresponding SONIC value (in wei).
     */
    function getUsdcToSonic(uint256 usdcAmount) public view returns (uint256) {
        return uint256(IOracle(usdcInSonicOracle).twap(usdc, usdcAmount));
    }

    /**
     * @notice Computes the discounted RED price (in SONIC) by applying the discount rate.
     * @return The effective RED price in SONIC (scaled by 1e18).
     */
    function getRedDiscountedPrice() public view returns (uint256) {
        uint256 redPrice = getRedPriceInSonic();
        if (redPrice < 1e16) redPrice = 1e16; // Floor price: 0.01 SONIC per RED.
        return (redPrice * (10000 - discountBP)) / 10000;
    }

    // ------------------------------------------------------------------------
    //                GOVERNANCE & ADMIN FUNCTIONS
    // ------------------------------------------------------------------------
    /**
     * @notice Allows the owner to recover unsupported tokens.
     * @param _token The token to recover.
     * @param _amount The amount to recover.
     * @param _to The recipient address.
     */
    function governanceRecoverUnsupported(IERC20 _token, uint256 _amount, address _to) external onlyOwner {
        require(_to != address(0), "RedOTCMarket: Cannot transfer to zero address");
        _token.safeTransfer(_to, _amount);
    }
}

File 2 of 16 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    /// @custom:storage-location erc7201:openzeppelin.storage.Ownable
    struct OwnableStorage {
        address _owner;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300;

    function _getOwnableStorage() private pure returns (OwnableStorage storage $) {
        assembly {
            $.slot := OwnableStorageLocation
        }
    }

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    function __Ownable_init(address initialOwner) internal onlyInitializing {
        __Ownable_init_unchained(initialOwner);
    }

    function __Ownable_init_unchained(address initialOwner) internal onlyInitializing {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        OwnableStorage storage $ = _getOwnableStorage();
        return $._owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        OwnableStorage storage $ = _getOwnableStorage();
        address oldOwner = $._owner;
        $._owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 3 of 16 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.20;

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```solidity
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 *
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Storage of the initializable contract.
     *
     * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
     * when using with upgradeable contracts.
     *
     * @custom:storage-location erc7201:openzeppelin.storage.Initializable
     */
    struct InitializableStorage {
        /**
         * @dev Indicates that the contract has been initialized.
         */
        uint64 _initialized;
        /**
         * @dev Indicates that the contract is in the process of being initialized.
         */
        bool _initializing;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;

    /**
     * @dev The contract is already initialized.
     */
    error InvalidInitialization();

    /**
     * @dev The contract is not initializing.
     */
    error NotInitializing();

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint64 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
     * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
     * production.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        // Cache values to avoid duplicated sloads
        bool isTopLevelCall = !$._initializing;
        uint64 initialized = $._initialized;

        // Allowed calls:
        // - initialSetup: the contract is not in the initializing state and no previous version was
        //                 initialized
        // - construction: the contract is initialized at version 1 (no reininitialization) and the
        //                 current contract is just being deployed
        bool initialSetup = initialized == 0 && isTopLevelCall;
        bool construction = initialized == 1 && address(this).code.length == 0;

        if (!initialSetup && !construction) {
            revert InvalidInitialization();
        }
        $._initialized = 1;
        if (isTopLevelCall) {
            $._initializing = true;
        }
        _;
        if (isTopLevelCall) {
            $._initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint64 version) {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing || $._initialized >= version) {
            revert InvalidInitialization();
        }
        $._initialized = version;
        $._initializing = true;
        _;
        $._initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        _checkInitializing();
        _;
    }

    /**
     * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
     */
    function _checkInitializing() internal view virtual {
        if (!_isInitializing()) {
            revert NotInitializing();
        }
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing) {
            revert InvalidInitialization();
        }
        if ($._initialized != type(uint64).max) {
            $._initialized = type(uint64).max;
            emit Initialized(type(uint64).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint64) {
        return _getInitializableStorage()._initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _getInitializableStorage()._initializing;
    }

    /**
     * @dev Returns a pointer to the storage namespace.
     */
    // solhint-disable-next-line var-name-mixedcase
    function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
        assembly {
            $.slot := INITIALIZABLE_STORAGE
        }
    }
}

File 4 of 16 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

File 5 of 16 : IERC1363.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";

/**
 * @title IERC1363
 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
 *
 * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
 * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
 */
interface IERC1363 is IERC20, IERC165 {
    /*
     * Note: the ERC-165 identifier for this interface is 0xb0202a11.
     * 0xb0202a11 ===
     *   bytes4(keccak256('transferAndCall(address,uint256)')) ^
     *   bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
     */

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @param data Additional data with no specified format, sent in call to `spender`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}

File 6 of 16 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../utils/introspection/IERC165.sol";

File 7 of 16 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../token/ERC20/IERC20.sol";

File 8 of 16 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the value of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 value) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}

File 9 of 16 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.2.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC-20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    /**
     * @dev An operation with an ERC-20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     *
     * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
     * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
     * set here.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            safeTransfer(token, to, value);
        } else if (!token.transferAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
     * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferFromAndCallRelaxed(
        IERC1363 token,
        address from,
        address to,
        uint256 value,
        bytes memory data
    ) internal {
        if (to.code.length == 0) {
            safeTransferFrom(token, from, to, value);
        } else if (!token.transferFromAndCall(from, to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
     * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
     * once without retrying, and relies on the returned value to be true.
     *
     * Reverts if the returned value is other than `true`.
     */
    function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            forceApprove(token, to, value);
        } else if (!token.approveAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            // bubble errors
            if iszero(success) {
                let ptr := mload(0x40)
                returndatacopy(ptr, 0, returndatasize())
                revert(ptr, returndatasize())
            }
            returnSize := returndatasize()
            returnValue := mload(0)
        }

        if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        bool success;
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            returnSize := returndatasize()
            returnValue := mload(0)
        }
        return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
    }
}

File 10 of 16 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[ERC].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 11 of 16 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,
 * consider using {ReentrancyGuardTransient} instead.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant NOT_ENTERED = 1;
    uint256 private constant ENTERED = 2;

    uint256 private _status;

    /**
     * @dev Unauthorized reentrant call.
     */
    error ReentrancyGuardReentrantCall();

    constructor() {
        _status = NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be NOT_ENTERED
        if (_status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

        // Any calls to nonReentrant after this point will fail
        _status = ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == ENTERED;
    }
}

File 12 of 16 : IBasisAsset.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.28;

interface IBasisAsset {
    function mint(address recipient, uint256 amount) external returns (bool);

    function burn(uint256 amount) external;

    function burnFrom(address from, uint256 amount) external;

    function isOperator() external returns (bool);

    function operator() external view returns (address);

    function transferOperator(address newOperator_) external;

    function transferOwnership(address newOwner_) external;

    function totalBurned() external view returns (uint256);
}

File 13 of 16 : IEpoch.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.28;

interface IEpoch {
    function epoch() external view returns (uint256);

    function nextEpochPoint() external view returns (uint256);

    function nextEpochLength() external view returns (uint256);
}

File 14 of 16 : IOracle.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.28;

interface IOracle {
    function update() external;

    function consult(address _token, uint256 _amountIn) external view returns (uint144 amountOut);

    function twap(address _token, uint256 _amountIn) external view returns (uint144 _amountOut);
}

File 15 of 16 : ITokenTradingRouter.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.28;

interface ITokenTradingRouter {
    function swapToken(address _inputToken, address _outputToken, uint256 _amount) external;
}

File 16 of 16 : ITreasury.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.28;

import "./IEpoch.sol";

interface ITreasury is IEpoch {
    function getPegTokenPrice(address _token) external view returns (uint256);

    function getPegTokenUpdatedPrice(address _token) external view returns (uint256);

    function getPegTokenLockedBalance(address _token) external view returns (uint256);

    function getPegTokenCirculatingSupply(address _token) external view returns (uint256);

    function getPegTokenExpansionRate(address _token) external view returns (uint256);

    function getPegTokenExpansionAmount(address _token) external view returns (uint256);

    function previousEpochGreenPrice() external view returns (uint256);

    function boardroom() external view returns (address);

    function boardroomSharedPercent() external view returns (uint256);

    function daoFund() external view returns (address);

    function daoFundSharedPercent() external view returns (uint256);

    function collateralPool() external view returns (address);

    function collateralPoolSharedPercent() external view returns (uint256);

    function devFund() external view returns (address);

    function devFundSharedPercent() external view returns (uint256);

    function isSharePrinter(address account) external view returns (bool);

    function priceOne() external view returns (uint256);

    function priceCeiling() external view returns (uint256);

    function green() external view returns (address);

    function blue() external view returns (address);

    function red() external view returns (address);

    function redOracle() external view returns (address);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 999999
  },
  "evmVersion": "paris",
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"pegToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"newBuybackAndBurnBP","type":"uint256"}],"name":"BuybackAndBurnBPUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newDiscountBP","type":"uint256"}],"name":"DiscountRateUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"usdcUsed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenBurned","type":"uint256"}],"name":"GreenPurchasedAndBurned","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountClaimed","type":"uint256"}],"name":"RedClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"usdcAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"redAmount","type":"uint256"}],"name":"RedPurchased","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newRouter","type":"address"}],"name":"RouterUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newTreasury","type":"address"}],"name":"TreasuryUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newPriceFloor","type":"uint256"}],"name":"TwapPriceFloorUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newVestingEpochs","type":"uint256"}],"name":"VestingEpochsUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"totalVestingAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startEpoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"vestingEpochs","type":"uint256"}],"name":"VestingUpdated","type":"event"},{"inputs":[{"internalType":"uint256","name":"_redAmount","type":"uint256"}],"name":"addRedForSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"availableToClaim","outputs":[{"internalType":"uint256","name":"claimableAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"blue","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_usdcAmount","type":"uint256"},{"internalType":"address","name":"pegToken","type":"address"}],"name":"buyRed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"buybackAndBurnBPs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentBatchRedPurchased","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentBatchRedSelling","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"discountBP","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"fullVestingEpoch","outputs":[{"internalType":"uint256","name":"fullEpoch","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"getPegTokenUpdatedPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRedDiscountedPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRedPriceInSonic","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"usdcAmount","type":"uint256"}],"name":"getUsdcToSonic","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_to","type":"address"}],"name":"governanceRecoverUnsupported","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"green","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_usdc","type":"address"},{"internalType":"contract IOracle","name":"_usdcInSonicOracle","type":"address"},{"internalType":"contract ITreasury","name":"_treasury","type":"address"},{"internalType":"contract ITokenTradingRouter","name":"_router","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"red","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"redInDebt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"router","outputs":[{"internalType":"contract ITokenTradingRouter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_pegToken","type":"address"},{"internalType":"uint256","name":"_buybackAndBurnBP","type":"uint256"}],"name":"setBuybackAndBurnBP","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_discountBP","type":"uint256"}],"name":"setDiscountBP","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ITokenTradingRouter","name":"_router","type":"address"}],"name":"setRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ITreasury","name":"_treasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_priceFloor","type":"uint256"}],"name":"setTwapPriceFloorToBuyBack","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_vestingEpochs","type":"uint256"}],"name":"setVestingEpochs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalBlueBurned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalGreenBurned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalRedPurchased","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalRedSelling","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalUsdcCollected","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalUsdcToDao","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"contract ITreasury","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"twapPriceFloorToBuyBack","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"usdc","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"usdcInSonicOracle","outputs":[{"internalType":"contract IOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vestingEpochs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_member","type":"address"}],"name":"vestingSchedule","outputs":[{"internalType":"uint256","name":"_claimable","type":"uint256"},{"internalType":"uint256","name":"_remaining","type":"uint256"},{"internalType":"uint256","name":"_startEpoch","type":"uint256"},{"internalType":"uint256","name":"_endEpoch","type":"uint256"},{"internalType":"uint256","name":"_currentEpoch","type":"uint256"},{"internalType":"uint256","name":"_nextEpochPoint","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"vestingScheduleByEpochs","outputs":[{"internalType":"uint256","name":"totalAmount","type":"uint256"},{"internalType":"uint256","name":"claimedAmount","type":"uint256"},{"internalType":"uint256","name":"startEpoch","type":"uint256"},{"internalType":"uint256","name":"vestingEpochs","type":"uint256"}],"stateMutability":"view","type":"function"}]

6080604052348015600f57600080fd5b506001600055613148806100246000396000f3fe608060405234801561001057600080fd5b50600436106102de5760003560e01c80636d08245311610186578063ce57d52c116100e3578063f2f1e13211610097578063f8c8765e11610071578063f8c8765e14610625578063fe102e6c14610638578063ffff6b041461065857600080fd5b8063f2f1e132146105d2578063f2fde38b146105f2578063f887ea401461060557600080fd5b8063e6d68581116100c8578063e6d6858114610596578063ed18f0a71461059f578063f0f44260146105bf57600080fd5b8063ce57d52c14610570578063cfce1be01461058357600080fd5b80639a51d2d11161013a578063a5f491fb1161011f578063a5f491fb1461054c578063c0d7865514610555578063ca3ec16a1461056857600080fd5b80639a51d2d11461053a5780639c154e641461054357600080fd5b80637412b9971161016b5780637412b997146104d757806382753b14146104ea5780638da5cb5b146104fd57600080fd5b80636d082453146104bc578063715018a6146104cf57600080fd5b8063445ec3891161023f57806357d472ef116101f357806361d027b3116101cd57806361d027b31461048a5780636a5190d0146104aa5780636a87fd2c146104b357600080fd5b806357d472ef146104655780635923e1c91461047857806361843e081461048157600080fd5b80634e71d92d116102245780634e71d92d1461043757806354575af41461043f57806354f4396c1461045257600080fd5b8063445ec3891461041b5780634e10db931461042457600080fd5b806320dd0d21116102965780632f28419a1161027b5780632f28419a146103d25780633b01a487146103db5780633e413bee146103fb57600080fd5b806320dd0d21146103845780632930cf241461038d57600080fd5b80631213f2e7116102c75780631213f2e71461035e5780631a0e756414610367578063209f9d3f1461036f57600080fd5b80630da45188146102e35780631169fc8814610309575b600080fd5b6102f66102f1366004612ea8565b610698565b6040519081526020015b60405180910390f35b61033e610317366004612ea8565b600d6020526000908152604090208054600182015460028301546003909301549192909184565b604080519485526020850193909352918301526060820152608001610300565b6102f660085481565b6102f6610807565b61038261037d366004612ecc565b610955565b005b6102f660115481565b6003546103ad9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610300565b6102f660125481565b6007546103ad9073ffffffffffffffffffffffffffffffffffffffff1681565b6006546103ad9073ffffffffffffffffffffffffffffffffffffffff1681565b6102f660105481565b610382610432366004612ee5565b6109be565b6103826114c5565b61038261044d366004612f15565b611580565b610382610460366004612ecc565b611651565b6102f6610473366004612ecc565b611725565b6102f660155481565b6102f6600f5481565b6001546103ad9073ffffffffffffffffffffffffffffffffffffffff1681565b6102f660095481565b6102f6600e5481565b6103826104ca366004612f57565b6117e1565b6103826118e0565b6102f66104e5366004612ea8565b6118f2565b6102f66104f8366004612ea8565b611932565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c1993005473ffffffffffffffffffffffffffffffffffffffff166103ad565b6102f6600c5481565b6102f6600b5481565b6102f660135481565b610382610563366004612ea8565b611a72565b6102f6611b8b565b61038261057e366004612ecc565b611bde565b610382610591366004612ecc565b611cab565b6102f660145481565b6005546103ad9073ffffffffffffffffffffffffffffffffffffffff1681565b6103826105cd366004612ea8565b611d7a565b6004546103ad9073ffffffffffffffffffffffffffffffffffffffff1681565b610382610600366004612ea8565b6120d0565b6002546103ad9073ffffffffffffffffffffffffffffffffffffffff1681565b610382610633366004612f83565b612131565b6102f6610646366004612ea8565b600a6020526000908152604090205481565b61066b610666366004612ea8565b6127db565b604080519687526020870195909552938501929092526060840152608083015260a082015260c001610300565b73ffffffffffffffffffffffffffffffffffffffff8082166000908152600d60209081526040808320815160808101835281548152600180830154828601526002830154828501526003909201546060820152905482517f900cf0cf0000000000000000000000000000000000000000000000000000000081529251949591948694919092169263900cf0cf92600480830193928290030181865afa158015610745573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107699190612fdf565b905081604001518111610780575060009392505050565b60008260400151826107929190613027565b9050826060015181106107b757602083015183516107b09190613027565b93506107ff565b600083606001518285600001516107ce919061303a565b6107d89190613051565b9050836020015181116107ec5760006107fb565b60208401516107fb9082613027565b9450505b505050919050565b600154604080517f2c2a65e8000000000000000000000000000000000000000000000000000000008152905160009273ffffffffffffffffffffffffffffffffffffffff1691632c2a65e89160048083019260209291908290030181865afa158015610877573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089b919061308c565b6003546040517f6808a12800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9182166004820152670de0b6b3a76400006024820152911690636808a12890604401602060405180830381865afa158015610918573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061093c91906130a9565b71ffffffffffffffffffffffffffffffffffff16905090565b61095d6129fc565b6003546109829073ffffffffffffffffffffffffffffffffffffffff16333084612a3f565b80600e600082825461099491906130dd565b9091555050600f54600e546109a99190613027565b60145560006015556109bb6001600055565b50565b6109c66129fc565b60008211610a35576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f5265644f54434d61726b65743a20616d6f756e74206d757374206265203e203060448201526064015b60405180910390fd5b60045473ffffffffffffffffffffffffffffffffffffffff82811691161480610a78575060055473ffffffffffffffffffffffffffffffffffffffff8281169116145b610ade576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265644f54434d61726b65743a20696e76616c69642070656720746f6b656e006044820152606401610a2c565b6000610ae982611932565b905060008111610b7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f5265644f54434d61726b65743a20696e76616c69642070656720746f6b656e2060448201527f54574150000000000000000000000000000000000000000000000000000000006064820152608401610a2c565b60065473ffffffffffffffffffffffffffffffffffffffff16610b9f81333087612a3f565b8360106000828254610bb191906130dd565b9091555050600954821015610fae5773ffffffffffffffffffffffffffffffffffffffff83166000908152600a602052604081205461271090610bf4908761303a565b610bfe9190613051565b90508015610fac576002546040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9182166004820152602481018390529083169063095ea7b3906044016020604051808303816000875af1158015610c7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca391906130f0565b506002546006546040517f0c0a763000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9182166004820152868216602482015260448101849052911690630c0a763090606401600060405180830381600087803b158015610d2257600080fd5b505af1158015610d36573d6000803e3d6000fd5b50506002546040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff918216600482015260006024820152908516925063095ea7b391506044016020604051808303816000875af1158015610db3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd791906130f0565b506040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8616906370a0823190602401602060405180830381865afa158015610e45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e699190612fdf565b90508015610faa576040517f42966c680000000000000000000000000000000000000000000000000000000081526004810182905273ffffffffffffffffffffffffffffffffffffffff8616906342966c6890602401600060405180830381600087803b158015610ed957600080fd5b505af1158015610eed573d6000803e3d6000fd5b505060045473ffffffffffffffffffffffffffffffffffffffff908116908816039150610f339050578060126000828254610f2891906130dd565b90915550610f6e9050565b60055473ffffffffffffffffffffffffffffffffffffffff90811690861603610f6e578060136000828254610f6891906130dd565b90915550505b604080518381526020810183905233917f328c1ef8a9337efc0861d5821c216f166f76181249e97db3491bd26f3cfd0ecc910160405180910390a25b505b505b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa15801561101b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061103f9190612fdf565b9050801561111257600154604080517f8d934f7400000000000000000000000000000000000000000000000000000000815290516110fa9273ffffffffffffffffffffffffffffffffffffffff1691638d934f749160048083019260209291908290030181865afa1580156110b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110dc919061308c565b73ffffffffffffffffffffffffffffffffffffffff84169083612ace565b806011600082825461110c91906130dd565b90915550505b600061111d86611725565b90506000611129611b8b565b905060008161114084670de0b6b3a764000061303a565b61114a9190613051565b9050600081116111b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f5265644f54434d61726b65743a20726564416d6f756e742069732030000000006044820152606401610a2c565b80600860008282546111c891906130dd565b90915550506003546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff909116906370a0823190602401602060405180830381865afa15801561123b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061125f9190612fdf565b60085411156112f0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5265644f54434d61726b65743a20696e73756666696369656e7420524544206960448201527f6e20636f6e7472616374000000000000000000000000000000000000000000006064820152608401610a2c565b336000908152600d6020526040902080541561134b57600061131133610698565b905080156113225761132281612b0c565b6001820154825460009161133591613027565b905061134181856130dd565b83555061134f9050565b8181555b60008160010181905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663900cf0cf6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ea9190612fdf565b6002820155600c546003820155600f805483919060009061140c9084906130dd565b92505081905550816015600082825461142591906130dd565b9091555050604080518a81526020810184905233917f9f9afeff03cbd563cfc4d628225ffb115534360fc7974f5eef81e35a9ab9c7ca910160405180910390a26002810154600382015460408051858152602081019390935282015233907fd943f66835b20274709ced0d97b504f69aa631329c7c3bb6c99fcbf09390538e9060600160405180910390a2505050505050506114c16001600055565b5050565b6114cd6129fc565b60006114d833610698565b90506000811161156a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f5265644f54434d61726b65743a206e6f2076657374656420746f6b656e73207460448201527f6f20636c61696d000000000000000000000000000000000000000000000000006064820152608401610a2c565b61157381612b0c565b5061157e6001600055565b565b611588612c3e565b73ffffffffffffffffffffffffffffffffffffffff811661162b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f5265644f54434d61726b65743a2043616e6e6f74207472616e7366657220746f60448201527f207a65726f2061646472657373000000000000000000000000000000000000006064820152608401610a2c565b61164c73ffffffffffffffffffffffffffffffffffffffff84168284612ace565b505050565b611659612c3e565b600081116116e9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f5265644f54434d61726b65743a2076657374696e672065706f636873206d757360448201527f74206265203e20300000000000000000000000000000000000000000000000006064820152608401610a2c565b600c8190556040518181527f0641e07b568600a6e937884b46041ac8f3862a7f6c43673f4bf7f19dc688e6f2906020015b60405180910390a150565b6007546006546040517f6808a12800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9182166004820152602481018490526000929190911690636808a12890604401602060405180830381865afa1580156117a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117c791906130a9565b71ffffffffffffffffffffffffffffffffffff1692915050565b6117e9612c3e565b61271081111561187b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f5265644f54434d61726b65743a20726174652063616e6e6f742065786365656460448201527f20313030250000000000000000000000000000000000000000000000000000006064820152608401610a2c565b73ffffffffffffffffffffffffffffffffffffffff82166000818152600a6020908152604091829020849055815192835282018390527fc2f0686ab008b7ea5f9d3ff6a94da2fae1de9ab031775cfacd50d1cd511e5698910160405180910390a15050565b6118e8612c3e565b61157e6000612ccc565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600d60205260408120600381015460029091015461192c91906130dd565b92915050565b60045460009073ffffffffffffffffffffffffffffffffffffffff83811691161480611978575060055473ffffffffffffffffffffffffffffffffffffffff8381169116145b6119de576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265644f54434d61726b65743a20696e76616c69642070656720746f6b656e006044820152606401610a2c565b6001546040517f82753b1400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8481166004830152909116906382753b1490602401602060405180830381865afa158015611a4e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061192c9190612fdf565b611a7a612c3e565b73ffffffffffffffffffffffffffffffffffffffff8116611b1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f5265644f54434d61726b65743a20696e76616c696420726f757465722061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610a2c565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f7aed1d3e8155a07ccf395e44ea3109a0e2d6c9b29bbbe9f142d9790596f4dc8090600090a250565b600080611b96610807565b9050662386f26fc10000811015611bb15750662386f26fc100005b612710600b54612710611bc49190613027565b611bce908361303a565b611bd89190613051565b91505090565b611be6612c3e565b60008111611c76576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f5265644f54434d61726b65743a20707269636520666c6f6f72206d757374206260448201527f65203e20300000000000000000000000000000000000000000000000000000006064820152608401610a2c565b60098190556040518181527f141cd26f030bb7adcb8ea8b74d2c32bacaff93051a55e5711ecef1694df9b2879060200161171a565b611cb3612c3e565b612710811115611d45576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f5265644f54434d61726b65743a20646973636f756e742063616e6e6f7420657860448201527f63656564203130302500000000000000000000000000000000000000000000006064820152608401610a2c565b600b8190556040518181527fc4f588c2b1b0db1ae244d5b46f69e0c5962875377386d78b2c9cd5b654f906379060200161171a565b611d82612c3e565b73ffffffffffffffffffffffffffffffffffffffff8116611e25576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f5265644f54434d61726b65743a20696e76616c6964207472656173757279206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610a2c565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8316908117909155604080517f2930cf240000000000000000000000000000000000000000000000000000000081529051632930cf24916004808201926020929091908290030181865afa158015611ebc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ee0919061308c565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff928316179055600154604080517ff2f1e1320000000000000000000000000000000000000000000000000000000081529051919092169163f2f1e1329160048083019260209291908290030181865afa158015611f7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa0919061308c565b600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff928316178155600154604080517fed18f0a70000000000000000000000000000000000000000000000000000000081529051919093169263ed18f0a792818101926020929091908290030181865afa15801561203b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061205f919061308c565b600580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff928316179055604051908216907f7dae230f18360d76a040c81f050aa14eb9d6dc7901b20fc5d855e2a20fe814d190600090a250565b6120d8612c3e565b73ffffffffffffffffffffffffffffffffffffffff8116612128576040517f1e4fbdf700000000000000000000000000000000000000000000000000000000815260006004820152602401610a2c565b6109bb81612ccc565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000810460ff16159067ffffffffffffffff1660008115801561217c5750825b905060008267ffffffffffffffff1660011480156121995750303b155b9050811580156121a7575080155b156121de576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b84547fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000166001178555831561223f5784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff16680100000000000000001785555b61224833612d62565b73ffffffffffffffffffffffffffffffffffffffff89166122eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f5265644f54434d61726b65743a20696e76616c6964205553444320616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610a2c565b73ffffffffffffffffffffffffffffffffffffffff881661238e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f5265644f54434d61726b65743a20696e76616c69642055534443206f7261636c60448201527f65000000000000000000000000000000000000000000000000000000000000006064820152608401610a2c565b73ffffffffffffffffffffffffffffffffffffffff871661240b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f5265644f54434d61726b65743a20696e76616c696420747265617375727900006044820152606401610a2c565b73ffffffffffffffffffffffffffffffffffffffff8616612488576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f5265644f54434d61726b65743a20696e76616c696420726f75746572000000006044820152606401610a2c565b6006805473ffffffffffffffffffffffffffffffffffffffff808c167fffffffffffffffffffffffff000000000000000000000000000000000000000092831617909255600780548b8416908316179055600180548a8416908316811790915560028054938a1693909216929092179055604080517f2930cf240000000000000000000000000000000000000000000000000000000081529051632930cf24916004818101926020929091908290030181865afa15801561254d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612571919061308c565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff928316179055600154604080517ff2f1e1320000000000000000000000000000000000000000000000000000000081529051919092169163f2f1e1329160048083019260209291908290030181865afa15801561260d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612631919061308c565b600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff928316178155600154604080517fed18f0a70000000000000000000000000000000000000000000000000000000081529051919093169263ed18f0a792818101926020929091908290030181865afa1580156126cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126f0919061308c565b600580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff928316178155670d2f13f7789f000060095560045482166000908152600a6020526040808220610fa090559154909216825290206103e890556107d0600b556015600c5583156127d05784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff8082166000908152600d60209081526040808320815160808101835281548152600180830154828601526002830154828501526003909201546060820152905482517f900cf0cf00000000000000000000000000000000000000000000000000000000815292519495869586958695869586959094169263900cf0cf926004808401939192918290030181865afa15801561288f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128b39190612fdf565b9250600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c5967c266040518163ffffffff1660e01b8152600401602060405180830381865afa158015612922573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129469190612fdf565b6060820151909250156129f25760408101516020820151825191965061296b91613027565b955080606001518561297d91906130dd565b9350848311156129f25760006129938685613027565b9050816060015181106129a8578697506129f0565b600082606001518284600001516129bf919061303a565b6129c99190613051565b9050826020015181116129dd5760006129ec565b60208301516129ec9082613027565b9850505b505b5091939550919395565b600260005403612a38576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600055565b60405173ffffffffffffffffffffffffffffffffffffffff8481166024830152838116604483015260648201839052612ac89186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612d73565b50505050565b60405173ffffffffffffffffffffffffffffffffffffffff83811660248301526044820183905261164c91859182169063a9059cbb90606401612a81565b336000908152600d6020526040812060018101805491928492612b309084906130dd565b9091555050805460018201541115612bca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5265644f54434d61726b65743a20636c61696d656420616d6f756e742065786360448201527f6565647320746f74616c000000000000000000000000000000000000000000006064820152608401610a2c565b8160086000828254612bdc9190613027565b9091555050600354612c059073ffffffffffffffffffffffffffffffffffffffff163384612ace565b60405182815233907f7fbd837b6a0a5a672080c5dafc183cbcae545e8ee65afd638d5b65bbc7b866559060200160405180910390a25050565b33612c7d7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c1993005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff161461157e576040517f118cdaa7000000000000000000000000000000000000000000000000000000008152336004820152602401610a2c565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080547fffffffffffffffffffffffff0000000000000000000000000000000000000000811673ffffffffffffffffffffffffffffffffffffffff848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b612d6a612e17565b6109bb81612e7e565b600080602060008451602086016000885af180612d96576040513d6000823e3d81fd5b50506000513d91508115612dae578060011415612dc8565b73ffffffffffffffffffffffffffffffffffffffff84163b155b15612ac8576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610a2c565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005468010000000000000000900460ff1661157e576040517fd7e6bcf800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6120d8612e17565b73ffffffffffffffffffffffffffffffffffffffff811681146109bb57600080fd5b600060208284031215612eba57600080fd5b8135612ec581612e86565b9392505050565b600060208284031215612ede57600080fd5b5035919050565b60008060408385031215612ef857600080fd5b823591506020830135612f0a81612e86565b809150509250929050565b600080600060608486031215612f2a57600080fd5b8335612f3581612e86565b9250602084013591506040840135612f4c81612e86565b809150509250925092565b60008060408385031215612f6a57600080fd5b8235612f7581612e86565b946020939093013593505050565b60008060008060808587031215612f9957600080fd5b8435612fa481612e86565b93506020850135612fb481612e86565b92506040850135612fc481612e86565b91506060850135612fd481612e86565b939692955090935050565b600060208284031215612ff157600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561192c5761192c612ff8565b808202811582820484141761192c5761192c612ff8565b600082613087577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60006020828403121561309e57600080fd5b8151612ec581612e86565b6000602082840312156130bb57600080fd5b815171ffffffffffffffffffffffffffffffffffff81168114612ec557600080fd5b8082018082111561192c5761192c612ff8565b60006020828403121561310257600080fd5b81518015158114612ec557600080fdfea26469706673582212202515670d8478c258c7c31174567162726c06f723dd5766b4f670f829d270669b64736f6c634300081c0033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102de5760003560e01c80636d08245311610186578063ce57d52c116100e3578063f2f1e13211610097578063f8c8765e11610071578063f8c8765e14610625578063fe102e6c14610638578063ffff6b041461065857600080fd5b8063f2f1e132146105d2578063f2fde38b146105f2578063f887ea401461060557600080fd5b8063e6d68581116100c8578063e6d6858114610596578063ed18f0a71461059f578063f0f44260146105bf57600080fd5b8063ce57d52c14610570578063cfce1be01461058357600080fd5b80639a51d2d11161013a578063a5f491fb1161011f578063a5f491fb1461054c578063c0d7865514610555578063ca3ec16a1461056857600080fd5b80639a51d2d11461053a5780639c154e641461054357600080fd5b80637412b9971161016b5780637412b997146104d757806382753b14146104ea5780638da5cb5b146104fd57600080fd5b80636d082453146104bc578063715018a6146104cf57600080fd5b8063445ec3891161023f57806357d472ef116101f357806361d027b3116101cd57806361d027b31461048a5780636a5190d0146104aa5780636a87fd2c146104b357600080fd5b806357d472ef146104655780635923e1c91461047857806361843e081461048157600080fd5b80634e71d92d116102245780634e71d92d1461043757806354575af41461043f57806354f4396c1461045257600080fd5b8063445ec3891461041b5780634e10db931461042457600080fd5b806320dd0d21116102965780632f28419a1161027b5780632f28419a146103d25780633b01a487146103db5780633e413bee146103fb57600080fd5b806320dd0d21146103845780632930cf241461038d57600080fd5b80631213f2e7116102c75780631213f2e71461035e5780631a0e756414610367578063209f9d3f1461036f57600080fd5b80630da45188146102e35780631169fc8814610309575b600080fd5b6102f66102f1366004612ea8565b610698565b6040519081526020015b60405180910390f35b61033e610317366004612ea8565b600d6020526000908152604090208054600182015460028301546003909301549192909184565b604080519485526020850193909352918301526060820152608001610300565b6102f660085481565b6102f6610807565b61038261037d366004612ecc565b610955565b005b6102f660115481565b6003546103ad9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610300565b6102f660125481565b6007546103ad9073ffffffffffffffffffffffffffffffffffffffff1681565b6006546103ad9073ffffffffffffffffffffffffffffffffffffffff1681565b6102f660105481565b610382610432366004612ee5565b6109be565b6103826114c5565b61038261044d366004612f15565b611580565b610382610460366004612ecc565b611651565b6102f6610473366004612ecc565b611725565b6102f660155481565b6102f6600f5481565b6001546103ad9073ffffffffffffffffffffffffffffffffffffffff1681565b6102f660095481565b6102f6600e5481565b6103826104ca366004612f57565b6117e1565b6103826118e0565b6102f66104e5366004612ea8565b6118f2565b6102f66104f8366004612ea8565b611932565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c1993005473ffffffffffffffffffffffffffffffffffffffff166103ad565b6102f6600c5481565b6102f6600b5481565b6102f660135481565b610382610563366004612ea8565b611a72565b6102f6611b8b565b61038261057e366004612ecc565b611bde565b610382610591366004612ecc565b611cab565b6102f660145481565b6005546103ad9073ffffffffffffffffffffffffffffffffffffffff1681565b6103826105cd366004612ea8565b611d7a565b6004546103ad9073ffffffffffffffffffffffffffffffffffffffff1681565b610382610600366004612ea8565b6120d0565b6002546103ad9073ffffffffffffffffffffffffffffffffffffffff1681565b610382610633366004612f83565b612131565b6102f6610646366004612ea8565b600a6020526000908152604090205481565b61066b610666366004612ea8565b6127db565b604080519687526020870195909552938501929092526060840152608083015260a082015260c001610300565b73ffffffffffffffffffffffffffffffffffffffff8082166000908152600d60209081526040808320815160808101835281548152600180830154828601526002830154828501526003909201546060820152905482517f900cf0cf0000000000000000000000000000000000000000000000000000000081529251949591948694919092169263900cf0cf92600480830193928290030181865afa158015610745573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107699190612fdf565b905081604001518111610780575060009392505050565b60008260400151826107929190613027565b9050826060015181106107b757602083015183516107b09190613027565b93506107ff565b600083606001518285600001516107ce919061303a565b6107d89190613051565b9050836020015181116107ec5760006107fb565b60208401516107fb9082613027565b9450505b505050919050565b600154604080517f2c2a65e8000000000000000000000000000000000000000000000000000000008152905160009273ffffffffffffffffffffffffffffffffffffffff1691632c2a65e89160048083019260209291908290030181865afa158015610877573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089b919061308c565b6003546040517f6808a12800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9182166004820152670de0b6b3a76400006024820152911690636808a12890604401602060405180830381865afa158015610918573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061093c91906130a9565b71ffffffffffffffffffffffffffffffffffff16905090565b61095d6129fc565b6003546109829073ffffffffffffffffffffffffffffffffffffffff16333084612a3f565b80600e600082825461099491906130dd565b9091555050600f54600e546109a99190613027565b60145560006015556109bb6001600055565b50565b6109c66129fc565b60008211610a35576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f5265644f54434d61726b65743a20616d6f756e74206d757374206265203e203060448201526064015b60405180910390fd5b60045473ffffffffffffffffffffffffffffffffffffffff82811691161480610a78575060055473ffffffffffffffffffffffffffffffffffffffff8281169116145b610ade576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265644f54434d61726b65743a20696e76616c69642070656720746f6b656e006044820152606401610a2c565b6000610ae982611932565b905060008111610b7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f5265644f54434d61726b65743a20696e76616c69642070656720746f6b656e2060448201527f54574150000000000000000000000000000000000000000000000000000000006064820152608401610a2c565b60065473ffffffffffffffffffffffffffffffffffffffff16610b9f81333087612a3f565b8360106000828254610bb191906130dd565b9091555050600954821015610fae5773ffffffffffffffffffffffffffffffffffffffff83166000908152600a602052604081205461271090610bf4908761303a565b610bfe9190613051565b90508015610fac576002546040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9182166004820152602481018390529083169063095ea7b3906044016020604051808303816000875af1158015610c7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca391906130f0565b506002546006546040517f0c0a763000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9182166004820152868216602482015260448101849052911690630c0a763090606401600060405180830381600087803b158015610d2257600080fd5b505af1158015610d36573d6000803e3d6000fd5b50506002546040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff918216600482015260006024820152908516925063095ea7b391506044016020604051808303816000875af1158015610db3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd791906130f0565b506040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8616906370a0823190602401602060405180830381865afa158015610e45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e699190612fdf565b90508015610faa576040517f42966c680000000000000000000000000000000000000000000000000000000081526004810182905273ffffffffffffffffffffffffffffffffffffffff8616906342966c6890602401600060405180830381600087803b158015610ed957600080fd5b505af1158015610eed573d6000803e3d6000fd5b505060045473ffffffffffffffffffffffffffffffffffffffff908116908816039150610f339050578060126000828254610f2891906130dd565b90915550610f6e9050565b60055473ffffffffffffffffffffffffffffffffffffffff90811690861603610f6e578060136000828254610f6891906130dd565b90915550505b604080518381526020810183905233917f328c1ef8a9337efc0861d5821c216f166f76181249e97db3491bd26f3cfd0ecc910160405180910390a25b505b505b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa15801561101b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061103f9190612fdf565b9050801561111257600154604080517f8d934f7400000000000000000000000000000000000000000000000000000000815290516110fa9273ffffffffffffffffffffffffffffffffffffffff1691638d934f749160048083019260209291908290030181865afa1580156110b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110dc919061308c565b73ffffffffffffffffffffffffffffffffffffffff84169083612ace565b806011600082825461110c91906130dd565b90915550505b600061111d86611725565b90506000611129611b8b565b905060008161114084670de0b6b3a764000061303a565b61114a9190613051565b9050600081116111b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f5265644f54434d61726b65743a20726564416d6f756e742069732030000000006044820152606401610a2c565b80600860008282546111c891906130dd565b90915550506003546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff909116906370a0823190602401602060405180830381865afa15801561123b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061125f9190612fdf565b60085411156112f0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5265644f54434d61726b65743a20696e73756666696369656e7420524544206960448201527f6e20636f6e7472616374000000000000000000000000000000000000000000006064820152608401610a2c565b336000908152600d6020526040902080541561134b57600061131133610698565b905080156113225761132281612b0c565b6001820154825460009161133591613027565b905061134181856130dd565b83555061134f9050565b8181555b60008160010181905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663900cf0cf6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ea9190612fdf565b6002820155600c546003820155600f805483919060009061140c9084906130dd565b92505081905550816015600082825461142591906130dd565b9091555050604080518a81526020810184905233917f9f9afeff03cbd563cfc4d628225ffb115534360fc7974f5eef81e35a9ab9c7ca910160405180910390a26002810154600382015460408051858152602081019390935282015233907fd943f66835b20274709ced0d97b504f69aa631329c7c3bb6c99fcbf09390538e9060600160405180910390a2505050505050506114c16001600055565b5050565b6114cd6129fc565b60006114d833610698565b90506000811161156a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f5265644f54434d61726b65743a206e6f2076657374656420746f6b656e73207460448201527f6f20636c61696d000000000000000000000000000000000000000000000000006064820152608401610a2c565b61157381612b0c565b5061157e6001600055565b565b611588612c3e565b73ffffffffffffffffffffffffffffffffffffffff811661162b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f5265644f54434d61726b65743a2043616e6e6f74207472616e7366657220746f60448201527f207a65726f2061646472657373000000000000000000000000000000000000006064820152608401610a2c565b61164c73ffffffffffffffffffffffffffffffffffffffff84168284612ace565b505050565b611659612c3e565b600081116116e9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f5265644f54434d61726b65743a2076657374696e672065706f636873206d757360448201527f74206265203e20300000000000000000000000000000000000000000000000006064820152608401610a2c565b600c8190556040518181527f0641e07b568600a6e937884b46041ac8f3862a7f6c43673f4bf7f19dc688e6f2906020015b60405180910390a150565b6007546006546040517f6808a12800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9182166004820152602481018490526000929190911690636808a12890604401602060405180830381865afa1580156117a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117c791906130a9565b71ffffffffffffffffffffffffffffffffffff1692915050565b6117e9612c3e565b61271081111561187b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f5265644f54434d61726b65743a20726174652063616e6e6f742065786365656460448201527f20313030250000000000000000000000000000000000000000000000000000006064820152608401610a2c565b73ffffffffffffffffffffffffffffffffffffffff82166000818152600a6020908152604091829020849055815192835282018390527fc2f0686ab008b7ea5f9d3ff6a94da2fae1de9ab031775cfacd50d1cd511e5698910160405180910390a15050565b6118e8612c3e565b61157e6000612ccc565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600d60205260408120600381015460029091015461192c91906130dd565b92915050565b60045460009073ffffffffffffffffffffffffffffffffffffffff83811691161480611978575060055473ffffffffffffffffffffffffffffffffffffffff8381169116145b6119de576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265644f54434d61726b65743a20696e76616c69642070656720746f6b656e006044820152606401610a2c565b6001546040517f82753b1400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8481166004830152909116906382753b1490602401602060405180830381865afa158015611a4e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061192c9190612fdf565b611a7a612c3e565b73ffffffffffffffffffffffffffffffffffffffff8116611b1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f5265644f54434d61726b65743a20696e76616c696420726f757465722061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610a2c565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f7aed1d3e8155a07ccf395e44ea3109a0e2d6c9b29bbbe9f142d9790596f4dc8090600090a250565b600080611b96610807565b9050662386f26fc10000811015611bb15750662386f26fc100005b612710600b54612710611bc49190613027565b611bce908361303a565b611bd89190613051565b91505090565b611be6612c3e565b60008111611c76576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f5265644f54434d61726b65743a20707269636520666c6f6f72206d757374206260448201527f65203e20300000000000000000000000000000000000000000000000000000006064820152608401610a2c565b60098190556040518181527f141cd26f030bb7adcb8ea8b74d2c32bacaff93051a55e5711ecef1694df9b2879060200161171a565b611cb3612c3e565b612710811115611d45576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f5265644f54434d61726b65743a20646973636f756e742063616e6e6f7420657860448201527f63656564203130302500000000000000000000000000000000000000000000006064820152608401610a2c565b600b8190556040518181527fc4f588c2b1b0db1ae244d5b46f69e0c5962875377386d78b2c9cd5b654f906379060200161171a565b611d82612c3e565b73ffffffffffffffffffffffffffffffffffffffff8116611e25576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f5265644f54434d61726b65743a20696e76616c6964207472656173757279206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610a2c565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8316908117909155604080517f2930cf240000000000000000000000000000000000000000000000000000000081529051632930cf24916004808201926020929091908290030181865afa158015611ebc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ee0919061308c565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff928316179055600154604080517ff2f1e1320000000000000000000000000000000000000000000000000000000081529051919092169163f2f1e1329160048083019260209291908290030181865afa158015611f7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa0919061308c565b600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff928316178155600154604080517fed18f0a70000000000000000000000000000000000000000000000000000000081529051919093169263ed18f0a792818101926020929091908290030181865afa15801561203b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061205f919061308c565b600580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff928316179055604051908216907f7dae230f18360d76a040c81f050aa14eb9d6dc7901b20fc5d855e2a20fe814d190600090a250565b6120d8612c3e565b73ffffffffffffffffffffffffffffffffffffffff8116612128576040517f1e4fbdf700000000000000000000000000000000000000000000000000000000815260006004820152602401610a2c565b6109bb81612ccc565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000810460ff16159067ffffffffffffffff1660008115801561217c5750825b905060008267ffffffffffffffff1660011480156121995750303b155b9050811580156121a7575080155b156121de576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b84547fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000166001178555831561223f5784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff16680100000000000000001785555b61224833612d62565b73ffffffffffffffffffffffffffffffffffffffff89166122eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f5265644f54434d61726b65743a20696e76616c6964205553444320616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610a2c565b73ffffffffffffffffffffffffffffffffffffffff881661238e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f5265644f54434d61726b65743a20696e76616c69642055534443206f7261636c60448201527f65000000000000000000000000000000000000000000000000000000000000006064820152608401610a2c565b73ffffffffffffffffffffffffffffffffffffffff871661240b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f5265644f54434d61726b65743a20696e76616c696420747265617375727900006044820152606401610a2c565b73ffffffffffffffffffffffffffffffffffffffff8616612488576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f5265644f54434d61726b65743a20696e76616c696420726f75746572000000006044820152606401610a2c565b6006805473ffffffffffffffffffffffffffffffffffffffff808c167fffffffffffffffffffffffff000000000000000000000000000000000000000092831617909255600780548b8416908316179055600180548a8416908316811790915560028054938a1693909216929092179055604080517f2930cf240000000000000000000000000000000000000000000000000000000081529051632930cf24916004818101926020929091908290030181865afa15801561254d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612571919061308c565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff928316179055600154604080517ff2f1e1320000000000000000000000000000000000000000000000000000000081529051919092169163f2f1e1329160048083019260209291908290030181865afa15801561260d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612631919061308c565b600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff928316178155600154604080517fed18f0a70000000000000000000000000000000000000000000000000000000081529051919093169263ed18f0a792818101926020929091908290030181865afa1580156126cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126f0919061308c565b600580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff928316178155670d2f13f7789f000060095560045482166000908152600a6020526040808220610fa090559154909216825290206103e890556107d0600b556015600c5583156127d05784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff8082166000908152600d60209081526040808320815160808101835281548152600180830154828601526002830154828501526003909201546060820152905482517f900cf0cf00000000000000000000000000000000000000000000000000000000815292519495869586958695869586959094169263900cf0cf926004808401939192918290030181865afa15801561288f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128b39190612fdf565b9250600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c5967c266040518163ffffffff1660e01b8152600401602060405180830381865afa158015612922573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129469190612fdf565b6060820151909250156129f25760408101516020820151825191965061296b91613027565b955080606001518561297d91906130dd565b9350848311156129f25760006129938685613027565b9050816060015181106129a8578697506129f0565b600082606001518284600001516129bf919061303a565b6129c99190613051565b9050826020015181116129dd5760006129ec565b60208301516129ec9082613027565b9850505b505b5091939550919395565b600260005403612a38576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600055565b60405173ffffffffffffffffffffffffffffffffffffffff8481166024830152838116604483015260648201839052612ac89186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612d73565b50505050565b60405173ffffffffffffffffffffffffffffffffffffffff83811660248301526044820183905261164c91859182169063a9059cbb90606401612a81565b336000908152600d6020526040812060018101805491928492612b309084906130dd565b9091555050805460018201541115612bca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5265644f54434d61726b65743a20636c61696d656420616d6f756e742065786360448201527f6565647320746f74616c000000000000000000000000000000000000000000006064820152608401610a2c565b8160086000828254612bdc9190613027565b9091555050600354612c059073ffffffffffffffffffffffffffffffffffffffff163384612ace565b60405182815233907f7fbd837b6a0a5a672080c5dafc183cbcae545e8ee65afd638d5b65bbc7b866559060200160405180910390a25050565b33612c7d7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c1993005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff161461157e576040517f118cdaa7000000000000000000000000000000000000000000000000000000008152336004820152602401610a2c565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080547fffffffffffffffffffffffff0000000000000000000000000000000000000000811673ffffffffffffffffffffffffffffffffffffffff848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b612d6a612e17565b6109bb81612e7e565b600080602060008451602086016000885af180612d96576040513d6000823e3d81fd5b50506000513d91508115612dae578060011415612dc8565b73ffffffffffffffffffffffffffffffffffffffff84163b155b15612ac8576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610a2c565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005468010000000000000000900460ff1661157e576040517fd7e6bcf800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6120d8612e17565b73ffffffffffffffffffffffffffffffffffffffff811681146109bb57600080fd5b600060208284031215612eba57600080fd5b8135612ec581612e86565b9392505050565b600060208284031215612ede57600080fd5b5035919050565b60008060408385031215612ef857600080fd5b823591506020830135612f0a81612e86565b809150509250929050565b600080600060608486031215612f2a57600080fd5b8335612f3581612e86565b9250602084013591506040840135612f4c81612e86565b809150509250925092565b60008060408385031215612f6a57600080fd5b8235612f7581612e86565b946020939093013593505050565b60008060008060808587031215612f9957600080fd5b8435612fa481612e86565b93506020850135612fb481612e86565b92506040850135612fc481612e86565b91506060850135612fd481612e86565b939692955090935050565b600060208284031215612ff157600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561192c5761192c612ff8565b808202811582820484141761192c5761192c612ff8565b600082613087577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60006020828403121561309e57600080fd5b8151612ec581612e86565b6000602082840312156130bb57600080fd5b815171ffffffffffffffffffffffffffffffffffff81168114612ec557600080fd5b8082018082111561192c5761192c612ff8565b60006020828403121561310257600080fd5b81518015158114612ec557600080fdfea26469706673582212202515670d8478c258c7c31174567162726c06f723dd5766b4f670f829d270669b64736f6c634300081c0033

Block Transaction Gas Used Reward
view all blocks produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.