All pages
Powered by GitBook
1 of 1

Loading...

Solidity API

LiquidationAuction02

vault

vaultManagerParameters

cdpRegistry

forceTransferAssetStore

DENOMINATOR_1E2

WRAPPED_TO_UNDERLYING_ORACLE_TYPE

Buyout

Trigger when buyouts are happened

checkpoint

constructor

Name
Type
Description

buyout

Buyouts a position's collateral

Name
Type
Description

_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

Name
Type
Description

_authorizeUpgrade

Restricted upgrades function

mint

Only Vault can mint GCD

Mints 'amount' of tokens to address 'to', and MUST fire the Transfer event

Name
Type
Description

burn

Only manager can burn tokens from manager's balance

Burns 'amount' of tokens, and MUST fire the Transfer event

Name
Type
Description

burn

Only Vault can burn tokens from any balance

Burns 'amount' of tokens from 'from' address, and MUST fire the Transfer event

Name
Type
Description

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.

Name
Type
Description

transferFrom

Transfers 'amount' of tokens from address 'from' to address 'to', and MUST fire the Transfer event

Name
Type
Description

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'.

Name
Type
Description

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 least subtractedValue._

_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

Name
Type
Description

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

Name
Type
Description

join_Eth

Deposits ETH and/or borrows GCD

Name
Type
Description

exit

Tx sender must have a sufficient GCD balance to pay the debt

Withdraws collateral and repays specified amount of debt

Name
Type
Description

exit_targetRepayment

Repayment is the sum of the principal and interest

Withdraws collateral and repays specified amount of debt

Name
Type
Description

exit_Eth

Withdraws WETH and converts to ETH

Name
Type
Description

exit_Eth_targetRepayment

Repayment is the sum of the principal and interest

Withdraws WETH and converts to ETH

Name
Type
Description

_repay

_ensurePositionCollateralization

triggerLiquidation

Triggers liquidation of a position

Name
Type
Description

getCollateralUsdValue_q112

_isLiquidatablePosition

Determines whether a position is liquidatable

Name
Type
Description
Name
Type
Description

_ensureOracle

isLiquidatablePosition

Determines whether a position is liquidatable

Name
Type
Description
Name
Type
Description

utilizationRatio

Calculates current utilization ratio

Name
Type
Description
Name
Type
Description

liquidationPrice_q112

Calculates liquidation price

Name
Type
Description
Name
Type
Description

_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

Name
Type
Description

setInitialCollateralRatio

Only manager is able to call this function

Sets the initial collateral ratio

Name
Type
Description

setLiquidationRatio

Only manager is able to call this function

Sets the liquidation ratio

Name
Type
Description

setLiquidationDiscount

Only manager is able to call this function

Sets the liquidation discount

Name
Type
Description

setDevaluationPeriod

Only manager is able to call this function

Sets the devaluation period of collateral after liquidation

Name
Type
Description

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

Name
Type
Description

_authorizeUpgrade

Restricted upgrades function

receive

update

Updates parameters of the position to the current ones

Name
Type
Description

spawn

Creates new position for user

Name
Type
Description

destroy

Clears unused storage variables

Name
Type
Description

depositMain

Tokens must be pre-approved

Adds main collateral to a position

Name
Type
Description

depositEth

Converts ETH to WETH and adds main collateral to a position

Name
Type
Description

withdrawMain

Withdraws main collateral from a position

Name
Type
Description

withdrawEth

Withdraws WETH collateral from a position converting WETH to ETH

Name
Type
Description

borrow

Increases position's debt and mints GCD token

Name
Type
Description

repay

Decreases position's debt and burns GCD token

Name
Type
Description
Name
Type
Description

chargeFee

Transfers fee to foundation

Name
Type
Description

triggerLiquidation

Deletes position and transfers collateral to liquidation system

Name
Type
Description

liquidate

Internal liquidation process

Name
Type
Description

changeOracleType

Only manager can call this function

Changes broken oracle type to the correct one

Name
Type
Description

getTotalDebt

Calculates the total amount of position's debt based on elapsed time

Name
Type
Description
Name
Type
Description

calculateFee

Calculates the amount of fee based on elapsed time and repayment amount

Name
Type
Description
Name
Type
Description

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

