GToken

GToken vault contract, direct counterparty to trades happening on gTrade

Methods

MIN_LOCK_DURATION

function MIN_LOCK_DURATION() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

accBlockWeightedMarketCap

function accBlockWeightedMarketCap() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

accBlockWeightedMarketCapLastStored

function accBlockWeightedMarketCapLastStored() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

accPnlPerToken

function accPnlPerToken() external view returns (int256)

Returns

NameTypeDescription

_0

int256

undefined

accPnlPerTokenUsed

function accPnlPerTokenUsed() external view returns (int256)

Returns

NameTypeDescription

_0

int256

undefined

accRewardsPerToken

function accRewardsPerToken() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

admin

function admin() external view returns (address)

Returns

NameTypeDescription

_0

address

undefined

allowance

function allowance(address owner, address spender) external view returns (uint256)

See {IERC20-allowance}.

Parameters

NameTypeDescription

owner

address

undefined

spender

address

undefined

Returns

NameTypeDescription

_0

uint256

undefined

approve

function approve(address spender, uint256 amount) external nonpayable returns (bool)

See {IERC20-approve}. NOTE: If amount is the maximum uint256, the allowance is not updated on transferFrom. This is semantically equivalent to an infinite approval. Requirements: - spender cannot be the zero address.

Parameters

NameTypeDescription

spender

address

undefined

amount

uint256

undefined

Returns

NameTypeDescription

_0

bool

undefined

asset

function asset() external view returns (address)

*See {IERC4626-asset}. *

Returns

NameTypeDescription

_0

address

undefined

assetsToDeplete

function assetsToDeplete() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

availableAssets

function availableAssets() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

balanceOf

function balanceOf(address account) external view returns (uint256)

See {IERC20-balanceOf}.

Parameters

NameTypeDescription

account

address

undefined

Returns

NameTypeDescription

_0

uint256

undefined

cancelWithdrawRequest

function cancelWithdrawRequest(uint256 shares, address owner, uint256 unlockEpoch) external nonpayable

Parameters

NameTypeDescription

shares

uint256

undefined

owner

address

undefined

unlockEpoch

uint256

undefined

collateralConfig

function collateralConfig() external view returns (uint128 precision, uint128 precisionDelta)

Returns

NameTypeDescription

precision

uint128

undefined

precisionDelta

uint128

undefined

collateralizationP

function collateralizationP() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

convertToAssets

function convertToAssets(uint256 shares) external view returns (uint256)

*See {IERC4626-convertToAssets}. *

Parameters

NameTypeDescription

shares

uint256

undefined

Returns

NameTypeDescription

_0

uint256

undefined

convertToShares

function convertToShares(uint256 assets) external view returns (uint256)

*See {IERC4626-convertToShares}. *

Parameters

NameTypeDescription

assets

uint256

undefined

Returns

NameTypeDescription

_0

uint256

undefined

currentEpoch

function currentEpoch() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

currentEpochPositiveOpenPnl

function currentEpochPositiveOpenPnl() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

currentEpochStart

function currentEpochStart() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

currentMaxSupply

function currentMaxSupply() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

dailyAccPnlDelta

function dailyAccPnlDelta() external view returns (int256)

Returns

NameTypeDescription

_0

int256

undefined

dailyMintedGns

function dailyMintedGns() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

decimals

function decimals() external view returns (uint8)

Returns

NameTypeDescription

_0

uint8

undefined

decreaseAllowance

function decreaseAllowance(address spender, uint256 subtractedValue) external nonpayable returns (bool)

Atomically decreases the allowance granted to spender by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - spender cannot be the zero address. - spender must have allowance for the caller of at least subtractedValue.

Parameters

NameTypeDescription

spender

address

undefined

subtractedValue

uint256

undefined

Returns

NameTypeDescription

_0

bool

undefined

deplete

function deplete(uint256 assets) external nonpayable

Parameters

NameTypeDescription

assets

uint256

undefined

deposit

function deposit(uint256 assets, address receiver) external nonpayable returns (uint256)

*See {IERC4626-deposit}. *

Parameters

NameTypeDescription

assets

uint256

