Gains Network
  • 📚Home
  • Gains Network
    • 🔎Overview
    • 🍏GNS Token
    • 📔Contract Addresses
      • Apechain Mainnet
      • Arbitrum Mainnet
      • Base Mainnet
      • Polygon Mainnet
  • gTrade (Leveraged Trading)
    • 🔎Overview
    • 🎛️Setting up to trade
      • 🟣Polygon Network Setup
      • 🔵Arbitrum Network Setup
    • 🏦Opening / Closing trades
    • 💲Trade Collaterals
      • Spotlight: WETH
    • 📖Asset classes
      • 🪙Cryptocurrencies
      • 💵Forex
      • 🛢️Commodities
    • 🎫Fees & Spread
    • 📰Pair List
    • 🧒How to use Practice Mode
    • ⚡One-Click Trading (1CT)
    • 🌌gTrade Solana
    • 📺Video tutorials
  • Loyalty Programs
    • Prime Trader
    • gTrade Credits
  • Community
    • gTrade Guardians
    • Governance forum
  • Reward Pools
    • 💚GNS Staking
    • 👛gToken Vaults
      • 👷Staker Functions
      • ❔Staker FAQ
      • ⏳Upgrades, updates, and timelocks
    • 🔼Active Pools & Incentives
  • Help
    • ❓FAQ
    • ⏳Chain congestion
  • Bridges
    • 🪐Arbitrum <-> Polygon Bridge
    • 🪐ERC20 Bridge (Polygon)
    • 🪐NFT Bridge (Polygon)
  • Developer
    • Integrators
      • Trading Contracts
      • Backend
      • Price Feed
      • Guides
        • v9 migration
        • Calculating borrowing fees
        • Calculating liquidation price
    • Technical Reference
      • Contracts
        • Changelogs
          • v9.2.1 Update
          • v9.1 Update
          • v9.1.1 Update
          • v9 Update
        • Core
          • Abstract
            • GNSAddressStore
            • GNSDiamondCut
            • GNSDiamondLoupe
            • GNSDiamondStorage
          • Facets
            • GNSBorrowingFees
            • GNSOtc
            • GNSPriceAggregator
            • GNSTradingInteractions
            • GNSTriggerRewards
            • GNSFeeTiers
            • GNSPairsStorage
            • GNSPriceImpact
            • GNSReferrals
            • GNSTradingCallbacks
            • GNSTradingStorage
          • GNSMultiCollatDiamond
          • GNSStaking
          • GToken
          • GTokenOpenPnlFeed
        • Interfaces
          • Libraries
            • IBorrowingFeesUtils
            • IOtcUtils
            • IPriceAggregatorUtils
            • ITriggerRewardsUtils
            • IFeeTiersUtils
            • IPairsStorageUtils
            • IPriceImpactUtils
            • IReferralsUtils
            • ITradingCallbacksUtils
            • ITradingCommonUtils
            • ITradingInteractionsUtils
            • ITradingStorageUtils
            • IUpdateLeverageUtils
            • IUpdatePositionSizeUtils
          • Types
            • IAddressStore
            • IBorrowingFees
            • IDiamondStorage
            • IOtc
            • IPriceAggregator
            • ITradingStorage
            • ITradingInteractions
            • ITriggerRewards
            • ITypes
            • IUpdateLeverage
            • IPairsStorage
            • IFeeTiers
            • IPriceImpact
            • IReferrals
            • ITradingCallbacks
            • IUpdatePositionSize
          • IChainlinkFeed
          • IArbSys
          • IChainlinkOracle
          • IERC20
          • IERC721
          • IERC721Design
          • IGeneralErrors
          • IGNSAddressStore
          • IGNSDiamond
          • IGNSDiamondCut
          • IGNSMultiCollatDiamond
          • IGNSDiamondLoupe
          • IGNSStaking
          • IGToken
          • IGTokenLockedDepositNft
          • IGTokenOpenPnlFeed
          • IGTokenLockedDepositNftDesign
          • ILiquidityPool
          • IRateProvider
          • IOwnable
        • Libraries
          • updateLeverage
            • UpdateLeverageLifecycles
          • updatePositionSize
            • IncreasePositionSizeUtils
            • DecreasePositionSizeUtils
            • UpdatePositionSizeLifecycles
          • AddressStoreUtils
          • ChainlinkClientUtils
          • ChainUtils
          • ConstantsUtils
          • CollateralUtils
          • DiamondUtils
          • LiquidityPoolUtils
          • OtcUtils
          • PackingUtils
          • StorageUtils
          • TriggerRewardsUtils
          • ArrayGetters
          • BorrowingFeesUtils
          • FeeTiersUtils
          • PriceAggregatorUtils
          • PriceImpactUtils
          • ReferralsUtils
          • TradingCallbacksUtils
          • PairsStorageUtils
          • TradingCommonUtils
          • TradingStorageUtils
          • TradingInteractionsUtils
        • Misc
          • EpochBasedTokenClaim
          • GNSCompensationHandler
          • GTokenRateProvider
          • GTokenLockedDepositNftDesign
          • ManagerTimelock
          • OwnerTimelock
          • VotingDelegator
        • Tokens
          • GainsNetworkToken
          • GTokenLockedDepositNft
      • Backend
        • Backend Types
      • SDK
        • Client Types
  • Archived
    • 🖼️gFARM2 NFTs
