Trigger when buyouts are happened
Buyouts a position's collateral
ERC20 token
Trigger on any successful call to approve(address spender, uint amount)
Trigger when tokens are transferred, including zero value transfers
Restricted upgrades function
Only Vault can mint GCD
Mints 'amount' of tokens to address 'to', and MUST fire the Transfer event
Only manager can burn tokens from manager's balance
Burns 'amount' of tokens, and MUST fire the Transfer event
Only Vault can burn tokens from any balance
Burns 'amount' of tokens from 'from' address, and MUST fire the Transfer event
_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.
Transfers 'amount' of tokens from address 'from' to address 'to', and MUST fire the Transfer event
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'.
_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._
_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._
Trigger when joins are happened
Trigger when exits are happened
Trigger when liquidations are initiated
Depositing tokens must be pre-approved to Vault address position actually considered as spawned only when debt > 0
Deposits collateral and/or borrows GCD
Deposits ETH and/or borrows GCD
Tx sender must have a sufficient GCD balance to pay the debt
Withdraws collateral and repays specified amount of debt
Repayment is the sum of the principal and interest
Withdraws collateral and repays specified amount of debt
Withdraws WETH and converts to ETH
Repayment is the sum of the principal and interest
Withdraws WETH and converts to ETH
Triggers liquidation of a position
Determines whether a position is liquidatable
Determines whether a position is liquidatable
Calculates current utilization ratio
Calculates liquidation price
Only manager is able to call this function
Sets ability to use token as the main collateral
Only manager is able to call this function
Sets the initial collateral ratio
Only manager is able to call this function
Sets the liquidation ratio
Only manager is able to call this function
Sets the liquidation discount
Only manager is able to call this function
Sets the devaluation period of collateral after liquidation
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
Restricted upgrades function
Updates parameters of the position to the current ones
Creates new position for user
Clears unused storage variables
Tokens must be pre-approved
Adds main collateral to a position
Converts ETH to WETH and adds main collateral to a position
Withdraws main collateral from a position
Withdraws WETH collateral from a position converting WETH to ETH
Increases position's debt and mints GCD token
Decreases position's debt and burns GCD token
Transfers fee to foundation
Deletes position and transfers collateral to liquidation system
Internal liquidation process
Only manager can call this function
Changes broken oracle type to the correct one
Calculates the total amount of position's debt based on elapsed time
Calculates the amount of fee based on elapsed time and repayment amount
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.
Restricted upgrades function
Only manager is able to call this function
Grants and revokes manager's status of any address
Only manager is able to call this function
Sets the foundation address
Only manager is able to call this function
Sets ability to use token as the main collateral
Only manager is able to call this function
Sets a permission for an address to modify the Vault
Only manager is able to call this function
Sets the percentage of the year stability fee for a particular collateral
Only manager is able to call this function
Sets the percentage of the liquidation fee for a particular collateral
Only manager is able to call this function
Enables/disables oracle types
Only manager is able to call this function
Sets GCD limit for a specific collateral
contract IVault vaultuint256
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 vaultManagerParameterscontract ICDPRegistry cdpRegistrycontract IForceTransferAssetStore forceTransferAssetStoreuint256 DENOMINATOR_1E2uint256 WRAPPED_TO_UNDERLYING_ORACLE_TYPEevent 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) publicfunction buyout(address asset, address owner) publicfunction _liquidate(address asset, address user, uint256 collateralToBuyer, uint256 collateralToOwner, uint256 repayment, uint256 penalty) privatefunction _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[]) cdpListmapping(address => mapping(address => uint256)) cdpIndexcontract IVault vaultcontract ICollateralRegistry crevent Added(address asset, address owner)event Removed(address asset, address owner)constructor(address _vault, address _collateralRegistry) publicfunction checkpoint(address asset, address owner) publicfunction batchCheckpointForAsset(address asset, address[] owners) externalfunction batchCheckpoint(address[] assets, address[] owners) externalfunction 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) internalfunction _addCdp(address asset, address owner) internalfunction 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) collateralIdaddress[] collateralListconstructor(address _vaultParameters, address[] assets) publicfunction addCollateral(address asset) publicfunction removeCollateral(address asset) publicfunction isCollateral(address asset) public view returns (bool)function collaterals() external view returns (address[])function collateralsCount() external view returns (uint256)string namestring symbolstring versionuint8 decimalsuint256 totalSupplymapping(address => uint256) balanceOfmapping(address => mapping(address => uint256)) allowanceevent Approval(address owner, address spender, uint256 value)event Transfer(address from, address to, uint256 value)function initialize(address _parameters) publicfunction _authorizeUpgrade(address) internalfunction mint(address to, uint256 amount) externalfunction burn(uint256 amount) externalfunction burn(address from, uint256 amount) externalfunction 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 virtualfunction _burn(address from, uint256 amount) internal virtualcontract IVault vaultcontract IVaultManagerParameters vaultManagerParameterscontract IOracleRegistry oracleRegistrycontract ICDPRegistry cdpRegistryaddress payable WETHuint256 Q112uint256 DENOMINATOR_1E5event 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) publicreceive() external payablefunction join(address asset, uint256 assetAmount, uint256 gcdAmount) publicfunction join_Eth(uint256 gcdAmount) external payablefunction 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) internalfunction _ensurePositionCollateralization(address asset, address owner) internal viewfunction triggerLiquidation(address asset, address owner) externalfunction 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 viewfunction 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) initialCollateralRatiomapping(address => uint256) liquidationRatiomapping(address => uint256) liquidationDiscountmapping(address => uint256) devaluationPeriodconstructor(address _vaultParameters) publicfunction setCollateral(address asset, uint256 stabilityFeeValue, uint256 liquidationFeeValue, uint256 initialCollateralRatioValue, uint256 liquidationRatioValue, uint256 liquidationDiscountValue, uint256 devaluationPeriodValue, uint256 gcdLimit, uint256[] oracles) externalfunction setInitialCollateralRatio(address asset, uint256 newValue) publicfunction setLiquidationRatio(address asset, uint256 newValue) publicfunction setLiquidationDiscount(address asset, uint256 newValue) publicfunction setDevaluationPeriod(address asset, uint256 newValue) publicaddress payable wethuint256 DENOMINATOR_1E5uint256 DENOMINATOR_1E2address gcdmapping(address => mapping(address => uint256)) collateralsmapping(address => mapping(address => uint256)) debtsmapping(address => mapping(address => uint256)) liquidationBlockmapping(address => mapping(address => uint256)) liquidationPricemapping(address => uint256) tokenDebtsmapping(address => mapping(address => uint256)) stabilityFeemapping(address => mapping(address => uint256)) liquidationFeemapping(address => mapping(address => uint256)) oracleTypemapping(address => mapping(address => uint256)) lastUpdatemodifier notLiquidating(address asset, address user)function initialize(address _parameters, address _gcd, address payable _weth) publicfunction _authorizeUpgrade(address) internalreceive() external payablefunction update(address asset, address user) publicfunction spawn(address asset, address user, uint256 _oracleType) externalfunction destroy(address asset, address user) publicfunction depositMain(address asset, address user, uint256 amount) externalfunction depositEth(address user) external payablefunction withdrawMain(address asset, address user, uint256 amount) externalfunction withdrawEth(address payable user, uint256 amount) externalfunction 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) externalfunction triggerLiquidation(address asset, address positionOwner, uint256 initialPrice) externalfunction liquidate(address asset, address positionOwner, uint256 mainAssetToLiquidator, uint256 mainAssetToPositionOwner, uint256 repayment, uint256 penalty, address liquidator) externalfunction changeOracleType(address asset, address user, uint256 newOracleType) externalfunction getTotalDebt(address asset, address user) public view returns (uint256)function calculateFee(address asset, address user, uint256 amount) public view returns (uint256)mapping(address => uint256) stabilityFeemapping(address => uint256) liquidationFeemapping(address => uint256) tokenDebtLimitmapping(address => bool) canModifyVaultmapping(address => bool) isManagermapping(uint256 => mapping(address => bool)) isOracleTypeEnabledaddress payable vaultaddress foundationfunction initialize(address payable _vault, address _foundation) publicfunction _authorizeUpgrade(address) internalfunction setManager(address who, bool permit) externalfunction setFoundation(address newFoundation) externalfunction setCollateral(address asset, uint256 stabilityFeeValue, uint256 liquidationFeeValue, uint256 gcdLimit, uint256[] oracles) externalfunction setVaultAccess(address who, bool permit) externalfunction setStabilityFee(address asset, uint256 newValue) publicfunction setLiquidationFee(address asset, uint256 newValue) publicfunction setOracleType(uint256 _type, address asset, bool enabled) publicfunction setTokenDebtLimit(address asset, uint256 limit) public