S Price: $0.519042 (+2.88%)

Contract

0xE2EaDC50c2F3044065E2484B0287F1CA82fD92E1

Overview

S Balance

Sonic LogoSonic LogoSonic Logo0 S

S Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

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

Contract Source Code Verified (Exact Match)

Contract Name:
PriceGetterUniV2

Compiler Version
v0.8.16+commit.07a7930e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 7 : PriceGetterUniV2.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.16;

import "../IPriceGetterProtocol.sol";
import "../../IPriceGetter.sol";
import "../../lib/UtilityLibrary.sol";
import "./interfaces/IApePair.sol";
import "./interfaces/IApeFactory.sol";

contract PriceGetterUniV2 is IPriceGetterProtocol {
    struct LocalVarsV2Price {
        uint256 usdStableTotal;
        uint256 wrappedNativeReserve;
        uint256 wrappedNativeTotal;
        uint256 tokenReserve;
        uint256 stableUsdReserve;
    }

    // ========== Get Token Prices ==========

    function getTokenPrice(
        address token,
        address factory,
        PriceGetterParams memory params
    ) public view override returns (uint256 price) {
        IApeFactory factoryV2 = IApeFactory(factory);
        uint256 nativePrice = params.mainPriceGetter.getNativePrice(IPriceGetter.Protocol.UniV2, address(factoryV2));
        if (token == params.wrappedNative.tokenAddress) {
            /// @dev Returning high total balance for wrappedNative to heavily weight value.
            return nativePrice;
        }

        LocalVarsV2Price memory vars;

        (vars.tokenReserve, vars.wrappedNativeReserve) = _getNormalizedReservesFromFactoryV2_Decimals(
            factoryV2,
            token,
            params.wrappedNative.tokenAddress,
            UtilityLibrary._getTokenDecimals(token),
            params.wrappedNative.decimals
        );
        vars.wrappedNativeTotal = (vars.wrappedNativeReserve * nativePrice) / 1e18;
        uint256 tokenTotal = vars.tokenReserve;

        for (uint256 i = 0; i < params.stableUsdTokens.length; i++) {
            IPriceGetter.TokenAndDecimals memory stableUsdToken = params.stableUsdTokens[i];
            (vars.tokenReserve, vars.stableUsdReserve) = _getNormalizedReservesFromFactoryV2_Decimals(
                factoryV2,
                token,
                stableUsdToken.tokenAddress,
                UtilityLibrary._getTokenDecimals(token),
                stableUsdToken.decimals
            );
            uint256 stableUsdPrice = params.mainPriceGetter.getOraclePriceNormalized(stableUsdToken.tokenAddress);

            if (stableUsdPrice > 0) {
                /// @dev Weighting the USD side of the pair by the price of the USD stable token if it exists.
                vars.usdStableTotal += (vars.stableUsdReserve * stableUsdPrice) / 1e18;
            } else {
                vars.usdStableTotal += vars.stableUsdReserve;
            }
            tokenTotal += vars.tokenReserve;
        }

        if (tokenTotal == 0) {
            return 0;
        }
        price = ((vars.usdStableTotal + vars.wrappedNativeTotal) * 1e18) / tokenTotal;
    }

    // ========== LP PRICE ==========

    function getLPPrice(
        address lp,
        address factory,
        PriceGetterParams memory params
    ) public view override returns (uint256 price) {
        //if not a LP, handle as a standard token
        try IApePair(lp).getReserves() returns (uint112 reserve0, uint112 reserve1, uint32) {
            address token0 = IApePair(lp).token0();
            address token1 = IApePair(lp).token1();
            uint256 totalSupply = IApePair(lp).totalSupply();

            //price0*reserve0+price1*reserve1
            uint256 token0Price = getTokenPrice(token0, factory, params);
            uint256 token1Price = getTokenPrice(token1, factory, params);
            reserve0 = UtilityLibrary._normalizeToken112(reserve0, token0);
            reserve1 = UtilityLibrary._normalizeToken112(reserve1, token1);
            uint256 totalValue = (token0Price * uint256(reserve0)) + (token1Price * uint256(reserve1));

            return totalValue / totalSupply;
        } catch {
            /// @dev If the pair is not a valid LP, return the price of the token
            uint256 lpPrice = getTokenPrice(lp, factory, params);
            return lpPrice;
        }
    }

    // ========== NATIVE PRICE ==========

    function getNativePrice(
        address factory,
        PriceGetterParams memory params
    ) public view override returns (uint256 price) {
        IApeFactory factoryV2 = IApeFactory(factory);
        uint256 wrappedNativeTotal;

        /// @dev This method calculates the price of wrappedNative by comparing multiple stable pools and weighting by their oracle price
        uint256 usdStableTotal = 0;
        for (uint256 i = 0; i < params.stableUsdTokens.length; i++) {
            IPriceGetter.TokenAndDecimals memory stableUsdToken = params.stableUsdTokens[i];
            (uint256 wrappedNativeReserve, uint256 stableUsdReserve) = _getNormalizedReservesFromFactoryV2_Decimals(
                factoryV2,
                params.wrappedNative.tokenAddress,
                stableUsdToken.tokenAddress,
                params.wrappedNative.decimals,
                stableUsdToken.decimals
            );
            uint256 stableUsdPrice = params.mainPriceGetter.getOraclePriceNormalized(stableUsdToken.tokenAddress);
            if (stableUsdPrice > 0) {
                /// @dev Weighting the USD side of the pair by the price of the USD stable token if it exists.
                usdStableTotal += (stableUsdReserve * stableUsdPrice) / 1e18;
            } else {
                usdStableTotal += stableUsdReserve;
            }
            wrappedNativeTotal += wrappedNativeReserve;
        }

        price = (usdStableTotal * 1e18) / wrappedNativeTotal;
    }

    // ========== INTERNAL FUNCTIONS ==========

    /**
     * @dev Get normalized reserves for a given token pair from the ApeSwap Factory contract, specifying decimals.
     * @param factoryV2 The address of the V2 factory.
     * @param tokenA The address of the first token in the pair.
     * @param tokenB The address of the second token in the pair.
     * @param decimalsA The number of decimals for the first token in the pair.
     * @param decimalsB The number of decimals for the second token in the pair.
     * @return normalizedReserveA The normalized reserve of the first token in the pair.
     * @return normalizedReserveB The normalized reserve of the second token in the pair.
     */
    function _getNormalizedReservesFromFactoryV2_Decimals(
        IApeFactory factoryV2,
        address tokenA,
        address tokenB,
        uint8 decimalsA,
        uint8 decimalsB
    ) internal view returns (uint256 normalizedReserveA, uint256 normalizedReserveB) {
        address pairAddress = factoryV2.getPair(tokenA, tokenB);
        if (pairAddress == address(0)) {
            return (0, 0);
        }
        return _getNormalizedReservesFromPair_Decimals(pairAddress, tokenA, tokenB, decimalsA, decimalsB);
    }

    /**
     * @dev This internal function takes in a pair address, two token addresses (tokenA and tokenB), and their respective decimals.
     * It returns the normalized reserves for each token in the pair.
     *
     * This function uses the IApePair interface to get the current reserves of the given token pair
     * If successful, it returns the normalized reserves for each token in the pair by calling _normalize() on
     * the reserve values. The order of the returned normalized reserve values depends on the lexicographic ordering
     * of tokenA and tokenB.
     *
     * @param pair Address of the liquidity pool contract representing the token pair
     * @param tokenA Address of one of the tokens in the pair. Assumed to be a valid address in the pair to save on gas.
     * @param tokenB Address of the other token in the pair. Assumed to be a valid address in the pair to save on gas.
     * @param decimalsA The number of decimals for tokenA
     * @param decimalsB The number of decimals for tokenB
     * @return normalizedReserveA The normalized reserve value for tokenA
     * @return normalizedReserveB The normalized reserve value for tokenB
     */
    function _getNormalizedReservesFromPair_Decimals(
        address pair,
        address tokenA,
        address tokenB,
        uint8 decimalsA,
        uint8 decimalsB
    ) internal view returns (uint256 normalizedReserveA, uint256 normalizedReserveB) {
        (bool success, bytes memory returnData) = pair.staticcall(abi.encodeWithSignature("getReserves()"));

        if (success) {
            try this.decodeReservesWithLP(returnData) returns (uint112 reserve0, uint112 reserve1, uint32) {
                if (UtilityLibrary._isSorted(tokenA, tokenB)) {
                    return (
                        UtilityLibrary._normalize(reserve0, decimalsA),
                        UtilityLibrary._normalize(reserve1, decimalsB)
                    );
                } else {
                    return (
                        UtilityLibrary._normalize(reserve1, decimalsA),
                        UtilityLibrary._normalize(reserve0, decimalsB)
                    );
                }
            } catch {
                (success, returnData) = pair.staticcall(abi.encodeWithSignature("getFictiveReserves()"));
                try this.decodeReservesWithoutLP(returnData) returns (uint256 reserve0, uint256 reserve1) {
                    if (UtilityLibrary._isSorted(tokenA, tokenB)) {
                        return (
                            UtilityLibrary._normalize(reserve0, decimalsA),
                            UtilityLibrary._normalize(reserve1, decimalsB)
                        );
                    } else {
                        return (
                            UtilityLibrary._normalize(reserve1, decimalsA),
                            UtilityLibrary._normalize(reserve0, decimalsB)
                        );
                    }
                } catch {
                    return (0, 0);
                }
            }
        } else {
            return (0, 0);
        }
    }

    function decodeReservesWithLP(
        bytes memory data
    ) public pure returns (uint112 reserve0, uint112 reserve1, uint32 lp) {
        return abi.decode(data, (uint112, uint112, uint32));
    }

    function decodeReservesWithoutLP(bytes memory data) public pure returns (uint256 reserve0, uint256 reserve1) {
        return abi.decode(data, (uint256, uint256));
    }
}

