POL Price: $0.692116 (-2.05%)
 

Overview

POL Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 POL

POL 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

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0xB458d319...89E82a392
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
UserProxyNftInteractions

Compiler Version
v0.8.11+commit.d7f03943

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 25 : UserProxyNftInteractions.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "./UserProxyStorageLayout.sol";

/**
 * @title UserProxyNftInteractions
 * @author Penrose
 * @notice Core logic for all user DYST/veNFT interactions
 * @dev All implementations must inherit from UserProxyStorageLayout
 */
contract UserProxyNftInteractions is UserProxyStorageLayout {
    using SafeERC20 for IERC20;

    /*******************************************************
     *                 DYST and veNFT interactions
     *******************************************************/

    // Modifiers
    modifier syncPools() {
        penLens.penPoolFactory().syncPools(1);
        _;
    }
    modifier onlyUserProxyInterfaceOrOwner() {
        require(
            msg.sender == userProxyInterfaceAddress ||
                msg.sender == ownerAddress ||
                msg.sender == address(userProxy),
            "Only user proxy interface or owner is allowed"
        );
        _;
    }

    /**
     * @notice DYST -> veNFT -> penDYST
     * @param amount The amount of DYST to convert to penDYST
     */
    function convertDystToPenDyst(uint256 amount)
        external
        onlyUserProxyInterfaceOrOwner
        syncPools
    {
        // No empty converting
        require(amount > 0, "Amount to convert must be greater than zero");

        // Lock DYST
        uint256 tokenId = _lockDyst(amount);

        // Convert NFT to penDYST
        _convertNftToPenDyst(tokenId);

        // Transfer penDYST to owner
        penLens.penDyst().transfer(ownerAddress, amount);
    }

    /**
     * @notice Convert veNFT to penDYST
     * @param tokenId The tokenID to convert
     */
    function _convertNftToPenDyst(uint256 tokenId) internal {
        // Fetch penDYST balanceOf(owner) before conversions
        uint256 penDystBalanceOfBefore = penLens.penDyst().balanceOf(
            address(this)
        );

        // Determine amount of penDYST to mint
        IVe ve = penLens.ve();
        uint256 amount = ve.locked(tokenId);
        assert(amount > 0);

        // Deposit NFT to penDYST and receive penDYST
        ve.approve(penDystAddress, tokenId);
        penLens.penDyst().convertNftToPenDyst(tokenId);

        // Make sure correct amount of penDYST was received
        uint256 penDystBalanceOfAfter = penLens.penDyst().balanceOf(
            address(this)
        );
        assert(penDystBalanceOfAfter == penDystBalanceOfBefore + amount);
    }

    /**
     * @notice Lock DYST
     * @param amount The amount of DYST to lock
     * @return tokenId The newly minted tokenID
     */
    function _lockDyst(uint256 amount) internal returns (uint256 tokenId) {
        // No empty locking
        require(amount > 0, "Amount to lock must be greater than zero");

        // Receive DYST from msg.sender
        IDyst dyst = penLens.dyst();
        dyst.transferFrom(msg.sender, address(this), amount);

        // Allow ve to spend DYST
        address veAddress = penLens.veAddress();
        dyst.approve(veAddress, amount);

        // Lock DYST (DYST -> veNFT)
        uint256 lockTime = 4 * 365 * 86400; // 4 years
        tokenId = penLens.ve().createLock(amount, lockTime);
    }

    /**
     * @notice DYST -> veNFT -> penDYST -> Staked penDYST
     * @param amount The amount of DYST to convert and stake
     */
    function convertDystToPenDystAndStake(uint256 amount)
        external
        onlyUserProxyInterfaceOrOwner
        syncPools
    {
        // No empty converting
        require(amount > 0, "Amount to convert must be greater than zero");

        // Lock DYST
        uint256 tokenId = _lockDyst(amount);

        // Convert NFT to penDYST
        _convertNftToPenDyst(tokenId);

        // Stake penDYST
        _stakePenDyst(amount);
    }

    /**
     * @notice veNFT -> penDYST
     * @param tokenId The tokenId to convert
     */
    function convertNftToPenDyst(uint256 tokenId)
        public
        onlyUserProxyInterfaceOrOwner
        syncPools
    {
        // Amount of underlying DYST locked
        IVe ve = penLens.ve();
        uint256 amount = ve.locked(tokenId);

        // Transfer NFT to this contract
        ve.safeTransferFrom(msg.sender, address(this), tokenId);

        // Perform actual conversion
        _convertNftToPenDyst(tokenId);

        // Send penDYST to user
        penLens.penDyst().transfer(ownerAddress, amount);
    }

    /**
     * @notice veNFT -> penDYST -> Staked penDYST
     * @param tokenId The tokenId to convert and stake
     */
    function convertNftToPenDystAndStake(uint256 tokenId)
        public
        onlyUserProxyInterfaceOrOwner
        syncPools
    {
        // Amount of underlying DYST locked
        IVe ve = penLens.ve();
        uint256 amount = ve.locked(tokenId);

        // Transfer NFT to this contract
        ve.safeTransferFrom(msg.sender, address(this), tokenId);

        // Perform actual conversion
        _convertNftToPenDyst(tokenId);

        // Stake penDYST
        _stakePenDyst(amount);
    }

    /**
     * @notice Stake penDYST in rewards pool
     */
    function _stakePenDyst(uint256 amount) internal {
        address stakingAddress;

        // Determine partner status
        bool isPartner = penLens.isPartner(address(this));

        // Set staking address
        if (isPartner) {
            stakingAddress = penLens.partnersRewardsPoolAddress();
        } else {
            stakingAddress = penDystRewardsPoolAddress;
        }

        // Allow penDYST mutlirewards to spend penDYST
        penLens.penDyst().approve(stakingAddress, amount);

        // Stake penDYST in multirewards
        IMultiRewards(stakingAddress).stake(amount);
    }

    /**
     * @notice penDYST -> staked penDYST
     */
    function stakePenDyst(uint256 amount)
        public
        onlyUserProxyInterfaceOrOwner
        syncPools
    {
        // Transfer penDYST from msg.sender to UserProxy
        penLens.penDyst().transferFrom(msg.sender, address(this), amount);

        // Stake penDYST on behalf of user
        _stakePenDyst(amount);
    }

    /**
     * penDYST -> staked penDYST (PEN v1 staking contract)
     */
    function stakePenDystInPenV1(uint256 amount)
        public
        onlyUserProxyInterfaceOrOwner
        syncPools
    {
        // Transfer penDYST from msg.sender to UserProxy
        penLens.penDyst().transferFrom(msg.sender, address(this), amount);

        // Stake penDYST on behalf of user
        _stakePenDystInPenV1(amount);
    }

    /**
     * @notice Perform penDYST stake into v1 staking pool
     */
    function _stakePenDystInPenV1(uint256 amount) internal {
        address stakingAddress = penLens.penV1RewardsAddress();

        // Allow penDYST mutlirewards to spend penDYST
        penLens.penDyst().approve(stakingAddress, amount);

        // Stake penDYST in multirewards
        IMultiRewards(stakingAddress).stake(amount);
    }

    /**
     * @notice Staked penDYST -> penDYST
     * @param amount The amount of penDYST to unstake
     */
    function unstakePenDyst(uint256 amount)
        public
        onlyUserProxyInterfaceOrOwner
    {
        address stakingAddress;

        // Determine partner status
        bool isPartner = penLens.isPartner(address(this));

        // Set staking address
        if (isPartner) {
            stakingAddress = penLens.partnersRewardsPoolAddress();
        } else {
            stakingAddress = penDystRewardsPoolAddress;
        }
        unstakePenDyst(stakingAddress, amount);
    }

    /**
     * @notice Staked penDYST (PEN v1 rewards) -> penDYST
     * @param amount The amount to unstake
     */
    function unstakePenDystInPenV1(uint256 amount)
        public
        onlyUserProxyInterfaceOrOwner
    {
        unstakePenDyst(penLens.penV1RewardsAddress(), amount);
    }

    /**
     * @notice Staked penDYST -> penDYST
     * @param stakingAddress Address to unstake from
     * @param amount The amount to unstake
     */
    function unstakePenDyst(address stakingAddress, uint256 amount)
        public
        onlyUserProxyInterfaceOrOwner
        syncPools
    {
        // No empty unstaking
        require(amount > 0, "Amount to unstake must be greater than zero");

        // Unstake penDYST
        IMultiRewards(stakingAddress).withdraw(amount);

        // Transfer penDYST to owner
        penLens.penDyst().transfer(ownerAddress, amount);
    }

    /**
     * @notice Redeem PEN v1 for penDYST
     */
    function redeemPenV1(uint256 amount)
        external
        onlyUserProxyInterfaceOrOwner
    {
        IERC20 penV1 = IERC20(penLens.penV1Address());
        penV1.transferFrom(msg.sender, address(this), amount);

        address penV1RedeemAddress = penLens.penV1RedeemAddress();
        IPenV1Redeem penV1Redeem = IPenV1Redeem(penV1RedeemAddress);

        penV1.approve(penV1RedeemAddress, amount);
        penV1Redeem.redeem(amount);

        IMultiRewards penV1Rewards = IMultiRewards(
            penLens.penV1RewardsAddress()
        );
        IPenDyst penDyst = penLens.penDyst();
        penDyst.transfer(ownerAddress, penDyst.balanceOf(address(this)));

        uint256 rewardTokensLength = penV1Rewards.rewardTokensLength();
        for (uint256 i; i < rewardTokensLength; i++) {
            IERC20 rewardToken = IERC20(penV1Rewards.rewardTokens(i));
            uint256 balance = rewardToken.balanceOf(address(this));
            if (balance > 0) {
                rewardToken.safeTransfer(ownerAddress, balance);
            }
        }
    }

    /**
     * @notice Redeem PEN v1 for penDYST and stake into penV1Rewards
     */
    function redeemAndStakePenV1(uint256 amount)
        external
        onlyUserProxyInterfaceOrOwner
    {
        //establish vars
        IERC20 penV1 = IERC20(penLens.penV1Address());
        IPenDyst penDyst = penLens.penDyst();
        address penV1RewardsAddress = penLens.penV1RewardsAddress();
        IPenV1Rewards penV1Rewards = IPenV1Rewards(penV1RewardsAddress);
        address penV1RedeemAddress = penLens.penV1RedeemAddress();
        IPenV1Redeem penV1Redeem = IPenV1Redeem(penV1RedeemAddress);

        //transfer PENv1 to userProxy
        penV1.transferFrom(msg.sender, address(this), amount);

        //approve and redeem PENv1 from penV1Redeem
        penV1.approve(penV1RedeemAddress, amount);
        penV1Redeem.redeem(amount);

        //check redeemed penDYST balance against stakingCap, transfer excess to owner
        uint256 penDystBalance = penDyst.balanceOf(address(this));
        uint256 stakingCap = penV1Rewards.stakingCap(address(this));
        uint256 stakedBalance = penV1Rewards.balanceOf(address(this));

        // If capMultiplier is lowered, stakingCap can be lower than stakedBalance
        // Users can withdraw under such conditions, but can't stake more
        if (stakingCap > stakedBalance) {
            if (stakingCap - stakedBalance < penDystBalance) {
                uint256 penDystToTransfer = penDystBalance - stakingCap;
                penDyst.transfer(ownerAddress, penDystToTransfer);
                penDystBalance = stakingCap;
            }
        } else {
            // if stakingCap < stakedBalance, transfer all penDYST to owner
            penDyst.transfer(ownerAddress, penDystBalance);
            penDystBalance = 0;
        }

        //approve and stake penDYST in penV1Rewards
        if (penDystBalance > 0) {
            penDyst.approve(penV1RewardsAddress, penDystBalance);
            penV1Rewards.stake(penDystBalance);
        }

        //transfer misc bribes gotten from redeem to owner
        uint256 rewardTokensLength = penV1Rewards.rewardTokensLength();
        for (uint256 i; i < rewardTokensLength; i++) {
            IERC20 rewardToken = IERC20(penV1Rewards.rewardTokens(i));
            uint256 balance = rewardToken.balanceOf(address(this));
            if (balance > 0) {
                rewardToken.safeTransfer(ownerAddress, balance);
            }
        }
    }

    /**
     * @notice Migrates nonparters who recently got whitelisted as partners
     */
    function migratePenDystToPartner() external onlyUserProxyInterfaceOrOwner {
        IMultiRewards penDystRewardsPool = IMultiRewards(
            penLens.penDystRewardsPoolAddress()
        );
        IMultiRewards partnersRewardsPool = IMultiRewards(
            penLens.partnersRewardsPoolAddress()
        );

        uint256 nonPartnerStakedBalance = penDystRewardsPool.balanceOf(
            address(this)
        );
        penDystRewardsPool.exit();
        penLens.penDyst().approve(
            address(partnersRewardsPool),
            nonPartnerStakedBalance
        );
        partnersRewardsPool.stake(nonPartnerStakedBalance);
    }

    /**
     * @notice Vote lock PEN for 16 weeks (non-transferrable)
     * @param amount Amount of PEN to lock
     * @param spendRatio Spend ratio for PenLocker
     * @dev PenLocker utilizes the same code as CvxLocker
     */
    function voteLockPen(uint256 amount, uint256 spendRatio)
        external
        onlyUserProxyInterfaceOrOwner
    {
        // Receive PEN
        penLens.pen().transferFrom(msg.sender, address(this), amount);

        // Allow vlPEN to spend PEN
        penLens.pen().approve(vlPenAddress, amount);

        // Lock PEN
        penLens.vlPen().lock(address(this), amount, spendRatio);
        assert(penLens.vlPen().lockedBalanceOf(address(this)) > 0);
    }

    /**
     * @notice Withdraw vote locked PEN
     * @param spendRatio Spend ratio
     */
    function withdrawVoteLockedPen(uint256 spendRatio, bool claim)
        external
        onlyUserProxyInterfaceOrOwner
    {
        uint256 currentBalance = penLens.vlPen().lockedBalanceOf(address(this));
        require(currentBalance > 0, "Nothing to withdraw");

        if (claim) {
            // Claim staking rewards and transfer them to proxy owner
            userProxy.claimVlPenRewards();
        }

        // Withdraw PEN and transfer to owner
        penLens.vlPen().processExpiredLocks(false, spendRatio, ownerAddress);
    }

    /**
     * @notice Relock vote locked PEN
     * @param spendRatio Spend ratio
     */
    function relockVoteLockedPen(uint256 spendRatio)
        external
        onlyUserProxyInterfaceOrOwner
    {
        penLens.vlPen().processExpiredLocks(true, spendRatio, address(this));
    }

    /**************************************************
     *                  Helper Utilities
     **************************************************/
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4) {
        return IERC721Receiver.onERC721Received.selector;
    }

    /**
     * @notice Claim staking rewards given a staking pool address
     * @dev The generalized function doesn't work because vlPEN is a bit different from other multirewards
     */
    function claimVlPenRewards() public onlyUserProxyInterfaceOrOwner {
        address stakingPoolAddress = penLens.vlPenAddress();
        IVlPen multiRewards = IVlPen(stakingPoolAddress);
        multiRewards.getReward();
        uint256 rewardTokensLength = multiRewards.rewardTokensLength();

        for (
            uint256 rewardTokenIndex;
            rewardTokenIndex < rewardTokensLength;
            rewardTokenIndex++
        ) {
            address rewardTokenAddress = multiRewards.rewardTokens(
                rewardTokenIndex
            );
            IERC20(rewardTokenAddress).safeTransfer(
                ownerAddress,
                IERC20(rewardTokenAddress).balanceOf(address(this))
            );
        }
    }
}