Name
Type
Description

setFoundation

Only manager is able to call this function

Sets the foundation address

Name
Type
Description

setCollateral

Only manager is able to call this function

Sets ability to use token as the main collateral

Name
Type
Description

setVaultAccess

Only manager is able to call this function

Sets a permission for an address to modify the Vault

Name
Type
Description

setStabilityFee

Only manager is able to call this function

Sets the percentage of the year stability fee for a particular collateral

Name
Type
Description

setLiquidationFee

Only manager is able to call this function

Sets the percentage of the liquidation fee for a particular collateral

Name
Type
Description

setOracleType

Only manager is able to call this function

Enables/disables oracle types

Name
Type
Description

setTokenDebtLimit

Only manager is able to call this function

Sets GCD limit for a specific collateral

Name
Type
Description
contract IVault vault

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

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

uint256

The GCD token issue limit

oracles

uint256[]

The enables oracle types

_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

asset

address

The address of the main collateral token of a position

owner

address

The owner of a position

_parameters

address

The address of system parameters contract

to

address

The address of the recipient

amount

uint256

The amount of token to be minted

amount

uint256

The amount of token to be burned

from

address

The address of the balance owner

amount

uint256

The amount of token to be burned

to

address

The address of the recipient

amount

uint256

The amount of token to be transferred

from

address

The address of the sender

to

address

The address of the recipient

amount

uint256

The amount of token to be transferred

spender

address

The address of the account able to transfer the tokens

amount

uint256

The amount of tokens to be approved for transfer

_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

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

gcdAmount

uint256

The amount of GCD token to borrow

asset

address

The address of the collateral

assetAmount

uint256

The amount of the collateral to withdraw

gcdAmount

uint256

The amount of GCD to repay

asset

address

The address of the collateral

assetAmount

uint256

The amount of the collateral to withdraw

repayment

uint256

The target repayment amount

ethAmount

uint256

ETH amount to withdraw

gcdAmount

uint256

The amount of GCD token to repay

ethAmount

uint256

ETH amount to withdraw

repayment

uint256

The target repayment amount

asset

address

The address of the collateral token of a position

owner

address

The owner of the position

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

asset

address

The address of the collateral

owner

address

The owner of the position

[0]

bool

boolean value, whether a position is liquidatable

asset

address

The address of the collateral

owner

address

The owner of the position

[0]

uint256

utilization ratio

asset

address

The address of the collateral

owner

address

The owner of the position

[0]

uint256

Q112-encoded liquidation price

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)

asset

address

The address of the main collateral token

newValue

uint256

The collateralization ratio (0 decimals)

asset

address

The address of the main collateral token

newValue

uint256

The liquidation ratio (0 decimals)

asset

address

The address of the main collateral token

newValue

uint256

The liquidation discount (3 decimals)

asset

address

The address of the main collateral token

newValue

uint256

The devaluation period in blocks

_parameters

address

The address of the system parameters

_gcd

address

GCD token address

_weth

address payable

asset

address

The address of the main collateral token

user

address

The owner of a position

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

asset

address

The address of the main collateral token

user

address

The address of a position's owner

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

user

address

The address of a position's owner

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

user

address payable

The address of a position's owner

amount

uint256

The amount of ETH to withdraw

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

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

asset

address

The address of the fee asset

user

address

The address to transfer funds from

amount

uint256

The amount of asset to transfer

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

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

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

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

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

who

address

The target address

permit

bool

The permission flag

newFoundation

address

The new foundation address

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)

who

address

The target address

permit

bool

The permission flag

asset

address

The address of the main collateral token

newValue

uint256

The stability fee percentage (3 decimals)

asset

address

The address of the main collateral token

newValue

uint256

The liquidation fee percentage (0 decimals)

_type

uint256

The type of the oracle

asset

address

The address of the main collateral token

enabled

bool

The control flag

asset

address

The address of the main collateral token

limit

uint256

The limit number

initialCollateralRatioValue

mainAssetToPositionOwner

gcdLimit