File 2 of 7 : IPriceGetterProtocol.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.16;

import "../IPriceGetter.sol";

interface IPriceGetterProtocol {
    struct PriceGetterParams {
        IPriceGetter mainPriceGetter;
        IPriceGetter.TokenAndDecimals wrappedNative;
        IPriceGetter.TokenAndDecimals[] stableUsdTokens;
        uint256 nativeLiquidityThreshold;
    }

    /**
     * @dev Returns the price of a token.
     * @param token The address of the token to get the price for.
     * @return price The current price of the token.
     */
    function getTokenPrice(
        address token,
        address factory,
        PriceGetterParams memory params
    ) external view returns (uint256 price);

    /**
     * @dev Returns the price of an LP token.
     * @param lp The address of the LP token to get the price for.
     * @return price The current price of the LP token.
     */
    function getLPPrice(
        address lp,
        address factory,
        PriceGetterParams memory params
    ) external view returns (uint256 price);

    /**
     * @dev Returns the current price of the native token in USD.
     * @return nativePrice The current price of the native token in USD.
     */
    function getNativePrice(
        address factory,
        PriceGetterParams memory params
    ) external view returns (uint256 nativePrice);
}

File 3 of 7 : IApeFactory.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.6.6;

interface IApeFactory {
    event PairCreated(address indexed token0, address indexed token1, address pair, uint);