File 2 of 25 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 3 of 25 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 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 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @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).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 4 of 25 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 5 of 25 : UserProxyStorageLayout.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import "./interfaces/IPenLens.sol";
import "./interfaces/IMultiRewards.sol";
import "./interfaces/IPenPool.sol";
import "./interfaces/IPenV1Redeem.sol";

/**
 * @title UserProxyStorageLayout
 * @author Penrose
 * @notice The primary storage slot layout for UserProxy implementations
 * @dev All implementations must inherit from this contract
 */
contract UserProxyStorageLayout {
    // Versioning
    uint256 public constant verison = 1;

    // Internal interface helpers
    IPenLens internal penLens;
    IUserProxy internal userProxy;

    // User positions
    mapping(address => bool) public hasStake;
    mapping(uint256 => address) public stakingAddressByIndex;
    mapping(address => uint256) public indexByStakingAddress;
    uint256 public stakingPoolsLength;

    // Public addresses
    address public ownerAddress;
    address public penLensAddress;
    address public penDystAddress;
    address public penDystRewardsPoolAddress;
    address public userProxyInterfaceAddress;
    address public vlPenAddress;

    // Implementations
    address public userProxyLpInteractionsAddress;
    address public userProxyNftInteractionsAddress;
    address public userProxyVotingInteractionsAddress;
}

