RepoTokenList.sol#RepoTokenList
State Variables
NULL_NODE
INVALID_AUCTION_RATE
ZERO_AUCTION_RATE
Functions
getRepoTokenMaturity
Retrieves the redemption (maturity) timestamp of a repoToken
This function calls the config()
method on the repoToken to retrieve its configuration details, including the redemption timestamp, which it then returns.
Parameters
repoToken
address
The address of the repoToken
Returns
redemptionTimestamp
uint256
The timestamp indicating when the repoToken matures
_getNext
Get the next node in the list
Parameters
listData
RepoTokenListData
The list data
current
address
The current node
Returns
<none>
address
The next node
_count
Count the number of nodes in the list
Parameters
listData
RepoTokenListData
The list data
Returns
count
uint256
The number of nodes in the list
holdings
Returns an array of addresses representing the repoTokens currently held in the list data
This function iterates through the list of repoTokens and returns their addresses in an array. It first counts the number of repoTokens, initializes an array of that size, and then populates the array with the addresses of the repoTokens.
Parameters
listData
RepoTokenListData
The list data
Returns
holdingsArray
address[]
An array of addresses of the repoTokens held in the list
getRepoTokenWeightedTimeToMaturity
Get the weighted time to maturity of the strategy's holdings of a specified repoToken
Parameters
repoToken
address
The address of the repoToken
repoTokenBalanceInBaseAssetPrecision
uint256
The balance of the repoToken in base asset precision
Returns
weightedTimeToMaturity
uint256
The weighted time to maturity in seconds x repoToken balance in base asset precision
getCumulativeRepoTokenData
This function calculates the cumulative weighted time to maturity and cumulative amount of all repoTokens in the list.
The repoToken
and repoTokenAmount
parameters are optional and provide flexibility to adjust the calculations to include the provided repoToken and amount. If repoToken
is set to address(0)
or repoTokenAmount
is 0
, the function calculates the cumulative data without specific token adjustments.
Parameters
listData
RepoTokenListData
The list data
discountRateAdapter
ITermDiscountRateAdapter
The discount rate adapter
repoToken
address
The address of the repoToken (optional)
repoTokenAmount
uint256
The amount of the repoToken (optional)
purchaseTokenPrecision
uint256
The precision of the purchase token
Returns
cumulativeWeightedTimeToMaturity
uint256
The cumulative weighted time to maturity for all repoTokens
cumulativeRepoTokenAmount
uint256
The cumulative repoToken amount across all repoTokens
found
bool
Whether the specified repoToken was found in the list
getPresentValue
Get the present value of repoTokens
Aggregates the present value of all repoTokens in the list.
Parameters
listData
RepoTokenListData
The list data
discountRateAdapter
ITermDiscountRateAdapter
The discount rate adapter
purchaseTokenPrecision
uint256
The precision of the purchase token
Returns
totalPresentValue
uint256
The total present value of the repoTokens
_getRepoTokenTimeToMaturity
Calculates the time remaining until a repoToken matures
This function calculates the difference between the redemption timestamp and the current block timestamp to determine how many seconds are left until the repoToken reaches its maturity.
Parameters
redemptionTimestamp
uint256
The redemption timestamp of the repoToken
Returns
<none>
uint256
uint256 The time remaining (in seconds) until the repoToken matures
removeAndRedeemMaturedTokens
Removes and redeems matured repoTokens from the list data
Iterates through the list of repoTokens and removes those that have matured. If a matured repoToken has a balance, the function attempts to redeem it. This helps maintain the list by clearing out matured repoTokens and redeeming their balances.
Parameters
listData
RepoTokenListData
The list data
validateRepoToken
Validates a repoToken against specific criteria
early exit because list is sorted
Ensures the repoToken is deployed, matches the purchase token, is not matured, and meets collateral requirements. Reverts with InvalidRepoToken
if any validation check fails.
Parameters
listData
RepoTokenListData
The list data
repoToken
ITermRepoToken
The repoToken to validate
asset
address
The address of the base asset
Returns
isRepoTokenValid
bool
Whether the repoToken is valid
redemptionTimestamp
uint256
The redemption timestamp of the validated repoToken
validateAndInsertRepoToken
Validate and insert a repoToken into the list data
Parameters
listData
RepoTokenListData
The list data
repoToken
ITermRepoToken
The repoToken to validate and insert
discountRateAdapter
ITermDiscountRateAdapter
The discount rate adapter
asset
address
The address of the base asset
Returns
validRepoToken
bool
Whether the repoToken is valid
redemptionTimestamp
uint256
The redemption timestamp of the validated repoToken
insertSorted
Insert a repoToken into the list in a sorted manner
Inserts the repoToken
into the listData
while maintaining the list sorted by the repoTokens' maturity timestamps. The function iterates through the list to find the correct position for the new repoToken
and updates the pointers accordingly.
Parameters
listData
RepoTokenListData
The list data
repoToken
address
The address of the repoToken to be inserted
Errors
InvalidRepoToken
Last updated