    function feeTo() external view returns (address);

    function feeToSetter() external view returns (address);

    function getPair(address tokenA, address tokenB) external view returns (address pair);

    function allPairs(uint) external view returns (address pair);

    function allPairsLength() external view returns (uint);

    function createPair(address tokenA, address tokenB) external returns (address pair);

    function setFeeTo(address) external;

    function setFeeToSetter(address) external;
}

File 4 of 7 : IApePair.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.6.6;

interface IApePair {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external pure returns (string memory);

    function symbol() external pure returns (string memory);

    function decimals() external pure returns (uint8);

    function totalSupply() external view returns (uint);

    function balanceOf(address owner) external view returns (uint);

    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);

    function transfer(address to, uint value) external returns (bool);

    function transferFrom(address from, address to, uint value) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);

    function PERMIT_TYPEHASH() external pure returns (bytes32);

    function nonces(address owner) external view returns (uint);

    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;

    event Mint(address indexed sender, uint amount0, uint amount1);
    event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
    event Swap(
        address indexed sender,
        uint amount0In,
        uint amount1In,
        uint amount0Out,
        uint amount1Out,
        address indexed to
    );
    event Sync(uint112 reserve0, uint112 reserve1);

    function MINIMUM_LIQUIDITY() external pure returns (uint);

    function factory() external view returns (address);

    function token0() external view returns (address);

    function token1() external view returns (address);

    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);

    function price0CumulativeLast() external view returns (uint);

    function price1CumulativeLast() external view returns (uint);

    function kLast() external view returns (uint);

    function mint(address to) external returns (uint liquidity);

    function burn(address to) external returns (uint amount0, uint amount1);

    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;

    function skim(address to) external;

    function sync() external;

    function initialize(address, address) external;
}

File 5 of 7 : IPriceGetter.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.16;

interface IPriceGetter {
    enum Protocol {
        __,
        ___,
        UniV2,
        UniV3,
        Algebra,
        _Gamma, // outdated
        _Steer, // outdated
        Solidly,
        Xfai,
        Curve,
        AlgebraIntegral
    }

    enum Wrappers {
        Gamma,
        Ichi,
        Steer
    }

    struct TokenAndDecimals {
        address tokenAddress;
        uint8 decimals;
    }

    function getTokenPrice(address token, Protocol protocol, address factory) external view returns (uint256 price);
    function getLPPrice(address lp, Protocol protocol, address factory) external view returns (uint256 price);
    function getWrappedLPPrice(
        address lp,
        Protocol protocol,
        address factory,
        IPriceGetter.Wrappers wrapper
    ) external view returns (uint256 price);
    function getNativePrice(Protocol protocol, address factory) external view returns (uint256 nativePrice);
    function getOraclePriceNormalized(address token) external view returns (uint256 price);
}

