Overview
The IPoolQuotaKeeperV3 interface manages quota-based interest for specific tokens in pools. It tracks per-account quotas, accumulates interest, and configures quota parameters like rates, limits, and fees.
View Functions
pool
function pool() external view returns (address)
Returns the address of the associated pool.
The pool contract address
underlying
function underlying() external view returns (address)
Returns the address of the pool’s underlying asset.
The underlying token address
getQuotaRate
function getQuotaRate(address token) external view returns (uint16)
Returns the current quota interest rate for a token.
The quota interest rate in basis points per year
cumulativeIndex
function cumulativeIndex(address token) external view returns (uint192)
Returns the current cumulative quota interest index for a token.
The cumulative interest index
isQuotedToken
function isQuotedToken(address token) external view returns (bool)
Checks if a token is registered as a quoted token.
The address of the token to check
True if the token is quoted, false otherwise
getQuota
function getQuota(address creditAccount, address token)
external
view
returns (uint96 quota, uint192 cumulativeIndexLU)
Returns the quota and last update index for a credit account’s token.
The address of the credit account
The current quota amount for the account
The cumulative index at last update
getTokenQuotaParams
function getTokenQuotaParams(address token)
external
view
returns (
uint16 rate,
uint192 cumulativeIndexLU,
uint16 quotaIncreaseFee,
uint96 totalQuoted,
uint96 limit,
bool isActive
)
Returns all quota parameters for a token.
The quota interest rate in basis points per year
The cumulative index at last update
The one-time fee charged on quota increases (in basis points)
The total amount of token currently quoted across all accounts
The maximum total quota allowed for this token
Whether the token is currently active for quotas
getQuotaAndOutstandingInterest
function getQuotaAndOutstandingInterest(address creditAccount, address token)
external
view
returns (uint96 quoted, uint128 outstandingInterest)
Returns the quota and outstanding interest for a credit account’s token.
The address of the credit account
The outstanding quota interest accumulated since last update
poolQuotaRevenue
function poolQuotaRevenue() external view returns (uint256)
Returns the total quota revenue earned by the pool.
The total quota revenue amount
lastQuotaRateUpdate
function lastQuotaRateUpdate() external view returns (uint40)
Returns the timestamp of the last quota rate update.
The unix timestamp of the last rate update
gauge
function gauge() external view returns (address)
Returns the address of the gauge contract that determines quota rates.
The gauge contract address
creditManagers
function creditManagers() external view returns (address[] memory)
Returns an array of all credit managers allowed to update quotas.
Array of credit manager addresses
quotedTokens
function quotedTokens() external view returns (address[] memory)
Returns an array of all quoted tokens.
Array of quoted token addresses
Quota Management Functions
updateQuota
function updateQuota(
address creditAccount,
address token,
int96 requestedChange,
uint96 minQuota,
uint96 maxQuota
)
external
returns (
uint128 caQuotaInterestChange,
uint128 fees,
bool enableToken,
bool disableToken
)
Updates the quota for a credit account’s token, accruing interest and charging fees.
The address of the credit account
The requested change in quota (positive to increase, negative to decrease)
The minimum quota amount allowed after the update
The maximum quota amount allowed after the update
The change in quota interest for the credit account
The fees charged for the quota update
Whether the token should be enabled on the credit account
Whether the token should be disabled on the credit account
removeQuotas
function removeQuotas(
address creditAccount,
address[] calldata tokens,
bool setLimitsToZero
) external
Removes quotas for multiple tokens from a credit account.
The address of the credit account
Array of token addresses to remove quotas for
Whether to set the account’s limits to zero after removal
accrueQuotaInterest
function accrueQuotaInterest(
address creditAccount,
address[] calldata tokens
) external
Accrues quota interest for multiple tokens on a credit account without changing quotas.
The address of the credit account
Array of token addresses to accrue interest for
Configuration Functions
setGauge
function setGauge(address _gauge) external
Sets a new gauge contract for determining quota rates.
The address of the new gauge contract
addCreditManager
function addCreditManager(address _creditManager) external
Allows a new credit manager to update quotas in this pool quota keeper.
The address of the credit manager to add
addQuotaToken
function addQuotaToken(address token) external
Adds a new token to the list of quoted tokens.
The address of the token to add
updateRates
function updateRates() external
Updates quota rates for all tokens by querying the gauge contract.
setTokenLimit
function setTokenLimit(address token, uint96 limit) external
Sets a new total quota limit for a token.
The new total quota limit
setTokenQuotaIncreaseFee
function setTokenQuotaIncreaseFee(address token, uint16 fee) external
Sets a new one-time quota increase fee for a token.
The new quota increase fee in basis points
Events
UpdateQuota
event UpdateQuota(address indexed creditAccount, address indexed token, int96 quotaChange)
Emitted when an account’s quota for a token is updated.
The address of the credit account
The change in quota (positive for increase, negative for decrease)
UpdateTokenQuotaRate
event UpdateTokenQuotaRate(address indexed token, uint16 rate)
Emitted when a token’s quota rate is updated.
The new quota interest rate in basis points per year
SetGauge
event SetGauge(address indexed newGauge)
Emitted when the gauge is updated.
The address of the new gauge contract
AddCreditManager
event AddCreditManager(address indexed creditManager)
Emitted when a new credit manager is allowed.
The address of the newly added credit manager
AddQuotaToken
event AddQuotaToken(address indexed token)
Emitted when a new token is added as quoted.
The address of the newly added quoted token
SetTokenLimit
event SetTokenLimit(address indexed token, uint96 limit)
Emitted when a new total quota limit is set for a token.
The new total quota limit
SetQuotaIncreaseFee
event SetQuotaIncreaseFee(address indexed token, uint16 fee)
Emitted when a new one-time quota increase fee is set for a token.
The new quota increase fee in basis points
Structs
TokenQuotaParams
struct TokenQuotaParams {
uint16 rate;
uint192 cumulativeIndexLU;
uint16 quotaIncreaseFee;
uint96 totalQuoted;
uint96 limit;
}
Stores all quota parameters for a token.
The quota interest rate in basis points per year
The cumulative interest index at last update
The one-time fee charged on quota increases (in basis points)
The total amount of token currently quoted across all accounts
The maximum total quota allowed for this token
AccountQuota
struct AccountQuota {
uint96 quota;
uint192 cumulativeIndexLU;
}
Stores quota information for a credit account’s token.
The current quota amount for the account
The cumulative interest index at last update for this account