ETH Price: $2,869.54 (-2.44%)

Contract

0xe7E13Aa1e663FbcEB464cECf1179c505aD285628

Overview

ETH Balance

0 ETH

ETH Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To

There are no matching entries

Please try again later

Parent Transaction Hash Block From To
View All Internal Transactions

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
PoolHook

Compiler Version
v0.8.18+commit.87f61d96

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion, Unlicense license
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.18;

import {Ownable2Step} from "@openzeppelin/contracts/access/Ownable2Step.sol";
import {IPoolHook} from "../interfaces/IPoolHook.sol";
import {IPoolWithStorage} from "../interfaces/IPoolWithStorage.sol";
import {IMintableErc20} from "../interfaces/IMintableErc20.sol";
import {ILevelOracle} from "../interfaces/ILevelOracle.sol";
import {ITradingContest} from "../interfaces/ITradingContest.sol";
import {IReferralController} from "../interfaces/IReferralController.sol";
import {DataTypes} from "../lib/DataTypes.sol";

contract PoolHook is IPoolHook {
    uint8 constant lyLevelDecimals = 18;
    uint256 constant VALUE_PRECISION = 1e30;

    address public immutable pool;
    IMintableErc20 public immutable lyLevel;

    IReferralController public immutable referralController;
    ITradingContest public immutable tradingContest;

    constructor(
        address _lyLevel,
        address _pool,
        address _referralController,
        address _tradingContest
    ) {
        if (_lyLevel == address(0)) revert InvalidAddress();
        if (_pool == address(0)) revert InvalidAddress();
        if (_referralController == address(0)) revert InvalidAddress();
        if (_tradingContest == address(0)) revert InvalidAddress();

        lyLevel = IMintableErc20(_lyLevel);
        pool = _pool;
        referralController = IReferralController(_referralController);
        tradingContest = ITradingContest(_tradingContest);
    }

    modifier onlyPool() {
        _validatePool(msg.sender);
        _;
    }

    /**
     * @inheritdoc IPoolHook
     */
    function postIncreasePosition(
        address _owner,
        address _indexToken,
        address _collateralToken,
        DataTypes.Side _side,
        bytes calldata _extradata
    ) external onlyPool {
        (uint256 _sizeChange,, uint256 _feeValue) = abi.decode(_extradata, (uint256, uint256, uint256));
        _updateReferralData(_owner, _feeValue);
        _mintLyLevel(_owner, _feeValue);
        _sentTradingRecord(_owner, _sizeChange);
        emit FeeCharged(_owner, _feeValue);
        emit PostIncreasePositionExecuted(pool, _owner, _indexToken, _collateralToken, _side, _extradata);
    }

    /**
     * @inheritdoc IPoolHook
     */
    function postDecreasePosition(
        address _owner,
        address _indexToken,
        address _collateralToken,
        DataTypes.Side _side,
        bytes calldata _extradata
    ) external onlyPool {
        (uint256 _sizeChange, /* uint256 collateralValue */, uint256 _feeValue) =
            abi.decode(_extradata, (uint256, uint256, uint256));
        _updateReferralData(_owner, _feeValue);
        _mintLyLevel(_owner, _feeValue);
        _sentTradingRecord(_owner, _sizeChange);
        emit FeeCharged(_owner, _feeValue);
        emit PostDecreasePositionExecuted(msg.sender, _owner, _indexToken, _collateralToken, _side, _extradata);
    }

    /**
     * @inheritdoc IPoolHook
     */
    function postLiquidatePosition(
        address _owner,
        address _indexToken,
        address _collateralToken,
        DataTypes.Side _side,
        bytes calldata _extradata
    ) external onlyPool {
        (uint256 _sizeChange, /* uint256 collateralValue */, uint256 _feeValue) =
            abi.decode(_extradata, (uint256, uint256, uint256));
        _updateReferralData(_owner, _feeValue);
        _mintLyLevel(_owner, _feeValue);
        _sentTradingRecord(_owner, _sizeChange);
        emit FeeCharged(_owner, _feeValue);
        emit PostLiquidatePositionExecuted(msg.sender, _owner, _indexToken, _collateralToken, _side, _extradata);
    }

    /**
     * @inheritdoc IPoolHook
     */
    function postSwap(address _user, address _tokenIn, address _tokenOut, bytes calldata _data) external onlyPool {
        ( /*uint256 amountIn*/ , /* uint256 amountOut */, uint256 feeValue, bytes memory extradata) =
            abi.decode(_data, (uint256, uint256, uint256, bytes));
        (address benificier) = extradata.length != 0 ? abi.decode(extradata, (address)) : (address(0));
        benificier = benificier == address(0) ? _user : benificier;
        _updateReferralData(benificier, feeValue);
        _mintLyLevel(benificier, feeValue);
        emit FeeCharged(benificier, feeValue);
        emit PostSwapExecuted(msg.sender, _user, _tokenIn, _tokenOut, _data);
    }

    // ========= Admin function ========

    function _updateReferralData(address _trader, uint256 _value) internal {
        if (address(referralController) != address(0) && _trader != address(0)) {
            referralController.updateFee(_trader, _value);
        }
    }

    function _sentTradingRecord(address _trader, uint256 _value) internal {
        if (_value == 0 || _trader == address(0)) {
            return;
        }
        if (address(tradingContest) != address(0)) {
            tradingContest.record(_trader, _value);
        }
    }

    function _mintLyLevel(address _trader, uint256 _value) internal {
        if (_value == 0 || _trader == address(0)) {
            return;
        }
        uint256 _lyTokenAmount = (_value * 10 ** lyLevelDecimals) / VALUE_PRECISION;
        lyLevel.mint(_trader, _lyTokenAmount);
    }

    function _validatePool(address sender) internal view {
        if (sender != pool) {
            revert OnlyPool();
        }
    }

    event ReferralControllerSet(address controller);
    event FeeCharged(address indexed trader, uint256 value);

    error InvalidAddress();
    error OnlyPool();
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (access/Ownable2Step.sol)

pragma solidity ^0.8.0;

import "./Ownable.sol";

/**
 * @dev Contract module which provides access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership} and {acceptOwnership}.
 *
 * This module is used through inheritance. It will make available all functions
 * from parent (Ownable).
 */
abstract contract Ownable2Step is Ownable {
    address private _pendingOwner;

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

    /**
     * @dev Returns the address of the pending owner.
     */
    function pendingOwner() public view virtual returns (address) {
        return _pendingOwner;
    }

    /**
     * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual override onlyOwner {
        _pendingOwner = newOwner;
        emit OwnershipTransferStarted(owner(), newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual override {
        delete _pendingOwner;
        super._transferOwnership(newOwner);
    }

    /**
     * @dev The new owner accepts the ownership transfer.
     */
    function acceptOwnership() external {
        address sender = _msgSender();
        require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner");
        _transferOwnership(sender);
    }
}

// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.0;

import {IPool} from "./IPool.sol";
import {DataTypes} from "../lib/DataTypes.sol";

interface IPoolHook {
    /**
     * @notice Called after increase position or deposit collateral
     * @param extradata = encode of (sizeIncreased, collateralValueAdded, feeValue)
     * @dev all value of extradata is in USD
     */
    function postIncreasePosition(
        address owner,
        address indexToken,
        address collateralToken,
        DataTypes.Side side,
        bytes calldata extradata
    ) external;

    /**
     * @notice Called after decrease position / withdraw collateral
     * @param extradata = encode of (sizeDecreased, collateralValueReduced, feeValue)
     * @dev all value of extradata is in USD
     */
    function postDecreasePosition(
        address owner,
        address indexToken,
        address collateralToken,
        DataTypes.Side side,
        bytes calldata extradata
    ) external;

    /**
     * @notice Called after liquidate position
     * @param extradata = encode of (positionSize, collateralValue, feeValue)
     * @dev all value of extradata is in USD
     */
    function postLiquidatePosition(
        address owner,
        address indexToken,
        address collateralToken,
        DataTypes.Side side,
        bytes calldata extradata
    ) external;

    /**
     * @notice Called after increase position
     * @param user user who receive token out
     * @param tokenIn token swap from
     * @param tokenOut token swap to
     * @param data = encode of (amountIn, amountOutAfterFee, feeValue, extradata)
     * extradata include:
     *     - benificier address: address receive trading incentive
     * @dev
     *     - amountIn, amountOutAfterFee is number of token
     *     - feeValue is in USD
     */
    function postSwap(address user, address tokenIn, address tokenOut, bytes calldata data) external;

    event PreIncreasePositionExecuted(
        address pool, address owner, address indexToken, address collateralToken, DataTypes.Side side, bytes extradata
    );
    event PostIncreasePositionExecuted(
        address pool, address owner, address indexToken, address collateralToken, DataTypes.Side side, bytes extradata
    );
    event PreDecreasePositionExecuted(
        address pool, address owner, address indexToken, address collateralToken, DataTypes.Side side, bytes extradata
    );
    event PostDecreasePositionExecuted(
        address pool, address owner, address indexToken, address collateralToken, DataTypes.Side side, bytes extradata
    );
    event PreLiquidatePositionExecuted(
        address pool, address owner, address indexToken, address collateralToken, DataTypes.Side side, bytes extradata
    );
    event PostLiquidatePositionExecuted(
        address pool, address owner, address indexToken, address collateralToken, DataTypes.Side side, bytes extradata
    );

    event PostSwapExecuted(address pool, address user, address tokenIn, address tokenOut, bytes data);
}

pragma solidity >= 0.8.0;

import {IPool} from "./IPool.sol";
import {ILevelOracle} from "./ILevelOracle.sol";
import {ILiquidityCalculator} from "./ILiquidityCalculator.sol";
import {DataTypes} from "../lib/DataTypes.sol";

interface IPoolWithStorage is IPool {
    function oracle() external view returns (ILevelOracle);
    function trancheAssets(address tranche, address token) external view returns (DataTypes.AssetInfo memory);
    function allTranches(uint256 index) external view returns (address);
    function positions(bytes32 positionKey) external view returns (DataTypes.Position memory);
    function isStableCoin(address token) external view returns (bool);
    function poolBalances(address token) external view returns (uint256);
    function feeReserves(address token) external view returns (uint256);
    function borrowIndices(address token) external view returns (uint256);
    function lastAccrualTimestamps(address token) external view returns (uint256);
    function daoFee() external view returns (uint256);
    function riskFactor(address token, address tranche) external view returns (uint256);
    function liquidityCalculator() external view returns (ILiquidityCalculator);
    function targetWeights(address token) external view returns (uint256);
    function totalWeight() external view returns (uint256);
    function virtualPoolValue() external view returns (uint256);
    function isTranche(address tranche) external view returns (bool);
    function positionFee() external view returns (uint256);
    function liquidationFee() external view returns (uint256);
    function positionRevisions(bytes32 key) external view returns (uint256 rev);
    function isAsset(address token) external view returns (bool);
}

// SPDX-License-Identifier: UNLICENSED

pragma solidity >=0.8.0;

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

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

pragma solidity >= 0.8.0;

interface ILevelOracle {
    /**
     * @notice get price of single token
     * @param token address of token to consult
     * @param max if true returns max price and vice versa
     */
    function getPrice(address token, bool max) external view returns (uint256);

    function getMultiplePrices(address[] calldata tokens, bool max) external view returns (uint256[] memory);

    /**
     * @notice returns chainlink price used when liquidate
     */
    function getReferencePrice(address token) external view returns (uint256);

    /**
     * @notice returns timestamp of last posted price
     */
    function lastAnswerTimestamp(address token) external view returns (uint256);
}

// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.0;

struct BatchInfo {
    uint128 rewardTokens;
    uint64 startTime;
    uint64 endTime;
    uint64 startVestingTime;
    uint64 vestingDuration;
    uint128 totalWeight;
    bool leaderUpdated;
}

struct LeaderInfo {
    uint128 weight;
    uint128 claimed;
    uint256 totalPoint;
    uint8 index;
}

struct LeaderInfoView {
    address trader;
    uint128 rewardTokens;
    uint128 claimed;
    uint256 totalPoint;
    uint8 index;
}

struct ContestResult {
    address trader;
    uint8 index;
    uint256 totalPoint;
}

interface ITradingContest {
    function batchDuration() external returns (uint64);

    /**
     * @notice record trading point for trader
     * @param _user address of trader
     * @param _value fee collected in this trade
     */
    function record(address _user, uint256 _value) external;

    /**
     * @notice accept reward send from IncentiveController
     */
    function addReward(uint256 _rewardTokens) external;

    /**
     * @notice start a new batch and close current batch. Waiting for leaders to be set
     */
    function nextBatch() external;

    /**
     * @notice start first batch. Called only once by owner
     */
    function start(uint256 _startTime) external;

    function setPoolHook(address poolHook) external;
}

pragma solidity 0.8.18;

interface IReferralController {
    function updateFee(address _trader, uint256 _value) external;
    function setReferrer(address _trader, address _referrer) external;
    function setPoolHook(address _poolHook) external;
    function setOrderHook(address _orderHook) external;
}

File 9 of 14 : DataTypes.sol
pragma solidity >=0.8.0;

library DataTypes {
    enum Side {
        LONG,
        SHORT
    }

    enum UpdatePositionType {
        INCREASE,
        DECREASE
    }

    struct UpdatePositionRequest {
        uint256 sizeChange;
        uint256 collateral;
        UpdatePositionType updateType;
        Side side;
    }

    enum OrderType {
        MARKET,
        LIMIT
    }

    enum OrderStatus {
        OPEN,
        FILLED,
        EXPIRED,
        CANCELLED
    }

    struct LeverageOrder {
        address owner;
        address indexToken;
        address collateralToken;
        OrderStatus status;
        bool triggerAboveThreshold;
        address payToken;
        uint256 price;
        uint256 executionFee;
        uint256 submissionBlock;
        uint256 expiresAt;
        uint256 submissionTimestamp;
    }

    struct SwapOrder {
        address owner;
        address tokenIn;
        address tokenOut;
        OrderStatus status;
        uint256 amountIn;
        uint256 minAmountOut;
        uint256 price;
        uint256 executionFee;
        uint256 submissionBlock;
        uint256 submissionTimestamp;
    }

    struct AssetInfo {
        /// @notice amount of token deposited (via add liquidity or increase long position)
        uint256 poolAmount;
        /// @notice amount of token reserved for paying out when user decrease long position
        uint256 reservedAmount;
        /// @notice total borrowed (in USD) to leverage
        uint256 guaranteedValue;
        /// @notice total size of all short positions
        uint256 totalShortSize;
        /// @notice average entry price of all short positions
        uint256 averageShortPrice;
    }

    struct Position {
        /// @dev contract size is evaluated in dollar
        uint256 size;
        /// @dev collateral value in dollar
        uint256 collateralValue;
        /// @dev contract size in indexToken
        uint256 reserveAmount;
        /// @dev average entry price
        uint256 entryPrice;
        /// @dev last cumulative interest rate
        uint256 borrowIndex;
    }

    struct LiquidityOrder {
        bool isAddLiquidity;
        OrderStatus status;
        uint64 executionFee;
        address owner;
        address token;
        address lpToken;
        uint64 submissionTimestamp;
        address to;
        uint64 expiresAt;
        uint256 amountIn;
        uint256 minAmountOut;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

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

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

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

pragma solidity >=0.8.0;

import {DataTypes} from "../lib/DataTypes.sol";

interface IPool {
    struct TokenWeight {
        address token;
        uint256 weight;
    }

    struct RiskConfig {
        address tranche;
        uint256 riskFactor;
    }

    function isValidLeverageTokenPair(
        address _indexToken,
        address _collateralToken,
        DataTypes.Side _side,
        bool _isIncrease
    ) external view returns (bool);

    function canSwap(address _tokenIn, address _tokenOut) external view returns (bool);

    function increasePosition(
        address _account,
        address _indexToken,
        address _collateralToken,
        uint256 _sizeChanged,
        DataTypes.Side _side
    ) external;

    function decreasePosition(
        address _account,
        address _indexToken,
        address _collateralToken,
        uint256 _desiredCollateralReduce,
        uint256 _sizeChanged,
        DataTypes.Side _side,
        address _receiver
    ) external;

    function swap(address _tokenIn, address _tokenOut, uint256 _minOut, address _to, bytes calldata extradata)
        external;

    function addLiquidity(address _tranche, address _token, uint256 _amountIn, uint256 _minLpAmount, address _to)
        external;

    function removeLiquidity(address _tranche, address _tokenOut, uint256 _lpAmount, uint256 _minOut, address _to)
        external;

    function getPoolAsset(address _token) external view returns (DataTypes.AssetInfo memory);

    function getAllAssets() external view returns (address[] memory tokens, bool[] memory isStable);

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

    // =========== EVENTS ===========

    event SetOrderManager(address indexed orderManager);
    event IncreasePosition(
        bytes32 indexed key,
        address account,
        address collateralToken,
        address indexToken,
        uint256 collateralValue,
        uint256 sizeChanged,
        DataTypes.Side side,
        uint256 indexPrice,
        uint256 feeValue
    );
    event UpdatePosition(
        bytes32 indexed key,
        uint256 size,
        uint256 collateralValue,
        uint256 entryPrice,
        uint256 entryInterestRate,
        uint256 reserveAmount,
        uint256 indexPrice
    );
    event DecreasePosition(
        bytes32 indexed key,
        address account,
        address collateralToken,
        address indexToken,
        uint256 collateralChanged,
        uint256 sizeChanged,
        DataTypes.Side side,
        uint256 indexPrice,
        int256 pnl,
        uint256 feeValue
    );
    event ClosePosition(
        bytes32 indexed key,
        uint256 size,
        uint256 collateralValue,
        uint256 entryPrice,
        uint256 entryInterestRate,
        uint256 reserveAmount
    );
    event LiquidatePosition(
        bytes32 indexed key,
        address account,
        address collateralToken,
        address indexToken,
        DataTypes.Side side,
        uint256 size,
        uint256 collateralValue,
        uint256 reserveAmount,
        uint256 indexPrice,
        int256 pnl,
        uint256 feeValue
    );
    event DaoFeeWithdrawn(address indexed token, address recipient, uint256 amount);
    event FeeDistributorSet(address indexed feeDistributor);
    event LiquidityAdded(
        address indexed tranche, address indexed sender, address token, uint256 amount, uint256 lpAmount, uint256 fee
    );
    event LiquidityRemoved(
        address indexed tranche, address indexed sender, address token, uint256 lpAmount, uint256 amountOut, uint256 fee
    );
    event TokenWeightSet(TokenWeight[]);
    event Swap(
        address indexed sender,
        address tokenIn,
        address tokenOut,
        uint256 amountIn,
        uint256 amountOut,
        uint256 fee,
        uint256 priceIn,
        uint256 priceOut
    );
    event PositionFeeSet(uint256 positionFee, uint256 liquidationFee);
    event DaoFeeSet(uint256 value);
    event InterestAccrued(address indexed token, uint256 borrowIndex);
    event MaxLeverageChanged(uint256 maxLeverage);
    event TokenWhitelisted(address indexed token);
    event TokenDelisted(address indexed token);
    event OracleChanged(address indexed oldOracle, address indexed newOracle);
    event InterestRateSet(uint256 interestRate, uint256 stableCoinInterestRate, uint256 interval);
    event InterestRateModelSet(address indexed token, address interestRateModel);
    event PoolHookChanged(address indexed hook);
    event TrancheAdded(address indexed lpToken);
    event TokenRiskFactorUpdated(address indexed token);
    event PnLDistributed(address indexed asset, address indexed tranche, int256 pnl);
    event MaintenanceMarginChanged(uint256 ratio);
    event MaxGlobalPositionSizeSet(address indexed token, uint256 maxLongRatios, uint256 maxShortSize);
    event PoolControllerChanged(address controller);
    event AssetRebalanced();
    event LiquidityCalculatorSet(address feeModel);
    event VirtualPoolValueRefreshed(uint256 value);
    event MaxLiquiditySet(address token, uint256 value);
    event SwapAllowanceChanged(address sender, bool allowed);

    // ========== ERRORS ==============

    error UpdateCauseLiquidation();
    error InvalidLeverageTokenPair();
    error InvalidLeverage();
    error InvalidPositionSize();
    error OrderManagerOnly();
    error UnknownToken();
    error AssetNotListed();
    error InsufficientPoolAmount();
    error ReserveReduceTooMuch();
    error SlippageExceeded();
    error ValueTooHigh();
    error InvalidInterval();
    error PositionNotLiquidated();
    error ZeroAmount();
    error ZeroAddress();
    error RequireAllTokens();
    error DuplicateToken();
    error FeeDistributorOnly();
    error InvalidMaxLeverage();
    error InvalidSwapPair();
    error InvalidTranche();
    error TrancheAlreadyAdded();
    error RemoveLiquidityTooMuch();
    error CannotDistributeToTranches();
    error PositionNotExists();
    error MaxNumberOfTranchesReached();
    error TooManyTokenAdded();
    error AddLiquidityNotAllowed();
    error MaxGlobalShortSizeExceeded();
    error NotApplicableForStableCoin();
    error MaxLiquidityReach();
    error SwapNotAllowed();
}

pragma solidity >= 0.8.0;

interface ILiquidityCalculator {
    function getTrancheValue(address _tranche, bool _max) external view returns (uint256);

    function getPoolValue(bool _max) external view returns (uint256 sum);

    function calcSwapFee(bool _isStableSwap, address _token, uint256 _tokenPrice, uint256 _valueChange, bool _isSwapIn)
        external
        view
        returns (uint256);

    function calcAddRemoveLiquidityFee(address _token, uint256 _tokenPrice, uint256 _valueChange, bool _isAdd)
        external
        view
        returns (uint256);

    function calcAddLiquidity(address _tranche, address _token, uint256 _amountIn)
        external
        view
        returns (uint256 outLpAmount, uint256 feeAmount);

    function calcRemoveLiquidity(address _tranche, address _tokenOut, uint256 _lpAmount)
        external
        view
        returns (uint256 outAmountAfterFee, uint256 feeAmount);

    function calcSwapOutput(address _tokenIn, address _tokenOut, uint256 _amountIn)
        external
        view
        returns (uint256 amountOutAfterFee, uint256 feeAmount, uint256 priceIn, uint256 priceOut);

    // ========= Events ===========
    event AddRemoveLiquidityFeeSet(uint256 value);
    event SwapFeeSet(
        uint256 baseSwapFee, uint256 taxBasisPoint, uint256 stableCoinBaseSwapFee, uint256 stableCoinTaxBasisPoint
    );

    // ========= Errors ==========
    error InvalidAddress();
    error ValueTooHigh(uint256 value);
}

// 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);
}

// 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
{
  "remappings": [
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "solady/=lib/solady/src/",
    "forge-std/=lib/forge-std/src/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "solmate/=lib/solady/lib/solmate/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "viaIR": true,
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_lyLevel","type":"address"},{"internalType":"address","name":"_pool","type":"address"},{"internalType":"address","name":"_referralController","type":"address"},{"internalType":"address","name":"_tradingContest","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidAddress","type":"error"},{"inputs":[],"name":"OnlyPool","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"trader","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"FeeCharged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"indexToken","type":"address"},{"indexed":false,"internalType":"address","name":"collateralToken","type":"address"},{"indexed":false,"internalType":"enum DataTypes.Side","name":"side","type":"uint8"},{"indexed":false,"internalType":"bytes","name":"extradata","type":"bytes"}],"name":"PostDecreasePositionExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"indexToken","type":"address"},{"indexed":false,"internalType":"address","name":"collateralToken","type":"address"},{"indexed":false,"internalType":"enum DataTypes.Side","name":"side","type":"uint8"},{"indexed":false,"internalType":"bytes","name":"extradata","type":"bytes"}],"name":"PostIncreasePositionExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"indexToken","type":"address"},{"indexed":false,"internalType":"address","name":"collateralToken","type":"address"},{"indexed":false,"internalType":"enum DataTypes.Side","name":"side","type":"uint8"},{"indexed":false,"internalType":"bytes","name":"extradata","type":"bytes"}],"name":"PostLiquidatePositionExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"address","name":"tokenOut","type":"address"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"PostSwapExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"indexToken","type":"address"},{"indexed":false,"internalType":"address","name":"collateralToken","type":"address"},{"indexed":false,"internalType":"enum DataTypes.Side","name":"side","type":"uint8"},{"indexed":false,"internalType":"bytes","name":"extradata","type":"bytes"}],"name":"PreDecreasePositionExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"indexToken","type":"address"},{"indexed":false,"internalType":"address","name":"collateralToken","type":"address"},{"indexed":false,"internalType":"enum DataTypes.Side","name":"side","type":"uint8"},{"indexed":false,"internalType":"bytes","name":"extradata","type":"bytes"}],"name":"PreIncreasePositionExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"indexToken","type":"address"},{"indexed":false,"internalType":"address","name":"collateralToken","type":"address"},{"indexed":false,"internalType":"enum DataTypes.Side","name":"side","type":"uint8"},{"indexed":false,"internalType":"bytes","name":"extradata","type":"bytes"}],"name":"PreLiquidatePositionExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"controller","type":"address"}],"name":"ReferralControllerSet","type":"event"},{"inputs":[],"name":"lyLevel","outputs":[{"internalType":"contract IMintableErc20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_indexToken","type":"address"},{"internalType":"address","name":"_collateralToken","type":"address"},{"internalType":"enum DataTypes.Side","name":"_side","type":"uint8"},{"internalType":"bytes","name":"_extradata","type":"bytes"}],"name":"postDecreasePosition","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_indexToken","type":"address"},{"internalType":"address","name":"_collateralToken","type":"address"},{"internalType":"enum DataTypes.Side","name":"_side","type":"uint8"},{"internalType":"bytes","name":"_extradata","type":"bytes"}],"name":"postIncreasePosition","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_indexToken","type":"address"},{"internalType":"address","name":"_collateralToken","type":"address"},{"internalType":"enum DataTypes.Side","name":"_side","type":"uint8"},{"internalType":"bytes","name":"_extradata","type":"bytes"}],"name":"postLiquidatePosition","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"address","name":"_tokenIn","type":"address"},{"internalType":"address","name":"_tokenOut","type":"address"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"postSwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"referralController","outputs":[{"internalType":"contract IReferralController","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tradingContest","outputs":[{"internalType":"contract ITradingContest","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

6101003461011f57601f610a7c38819003918201601f191683019291906001600160401b0384118385101761012457816080928492604096875283398101031261011f5761004c8161013a565b6100586020830161013a565b61006f606061006886860161013a565b940161013a565b6001600160a01b0392831693909290841561010e578183161561010e57811692831561010e57169283156100fd5760a05260805260c05260e0525161092d908161014f8239608051818181610448015281816104f4015261089b015260a05181818161013401526107e5015260c051818181610405015261068a015260e051818181610177015261073b0152f35b845163e6c4247b60e01b8152600490fd5b855163e6c4247b60e01b8152600490fd5b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b038216820361011f5756fe604060808152600436101561001357600080fd5b600090813560e01c806305c317db1461047757806316f0115b146104345780634ba694bd146103f15780638857560b146101da57806388a494ff146101a6578063b2b62fa614610163578063b601471b146101205763fd19608d1461007757600080fd5b3461011c576101167f8c27369486b7fc5a76f0eba3e3b680888f0ae6e2d9bd4ccc24f8cab462098f2f916100aa3661054c565b939694956100ba93919333610891565b6100e76100c9868601866105b9565b929190506100d7838b610680565b6100e1838b6107be565b8961072c565b81519081526001600160a01b038816906000805160206108d883398151915290602090a25196879633886105f5565b0390a180f35b5080fd5b503461011c578160031936011261011c57517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b503461011c578160031936011261011c57517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b503461011c576101167f9edaae845b942a31bacc8750fe95740cc2e43dc51bb5a55bf19d48070e6e3ec5916100aa3661054c565b503461011c57608036600319011261011c576001600160a01b039060043582811691908281036103b157602435918483168093036103ed57604435928584168094036103e95767ffffffffffffffff936064358581116103e557610242903690600401610519565b92909361024e33610891565b8385016080868203126103e157818601359060608701358981116103dd5787019881601f8b0112156103dd5789358181116103c957845191601f8201601f19908116603f01168301908111838210176103b557908e939291865280825260209b8c8301938d83830101116103b1578185928e80930186378301015280518015610370578101038a1361011c57518b811680910361011c577ff93a8f009abf7dea84b5b6973583a0f5fd5af9b4b5e34f09fadd34e9bba5a9779b610116996000805160206108d8833981519152938c93905b5080831661036957505b6103338582610680565b61033d85826107be565b85519485521692a28051978897338952880152860152606085015260a0608085015260a08401916105d4565b9050610329565b505050887ff93a8f009abf7dea84b5b6973583a0f5fd5af9b4b5e34f09fadd34e9bba5a9779b61011699836000805160206108d8833981519152949061031f565b8480fd5b634e487b7160e01b8f52604160045260248ffd5b634e487b7160e01b8e52604160045260248efd5b8c80fd5b8a80fd5b8880fd5b8680fd5b8580fd5b503461011c578160031936011261011c57517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b503461011c578160031936011261011c57517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b503461011c576101167fa7d00e6cd2352a060b9d1b0a88ff25ceb8fd83e79f466d2371f92503b6487e2c916104ab3661054c565b939694956104bb93919333610891565b6104ca6100c9868601866105b9565b81519081526001600160a01b038816906000805160206108d883398151915290602090a2519687967f0000000000000000000000000000000000000000000000000000000000000000886105f5565b9181601f840112156105475782359167ffffffffffffffff8311610547576020838186019501011161054757565b600080fd5b9060a0600319830112610547576001600160a01b0390600435828116810361054757926024358381168103610547579260443590811681036105475791606435600281101561054757916084359067ffffffffffffffff8211610547576105b591600401610519565b9091565b90816060910312610547578035916040602083013592013590565b908060209392818452848401376000828201840152601f01601f1916010190565b6001600160a01b039182168152918116602083015291821660408201529116606082015292906002811015610640578360c091608061063d9601528160a082015201916105d4565b90565b634e487b7160e01b600052602160045260246000fd5b67ffffffffffffffff811161066a57604052565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811692908315159081610720575b506106c157505050565b823b15610547576040516394be719760e01b81526001600160a01b0390921660048301526024820152906000908290818381604481015b03925af18015610714576107095750565b61071290610656565b565b6040513d6000823e3d90fd5b905082161515386106b7565b811580156107ad575b6107a9577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316918261076e57505050565b823b156105475760405163c668561760e01b81526001600160a01b0390921660048301526024820152906000908290818381604481016106f8565b5050565b506001600160a01b03811615610735565b908015808015610880575b61087b57670de0b6b3a7640000808302928304141715610865577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031691823b15610547576040516340c10f1960e01b81526001600160a01b039190911660048201526c0c9f2c9cd04674edea400000009091046024820152906000908290604490829084905af18015610714576107095750565b634e487b7160e01b600052601160045260246000fd5b505050565b506001600160a01b038316156107c9565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081169116036108c557565b604051634b60273560e01b8152600490fdfe55bb3cade9d43b798a4fe5ffdd05024b2d7870df53920673bfc7e68047cd0ab1a264697066735822122077b40cd31923a41b8d6b46f21f3af385df6f459360a5b78452db14fdc572e52664736f6c634300081200330000000000000000000000001428cc68c38f370c911a537981b75b0e3c650c3300000000000000000000000032b7bf19cb8b95c27e644183837813d4b595dcc6000000000000000000000000bf80a1288012ada64b6086998fa12bb482086bbc000000000000000000000000279e41371ac124d5271f6edad12ac07e8c3bcb5f

Deployed Bytecode

0x604060808152600436101561001357600080fd5b600090813560e01c806305c317db1461047757806316f0115b146104345780634ba694bd146103f15780638857560b146101da57806388a494ff146101a6578063b2b62fa614610163578063b601471b146101205763fd19608d1461007757600080fd5b3461011c576101167f8c27369486b7fc5a76f0eba3e3b680888f0ae6e2d9bd4ccc24f8cab462098f2f916100aa3661054c565b939694956100ba93919333610891565b6100e76100c9868601866105b9565b929190506100d7838b610680565b6100e1838b6107be565b8961072c565b81519081526001600160a01b038816906000805160206108d883398151915290602090a25196879633886105f5565b0390a180f35b5080fd5b503461011c578160031936011261011c57517f0000000000000000000000001428cc68c38f370c911a537981b75b0e3c650c336001600160a01b03168152602090f35b503461011c578160031936011261011c57517f000000000000000000000000279e41371ac124d5271f6edad12ac07e8c3bcb5f6001600160a01b03168152602090f35b503461011c576101167f9edaae845b942a31bacc8750fe95740cc2e43dc51bb5a55bf19d48070e6e3ec5916100aa3661054c565b503461011c57608036600319011261011c576001600160a01b039060043582811691908281036103b157602435918483168093036103ed57604435928584168094036103e95767ffffffffffffffff936064358581116103e557610242903690600401610519565b92909361024e33610891565b8385016080868203126103e157818601359060608701358981116103dd5787019881601f8b0112156103dd5789358181116103c957845191601f8201601f19908116603f01168301908111838210176103b557908e939291865280825260209b8c8301938d83830101116103b1578185928e80930186378301015280518015610370578101038a1361011c57518b811680910361011c577ff93a8f009abf7dea84b5b6973583a0f5fd5af9b4b5e34f09fadd34e9bba5a9779b610116996000805160206108d8833981519152938c93905b5080831661036957505b6103338582610680565b61033d85826107be565b85519485521692a28051978897338952880152860152606085015260a0608085015260a08401916105d4565b9050610329565b505050887ff93a8f009abf7dea84b5b6973583a0f5fd5af9b4b5e34f09fadd34e9bba5a9779b61011699836000805160206108d8833981519152949061031f565b8480fd5b634e487b7160e01b8f52604160045260248ffd5b634e487b7160e01b8e52604160045260248efd5b8c80fd5b8a80fd5b8880fd5b8680fd5b8580fd5b503461011c578160031936011261011c57517f000000000000000000000000bf80a1288012ada64b6086998fa12bb482086bbc6001600160a01b03168152602090f35b503461011c578160031936011261011c57517f00000000000000000000000032b7bf19cb8b95c27e644183837813d4b595dcc66001600160a01b03168152602090f35b503461011c576101167fa7d00e6cd2352a060b9d1b0a88ff25ceb8fd83e79f466d2371f92503b6487e2c916104ab3661054c565b939694956104bb93919333610891565b6104ca6100c9868601866105b9565b81519081526001600160a01b038816906000805160206108d883398151915290602090a2519687967f00000000000000000000000032b7bf19cb8b95c27e644183837813d4b595dcc6886105f5565b9181601f840112156105475782359167ffffffffffffffff8311610547576020838186019501011161054757565b600080fd5b9060a0600319830112610547576001600160a01b0390600435828116810361054757926024358381168103610547579260443590811681036105475791606435600281101561054757916084359067ffffffffffffffff8211610547576105b591600401610519565b9091565b90816060910312610547578035916040602083013592013590565b908060209392818452848401376000828201840152601f01601f1916010190565b6001600160a01b039182168152918116602083015291821660408201529116606082015292906002811015610640578360c091608061063d9601528160a082015201916105d4565b90565b634e487b7160e01b600052602160045260246000fd5b67ffffffffffffffff811161066a57604052565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b037f000000000000000000000000bf80a1288012ada64b6086998fa12bb482086bbc811692908315159081610720575b506106c157505050565b823b15610547576040516394be719760e01b81526001600160a01b0390921660048301526024820152906000908290818381604481015b03925af18015610714576107095750565b61071290610656565b565b6040513d6000823e3d90fd5b905082161515386106b7565b811580156107ad575b6107a9577f000000000000000000000000279e41371ac124d5271f6edad12ac07e8c3bcb5f6001600160a01b0316918261076e57505050565b823b156105475760405163c668561760e01b81526001600160a01b0390921660048301526024820152906000908290818381604481016106f8565b5050565b506001600160a01b03811615610735565b908015808015610880575b61087b57670de0b6b3a7640000808302928304141715610865577f0000000000000000000000001428cc68c38f370c911a537981b75b0e3c650c336001600160a01b031691823b15610547576040516340c10f1960e01b81526001600160a01b039190911660048201526c0c9f2c9cd04674edea400000009091046024820152906000908290604490829084905af18015610714576107095750565b634e487b7160e01b600052601160045260246000fd5b505050565b506001600160a01b038316156107c9565b6001600160a01b037f00000000000000000000000032b7bf19cb8b95c27e644183837813d4b595dcc681169116036108c557565b604051634b60273560e01b8152600490fdfe55bb3cade9d43b798a4fe5ffdd05024b2d7870df53920673bfc7e68047cd0ab1a264697066735822122077b40cd31923a41b8d6b46f21f3af385df6f459360a5b78452db14fdc572e52664736f6c63430008120033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

0000000000000000000000001428cc68c38f370c911a537981b75b0e3c650c3300000000000000000000000032b7bf19cb8b95c27e644183837813d4b595dcc6000000000000000000000000bf80a1288012ada64b6086998fa12bb482086bbc000000000000000000000000279e41371ac124d5271f6edad12ac07e8c3bcb5f

-----Decoded View---------------
Arg [0] : _lyLevel (address): 0x1428cC68c38F370c911a537981b75b0E3C650c33
Arg [1] : _pool (address): 0x32B7bF19cb8b95C27E644183837813d4b595dcc6
Arg [2] : _referralController (address): 0xbf80a1288012Ada64B6086998fA12bb482086bbc
Arg [3] : _tradingContest (address): 0x279E41371ac124D5271F6EDad12Ac07E8C3bcb5F

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000001428cc68c38f370c911a537981b75b0e3c650c33
Arg [1] : 00000000000000000000000032b7bf19cb8b95c27e644183837813d4b595dcc6
Arg [2] : 000000000000000000000000bf80a1288012ada64b6086998fa12bb482086bbc
Arg [3] : 000000000000000000000000279e41371ac124d5271f6edad12ac07e8c3bcb5f


Deployed Bytecode Sourcemap

583:4953:4:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2841:98;;583:4953;;;;:::i;:::-;1553:10;;;;;;;;;;:::i;:::-;2770:11;2593:51;;;;;;:::i;:::-;2682:9;;;;;;;;:::i;:::-;2723;;;;:::i;:::-;2770:11;;:::i;:::-;583:4953;;;;;-1:-1:-1;;;;;583:4953:4;;;-1:-1:-1;;;;;;;;;;;2797:29:4;583:4953;;2797:29;583:4953;1553:10;;;;2841:98;;:::i;:::-;;;;583:4953;;;;;;;;;;;;;;;;;;;;742:39;-1:-1:-1;;;;;583:4953:4;;;;;;;;;;;;;;;;;;;;849:47;-1:-1:-1;;;;;583:4953:4;;;;;;;;;;;3548:99;;583:4953;;;;:::i;:::-;;;;;;;-1:-1:-1;;583:4953:4;;;;-1:-1:-1;;;;;583:4953:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;1553:10;;;;;;:::i;:::-;3931:53;;;583:4953;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;583:4953:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4017:21;;;;4041:32;;583:4953;;-1:-1:-1;583:4953:4;;;;;;;;;;;4313:63;4017:71;583:4953;4017:71;-1:-1:-1;;;;;;;;;;;4017:71:4;;;;;-1:-1:-1;583:4953:4;;;;;4111:45;;4198:8;;;;:::i;:::-;4242;;;;:::i;:::-;583:4953;;;;;;4266:32;;583:4953;;1553:10;;;;583:4953;;;;;;;;;;;;;;;;;;;;;;:::i;4111:45::-;;;;;4017:71;;;;;4313:63;4017:71;583:4953;4017:71;;-1:-1:-1;;;;;;;;;;;4017:71:4;;;;583:4953;;;;;-1:-1:-1;;;583:4953:4;;;;;;;;;-1:-1:-1;;;583:4953:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;788:55;-1:-1:-1;;;;;583:4953:4;;;;;;;;;;;;;;;;;;;;707:29;-1:-1:-1;;;;;583:4953:4;;;;;;;;;;;2141:92;;583:4953;;;;:::i;:::-;1553:10;;;;;;;;;;:::i;:::-;2070:11;1893:51;;;;;;:::i;2070:11::-;583:4953;;;;;-1:-1:-1;;;;;583:4953:4;;;-1:-1:-1;;;;;;;;;;;2097:29:4;583:4953;;2097:29;583:4953;2170:4;;;;2141:92;;:::i;583:4953::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;-1:-1:-1;;583:4953:4;;;;;-1:-1:-1;;;;;583:4953:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;-1:-1:-1;583:4953:4;;;;;;;;-1:-1:-1;;583:4953:4;;;;:::o;:::-;-1:-1:-1;;;;;583:4953:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::o;:::-;;;;-1:-1:-1;583:4953:4;;;;;-1:-1:-1;583:4953:4;;;;;;;;;:::o;:::-;;;;;;;;;;;;4431:229;-1:-1:-1;;;;;4524:18:4;583:4953;;;;4516:41;;;;;:66;;4431:229;4512:142;;;4431:229;;;:::o;4512:142::-;4598:45;;;;;583:4953;;-1:-1:-1;;;4598:45:4;;-1:-1:-1;;;;;583:4953:4;;;4598:45;;;583:4953;;;;;;4555:1;;583:4953;;;4555:1;583:4953;;;;4598:45;;;;;;;;;;;4431:229;:::o;4598:45::-;;;;:::i;:::-;4431:229::o;4598:45::-;583:4953;;;4555:1;583:4953;;;;;4516:66;583:4953;;;;4561:21;;4516:66;;;4666:274;4750:11;;:36;;;;4666:274;4746:73;;4840:14;-1:-1:-1;;;;;583:4953:4;;;4828:106;;4666:274;;;:::o;4828:106::-;4885:38;;;;;583:4953;;-1:-1:-1;;;4885:38:4;;-1:-1:-1;;;;;583:4953:4;;;4885:38;;;583:4953;;;;;;4760:1;;583:4953;;;4760:1;583:4953;;;;4885:38;583:4953;4746:73;4802:7;;:::o;4750:36::-;-1:-1:-1;;;;;;583:4953:4;;4765:21;4750:36;;4946:285;;5024:11;;:36;;;;;4946:285;5020:73;;653:2;;;;;;;;;;;;5187:7;-1:-1:-1;;;;;583:4953:4;;5187:37;;;;;583:4953;;-1:-1:-1;;;5187:37:4;;-1:-1:-1;;;;;583:4953:4;;;;5187:37;;;583:4953;696:4;;;;583:4953;;;;;-1:-1:-1;;583:4953:4;;;;;;-1:-1:-1;;5187:37:4;;;;;;;;4946:285;:::o;653:2::-;583:4953;;;5034:1;653:2;;;;;5034:1;653:2;5020:73;5076:7;;;:::o;5024:36::-;-1:-1:-1;;;;;;583:4953:4;;5039:21;5024:36;;5237:131;-1:-1:-1;;;;;5314:4:4;583:4953;;;;5304:14;5300:62;;5237:131::o;5300:62::-;583:4953;;-1:-1:-1;;;5341:10:4;;;;

Swarm Source

ipfs://77b40cd31923a41b8d6b46f21f3af385df6f459360a5b78452db14fdc572e526

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

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.