File 6 of 7 : UtilityLibrary.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.16;

import "../token-lib/IERC20.sol";

library UtilityLibrary {
    function _isSorted(address tokenA, address tokenB) internal pure returns (bool isSorted) {
        //  (address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
        isSorted = tokenA < tokenB ? true : false;
    }

    function _getTokenDecimals(address token) internal view returns (uint8 decimals) {
        try IERC20(token).decimals() returns (uint8 dec) {
            decimals = dec;
        } catch {
            decimals = 18;
        }
    }

    /// @notice Normalize the amount of a token to wei or 1e18
    function _normalizeToken(uint256 amount, address token) internal view returns (uint256) {
        return _normalize(amount, _getTokenDecimals(token));
    }

    /// @notice Normalize the amount of a token to wei or 1e18
    function _normalizeToken112(uint112 amount, address token) internal view returns (uint112) {
        return _normalize112(amount, _getTokenDecimals(token));
    }

    /// @notice Normalize the amount passed to wei or 1e18 decimals
    function _normalize(uint256 amount, uint8 decimals) internal pure returns (uint256) {
        if (decimals == 18) return amount;
        return (amount * (10 ** 18)) / (10 ** decimals);
    }

    /// @notice Normalize the amount passed to wei or 1e18 decimals
    function _normalize112(uint112 amount, uint8 decimals) internal pure returns (uint112) {
        if (decimals == 18) {
            return amount;
        } else if (decimals > 18) {
            return uint112(amount / (10 ** (decimals - 18)));
        } else {
            return uint112(amount * (10 ** (18 - decimals)));
        }
    }
}

File 7 of 7 : IERC20.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.5.0;

interface IERC20 {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external view returns (string memory);

    function symbol() external view returns (string memory);

    function decimals() external view returns (uint8);

    function totalSupply() external view returns (uint);

