OtcUtils

OTC facet internal library

initializeOtc

function initializeOtc(struct IOtc.OtcConfig _config) internal

Check IOtcUtils interface for documentation

updateOtcConfig

function updateOtcConfig(struct IOtc.OtcConfig _config) internal

Check IOtcUtils interface for documentation

addOtcCollateralBalance

function addOtcCollateralBalance(uint8 _collateralIndex, uint256 _collateralAmount) internal

Check IOtcUtils interface for documentation

sellGnsForCollateral

function sellGnsForCollateral(uint8 _collateralIndex, uint256 _collateralAmount) internal

Check IOtcUtils interface for documentation

getOtcConfig

Check IOtcUtils interface for documentation

getOtcBalance

Check IOtcUtils interface for documentation

getOtcRate

Check IOtcUtils interface for documentation

_getSlot

Returns storage slot to use when fetching storage relevant to library

_getStorage

Returns storage pointer for storage struct in diamond contract, at defined slot

_getMultiCollatDiamond

Returns current address as multi-collateral diamond interface to call other facets functions.

_calculateGnsAmount

Calculate GNS amount for given collateral amount

Parameters

Name
Type
Description

_collateralIndex

uint8

index of the collateral

_collateralAmount

uint256

amount of collateral (collateral precision)

_gnsPriceCollateral

uint256

price of GNS in collateral (1e10)

_calculateGnsDistribution

Calculate GNS distribution for treasury, GNS staking and burn

Parameters

Name
Type
Description

_gnsAmount

uint256

amount of GNS tokens to distribute (1e18)

_distributeTreasuryGns

Distributes treasury rewards in GNS tokens

Parameters

Name
Type
Description

_gnsAmount

uint256

amount of GNS tokens to distribute (1e18)

_distributeStakingGns

Distributes staking rewards in GNS tokens

Parameters

Name
Type
Description

_gnsAmount

uint256

amount of GNS tokens to distribute (1e18)

_burnGns

Burns GNS tokens

Parameters

Name
Type
Description

_gnsAmount

uint256

amount of GNS tokens to burn (1e18)

Was this helpful?