File 6 of 25 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 7 of 25 : IPenLens.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import "./IPen.sol";
import "./IVlPen.sol";
import "./IPenPoolFactory.sol";
import "./IPenDyst.sol";
import "./IDyst.sol";
import "./IDystopiaLens.sol";
import "./IUserProxy.sol";
import "./IVe.sol";
import "./IVotingSnapshot.sol";
import "./IVoterProxy.sol";
import "./IPenV1Rewards.sol";
import "./ITokensAllowlist.sol";

interface IPenLens {
    struct ProtocolAddresses {
        address penPoolFactoryAddress;
        address DystopiaLensAddress;
        address PenAddress;
        address vlPenAddress;
        address penDystAddress;
        address voterProxyAddress;
        address dystAddress;
        address voterAddress;
        address poolsFactoryAddress;
        address gaugesFactoryAddress;
        address minterAddress;
        address veAddress;
        address userProxyInterfaceAddress;
        address votingSnapshotAddress;
    }

    struct UserPosition {
        address userProxyAddress;
        uint256 veTotalBalanceOf;
        IDystopiaLens.PositionVe[] vePositions;
        IDystopiaLens.PositionPool[] poolsPositions;
        IUserProxy.PositionStakingPool[] stakingPools;
        uint256 penDystBalanceOf;
        uint256 penBalanceOf;
        uint256 dystBalanceOf;
        uint256 vlPenBalanceOf;
    }

    struct TokenMetadata {
        address id;
        string name;
        string symbol;
        uint8 decimals;
        uint256 priceUsdc;
    }

    struct PenPoolData {
        address id;
        address stakingAddress;
        uint256 stakedTotalSupply;
        uint256 totalSupply;
        IDystopiaLens.Pool poolData;
    }

    struct Pool {
        address id;
        string symbol;
        bool stable;
        address token0Address;
        address token1Address;
        address gaugeAddress;
        address bribeAddress;
        address[] bribeTokensAddresses;
        address fees;
    }

    struct RewardTokenData {
        address id;
        uint256 rewardRate;
        uint256 periodFinish;
    }

    /* ========== PUBLIC VARS ========== */

    function penPoolFactoryAddress() external view returns (address);

    function rewardsDistributorAddress() external view returns (address);

    function userProxyFactoryAddress() external view returns (address);

    function dystopiaLensAddress() external view returns (address);

    function penAddress() external view returns (address);

    function vlPenAddress() external view returns (address);

    function penDystAddress() external view returns (address);

    function voterProxyAddress() external view returns (address);

    function veAddress() external view returns (address);

    function dystAddress() external view returns (address);

    function penDystRewardsPoolAddress() external view returns (address);

    function partnersRewardsPoolAddress() external view returns (address);

    function treasuryAddress() external view returns (address);

    function cvlPenAddress() external view returns (address);

    function penV1RewardsAddress() external view returns (address);

    function penV1RedeemAddress() external view returns (address);

    function penV1Address() external view returns (address);

    function tokensAllowlistAddress() external view returns (address);

    /* ========== PUBLIC VIEW FUNCTIONS ========== */

    function voterAddress() external view returns (address);

    function poolsFactoryAddress() external view returns (address);

    function gaugesFactoryAddress() external view returns (address);

    function minterAddress() external view returns (address);

    function protocolAddresses()
        external
        view
        returns (ProtocolAddresses memory);

    function positionsOf(address accountAddress)
        external
        view
        returns (UserPosition memory);

    function rewardTokensPositionsOf(address, address)
        external
        view
        returns (IUserProxy.RewardToken[] memory);

    function veTotalBalanceOf(IDystopiaLens.PositionVe[] memory positions)
        external
        pure
        returns (uint256);

    function penPoolsLength() external view returns (uint256);

    function userProxiesLength() external view returns (uint256);

    function userProxyByAccount(address accountAddress)
        external
        view
        returns (address);

    function userProxyByIndex(uint256 index) external view returns (address);

    function gaugeByDystPool(address) external view returns (address);

    function dystPoolByPenPool(address penPoolAddress)
        external
        view
        returns (address);

    function penPoolByDystPool(address dystPoolAddress)
        external
        view
        returns (address);

    function stakingRewardsByDystPool(address dystPoolAddress)
        external
        view
        returns (address);

    function stakingRewardsByPenPool(address dystPoolAddress)
        external
        view
        returns (address);

    function isPenPool(address penPoolAddress) external view returns (bool);

    function penPoolsAddresses() external view returns (address[] memory);

    function penPoolData(address penPoolAddress)
        external
        view
        returns (PenPoolData memory);

    function penPoolsData(address[] memory _penPoolsAddresses)
        external
        view
        returns (PenPoolData[] memory);

    function penPoolsData() external view returns (PenPoolData[] memory);

    function penDyst() external view returns (IPenDyst);

    function pen() external view returns (IPen);

    function vlPen() external view returns (IVlPen);

    function penPoolFactory() external view returns (IPenPoolFactory);

    function dyst() external view returns (IDyst);

    function ve() external view returns (IVe);

    function voterProxy() external view returns (IVoterProxy);

    function votingSnapshot() external view returns (IVotingSnapshot);

    function tokensAllowlist() external view returns (ITokensAllowlist);

    function isPartner(address userProxyAddress) external view returns (bool);

    function stakedPenDystBalanceOf(address accountAddress)
        external
        view
        returns (uint256 stakedBalance);

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

File 8 of 25 : IMultiRewards.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;

interface IMultiRewards {
    struct Reward {
        address rewardsDistributor;
        uint256 rewardsDuration;
        uint256 periodFinish;
        uint256 rewardRate;
        uint256 lastUpdateTime;
        uint256 rewardPerTokenStored;
    }

    function stake(uint256) external;

    function withdraw(uint256) external;

    function getReward() external;

    function stakingToken() external view returns (address);

    function balanceOf(address) external view returns (uint256);

    function earned(address, address) external view returns (uint256);

    function initialize(address, address) external;

    function rewardRate(address) external view returns (uint256);

    function getRewardForDuration(address) external view returns (uint256);

    function rewardPerToken(address) external view returns (uint256);

    function rewardData(address) external view returns (Reward memory);

    function rewardTokensLength() external view returns (uint256);

    function rewardTokens(uint256) external view returns (address);

    function totalSupply() external view returns (uint256);

    function addReward(
        address _rewardsToken,
        address _rewardsDistributor,
        uint256 _rewardsDuration
    ) external;

    function notifyRewardAmount(address, uint256) external;

    function recoverERC20(address tokenAddress, uint256 tokenAmount) external;

    function setRewardsDuration(address _rewardsToken, uint256 _rewardsDuration)
        external;

    function exit() external;

    function nominateNewOwner(address _owner) external;

    function acceptOwnership() external;
}

File 9 of 25 : IPenPool.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import "./IDystopiaLens.sol";

interface IPenPool {
    function stakingAddress() external view returns (address);

    function dystPoolAddress() external view returns (address);

    function dystPoolInfo() external view returns (IDystopiaLens.Pool memory);

    function depositLpAndStake(uint256) external;

    function depositLp(uint256) external;

    function withdrawLp(uint256) external;

    function syncBribeTokens() external;

    function notifyBribeOrFees() external;

    function initialize(
        address,
        address,
        address,
        string memory,
        string memory,
        address,
        address
    ) external;

    function gaugeAddress() external view returns (address);

    function balanceOf(address) external view returns (uint256);

    function transfer(address recipient, uint256 amount)
        external
        returns (bool);

