Solidity API
LiquidationAuction02
vault
vaultManagerParameters
cdpRegistry
forceTransferAssetStore
DENOMINATOR_1E2
WRAPPED_TO_UNDERLYING_ORACLE_TYPE
Buyout
Trigger when buyouts are happened
checkpoint
constructor
_vaultManagerParameters
address
The address of the contract with Vault manager parameters
_cdpRegistry
address
The address of the CDP registry
_forceTransferAssetStore
address
The address of the ForceTransferAssetStore
buyout
Buyouts a position's collateral
asset
address
The address of the main collateral token of a position
owner
address
The owner of a position
_liquidate
_calcLiquidationParams
CDPRegistry
CDP
cdpList
cdpIndex
vault
cr
Added
Removed
constructor
checkpoint
batchCheckpointForAsset
batchCheckpoint
isAlive
isListed
_removeCdp
_addCdp
getCdpsByCollateral
getCdpsByOwner
getAllCdps
getCdpsCount
getCdpsCountForCollateral
CollateralRegistry
CollateralAdded
CollateralRemoved
collateralId
collateralList
constructor
addCollateral
removeCollateral
isCollateral
collaterals
collateralsCount
GCD
ERC20 token
name
symbol
version
decimals
totalSupply
balanceOf
allowance
Approval
Trigger on any successful call to approve(address spender, uint amount)
Transfer
Trigger when tokens are transferred, including zero value transfers
initialize
_parameters
address
The address of system parameters contract
_authorizeUpgrade
Restricted upgrades function
mint
Only Vault can mint GCD
Mints 'amount' of tokens to address 'to', and MUST fire the Transfer event
to
address
The address of the recipient
amount
uint256
The amount of token to be minted
burn
Only manager can burn tokens from manager's balance
Burns 'amount' of tokens, and MUST fire the Transfer event
amount
uint256
The amount of token to be burned
burn
Only Vault can burn tokens from any balance
Burns 'amount' of tokens from 'from' address, and MUST fire the Transfer event
from
address
The address of the balance owner
amount
uint256
The amount of token to be burned
transfer
_Transfers 'amount' of tokens to address 'to', and MUST fire the Transfer event. The function SHOULD throw if the from account balance does not have enough tokens to spend.
to
address
The address of the recipient
amount
uint256
The amount of token to be transferred
transferFrom
Transfers 'amount' of tokens from address 'from' to address 'to', and MUST fire the Transfer event
from
address
The address of the sender
to
address
The address of the recipient
amount
uint256
The amount of token to be transferred
approve
Allows 'spender' to withdraw from your account multiple times, up to the 'amount' amount. If this function is called again it overwrites the current allowance with 'amount'.
spender
address
The address of the account able to transfer the tokens
amount
uint256
The amount of tokens to be approved for transfer
increaseAllowance
_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._
decreaseAllowance
_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 leastsubtractedValue
._
_approve
_burn
CDPManager01
vault
vaultManagerParameters
oracleRegistry
cdpRegistry
WETH
Q112
DENOMINATOR_1E5
Join
Trigger when joins are happened
Exit
Trigger when exits are happened
LiquidationTriggered
Trigger when liquidations are initiated
checkpoint
constructor
_vaultManagerParameters
address
The address of the contract with Vault manager parameters
_oracleRegistry
address
The address of the oracle registry
_cdpRegistry
address
The address of the CDP registry
receive
join
Depositing tokens must be pre-approved to Vault address position actually considered as spawned only when debt > 0
Deposits collateral and/or borrows GCD
asset
address
The address of the collateral
assetAmount
uint256
The amount of the collateral to deposit
gcdAmount
uint256
The amount of GCD token to borrow
join_Eth
Deposits ETH and/or borrows GCD
gcdAmount
uint256
The amount of GCD token to borrow
exit
Tx sender must have a sufficient GCD balance to pay the debt
Withdraws collateral and repays specified amount of debt
asset
address
The address of the collateral
assetAmount
uint256
The amount of the collateral to withdraw
gcdAmount
uint256
The amount of GCD to repay
exit_targetRepayment
Repayment is the sum of the principal and interest
Withdraws collateral and repays specified amount of debt
asset
address
The address of the collateral
assetAmount
uint256
The amount of the collateral to withdraw
repayment
uint256
The target repayment amount
exit_Eth
Withdraws WETH and converts to ETH
ethAmount
uint256
ETH amount to withdraw
gcdAmount
uint256
The amount of GCD token to repay
exit_Eth_targetRepayment
Repayment is the sum of the principal and interest
Withdraws WETH and converts to ETH
ethAmount
uint256
ETH amount to withdraw
repayment
uint256
The target repayment amount
_repay
_ensurePositionCollateralization
triggerLiquidation
Triggers liquidation of a position
asset
address
The address of the collateral token of a position
owner
address
The owner of the position
getCollateralUsdValue_q112
_isLiquidatablePosition
Determines whether a position is liquidatable
asset
address
The address of the collateral
owner
address
The owner of the position
usdValue_q112
uint256
Q112-encoded USD value of the collateral
[0]
bool
boolean value, whether a position is liquidatable
_ensureOracle
isLiquidatablePosition
Determines whether a position is liquidatable
asset
address
The address of the collateral
owner
address
The owner of the position
[0]
bool
boolean value, whether a position is liquidatable
utilizationRatio
Calculates current utilization ratio
asset
address
The address of the collateral
owner
address
The owner of the position
[0]
uint256
utilization ratio
liquidationPrice_q112
Calculates liquidation price
asset
address
The address of the collateral
owner
address
The owner of the position
[0]
uint256
Q112-encoded liquidation price
_calcPrincipal
VaultManagerParameters
initialCollateralRatio
liquidationRatio
liquidationDiscount
devaluationPeriod
constructor
setCollateral
Only manager is able to call this function
Sets ability to use token as the main collateral
asset
address
The address of the main collateral token
stabilityFeeValue
uint256
The percentage of the year stability fee (3 decimals)
liquidationFeeValue
uint256
The liquidation fee percentage (0 decimals)
initialCollateralRatioValue
uint256
The initial collateralization ratio
liquidationRatioValue
uint256
The liquidation ratio
liquidationDiscountValue
uint256
The liquidation discount (3 decimals)
devaluationPeriodValue
uint256
The devaluation period in blocks
gcdLimit
uint256
The GCD token issue limit
oracles
uint256[]
The enabled oracles type IDs
setInitialCollateralRatio
Only manager is able to call this function
Sets the initial collateral ratio
asset
address
The address of the main collateral token
newValue
uint256
The collateralization ratio (0 decimals)
setLiquidationRatio
Only manager is able to call this function
Sets the liquidation ratio
asset
address
The address of the main collateral token
newValue
uint256
The liquidation ratio (0 decimals)
setLiquidationDiscount
Only manager is able to call this function
Sets the liquidation discount
asset
address
The address of the main collateral token
newValue
uint256
The liquidation discount (3 decimals)
setDevaluationPeriod
Only manager is able to call this function
Sets the devaluation period of collateral after liquidation
asset
address
The address of the main collateral token
newValue
uint256
The devaluation period in blocks
Vault
Vault is the core of GCD Protocol GCD Stablecoin system
Vault stores and manages collateral funds of all positions and counts debts
Only Vault can manage supply of GCD token
Vault will not be changed/upgraded after initial deployment for the current stablecoin version
weth
DENOMINATOR_1E5
DENOMINATOR_1E2
gcd
collaterals
debts
liquidationBlock
liquidationPrice
tokenDebts
stabilityFee
liquidationFee
oracleType
lastUpdate
notLiquidating
initialize
_parameters
address
The address of the system parameters
_gcd
address
GCD token address
_weth
address payable
_authorizeUpgrade
Restricted upgrades function
receive
update
Updates parameters of the position to the current ones
asset
address
The address of the main collateral token
user
address
The owner of a position
spawn
Creates new position for user
asset
address
The address of the main collateral token
user
address
The address of a position's owner
_oracleType
uint256
The type of an oracle
destroy
Clears unused storage variables
asset
address
The address of the main collateral token
user
address
The address of a position's owner
depositMain
Tokens must be pre-approved
Adds main collateral to a position
asset
address
The address of the main collateral token
user
address
The address of a position's owner
amount
uint256
The amount of tokens to deposit
depositEth
Converts ETH to WETH and adds main collateral to a position
user
address
The address of a position's owner
withdrawMain
Withdraws main collateral from a position
asset
address
The address of the main collateral token
user
address
The address of a position's owner
amount
uint256
The amount of tokens to withdraw
withdrawEth
Withdraws WETH collateral from a position converting WETH to ETH
user
address payable
The address of a position's owner
amount
uint256
The amount of ETH to withdraw
borrow
Increases position's debt and mints GCD token
asset
address
The address of the main collateral token
user
address
The address of a position's owner
amount
uint256
The amount of GCD to borrow
repay
Decreases position's debt and burns GCD token
asset
address
The address of the main collateral token
user
address
The address of a position's owner
amount
uint256
The amount of GCD to repay
[0]
uint256
updated debt of a position
chargeFee
Transfers fee to foundation
asset
address
The address of the fee asset
user
address
The address to transfer funds from
amount
uint256
The amount of asset to transfer
triggerLiquidation
Deletes position and transfers collateral to liquidation system
asset
address
The address of the main collateral token
positionOwner
address
The address of a position's owner
initialPrice
uint256
The starting price of collateral in GCD
liquidate
Internal liquidation process
asset
address
The address of the main collateral token
positionOwner
address
The address of a position's owner
mainAssetToLiquidator
uint256
The amount of main asset to send to a liquidator
mainAssetToPositionOwner
uint256
The amount of main asset to send to a position owner
repayment
uint256
The repayment in GCD
penalty
uint256
The liquidation penalty in GCD
liquidator
address
The address of a liquidator
changeOracleType
Only manager can call this function
Changes broken oracle type to the correct one
asset
address
The address of the main collateral token
user
address
The address of a position's owner
newOracleType
uint256
The new type of an oracle
getTotalDebt
Calculates the total amount of position's debt based on elapsed time
asset
address
The address of the main collateral token
user
address
The address of a position's owner
[0]
uint256
user debt of a position plus accumulated fee
calculateFee
Calculates the amount of fee based on elapsed time and repayment amount
asset
address
The address of the main collateral token
user
address
The address of a position's owner
amount
uint256
The repayment amount
[0]
uint256
fee amount
VaultParameters
stabilityFee
liquidationFee
tokenDebtLimit
canModifyVault
isManager
isOracleTypeEnabled
vault
foundation
initialize
The address for an Ethereum contract is deterministically computed from the address of its creator (sender) and how many transactions the creator has sent (nonce). The sender and nonce are RLP encoded and then hashed with Keccak-256. Therefore, the Vault address can be pre-computed and passed as an argument before deployment.
_authorizeUpgrade
Restricted upgrades function
setManager
Only manager is able to call this function
Grants and revokes manager's status of any address
who
address
The target address
permit
bool
The permission flag
setFoundation
Only manager is able to call this function
Sets the foundation address
newFoundation
address
The new foundation address
setCollateral
Only manager is able to call this function
Sets ability to use token as the main collateral
asset
address
The address of the main collateral token
stabilityFeeValue
uint256
The percentage of the year stability fee (3 decimals)
liquidationFeeValue
uint256
The liquidation fee percentage (0 decimals)
gcdLimit
uint256
The GCD token issue limit
oracles
uint256[]
The enables oracle types
setVaultAccess
Only manager is able to call this function
Sets a permission for an address to modify the Vault
who
address
The target address
permit
bool
The permission flag
setStabilityFee
Only manager is able to call this function
Sets the percentage of the year stability fee for a particular collateral
asset
address
The address of the main collateral token
newValue
uint256
The stability fee percentage (3 decimals)
setLiquidationFee
Only manager is able to call this function
Sets the percentage of the liquidation fee for a particular collateral
asset
address
The address of the main collateral token
newValue
uint256
The liquidation fee percentage (0 decimals)
setOracleType
Only manager is able to call this function
Enables/disables oracle types
_type
uint256
The type of the oracle
asset
address
The address of the main collateral token
enabled
bool
The control flag
setTokenDebtLimit
Only manager is able to call this function
Sets GCD limit for a specific collateral
asset
address
The address of the main collateral token
limit
uint256
The limit number
Last updated