undefined

receiver

address

undefined

Returns

NameTypeDescription

_0

uint256

undefined

depositWithDiscountAndLock

function depositWithDiscountAndLock(uint256 assets, uint256 lockDuration, address receiver) external nonpayable returns (uint256)

Parameters

NameTypeDescription

assets

uint256

undefined

lockDuration

uint256

undefined

receiver

address

undefined

Returns

NameTypeDescription

_0

uint256

undefined

distributeReward

function distributeReward(uint256 assets) external nonpayable

Parameters

NameTypeDescription

assets

uint256

undefined

getLockedDeposit

function getLockedDeposit(uint256 depositId) external view returns (struct IGToken.LockedDeposit)

Parameters

NameTypeDescription

depositId

uint256

undefined

Returns

NameTypeDescription

_0

IGToken.LockedDeposit

undefined

gnsPriceProvider

function gnsPriceProvider() external view returns (address addr, bytes signature)

Returns

NameTypeDescription

addr

address

undefined

signature

bytes

undefined

gnsToken

function gnsToken() external view returns (address)

Returns

NameTypeDescription

_0

address

undefined

gnsTokenToAssetsPrice

function gnsTokenToAssetsPrice() external view returns (uint256 price)

Returns

NameTypeDescription

price

uint256

undefined

increaseAllowance

function increaseAllowance(address spender, uint256 addedValue) external nonpayable returns (bool)

Atomically increases the allowance granted to spender by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - spender cannot be the zero address.

Parameters

NameTypeDescription

spender

address

undefined

addedValue

uint256

undefined

Returns

NameTypeDescription

_0

bool

undefined

initialize

function initialize(IGToken.Meta _meta, IGToken.ContractAddresses _contractAddresses, uint256 _MIN_LOCK_DURATION, uint256 _maxAccOpenPnlDelta, uint256 _maxDailyAccPnlDelta, uint256[2] _withdrawLockThresholdsP, uint256 _maxSupplyIncreaseDailyP, uint256 _lossesBurnP, uint256 _maxGnsSupplyMintDailyP, uint256 _maxDiscountP, uint256 _maxDiscountThresholdP) external nonpayable

Parameters

NameTypeDescription

_meta

IGToken.Meta

undefined

_contractAddresses

IGToken.ContractAddresses

undefined

_MIN_LOCK_DURATION

uint256

undefined

_maxAccOpenPnlDelta

uint256

undefined

_maxDailyAccPnlDelta

uint256

undefined

_withdrawLockThresholdsP

uint256[2]

undefined

_maxSupplyIncreaseDailyP

uint256

undefined

_lossesBurnP

uint256

undefined

_maxGnsSupplyMintDailyP

uint256

undefined

_maxDiscountP

uint256

undefined

_maxDiscountThresholdP

uint256

undefined

initializeV3

function initializeV3() external nonpayable

lastDailyAccPnlDeltaReset

function lastDailyAccPnlDeltaReset() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

lastDailyMintedGnsReset

function lastDailyMintedGnsReset() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

lastMaxSupplyUpdate

function lastMaxSupplyUpdate() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

lockDiscountP

function lockDiscountP(uint256 collatP, uint256 lockDuration) external view returns (uint256)

Parameters

NameTypeDescription

collatP

uint256

undefined

lockDuration

uint256

undefined

Returns

NameTypeDescription

_0

uint256

undefined

lockedDepositNft

function lockedDepositNft() external view returns (contract IGTokenLockedDepositNft)

Returns

NameTypeDescription

_0

contract IGTokenLockedDepositNft

undefined

lockedDeposits

function lockedDeposits(uint256) external view returns (address owner, uint256 shares, uint256 assetsDeposited, uint256 assetsDiscount, uint256 atTimestamp, uint256 lockDuration)

Parameters

NameTypeDescription

_0

uint256

undefined

Returns

NameTypeDescription

owner

address

undefined

shares

uint256

undefined

assetsDeposited

uint256

undefined

assetsDiscount

uint256

undefined

atTimestamp

uint256

undefined

lockDuration

uint256

undefined

lockedDepositsCount