    function balanceOf(address owner) external view returns (uint);

    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);

    function transfer(address to, uint value) external returns (bool);

    function transferFrom(address from, address to, uint value) external returns (bool);
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"decodeReservesWithLP","outputs":[{"internalType":"uint112","name":"reserve0","type":"uint112"},{"internalType":"uint112","name":"reserve1","type":"uint112"},{"internalType":"uint32","name":"lp","type":"uint32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"decodeReservesWithoutLP","outputs":[{"internalType":"uint256","name":"reserve0","type":"uint256"},{"internalType":"uint256","name":"reserve1","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"lp","type":"address"},{"internalType":"address","name":"factory","type":"address"},{"components":[{"internalType":"contract IPriceGetter","name":"mainPriceGetter","type":"address"},{"components":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"internalType":"struct IPriceGetter.TokenAndDecimals","name":"wrappedNative","type":"tuple"},{"components":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"internalType":"struct IPriceGetter.TokenAndDecimals[]","name":"stableUsdTokens","type":"tuple[]"},{"internalType":"uint256","name":"nativeLiquidityThreshold","type":"uint256"}],"internalType":"struct IPriceGetterProtocol.PriceGetterParams","name":"params","type":"tuple"}],"name":"getLPPrice","outputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"factory","type":"address"},{"components":[{"internalType":"contract IPriceGetter","name":"mainPriceGetter","type":"address"},{"components":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"internalType":"struct IPriceGetter.TokenAndDecimals","name":"wrappedNative","type":"tuple"},{"components":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"internalType":"struct IPriceGetter.TokenAndDecimals[]","name":"stableUsdTokens","type":"tuple[]"},{"internalType":"uint256","name":"nativeLiquidityThreshold","type":"uint256"}],"internalType":"struct IPriceGetterProtocol.PriceGetterParams","name":"params","type":"tuple"}],"name":"getNativePrice","outputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"factory","type":"address"},{"components":[{"internalType":"contract IPriceGetter","name":"mainPriceGetter","type":"address"},{"components":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"internalType":"struct IPriceGetter.TokenAndDecimals","name":"wrappedNative","type":"tuple"},{"components":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"internalType":"struct IPriceGetter.TokenAndDecimals[]","name":"stableUsdTokens","type":"tuple[]"},{"internalType":"uint256","name":"nativeLiquidityThreshold","type":"uint256"}],"internalType":"struct IPriceGetterProtocol.PriceGetterParams","name":"params","type":"tuple"}],"name":"getTokenPrice","outputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b5061130b806100206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80631c4d118d1461005c5780635a51a2a0146100895780639bbcae16146100aa578063e9876564146100bd578063f9f4f732146100d0575b600080fd5b61006f61006a366004610ce7565b61010f565b604080519283526020830191909152015b60405180910390f35b61009c610097366004610ef3565b61012f565b604051908152602001610080565b61009c6100b8366004610ef3565b61035e565b61009c6100cb366004610f55565b610630565b6100e36100de366004610ce7565b610793565b604080516001600160701b03948516815293909216602084015263ffffffff1690820152606001610080565b600080828060200190518101906101269190610fa5565b91509150915091565b6000836001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa92505050801561018b575060408051601f3d908101601f1916820190925261018891810190610fe0565b60015b6101a557600061019c85858561035e565b91506103579050565b6000876001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102099190611030565b90506000886001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561024b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061026f9190611030565b90506000896001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d5919061104d565b905060006102e4848b8b61035e565b905060006102f3848c8c61035e565b90506102ff88866107b9565b975061030b87856107b9565b965060006103226001600160701b0389168361107c565b6103356001600160701b038b168561107c565b61033f919061109b565b905061034b84826110ae565b99505050505050505050505b9392505050565b805160405160016246908760e11b03198152600091849183916001600160a01b03169063ff72def2906103989060029086906004016110d0565b602060405180830381865afa1580156103b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d9919061104d565b90508360200151600001516001600160a01b0316866001600160a01b0316036104055791506103579050565b6104376040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b61045c838887602001516000015161044e8b6107d6565b896020015160200151610846565b602083018190526060830191909152670de0b6b3a76400009061048090849061107c565b61048a91906110ae565b6040820152606081015160005b8660400151518110156105e0576000876040015182815181106104bc576104bc61110a565b602002602001015190506104e3868b83600001516104d98e6107d6565b8560200151610846565b608086015260608501528751815160405163427d626760e11b81526001600160a01b03918216600482015260009291909116906384fac4ce90602401602060405180830381865afa15801561053c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610560919061104d565b905080156105a257670de0b6b3a7640000818660800151610581919061107c565b61058b91906110ae565b8551869061059a90839061109b565b9052506105ba565b6080850151855186906105b690839061109b565b9052505b60608501516105c9908561109b565b9350505080806105d890611120565b915050610497565b50806000036105f6576000945050505050610357565b6040820151825182916106089161109b565b61061a90670de0b6b3a764000061107c565b61062491906110ae565b98975050505050505050565b6000828180805b85604001515181101561076b5760008660400151828151811061065c5761065c61110a565b6020026020010151905060008061068e878a602001516000015185600001518c60200151602001518760200151610846565b8a51855160405163427d626760e11b81526001600160a01b0391821660048201529395509193506000929116906384fac4ce90602401602060405180830381865afa1580156106e1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610705919061104d565b9050801561073b57670de0b6b3a7640000610720828461107c565b61072a91906110ae565b610734908761109b565b9550610748565b610745828761109b565b95505b610752838861109b565b965050505050808061076390611120565b915050610637565b508161077f82670de0b6b3a764000061107c565b61078991906110ae565b9695505050505050565b6000806000838060200190518101906107ac9190610fe0565b9250925092509193909250565b60006107cd836107c8846107d6565b6108fa565b90505b92915050565b6000816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610832575060408051601f3d908101601f1916820190925261082f91810190611139565b60015b61083e57506012919050565b90505b919050565b60405163e6a4390560e01b81526001600160a01b0385811660048301528481166024830152600091829182919089169063e6a4390590604401602060405180830381865afa15801561089c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c09190611030565b90506001600160a01b0381166108dd5760008092509250506108f0565b6108ea8188888888610973565b92509250505b9550959350505050565b60008160ff1660120361090e5750816107d0565b60128260ff16111561094a57610925601283611156565b61093090600a611253565b610943906001600160701b0385166110ae565b90506107d0565b610955826012611156565b61096090600a611253565b610943906001600160701b03851661107c565b60408051600481526024810182526020810180516001600160e01b0316630240bc6b60e21b17905290516000918291829182916001600160a01b038b16916109ba91611286565b600060405180830381855afa9150503d80600081146109f5576040519150601f19603f3d011682016040523d82523d6000602084013e6109fa565b606091505b50915091508115610c0357604051637cfa7b9960e11b8152309063f9f4f73290610a289084906004016112a2565b606060405180830381865afa925050508015610a61575060408051601f3d908101601f19168201909252610a5e91810190610fe0565b60015b610b9a5760408051600481526024810182526020810180516001600160e01b0316639a20767b60e01b17905290516001600160a01b038b1691610aa391611286565b600060405180830381855afa9150503d8060008114610ade576040519150601f19603f3d011682016040523d82523d6000602084013e610ae3565b606091505b50604051631c4d118d60e01b815291935091503090631c4d118d90610b0c9084906004016112a2565b6040805180830381865afa925050508015610b44575060408051601f3d908101601f19168201909252610b4191810190610fa5565b60015b610b56576000809350935050506108f0565b610b608a8a610c11565b15610b8657610b6f8289610c3c565b610b798289610c3c565b95509550505050506108f0565b610b908189610c3c565b610b798389610c3c565b610ba48b8b610c11565b15610bdd57610bbc836001600160701b03168a610c3c565b610bcf836001600160701b03168a610c3c565b9650965050505050506108f0565b610bf0826001600160701b03168a610c3c565b610bcf846001600160701b03168a610c3c565b6000809350935050506108f0565b6000816001600160a01b0316836001600160a01b031610610c335760006107cd565b60019392505050565b60008160ff16601203610c505750816107d0565b610c5b82600a611253565b610c6d84670de0b6b3a764000061107c565b6107cd91906110ae565b634e487b7160e01b600052604160045260246000fd5b6040516080810167ffffffffffffffff81118282101715610cb057610cb0610c77565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610cdf57610cdf610c77565b604052919050565b60006020808385031215610cfa57600080fd5b823567ffffffffffffffff80821115610d1257600080fd5b818501915085601f830112610d2657600080fd5b813581811115610d3857610d38610c77565b610d4a601f8201601f19168501610cb6565b91508082528684828501011115610d6057600080fd5b8084840185840137600090820190930192909252509392505050565b6001600160a01b0381168114610d9157600080fd5b50565b60ff81168114610d9157600080fd5b600060408284031215610db557600080fd5b6040516040810181811067ffffffffffffffff82111715610dd857610dd8610c77565b6040529050808235610de981610d7c565b81526020830135610df981610d94565b6020919091015292915050565b600060a08284031215610e1857600080fd5b610e20610c8d565b90508135610e2d81610d7c565b81526020610e3d84848301610da3565b81830152606083013567ffffffffffffffff80821115610e5c57600080fd5b818501915085601f830112610e7057600080fd5b813581811115610e8257610e82610c77565b610e90848260051b01610cb6565b818152848101925060069190911b830184019087821115610eb057600080fd5b928401925b81841015610ed957610ec78885610da3565b83528483019250604084019350610eb5565b604086015250505050608091909101356060820152919050565b600080600060608486031215610f0857600080fd5b8335610f1381610d7c565b92506020840135610f2381610d7c565b9150604084013567ffffffffffffffff811115610f3f57600080fd5b610f4b86828701610e06565b9150509250925092565b60008060408385031215610f6857600080fd5b8235610f7381610d7c565b9150602083013567ffffffffffffffff811115610f8f57600080fd5b610f9b85828601610e06565b9150509250929050565b60008060408385031215610fb857600080fd5b505080516020909101519092909150565b80516001600160701b038116811461084157600080fd5b600080600060608486031215610ff557600080fd5b610ffe84610fc9565b925061100c60208501610fc9565b9150604084015163ffffffff8116811461102557600080fd5b809150509250925092565b60006020828403121561104257600080fd5b815161035781610d7c565b60006020828403121561105f57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561109657611096611066565b500290565b808201808211156107d0576107d0611066565b6000826110cb57634e487b7160e01b600052601260045260246000fd5b500490565b60408101600b84106110f257634e487b7160e01b600052602160045260246000fd5b9281526001600160a01b039190911660209091015290565b634e487b7160e01b600052603260045260246000fd5b60006001820161113257611132611066565b5060010190565b60006020828403121561114b57600080fd5b815161035781610d94565b60ff82811682821603908111156107d0576107d0611066565b600181815b808511156111aa57816000190482111561119057611190611066565b8085161561119d57918102915b93841c9390800290611174565b509250929050565b6000826111c1575060016107d0565b816111ce575060006107d0565b81600181146111e457600281146111ee5761120a565b60019150506107d0565b60ff8411156111ff576111ff611066565b50506001821b6107d0565b5060208310610133831016604e8410600b841016171561122d575081810a6107d0565b611237838361116f565b806000190482111561124b5761124b611066565b029392505050565b60006107cd60ff8416836111b2565b60005b8381101561127d578181015183820152602001611265565b50506000910152565b60008251611298818460208701611262565b9190910192915050565b60208152600082518060208401526112c1816040850160208701611262565b601f01601f1916919091016040019291505056fea2646970667358221220bae63554575099f8fce4f21e7812d79aaa489b17ec6e957741d27eab639e032c64736f6c63430008100033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100575760003560e01c80631c4d118d1461005c5780635a51a2a0146100895780639bbcae16146100aa578063e9876564146100bd578063f9f4f732146100d0575b600080fd5b61006f61006a366004610ce7565b61010f565b604080519283526020830191909152015b60405180910390f35b61009c610097366004610ef3565b61012f565b604051908152602001610080565b61009c6100b8366004610ef3565b61035e565b61009c6100cb366004610f55565b610630565b6100e36100de366004610ce7565b610793565b604080516001600160701b03948516815293909216602084015263ffffffff1690820152606001610080565b600080828060200190518101906101269190610fa5565b91509150915091565b6000836001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa92505050801561018b575060408051601f3d908101601f1916820190925261018891810190610fe0565b60015b6101a557600061019c85858561035e565b91506103579050565b6000876001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102099190611030565b90506000886001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561024b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061026f9190611030565b90506000896001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d5919061104d565b905060006102e4848b8b61035e565b905060006102f3848c8c61035e565b90506102ff88866107b9565b975061030b87856107b9565b965060006103226001600160701b0389168361107c565b6103356001600160701b038b168561107c565b61033f919061109b565b905061034b84826110ae565b99505050505050505050505b9392505050565b805160405160016246908760e11b03198152600091849183916001600160a01b03169063ff72def2906103989060029086906004016110d0565b602060405180830381865afa1580156103b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d9919061104d565b90508360200151600001516001600160a01b0316866001600160a01b0316036104055791506103579050565b6104376040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b61045c838887602001516000015161044e8b6107d6565b896020015160200151610846565b602083018190526060830191909152670de0b6b3a76400009061048090849061107c565b61048a91906110ae565b6040820152606081015160005b8660400151518110156105e0576000876040015182815181106104bc576104bc61110a565b602002602001015190506104e3868b83600001516104d98e6107d6565b8560200151610846565b608086015260608501528751815160405163427d626760e11b81526001600160a01b03918216600482015260009291909116906384fac4ce90602401602060405180830381865afa15801561053c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610560919061104d565b905080156105a257670de0b6b3a7640000818660800151610581919061107c565b61058b91906110ae565b8551869061059a90839061109b565b9052506105ba565b6080850151855186906105b690839061109b565b9052505b60608501516105c9908561109b565b9350505080806105d890611120565b915050610497565b50806000036105f6576000945050505050610357565b6040820151825182916106089161109b565b61061a90670de0b6b3a764000061107c565b61062491906110ae565b98975050505050505050565b6000828180805b85604001515181101561076b5760008660400151828151811061065c5761065c61110a565b6020026020010151905060008061068e878a602001516000015185600001518c60200151602001518760200151610846565b8a51855160405163427d626760e11b81526001600160a01b0391821660048201529395509193506000929116906384fac4ce90602401602060405180830381865afa1580156106e1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610705919061104d565b9050801561073b57670de0b6b3a7640000610720828461107c565b61072a91906110ae565b610734908761109b565b9550610748565b610745828761109b565b95505b610752838861109b565b965050505050808061076390611120565b915050610637565b508161077f82670de0b6b3a764000061107c565b61078991906110ae565b9695505050505050565b6000806000838060200190518101906107ac9190610fe0565b9250925092509193909250565b60006107cd836107c8846107d6565b6108fa565b90505b92915050565b6000816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610832575060408051601f3d908101601f1916820190925261082f91810190611139565b60015b61083e57506012919050565b90505b919050565b60405163e6a4390560e01b81526001600160a01b0385811660048301528481166024830152600091829182919089169063e6a4390590604401602060405180830381865afa15801561089c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c09190611030565b90506001600160a01b0381166108dd5760008092509250506108f0565b6108ea8188888888610973565b92509250505b9550959350505050565b60008160ff1660120361090e5750816107d0565b60128260ff16111561094a57610925601283611156565b61093090600a611253565b610943906001600160701b0385166110ae565b90506107d0565b610955826012611156565b61096090600a611253565b610943906001600160701b03851661107c565b60408051600481526024810182526020810180516001600160e01b0316630240bc6b60e21b17905290516000918291829182916001600160a01b038b16916109ba91611286565b600060405180830381855afa9150503d80600081146109f5576040519150601f19603f3d011682016040523d82523d6000602084013e6109fa565b606091505b50915091508115610c0357604051637cfa7b9960e11b8152309063f9f4f73290610a289084906004016112a2565b606060405180830381865afa925050508015610a61575060408051601f3d908101601f19168201909252610a5e91810190610fe0565b60015b610b9a5760408051600481526024810182526020810180516001600160e01b0316639a20767b60e01b17905290516001600160a01b038b1691610aa391611286565b600060405180830381855afa9150503d8060008114610ade576040519150601f19603f3d011682016040523d82523d6000602084013e610ae3565b606091505b50604051631c4d118d60e01b815291935091503090631c4d118d90610b0c9084906004016112a2565b6040805180830381865afa925050508015610b44575060408051601f3d908101601f19168201909252610b4191810190610fa5565b60015b610b56576000809350935050506108f0565b610b608a8a610c11565b15610b8657610b6f8289610c3c565b610b798289610c3c565b95509550505050506108f0565b610b908189610c3c565b610b798389610c3c565b610ba48b8b610c11565b15610bdd57610bbc836001600160701b03168a610c3c565b610bcf836001600160701b03168a610c3c565b9650965050505050506108f0565b610bf0826001600160701b03168a610c3c565b610bcf846001600160701b03168a610c3c565b6000809350935050506108f0565b6000816001600160a01b0316836001600160a01b031610610c335760006107cd565b60019392505050565b60008160ff16601203610c505750816107d0565b610c5b82600a611253565b610c6d84670de0b6b3a764000061107c565b6107cd91906110ae565b634e487b7160e01b600052604160045260246000fd5b6040516080810167ffffffffffffffff81118282101715610cb057610cb0610c77565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610cdf57610cdf610c77565b604052919050565b60006020808385031215610cfa57600080fd5b823567ffffffffffffffff80821115610d1257600080fd5b818501915085601f830112610d2657600080fd5b813581811115610d3857610d38610c77565b610d4a601f8201601f19168501610cb6565b91508082528684828501011115610d6057600080fd5b8084840185840137600090820190930192909252509392505050565b6001600160a01b0381168114610d9157600080fd5b50565b60ff81168114610d9157600080fd5b600060408284031215610db557600080fd5b6040516040810181811067ffffffffffffffff82111715610dd857610dd8610c77565b6040529050808235610de981610d7c565b81526020830135610df981610d94565b6020919091015292915050565b600060a08284031215610e1857600080fd5b610e20610c8d565b90508135610e2d81610d7c565b81526020610e3d84848301610da3565b81830152606083013567ffffffffffffffff80821115610e5c57600080fd5b818501915085601f830112610e7057600080fd5b813581811115610e8257610e82610c77565b610e90848260051b01610cb6565b818152848101925060069190911b830184019087821115610eb057600080fd5b928401925b81841015610ed957610ec78885610da3565b83528483019250604084019350610eb5565b604086015250505050608091909101356060820152919050565b600080600060608486031215610f0857600080fd5b8335610f1381610d7c565b92506020840135610f2381610d7c565b9150604084013567ffffffffffffffff811115610f3f57600080fd5b610f4b86828701610e06565b9150509250925092565b60008060408385031215610f6857600080fd5b8235610f7381610d7c565b9150602083013567ffffffffffffffff811115610f8f57600080fd5b610f9b85828601610e06565b9150509250929050565b60008060408385031215610fb857600080fd5b505080516020909101519092909150565b80516001600160701b038116811461084157600080fd5b600080600060608486031215610ff557600080fd5b610ffe84610fc9565b925061100c60208501610fc9565b9150604084015163ffffffff8116811461102557600080fd5b809150509250925092565b60006020828403121561104257600080fd5b815161035781610d7c565b60006020828403121561105f57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561109657611096611066565b500290565b808201808211156107d0576107d0611066565b6000826110cb57634e487b7160e01b600052601260045260246000fd5b500490565b60408101600b84106110f257634e487b7160e01b600052602160045260246000fd5b9281526001600160a01b039190911660209091015290565b634e487b7160e01b600052603260045260246000fd5b60006001820161113257611132611066565b5060010190565b60006020828403121561114b57600080fd5b815161035781610d94565b60ff82811682821603908111156107d0576107d0611066565b600181815b808511156111aa57816000190482111561119057611190611066565b8085161561119d57918102915b93841c9390800290611174565b509250929050565b6000826111c1575060016107d0565b816111ce575060006107d0565b81600181146111e457600281146111ee5761120a565b60019150506107d0565b60ff8411156111ff576111ff611066565b50506001821b6107d0565b5060208310610133831016604e8410600b841016171561122d575081810a6107d0565b611237838361116f565b806000190482111561124b5761124b611066565b029392505050565b60006107cd60ff8416836111b2565b60005b8381101561127d578181015183820152602001611265565b50506000910152565b60008251611298818460208701611262565b9190910192915050565b60208152600082518060208401526112c1816040850160208701611262565b601f01601f1916919091016040019291505056fea2646970667358221220bae63554575099f8fce4f21e7812d79aaa489b17ec6e957741d27eab639e032c64736f6c63430008100033

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.