Skip to content
ClearClear
Docs
Protocol/AssurancePool

AssurancePool

Source: contracts/peripherals/AssurancePool.sol · Guide: reserve · Upgradeable (UUPS proxy)

2 min readUpdated View source

On this page
Network
Chain id
Address
Base Sepolia
84532

Functions that change state

Function
Who can call
Also
deposit(uint256 amount)
Anyone; acts on the caller's own account
nonReentrant
depositIntoBufferReserve(uint256 amount)
Anyone; acts on the caller's own account
nonReentrant
depositIntoExcessReserve(uint256 amount)
Anyone
depositIntoPrimaryReserve(uint256 amount)
Anyone; acts on the caller's own account
depositRepayment(uint256 amount)
Anyone; acts on the caller's own account
nonReentrant
depositToken(address token, uint256 amount)
Anyone; acts on the caller's own account
nonReentrant
depositTokenIntoBuffer(address token, uint256 amount)
Anyone
depositTokenIntoExcess(address token, uint256 amount)
Anyone
depositTokenIntoPrimary(address token, uint256 amount)
Anyone
initialize(address _stableCredit, address _reserveToken)
Once, when the proxy is initialised
lendToBondVault(uint256 amount)
Checked inside the function
nonReentrant
lendToPayoutPool(uint256 amount)
Checked inside the function
nonReentrant
moveBufferToPrimary(uint256 amount)
onlyOperator
nonReentrant
reallocateExcessBalance()
onlyOperator
rebalanceRTD()
onlyOperator
rebalanceRTDPublic()
Anyone
reimburse(address account, uint256 amount)
onlyStableCredit
nonReentrant
renounceOwnership()
The owner
repayFromBondVault(uint256 amount)
Anyone; acts on the caller's own account
nonReentrant
repayFromPayoutPool(uint256 amount)
Anyone; acts on the caller's own account
nonReentrant
setAssuranceOracle(address _assuranceOracle)
onlyAdmin
setBondVault(address vault)
onlyOperator
setExposureSource(address _exposureSource)
onlyAdmin
setPayoutPool(address pool)
onlyOperator
setReserveToken(address _reserveToken)
onlyAdmin
setTokenAddresses(address _usdcAddress, address _usdtAddress, address _daiAddress)
onlyAdmin
setWithdrawalCaller(address caller, bool allowed)
onlyAdmin
transferOwnership(address newOwner)
The owner
upgradeTo(address newImplementation)
onlyOwner (via _authorizeUpgrade)
upgradeToAndCall(address newImplementation, bytes data)
onlyOwner (via _authorizeUpgrade)
payable
withdraw(uint256 amount)
onlyWithdrawalCaller
nonReentrant
withdrawToken(address token, uint256 amount)
onlyWithdrawalCaller
nonReentrant

Read functions

Anyone can call these; they change nothing.

Function
Returns
assuranceOracle()
address
bondBufferOwed()
uint256
bondExposure()
uint256
bondVault()
address
bufferBalance()
uint256
bufferOwed()
uint256
bufferReserve(address)
uint256
checkPriceImpact()
bool needsRebalancing, uint256 priceImpact
convertReserveTokenToStableCredit(uint256 reserveAmount)
uint256
convertStableCreditToReserveToken(uint256 creditAmount)
uint256
DAI_ADDRESS()
address
excessBalance()
uint256
excessReserve(address)
uint256
exposureSource()
address
getReserveBreakdown()
uint256 primaryAmount, uint256 bufferAmount, uint256 excessAmount, uint256 totalReserves, uint256 currentRTD, uint256 _targetRTD
getRTDStatus()
uint256 currentRTD, uint256 _targetRTD, bool needsRebalancing, string rebalanceDirection
hasValidRTD()
bool
heldReserveValue()
uint256 value
heldTokens()
address[]
lentToBondVault()
uint256
lentToPayoutPool()
uint256
MAX_HELD_TOKENS()
uint256
neededReserves()
uint256
owner()
address
payoutPool()
address
poolExposure()
uint256
primaryBalance()
uint256
primaryReserve(address)
uint256
proxiableUUID()
bytes32
reserveBalance()
uint256
reserveToken()
address
RTD()
uint256
stableCredit()
address
targetRTD()
uint256
unpricedTokenCount()
uint256 count
unpricedTokens()
address[] tokens
USDC_ADDRESS()
address
USDT_ADDRESS()
address
withdrawalCallers(address)
bool
withdrawalPriority()
address[]

Events

Event
AccountReimbursed(address account, uint256 amount)
AdminChanged(address previousAdmin, address newAdmin)
AssuranceOracleUpdated(address assuranceOracle)
BeaconUpgraded(address beacon indexed)
BondVaultUpdated(address vault indexed)
BufferMovedToPrimary(uint256 amount, uint256 primaryReserve)
BufferReserveDeposited(uint256 amount)
ConversionRateUpdated(uint256 conversionRate)
ExcessReallocated(uint256 excessReserve, uint256 primaryReserve)
ExcessReserveDeposited(uint256 amount)
ExcessReserveWithdrawn(uint256 amount)
ExposureSourceUpdated(address exposureSource indexed)
HeldTokenRegistered(address token indexed)
Initialized(uint8 version)
LentToBondVault(uint256 amount, uint256 outstanding)
LentToPayoutPool(uint256 amount, uint256 outstanding)
OwnershipTransferred(address previousOwner indexed, address newOwner indexed)
PayoutPoolUpdated(address pool indexed)
PrimaryReserveDeposited(uint256 amount)
RepaidFromBondVault(uint256 amount, uint256 outstanding)
RepaidFromPayoutPool(uint256 amount, uint256 outstanding)
ReservesRepriced(uint256 accounted, uint256 held)
ReserveTokenUpdated(address newReserveToken)
RTDRebalanced(uint256 previousRTD, uint256 targetRTD, uint256 newRTD)
Upgraded(address implementation indexed)
WithdrawalCallerUpdated(address caller indexed, bool allowed)

Errors

Error
AssurancePoolInvalidAddress()
AssurancePoolLossAbsorptionTouched()
AssurancePoolTooManyTokens()
AssurancePoolUnauthorizedWithdrawal(address caller)