Skip to main content

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.
address
address
The pool contract address

underlying

function underlying() external view returns (address)
Returns the address of the pool’s underlying asset.
address
address
The underlying token address

getQuotaRate

function getQuotaRate(address token) external view returns (uint16)
Returns the current quota interest rate for a token.
token
address
required
The address of the token
rate
uint16
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.
token
address
required
The address of the token
index
uint192
The cumulative interest index

isQuotedToken

function isQuotedToken(address token) external view returns (bool)
Checks if a token is registered as a quoted token.
token
address
required
The address of the token to check
isQuoted
bool
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.
creditAccount
address
required
The address of the credit account
token
address
required
The address of the token
quota
uint96
The current quota amount for the account
cumulativeIndexLU
uint192
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.
token
address
required
The address of the token
rate
uint16
The quota interest rate in basis points per year
cumulativeIndexLU
uint192
The cumulative index at last update
quotaIncreaseFee
uint16
The one-time fee charged on quota increases (in basis points)
totalQuoted
uint96
The total amount of token currently quoted across all accounts
limit
uint96
The maximum total quota allowed for this token
isActive
bool
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.
creditAccount
address
required
The address of the credit account
token
address
required
The address of the token
quoted
uint96
The current quota amount
outstandingInterest
uint128
The outstanding quota interest accumulated since last update

poolQuotaRevenue

function poolQuotaRevenue() external view returns (uint256)
Returns the total quota revenue earned by the pool.
revenue
uint256
The total quota revenue amount

lastQuotaRateUpdate

function lastQuotaRateUpdate() external view returns (uint40)
Returns the timestamp of the last quota rate update.
timestamp
uint40
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.
address
address
The gauge contract address

creditManagers

function creditManagers() external view returns (address[] memory)
Returns an array of all credit managers allowed to update quotas.
managers
address[]
Array of credit manager addresses

quotedTokens

function quotedTokens() external view returns (address[] memory)
Returns an array of all quoted tokens.
tokens
address[]
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.
creditAccount
address
required
The address of the credit account
token
address
required
The address of the token
requestedChange
int96
required
The requested change in quota (positive to increase, negative to decrease)
minQuota
uint96
required
The minimum quota amount allowed after the update
maxQuota
uint96
required
The maximum quota amount allowed after the update
caQuotaInterestChange
uint128
The change in quota interest for the credit account
fees
uint128
The fees charged for the quota update
enableToken
bool
Whether the token should be enabled on the credit account
disableToken
bool
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.
creditAccount
address
required
The address of the credit account
tokens
address[]
required
Array of token addresses to remove quotas for
setLimitsToZero
bool
required
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.
creditAccount
address
required
The address of the credit account
tokens
address[]
required
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.
_gauge
address
required
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.
_creditManager
address
required
The address of the credit manager to add

addQuotaToken

function addQuotaToken(address token) external
Adds a new token to the list of quoted tokens.
token
address
required
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.
token
address
required
The address of the token
limit
uint96
required
The new total quota limit

setTokenQuotaIncreaseFee

function setTokenQuotaIncreaseFee(address token, uint16 fee) external
Sets a new one-time quota increase fee for a token.
token
address
required
The address of the token
fee
uint16
required
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.
creditAccount
address
The address of the credit account
token
address
The address of the token
quotaChange
int96
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.
token
address
The address of the token
rate
uint16
The new quota interest rate in basis points per year

SetGauge

event SetGauge(address indexed newGauge)
Emitted when the gauge is updated.
newGauge
address
The address of the new gauge contract

AddCreditManager

event AddCreditManager(address indexed creditManager)
Emitted when a new credit manager is allowed.
creditManager
address
The address of the newly added credit manager

AddQuotaToken

event AddQuotaToken(address indexed token)
Emitted when a new token is added as quoted.
token
address
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.
token
address
The address of the token
limit
uint96
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.
token
address
The address of the token
fee
uint16
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.
rate
uint16
The quota interest rate in basis points per year
cumulativeIndexLU
uint192
The cumulative interest index at last update
quotaIncreaseFee
uint16
The one-time fee charged on quota increases (in basis points)
totalQuoted
uint96
The total amount of token currently quoted across all accounts
limit
uint96
The maximum total quota allowed for this token

AccountQuota

struct AccountQuota {
    uint96 quota;
    uint192 cumulativeIndexLU;
}
Stores quota information for a credit account’s token.
quota
uint96
The current quota amount for the account
cumulativeIndexLU
uint192
The cumulative interest index at last update for this account

Build docs developers (and LLMs) love