Skip to content

DDHubBase

senamakel edited this page Aug 26, 2024 · 1 revision

Solidity API

DDHubBase

This is the main contract responsible for managing pools.

Has permissions to mint/burn ZAI

zai

contract IStablecoin zai

The ZAI stablecoin contract

RISK_ROLE

bytes32 RISK_ROLE

The risk manager role

EXECUTOR_ROLE

bytes32 EXECUTOR_ROLE

The executor role

feeCollector

address feeCollector

The fee collector address

globalDebtCeiling

uint256 globalDebtCeiling

The total debt ceiling for all pools

Return Values

Name Type Description

_poolInfos

mapping(contract IDDPool => struct IDDHub.PoolInfo) _poolInfos

initialize

function initialize(address _feeCollector, uint256 _globalDebtCeiling, address _zai, address _governance) external

Initializes the contract

Parameters

Name Type Description
_feeCollector address The address to send fees to
_globalDebtCeiling uint256 The global debt ceiling
_zai address The ZAI stablecoin contract
_governance address The governance contract for ownership

poolInfos

function poolInfos(contract IDDPool pool) external view returns (struct IDDHub.PoolInfo info)

The pool info for a given pool

Parameters

Name Type Description
pool contract IDDPool The pool to get the info for

Return Values

Name Type Description
info struct IDDHub.PoolInfo The pool info

isPool

function isPool(address pool) external view returns (bool what)

Checks if a pool is registered

Parameters

Name Type Description
pool address The pool to check

exec

function exec(contract IDDPool pool) external

Executes the actions for a pool

This is a permission-less function

Parameters

Name Type Description
pool contract IDDPool The pool to execute actions for

registerPool

function registerPool(contract IDDPool pool, contract IDDPlan plan, uint256 debtCeiling) external

Registers a pool

Parameters

Name Type Description
pool contract IDDPool The pool to register
plan contract IDDPlan The plan to use for the pool
debtCeiling uint256 The debt ceiling for the pool

reduceDebtCeiling

function reduceDebtCeiling(contract IDDPool pool, uint256 amountToReduce) external

Reduces the debt ceiling for a pool

Callable by the risk manager only

Parameters

Name Type Description
pool contract IDDPool The pool to reduce the debt ceiling for
amountToReduce uint256 The amount to reduce the debt ceiling by

setDebtCeiling

function setDebtCeiling(contract IDDPool pool, uint256 amount) external

Sets the debt ceiling for a pool

Callable by the governance only

Parameters

Name Type Description
pool contract IDDPool The pool to set the debt ceiling for
amount uint256 The new debt ceiling

setFeeCollector

function setFeeCollector(address who) external

Sets the fee collector

Callable by governance only

Parameters

Name Type Description
who address The new fee collector

setGlobalDebtCeiling

function setGlobalDebtCeiling(uint256 amount) external

Sets the global debt ceiling

Callable by governance only

Parameters

Name Type Description
amount uint256 The new global debt ceiling

shutdownPool

function shutdownPool(contract IDDPool pool) external

Shuts down a pool

Callable by governance only

Parameters

Name Type Description
pool contract IDDPool The pool to shutdown

sweepFees

function sweepFees(contract IDDPool pool) external

Sweeps fees from a specific pool

Parameters

Name Type Description
pool contract IDDPool The pool to sweep fees for

evaluatePoolAction

function evaluatePoolAction(contract IDDPool pool) public view returns (uint256 toWithdraw, uint256 toSupply)

Evaluates the actions to take for a pool

Parameters

Name Type Description
pool contract IDDPool The pool to evaluate

Return Values

Name Type Description
toWithdraw uint256 The amount of ZAI to withdraw
toSupply uint256 The amount of ZAI to supply

_mint

function _mint(uint256 amount, address dest) internal virtual

_burn

function _burn(uint256 amount, address dest) internal virtual

Clone this wiki locally