Overview
ETH Balance
0 ETH
ETH Value
$0.00More Info
Private Name Tags
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Advanced mode: Intended for advanced users or developers and will display all Internal Transactions including zero value transfers. Name tag integration is not available in advanced view.
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block | From | To | ||||
---|---|---|---|---|---|---|---|
134909626 | 24 mins ago | 0 ETH | |||||
134909626 | 24 mins ago | 0 ETH | |||||
134909626 | 24 mins ago | 0 ETH | |||||
134909626 | 24 mins ago | 0 ETH | |||||
134909626 | 24 mins ago | 0 ETH | |||||
134909626 | 24 mins ago | 0 ETH | |||||
134909626 | 24 mins ago | 0 ETH | |||||
134909626 | 24 mins ago | 0 ETH | |||||
134909626 | 24 mins ago | 0 ETH | |||||
134909626 | 24 mins ago | 0 ETH | |||||
134909626 | 24 mins ago | 0 ETH | |||||
134909626 | 24 mins ago | 0 ETH | |||||
134909626 | 24 mins ago | 0 ETH | |||||
134909626 | 24 mins ago | 0 ETH | |||||
134909626 | 24 mins ago | 0 ETH | |||||
134909626 | 24 mins ago | 0 ETH | |||||
134909626 | 24 mins ago | 0 ETH | |||||
134909626 | 24 mins ago | 0 ETH | |||||
134909626 | 24 mins ago | 0 ETH | |||||
134909626 | 24 mins ago | 0 ETH | |||||
134909123 | 41 mins ago | 0 ETH | |||||
134909123 | 41 mins ago | 0 ETH | |||||
134909123 | 41 mins ago | 0 ETH | |||||
134909123 | 41 mins ago | 0 ETH | |||||
134909123 | 41 mins ago | 0 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
SynthetixHandler
Compiler Version
v0.8.24+commit.e11b9ed9
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.13; // solhint-disable avoid-tx-origin import {ISynthetixHandler} from "./interfaces/ISynthetixHandler.sol"; import {IAddressProvider} from "./interfaces/IAddressProvider.sol"; import {ILeveragedToken} from "./interfaces/ILeveragedToken.sol"; import {ISynthetixHandlerStorage} from "./interfaces/ISynthetixHandlerStorage.sol"; import {IPerpsV2MarketSettings} from "./interfaces/synthetix/IPerpsV2MarketSettings.sol"; import {IPerpsV2MarketData} from "./interfaces/synthetix/IPerpsV2MarketData.sol"; import {IPerpsV2MarketConsolidated} from "./interfaces/synthetix/IPerpsV2MarketConsolidated.sol"; import {IPerpsV2MarketBaseTypes} from "./interfaces/synthetix/IPerpsV2MarketBaseTypes.sol"; import {ScaledNumber} from "./libraries/ScaledNumber.sol"; import {AddressKeys} from "./libraries/AddressKeys.sol"; contract SynthetixHandler is ISynthetixHandler { using ScaledNumber for uint256; using ScaledNumber for int256; IPerpsV2MarketData internal immutable _perpsV2MarketData; IPerpsV2MarketSettings internal immutable _marketSettings; IAddressProvider internal immutable _addressProvider; uint256 internal constant _SLIPPAGE_TOLERANCE = 0.02e18; // 2% bytes32 internal constant _TRACKING_CODE = bytes32("TLX"); constructor( address addressProvider_, address perpsV2MarketData_, address marketSettings_ ) { _perpsV2MarketData = IPerpsV2MarketData(perpsV2MarketData_); _addressProvider = IAddressProvider(addressProvider_); _marketSettings = IPerpsV2MarketSettings(marketSettings_); } /// @inheritdoc ISynthetixHandler function market( string calldata targetAsset_ ) external view returns (address) { IPerpsV2MarketData.MarketData memory marketData_ = _perpsV2MarketData .marketDetailsForKey(_key(targetAsset_)); return marketData_.market; } /// @inheritdoc ISynthetixHandler function depositMargin(address market_, uint256 amount_) public override { _validateMintAmount(market_, amount_); _writeUserMint(amount_); IPerpsV2MarketConsolidated(market_).transferMargin(int256(amount_)); } /// @inheritdoc ISynthetixHandler function withdrawMargin(address market_, uint256 amount_) public override { _writeUserRedeem(amount_); IPerpsV2MarketConsolidated(market_).transferMargin(-int256(amount_)); } /// @inheritdoc ISynthetixHandler function submitLeverageUpdate( address market_, uint256 leverage_, bool isLong_ ) public override { uint256 marginAmount_ = remainingMargin(market_, address(this)); int256 sizeDelta_ = _getLeverageUpdateSizeDelta( market_, leverage_, isLong_, marginAmount_ ); uint256 price_ = fillPrice(market_, sizeDelta_); if (sizeDelta_ > 0) { price_ = price_.mul(1e18 + _SLIPPAGE_TOLERANCE); } else { price_ = price_.div(1e18 + _SLIPPAGE_TOLERANCE); } // This does not take into account the `dynamicFeeRate`, the `makerFee` and the `takerFee` // So the leverage we end up at will be slightly higher than our target // In practice, this is typically in the order of 0.2%, which is an order of magnitude smaller than our // rebalance threshold, so it is not an issue IPerpsV2MarketConsolidated(market_) .submitOffchainDelayedOrderWithTracking( sizeDelta_, price_, _TRACKING_CODE ); } /// @inheritdoc ISynthetixHandler function computePriceImpact( address market_, uint256 leverage_, uint256 baseAmount_, bool isLong_, bool isDeposit_ ) public view override returns (uint256, bool) { uint256 assetPrice_ = assetPrice(market_); uint256 tradeSize_ = baseAmount_.mul(leverage_); // Getting order fee for the base amount uint256 absTargetSizeDelta_ = tradeSize_.div(assetPrice_); int256 targetSizeDelta_ = int256(absTargetSizeDelta_); if (!isLong_) targetSizeDelta_ = -targetSizeDelta_; // Invert if shorting if (!isDeposit_) targetSizeDelta_ = -targetSizeDelta_; // Invert if redeeming uint256 orderFee_ = _orderFee(market_, targetSizeDelta_); // Getting decayed redemption fee uint256 decayingRedemptionFee_ = isDeposit_ ? 0 : _synthetixHandlerStorage() .decayingRedemptionFee(msg.sender, tx.origin, baseAmount_) .mul(leverage_); // Getting price impact from a rebalance uint256 marginAmount_ = remainingMargin(market_, msg.sender); if (isDeposit_) marginAmount_ += baseAmount_; else marginAmount_ -= baseAmount_; int256 rebalanceSizeDelta_ = _getLeverageUpdateSizeDelta( market_, leverage_, isLong_, marginAmount_ ); uint256 fillPrice_ = fillPrice(market_, rebalanceSizeDelta_); int256 priceImpact_ = int256(fillPrice_) - int256(assetPrice_); if (!isLong_) priceImpact_ = -priceImpact_; // Invert if shorting if (!isDeposit_) priceImpact_ = -priceImpact_; // Invert if redeeming if (priceImpact_ < 0) return (orderFee_ + decayingRedemptionFee_, true); uint256 priceImpactPercent_ = uint256(priceImpact_).div(assetPrice_); uint256 rebalanceCharge_ = priceImpactPercent_.mul(tradeSize_); return (orderFee_ + rebalanceCharge_ + decayingRedemptionFee_, true); } /// @inheritdoc ISynthetixHandler function hasPendingLeverageUpdate( address market_, address account_ ) public view override returns (bool) { return IPerpsV2MarketConsolidated(market_) .delayedOrders(account_) .sizeDelta != 0; } /// @inheritdoc ISynthetixHandler function hasOpenPosition( address market_, address account_ ) public view override returns (bool) { return IPerpsV2MarketConsolidated(market_).positions(account_).size != 0; } /// @inheritdoc ISynthetixHandler function totalValue( address market_, address account_ ) public view override returns (uint256) { return remainingMargin(market_, account_); } /// @inheritdoc ISynthetixHandler function initialMargin( address market_, address account_ ) public view returns (uint256) { return IPerpsV2MarketConsolidated(market_).positions(account_).margin; } /// @inheritdoc ISynthetixHandler function leverageDeviationFactor( address market_, address account_, uint256 targetLeverage_ ) public view returns (uint256) { uint256 initialNotional = initialMargin(market_, account_).mul( targetLeverage_ ); if (initialNotional == 0) return 0; uint256 currentNotional = notionalValue(market_, account_); return currentNotional.absSub(initialNotional).div(initialNotional).mul( targetLeverage_ ); } /// @inheritdoc ISynthetixHandler function leverage( address market_, address account_ ) public view override returns (uint256) { uint256 notionalValue_ = notionalValue(market_, account_); uint256 marginRemaining_ = remainingMargin(market_, account_); if (marginRemaining_ == 0) revert NoMargin(); return notionalValue_.div(marginRemaining_); } /// @inheritdoc ISynthetixHandler function notionalValue( address market_, address account_ ) public view override returns (uint256) { (int256 notionalValue_, bool invalid_) = IPerpsV2MarketConsolidated( market_ ).notionalValue(account_); if (invalid_) return 0; if (notionalValue_ < 0) return uint256(-notionalValue_); return uint256(notionalValue_); } /// @inheritdoc ISynthetixHandler function isLong( address market_, address account_ ) public view override returns (bool) { (int256 notionalValue_, bool invalid_) = IPerpsV2MarketConsolidated( market_ ).notionalValue(account_); if (invalid_) revert ErrorGettingIsLong(); if (notionalValue_ == 0) revert ErrorGettingIsLong(); return notionalValue_ > 0; } /// @inheritdoc ISynthetixHandler function remainingMargin( address market_, address account_ ) public view override returns (uint256) { (uint256 marginRemaining_, bool invalid_) = IPerpsV2MarketConsolidated( market_ ).remainingMargin(account_); if (invalid_) return 0; return marginRemaining_; } /// @inheritdoc ISynthetixHandler function fillPrice( address market_, int256 sizeDelta_ ) public view override returns (uint256) { (uint256 fillPrice_, bool invalid_) = IPerpsV2MarketConsolidated( market_ ).fillPrice(sizeDelta_); if (invalid_) revert ErrorGettingFillPrice(); return fillPrice_; } /// @inheritdoc ISynthetixHandler function isAssetSupported( string calldata targetAsset_ ) public view override returns (bool) { try _perpsV2MarketData.marketDetailsForKey(_key(targetAsset_)) returns ( IPerpsV2MarketData.MarketData memory ) { return true; } catch { return false; } } /// @inheritdoc ISynthetixHandler function assetPrice( address market_ ) public view override returns (uint256) { (uint256 assetPrice_, bool invalid_) = IPerpsV2MarketConsolidated( market_ ).assetPrice(); if (invalid_) revert ErrorGettingAssetPrice(); return assetPrice_; } /// @inheritdoc ISynthetixHandler function maxLeverage( string calldata targetAsset_ ) public view override returns (uint256) { return _marketSettings.maxLeverage(_key(targetAsset_)); } /// @inheritdoc ISynthetixHandler function maxMarketValue( string calldata targetAsset_, address market_ ) public view override returns (uint256) { uint256 price_ = assetPrice(market_); return _marketSettings.maxMarketValue(_key(targetAsset_)).mul(price_); } function _writeUserMint(uint256 mintAmount_) internal { uint256 amountMinted_ = mintAmount_.div(_exchangeRate()); _synthetixHandlerStorage().increaseMintedAmount( address(this), tx.origin, amountMinted_ ); } function _writeUserRedeem(uint256 redeemAmount_) internal { uint256 amountRedeemed_ = redeemAmount_.div(_exchangeRate()); _synthetixHandlerStorage().decreaseMintedAmount( address(this), tx.origin, amountRedeemed_ ); } function _getLeverageUpdateSizeDelta( address market_, uint256 leverage_, bool isLong_, uint256 marginAmount_ ) internal view returns (int256) { if (marginAmount_ == 0) revert NoMargin(); marginAmount_ -= _minKeeperFee(); // Subtract keeper fee uint256 assetPrice_ = assetPrice(market_); uint256 notionalValue_ = notionalValue(market_, address(this)); notionalValue_ = notionalValue_.div(assetPrice_); // Convert to target units uint256 targetNotional_ = marginAmount_.mul(leverage_).div(assetPrice_); int256 sizeDelta_ = int256(targetNotional_) - int256(notionalValue_); if (!isLong_) sizeDelta_ = -sizeDelta_; // Invert if shorting return sizeDelta_; } function _validateMintAmount( address market_, uint256 mintAmount_ ) internal view { uint256 price_ = assetPrice(market_); uint256 increase_ = mintAmount_.mul(_leverage()).div(price_); bytes32 key_ = IPerpsV2MarketConsolidated(market_).marketKey(); uint256 maxMarketValue_ = _marketSettings.maxMarketValue(key_); uint256 buffer_ = _addressProvider .parameterProvider() .maxBaseAssetAmountBuffer(); uint256 max_ = maxMarketValue_.mul(1e18 - buffer_); (uint256 long_, uint256 short_) = IPerpsV2MarketConsolidated(market_) .marketSizes(); uint256 currentSize_ = _isLong() ? long_ : short_; if (currentSize_ + increase_ > max_) revert MaxMarketValueExceeded(); } function _isLong() internal view returns (bool) { return ILeveragedToken(address(this)).isLong(); } function _leverage() internal view returns (uint256) { return ILeveragedToken(address(this)).targetLeverage(); } function _exchangeRate() internal view returns (uint256) { return ILeveragedToken(address(this)).exchangeRate(); } function _pnl( address market_, address account_ ) internal view returns (int256) { (int256 pnl_, bool invalid_) = IPerpsV2MarketConsolidated(market_) .profitLoss(account_); if (invalid_) revert ErrorGettingPnl(); return pnl_; } function _orderFee( address market_, int256 sizeDelta_ ) internal view returns (uint256) { (uint256 fee_, bool invalid_) = IPerpsV2MarketConsolidated(market_) .orderFee(sizeDelta_, IPerpsV2MarketBaseTypes.OrderType.Offchain); if (invalid_) revert ErrorGettingOrderFee(); return fee_; } function _minKeeperFee() internal view returns (uint256) { return _marketSettings.minKeeperFee(); } function _synthetixHandlerStorage() internal view returns (ISynthetixHandlerStorage) { return ISynthetixHandlerStorage( _addressProvider.addressOf( AddressKeys.SYNTHETIX_HANDLER_STORAGE ) ); } function _key( string calldata targetAsset_ ) internal pure returns (bytes32) { return bytes32(bytes(abi.encodePacked("s", targetAsset_, "PERP"))); } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.13; interface ISynthetixHandler { error ErrorGettingPnl(); error ErrorGettingOrderFee(); error ErrorGettingIsLong(); error ErrorGettingFillPrice(); error ErrorGettingAssetPrice(); error NoMargin(); error MaxMarketValueExceeded(); /** * @notice Deposit `amount` of margin to Synthetix for the `market`. * @dev Should be called with delegatecall. * @param market The market to deposit margin for. * @param amount The amount of margin to deposit. */ function depositMargin(address market, uint256 amount) external; /** * @notice Withdraw `amount` of margin from Synthetix for the `market`. * @dev Should be called with delegatecall. * @param market The market to withdraw margin for. * @param amount The amount of margin to withdraw. */ function withdrawMargin(address market, uint256 amount) external; /** * @notice Submit a leverage update for the `market`. * @dev Should be called with delegatecall. * @param market The market to submit a leverage update for. * @param leverage The new leverage to target. * @param isLong Whether the position is long or short. */ function submitLeverageUpdate( address market, uint256 leverage, bool isLong ) external; /** * @notice Computes expected price impact for a position adjustment at current prices. * @dev This also includes fees charged by Synthetix for modifying the position. * @param market The market for which to compute price impact for. * @param leverage The leverage to target. * @param baseAmount The margin amount to compute price impact for. * @param isLong Whether the position is long or short. * @param isDeposit Whether the adjustment is a deposit. * @return slippage The expected slippage for the position adjustment. * @return isLoss Whether the expected slippage is a loss. */ function computePriceImpact( address market, uint256 leverage, uint256 baseAmount, bool isLong, bool isDeposit ) external view returns (uint256 slippage, bool isLoss); /** * @notice Returns the address for the market of the `targetAsset`. * @param targetAsset The asset to return the market for. * @return market The address for the market of the `targetAsset`. */ function market( string calldata targetAsset ) external view returns (address market); /** * @notice Returns if the `account` has a pending leverage update. * @param market The market to check if the `account` has a pending leverage update for. * @param account The account to check if they have a pending leverage update. * @return hasPendingLeverageUpdate Whether the `account` has a pending leverage update. */ function hasPendingLeverageUpdate( address market, address account ) external view returns (bool hasPendingLeverageUpdate); /** * @notice Returns if the `account` has an open position for the `market`. * @param market The market to check if the `account` has an open position for. * @param account The account to check if they have an open position for the `market`. * @return hasOpenPosition Whether the `acccount` has an open position for the `market`. */ function hasOpenPosition( address market, address account ) external view returns (bool hasOpenPosition); /** * @notice Returns the total value of the `account`'s position for the `market` in the Base Asset. * @param market The market to get the total value of the `account`'s position for. * @param account The account to get the total value of the `account`'s position for the `market`. * @return totalValue The total value of the `account`'s position for the `market` in the Base Asset. */ function totalValue( address market, address account ) external view returns (uint256 totalValue); /** * @notice Returns the deviation factor from our target leverage. * @dev Used for rebalances, if |1 - leverageDeviationFactor| exceeds our `rebalanceThreshold` then a rebalance is triggered. * When this factoris below 1, it means we are underleveraged, when it is above 1, it means we are overleveraged. * @param market The market to get the leverage of the `account`'s position for. * @param account The account to get the leverage of the `account`'s position for the `market`. * @return leverageDeviationFactor The deviation factor from our target leverage. */ function leverageDeviationFactor( address market, address account, uint256 targetLeverage ) external view returns (uint256 leverageDeviationFactor); /** * @notice Returns the leverage of the `account`'s position for the `market`. * @param market The market to get the leverage of the `account`'s position for. * @param account The account to get the leverage of the `account`'s position for the `market`. * @return leverage The leverage of the `account`'s position for the `market`. */ function leverage( address market, address account ) external view returns (uint256 leverage); /** * @notice Returns the notional value of the `account`'s position for the `market` in the Base Asset. * @param market The market to get the notional value of the `account`'s position for. * @param account The account to get the notional value of the `account`'s position for the `market`. * @return notionalValue The notional value of the `account`'s position for the `market` in the Base Asset. */ function notionalValue( address market, address account ) external view returns (uint256); /** * @notice Returns if the `account`'s position for the `m` is long. * @dev Reverts if the `account` does not have an open position for the `targetAsset`. * @param market The market to check if the `account`'s position for is long. * @param account The account to check if the `account`'s position for the `targetAsset` is long. * @return isLong Whether the `account`'s position for the `market` is long. */ function isLong( address market, address account ) external view returns (bool isLong); /** * @notice Returns the initial margin of the `account`'s position for the `market`. * This does not take into account any profit or loss * @param market The market to get the remaining margin of the `account`'s position for. * @param account The account to get the remaining margin of the `account`'s position for the `market`. * @return initialMargin The initial margin of the `account`'s position for the `market`. */ function initialMargin( address market, address account ) external view returns (uint256 initialMargin); /** * @notice Returns the remaining margin of the `account`'s position for the `market`. * @param market The market to get the remaining margin of the `account`'s position for. * @param account The account to get the remaining margin of the `account`'s position for the `market`. * @return remainingMargin The remaining margin of the `account`'s position for the `market`. */ function remainingMargin( address market, address account ) external view returns (uint256 remainingMargin); /** * @notice Returns the fill price of the `market` for a trade of `sizeDelta` tokens. * @param market The market to get the fill price of. * @param sizeDelta The amount of tokens to get the fill price for. * @return fillPrice The fill price of the `market` for a trade of `sizeDelta` tokens. */ function fillPrice( address market, int256 sizeDelta ) external view returns (uint256 fillPrice); /** * @notice Returns the price of the `market`. * @param market The market to return the price for. * @return assetPrice The price of the `market`. */ function assetPrice( address market ) external view returns (uint256 assetPrice); /** * @notice Returns if the `targetAsset` is supported. * @param targetAsset The asset to check if it is supported. * @return isSupported Whether the `targetAsset` is supported. */ function isAssetSupported( string calldata targetAsset ) external view returns (bool isSupported); /** * @notice Returns the Maximum Market value for the `targetAsset`. * @param targetAsset The asset to get the Maximum Market value for. * @param market The market to get the Maximum Market value for. * @return maxMarketValue The Maximum Market value for the `targetAsset`. */ function maxMarketValue( string calldata targetAsset, address market ) external view returns (uint256 maxMarketValue); /** * @notice Returns the maximum leverage allowed for the `targetAsset`. * @param targetAsset The asset to check the maximum leverage allowed for. * @return maxLeverage The maximum leverage allowed for the `targetAsset`. */ function maxLeverage( string calldata targetAsset ) external view returns (uint256 maxLeverage); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.13; import {IERC20Metadata} from "openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import {ILeveragedTokenFactory} from "./ILeveragedTokenFactory.sol"; import {IReferrals} from "./IReferrals.sol"; import {IAirdrop} from "./IAirdrop.sol"; import {IBonding} from "./IBonding.sol"; import {IVesting} from "./IVesting.sol"; import {ITlxToken} from "./ITlxToken.sol"; import {IStaker} from "./IStaker.sol"; import {ISynthetixHandler} from "./ISynthetixHandler.sol"; import {IParameterProvider} from "./IParameterProvider.sol"; import {IZapSwap} from "./IZapSwap.sol"; interface IAddressProvider { event AddressUpdated(bytes32 indexed key, address value); event AddressFrozen(bytes32 indexed key); event RebalancerAdded(address indexed account); event RebalancerRemoved(address indexed account); error AddressIsFrozen(bytes32 key); /** * @notice Updates an address for the given key. * @param key The key of the address to be updated. * @param value The value of the address to be updated. */ function updateAddress(bytes32 key, address value) external; /** * @notice Freezes an address for the given key, making it immutable. * @param key The key of the address to be frozen. */ function freezeAddress(bytes32 key) external; /** * @notice Gives the `account` permissions to rebalance leveraged tokens. * @dev Reverts if the `account` is already a rebalancer. * @param account The address of the account to be added. */ function addRebalancer(address account) external; /** * @notice Removes the `account` permissions to rebalance leveraged tokens. * @dev Reverts if the `account` is not a rebalancer. * @param account The address of the account to be removed. */ function removeRebalancer(address account) external; /** * @notice Returns the address for a kiven key. * @param key The key of the address to be returned. * @return value The address for the given key. */ function addressOf(bytes32 key) external view returns (address value); /** * @notice Returns whether an address is frozen. * @param key The key of the address to be checked. * @return Whether the address is frozen. */ function isAddressFrozen(bytes32 key) external view returns (bool); /** * @notice Returns the LeveragedTokenFactory contract. * @return leveragedTokenFactory The LeveragedTokenFactory contract. */ function leveragedTokenFactory() external view returns (ILeveragedTokenFactory leveragedTokenFactory); /** * @notice Returns the Referrals contract. * @return referrals The Referrals contract. */ function referrals() external view returns (IReferrals referrals); /** * @notice Returns the Airdrop contract. * @return airdrop The Airdrop contract. */ function airdrop() external view returns (IAirdrop airdrop); /** * @notice Returns the Bonding contract. * @return bonding The Bonding contract. */ function bonding() external view returns (IBonding bonding); /** * @notice Returns the address for the Treasury contract. * @return treasury The address of the Treasury contract. */ function treasury() external view returns (address treasury); /** * @notice Returns the Vesting contract. * @return vesting The Vesting contract. */ function vesting() external view returns (IVesting vesting); /** * @notice Returns the TLX contract. * @return tlx The TLX contract. */ function tlx() external view returns (ITlxToken tlx); /** * @notice Returns the Staker contract. * @return staker The Staker contract. */ function staker() external view returns (IStaker staker); /** * @notice Returns the ZapSwap contract. * @return zapSwap The ZapSwap contract. */ function zapSwap() external view returns (IZapSwap zapSwap); /** * @notice Returns the base asset. * @return baseAsset The base asset. */ function baseAsset() external view returns (IERC20Metadata baseAsset); /** * @notice Returns the SynthetixHandler contract. * @return synthetixHandler The SynthetixHandler contract. */ function synthetixHandler() external view returns (ISynthetixHandler synthetixHandler); /** * @notice Returns the address for the POL token. * @return pol The address of the POL token. */ function pol() external view returns (address pol); /** * @notice Returns the Parameter Provider contract. * @return parameterProvider The Parameter Provider contract. */ function parameterProvider() external view returns (IParameterProvider parameterProvider); /** * @notice Returns if the given `account` is permitted to rebalance leveraged tokens. * @param account The address of the account to be checked. * @return isRebalancer Whether the account is permitted to rebalance leveraged tokens. */ function isRebalancer( address account ) external view returns (bool isRebalancer); /** * @notice Returns the list of rebalancers. * @return rebalancers The list of rebalancers. */ function rebalancers() external view returns (address[] memory rebalancers); /** * @notice Returns the address for the Rebalance Fee Receiver. * @return rebalanceFeeReceiver The address of the Rebalance Fee Receiver. */ function rebalanceFeeReceiver() external view returns (address rebalanceFeeReceiver); /** * @notice Returns the owner of all TLX contracts. * @return owner The owner of all TLX contracts. */ function owner() external view returns (address owner); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.13; import {IERC20Metadata} from "openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol"; interface ILeveragedToken is IERC20Metadata { event Minted( address indexed account, uint256 leveragedTokenAmount, uint256 baseAssetAmount ); event Redeemed( address indexed account, uint256 leveragedTokenAmount, uint256 baseAssetAmount ); event Rebalanced(uint256 currentLeverage); event PausedSet(bool isPaused); error InsufficientAmount(); error CannotRebalance(); error LeverageUpdatePending(); error Paused(); error ExceedsLimit(); error Inactive(); /** * @notice Mints some leveraged tokens to the caller with the given baseAmountIn of the base asset. * @param baseAmountIn The amount of the base asset to mint with. * @param minLeveragedTokenAmountOut The minimum amount of leveragedTokens to mint (reverts otherwise). * @return leveragedTokenAmountOut The amount of leveragedTokens minted. */ function mint( uint256 baseAmountIn, uint256 minLeveragedTokenAmountOut ) external returns (uint256 leveragedTokenAmountOut); /** * @notice Redeems leveragedTokenAmount of the leveraged token and returns the base asset. * @param leveragedTokenAmount The amount of the leveraged token to redeem. * @param minBaseAmountReceived The minimum amount of the base asset to receive (reverts otherwise). * @return baseAmountReceived The amount of the base asset received. */ function redeem( uint256 leveragedTokenAmount, uint256 minBaseAmountReceived ) external returns (uint256 baseAmountReceived); /** * @notice Rebalances the position to the target leverage. */ function rebalance() external; /** * @notice Charges the streaming fee. * @dev This is done automatically during rebalances, but we might want to do this more frequently. */ function chargeStreamingFee() external; /** * @notice Sets if the leveraged token is paused. * @dev Only callable by the contract owner. * @param isPaused If the leveraged token should be paused or not. */ function setIsPaused(bool isPaused) external; /** * @notice Returns the target asset of the leveraged token. * @return targetAsset The target asset of the leveraged token. */ function targetAsset() external view returns (string memory targetAsset); /** * @notice Returns the target leverage of the leveraged token. * @return targetLeverage The target leverage of the leveraged token. */ function targetLeverage() external view returns (uint256 targetLeverage); /** * @notice Returns if the leveraged token is long or short. * @return isLong `true` if the leveraged token is long and `false` if the leveraged token is short. */ function isLong() external view returns (bool isLong); /** * @notice Returns if the leveraged token is active, * @dev A token is active if it still has some positive exchange rate (i.e. has not been liquidated). * @return isActive If the leveraged token is active. */ function isActive() external view returns (bool isActive); /** * @notice Returns if the leveraged token is paused, * @dev If a token is paused, deposits are disabled. * @return isPaused If the leveraged token is paused. */ function isPaused() external view returns (bool isPaused); /** * @notice Returns the rebalance threshold. * @dev Represented as a percent in 18 decimals, e.g. 20% = 0.2e18. * @return rebalanceThreshold The rebalance threshold. */ function rebalanceThreshold() external view returns (uint256 rebalanceThreshold); /** * @notice Returns the exchange rate from one leveraged token to one base asset. * @dev In 18 decimals. * @return exchangeRate The exchange rate. */ function exchangeRate() external view returns (uint256 exchangeRate); /** * @notice Returns the expected slippage from making an adjustment to a position. * @param baseAmount Margin amount to deposit in units of base asset. * @param isDeposit If the adjustment is a deposit. * @return slippage Slippage in units of base asset. * @return isLoss Whether the slippage is a loss. */ function computePriceImpact( uint256 baseAmount, bool isDeposit ) external view returns (uint256 slippage, bool isLoss); /** * @notice Returns if the leveraged token can be rebalanced. * @return canRebalance If the leveraged token can be rebalanced. */ function canRebalance() external view returns (bool canRebalance); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.13; interface ISynthetixHandlerStorage { function increaseMintedAmount( address leveragedToken, address user, uint256 amount ) external; function decreaseMintedAmount( address leveragedToken_, address user_, uint256 amount_ ) external; function setRedemptionFeeDuration(uint256 redemptionFeeDuration) external; function setRedemptionFeeStart(uint256 redemptionFeeStart) external; function decayingRedemptionFee( address leveragedToken, address user, uint256 amount ) external view returns (uint256); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.13; interface IPerpsV2MarketSettings { struct Parameters { uint takerFee; uint makerFee; uint takerFeeDelayedOrder; uint makerFeeDelayedOrder; uint takerFeeOffchainDelayedOrder; uint makerFeeOffchainDelayedOrder; uint maxLeverage; uint maxMarketValue; uint maxFundingVelocity; uint skewScale; uint nextPriceConfirmWindow; uint delayedOrderConfirmWindow; uint minDelayTimeDelta; uint maxDelayTimeDelta; uint offchainDelayedOrderMinAge; uint offchainDelayedOrderMaxAge; bytes32 offchainMarketKey; uint offchainPriceDivergence; uint liquidationPremiumMultiplier; uint liquidationBufferRatio; uint maxLiquidationDelta; uint maxPD; } function takerFee(bytes32 _marketKey) external view returns (uint); function makerFee(bytes32 _marketKey) external view returns (uint); function takerFeeDelayedOrder( bytes32 _marketKey ) external view returns (uint); function makerFeeDelayedOrder( bytes32 _marketKey ) external view returns (uint); function takerFeeOffchainDelayedOrder( bytes32 _marketKey ) external view returns (uint); function makerFeeOffchainDelayedOrder( bytes32 _marketKey ) external view returns (uint); function nextPriceConfirmWindow( bytes32 _marketKey ) external view returns (uint); function delayedOrderConfirmWindow( bytes32 _marketKey ) external view returns (uint); function offchainDelayedOrderMinAge( bytes32 _marketKey ) external view returns (uint); function offchainDelayedOrderMaxAge( bytes32 _marketKey ) external view returns (uint); function maxLeverage(bytes32 _marketKey) external view returns (uint); function maxMarketValue(bytes32 _marketKey) external view returns (uint); function maxFundingVelocity( bytes32 _marketKey ) external view returns (uint); function skewScale(bytes32 _marketKey) external view returns (uint); function minDelayTimeDelta(bytes32 _marketKey) external view returns (uint); function maxDelayTimeDelta(bytes32 _marketKey) external view returns (uint); function offchainMarketKey( bytes32 _marketKey ) external view returns (bytes32); function offchainPriceDivergence( bytes32 _marketKey ) external view returns (uint); function liquidationPremiumMultiplier( bytes32 _marketKey ) external view returns (uint); function maxPD(bytes32 _marketKey) external view returns (uint); function maxLiquidationDelta( bytes32 _marketKey ) external view returns (uint); function liquidationBufferRatio( bytes32 _marketKey ) external view returns (uint); function parameters( bytes32 _marketKey ) external view returns (Parameters memory); function minKeeperFee() external view returns (uint); function maxKeeperFee() external view returns (uint); function liquidationFeeRatio() external view returns (uint); function minInitialMargin() external view returns (uint); function keeperLiquidationFee() external view returns (uint); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.13; interface IPerpsV2MarketData { struct FeeRates { uint takerFee; uint makerFee; uint takerFeeDelayedOrder; uint makerFeeDelayedOrder; uint takerFeeOffchainDelayedOrder; uint makerFeeOffchainDelayedOrder; } struct MarketLimits { uint maxLeverage; uint maxMarketValue; } struct FundingParameters { uint maxFundingVelocity; uint skewScale; } struct Sides { uint long; uint short; } struct MarketSizeDetails { uint marketSize; Sides sides; uint marketDebt; int marketSkew; } struct PriceDetails { uint price; bool invalid; } struct MarketData { address market; bytes32 baseAsset; bytes32 marketKey; FeeRates feeRates; MarketLimits limits; FundingParameters fundingParameters; MarketSizeDetails marketSizeDetails; PriceDetails priceDetails; } function marketDetailsForKey( bytes32 marketKey ) external view returns (MarketData memory); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.13; pragma experimental ABIEncoderV2; import "./IPerpsV2MarketBaseTypes.sol"; // Helper Interface - used in tests and to provide a consolidated PerpsV2 interface for users/integrators. interface IPerpsV2MarketConsolidated { /* ========== TYPES ========== */ enum OrderType { Atomic, Delayed, Offchain } enum Status { Ok, InvalidPrice, InvalidOrderType, PriceOutOfBounds, CanLiquidate, CannotLiquidate, MaxMarketSizeExceeded, MaxLeverageExceeded, InsufficientMargin, NotPermitted, NilOrder, NoPositionOpen, PriceTooVolatile, PriceImpactToleranceExceeded, PositionFlagged, PositionNotFlagged } /* @dev: See IPerpsV2MarketBaseTypes */ struct Position { uint64 id; uint64 lastFundingIndex; uint128 margin; uint128 lastPrice; int128 size; } /* @dev: See IPerpsV2MarketBaseTypes */ struct DelayedOrder { bool isOffchain; int128 sizeDelta; uint128 desiredFillPrice; uint128 targetRoundId; uint128 commitDeposit; uint128 keeperDeposit; uint256 executableAtTime; uint256 intentionTime; bytes32 trackingCode; } /* ========== Views ========== */ /* ---------- Market Details ---------- */ function marketKey() external view returns (bytes32 key); function baseAsset() external view returns (bytes32 key); function marketSize() external view returns (uint128 size); function marketSkew() external view returns (int128 skew); function fundingLastRecomputed() external view returns (uint32 timestamp); function fundingRateLastRecomputed() external view returns (int128 fundingRate); function fundingSequence( uint index ) external view returns (int128 netFunding); function positions(address account) external view returns (Position memory); function delayedOrders( address account ) external view returns (DelayedOrder memory); function assetPrice() external view returns (uint price, bool invalid); function fillPrice( int sizeDelta ) external view returns (uint price, bool invalid); function marketSizes() external view returns (uint long, uint short); function marketDebt() external view returns (uint debt, bool isInvalid); function currentFundingRate() external view returns (int fundingRate); function currentFundingVelocity() external view returns (int fundingVelocity); function unrecordedFunding() external view returns (int funding, bool invalid); function fundingSequenceLength() external view returns (uint length); /* ---------- Position Details ---------- */ function notionalValue( address account ) external view returns (int value, bool invalid); function profitLoss( address account ) external view returns (int pnl, bool invalid); function accruedFunding( address account ) external view returns (int funding, bool invalid); function remainingMargin( address account ) external view returns (uint marginRemaining, bool invalid); function accessibleMargin( address account ) external view returns (uint marginAccessible, bool invalid); function liquidationPrice( address account ) external view returns (uint price, bool invalid); function liquidationFee(address account) external view returns (uint); function isFlagged(address account) external view returns (bool); function canLiquidate(address account) external view returns (bool); function orderFee( int sizeDelta, IPerpsV2MarketBaseTypes.OrderType orderType ) external view returns (uint fee, bool invalid); function postTradeDetails( int sizeDelta, uint tradePrice, IPerpsV2MarketBaseTypes.OrderType orderType, address sender ) external view returns ( uint margin, int size, uint price, uint liqPrice, uint fee, Status status ); /* ========== Market ========== */ function recomputeFunding() external returns (uint lastIndex); function transferMargin(int marginDelta) external; function withdrawAllMargin() external; function modifyPosition(int sizeDelta, uint desiredFillPrice) external; function modifyPositionWithTracking( int sizeDelta, uint desiredFillPrice, bytes32 trackingCode ) external; function closePosition(uint desiredFillPrice) external; function closePositionWithTracking( uint desiredFillPrice, bytes32 trackingCode ) external; /* ========== Liquidate ========== */ function flagPosition(address account) external; function liquidatePosition(address account) external; function forceLiquidatePosition(address account) external; /* ========== Delayed Intent ========== */ function submitCloseOffchainDelayedOrderWithTracking( uint desiredFillPrice, bytes32 trackingCode ) external; function submitCloseDelayedOrderWithTracking( uint desiredTimeDelta, uint desiredFillPrice, bytes32 trackingCode ) external; function submitDelayedOrder( int sizeDelta, uint desiredTimeDelta, uint desiredFillPrice ) external; function submitDelayedOrderWithTracking( int sizeDelta, uint desiredTimeDelta, uint desiredFillPrice, bytes32 trackingCode ) external; function submitOffchainDelayedOrder( int sizeDelta, uint desiredFillPrice ) external; function submitOffchainDelayedOrderWithTracking( int sizeDelta, uint desiredFillPrice, bytes32 trackingCode ) external; /* ========== Delayed Execution ========== */ function executeDelayedOrder(address account) external; function executeOffchainDelayedOrder( address account, bytes[] calldata priceUpdateData ) external payable; function cancelDelayedOrder(address account) external; function cancelOffchainDelayedOrder(address account) external; /* ========== Events ========== */ event PositionModified( uint indexed id, address indexed account, uint margin, int size, int tradeSize, uint lastPrice, uint fundingIndex, uint fee, int skew ); event MarginTransferred(address indexed account, int marginDelta); event PositionFlagged( uint id, address account, address flagger, uint price, uint timestamp ); event PositionLiquidated( uint id, address account, address liquidator, int size, uint price, uint flaggerFee, uint liquidatorFee, uint stakersFee ); event FundingRecomputed( int funding, int fundingRate, uint index, uint timestamp ); event PerpsTracking( bytes32 indexed trackingCode, bytes32 baseAsset, bytes32 marketKey, int sizeDelta, uint fee ); event DelayedOrderRemoved( address indexed account, bool isOffchain, uint currentRoundId, int sizeDelta, uint targetRoundId, uint commitDeposit, uint keeperDeposit, bytes32 trackingCode ); event DelayedOrderSubmitted( address indexed account, bool isOffchain, int sizeDelta, uint targetRoundId, uint intentionTime, uint executableAtTime, uint commitDeposit, uint keeperDeposit, bytes32 trackingCode ); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.13; interface IPerpsV2MarketBaseTypes { /* ========== TYPES ========== */ enum OrderType { Atomic, Delayed, Offchain } enum Status { Ok, InvalidPrice, InvalidOrderType, PriceOutOfBounds, CanLiquidate, CannotLiquidate, MaxMarketSizeExceeded, MaxLeverageExceeded, InsufficientMargin, NotPermitted, NilOrder, NoPositionOpen, PriceTooVolatile, PriceImpactToleranceExceeded, PositionFlagged, PositionNotFlagged } // If margin/size are positive, the position is long; if negative then it is short. struct Position { uint64 id; uint64 lastFundingIndex; uint128 margin; uint128 lastPrice; int128 size; } // Delayed order storage struct DelayedOrder { bool isOffchain; // flag indicating the delayed order is offchain int128 sizeDelta; // difference in position to pass to modifyPosition uint128 desiredFillPrice; // desired fill price as usd used on fillPrice at execution uint128 targetRoundId; // price oracle roundId using which price this order needs to executed uint128 commitDeposit; // the commitDeposit paid upon submitting that needs to be refunded if order succeeds uint128 keeperDeposit; // the keeperDeposit paid upon submitting that needs to be paid / refunded on tx confirmation uint256 executableAtTime; // The timestamp at which this order is executable at uint256 intentionTime; // The block timestamp of submission bytes32 trackingCode; // tracking code to emit on execution for volume source fee sharing } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.13; library ScaledNumber { uint8 internal constant _DEFAULT_DECIMALS = 18; function div( uint256 value, uint256 divisor ) internal pure returns (uint256) { return (value * 10 ** _DEFAULT_DECIMALS) / divisor; } function mul( uint256 value, uint256 multiplier ) internal pure returns (uint256) { return (value * multiplier) / 10 ** _DEFAULT_DECIMALS; } function absSub(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a - b : b - a; } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.13; library AddressKeys { bytes32 public constant LEVERAGED_TOKEN_FACTORY = "leveragedTokenFactory"; bytes32 public constant REFERRALS = "referrals"; bytes32 public constant BASE_ASSET = "baseAsset"; bytes32 public constant AIRDROP = "airdrop"; bytes32 public constant BONDING = "bonding"; bytes32 public constant TREASURY = "treasury"; bytes32 public constant VESTING = "vesting"; bytes32 public constant TLX = "tlx"; bytes32 public constant STAKER = "staker"; bytes32 public constant GENESIS_LOCKER = "genesisLocker"; bytes32 public constant SYNTHETIX_HANDLER = "synthetixHandler"; bytes32 public constant POL = "pol"; bytes32 public constant PARAMETER_PROVIDER = "parameterProvider"; bytes32 public constant REBALANCE_FEE_RECEIVER = "rebalanceFeeReceiver"; bytes32 public constant ZAP_SWAP = "zapSwap"; bytes32 public constant OWNER = "owner"; bytes32 public constant UPKEEP_REGISTRY = "upkeepRegistry"; bytes32 public constant SYNTHETIX_HANDLER_STORAGE = "synthetixHandlerStorage"; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC-20 standard. */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.13; interface ILeveragedTokenFactory { event NewLeveragedToken(address indexed token); error ZeroLeverage(); error MaxLeverage(); error MaxOfTwoDecimals(); error AssetNotSupported(); error NotInactive(); /** * @notice Creates a new Long and Short Leveraged Token for the given target asset and leverage. * @dev Reverts if a Leveraged Token for the given target asset and leverage already exists. * @param targetAsset The target asset of the Leveraged Token. * @param targetLeverage The target leverage of the Leveraged Token (18 decimals). * @param rebalanceThreshold The threshold for rebalancing (18 decimals). * @return longToken The address of the Long Leveraged Token. * @return shortToken The address of the Short Leveraged Token. */ function createLeveragedTokens( string calldata targetAsset, uint256 targetLeverage, uint256 rebalanceThreshold ) external returns (address longToken, address shortToken); /** * @notice Redeploys a Leveraged Token when the old one has been liquidated and is inactive. * @dev Reverts if the Leveraged Token doesn't exist or is not inactive. * @param tokenAddress The address of the Leveraged Token that has been liquidated and is inactive. * @return newToken The address of the new Leveraged Token. */ function redeployInactiveToken( address tokenAddress ) external returns (address newToken); /** * @notice Returns all Leveraged Tokens. * @return tokens The addresses of all Leveraged Tokens. */ function allTokens() external view returns (address[] memory tokens); /** * @notice Returns all Long Leveraged Tokens. * @return tokens The addresses of all Long Leveraged Tokens. */ function longTokens() external view returns (address[] memory tokens); /** * @notice Returns all Short Leveraged Tokens. * @return tokens The addresses of all Short Leveraged Tokens. */ function shortTokens() external view returns (address[] memory tokens); /** * @notice Returns all Leveraged Tokens for the given target asset. * @param targetAsset The target asset of the Leveraged Tokens. * @return tokens The addresses of all Leveraged Tokens for the given target asset. */ function allTokens( string calldata targetAsset ) external view returns (address[] memory tokens); /** * @notice Returns all Long Leveraged Tokens for the given target asset. * @param targetAsset The target asset of the Long Leveraged Tokens. * @return tokens The addresses of all Long Leveraged Tokens for the given target asset. */ function longTokens( string calldata targetAsset ) external view returns (address[] memory tokens); /** * @notice Returns all Short Leveraged Tokens for the given target asset. * @param targetAsset The target asset of the Short Leveraged Tokens. * @return tokens The addresses of all Short Leveraged Tokens for the given target asset. */ function shortTokens( string calldata targetAsset ) external view returns (address[] memory tokens); /** * @notice Returns the Leveraged Token for the given target asset and leverage. * @param targetAsset The target asset of the Leveraged Token. * @param targetLeverage The target leverage of the Leveraged Token (2 decimals). * @param isLong If the Leveraged Token is long or short. * @return token The address of the Leveraged Token. */ function token( string calldata targetAsset, uint256 targetLeverage, bool isLong ) external view returns (address token); /** * @notice Returns if the Leveraged Token for the given target asset and leverage exists. * @param targetAsset The target asset of the Leveraged Token. * @param targetLeverage The target leverage of the Leveraged Token (2 decimals). * @param isLong If the Leveraged Token is long or short. * @return exists If the Leveraged Token exists. */ function tokenExists( string calldata targetAsset, uint256 targetLeverage, bool isLong ) external view returns (bool exists); /** * @notice Returns the Leveraged Tokens inverse pair (e.g. ETH3L -> ETH3S). * @param token The address of the Leveraged Token. * @return pair The address of the Leveraged Tokens inverse pair. */ function pair(address token) external view returns (address pair); /** * @notice Returns if the given token is a Leveraged Token. * @param token The address of the token. * @return isLeveragedToken If the given token is a Leveraged Token. */ function isLeveragedToken( address token ) external view returns (bool isLeveragedToken); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.13; interface IReferrals { event Registered(address indexed user, bytes32 code); event SetReferral(address indexed user, bytes32 code); event RebateSet(uint256 rebate); event EarningsSet(uint256 earnings); event ReferralEarned(address indexed user, uint256 amount); event RebateEarned(address indexed user, uint256 amount); event EarningsClaimed(address indexed user, uint256 amount); error AlreadyRegistered(); error InvalidCode(); error CodeTaken(); error AlreadyOpen(); error NotChanged(); error InvalidAmount(); /** * @notice Takes the referral earnings from the given fees for the given user. * @param fees The fees to take the earnings from. * @param user The user to take the earnings for. * @return earnings The earnings taken. */ function takeEarnings( uint256 fees, address user ) external returns (uint256 earnings); /** * @notice Claims the referral earnings for the sender. * @return earnings The earnings claimed. */ function claimEarnings() external returns (uint256 earnings); /** * @notice Registers the given code for the sender. * @param code The code to register. */ function register(address referrer, bytes32 code) external; /** * @notice Sets the referral code for the sender. * @dev Reverts if the user has already set a code. * @param code The code to use. */ function setReferral(bytes32 code) external; /** * @notice Sets the rebate percent. * @dev Can only be called by the owner. * @param rebatePercent The rebate percent to set. */ function setRebatePercent(uint256 rebatePercent) external; /** * @notice Sets the referral percent. * @dev Can only be called by the owner. * @param referralPercent The referral percent to set. */ function setReferralPercent(uint256 referralPercent) external; /** * @notice Returns the reabate for the given code. * @param code The code to get the rebate for. * @return rebate The rebate for the given code. */ function codeRebate(bytes32 code) external view returns (uint256 rebate); /** * @notice Returns the rebate for the given user. * @param user The user to get the rebate for. * @return rebate The rebate for the given user. */ function userRebate(address user) external view returns (uint256 rebate); /** * @notice Returns the referrer for the given code. * @param code The code to get the referrer for. * @return referrer The referrer for the given code. */ function referrer(bytes32 code) external view returns (address referrer); /** * @notice Returns the code for the given referrer * @param referrer The referrer to get the code for. * @return code The code for the given referrer. */ function code(address referrer) external view returns (bytes32 code); /** * @notice Returns the code for the given user. * @param user The user to get the code for. * @return code The code for the given user. */ function referral(address user) external view returns (bytes32 code); /** * @notice Returns the earnings for the given referrer. * @param referrer The referrer to get the earnings for. * @return earned The earnings for the given referrer. */ function earned(address referrer) external view returns (uint256 earned); /** * @notice Returns the rebate percent. * @dev As a percent of fees, e.g 10% as 0.1e18. * @return rebatePercent The rebate percent. */ function rebatePercent() external view returns (uint256 rebatePercent); /** * @notice Returns the referral percent. * @dev As a percent of fees, e.g 10% as 0.1e18. * @return referralPercent The referral percent. */ function referralPercent() external view returns (uint256 referralPercent); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.13; interface IAirdrop { event MerkleRootUpdated(bytes32 merkleRoot); event Claimed(address indexed account, uint256 amount); event UnclaimedRecovered(uint256 amount); error ClaimPeriodOver(); error InvalidMerkleProof(); error AlreadyClaimed(); error AirdropCompleted(); error EverythingClaimed(); error ClaimStillOngoing(); /** * @notice Claim tokens from the airdrop. * @param amount The amount of tokens to claim. * @param merkleProof The merkle proof for the account. */ function claim(uint256 amount, bytes32[] calldata merkleProof) external; /** * @notice Update the merkle root for the airdrop. * @param merkleRoot_ The new merkle root. */ function updateMerkleRoot(bytes32 merkleRoot_) external; /** * @notice Recover unclaimed tokens to the treasury. */ function recoverUnclaimed() external; /** * @notice Returns the merkle root for the airdrop. * @return merkleRoot The merkle root for the airdrop. */ function merkleRoot() external view returns (bytes32 merkleRoot); /** * @notice Returns if the `account` has claimed their airdrop. * @param account The account to check. * @return hasClaimed If the `account` has claimed their airdrop. */ function hasClaimed( address account ) external view returns (bool hasClaimed); /** * @notice Returns the deadline for the airdrop. * @return deadline The deadline for the airdrop. */ function deadline() external view returns (uint256 deadline); /** * @notice Returns the total amount of tokens claimed. * @return totalClaimed The total amount of tokens claimed. */ function totalClaimed() external view returns (uint256 totalClaimed); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.13; interface IBonding { event Bonded( address indexed account, address indexed leveragedToken, uint256 leveragedTokenAmount, uint256 tlxTokensReceived ); event Migrated(uint256 amount); event BaseForAllTlxSet(uint256 value); event Launched(); error MinTlxNotReached(); error ExceedsAvailable(); error BondingNotLive(); error AmountIsZero(); error BondingAlreadyLive(); error AlreadyMigrated(); error InactiveToken(); /** * @notice Bond leveraged tokens for TLX. * @param leveragedToken The address of the leveraged token to bond. * @param leveragedTokenAmount The amount of leveraged tokens to bond. * @param minTlxTokensReceived The minimum amount of TLX tokens to receive. * @return tlxTokensReceived The amount of TLX tokens received. */ function bond( address leveragedToken, uint256 leveragedTokenAmount, uint256 minTlxTokensReceived ) external returns (uint256 tlxTokensReceived); /** * @notice Sets the base for all TLX. * @dev Reverts if the caller is not the owner. * @param baseForAllTlx The new base for all TLX. */ function setBaseForAllTlx(uint256 baseForAllTlx) external; /** * @notice Sets the bonding to live. * @dev Reverts if the caller is not the owner. */ function launch() external; /** * @notice Migrate the TLX tokens to the new bonding contract. * @dev Reverts if the caller is not the owner. */ function migrate() external; /** * @notice Returns if the bonding is live. * @return isLive If the bonding is live. */ function isLive() external view returns (bool isLive); /** * @notice Returns the exchange rate between leveraged tokens baseAsset value and TLX. * @return exchangeRate The exchange rate between leveraged tokens baseAsset value and TLX. */ function exchangeRate() external view returns (uint256 exchangeRate); /** * @notice Returns the amount of TLX tokens that can be bonded. * @return availableTlx The amount of TLX tokens that can be bonded. */ function availableTlx() external view returns (uint256 availableTlx); /** * @notice Returns the total amount of TLX tokens bonded. * @return totalTlxBonded The total amount of TLX tokens bonded. */ function totalTlxBonded() external view returns (uint256 totalTlxBonded); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.13; interface IVesting { struct VestingAmount { address account; uint256 amount; } struct VestingData { uint256 amount; uint256 claimed; } event Claimed(address indexed account, address indexed to, uint256 amount); event DelegateAdded(address indexed account, address indexed delegate); event DelegateRemoved(address indexed account, address indexed delegate); error NothingToClaim(); error InvalidDuration(); error NotAuthorized(); /** * @notice Claim vested tokens. */ function claim() external; /** * @notice Claim vested tokens for 'account' and send to 'to'. * @param account The address to claim the vested tokens for. * @param to The address to send the claimed tokens to. */ function claim(address account, address to) external; /** * @notice Adds a delegate for the caller. * @param delegate The address of the delegate to add. */ function addDelegate(address delegate) external; /** * @notice Removes a delegate for the caller. * @param delegate The address of the delegate to remove. */ function removeDelegate(address delegate) external; /** * @notice Get the amount of tokens that were allocated for vesting for `account`. * @param account The address to get the allocated amount for. * @return amount The amount of tokens allocated for vesting for `account`. */ function allocated(address account) external view returns (uint256 amount); /** * @notice Get the amount of tokens that have vested for `account`. * @param account The address to get the vested amount for. * @return amount The amount of tokens vested to `account`. */ function vested(address account) external view returns (uint256 amount); /** * @notice Get the amount of tokens that are vesting for `account`. * @param account The address to get the vesting amount for. * @return amount The amount of tokens vesting for `account`. */ function vesting(address account) external view returns (uint256 amount); /** * @notice Get the amount of tokens that have been claimed for `account`. * @param account The address to get the claimed amount for. * @return amount The amount of tokens claimed for `account`. */ function claimed(address account) external view returns (uint256 amount); /** * @notice Get the amount of tokens that are claimable for `account`. * @dev This is calculated as `vested` - `claimed`. * @param account The address to get the claimable amount for. * @return amount The amount of tokens claimable for `account`. */ function claimable(address account) external view returns (uint256 amount); /** * @notice Check if `delegate` is a delegate for `account`. * @param account The address to check the delegate for. * @param delegate The address to check if it is a delegate. * @return isDelegate True if `delegate` is a delegate for `account`. */ function isDelegate( address account, address delegate ) external view returns (bool isDelegate); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.13; import {IERC20Metadata} from "openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol"; interface ITlxToken is IERC20Metadata {}
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.13; import {IRewardsStreaming} from "./IRewardsStreaming.sol"; import {Unstakes} from "../libraries/Unstakes.sol"; interface IStaker is IRewardsStreaming { event Staked( address indexed accountFrom, address indexed accountTo, uint256 amount ); event PreparedUnstake(address indexed account, uint256 amount, uint256 id); event Unstaked( address indexed accountFrom, address indexed accountTo, uint256 amount ); event Restaked(address indexed account, uint256 amount); error NotUnstaked(); error ClaimingNotEnabled(); error ClaimingAlreadyEnabled(); error ZeroBalance(); /** * @notice Stakes TLX tokens for the caller. * @param amount The amount of TLX tokens to stake. */ function stake(uint256 amount) external; /** * @notice Stakes TLX tokens for the caller for the account. * @param amount The amount of TLX tokens to stake. * @param account The account to stake the TLX tokens to. */ function stakeFor(uint256 amount, address account) external; /** * @notice Prepares the caller's staked TLX tokens for unstaking. * @return id The ID of the withdrawal to be unstaked. */ function prepareUnstake(uint256 amount) external returns (uint256 id); /** * @notice Unstakes the caller's TLX tokens. * @param withdrawalId The ID of the withdrawal to unstake. */ function unstake(uint256 withdrawalId) external; /** * @notice Restakes the caller's prepared TLX tokens. * @param withdrawalId The ID of the withdrawal to restake. */ function restake(uint256 withdrawalId) external; /** * @notice Unstakes the caller's TLX tokens for the given account. * @param account The account to send the TLX tokens to. * @param withdrawalId The ID of the withdrawal to unstake. */ function unstakeFor(address account, uint256 withdrawalId) external; /** * @notice Enables claiming for stakers. * @dev This can only be called by the owner. */ function enableClaiming() external; /** * @notice Returns if claiming is enabled for stakers. * @return claimingEnabled Whether claiming is enabled for stakers. */ function claimingEnabled() external view returns (bool claimingEnabled); /** * @notice Returns the symbol of the Staker. * @return symbol The symbol of the Staker. */ function symbol() external view returns (string memory symbol); /** * @notice Returns the name of the Staker. * @return name The name of the Staker. */ function name() external view returns (string memory name); /** * @notice Returns the total amount of TLX tokens prepared for unstaking. * @return amount The total amount of TLX tokens prepared for unstaking. */ function totalPrepared() external view returns (uint256 amount); /** * @notice Returns all the queued unstakes for the given account. * @param account The account to return the unstakes for. * @return unstakes All the queued unstakes for the given account. */ function listQueuedUnstakes( address account ) external view returns (Unstakes.UserUnstakeData[] memory unstakes); /** * @notice Returns the delay the user must wait when unstakeing. * @return delay The delay the user must wait when unstakeing. */ function unstakeDelay() external view returns (uint256 delay); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.13; interface IParameterProvider { struct Parameter { bytes32 key; uint256 value; } event ParameterUpdated(bytes32 indexed key, uint256 value); event RebalanceThresholdUpdated(address leveragedToken, uint256 value); error InvalidRebalanceThreshold(); error NonExistentParameter(bytes32 key); /** * @notice Updates a parameter for the given key. * @param key The key of the parameter to be updated. * @param value The value of the parameter to be updated. */ function updateParameter(bytes32 key, uint256 value) external; /** * @notice Updates the rebalance threshold for the `leveragedToken`. * @param leveragedToken The address of the leveraged token. * @param value The new rebalance threshold. */ function updateRebalanceThreshold( address leveragedToken, uint256 value ) external; /** * @notice Returns the parameter for a given key. * @param key The key of the parameter to be returned. * @return value The parameter for the given key. */ function parameterOf(bytes32 key) external view returns (uint256 value); /** * @notice Returns the redemption fee parameter. * @return redemptionFee The redemption fee parameter. */ function redemptionFee() external view returns (uint256); /** * @notice Returns the streaming fee parameter. * @return streamingFee The streaming fee parameter. */ function streamingFee() external view returns (uint256); /** * @notice Returns the rebalance fee charged for rebalances in baseAsset. * @return rebalanceFee The rebalance fee. */ function rebalanceFee() external view returns (uint256 rebalanceFee); /** * @notice Returns the percent buffer applied on the `maxBaseAssetAmount`. * @return maxBaseAssetAmountBuffer The percent buffer applied on the `maxBaseAssetAmount`. */ function maxBaseAssetAmountBuffer() external view returns (uint256 maxBaseAssetAmountBuffer); /** * @notice Returns all parameters. * @return parameters All parameters. */ function parameters() external view returns (Parameter[] memory parameters); /** * @notice Returns the rebalance threshold for the `leveragedToken`. * @param leveragedToken The address of the leveraged token. * @return rebalanceThreshold The rebalance threshold of the `leveragedToken`. */ function rebalanceThreshold( address leveragedToken ) external view returns (uint256 rebalanceThreshold); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.13; interface IZapSwap { struct SwapData { bool supported; bool direct; address bridgeAsset; bool zapAssetSwapStable; bool baseAssetSwapStable; address zapAssetFactory; address baseAssetFactory; bool swapZapAssetOnUni; uint24 uniPoolFee; } event Minted( address indexed account, address indexed leveragedToken, address assetIn, uint256 amountIn, uint256 leveragedTokenAmountOut ); event Redeemed( address indexed account, address indexed leveragedToken, uint256 leveragedTokenAmountIn, address assetOut, uint256 amountOut ); event AssetSwapDataUpdated(address indexed zapAsset, SwapData swapData); event AssetSwapDataRemoved(address indexed zapAsset); error UnsupportedAsset(); error BridgeAssetNotSupported(); error BridgeAssetDependency(address dependentZapAsset); /** * @notice Sets the swap data for a zap asset. * @param zapAsset The address of the new zap asset. * @param swapData The swap data describing the swap route. */ function setAssetSwapData( address zapAsset, SwapData memory swapData ) external; /** * @notice Removes an asset from supported zap assets. * @param zapAsset The address of the zap asset to be removed. */ function removeAssetSwapData(address zapAsset) external; /** * @notice Returns the swap data of a zap asset. * @param zapAsset The address of the zap asset. * @return swapData The swap data of the zap asset. */ function swapData( address zapAsset ) external returns (SwapData memory swapData); /** * @notice Returns all assets supported by the zap. * @return assets An array of all assets supported by the zap. */ function supportedZapAssets() external returns (address[] memory assets); /** * @notice Swaps the zap asset for the base asset and mints the target leveraged tokens for the caller. * @param zapAssetAddress The address of the asset used for minting. * @param leveragedTokenAddress Address of target leveraged token to mint. * @param zapAssetAmountIn The amount of the zap asset to mint with. * @param minLeveragedTokenAmountOut The minimum amount of leveraged tokens to receive (reverts otherwise). * @return leveragedTokenAmountOut The amount of leveraged tokens minted. */ function mint( address zapAssetAddress, address leveragedTokenAddress, uint256 zapAssetAmountIn, uint256 minLeveragedTokenAmountOut ) external returns (uint256 leveragedTokenAmountOut); /** * @notice Redeems the target leveraged tokens, swaps the base asset for the zap asset and returns the zap asset to the caller. * @param zapAssetAddress The address of the asset received upon redeeming. * @param leveragedTokenAddress The address of the target leveraged token to redeem. * @param leveragedTokenAmountIn The amount of the leveraged tokens to redeem. * @param minZapAssetAmountOut The minimum amount of the zap asset to receive (reverts otherwise). * @return zapAssetAmountOut The amount of zap asset received. */ function redeem( address zapAssetAddress, address leveragedTokenAddress, uint256 leveragedTokenAmountIn, uint256 minZapAssetAmountOut ) external returns (uint256 zapAssetAmountOut); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-20 standard as defined in the ERC. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.13; interface IRewardsStreaming { event Claimed(address indexed account, uint256 amount); event DonatedRewards(address indexed account, uint256 amount); error ZeroAmount(); error InsufficientBalance(); /** * @notice Claims the caller's rewards. */ function claim() external; /** * @notice Donates an amount of the reward token to the staker. */ function donateRewards(uint256 amount) external; /** * @notice Returns the amount of TLX tokens staked for the given account. * @param account The account to return the staked TLX tokens for. * @return amount The amount of TLX tokens staked for the given account. */ function balanceOf(address account) external view returns (uint256 amount); /** * @notice Returns the amount of TLX tokens staked for the given account * minus the amount queued for withdrawal. * @param account The account to return the staked TLX tokens for. * @return amount The amount of TLX tokens staked and not queued for the given account. */ function activeBalanceOf( address account ) external view returns (uint256 amount); /** * @notice Returns the total amount of TLX tokens staked. * @return amount The total amount of TLX tokens staked. */ function totalStaked() external view returns (uint256 amount); /** * @notice Returns the amount of reward tokens claimable for the given account. * @param account The account to return the claimable reward tokens for. * @return amount The amount of reward tokens claimable for the given account. */ function claimable(address account) external view returns (uint256 amount); /** * @notice Returns the number of decimals the Staker's token uses. * @return decimals The number of decimals the Staker's token uses. */ function decimals() external view returns (uint8 decimals); /** * @notice Returns the address of the reward token. * @return rewardToken The address of the reward token. */ function rewardToken() external view returns (address rewardToken); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.13; import {EnumerableSet} from "openzeppelin-contracts/contracts/utils/structs/EnumerableSet.sol"; import {Errors} from "./Errors.sol"; library Unstakes { using EnumerableSet for EnumerableSet.UintSet; struct UserUnstakeData { uint256 id; uint256 amount; uint256 unstakeTime; } struct UserUnstake { uint192 amount; uint64 unstakeTime; } struct UserUnstakes { mapping(uint256 => UserUnstake) withdrawals; EnumerableSet.UintSet ids; uint64 nextId; uint192 totalQueued; } function queue( UserUnstakes storage self_, uint256 amount_, uint256 unstakeTime_ ) internal returns (uint256) { uint256 id = self_.nextId; self_.withdrawals[id] = UserUnstake({ amount: uint192(amount_), unstakeTime: uint64(unstakeTime_) }); self_.ids.add(id); self_.nextId++; self_.totalQueued += uint192(amount_); return id; } function remove( UserUnstakes storage self_, uint256 id_ ) internal returns (UserUnstake memory withdrawal) { if (!self_.ids.remove(id_)) revert Errors.DoesNotExist(); withdrawal = self_.withdrawals[id_]; self_.totalQueued -= withdrawal.amount; delete self_.withdrawals[id_]; } function list( UserUnstakes storage self_ ) internal view returns (UserUnstakeData[] memory withdrawals) { uint256 length_ = self_.ids.length(); withdrawals = new UserUnstakeData[](length_); for (uint256 i_; i_ < length_; i_++) { uint256 id_ = self_.ids.at(i_); UserUnstake memory withdrawal = self_.withdrawals[id_]; withdrawals[i_] = UserUnstakeData({ id: id_, amount: withdrawal.amount, unstakeTime: withdrawal.unstakeTime }); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.20; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ```solidity * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position is the index of the value in the `values` array plus 1. // Position 0 is used to mean a value is not in the set. mapping(bytes32 value => uint256) _positions; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._positions[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We cache the value's position to prevent multiple reads from the same storage slot uint256 position = set._positions[value]; if (position != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 valueIndex = position - 1; uint256 lastIndex = set._values.length - 1; if (valueIndex != lastIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the lastValue to the index where the value to delete is set._values[valueIndex] = lastValue; // Update the tracked position of the lastValue (that was just moved) set._positions[lastValue] = position; } // Delete the slot where the moved value was stored set._values.pop(); // Delete the tracked position for the deleted slot delete set._positions[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._positions[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.13; library Errors { error NotAuthorized(); error AlreadyExists(); error DoesNotExist(); error ZeroAddress(); error SameAsCurrent(); error InvalidAddress(); error InsufficientAmount(); error NotLeveragedToken(); }
{ "remappings": [ "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "chainlink/=lib/chainlink/contracts/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "pyth-sdk-solidity/=lib/pyth-sdk-solidity/" ], "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
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"addressProvider_","type":"address"},{"internalType":"address","name":"perpsV2MarketData_","type":"address"},{"internalType":"address","name":"marketSettings_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ErrorGettingAssetPrice","type":"error"},{"inputs":[],"name":"ErrorGettingFillPrice","type":"error"},{"inputs":[],"name":"ErrorGettingIsLong","type":"error"},{"inputs":[],"name":"ErrorGettingOrderFee","type":"error"},{"inputs":[],"name":"ErrorGettingPnl","type":"error"},{"inputs":[],"name":"MaxMarketValueExceeded","type":"error"},{"inputs":[],"name":"NoMargin","type":"error"},{"inputs":[{"internalType":"address","name":"market_","type":"address"}],"name":"assetPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market_","type":"address"},{"internalType":"uint256","name":"leverage_","type":"uint256"},{"internalType":"uint256","name":"baseAmount_","type":"uint256"},{"internalType":"bool","name":"isLong_","type":"bool"},{"internalType":"bool","name":"isDeposit_","type":"bool"}],"name":"computePriceImpact","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market_","type":"address"},{"internalType":"uint256","name":"amount_","type":"uint256"}],"name":"depositMargin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"market_","type":"address"},{"internalType":"int256","name":"sizeDelta_","type":"int256"}],"name":"fillPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market_","type":"address"},{"internalType":"address","name":"account_","type":"address"}],"name":"hasOpenPosition","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market_","type":"address"},{"internalType":"address","name":"account_","type":"address"}],"name":"hasPendingLeverageUpdate","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market_","type":"address"},{"internalType":"address","name":"account_","type":"address"}],"name":"initialMargin","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"targetAsset_","type":"string"}],"name":"isAssetSupported","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market_","type":"address"},{"internalType":"address","name":"account_","type":"address"}],"name":"isLong","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market_","type":"address"},{"internalType":"address","name":"account_","type":"address"}],"name":"leverage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market_","type":"address"},{"internalType":"address","name":"account_","type":"address"},{"internalType":"uint256","name":"targetLeverage_","type":"uint256"}],"name":"leverageDeviationFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"targetAsset_","type":"string"}],"name":"market","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"targetAsset_","type":"string"}],"name":"maxLeverage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"targetAsset_","type":"string"},{"internalType":"address","name":"market_","type":"address"}],"name":"maxMarketValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market_","type":"address"},{"internalType":"address","name":"account_","type":"address"}],"name":"notionalValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market_","type":"address"},{"internalType":"address","name":"account_","type":"address"}],"name":"remainingMargin","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market_","type":"address"},{"internalType":"uint256","name":"leverage_","type":"uint256"},{"internalType":"bool","name":"isLong_","type":"bool"}],"name":"submitLeverageUpdate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"market_","type":"address"},{"internalType":"address","name":"account_","type":"address"}],"name":"totalValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market_","type":"address"},{"internalType":"uint256","name":"amount_","type":"uint256"}],"name":"withdrawMargin","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60e034620000d057601f62001cca38819003918201601f19168301916001600160401b03831184841017620000d557808492606094604052833981010312620000d0576200004d81620000eb565b906200006a60406200006260208401620000eb565b9201620000eb565b6001600160a01b0391821660805291811660c0521660a052604051611bc9908162000101823960805181818161014e0152611348015260a0518181816104950152818161062801528181610b740152611939015260c051818181610bb70152611ace0152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b0382168203620000d05756fe6040608081526004908136101561001557600080fd5b600091823560e01c8062343d1314610aaa57806303bf450b14610a785780630e0f7ba6146109f157806333a0980e146108e757806335a0794b146108435780633932d1ab146107fc5780633a5271f9146106be5780635317f109146105c957806359131aa81461025b578063689549e71461050d57806369af8ad114610441578063756a2b2914610413578063890914cf146102b45780638b51e38c14610286578063b883b05814610260578063ba1955841461025b578063c5ed3ba0146101ff578063cfd85f30146101cb5763ec697e13146100f157600080fd5b346101c75760203660031901126101c75780359067ffffffffffffffff82116101c3576101246101339236908301610f5b565b6001600160a01b039391611a31565b83516360e8efab60e11b8152918201526102809081816024817f000000000000000000000000000000000000000000000000000000000000000087165afa9182156101b9576020959261018c575b505051169051908152f35b6101ab9250803d106101b2575b6101a38183611003565b8101906111c1565b3880610181565b503d610199565b84513d87823e3d90fd5b8380fd5b8280fd5b5050346101fb57806003193601126101fb576020906101f46101eb610f2f565b60243590611870565b9051908152f35b5080fd5b8284346102585760a0366003190112610258575061021b610f2f565b606435801515810361025357608435908115158203610253576102459260443590602435906115cf565b825191825215156020820152f35b600080fd5b80fd5b610f89565b5050346101fb5760203660031901126101fb576020906101f4610281610f2f565b6114c9565b5050346101fb57806003193601126101fb576020906101f46102a6610f2f565b6102ae610f45565b9061145d565b50346101c757816003193601126101c7576102cd610f2f565b6102d5610f45565b835163645c04d560e11b81526001600160a01b039182168185015292610120929091839185916024918391165afa948515610408578095610324575b60208581880151600f0b15159051908152f35b90918381809597503d8311610401575b61033e8183611003565b81010312610258575082519182019082821067ffffffffffffffff8311176103ec57509060209384928452610372816111b4565b825261037f8382016110ee565b8383015261038e8482016110da565b8483015261039e606082016110da565b60608301526103af608082016110da565b60808301526103c060a082016110da565b60a083015260c081015160c083015260e081015160e08301526101008091015190820152923880610311565b604190634e487b7160e01b6000525260246000fd5b503d610334565b8451903d90823e3d90fd5b5050346101fb57806003193601126101fb576020906101f4610433610f2f565b61043b610f45565b906113d5565b509190346101fb57602092836003193601126101c757803567ffffffffffffffff81116101c35761047861047e9136908401610f5b565b90611a31565b8251630730bf5360e01b81529182015283816024817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa92831561050257926104d3575b5051908152f35b9091508281813d83116104fb575b6104eb8183611003565b81010312610253575190386104cc565b503d6104e1565b8251903d90823e3d90fd5b509134610258578160031936011261025857610527610f2f565b9180610531610f45565b815163b895daab60e01b81526001600160a01b03918216878201529485916024918391165afa80156105be578293839161058b575b5061057c57821561057c57602093505191138152f35b5163d969f4b360e01b81528390fd5b9050816105ae9294503d85116105b7575b6105a68183611003565b8101906113b8565b92909238610566565b503d61059c565b5051903d90823e3d90fd5b50346101c757816003193601126101c75780359067ffffffffffffffff82116101c3576105fc6106109236908301610f5b565b61060a610281949294610f45565b93611a31565b8351636cd8817160e11b8152918201526020816024817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa9384156106b3579361067d575b50610675670de0b6b3a7640000916020946118e8565b049051908152f35b92506020833d6020116106ab575b8161069860209383611003565b810103126102535791519161067561065f565b3d915061068b565b8351903d90823e3d90fd5b508290346101fb57826003193601126101fb576106d9610f2f565b92602435916106e6611b3c565b94670de0b6b3a76400008085029085820414851517156107e757859661070b916118fb565b6001600160a01b03908161071d611a8a565b16803b156107e357855163f940417d60e01b8152308682019081523260208201526040810193909352918891839182908490829060600103925af180156107d9579087916107c1575b50506107739116936113a7565b833b156107bd57602485928385519687948593631114790960e31b85528401525af19081156107b457506107a45750f35b6107ad90610fbd565b6102585780f35b513d84823e3d90fd5b8480fd5b6107ca90610fbd565b6107d5578588610766565b8580fd5b85513d89823e3d90fd5b8780fd5b601183634e487b7160e01b6000525260246000fd5b5091346102585760203660031901126102585782359067ffffffffffffffff8211610258575061083460209361083a92369101610f5b565b9061131f565b90519015158152f35b50346101c757816003193601126101c75760a061085e610f2f565b6024610868610f45565b600180851b0380938751968795869463055f575160e41b86521690840152165afa9081156108db5790608091602094916108ac575b500151600f0b15159051908152f35b6108ce915060a03d60a0116108d4575b6108c68183611003565b8101906110fc565b3861089d565b503d6108bc565b505051903d90823e3d90fd5b509190346101fb5760603660031901126101fb57610903610f2f565b906044358015158103610253576109289061091e3085611544565b906024358561191b565b936109338584611870565b94848113156109c557670e27c49886e60000958681029681880414901517156109b057670de0b6b3a7640000859604935b6001600160a01b0316803b156107d557859283606492865197889586946385f05ab560e01b86528501526024840152620a898b60eb1b60448401525af19081156107b457506107a45750f35b601182634e487b7160e01b6000525260246000fd5b670de0b6b3a7640000958681029681880414901517156109b057670e27c49886e6000085960493610964565b50913461025857816003193601126102585750610a0c610f2f565b610a27610a17610f45565b610a2181846113d5565b92611544565b928315610a6a57670de0b6b3a764000091828102928184041490151715610a5557506020926101f4916118fb565b601190634e487b7160e01b6000525260246000fd5b82516393408bd560e01b8152fd5b5050346101fb5760603660031901126101fb576020906101f4610a99610f2f565b610aa1610f45565b60443591611025565b508290346101fb57826003193601126101fb57610ac5610f2f565b926024918235610ad4866114c9565b8351636b64a37560e11b8152966020959186898681305afa8015610f25578890610ef6575b610b109950670de0b6b3a7640000998a91866118e8565b04898102908082048b1490151715610ee45790610b2c916118fb565b8551636b881d2360e11b81526001600160a01b03928316979190828188818c5afa908115610ead578a91610eb7575b50875190636cd8817160e11b82528782015282818681877f0000000000000000000000000000000000000000000000000000000000000000165afa908115610ead578a91610e7c575b50875163e9b14a6960e01b8152838189817f000000000000000000000000000000000000000000000000000000000000000089165afa908115610dfa57859185918d91610e43575b50898b518094819363dd7090f760e01b8352165afa908115610dfa578b91610e16575b508b03908b8211610e04578b91610c25916118e8565b8851632fe4486160e11b815291900492888289818d5afa908115610dfa578b928c92610dc1575b50895163202a61a160e01b815281818b81305afa918215610db7578d92610d74575b505090610c84939291600014610d6d57506110b8565b11610d5d57610c91611b3c565b97808402908482041484151715610d4b578798610cad916118fb565b90610cb6611a8a565b1690813b156107e35785516318ee591d60e11b81523086820190815232602082015260408101929092529888928a928390036060019183915af18015610d4157610d2d575b859650843b156107d55785928385519687948593631114790960e31b85528401525af19081156107b457506107a45750f35b949095610d3990610fbd565b938590610cfb565b84513d88823e3d90fd5b634e487b7160e01b8852601185528288fd5b8451631ff07a6560e11b81528490fd5b90506110b8565b90809250813d8311610db0575b610d8b8183611003565b81010312610dac5790610da2610c849493926111b4565b909192938e610c6e565b8b80fd5b503d610d81565b8b513d8f823e3d90fd5b925090508882813d8111610df3575b610dda8183611003565b81010312610def57808251920151908d610c4c565b8a80fd5b503d610dd0565b89513d8d823e3d90fd5b634e487b7160e01b8b5260118852858bfd5b90508381813d8311610e3c575b610e2d8183611003565b81010312610def57518c610c0f565b503d610e23565b92505081813d8311610e75575b610e5a8183611003565b81010312610def57518481168103610def578385918e610bec565b503d610e50565b90508281813d8311610ea6575b610e938183611003565b81010312610ea257518b610ba4565b8980fd5b503d610e89565b88513d8c823e3d90fd5b90508281813d8311610edd575b610ece8183611003565b81010312610ea257518b610b5b565b503d610ec4565b634e487b7160e01b8952601186528389fd5b508689813d8311610f1e575b610f0c8183611003565b810103126107e357610b109851610af9565b503d610f02565b86513d8a823e3d90fd5b600435906001600160a01b038216820361025357565b602435906001600160a01b038216820361025357565b9181601f840112156102535782359167ffffffffffffffff8311610253576020838186019501011161025357565b34610253576040366003190112610253576020610fb5610fa7610f2f565b610faf610f45565b90611544565b604051908152f35b67ffffffffffffffff8111610fd157604052565b634e487b7160e01b600052604160045260246000fd5b6040810190811067ffffffffffffffff821117610fd157604052565b90601f8019910116810190811067ffffffffffffffff821117610fd157604052565b91670de0b6b3a764000092836110448361103f868561145d565b6118e8565b049283156110ae57611055916113d5565b828082111561109f57611067916115a9565b83810290808204851490151715611089576110859261103f916118fb565b0490565b634e487b7160e01b600052601160045260246000fd5b906110a9916115a9565b611067565b5050505050600090565b9190820180921161108957565b519067ffffffffffffffff8216820361025357565b51906001600160801b038216820361025357565b519081600f0b820361025357565b908160a0910312610253576040519060a0820182811067ffffffffffffffff821117610fd15761117091608091604052611135816110c5565b8452611143602082016110c5565b6020850152611154604082016110da565b6040850152611165606082016110da565b6060850152016110ee565b608082015290565b51906001600160a01b038216820361025357565b9190826040910312610253576040516111a481610fe7565b6020808294805184520151910152565b5190811515820361025357565b808203916102808312610253576040908151936101008086019067ffffffffffffffff9187811083821117610fd15785526111fb86611178565b875260208601516020880152848601518588015260c0605f198401126102535784519060c0820182811084821117610fd1578652606087015182526080870151602083015260a08701518683015260c0870151606083015260e0870151608083015286015160a0820152606087015261127883610120870161118c565b608087015261128b83610160870161118c565b60a087015260a061019f19830112610253578351906080820190811182821017610fd15784936112c99185526101a087015183526101c0870161118c565b602082015261020085015183820152610220850151606082015260c086015261023f1901126102535761026061131291519261130484610fe7565b6102408101518452016111b4565b602082015260e082015290565b9061132991611a31565b6040516360e8efab60e11b8152600481019190915261028080826024817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa9182611389575b505061138457600090565b600190565b8161139f92903d106101b2576101a38183611003565b503880611379565b600160ff1b81146110895760000390565b9190826040910312610253576113d26020835193016111b4565b90565b6040805163b895daab60e01b81526001600160a01b03938416600482015292909183916024918391165afa801561145157600091600091611430575b5061142a57600081126114215790565b6113d2906113a7565b50600090565b905061144b915060403d6040116105b7576105a68183611003565b38611411565b6040513d6000823e3d90fd5b60405163055f575160e41b81526001600160a01b0392831660048201529160a09183916024918391165afa908115611451576001600160801b03916040916000916114aa575b5001511690565b6114c3915060a03d60a0116108d4576108c68183611003565b386114a3565b6040805163d24378eb60e01b8152918190839060049082906001600160a01b03165afa801561153957600092600091611516575b50611506575090565b516312f2b5eb60e21b8152600490fd5b9050816115309293503d84116105b7576105a68183611003565b919091386114fd565b50513d6000823e3d90fd5b6040805163273efd3960e21b81526001600160a01b03938416600482015292909183916024918391165afa801561145157600091600091611588575b5061142a5790565b90506115a3915060403d6040116105b7576105a68183611003565b38611580565b9190820391821161108957565b8181039291600013801582851316918412161761108957565b939291926115dc856114c9565b670de0b6b3a764000091826115f185886118e8565b0496838802888104851489151715611089578361160d916118fb565b9486159687611860575b83159384611850575b60408051634dd9d7e960e01b81526004810199909952600260248a01526001600160a01b03818a6044818985165afa80156118455760009a600091611822575b50611811579087949392918c6000918460001461173f57505050506116b3926116b895926116ad9260009d5b6116963387611544565b9115611730576116a5916110b8565b915b8461191b565b90611870565b6115b6565b94611720575b611710575b600084126117025781840293808504831490151715611089576116fc9561103f6116f0926116f7966118fb565b04906110b8565b6110b8565b90600190565b505090506116fc92506110b8565b9261171a906113a7565b926116c3565b9361172a906113a7565b936116be565b611739916115a9565b916116a7565b61178893949596975090602091611754611a8a565b86516355fdf82960e01b81523360048201523260248201526044810193909352919485929190911690829081906064820190565b03915afa9283156118075750918991838a97969594926117c4575b5050926116ad9285926117bd6116b3976116b89a976118e8565b049d61168c565b92509293949550506020823d6020116117ff575b816117e560209383611003565b8101031261025857505186939291908890826116b36117a3565b3d91506117d8565b51903d90823e3d90fd5b81516302d72b2f60e41b8152600490fd5b905061183c919a50823d84116105b7576105a68183611003565b99909938611660565b82513d6000823e3d90fd5b9661185a906113a7565b96611620565b9561186a906113a7565b95611617565b6040805163ea9f9aa760e01b81526004810193909352908190839060249082906001600160a01b03165afa8015611539576000926000916118c5575b506118b5575090565b516328fe356160e11b8152600490fd5b9050816118df9293503d84116105b7576105a68183611003565b919091386118ac565b8181029291811591840414171561108957565b8115611905570490565b634e487b7160e01b600052601260045260246000fd5b91928015611a1f576040516309ccaa8160e11b8152906020826004817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa908115611451576000916119e9575b61197c92506115a9565b90611991611989846114c9565b9330906113d5565b90670de0b6b3a764000091828102908082048414901517156110895782916119bc866119c2936118fb565b946118e8565b04818102918183041490151715611089576119e0926116b3916118fb565b90156114215790565b90506020823d602011611a17575b81611a0460209383611003565b810103126102535761197c915190611972565b3d91506119f7565b6040516393408bd560e01b8152600490fd5b90611a6b60256040518381946020830196607360f81b885260218401378101630504552560e41b6021820152036005810184520182611003565b5190519060208110611a7b575090565b6000199060200360031b1b1690565b604051632ecd14d360e21b81527f73796e74686574697848616e646c657253746f7261676500000000000000000060048201526001600160a01b03906020816024817f000000000000000000000000000000000000000000000000000000000000000086165afa90811561145157600091611b0457501690565b90506020813d602011611b34575b81611b1f60209383611003565b8101031261025357611b3090611178565b1690565b3d9150611b12565b604051633ba0b9a960e01b8152602081600481305afa90811561145157600091611b64575090565b90506020813d602011611b8b575b81611b7f60209383611003565b81010312610253575190565b3d9150611b7256fea26469706673582212200bef7ab9ab98be326f4d717267f85fdc8f10a33d4632835378b3cd973b673ad064736f6c63430008180033000000000000000000000000baa87ecc5dd76526b51ab7fd2d0c814eb967e2e2000000000000000000000000340b5d664834113735730ad4afb3760219ad9112000000000000000000000000649f44cac3276557d03223dbf6395af65b11c11c
Deployed Bytecode
0x6040608081526004908136101561001557600080fd5b600091823560e01c8062343d1314610aaa57806303bf450b14610a785780630e0f7ba6146109f157806333a0980e146108e757806335a0794b146108435780633932d1ab146107fc5780633a5271f9146106be5780635317f109146105c957806359131aa81461025b578063689549e71461050d57806369af8ad114610441578063756a2b2914610413578063890914cf146102b45780638b51e38c14610286578063b883b05814610260578063ba1955841461025b578063c5ed3ba0146101ff578063cfd85f30146101cb5763ec697e13146100f157600080fd5b346101c75760203660031901126101c75780359067ffffffffffffffff82116101c3576101246101339236908301610f5b565b6001600160a01b039391611a31565b83516360e8efab60e11b8152918201526102809081816024817f000000000000000000000000340b5d664834113735730ad4afb3760219ad911287165afa9182156101b9576020959261018c575b505051169051908152f35b6101ab9250803d106101b2575b6101a38183611003565b8101906111c1565b3880610181565b503d610199565b84513d87823e3d90fd5b8380fd5b8280fd5b5050346101fb57806003193601126101fb576020906101f46101eb610f2f565b60243590611870565b9051908152f35b5080fd5b8284346102585760a0366003190112610258575061021b610f2f565b606435801515810361025357608435908115158203610253576102459260443590602435906115cf565b825191825215156020820152f35b600080fd5b80fd5b610f89565b5050346101fb5760203660031901126101fb576020906101f4610281610f2f565b6114c9565b5050346101fb57806003193601126101fb576020906101f46102a6610f2f565b6102ae610f45565b9061145d565b50346101c757816003193601126101c7576102cd610f2f565b6102d5610f45565b835163645c04d560e11b81526001600160a01b039182168185015292610120929091839185916024918391165afa948515610408578095610324575b60208581880151600f0b15159051908152f35b90918381809597503d8311610401575b61033e8183611003565b81010312610258575082519182019082821067ffffffffffffffff8311176103ec57509060209384928452610372816111b4565b825261037f8382016110ee565b8383015261038e8482016110da565b8483015261039e606082016110da565b60608301526103af608082016110da565b60808301526103c060a082016110da565b60a083015260c081015160c083015260e081015160e08301526101008091015190820152923880610311565b604190634e487b7160e01b6000525260246000fd5b503d610334565b8451903d90823e3d90fd5b5050346101fb57806003193601126101fb576020906101f4610433610f2f565b61043b610f45565b906113d5565b509190346101fb57602092836003193601126101c757803567ffffffffffffffff81116101c35761047861047e9136908401610f5b565b90611a31565b8251630730bf5360e01b81529182015283816024817f000000000000000000000000649f44cac3276557d03223dbf6395af65b11c11c6001600160a01b03165afa92831561050257926104d3575b5051908152f35b9091508281813d83116104fb575b6104eb8183611003565b81010312610253575190386104cc565b503d6104e1565b8251903d90823e3d90fd5b509134610258578160031936011261025857610527610f2f565b9180610531610f45565b815163b895daab60e01b81526001600160a01b03918216878201529485916024918391165afa80156105be578293839161058b575b5061057c57821561057c57602093505191138152f35b5163d969f4b360e01b81528390fd5b9050816105ae9294503d85116105b7575b6105a68183611003565b8101906113b8565b92909238610566565b503d61059c565b5051903d90823e3d90fd5b50346101c757816003193601126101c75780359067ffffffffffffffff82116101c3576105fc6106109236908301610f5b565b61060a610281949294610f45565b93611a31565b8351636cd8817160e11b8152918201526020816024817f000000000000000000000000649f44cac3276557d03223dbf6395af65b11c11c6001600160a01b03165afa9384156106b3579361067d575b50610675670de0b6b3a7640000916020946118e8565b049051908152f35b92506020833d6020116106ab575b8161069860209383611003565b810103126102535791519161067561065f565b3d915061068b565b8351903d90823e3d90fd5b508290346101fb57826003193601126101fb576106d9610f2f565b92602435916106e6611b3c565b94670de0b6b3a76400008085029085820414851517156107e757859661070b916118fb565b6001600160a01b03908161071d611a8a565b16803b156107e357855163f940417d60e01b8152308682019081523260208201526040810193909352918891839182908490829060600103925af180156107d9579087916107c1575b50506107739116936113a7565b833b156107bd57602485928385519687948593631114790960e31b85528401525af19081156107b457506107a45750f35b6107ad90610fbd565b6102585780f35b513d84823e3d90fd5b8480fd5b6107ca90610fbd565b6107d5578588610766565b8580fd5b85513d89823e3d90fd5b8780fd5b601183634e487b7160e01b6000525260246000fd5b5091346102585760203660031901126102585782359067ffffffffffffffff8211610258575061083460209361083a92369101610f5b565b9061131f565b90519015158152f35b50346101c757816003193601126101c75760a061085e610f2f565b6024610868610f45565b600180851b0380938751968795869463055f575160e41b86521690840152165afa9081156108db5790608091602094916108ac575b500151600f0b15159051908152f35b6108ce915060a03d60a0116108d4575b6108c68183611003565b8101906110fc565b3861089d565b503d6108bc565b505051903d90823e3d90fd5b509190346101fb5760603660031901126101fb57610903610f2f565b906044358015158103610253576109289061091e3085611544565b906024358561191b565b936109338584611870565b94848113156109c557670e27c49886e60000958681029681880414901517156109b057670de0b6b3a7640000859604935b6001600160a01b0316803b156107d557859283606492865197889586946385f05ab560e01b86528501526024840152620a898b60eb1b60448401525af19081156107b457506107a45750f35b601182634e487b7160e01b6000525260246000fd5b670de0b6b3a7640000958681029681880414901517156109b057670e27c49886e6000085960493610964565b50913461025857816003193601126102585750610a0c610f2f565b610a27610a17610f45565b610a2181846113d5565b92611544565b928315610a6a57670de0b6b3a764000091828102928184041490151715610a5557506020926101f4916118fb565b601190634e487b7160e01b6000525260246000fd5b82516393408bd560e01b8152fd5b5050346101fb5760603660031901126101fb576020906101f4610a99610f2f565b610aa1610f45565b60443591611025565b508290346101fb57826003193601126101fb57610ac5610f2f565b926024918235610ad4866114c9565b8351636b64a37560e11b8152966020959186898681305afa8015610f25578890610ef6575b610b109950670de0b6b3a7640000998a91866118e8565b04898102908082048b1490151715610ee45790610b2c916118fb565b8551636b881d2360e11b81526001600160a01b03928316979190828188818c5afa908115610ead578a91610eb7575b50875190636cd8817160e11b82528782015282818681877f000000000000000000000000649f44cac3276557d03223dbf6395af65b11c11c165afa908115610ead578a91610e7c575b50875163e9b14a6960e01b8152838189817f000000000000000000000000baa87ecc5dd76526b51ab7fd2d0c814eb967e2e289165afa908115610dfa57859185918d91610e43575b50898b518094819363dd7090f760e01b8352165afa908115610dfa578b91610e16575b508b03908b8211610e04578b91610c25916118e8565b8851632fe4486160e11b815291900492888289818d5afa908115610dfa578b928c92610dc1575b50895163202a61a160e01b815281818b81305afa918215610db7578d92610d74575b505090610c84939291600014610d6d57506110b8565b11610d5d57610c91611b3c565b97808402908482041484151715610d4b578798610cad916118fb565b90610cb6611a8a565b1690813b156107e35785516318ee591d60e11b81523086820190815232602082015260408101929092529888928a928390036060019183915af18015610d4157610d2d575b859650843b156107d55785928385519687948593631114790960e31b85528401525af19081156107b457506107a45750f35b949095610d3990610fbd565b938590610cfb565b84513d88823e3d90fd5b634e487b7160e01b8852601185528288fd5b8451631ff07a6560e11b81528490fd5b90506110b8565b90809250813d8311610db0575b610d8b8183611003565b81010312610dac5790610da2610c849493926111b4565b909192938e610c6e565b8b80fd5b503d610d81565b8b513d8f823e3d90fd5b925090508882813d8111610df3575b610dda8183611003565b81010312610def57808251920151908d610c4c565b8a80fd5b503d610dd0565b89513d8d823e3d90fd5b634e487b7160e01b8b5260118852858bfd5b90508381813d8311610e3c575b610e2d8183611003565b81010312610def57518c610c0f565b503d610e23565b92505081813d8311610e75575b610e5a8183611003565b81010312610def57518481168103610def578385918e610bec565b503d610e50565b90508281813d8311610ea6575b610e938183611003565b81010312610ea257518b610ba4565b8980fd5b503d610e89565b88513d8c823e3d90fd5b90508281813d8311610edd575b610ece8183611003565b81010312610ea257518b610b5b565b503d610ec4565b634e487b7160e01b8952601186528389fd5b508689813d8311610f1e575b610f0c8183611003565b810103126107e357610b109851610af9565b503d610f02565b86513d8a823e3d90fd5b600435906001600160a01b038216820361025357565b602435906001600160a01b038216820361025357565b9181601f840112156102535782359167ffffffffffffffff8311610253576020838186019501011161025357565b34610253576040366003190112610253576020610fb5610fa7610f2f565b610faf610f45565b90611544565b604051908152f35b67ffffffffffffffff8111610fd157604052565b634e487b7160e01b600052604160045260246000fd5b6040810190811067ffffffffffffffff821117610fd157604052565b90601f8019910116810190811067ffffffffffffffff821117610fd157604052565b91670de0b6b3a764000092836110448361103f868561145d565b6118e8565b049283156110ae57611055916113d5565b828082111561109f57611067916115a9565b83810290808204851490151715611089576110859261103f916118fb565b0490565b634e487b7160e01b600052601160045260246000fd5b906110a9916115a9565b611067565b5050505050600090565b9190820180921161108957565b519067ffffffffffffffff8216820361025357565b51906001600160801b038216820361025357565b519081600f0b820361025357565b908160a0910312610253576040519060a0820182811067ffffffffffffffff821117610fd15761117091608091604052611135816110c5565b8452611143602082016110c5565b6020850152611154604082016110da565b6040850152611165606082016110da565b6060850152016110ee565b608082015290565b51906001600160a01b038216820361025357565b9190826040910312610253576040516111a481610fe7565b6020808294805184520151910152565b5190811515820361025357565b808203916102808312610253576040908151936101008086019067ffffffffffffffff9187811083821117610fd15785526111fb86611178565b875260208601516020880152848601518588015260c0605f198401126102535784519060c0820182811084821117610fd1578652606087015182526080870151602083015260a08701518683015260c0870151606083015260e0870151608083015286015160a0820152606087015261127883610120870161118c565b608087015261128b83610160870161118c565b60a087015260a061019f19830112610253578351906080820190811182821017610fd15784936112c99185526101a087015183526101c0870161118c565b602082015261020085015183820152610220850151606082015260c086015261023f1901126102535761026061131291519261130484610fe7565b6102408101518452016111b4565b602082015260e082015290565b9061132991611a31565b6040516360e8efab60e11b8152600481019190915261028080826024817f000000000000000000000000340b5d664834113735730ad4afb3760219ad91126001600160a01b03165afa9182611389575b505061138457600090565b600190565b8161139f92903d106101b2576101a38183611003565b503880611379565b600160ff1b81146110895760000390565b9190826040910312610253576113d26020835193016111b4565b90565b6040805163b895daab60e01b81526001600160a01b03938416600482015292909183916024918391165afa801561145157600091600091611430575b5061142a57600081126114215790565b6113d2906113a7565b50600090565b905061144b915060403d6040116105b7576105a68183611003565b38611411565b6040513d6000823e3d90fd5b60405163055f575160e41b81526001600160a01b0392831660048201529160a09183916024918391165afa908115611451576001600160801b03916040916000916114aa575b5001511690565b6114c3915060a03d60a0116108d4576108c68183611003565b386114a3565b6040805163d24378eb60e01b8152918190839060049082906001600160a01b03165afa801561153957600092600091611516575b50611506575090565b516312f2b5eb60e21b8152600490fd5b9050816115309293503d84116105b7576105a68183611003565b919091386114fd565b50513d6000823e3d90fd5b6040805163273efd3960e21b81526001600160a01b03938416600482015292909183916024918391165afa801561145157600091600091611588575b5061142a5790565b90506115a3915060403d6040116105b7576105a68183611003565b38611580565b9190820391821161108957565b8181039291600013801582851316918412161761108957565b939291926115dc856114c9565b670de0b6b3a764000091826115f185886118e8565b0496838802888104851489151715611089578361160d916118fb565b9486159687611860575b83159384611850575b60408051634dd9d7e960e01b81526004810199909952600260248a01526001600160a01b03818a6044818985165afa80156118455760009a600091611822575b50611811579087949392918c6000918460001461173f57505050506116b3926116b895926116ad9260009d5b6116963387611544565b9115611730576116a5916110b8565b915b8461191b565b90611870565b6115b6565b94611720575b611710575b600084126117025781840293808504831490151715611089576116fc9561103f6116f0926116f7966118fb565b04906110b8565b6110b8565b90600190565b505090506116fc92506110b8565b9261171a906113a7565b926116c3565b9361172a906113a7565b936116be565b611739916115a9565b916116a7565b61178893949596975090602091611754611a8a565b86516355fdf82960e01b81523360048201523260248201526044810193909352919485929190911690829081906064820190565b03915afa9283156118075750918991838a97969594926117c4575b5050926116ad9285926117bd6116b3976116b89a976118e8565b049d61168c565b92509293949550506020823d6020116117ff575b816117e560209383611003565b8101031261025857505186939291908890826116b36117a3565b3d91506117d8565b51903d90823e3d90fd5b81516302d72b2f60e41b8152600490fd5b905061183c919a50823d84116105b7576105a68183611003565b99909938611660565b82513d6000823e3d90fd5b9661185a906113a7565b96611620565b9561186a906113a7565b95611617565b6040805163ea9f9aa760e01b81526004810193909352908190839060249082906001600160a01b03165afa8015611539576000926000916118c5575b506118b5575090565b516328fe356160e11b8152600490fd5b9050816118df9293503d84116105b7576105a68183611003565b919091386118ac565b8181029291811591840414171561108957565b8115611905570490565b634e487b7160e01b600052601260045260246000fd5b91928015611a1f576040516309ccaa8160e11b8152906020826004817f000000000000000000000000649f44cac3276557d03223dbf6395af65b11c11c6001600160a01b03165afa908115611451576000916119e9575b61197c92506115a9565b90611991611989846114c9565b9330906113d5565b90670de0b6b3a764000091828102908082048414901517156110895782916119bc866119c2936118fb565b946118e8565b04818102918183041490151715611089576119e0926116b3916118fb565b90156114215790565b90506020823d602011611a17575b81611a0460209383611003565b810103126102535761197c915190611972565b3d91506119f7565b6040516393408bd560e01b8152600490fd5b90611a6b60256040518381946020830196607360f81b885260218401378101630504552560e41b6021820152036005810184520182611003565b5190519060208110611a7b575090565b6000199060200360031b1b1690565b604051632ecd14d360e21b81527f73796e74686574697848616e646c657253746f7261676500000000000000000060048201526001600160a01b03906020816024817f000000000000000000000000baa87ecc5dd76526b51ab7fd2d0c814eb967e2e286165afa90811561145157600091611b0457501690565b90506020813d602011611b34575b81611b1f60209383611003565b8101031261025357611b3090611178565b1690565b3d9150611b12565b604051633ba0b9a960e01b8152602081600481305afa90811561145157600091611b64575090565b90506020813d602011611b8b575b81611b7f60209383611003565b81010312610253575190565b3d9150611b7256fea26469706673582212200bef7ab9ab98be326f4d717267f85fdc8f10a33d4632835378b3cd973b673ad064736f6c63430008180033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000baa87ecc5dd76526b51ab7fd2d0c814eb967e2e2000000000000000000000000340b5d664834113735730ad4afb3760219ad9112000000000000000000000000649f44cac3276557d03223dbf6395af65b11c11c
-----Decoded View---------------
Arg [0] : addressProvider_ (address): 0xbaA87EcC5Dd76526b51AB7FD2d0c814EB967E2E2
Arg [1] : perpsV2MarketData_ (address): 0x340B5d664834113735730Ad4aFb3760219Ad9112
Arg [2] : marketSettings_ (address): 0x649F44CAC3276557D03223Dbf6395Af65b11c11c
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000baa87ecc5dd76526b51ab7fd2d0c814eb967e2e2
Arg [1] : 000000000000000000000000340b5d664834113735730ad4afb3760219ad9112
Arg [2] : 000000000000000000000000649f44cac3276557d03223dbf6395af65b11c11c
Deployed Bytecode Sourcemap
866:13469:3:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;866:13469:3;;;;;;;;;;;;;1882:18;866:13469;;;;;;:::i;:::-;-1:-1:-1;;;;;866:13469:3;;1882:18;:::i;:::-;866:13469;;-1:-1:-1;;;1830:71:3;;;;;866:13469;1830:71;;;866:13469;;;1830:18;866:13469;;1830:71;;;;;;;866:13469;1830:71;;;;866:13469;;;;;;;;;;;1830:71;;;;;;-1:-1:-1;1830:71:3;;;;;;;:::i;:::-;;;;;:::i;:::-;;;;;;;;;;;866:13469;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;-1:-1:-1;;866:13469:3;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;-1:-1:-1;;866:13469:3;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::i;:::-;;;:::i;:::-;;;;;;;;;;;;;;;:::i;:::-;;;:::i;:::-;;;-1:-1:-1;;;5878:76:3;;-1:-1:-1;;;;;866:13469:3;;;5878:76;;;866:13469;;5878:76;;866:13469;;5878:76;;866:13469;;;;;;;5878:76;;;;;;;;;;;866:13469;;5878:103;;;;866:13469;;;5878:108;;866:13469;;;;;;5878:76;;;;;;;;;;;;;;;;;;;:::i;:::-;;;866:13469;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;:::i;:::-;;;;;;;;;;:::i;:::-;;;;;;;;;;:::i;:::-;;;;;;;;;;:::i;:::-;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5878:76;;;;;866:13469;;1223:7;;;;866:13469;;;;;;5878:76;;;;;;866:13469;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::i;:::-;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;10233:18;866:13469;;;;;;:::i;:::-;10233:18;;:::i;:::-;866:13469;;-1:-1:-1;;;10205:47:3;;;;;866:13469;;;;;10205:15;-1:-1:-1;;;;;866:13469:3;10205:47;;;;;;;;;;866:13469;;;;;;;10205:47;;;;;;;;;;;;;;;;;:::i;:::-;;;866:13469;;;;;10205:47;;;;;;;;;;866:13469;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::i;:::-;;;-1:-1:-1;;;8334:81:3;;-1:-1:-1;;;;;866:13469:3;;;8334:81;;;866:13469;;;;;;;;;8334:81;;;;;;;;;;;;866:13469;8425:41;;;8480:19;;8476:52;;866:13469;;;;8545:18;;866:13469;;;8476:52;866:13469;-1:-1:-1;;;8508:20:3;;866:13469;;8508:20;8334:81;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::i;:::-;;;;;;;;;;;;;866:13469;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10529:18;866:13469;;;;;;:::i;:::-;10462:19;866:13469;;;;;:::i;10462:19::-;10529:18;;:::i;:::-;866:13469;;-1:-1:-1;;;10498:50:3;;;;;866:13469;;;;;10498:15;-1:-1:-1;;;;;866:13469:3;10498:50;;;;;;;;;;866:13469;434:18:24;;133:2;434:18;866:13469:3;434:18:24;;:::i;:::-;133:2;866:13469:3;;;;;;10498:50;;;866:13469;10498:50;;866:13469;10498:50;;;;;;866:13469;10498:50;;;:::i;:::-;;;866:13469;;;;;;;434:18:24;10498:50:3;;;;;-1:-1:-1;10498:50:3;;;866:13469;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;10962:15;;;:::i;:::-;133:2:24;;866:13469:3;;;;;;;;;;;;;;258:43:24;;;;;:::i;:::-;-1:-1:-1;;;;;866:13469:3;;10988:26;;:::i;:::-;866:13469;10988:136;;;;;866:13469;;-1:-1:-1;;;10988:136:3;;11057:4;10988:136;;;866:13469;;;11076:9;866:13469;;;;;;;;;;;;;;;;;;;;;;;;10988:136;;;;;;;;;;;;;866:13469;;;2438:16;866:13469;;2438:16;;:::i;:::-;2387:68;;;;;866:13469;;;;;;;;;;;;;;2387:68;;;;866:13469;2387:68;;;;;;;;;;866:13469;;2387:68;;;;:::i;:::-;866:13469;;2387:68;866:13469;2387:68;866:13469;;;;;;;;2387:68;866:13469;;;10988:136;;;;:::i;:::-;866:13469;;10988:136;;;;866:13469;;;;10988:136;866:13469;;;;;;;;;10988:136;866:13469;;;;1223:7;;;;;866:13469;1223:7;;866:13469;;1223:7;866:13469;;;;;;;;-1:-1:-1;;866:13469:3;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;6184:55;866:13469;;:::i;:::-;;;;:::i;:::-;;;;;;;;;;;;;;;;;;6184:55;;866:13469;6184:55;;;866:13469;;6184:55;;;;;;;;:60;:55;866:13469;6184:55;;;;866:13469;6184:60;;866:13469;;;6184:65;;866:13469;;;;;;6184:55;;;;;;;;;;;;;;;:::i;:::-;;;;;:::i;:::-;;;;;;;;;;866:13469;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;866:13469:3;;;;;;:::i;:::-;;;;;;;;;;;2735:129;2699:4;2666:39;2699:4;2666:39;;:::i;:::-;866:13469;;;2735:129;;:::i;:::-;2891:30;;;;;:::i;:::-;2936:14;;;;866:13469;;;1223:7;866:13469;;;;;;;;;;;;;;;133:2:24;;;;2932:170:3;;-1:-1:-1;;;;;866:13469:3;3457:185;;;;;866:13469;;;1285:14;866:13469;;;;;;;;;;;3457:185;;;;866:13469;;1285:14;;866:13469;1223:7;;;866:13469;1285:14;;866:13469;3457:185;;;;;;;;;;866:13469;;;1223:7;;;;;866:13469;1223:7;;866:13469;;1223:7;2932:170;133:2:24;866:13469:3;;;;;;;;;;;;;;;1223:7;133:2:24;;;2932:170:3;;;866:13469;;;;;;;;;;;;;;;;;:::i;:::-;7543:34;866:13469;;:::i;:::-;7474:32;;;;:::i;:::-;7543:34;;:::i;:::-;7591:21;;;7587:44;;133:2:24;866:13469:3;;;;;;;;;;;;;;;258:43:24;866:13469:3;258:43:24;;;;:::i;866:13469:3:-;1223:7;;;;;866:13469;1223:7;;;866:13469;1223:7;7587:44;866:13469;;-1:-1:-1;;;7621:10:3;;;866:13469;;;;;;;;-1:-1:-1;;866:13469:3;;;;;;;;;:::i;:::-;;;:::i;:::-;;;;;:::i;:::-;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;12039:19;;;:::i;:::-;866:13469;;-1:-1:-1;;;12892:47:3;;866:13469;;;;;;12916:4;866:13469;12916:4;12892:47;;;;;;;;;;866:13469;434:18:24;133:2;;;434:18;;;;;:::i;:::-;133:2;866:13469:3;;;;;;;;;;;;;;;258:43:24;;;;:::i;:::-;866:13469:3;;-1:-1:-1;;;12153:47:3;;-1:-1:-1;;;;;866:13469:3;;;;;;;;12153:47;866:13469;;12153:47;;;;;;;;;;;866:13469;;;;;;;;12236:36;;;;;866:13469;12236:15;;;;;;866:13469;12236:36;;;;;;;;;;;866:13469;-1:-1:-1;866:13469:3;;-1:-1:-1;;;12300:49:3;;:16;866:13469;12300:16;866:13469;12300:16;866:13469;;12300:49;;;;;;;;;;;;;;;866:13469;;;;;;;;;;;;12300:89;;866:13469;12300:89;;;;;;;;;;;866:13469;;;;;;;;;;434:18:24;;;;;:::i;:::-;866:13469:3;;-1:-1:-1;;;12493:62:3;;133:2:24;;;;866:13469:3;;12493:62;866:13469;12493:62;;;;;;;;;866:13469;;12493:62;;;866:13469;-1:-1:-1;866:13469:3;;-1:-1:-1;;;12770:39:3;;12916:4;866:13469;12916:4;866:13469;12916:4;12770:39;;;;;;;;;;;866:13469;12588:26;;;12628:24;12588:26;;;;;;;;12628:24;:::i;:::-;:31;12624:68;;10677:15;;:::i;:::-;866:13469;;;;;;;;;;;;;;;258:43:24;;;;;:::i;:::-;10703:26:3;;;:::i;:::-;866:13469;10703:134;;;;;;866:13469;;-1:-1:-1;;;10703:134:3;;12916:4;10703:134;;;866:13469;;;10791:9;866:13469;;;;;;;;;;;;;;;;10703:134;;;866:13469;10703:134;;866:13469;;10703:134;;;;;;;;12588:26;2150:67;;;;;;;;866:13469;;;;;;;;;;;;;2150:67;;;;866:13469;2150:67;;;;;;;;;;866:13469;;10703:134;;;;;;;:::i;:::-;;;;;;;866:13469;;;;;;;;;;-1:-1:-1;;;1223:7:3;;;;;;;;12624:68;866:13469;;-1:-1:-1;;;12668:24:3;;866:13469;;12668:24;12588:26;;;12628:24;:::i;12770:39::-;;;;;;;;;;;;;;;;:::i;:::-;;;866:13469;;;;;;12628:24;866:13469;;;;:::i;:::-;12770:39;;;;;;;866:13469;;;;12770:39;;;;;;866:13469;;;;;;;;;12493:62;;-1:-1:-1;12493:62:3;-1:-1:-1;12493:62:3;;;;;;;;;;;;;:::i;:::-;;;866:13469;;;;;;;;;;12493:62;;;;866:13469;;;;12493:62;;;;;;866:13469;;;;;;;;;;-1:-1:-1;;;1223:7:3;;;;;;;;12300:89;;;;;;;;;;;;;;;;:::i;:::-;;;866:13469;;;;;12300:89;;;;;;;;:49;;;;;;;;;;;;;;;;:::i;:::-;;;866:13469;;;;;;;;;;;;12300:49;;;;;;;;;;;12236:36;;;;;;;;;;;;;;;;:::i;:::-;;;866:13469;;;;;12236:36;;;866:13469;;;;12236:36;;;;;;866:13469;;;;;;;;;12153:47;;;;;;;;;;;;;;;;:::i;:::-;;;866:13469;;;;;12153:47;;;;;;;;866:13469;-1:-1:-1;;;1223:7:3;;;;;;;;12892:47;;;;;;;;;;;;;;;:::i;:::-;;;866:13469;;;;434:18:24;866:13469:3;;12892:47;;;;;;;;866:13469;;;;;;;;;;;;;-1:-1:-1;;;;;866:13469:3;;;;;;:::o;:::-;;;;-1:-1:-1;;;;;866:13469:3;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;-1:-1:-1;;866:13469:3;;;;;6433:34;866:13469;;:::i;:::-;;;:::i;:::-;6433:34;;:::i;:::-;866:13469;;;;;;;;;;;;;;:::o;:::-;1223:7;;;866:13469;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;:::o;6758:523::-;;133:2:24;6947:32:3;;434:18:24;6947:32:3;;;;;:::i;:::-;434:18:24;:::i;:::-;133:2;7036:20:3;;;7032:34;;7102:32;;;:::i;:::-;579:5:24;;;;;;;587;;;:::i;:::-;866:13469:3;;;;;;;;;;;;;;;434:18:24;258:43;;;;:::i;434:18::-;133:2;6758:523:3;:::o;866:13469::-;1223:7;;;-1:-1:-1;1223:7:3;;;;;-1:-1:-1;1223:7:3;579:21:24;595:5;;;;:::i;:::-;579:21;;7032:34:3;7058:8;;;;;-1:-1:-1;7058:8:3;:::o;1223:7::-;;;;;;;;;;:::o;866:13469::-;;;;;;;;;;:::o;:::-;;;-1:-1:-1;;;;;866:13469:3;;;;;;:::o;:::-;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;:::i;:::-;;;;;;;;;;:::i;:::-;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;:::o;:::-;;;-1:-1:-1;;;;;866:13469:3;;;;;;:::o;:::-;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;866:13469:3;;;;;;;;;;;;:::i;:::-;;;;;;;;;:::i;:::-;;;;;;;;;;:::o;9363:334::-;;9522:18;9363:334;9522:18;:::i;:::-;866:13469;;-1:-1:-1;;;9483:58:3;;;;;866:13469;;;;9483:58;;866:13469;;;9483:18;-1:-1:-1;;;;;866:13469:3;9483:58;;;;;;9363:334;-1:-1:-1;;9479:212:3;;-1:-1:-1;9668:12:3;:::o;9479:212::-;9632:4;9625:11;:::o;9483:58::-;;;;;;-1:-1:-1;9483:58:3;;;;;;:::i;:::-;;;;;;866:13469;-1:-1:-1;;;866:13469:3;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;:::i;:::-;;:::o;7735:395::-;866:13469;;;-1:-1:-1;;;7905:81:3;;-1:-1:-1;;;;;866:13469:3;;;7905:81;;;866:13469;;;;;;;;;;;7905:81;;;;;;-1:-1:-1;;;7905:81:3;;;7735:395;7996:22;;;-1:-1:-1;8032:18:3;;8028:55;;7735:395;:::o;8028:55::-;8067:15;;;:::i;7996:22::-;8010:8;-1:-1:-1;8010:8:3;:::o;7905:81::-;;;;;;866:13469;7905:81;866:13469;7905:81;;;;;;;:::i;:::-;;;;;866:13469;;;-1:-1:-1;866:13469:3;;;;;6518:196;866:13469;;-1:-1:-1;;;6645:55:3;;-1:-1:-1;;;;;866:13469:3;;;6645:55;;;866:13469;;6645:55;;866:13469;;;;;;;6645:55;;;;;;;-1:-1:-1;;;;;6645:55:3;866:13469;6645:55;-1:-1:-1;6645:55:3;;;6518:196;6645:62;;866:13469;;6518:196;:::o;6645:55::-;;;;;;;;;;;;;;:::i;:::-;;;;9741:299;866:13469;;;-1:-1:-1;;;9880:70:3;;866:13469;;;;;9880:70;;866:13469;;-1:-1:-1;;;;;866:13469:3;9880:70;;;;;;;;;;;;9741:299;9960:45;;;10015:18;9741:299;:::o;9960:45::-;866:13469;-1:-1:-1;;;9981:24:3;;9880:70;;9981:24;9880:70;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;866:13469;;;9880:70;866:13469;;;;;8614:330;866:13469;;;-1:-1:-1;;;8789:83:3;;-1:-1:-1;;;;;866:13469:3;;;8789:83;;;866:13469;;;;;;;;;;;8789:83;;;;;;-1:-1:-1;;;8789:83:3;;;8614:330;8882:22;;;8614:330;:::o;8789:83::-;;;;;;866:13469;8789:83;866:13469;8789:83;;;;;;;:::i;:::-;;;;866:13469;;;;;;;;;;:::o;:::-;;;;;;;-1:-1:-1;866:13469:3;;;;;;;;;;;;;:::o;3693:1985::-;;;;;3932:19;;;:::i;:::-;133:2:24;434:18;;;;;;:::i;:::-;133:2;866:13469:3;;;;;;;;;;;;;;;258:43:24;;;;:::i;:::-;4202:8:3;;;4198:50;;;;3693:1985;4284:11;;4280:53;;;;3693:1985;866:13469;;;-1:-1:-1;;;13529:113:3;;;;;866:13469;;;;13599:42;866:13469;;;;-1:-1:-1;;;;;866:13469:3;;;;;;;13529:113;;;;;;-1:-1:-1;;;13529:113:3;;;3693:1985;13652:43;;;4508:174;;;;;;;-1:-1:-1;4508:174:3;;;;;;;;;;5098:39;4508:174;5169:40;4508:174;;4938:129;4508:174;-1:-1:-1;4508:174:3;;4766:36;4791:10;4766:36;;:::i;:::-;4812:87;;;;4828:28;;;:::i;:::-;4812:87;;4938:129;;:::i;:::-;5098:39;;:::i;:::-;5169:40;:::i;:::-;5219:42;;;4812:87;5293:45;;4812:87;-1:-1:-1;5375:16:3;;5371:71;;866:13469;;;;;;;;;;;;;;;5611:53;258:43:24;;434:18;258:43;5611:28:3;258:43:24;;:::i;434:18::-;133:2;5611:28:3;;:::i;:::-;:53;:::i;:::-;5603:68;866:13469;3693:1985;:::o;5371:71::-;5401:34;;;;;;;;:::i;5293:45::-;5325:13;;;;:::i;:::-;5293:45;;;5219:42;5248:13;;;;:::i;:::-;5219:42;;;4812:87;4871:28;;;:::i;:::-;4812:87;;;4508:174;4549:101;:26;;;;;;;866:13469;4549:26;;;:::i;:::-;866:13469;;-1:-1:-1;;;4549:101:3;;4615:10;13529:113;4549:101;;866:13469;4627:9;866:13469;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4549:101;;;;;;;;;;;;;;;;;;;;;;;4508:174;434:18:24;;;4938:129:3;434:18:24;;;;5098:39:3;434:18:24;5169:40:3;434:18:24;;;:::i;:::-;133:2;4508:174:3;;;4549:101;;;;;;;;;866:13469;4549:101;;866:13469;4549:101;;;;;;866:13469;4549:101;;;:::i;:::-;;;866:13469;;;;-1:-1:-1;866:13469:3;;;;;;;;;5098:39;4549:101;;;;;-1:-1:-1;4549:101:3;;;866:13469;;;;;;;;;13652:43;866:13469;;-1:-1:-1;;;13673:22:3;;13529:113;;13673:22;13529:113;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;866:13469;;;-1:-1:-1;866:13469:3;;;;;4280:53;4316:17;;;;:::i;:::-;4280:53;;;4198:50;4231:17;;;;:::i;:::-;4198:50;;;8988:331;866:13469;;;-1:-1:-1;;;9152:79:3;;;;;866:13469;;;;;;;;;;;;;-1:-1:-1;;;;;866:13469:3;9152:79;;;;;;-1:-1:-1;;;9152:79:3;;;8988:331;9241:44;;;9295:17;8988:331;:::o;9241:44::-;866:13469;-1:-1:-1;;;9262:23:3;;9152:79;;9262:23;9152:79;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;866:13469;;;;;;;;;;;;;;;;:::o;133:2:24:-;;;;;;;:::o;:::-;1223:7:3;;;133:2:24;;;;;;;;11137:766:3;;;11330:18;;11326:41;;866:13469;;-1:-1:-1;;;13803:30:3;;866:13469;13803:30;866:13469;13803:30;866:13469;13803:15;-1:-1:-1;;;;;866:13469:3;13803:30;;;;;;;11347:1;13803:30;;;11137:766;11377:32;;;;:::i;:::-;11464:19;11518:37;11464:19;;;:::i;:::-;11549:4;;11518:37;;:::i;:::-;133:2:24;;866:13469:3;;;;;;;;;;;;;;;;258:43:24;;;;434:18;258:43;;:::i;:::-;434:18;;:::i;:::-;133:2;866:13469:3;;;;;;;;;;;;;;11751:48;258:43:24;;;;:::i;11751:48:3:-;11813:8;;11809:38;;11137:766;:::o;13803:30::-;;;;;;;;;;;;;;;;;:::i;:::-;;;866:13469;;;;11377:32;866:13469;;13803:30;;;;;;-1:-1:-1;13803:30:3;;11326:41;866:13469;;-1:-1:-1;;;11357:10:3;;;;;14160:173;;14281:43;;866:13469;;14281:43;;;;;;866:13469;-1:-1:-1;;;866:13469:3;;;;;;;;-1:-1:-1;;;866:13469:3;;;;14281:43;;;;;;;;;:::i;:::-;866:13469;;;;14281:43;866:13469;;;;14260:66;14160:173;:::o;866:13469::-;;;;14281:43;866:13469;;;;;14160:173;:::o;13846:308::-;866:13469;;-1:-1:-1;;;14030:103:3;;866:13469;14030:103;;;866:13469;-1:-1:-1;;;;;866:13469:3;14030:103;866:13469;;;14030:16;866:13469;;14030:103;;;;;;;-1:-1:-1;14030:103:3;;;866:13469;;13846:308;:::o;14030:103::-;;;;;;;;;;;;;;;;;:::i;:::-;;;1097:25:22;;;;866:13469:3;;;:::i;:::-;;13846:308;:::o;14030:103::-;;;-1:-1:-1;14030:103:3;;12952:126;866:13469;;-1:-1:-1;;;13026:45:3;;;866:13469;13026:45;866:13469;13050:4;13026:45;;;;;;;;;;;13019:52;12952:126;:::o;13026:45::-;;;;;;;;;;;;;;;;;:::i;:::-;;;866:13469;;;;;12952:126;:::o;13026:45::-;;;-1:-1:-1;13026:45:3;
Swarm Source
ipfs://0bef7ab9ab98be326f4d717267f85fdc8f10a33d4632835378b3cd973b673ad0
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
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.