TermAuctionList.sol#TermAuctionList

Git Source

State Variables

NULL_NODE

bytes32 internal constant NULL_NODE = bytes32(0);

Functions

_getNext

Get the next node in the list

function _getNext(TermAuctionListData storage listData, bytes32 current) private view returns (bytes32);

Parameters

Name
Type
Description

listData

TermAuctionListData

The list data

current

bytes32

The current node

Returns

Name
Type
Description

<none>

bytes32

The next node

_count

Count the number of nodes in the list

function _count(TermAuctionListData storage listData) internal view returns (uint256 count);

Parameters

Name
Type
Description

listData

TermAuctionListData

The list data

Returns

Name
Type
Description

count

uint256

The number of nodes in the list

pendingOffers

Retrieves an array of offer IDs representing the pending offers

This function iterates through the list of offers and gathers their IDs into an array of bytes32. This makes it easier to process and manage the pending offers.

function pendingOffers(TermAuctionListData storage listData) internal view returns (bytes32[] memory offers);

Parameters

Name
Type
Description

listData

TermAuctionListData

The list data

Returns

Name
Type
Description

offers

bytes32[]

An array of offer IDs representing the pending offers

insertPending

Inserts a new pending offer into the list data

This function inserts a new pending offer while maintaining the list sorted by auction address. The function iterates through the list to find the correct position for the new offerId and updates the pointers accordingly.

function insertPending(TermAuctionListData storage listData, bytes32 offerId, PendingOffer memory pendingOffer)
    internal;

Parameters

Name
Type
Description

listData

TermAuctionListData

The list data

offerId

bytes32

The ID of the offer to be inserted

pendingOffer

PendingOffer

The PendingOffer struct containing details of the offer to be inserted

removeCompleted

Removes completed or cancelled offers from the list data and processes the corresponding repoTokens

This function iterates through the list of offers and removes those that are completed or cancelled. It processes the corresponding repoTokens by validating and inserting them if necessary. This helps maintain the list by clearing out inactive offers and ensuring repoTokens are correctly processed.

function removeCompleted(
    TermAuctionListData storage listData,
    RepoTokenListData storage repoTokenListData,
    ITermDiscountRateAdapter discountRateAdapter,
    address asset
) internal;

Parameters

Name
Type
Description

listData

TermAuctionListData

The list data

repoTokenListData

RepoTokenListData

The repoToken list data

discountRateAdapter

ITermDiscountRateAdapter

The discount rate adapter

asset

address

The address of the asset

getPresentValue

Calculates the total present value of all relevant offers related to a specified repoToken

This function calculates the present value of offers in the list. If repoTokenToMatch is provided, it will filter the calculations to include only the specified repoToken. If repoTokenToMatch is not provided, it will aggregate the present value of all repoTokens in the list. This provides flexibility for both aggregate and specific token evaluations.

function getPresentValue(
    TermAuctionListData storage listData,
    RepoTokenListData storage repoTokenListData,
    ITermDiscountRateAdapter discountRateAdapter,
    uint256 purchaseTokenPrecision,
    address repoTokenToMatch
) internal view returns (uint256 totalValue);

Parameters

Name
Type
Description

listData

TermAuctionListData

The list data

repoTokenListData

RepoTokenListData

The repoToken list data

discountRateAdapter

ITermDiscountRateAdapter

The discount rate adapter

purchaseTokenPrecision

uint256

The precision of the purchase token

repoTokenToMatch

address

The address of the repoToken to match (optional)

Returns

Name
Type
Description

totalValue

uint256

The total present value of the offers

getCumulativeOfferData

Get cumulative offer data for a specified repoToken

offer processed, but auctionClosed not yet called and auction is new so repoToken not on List and wont be picked up checking repoTokendiscountRates to make sure we are not double counting on re-openings

This function calculates cumulative data for all offers in the list. The repoToken and newOfferAmount parameters are optional and provide flexibility to include the newOfferAmount for a specified repoToken in the calculation. If repoToken is set to address(0) or newOfferAmount is 0, the function calculates the cumulative data without adjustments.

function getCumulativeOfferData(
    TermAuctionListData storage listData,
    RepoTokenListData storage repoTokenListData,
    ITermDiscountRateAdapter discountRateAdapter,
    address repoToken,
    uint256 newOfferAmount,
    uint256 purchaseTokenPrecision
) internal view returns (uint256 cumulativeWeightedTimeToMaturity, uint256 cumulativeOfferAmount, bool found);

Parameters

Name
Type
Description

listData

TermAuctionListData

The list data

repoTokenListData

RepoTokenListData

The repoToken list data

discountRateAdapter

ITermDiscountRateAdapter

The discount rate adapter

repoToken

address

The address of the repoToken (optional)

newOfferAmount

uint256

The new offer amount for the specified repoToken

purchaseTokenPrecision

uint256

The precision of the purchase token

Returns

Name
Type
Description

cumulativeWeightedTimeToMaturity

uint256

The cumulative weighted time to maturity

cumulativeOfferAmount

uint256

The cumulative repoToken amount

found

bool

Whether the specified repoToken was found in the list

Last updated