Skip to main content
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

NameTypeDescription
_configIOtc.OtcConfignew OTC Config

updateOtcConfig

function updateOtcConfig(struct IOtc.OtcConfig _config) external
Updates OTC config

Parameters

NameTypeDescription
_configIOtc.OtcConfignew 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

NameTypeDescription
_collateralIndexuint8collateral index
_collateralAmountuint256amount of collateral to increase (collateral precision)

sellGnsForCollateral

function sellGnsForCollateral(uint8 _collateralIndex, uint256 _collateralAmount) external
OTC Buys GNS from caller for _amountCollateral of _collateralIndex

Parameters

NameTypeDescription
_collateralIndexuint8collateral index
_collateralAmountuint256amount 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

NameTypeDescription
_collateralIndexuint8collateral index

getOtcRate

function getOtcRate(uint8 _collateralIndex) external view returns (uint256)
Returns OTC rate (price + premium) of GNS in collateral (1e10)

Parameters

NameTypeDescription
_collateralIndexuint8collateral index

OtcConfigUpdated

event OtcConfigUpdated(struct IOtc.OtcConfig config)
Emitted when OTCConfig is updated

Parameters

NameTypeDescription
configstruct IOtc.OtcConfignew OTC config

OtcBalanceUpdated

event OtcBalanceUpdated(uint8 collateralIndex, uint256 balanceCollateral)
Emitted when OTC balance is updated

Parameters

NameTypeDescription
collateralIndexuint8collateral index
balanceCollateraluint256new 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

NameTypeDescription
collateralIndexuint8collateral index
collateralAmountuint256amount of collateral traded (collateral precision)
gnsPriceCollateraluint256effective gns/collateral price, including premium (1e10)
treasuryAmountGnsuint256amount of GNS sent to treasury (1e18)
stakingAmountGnsuint256amount of GNS sent to GNS Staking (1e18)
burnAmountGnsuint256amount of GNS burned (1e18)

InvalidShareSum

error InvalidShareSum()