function lockedDepositsCount() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

lossesBurnP

function lossesBurnP() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

makeWithdrawRequest

function makeWithdrawRequest(uint256 shares, address owner) external nonpayable

Parameters

NameTypeDescription

shares

uint256

undefined

owner

address

undefined

manager

function manager() external view returns (address)

Returns

NameTypeDescription

_0

address

undefined

marketCap

function marketCap() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

maxAccOpenPnlDelta

function maxAccOpenPnlDelta() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

maxAccPnlPerToken

function maxAccPnlPerToken() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

maxDailyAccPnlDelta

function maxDailyAccPnlDelta() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

maxDeposit

function maxDeposit(address owner) external view returns (uint256)

Parameters

NameTypeDescription

owner

address

undefined

Returns

NameTypeDescription

_0

uint256

undefined

maxDiscountP

function maxDiscountP() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

maxDiscountThresholdP

function maxDiscountThresholdP() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

maxGnsSupplyMintDailyP

function maxGnsSupplyMintDailyP() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

maxMint

function maxMint(address) external view returns (uint256)

*See {IERC4626-maxMint}. *

Parameters

NameTypeDescription

_0

address

undefined

Returns

NameTypeDescription

_0

uint256

undefined

maxRedeem

function maxRedeem(address owner) external view returns (uint256)

*See {IERC4626-maxRedeem}. *

Parameters

NameTypeDescription

owner

address

undefined

Returns

NameTypeDescription

_0

uint256

undefined

maxSupplyIncreaseDailyP

function maxSupplyIncreaseDailyP() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

maxWithdraw

function maxWithdraw(address owner) external view returns (uint256)

*See {IERC4626-maxWithdraw}. *

Parameters

NameTypeDescription

owner

address

undefined

Returns

NameTypeDescription

_0

uint256

undefined

mint

function mint(uint256 shares, address receiver) external nonpayable returns (uint256)

See {IERC4626-mint}. As opposed to {deposit}, minting is allowed even if the vault is in a state where the price of a share is zero. In this case, the shares will be minted without requiring any assets to be deposited.

Parameters

NameTypeDescription

shares

uint256

undefined

receiver

address

undefined

Returns

NameTypeDescription

_0

uint256

undefined

mintWithDiscountAndLock

function mintWithDiscountAndLock(uint256 shares, uint256 lockDuration, address receiver) external nonpayable returns (uint256)

Parameters

NameTypeDescription

shares

uint256

undefined

lockDuration

uint256

undefined

receiver

address

undefined

Returns

NameTypeDescription

_0

uint256

undefined

name

function name() external view returns (string)

Returns the name of the token.

Returns

NameTypeDescription

_0

string

undefined

openTradesPnlFeed

function openTradesPnlFeed() external view returns (contract IGTokenOpenPnlFeed)

Returns

NameTypeDescription

_0

contract IGTokenOpenPnlFeed

undefined

owner

function owner() external view returns (address)

Returns the address of the current owner.

Returns

NameTypeDescription

_0

address

undefined

pnlHandler

function pnlHandler() external view returns (address)

Returns

NameTypeDescription

_0

address

undefined

previewDeposit

function previewDeposit(uint256 assets) external view returns (uint256)

*See {IERC4626-previewDeposit}. *

Parameters

NameTypeDescription

assets

uint256

undefined

Returns

NameTypeDescription

_0

uint256

undefined

previewMint

function previewMint(uint256 shares) external view returns (uint256)

*See {IERC4626-previewMint}. *

Parameters

NameTypeDescription

shares

uint256

undefined

Returns

NameTypeDescription

_0

uint256

undefined

previewRedeem

function previewRedeem(uint256 shares) external view returns (uint256)

*See {IERC4626-previewRedeem}. *

Parameters

NameTypeDescription

shares

uint256

undefined

Returns

NameTypeDescription

_0

uint256

undefined

previewWithdraw

function previewWithdraw(uint256 assets) external view returns (uint256)

*See {IERC4626-previewWithdraw}. *

Parameters

NameTypeDescription

assets

uint256

undefined

Returns

NameTypeDescription

_0

uint256

undefined

