Skip to main content

AssurancePool

AssurancePool

Stores and manages reserve tokens according to pool configurations set by operator access granted addresses.

Methods​

RTD​

function RTD() external view returns (uint256)

returns the ratio of primary reserve to total debt, where 1 ether == 100%.

Returns​

NameTypeDescription
_0uint256ratio of primary reserve to total debt, where 1 ether == 100%.

allocate​

function allocate() external nonpayable

enables caller to allocate unallocated reserve tokens into the needed reserve balance.

this function should be called on a time frame to ensure collected deposits are allocated to the necessary reserve balances.

assuranceOracle​

function assuranceOracle() external view returns (contract IAssuranceOracle)

Returns​

NameTypeDescription
_0contract IAssuranceOracleundefined

convertReserveTokenToStableCredit​

function convertReserveTokenToStableCredit(uint256 reserveAmount) external view returns (uint256)

converts the reserve token amount to the stable credit denomination.

Parameters​

NameTypeDescription
reserveAmountuint256reserve token amount to convert to credit currency denomination.

Returns​

NameTypeDescription
_0uint256credit currency conversion.

convertStableCreditToReserveToken​

function convertStableCreditToReserveToken(uint256 creditAmount) external view returns (uint256)

converts the stable credit amount to the reserve token denomination.

Parameters​

NameTypeDescription
creditAmountuint256stable credit amount to convert to reserve currency denomination.

Returns​

NameTypeDescription
_0uint256reserve currency conversion.

deposit​

function deposit(uint256 amount) external nonpayable

enables caller to deposit reserve tokens into the excess reserve.

Parameters​

NameTypeDescription
amountuint256amount of deposit token to deposit.

depositIntoExcessReserve​

function depositIntoExcessReserve(uint256 amount) external nonpayable

enables caller to deposit reserve tokens into the excess reserve.

Parameters​

NameTypeDescription
amountuint256amount of reserve token to deposit.

depositIntoPeripheralReserve​

function depositIntoPeripheralReserve(uint256 amount) external nonpayable

enables caller to deposit reserve tokens into the peripheral reserve.

Parameters​

NameTypeDescription
amountuint256amount of reserve token to deposit.

depositIntoPrimaryReserve​

function depositIntoPrimaryReserve(uint256 amount) external nonpayable

enables caller to deposit reserve tokens into the primary reserve.

Parameters​

NameTypeDescription
amountuint256amount of reserve token to deposit.

excessBalance​

function excessBalance() external view returns (uint256)

returns the amount of current reserve token's excess balance.

Returns​

NameTypeDescription
_0uint256undefined

hasValidRTD​

function hasValidRTD() external view returns (bool)

returns true if the primary reserve is greater than or equal to the target RTD.

returns true if the primary reserve is greater than or equal to the target RTD.

Returns​

NameTypeDescription
_0booltrue if the primary reserve is greater than or equal to the target RTD.

initialize​

function initialize(address _stableCredit, address _reserveToken) external nonpayable

initializes the reserve token and deposit token to be used for assurance, as well as assigns the stable credit and swap router contracts.

should be called directly after deployment (see OpenZeppelin upgradeable standards).

Parameters​

NameTypeDescription
_stableCreditaddressaddress of the stable credit contract to assure.
_reserveTokenaddressaddress of the reserve token to use for assurance.

neededReserves​

function neededReserves() external view returns (uint256)

returns the amount of reserve tokens needed for the primary reserve to reach the target RTD.

the returned amount is denominated in the reserve token

Returns​

NameTypeDescription
_0uint256amount of reserve tokens needed for the primary reserve to reach the target RTD.

owner​

function owner() external view returns (address)

Returns the address of the current owner.

Returns​

NameTypeDescription
_0addressundefined

peripheralBalance​

function peripheralBalance() external view returns (uint256)

returns the amount of current reserve token's peripheral balance.

Returns​

NameTypeDescription
_0uint256undefined

primaryBalance​

function primaryBalance() external view returns (uint256)

returns the amount of current reserve token's primary balance.

Returns​

NameTypeDescription
_0uint256undefined

reallocateExcessBalance​

function reallocateExcessBalance() external nonpayable

this function reallocates needed reserves from the excess reserve to the primary reserve to attempt to reach the target RTD.

reimburse​

function reimburse(address account, uint256 amount) external nonpayable returns (uint256)