Powered by GitBook
On this page
  • initializeOtc
  • Parameters
  • updateOtcConfig
  • Parameters
  • addOtcCollateralBalance
  • Parameters
  • sellGnsForCollateral
  • Parameters
  • getOtcConfig
  • getOtcBalance
  • Parameters
  • getOtcRate
  • Parameters
  • OtcConfigUpdated
  • Parameters
  • OtcBalanceUpdated
  • Parameters
  • OtcExecuted
  • Parameters
  • InvalidShareSum

Was this helpful?

  1. Developer
  2. Technical Reference
  3. Contracts
  4. Interfaces
  5. Libraries

IOtcUtils

Interface for GNSOtc facet (inherits types and also contains functions, events, and custom errors)

initializeOtc

function initializeOtc(struct IOtc.OtcConfig _config) external

Initializer for OTC facet

Parameters

Name
Type
Description

_config

new OTC Config

updateOtcConfig

function updateOtcConfig(struct IOtc.OtcConfig _config) external

Updates OTC config

Parameters

Name
Type
Description

_config

new OTC Config. Sum of treasuryShareP, stakingShareP, burnShareP must equal 100 and premiumP must be less than or equal to MAX_PREMIUM_P

addOtcCollateralBalance

function addOtcCollateralBalance(uint8 _collateralIndex, uint256 _collateralAmount) external

Increases OTC balance for a collateral

Parameters

Name
Type
Description

_collateralIndex

uint8

collateral index

_collateralAmount

uint256

amount of collateral to increase (collateral precision)

sellGnsForCollateral

function sellGnsForCollateral(uint8 _collateralIndex, uint256 _collateralAmount) external

OTC Buys GNS from caller for _amountCollateral of _collateralIndex

Parameters

Name
Type
Description

_collateralIndex

uint8

collateral index

_collateralAmount

uint256

amount of collateral to trade (collateral precision)

getOtcConfig

function getOtcConfig() external view returns (struct IOtc.OtcConfig)

Returns OTC Config

getOtcBalance

function getOtcBalance(uint8 _collateralIndex) external view returns (uint256)

Returns OTC balance for a collateral (collateral precision)

Parameters

Name
Type
Description

_collateralIndex

uint8

collateral index

getOtcRate

function getOtcRate(uint8 _collateralIndex) external view returns (uint256)

Returns OTC rate (price + premium) of GNS in collateral (1e10)

Parameters

Name
Type
Description

_collateralIndex

uint8

collateral index

OtcConfigUpdated

event OtcConfigUpdated(struct IOtc.OtcConfig config)

Emitted when OTCConfig is updated

Parameters

Name
Type
Description

config

struct IOtc.OtcConfig

new OTC config

OtcBalanceUpdated

event OtcBalanceUpdated(uint8 collateralIndex, uint256 balanceCollateral)

Emitted when OTC balance is updated

Parameters

Name
Type
Description

collateralIndex

uint8

collateral index

balanceCollateral

uint256

new balance (collateral precision)

OtcExecuted

event OtcExecuted(uint8 collateralIndex, uint256 collateralAmount, uint256 gnsPriceCollateral, uint256 treasuryAmountGns, uint256 stakingAmountGns, uint256 burnAmountGns)

Emitted when an OTC trade is executed

Parameters

Name
Type
Description

collateralIndex

uint8

collateral index

collateralAmount

uint256

amount of collateral traded (collateral precision)

gnsPriceCollateral

uint256

effective gns/collateral price, including premium (1e10)

treasuryAmountGns

uint256

amount of GNS sent to treasury (1e18)

stakingAmountGns

uint256

amount of GNS sent to GNS Staking (1e18)

burnAmountGns

uint256

amount of GNS burned (1e18)

InvalidShareSum

error InvalidShareSum()
PreviousIBorrowingFeesUtilsNextIPriceAggregatorUtils

Last updated 8 months ago

Was this helpful?

IOtc.OtcConfig
IOtc.OtcConfig