receiveAssets

function receiveAssets(uint256 assets, address user) external nonpayable

Parameters

NameTypeDescription

assets

uint256

undefined

user

address

undefined

redeem

function redeem(uint256 shares, address receiver, address owner) external nonpayable returns (uint256)

*See {IERC4626-redeem}. *

Parameters

NameTypeDescription

shares

uint256

undefined

receiver

address

undefined

owner

address

undefined

Returns

NameTypeDescription

_0

uint256

undefined

refill

function refill(uint256 assets) external nonpayable

Parameters

NameTypeDescription

assets

uint256

undefined

renounceOwnership

function renounceOwnership() external nonpayable

Leaves the contract without owner. It will not be possible to call onlyOwner functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.

sendAssets

function sendAssets(uint256 assets, address receiver) external nonpayable

Parameters

NameTypeDescription

assets

uint256

undefined

receiver

address

undefined

shareToAssetsPrice

function shareToAssetsPrice() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

symbol

function symbol() external view returns (string)

Returns the symbol of the token, usually a shorter version of the name.

Returns

NameTypeDescription

_0

string

undefined

totalAssets

function totalAssets() external view returns (uint256)

*See {IERC4626-totalAssets}. *

Returns

NameTypeDescription

_0

uint256

undefined

totalClosedPnl

function totalClosedPnl() external view returns (int256)

Returns

NameTypeDescription

_0

int256

undefined

totalDepleted

function totalDepleted() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

totalDepletedGns

function totalDepletedGns() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

totalDeposited

function totalDeposited() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

totalDiscounts

function totalDiscounts() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

totalLiability

function totalLiability() external view returns (int256)

Returns

NameTypeDescription

_0

int256

undefined

totalLockedDiscounts

function totalLockedDiscounts() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

totalRefilled

function totalRefilled() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

totalRefilledGns

function totalRefilledGns() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

totalRewards

function totalRewards() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

totalSharesBeingWithdrawn

function totalSharesBeingWithdrawn(address owner) external view returns (uint256 shares)

Parameters

NameTypeDescription

owner

address

undefined

Returns

NameTypeDescription

shares

uint256

undefined

totalSupply

function totalSupply() external view returns (uint256)

See {IERC20-totalSupply}.

Returns

NameTypeDescription

_0

uint256

undefined

transfer

function transfer(address to, uint256 amount) external nonpayable returns (bool)

Parameters

NameTypeDescription

to

address

undefined

amount

uint256

undefined

Returns

NameTypeDescription

_0

bool

undefined

transferFrom

function transferFrom(address from, address to, uint256 amount) external nonpayable returns (bool)

Parameters

NameTypeDescription

from

address

undefined

to

address

undefined

amount

uint256

undefined

Returns

NameTypeDescription

_0

bool

undefined

transferOwnership

function transferOwnership(address newOwner) external nonpayable

Transfers ownership of the contract to a new account (newOwner). Can only be called by the current owner.

Parameters

NameTypeDescription

newOwner

address

undefined

tryNewOpenPnlRequestOrEpoch

function tryNewOpenPnlRequestOrEpoch() external nonpayable

tryResetDailyAccPnlDelta

function tryResetDailyAccPnlDelta() external nonpayable

tryUpdateCurrentMaxSupply

function tryUpdateCurrentMaxSupply() external nonpayable

tvl

function tvl() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

unlockDeposit

function unlockDeposit(uint256 depositId, address receiver) external nonpayable

Parameters

NameTypeDescription

depositId

uint256

undefined

receiver

address

undefined

updateAccPnlPerTokenUsed

function updateAccPnlPerTokenUsed(uint256 prevPositiveOpenPnl, uint256 newPositiveOpenPnl) external nonpayable returns (uint256)

Parameters

NameTypeDescription

prevPositiveOpenPnl

uint256

undefined

newPositiveOpenPnl

uint256

undefined

Returns

NameTypeDescription

_0

uint256

undefined

updateAdmin

function updateAdmin(address newValue) external nonpayable

Parameters

NameTypeDescription

newValue

address

undefined

updateDelegatee