    function approve(address spender, uint256 amount) external returns (bool);

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

File 10 of 25 : IPenV1Redeem.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

interface IPenV1Redeem {
    function penV1Burnt(address account) external view returns (uint256);

    function redeem(uint256 amount) external;

    function oxdV1() external view returns (IERC20);
}

File 11 of 25 : IPen.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface IPen is IERC20 {
    function mint(address to, uint256 amount) external;
}

File 12 of 25 : IVlPen.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;

interface IVlPen {
    struct LocksData {
        uint256 total;
        uint256 unlockable;
        uint256 locked;
        LockedBalance[] locks;
    }

    struct LockedBalance {
        uint112 amount;
        uint112 boosted;
        uint32 unlockTime;
    }

    struct EarnedData {
        address token;
        uint256 amount;
    }

    struct Reward {
        bool useBoost;
        uint40 periodFinish;
        uint208 rewardRate;
        uint40 lastUpdateTime;
        uint208 rewardPerTokenStored;
        address rewardsDistributor;
    }

    function lock(
        address _account,
        uint256 _amount,
        uint256 _spendRatio
    ) external;

    function processExpiredLocks(
        bool _relock,
        uint256 _spendRatio,
        address _withdrawTo
    ) external;

    function lockedBalanceOf(address) external view returns (uint256 amount);

    function lockedBalances(address)
        external
        view
        returns (
            uint256,
            uint256,
            uint256,
            LockedBalance[] memory
        );

    function claimableRewards(address _account)
        external
        view
        returns (EarnedData[] memory userRewards);

    function rewardTokensLength() external view returns (uint256);

    function rewardTokens(uint256) external view returns (address);

    function rewardData(address) external view returns (Reward memory);

    function rewardPerToken(address) external view returns (uint256);

    function getRewardForDuration(address) external view returns (uint256);

    function getReward() external;

    function checkpointEpoch() external;

    function updateRewards() external;
}

File 13 of 25 : IPenPoolFactory.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;

interface IPenPoolFactory {
    function penPoolsLength() external view returns (uint256);

    function isPenPool(address) external view returns (bool);

    function isPenPoolOrLegacyPenPool(address) external view returns (bool);

    function PEN() external view returns (address);

    function syncPools(uint256) external;

    function penPools(uint256) external view returns (address);

    function penPoolByDystPool(address) external view returns (address);

    function vlPenAddress() external view returns (address);

    function dystPoolByPenPool(address) external view returns (address);

    function syncedPoolsLength() external returns (uint256);

    function dystopiaLensAddress() external view returns (address);

    function voterProxyAddress() external view returns (address);

    function rewardsDistributorAddress() external view returns (address);

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

File 14 of 25 : IPenDyst.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface IPenDyst is IERC20 {
    function mint(address, uint256) external;

    function convertNftToPenDyst(uint256) external;
}

File 15 of 25 : IDyst.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;

interface IDyst {
    function transferFrom(
        address,
        address,
        uint256
    ) external;

    function allowance(address, address) external view returns (uint256);

    function approve(address, uint256) external;

    function balanceOf(address) external view returns (uint256);

    function router() external view returns (address);

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

File 16 of 25 : IDystopiaLens.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;

interface IDystopiaLens {
    struct Pool {
        address id;
        string symbol;
        bool stable;
        address token0Address;
        address token1Address;
        address gaugeAddress;
        address bribeAddress;
        address[] bribeTokensAddresses;
        address fees;
        uint256 totalSupply;
    }

    struct PoolReserveData {
        address id;
        address token0Address;
        address token1Address;
        uint256 token0Reserve;
        uint256 token1Reserve;
        uint8 token0Decimals;
        uint8 token1Decimals;
    }

    struct PositionVe {
        uint256 tokenId;
        uint256 balanceOf;
        uint256 locked;
    }

    struct PositionBribesByTokenId {
        uint256 tokenId;
        PositionBribe[] bribes;
    }

    struct PositionBribe {
        address bribeTokenAddress;
        uint256 earned;
    }

    struct PositionPool {
        address id;
        uint256 balanceOf;
    }

    function poolsLength() external view returns (uint256);

    function voterAddress() external view returns (address);

    function veAddress() external view returns (address);

    function poolsFactoryAddress() external view returns (address);

    function gaugesFactoryAddress() external view returns (address);

    function minterAddress() external view returns (address);

    function dystAddress() external view returns (address);

    function vePositionsOf(address) external view returns (PositionVe[] memory);

    function bribeAddresByPoolAddress(address) external view returns (address);

    function gaugeAddressByPoolAddress(address) external view returns (address);

    function poolsPositionsOf(address)
        external
        view
        returns (PositionPool[] memory);

    function poolsPositionsOf(
        address,
        uint256,
        uint256
    ) external view returns (PositionPool[] memory);

    function poolInfo(address) external view returns (Pool memory);
}

File 17 of 25 : IUserProxy.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;

interface IUserProxy {
    struct PositionStakingPool {
        address stakingPoolAddress;
        address penPoolAddress;
        address dystPoolAddress;
        uint256 balanceOf;
        RewardToken[] rewardTokens;
    }

    function initialize(
        address,
        address,
        address,
        address[] memory
    ) external;

    struct RewardToken {
        address rewardTokenAddress;
        uint256 rewardRate;
        uint256 rewardPerToken;
        uint256 getRewardForDuration;
        uint256 earned;
    }

    struct Vote {
        address poolAddress;
        int256 weight;
    }

    function convertNftToPenDyst(uint256) external;

    function convertDystToPenDyst(uint256) external;

    function depositLpAndStake(address, uint256) external;

    function depositLp(address, uint256) external;

    function stakingAddresses() external view returns (address[] memory);

    function initialize(address, address) external;

    function stakingPoolsLength() external view returns (uint256);

    function unstakeLpAndWithdraw(
        address,
        uint256,
        bool
    ) external;

    function unstakeLpAndWithdraw(address, uint256) external;

    function unstakeLpWithdrawAndClaim(address) external;

    function unstakeLpWithdrawAndClaim(address, uint256) external;

    function withdrawLp(address, uint256) external;

    function stakePenLp(address, uint256) external;

    function unstakePenLp(address, uint256) external;

    function ownerAddress() external view returns (address);

    function stakingPoolsPositions()
        external
        view
        returns (PositionStakingPool[] memory);

    function stakePenDyst(uint256) external;

    function unstakePenDyst(uint256) external;

    function unstakePenDyst(address, uint256) external;

    function convertDystToPenDystAndStake(uint256) external;

    function convertNftToPenDystAndStake(uint256) external;

    function claimPenDystStakingRewards() external;

    function claimPartnerStakingRewards() external;

    function claimStakingRewards(address) external;

    function claimStakingRewards(address[] memory) external;

    function claimStakingRewards() external;

    function claimVlPenRewards() external;

    function depositPen(uint256, uint256) external;

    function withdrawPen(bool, uint256) external;

    function voteLockPen(uint256, uint256) external;

    function withdrawVoteLockedPen(uint256, bool) external;

    function relockVoteLockedPen(uint256) external;

    function removeVote(address) external;

    function registerStake(address) external;

    function registerUnstake(address) external;

    function resetVotes() external;

    function setVoteDelegate(address) external;

    function clearVoteDelegate() external;

    function vote(address, int256) external;

    function vote(Vote[] memory) external;

    function votesByAccount(address) external view returns (Vote[] memory);

    function migratePenDystToPartner() external;

    function stakePenDystInPenV1(uint256) external;

    function unstakePenDystInPenV1(uint256) external;

    function redeemPenV1(uint256) external;

    function redeemAndStakePenV1(uint256) external;

    function whitelist(address) external;

    function implementationsAddresses()
        external
        view
        returns (address[] memory);
}

File 18 of 25 : IVe.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;

interface IVe {
    function safeTransferFrom(
        address,
        address,
        uint256
    ) external;

    function ownerOf(uint256) external view returns (address);

    function balanceOf(address) external view returns (uint256);

    function balanceOfNFT(uint256) external view returns (uint256);

    function balanceOfNFTAt(uint256, uint256) external view returns (uint256);

    function balanceOfAtNFT(uint256, uint256) external view returns (uint256);