Called by the stable credit implementation to reimburse an account. If the amount is covered by the peripheral reserve, the peripheral reserve is depleted first, followed by the primary reserve.

The stable credit implementation should not expose this function to the public as it could be exploited to drain the reserves.

Parameters​

NameTypeDescription
accountaddressaddress to reimburse from reserves.
amountuint256amount reserve tokens to withdraw from the excess reserve.

Returns​

NameTypeDescription
_0uint256undefined

renounceOwnership​

function renounceOwnership() external nonpayable

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

reserveBalance​

function reserveBalance() external view returns (uint256)

returns the total amount of reserve tokens in the primary and peripheral reserves.

Returns​

NameTypeDescription
_0uint256total amount of reserve tokens in the primary and peripheral reserves.

reserveToken​

function reserveToken() external view returns (contract IERC20Upgradeable)

Exposes the ERC20 interface of the reserve token.

Returns​

NameTypeDescription
_0contract IERC20Upgradeablereserve token of the reserve pool.

reserves​

function reserves(address) external view returns (uint256 unallocatedBalance, uint256 primaryBalance, uint256 peripheralBalance, uint256 excessBalance)

Parameters​

NameTypeDescription
_0addressundefined

Returns​

NameTypeDescription
unallocatedBalanceuint256undefined
primaryBalanceuint256undefined
peripheralBalanceuint256undefined
excessBalanceuint256undefined

setAssuranceOracle​

function setAssuranceOracle(address _assuranceOracle) external nonpayable

Parameters​

NameTypeDescription
_assuranceOracleaddressundefined

setReserveToken​

function setReserveToken(address _reserveToken) external nonpayable

This function allows the risk manager to set the reserve token.

Updating the reserve token will not affect the stored reserves of the previous reserve token.

Parameters​

NameTypeDescription
_reserveTokenaddressaddress of the new reserve token.

stableCredit​

function stableCredit() external view returns (contract IStableCredit)

Returns​

NameTypeDescription
_0contract IStableCreditundefined

targetRTD​

function targetRTD() external view returns (uint256)

returns the target RTD for the AssurancePool.

the target RTD is set by the AssuranceOracle contract.

Returns​

NameTypeDescription
_0uint256target RTD for the AssurancePool, where 1 ether == 100% RTD.

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
newOwneraddressundefined

unallocatedBalance​

function unallocatedBalance() external view returns (uint256)

returns the amount of current reserve token's unallocated balance.

Returns​

NameTypeDescription
_0uint256undefined

withdraw​

function withdraw(uint256 amount) external nonpayable

enables caller to withdraw reserve tokens from the excess reserve.

Parameters​

NameTypeDescription
amountuint256amount of reserve tokens to withdraw from the excess reserve.

Events​

AccountReimbursed​

event AccountReimbursed(address account, uint256 amount)

Parameters​

NameTypeDescription
accountaddressundefined
amountuint256undefined

AssuranceOracleUpdated​

event AssuranceOracleUpdated(address assuranceOracle)

Parameters​

NameTypeDescription
assuranceOracleaddressundefined

ConversionRateUpdated​

event ConversionRateUpdated(uint256 conversionRate)

Parameters​

NameTypeDescription
conversionRateuint256undefined

ExcessReallocated​

event ExcessReallocated(uint256 excessReserve, uint256 primaryReserve)

Parameters​

NameTypeDescription
excessReserveuint256undefined
primaryReserveuint256undefined

ExcessReserveDeposited​

event ExcessReserveDeposited(uint256 amount)

Parameters​

NameTypeDescription
amountuint256undefined

ExcessReserveWithdrawn​

event ExcessReserveWithdrawn(uint256 amount)

Parameters​

NameTypeDescription
amountuint256undefined

Initialized​

event Initialized(uint8 version)

Parameters​

NameTypeDescription
versionuint8undefined

OwnershipTransferred​

event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)

Parameters​

NameTypeDescription
previousOwner indexedaddressundefined
newOwner indexedaddressundefined

PeripheralReserveDeposited​

event PeripheralReserveDeposited(uint256 amount)

Parameters​

NameTypeDescription
amountuint256undefined

PrimaryReserveDeposited​

event PrimaryReserveDeposited(uint256 amount)

Parameters​

NameTypeDescription
amountuint256undefined

ReserveTokenUpdated​

event ReserveTokenUpdated(address newReserveToken)

Parameters​

NameTypeDescription
newReserveTokenaddressundefined