function updateDelegatee(address _delegatee) external nonpayable

Parameters

NameTypeDescription

_delegatee

address

undefined

updateGnsPriceProvider

function updateGnsPriceProvider(IGToken.GnsPriceProvider newValue) external nonpayable

Parameters

NameTypeDescription

newValue

IGToken.GnsPriceProvider

undefined

updateLossesBurnP

function updateLossesBurnP(uint256 newValue) external nonpayable

Parameters

NameTypeDescription

newValue

uint256

undefined

updateManager

function updateManager(address newValue) external nonpayable

Parameters

NameTypeDescription

newValue

address

undefined

updateMaxAccOpenPnlDelta

function updateMaxAccOpenPnlDelta(uint256 newValue) external nonpayable

Parameters

NameTypeDescription

newValue

uint256

undefined

updateMaxDailyAccPnlDelta

function updateMaxDailyAccPnlDelta(uint256 newValue) external nonpayable

Parameters

NameTypeDescription

newValue

uint256

undefined

updateMaxDiscountP

function updateMaxDiscountP(uint256 newValue) external nonpayable

Parameters

NameTypeDescription

newValue

uint256

undefined

updateMaxDiscountThresholdP

function updateMaxDiscountThresholdP(uint256 newValue) external nonpayable

Parameters

NameTypeDescription

newValue

uint256

undefined

updateMaxGnsSupplyMintDailyP

function updateMaxGnsSupplyMintDailyP(uint256 newValue) external nonpayable

Parameters

NameTypeDescription

newValue

uint256

undefined

updateMaxSupplyIncreaseDailyP

function updateMaxSupplyIncreaseDailyP(uint256 newValue) external nonpayable

Parameters

NameTypeDescription

newValue

uint256

undefined

updateOpenTradesPnlFeed

function updateOpenTradesPnlFeed(address newValue) external nonpayable

Parameters

NameTypeDescription

newValue

address

undefined

updatePnlHandler

function updatePnlHandler(address newValue) external nonpayable

Parameters

NameTypeDescription

newValue

address

undefined

updateWithdrawLockThresholdsP

function updateWithdrawLockThresholdsP(uint256[2] newValue) external nonpayable

Parameters

NameTypeDescription

newValue

uint256[2]

undefined

withdraw

function withdraw(uint256 assets, address receiver, address owner) external nonpayable returns (uint256)

*See {IERC4626-withdraw}. *

Parameters

NameTypeDescription

assets

uint256

undefined

receiver

address

undefined

owner

address

undefined

Returns

NameTypeDescription

_0

uint256

undefined

withdrawEpochsTimelock

function withdrawEpochsTimelock() external view returns (uint256)

Returns

NameTypeDescription

_0

uint256

undefined

withdrawLockThresholdsP

function withdrawLockThresholdsP(uint256) external view returns (uint256)

Parameters

NameTypeDescription

_0

uint256

undefined

Returns

NameTypeDescription

_0

uint256

undefined

withdrawRequests

function withdrawRequests(address, uint256) external view returns (uint256)

Parameters

NameTypeDescription

_0

address

undefined

_1

uint256

undefined

Returns

NameTypeDescription

_0

uint256

undefined

Events

AccPnlPerTokenUsedUpdated

event AccPnlPerTokenUsedUpdated(address indexed sender, uint256 indexed newEpoch, uint256 prevPositiveOpenPnl, uint256 newPositiveOpenPnl, uint256 newEpochPositiveOpenPnl, int256 newAccPnlPerTokenUsed)

Parameters

NameTypeDescription

sender indexed

address

undefined

newEpoch indexed

uint256

undefined

prevPositiveOpenPnl

uint256

undefined

newPositiveOpenPnl

uint256

undefined

newEpochPositiveOpenPnl

uint256

undefined

newAccPnlPerTokenUsed

int256

undefined

AdminUpdated

event AdminUpdated(address newValue)

Parameters

NameTypeDescription

newValue

address

undefined

Approval

event Approval(address indexed owner, address indexed spender, uint256 value)

Emitted when the allowance of a spender for an owner is set by a call to {approve}. value is the new allowance.

Parameters