    function locked(uint256) external view returns (uint256);

    function createLock(uint256, uint256) external returns (uint256);

    function approve(address, uint256) external;

    function merge(uint256, uint256) external;

    function token() external view returns (address);

    function controller() external view returns (address);

    function voted(uint256) external view returns (bool);

    function tokenOfOwnerByIndex(address, uint256)
        external
        view
        returns (uint256);
}

File 19 of 25 : IVotingSnapshot.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11||0.6.12;
pragma experimental ABIEncoderV2;

interface IVotingSnapshot {
    struct Vote {
        address poolAddress;
        int256 weight;
    }

    function vote(address, int256) external;

    function vote(Vote[] memory) external;

    function removeVote(address) external;

    function resetVotes() external;

    function resetVotes(address) external;

    function setVoteDelegate(address) external;

    function clearVoteDelegate() external;

    function voteDelegateByAccount(address) external view returns (address);

    function votesByAccount(address) external view returns (Vote[] memory);

    function voteWeightTotalByAccount(address) external view returns (uint256);

    function voteWeightUsedByAccount(address) external view returns (uint256);

    function voteWeightAvailableByAccount(address)
        external
        view
        returns (uint256);
}

File 20 of 25 : IVoterProxy.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;

interface IVoterProxy {
    function depositInGauge(address, uint256) external;

    function withdrawFromGauge(address, uint256) external;

    function getRewardFromGauge(address _penPool, address[] memory _tokens)
        external;

    function depositNft(uint256) external;

    function veAddress() external returns (address);

    function veDistAddress() external returns (address);

    function lockDyst(uint256 amount) external;

    function primaryTokenId() external view returns (uint256);

    function vote(address[] memory, int256[] memory) external;

    function votingSnapshotAddress() external view returns (address);

    function dystInflationSinceInception() external view returns (uint256);

    function getRewardFromBribe(
        address penPoolAddress,
        address[] memory _tokensAddresses
    ) external returns (bool allClaimed, bool[] memory claimed);

    function getFeeTokensFromBribe(address penPoolAddress)
        external
        returns (bool allClaimed);

    function claimDyst(address penPoolAddress)
        external
        returns (bool _claimDyst);

    function setVoterProxyAssetsAddress(address _voterProxyAssetsAddress)
        external;

    function detachNFT(uint256 startingIndex, uint256 range) external;

    function claim() external;

    function whitelist(address tokenAddress) external;

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

File 21 of 25 : IPenV1Rewards.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "./IMultiRewards.sol";

interface IPenV1Rewards is IMultiRewards {
    function stakingCap(address account) external view returns (uint256 cap);
}

File 22 of 25 : ITokensAllowlist.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;

interface ITokensAllowlist {
    function tokenIsAllowed(address) external view returns (bool);

    function bribeTokensSyncPageSize() external view returns (uint256);

    function bribeTokensNotifyPageSize() external view returns (uint256);

    function bribeSyncLagLimit() external view returns (uint256);

    function notifyFrequency()
        external
        view
        returns (uint256 bribeFrequency, uint256 feeFrequency);

    function feeClaimingDisabled(address) external view returns (bool);

    function periodBetweenClaimDyst() external view returns (uint256);

    function periodBetweenClaimFee() external view returns (uint256);

    function periodBetweenClaimBribe() external view returns (uint256);

    function tokenIsAllowedInPools(address) external view returns (bool);

    function setTokenIsAllowedInPools(
        address[] memory tokensAddresses,
        bool allowed
    ) external;