contract IVaultManagerParameters vaultManagerParameters
contract ICDPRegistry cdpRegistry
contract IForceTransferAssetStore forceTransferAssetStore
uint256 DENOMINATOR_1E2
uint256 WRAPPED_TO_UNDERLYING_ORACLE_TYPE
event Buyout(address asset, address owner, address buyer, uint256 amount, uint256 price, uint256 penalty)
modifier checkpoint(address asset, address owner)
constructor(address _vaultManagerParameters, address _cdpRegistry, address _forceTransferAssetStore) public
function buyout(address asset, address owner) public
function _liquidate(address asset, address user, uint256 collateralToBuyer, uint256 collateralToOwner, uint256 repayment, uint256 penalty) private
function _calcLiquidationParams(uint256 depreciationPeriod, uint256 blocksPast, uint256 startingPrice, uint256 debtWithPenalty, uint256 collateralInPosition) internal pure returns (uint256 collateralToBuyer, uint256 collateralToOwner, uint256 price)
struct CDP {
  address asset;
  address owner;
}
mapping(address => address[]) cdpList
mapping(address => mapping(address => uint256)) cdpIndex
contract IVault vault
contract ICollateralRegistry cr
event Added(address asset, address owner)
event Removed(address asset, address owner)
constructor(address _vault, address _collateralRegistry) public
function checkpoint(address asset, address owner) public
function batchCheckpointForAsset(address asset, address[] owners) external
function batchCheckpoint(address[] assets, address[] owners) external
function isAlive(address asset, address owner) public view returns (bool)
function isListed(address asset, address owner) public view returns (bool)
function _removeCdp(address asset, address owner) internal
function _addCdp(address asset, address owner) internal
function getCdpsByCollateral(address asset) external view returns (struct CDPRegistry.CDP[] cdps)
function getCdpsByOwner(address owner) external view returns (struct CDPRegistry.CDP[] r)
function getAllCdps() external view returns (struct CDPRegistry.CDP[] r)
function getCdpsCount() public view returns (uint256 totalCdpCount)
function getCdpsCountForCollateral(address asset) public view returns (uint256)
event CollateralAdded(address asset)
event CollateralRemoved(address asset)
mapping(address => uint256) collateralId
address[] collateralList
constructor(address _vaultParameters, address[] assets) public
function addCollateral(address asset) public
function removeCollateral(address asset) public
function isCollateral(address asset) public view returns (bool)
function collaterals() external view returns (address[])
function collateralsCount() external view returns (uint256)
string name
string symbol
string version
uint8 decimals
uint256 totalSupply
mapping(address => uint256) balanceOf
mapping(address => mapping(address => uint256)) allowance
event Approval(address owner, address spender, uint256 value)
event Transfer(address from, address to, uint256 value)
function initialize(address _parameters) public
function _authorizeUpgrade(address) internal
function mint(address to, uint256 amount) external
function burn(uint256 amount) external
function burn(address from, uint256 amount) external
function transfer(address to, uint256 amount) external returns (bool)
function transferFrom(address from, address to, uint256 amount) public returns (bool)
function approve(address spender, uint256 amount) external returns (bool)
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool)
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool)
function _approve(address owner, address spender, uint256 amount) internal virtual
function _burn(address from, uint256 amount) internal virtual
contract IVault vault
contract IVaultManagerParameters vaultManagerParameters
contract IOracleRegistry oracleRegistry
contract ICDPRegistry cdpRegistry
address payable WETH
uint256 Q112
uint256 DENOMINATOR_1E5
event Join(address asset, address owner, uint256 main, uint256 gcd)
event Exit(address asset, address owner, uint256 main, uint256 gcd)
event LiquidationTriggered(address asset, address owner)
modifier checkpoint(address asset, address owner)
constructor(address _vaultManagerParameters, address _oracleRegistry, address _cdpRegistry) public
receive() external payable
function join(address asset, uint256 assetAmount, uint256 gcdAmount) public
function join_Eth(uint256 gcdAmount) external payable
function exit(address asset, uint256 assetAmount, uint256 gcdAmount) public returns (uint256)
function exit_targetRepayment(address asset, uint256 assetAmount, uint256 repayment) external returns (uint256)
function exit_Eth(uint256 ethAmount, uint256 gcdAmount) public returns (uint256)
function exit_Eth_targetRepayment(uint256 ethAmount, uint256 repayment) external returns (uint256)
function _repay(address asset, address owner, uint256 gcdAmount) internal
function _ensurePositionCollateralization(address asset, address owner) internal view
function triggerLiquidation(address asset, address owner) external
function getCollateralUsdValue_q112(address asset, address owner) public view returns (uint256)
function _isLiquidatablePosition(address asset, address owner, uint256 usdValue_q112) internal view returns (bool)
function _ensureOracle(address asset) internal view
function isLiquidatablePosition(address asset, address owner) public view returns (bool)
function utilizationRatio(address asset, address owner) public view returns (uint256)
function liquidationPrice_q112(address asset, address owner) external view returns (uint256)
function _calcPrincipal(address asset, address owner, uint256 repayment) internal view returns (uint256)
mapping(address => uint256) initialCollateralRatio
mapping(address => uint256) liquidationRatio
mapping(address => uint256) liquidationDiscount
mapping(address => uint256) devaluationPeriod
constructor(address _vaultParameters) public
function setCollateral(address asset, uint256 stabilityFeeValue, uint256 liquidationFeeValue, uint256 initialCollateralRatioValue, uint256 liquidationRatioValue, uint256 liquidationDiscountValue, uint256 devaluationPeriodValue, uint256 gcdLimit, uint256[] oracles) external
function setInitialCollateralRatio(address asset, uint256 newValue) public
function setLiquidationRatio(address asset, uint256 newValue) public
function setLiquidationDiscount(address asset, uint256 newValue) public
function setDevaluationPeriod(address asset, uint256 newValue) public
address payable weth
uint256 DENOMINATOR_1E5
uint256 DENOMINATOR_1E2
address gcd
mapping(address => mapping(address => uint256)) collaterals
mapping(address => mapping(address => uint256)) debts
mapping(address => mapping(address => uint256)) liquidationBlock
mapping(address => mapping(address => uint256)) liquidationPrice
mapping(address => uint256) tokenDebts
mapping(address => mapping(address => uint256)) stabilityFee
mapping(address => mapping(address => uint256)) liquidationFee
mapping(address => mapping(address => uint256)) oracleType
mapping(address => mapping(address => uint256)) lastUpdate
modifier notLiquidating(address asset, address user)
function initialize(address _parameters, address _gcd, address payable _weth) public
function _authorizeUpgrade(address) internal
receive() external payable
function update(address asset, address user) public
function spawn(address asset, address user, uint256 _oracleType) external
function destroy(address asset, address user) public
function depositMain(address asset, address user, uint256 amount) external
function depositEth(address user) external payable
function withdrawMain(address asset, address user, uint256 amount) external
function withdrawEth(address payable user, uint256 amount) external
function borrow(address asset, address user, uint256 amount) external returns (uint256)
function repay(address asset, address user, uint256 amount) external returns (uint256)
function chargeFee(address asset, address user, uint256 amount) external
function triggerLiquidation(address asset, address positionOwner, uint256 initialPrice) external
function liquidate(address asset, address positionOwner, uint256 mainAssetToLiquidator, uint256 mainAssetToPositionOwner, uint256 repayment, uint256 penalty, address liquidator) external
function changeOracleType(address asset, address user, uint256 newOracleType) external
function getTotalDebt(address asset, address user) public view returns (uint256)
function calculateFee(address asset, address user, uint256 amount) public view returns (uint256)
mapping(address => uint256) stabilityFee
mapping(address => uint256) liquidationFee
mapping(address => uint256) tokenDebtLimit
mapping(address => bool) canModifyVault
mapping(address => bool) isManager
mapping(uint256 => mapping(address => bool)) isOracleTypeEnabled
address payable vault
address foundation
function initialize(address payable _vault, address _foundation) public
function _authorizeUpgrade(address) internal
function setManager(address who, bool permit) external
function setFoundation(address newFoundation) external
function setCollateral(address asset, uint256 stabilityFeeValue, uint256 liquidationFeeValue, uint256 gcdLimit, uint256[] oracles) external
function setVaultAccess(address who, bool permit) external
function setStabilityFee(address asset, uint256 newValue) public
function setLiquidationFee(address asset, uint256 newValue) public
function setOracleType(uint256 _type, address asset, bool enabled) public
function setTokenDebtLimit(address asset, uint256 limit) public