    function oogLoopLimit() external view returns (uint256);

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

File 23 of 25 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, spender) + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `sender` to `recipient`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
        }
        _balances[to] += amount;

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
}

File 24 of 25 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 25 of 25 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

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

Contract Security Audit

Contract ABI

[{"inputs":[],"name":"claimVlPenRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"convertDystToPenDyst","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"convertDystToPenDystAndStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"convertNftToPenDyst","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"convertNftToPenDystAndStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"hasStake","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"indexByStakingAddress","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"migratePenDystToPartner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"ownerAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"penDystAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"penDystRewardsPoolAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"penLensAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"redeemAndStakePenV1","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"redeemPenV1","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"spendRatio","type":"uint256"}],"name":"relockVoteLockedPen","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stakePenDyst","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stakePenDystInPenV1","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"stakingAddressByIndex","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingPoolsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"unstakePenDyst","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"stakingAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"unstakePenDyst","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"unstakePenDystInPenV1","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"userProxyInterfaceAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"userProxyLpInteractionsAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"userProxyNftInteractionsAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"userProxyVotingInteractionsAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"verison","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vlPenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"spendRatio","type":"uint256"}],"name":"voteLockPen","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"spendRatio","type":"uint256"},{"internalType":"bool","name":"claim","type":"bool"}],"name":"withdrawVoteLockedPen","outputs":[],"stateMutability":"nonpayable","type":"function"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101e45760003560e01c80634dd4c81e1161010f578063a1a75731116100a2578063c3d9c86e11610071578063c3d9c86e14610434578063d0d11cd914610447578063e48013891461045a578063e73e14bf1461046d57600080fd5b8063a1a75731146103e8578063a22983fd146103fb578063b46dadcd1461040e578063bd7a109b1461042157600080fd5b806365d25bb3116100de57806365d25bb31461038f5780638f84aa09146103af57806390621360146103c2578063973a664a146103d557600080fd5b80634dd4c81e146103435780635611b8e8146103565780635cb88521146103695780635cc4429a1461037c57600080fd5b80631dead9c6116101875780633a045cda116101565780633a045cda1461030257806345a46654146103155780634773db21146103285780634d6f689c1461033b57600080fd5b80631dead9c6146102c85780631ff76ee7146102df57806320708c20146102e757806338b9f2a8146102fa57600080fd5b80630ee29f6a116101c35780630ee29f6a14610241578063128db9bf14610254578063150b7a0214610267578063176425ea1461029f57600080fd5b80622766b0146101e957806308a24fc3146101fe5780630c3c9bec14610211575b600080fd5b6101fc6101f73660046140ac565b6104a0565b005b6101fc61020c3660046140d3565b61060c565b600b54610224906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b600c54610224906001600160a01b031681565b6101fc610262366004614118565b6108e0565b610286610275366004614144565b630a85bd0160e11b95945050505050565b6040516001600160e01b03199091168152602001610238565b6102246102ad3660046140ac565b6003602052600090815260409020546001600160a01b031681565b6102d160055481565b604051908152602001610238565b6101fc610bae565b600e54610224906001600160a01b031681565b6102d1600181565b6101fc6103103660046140ac565b610eca565b600854610224906001600160a01b031681565b6101fc6103363660046140ac565b611235565b6101fc6114b8565b600a54610224906001600160a01b031681565b6101fc6103643660046140ac565b611755565b6101fc6103773660046140ac565b61196e565b6101fc61038a3660046141e3565b611f55565b6102d161039d366004614205565b60046020526000908152604090205481565b600654610224906001600160a01b031681565b6101fc6103d03660046140ac565b61234e565b600954610224906001600160a01b031681565b600d54610224906001600160a01b031681565b6101fc6104093660046140ac565b612b98565b6101fc61041c3660046140ac565b612cfc565b6101fc61042f3660046140ac565b612e31565b6101fc6104423660046140ac565b613034565b6101fc6104553660046140ac565b61324a565b600754610224906001600160a01b031681565b61049061047b366004614205565b60026020526000908152604090205460ff1681565b6040519015158152602001610238565b600a546001600160a01b03163314806104c357506006546001600160a01b031633145b806104d857506001546001600160a01b031633145b6104fd5760405162461bcd60e51b81526004016104f490614222565b60405180910390fd5b60008054604051632303e6ab60e21b815230600482015282916001600160a01b031690638c0f9aac90602401602060405180830381865afa158015610546573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061056a919061426f565b905080156105ee5760008054906101000a90046001600160a01b03166001600160a01b0316631c0b05d76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105e7919061428c565b91506105fd565b6009546001600160a01b031691505b61060782846108e0565b505050565b600a546001600160a01b031633148061062f57506006546001600160a01b031633145b8061064457506001546001600160a01b031633145b6106605760405162461bcd60e51b81526004016104f490614222565b60008060009054906101000a90046001600160a01b03166001600160a01b0316630eecceca6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d8919061428c565b604051632c9aab9b60e11b81523060048201526001600160a01b039190911690635935573690602401602060405180830381865afa15801561071e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074291906142a9565b90506000811161078a5760405162461bcd60e51b81526020600482015260136024820152724e6f7468696e6720746f20776974686472617760681b60448201526064016104f4565b81156107f957600160009054906101000a90046001600160a01b03166001600160a01b0316634d6f689c6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156107e057600080fd5b505af11580156107f4573d6000803e3d6000fd5b505050505b60008054906101000a90046001600160a01b03166001600160a01b0316630eecceca6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561084a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086e919061428c565b6006546040516370e664cd60e01b815260006004820152602481018690526001600160a01b0391821660448201529116906370e664cd906064015b600060405180830381600087803b1580156108c357600080fd5b505af11580156108d7573d6000803e3d6000fd5b50505050505050565b600a546001600160a01b031633148061090357506006546001600160a01b031633145b8061091857506001546001600160a01b031633145b6109345760405162461bcd60e51b81526004016104f490614222565b60008054906101000a90046001600160a01b03166001600160a01b0316639b44707b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610985573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a9919061428c565b60405163592e896f60e11b8152600160048201526001600160a01b03919091169063b25d12de90602401600060405180830381600087803b1580156109ed57600080fd5b505af1158015610a01573d6000803e3d6000fd5b5050505060008111610a695760405162461bcd60e51b815260206004820152602b60248201527f416d6f756e7420746f20756e7374616b65206d7573742062652067726561746560448201526a72207468616e207a65726f60a81b60648201526084016104f4565b604051632e1a7d4d60e01b8152600481018290526001600160a01b03831690632e1a7d4d90602401600060405180830381600087803b158015610aab57600080fd5b505af1158015610abf573d6000803e3d6000fd5b5050505060008054906101000a90046001600160a01b03166001600160a01b0316632b9512776040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b14573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b38919061428c565b60065460405163a9059cbb60e01b81526001600160a01b039283169263a9059cbb92610b6b9291169085906004016142c2565b6020604051808303816000875af1158015610b8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610607919061426f565b600a546001600160a01b0316331480610bd157506006546001600160a01b031633145b80610be657506001546001600160a01b031633145b610c025760405162461bcd60e51b81526004016104f490614222565b60008060009054906101000a90046001600160a01b03166001600160a01b031663973a664a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7a919061428c565b905060008060009054906101000a90046001600160a01b03166001600160a01b0316631c0b05d76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cf4919061428c565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038416906370a0823190602401602060405180830381865afa158015610d3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6291906142a9565b9050826001600160a01b031663e9fad8ee6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610d9f57600080fd5b505af1158015610db3573d6000803e3d6000fd5b5050505060008054906101000a90046001600160a01b03166001600160a01b0316632b9512776040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2c919061428c565b6001600160a01b031663095ea7b383836040518363ffffffff1660e01b8152600401610e599291906142c2565b6020604051808303816000875af1158015610e78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9c919061426f565b5060405163534a7e1d60e11b8152600481018290526001600160a01b0383169063a694fc3a906024016108a9565b600a546001600160a01b0316331480610eed57506006546001600160a01b031633145b80610f0257506001546001600160a01b031633145b610f1e5760405162461bcd60e51b81526004016104f490614222565b60008054906101000a90046001600160a01b03166001600160a01b0316639b44707b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f93919061428c565b60405163592e896f60e11b8152600160048201526001600160a01b03919091169063b25d12de90602401600060405180830381600087803b158015610fd757600080fd5b505af1158015610feb573d6000803e3d6000fd5b5050505060008060009054906101000a90046001600160a01b03166001600160a01b0316631f8507166040518163ffffffff1660e01b8152600401602060405180830381865afa158015611043573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611067919061428c565b604051635a2d1e0760e11b8152600481018490529091506000906001600160a01b0383169063b45a3c0e90602401602060405180830381865afa1580156110b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d691906142a9565b604051632142170760e11b81529091506001600160a01b038316906342842e0e90611109903390309088906004016142db565b600060405180830381600087803b15801561112357600080fd5b505af1158015611137573d6000803e3d6000fd5b5050505061114483613313565b60008054906101000a90046001600160a01b03166001600160a01b0316632b9512776040518163ffffffff1660e01b8152600401602060405180830381865afa158015611195573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111b9919061428c565b60065460405163a9059cbb60e01b81526001600160a01b039283169263a9059cbb926111ec9291169085906004016142c2565b6020604051808303816000875af115801561120b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061122f919061426f565b50505050565b600a546001600160a01b031633148061125857506006546001600160a01b031633145b8061126d57506001546001600160a01b031633145b6112895760405162461bcd60e51b81526004016104f490614222565b60008054906101000a90046001600160a01b03166001600160a01b0316639b44707b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112fe919061428c565b60405163592e896f60e11b8152600160048201526001600160a01b03919091169063b25d12de90602401600060405180830381600087803b15801561134257600080fd5b505af1158015611356573d6000803e3d6000fd5b5050505060008060009054906101000a90046001600160a01b03166001600160a01b0316631f8507166040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113d2919061428c565b604051635a2d1e0760e11b8152600481018490529091506000906001600160a01b0383169063b45a3c0e90602401602060405180830381865afa15801561141d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144191906142a9565b604051632142170760e11b81529091506001600160a01b038316906342842e0e90611474903390309088906004016142db565b600060405180830381600087803b15801561148e57600080fd5b505af11580156114a2573d6000803e3d6000fd5b505050506114af83613313565b61060781613726565b600a546001600160a01b03163314806114db57506006546001600160a01b031633145b806114f057506001546001600160a01b031633145b61150c5760405162461bcd60e51b81526004016104f490614222565b60008060009054906101000a90046001600160a01b03166001600160a01b0316630c3c9bec6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611560573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611584919061428c565b90506000819050806001600160a01b0316633d18b9126040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156115c657600080fd5b505af11580156115da573d6000803e3d6000fd5b505050506000816001600160a01b031663bf199e626040518163ffffffff1660e01b8152600401602060405180830381865afa15801561161e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061164291906142a9565b905060005b8181101561122f57604051637bb7bed160e01b8152600481018290526000906001600160a01b03851690637bb7bed190602401602060405180830381865afa158015611697573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116bb919061428c565b6006546040516370a0823160e01b8152306004820152919250611742916001600160a01b03918216918416906370a0823190602401602060405180830381865afa15801561170d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061173191906142a9565b6001600160a01b0384169190613939565b508061174d81614315565b915050611647565b600a546001600160a01b031633148061177857506006546001600160a01b031633145b8061178d57506001546001600160a01b031633145b6117a95760405162461bcd60e51b81526004016104f490614222565b60008054906101000a90046001600160a01b03166001600160a01b0316639b44707b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061181e919061428c565b60405163592e896f60e11b8152600160048201526001600160a01b03919091169063b25d12de90602401600060405180830381600087803b15801561186257600080fd5b505af1158015611876573d6000803e3d6000fd5b5050505060008054906101000a90046001600160a01b03166001600160a01b0316632b9512776040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ef919061428c565b6001600160a01b03166323b872dd3330846040518463ffffffff1660e01b815260040161191e939291906142db565b6020604051808303816000875af115801561193d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611961919061426f565b5061196b8161398f565b50565b600a546001600160a01b031633148061199157506006546001600160a01b031633145b806119a657506001546001600160a01b031633145b6119c25760405162461bcd60e51b81526004016104f490614222565b60008060009054906101000a90046001600160a01b03166001600160a01b03166393a5e47d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a3a919061428c565b6040516323b872dd60e01b81529091506001600160a01b038216906323b872dd90611a6d903390309087906004016142db565b6020604051808303816000875af1158015611a8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ab0919061426f565b5060008060009054906101000a90046001600160a01b03166001600160a01b03166330f6d2376040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b29919061428c565b60405163095ea7b360e01b815290915081906001600160a01b0384169063095ea7b390611b5c90849088906004016142c2565b6020604051808303816000875af1158015611b7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b9f919061426f565b5060405163db006a7560e01b8152600481018590526001600160a01b0382169063db006a7590602401600060405180830381600087803b158015611be257600080fd5b505af1158015611bf6573d6000803e3d6000fd5b5050505060008060009054906101000a90046001600160a01b03166001600160a01b031663ece773a36040518163ffffffff1660e01b8152600401602060405180830381865afa158015611c4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c72919061428c565b905060008060009054906101000a90046001600160a01b03166001600160a01b0316632b9512776040518163ffffffff1660e01b8152600401602060405180830381865afa158015611cc8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cec919061428c565b6006546040516370a0823160e01b81523060048201529192506001600160a01b038084169263a9059cbb92919091169083906370a0823190602401602060405180830381865afa158015611d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d6891906142a9565b6040518363ffffffff1660e01b8152600401611d859291906142c2565b6020604051808303816000875af1158015611da4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dc8919061426f565b506000826001600160a01b031663bf199e626040518163ffffffff1660e01b8152600401602060405180830381865afa158015611e09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e2d91906142a9565b905060005b81811015611f4b57604051637bb7bed160e01b8152600481018290526000906001600160a01b03861690637bb7bed190602401602060405180830381865afa158015611e82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea6919061428c565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038316906370a0823190602401602060405180830381865afa158015611ef0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1491906142a9565b90508015611f3657600654611f36906001600160a01b03848116911683613939565b50508080611f4390614315565b915050611e32565b5050505050505050565b600a546001600160a01b0316331480611f7857506006546001600160a01b031633145b80611f8d57506001546001600160a01b031633145b611fa95760405162461bcd60e51b81526004016104f490614222565b60008054906101000a90046001600160a01b03166001600160a01b03166310c1d32c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ffa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061201e919061428c565b6001600160a01b03166323b872dd3330856040518463ffffffff1660e01b815260040161204d939291906142db565b6020604051808303816000875af115801561206c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612090919061426f565b5060008054906101000a90046001600160a01b03166001600160a01b03166310c1d32c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156120e2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612106919061428c565b600b5460405163095ea7b360e01b81526001600160a01b039283169263095ea7b3926121399291169086906004016142c2565b6020604051808303816000875af1158015612158573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061217c919061426f565b5060008054906101000a90046001600160a01b03166001600160a01b0316630eecceca6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156121ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121f2919061428c565b60405163e2ab691d60e01b815230600482015260248101849052604481018390526001600160a01b03919091169063e2ab691d90606401600060405180830381600087803b15801561224357600080fd5b505af1158015612257573d6000803e3d6000fd5b5050505060008060009054906101000a90046001600160a01b03166001600160a01b0316630eecceca6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156122af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122d3919061428c565b604051632c9aab9b60e11b81523060048201526001600160a01b039190911690635935573690602401602060405180830381865afa158015612319573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061233d91906142a9565b1161234a5761234a614330565b5050565b600a546001600160a01b031633148061237157506006546001600160a01b031633145b8061238657506001546001600160a01b031633145b6123a25760405162461bcd60e51b81526004016104f490614222565b60008060009054906101000a90046001600160a01b03166001600160a01b03166393a5e47d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156123f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061241a919061428c565b905060008060009054906101000a90046001600160a01b03166001600160a01b0316632b9512776040518163ffffffff1660e01b8152600401602060405180830381865afa158015612470573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612494919061428c565b905060008060009054906101000a90046001600160a01b03166001600160a01b031663ece773a36040518163ffffffff1660e01b8152600401602060405180830381865afa1580156124ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061250e919061428c565b60008054604080516330f6d23760e01b8152905193945084936001600160a01b03909216916330f6d237916004808201926020929091908290030181865afa15801561255e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612582919061428c565b6040516323b872dd60e01b815290915081906001600160a01b038716906323b872dd906125b790339030908c906004016142db565b6020604051808303816000875af11580156125d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125fa919061426f565b5060405163095ea7b360e01b81526001600160a01b0387169063095ea7b3906126299085908b906004016142c2565b6020604051808303816000875af1158015612648573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061266c919061426f565b5060405163db006a7560e01b8152600481018890526001600160a01b0382169063db006a7590602401600060405180830381600087803b1580156126af57600080fd5b505af11580156126c3573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152600092506001600160a01b03881691506370a0823190602401602060405180830381865afa15801561270e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061273291906142a9565b6040516368bb292f60e11b81523060048201529091506000906001600160a01b0386169063d176525e90602401602060405180830381865afa15801561277c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127a091906142a9565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038716906370a0823190602401602060405180830381865afa1580156127ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061280e91906142a9565b9050808211156128b857826128238284614346565b10156128b35760006128358385614346565b60065460405163a9059cbb60e01b81529192506001600160a01b03808c169263a9059cbb9261286a92169085906004016142c2565b6020604051808303816000875af1158015612889573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128ad919061426f565b50829350505b612935565b60065460405163a9059cbb60e01b81526001600160a01b038a81169263a9059cbb926128ec929091169087906004016142c2565b6020604051808303816000875af115801561290b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061292f919061426f565b50600092505b8215612a085760405163095ea7b360e01b81526001600160a01b0389169063095ea7b390612969908a9087906004016142c2565b6020604051808303816000875af1158015612988573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129ac919061426f565b5060405163534a7e1d60e11b8152600481018490526001600160a01b0387169063a694fc3a90602401600060405180830381600087803b1580156129ef57600080fd5b505af1158015612a03573d6000803e3d6000fd5b505050505b6000866001600160a01b031663bf199e626040518163ffffffff1660e01b8152600401602060405180830381865afa158015612a48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a6c91906142a9565b905060005b81811015612b8a57604051637bb7bed160e01b8152600481018290526000906001600160a01b038a1690637bb7bed190602401602060405180830381865afa158015612ac1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ae5919061428c565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038316906370a0823190602401602060405180830381865afa158015612b2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b5391906142a9565b90508015612b7557600654612b75906001600160a01b03848116911683613939565b50508080612b8290614315565b915050612a71565b505050505050505050505050565b600a546001600160a01b0316331480612bbb57506006546001600160a01b031633145b80612bd057506001546001600160a01b031633145b612bec5760405162461bcd60e51b81526004016104f490614222565b60008054906101000a90046001600160a01b03166001600160a01b0316639b44707b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612c3d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c61919061428c565b60405163592e896f60e11b8152600160048201526001600160a01b03919091169063b25d12de90602401600060405180830381600087803b158015612ca557600080fd5b505af1158015612cb9573d6000803e3d6000fd5b5050505060008111612cdd5760405162461bcd60e51b81526004016104f49061435d565b6000612ce882613b4d565b9050612cf381613313565b61234a82613726565b600a546001600160a01b0316331480612d1f57506006546001600160a01b031633145b80612d3457506001546001600160a01b031633145b612d505760405162461bcd60e51b81526004016104f490614222565b60008054906101000a90046001600160a01b03166001600160a01b0316630eecceca6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612da1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dc5919061428c565b6040516370e664cd60e01b815260016004820152602481018390523060448201526001600160a01b0391909116906370e664cd90606401600060405180830381600087803b158015612e1657600080fd5b505af1158015612e2a573d6000803e3d6000fd5b5050505050565b600a546001600160a01b0316331480612e5457506006546001600160a01b031633145b80612e6957506001546001600160a01b031633145b612e855760405162461bcd60e51b81526004016104f490614222565b60008054906101000a90046001600160a01b03166001600160a01b0316639b44707b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612ed6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612efa919061428c565b60405163592e896f60e11b8152600160048201526001600160a01b03919091169063b25d12de90602401600060405180830381600087803b158015612f3e57600080fd5b505af1158015612f52573d6000803e3d6000fd5b5050505060008111612f765760405162461bcd60e51b81526004016104f49061435d565b6000612f8182613b4d565b9050612f8c81613313565b60008054906101000a90046001600160a01b03166001600160a01b0316632b9512776040518163ffffffff1660e01b8152600401602060405180830381865afa158015612fdd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613001919061428c565b60065460405163a9059cbb60e01b81526001600160a01b039283169263a9059cbb92610b6b9291169086906004016142c2565b600a546001600160a01b031633148061305757506006546001600160a01b031633145b8061306c57506001546001600160a01b031633145b6130885760405162461bcd60e51b81526004016104f490614222565b60008054906101000a90046001600160a01b03166001600160a01b0316639b44707b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156130d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130fd919061428c565b60405163592e896f60e11b8152600160048201526001600160a01b03919091169063b25d12de90602401600060405180830381600087803b15801561314157600080fd5b505af1158015613155573d6000803e3d6000fd5b5050505060008054906101000a90046001600160a01b03166001600160a01b0316632b9512776040518163ffffffff1660e01b8152600401602060405180830381865afa1580156131aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131ce919061428c565b6001600160a01b03166323b872dd3330846040518463ffffffff1660e01b81526004016131fd939291906142db565b6020604051808303816000875af115801561321c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613240919061426f565b5061196b81613726565b600a546001600160a01b031633148061326d57506006546001600160a01b031633145b8061328257506001546001600160a01b031633145b61329e5760405162461bcd60e51b81526004016104f490614222565b6000546040805163ece773a360e01b8152905161196b926001600160a01b03169163ece773a39160048083019260209291908290030181865afa1580156132e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061330d919061428c565b826108e0565b60008060009054906101000a90046001600160a01b03166001600160a01b0316632b9512776040518163ffffffff1660e01b8152600401602060405180830381865afa158015613367573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061338b919061428c565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa1580156133d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133f591906142a9565b905060008060009054906101000a90046001600160a01b03166001600160a01b0316631f8507166040518163ffffffff1660e01b8152600401602060405180830381865afa15801561344b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061346f919061428c565b604051635a2d1e0760e11b8152600481018590529091506000906001600160a01b0383169063b45a3c0e90602401602060405180830381865afa1580156134ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134de91906142a9565b9050600081116134f0576134f0614330565b60085460405163095ea7b360e01b81526001600160a01b038481169263095ea7b392613524929091169088906004016142c2565b600060405180830381600087803b15801561353e57600080fd5b505af1158015613552573d6000803e3d6000fd5b5050505060008054906101000a90046001600160a01b03166001600160a01b0316632b9512776040518163ffffffff1660e01b8152600401602060405180830381865afa1580156135a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135cb919061428c565b6001600160a01b0316633a045cda856040518263ffffffff1660e01b81526004016135f891815260200190565b600060405180830381600087803b15801561361257600080fd5b505af1158015613626573d6000803e3d6000fd5b5050505060008060009054906101000a90046001600160a01b03166001600160a01b0316632b9512776040518163ffffffff1660e01b8152600401602060405180830381865afa15801561367e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136a2919061428c565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa1580156136e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061370c91906142a9565b905061371882856143a8565b8114612e2a57612e2a614330565b60008054604051632303e6ab60e21b815230600482015282916001600160a01b031690638c0f9aac90602401602060405180830381865afa15801561376f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613793919061426f565b905080156138175760008054906101000a90046001600160a01b03166001600160a01b0316631c0b05d76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156137ec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613810919061428c565b9150613826565b6009546001600160a01b031691505b60008054906101000a90046001600160a01b03166001600160a01b0316632b9512776040518163ffffffff1660e01b8152600401602060405180830381865afa158015613877573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061389b919061428c565b6001600160a01b031663095ea7b383856040518363ffffffff1660e01b81526004016138c89291906142c2565b6020604051808303816000875af11580156138e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061390b919061426f565b5060405163534a7e1d60e11b8152600481018490526001600160a01b0383169063a694fc3a906024016108a9565b6106078363a9059cbb60e01b84846040516024016139589291906142c2565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613e57565b60008060009054906101000a90046001600160a01b03166001600160a01b031663ece773a36040518163ffffffff1660e01b8152600401602060405180830381865afa1580156139e3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a07919061428c565b905060008054906101000a90046001600160a01b03166001600160a01b0316632b9512776040518163ffffffff1660e01b8152600401602060405180830381865afa158015613a5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a7e919061428c565b6001600160a01b031663095ea7b382846040518363ffffffff1660e01b8152600401613aab9291906142c2565b6020604051808303816000875af1158015613aca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613aee919061426f565b5060405163534a7e1d60e11b8152600481018390526001600160a01b0382169063a694fc3a90602401600060405180830381600087803b158015613b3157600080fd5b505af1158015613b45573d6000803e3d6000fd5b505050505050565b6000808211613baf5760405162461bcd60e51b815260206004820152602860248201527f416d6f756e7420746f206c6f636b206d7573742062652067726561746572207460448201526768616e207a65726f60c01b60648201526084016104f4565b60008060009054906101000a90046001600160a01b03166001600160a01b0316639994e71b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613c03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c27919061428c565b6040516323b872dd60e01b81529091506001600160a01b038216906323b872dd90613c5a903390309088906004016142db565b600060405180830381600087803b158015613c7457600080fd5b505af1158015613c88573d6000803e3d6000fd5b5050505060008060009054906101000a90046001600160a01b03166001600160a01b03166360aca1f46040518163ffffffff1660e01b8152600401602060405180830381865afa158015613ce0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d04919061428c565b60405163095ea7b360e01b81529091506001600160a01b0383169063095ea7b390613d3590849088906004016142c2565b600060405180830381600087803b158015613d4f57600080fd5b505af1158015613d63573d6000803e3d6000fd5b505060005460408051630fc2838b60e11b81529051630784ce0094506001600160a01b039092169250631f8507169160048083019260209291908290030181865afa158015613db6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613dda919061428c565b604051635a9602ff60e11b815260048101879052602481018390526001600160a01b03919091169063b52c05fe906044016020604051808303816000875af1158015613e2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e4e91906142a9565b95945050505050565b6000613eac826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613f299092919063ffffffff16565b8051909150156106075780806020019051810190613eca919061426f565b6106075760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016104f4565b6060613f388484600085613f42565b90505b9392505050565b606082471015613fa35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016104f4565b6001600160a01b0385163b613ffa5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016104f4565b600080866001600160a01b0316858760405161401691906143ec565b60006040518083038185875af1925050503d8060008114614053576040519150601f19603f3d011682016040523d82523d6000602084013e614058565b606091505b5091509150614068828286614073565b979650505050505050565b60608315614082575081613f3b565b8251156140925782518084602001fd5b8160405162461bcd60e51b81526004016104f49190614408565b6000602082840312156140be57600080fd5b5035919050565b801515811461196b57600080fd5b600080604083850312156140e657600080fd5b8235915060208301356140f8816140c5565b809150509250929050565b6001600160a01b038116811461196b57600080fd5b6000806040838503121561412b57600080fd5b823561413681614103565b946020939093013593505050565b60008060008060006080868803121561415c57600080fd5b853561416781614103565b9450602086013561417781614103565b935060408601359250606086013567ffffffffffffffff8082111561419b57600080fd5b818801915088601f8301126141af57600080fd5b8135818111156141be57600080fd5b8960208285010111156141d057600080fd5b9699959850939650602001949392505050565b600080604083850312156141f657600080fd5b50508035926020909101359150565b60006020828403121561421757600080fd5b8135613f3b81614103565b6020808252602d908201527f4f6e6c7920757365722070726f787920696e74657266616365206f72206f776e60408201526c195c881a5cc8185b1b1bddd959609a1b606082015260800190565b60006020828403121561428157600080fd5b8151613f3b816140c5565b60006020828403121561429e57600080fd5b8151613f3b81614103565b6000602082840312156142bb57600080fd5b5051919050565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b634e487b7160e01b600052601160045260246000fd5b6000600019821415614329576143296142ff565b5060010190565b634e487b7160e01b600052600160045260246000fd5b600082821015614358576143586142ff565b500390565b6020808252602b908201527f416d6f756e7420746f20636f6e76657274206d7573742062652067726561746560408201526a72207468616e207a65726f60a81b606082015260800190565b600082198211156143bb576143bb6142ff565b500190565b60005b838110156143db5781810151838201526020016143c3565b8381111561122f5750506000910152565b600082516143fe8184602087016143c0565b9190910192915050565b60208152600082518060208401526144278160408501602087016143c0565b601f01601f1916919091016040019291505056fea2646970667358221220569338a2fee072b14fd192e6a258dbf7c8a677c2d3f83d3b3a63d80d596570ad64736f6c634300080b0033

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.