RepoTokenUtils.sol#RepoTokenUtils

Git Source

State Variables

THREESIXTY_DAYCOUNT_SECONDS

uint256 internal constant THREESIXTY_DAYCOUNT_SECONDS = 360 days;

RATE_PRECISION

uint256 internal constant RATE_PRECISION = 1e18;

Functions

calculatePresentValue

Calculate the present value of a repoToken

function calculatePresentValue(
    uint256 repoTokenAmountInBaseAssetPrecision,
    uint256 purchaseTokenPrecision,
    uint256 redemptionTimestamp,
    uint256 discountRate
) internal view returns (uint256 presentValue);

Parameters

Name
Type
Description

repoTokenAmountInBaseAssetPrecision

uint256

The amount of repoToken in base asset precision

purchaseTokenPrecision

uint256

The precision of the purchase token

redemptionTimestamp

uint256

The redemption timestamp of the repoToken

discountRate

uint256

The auction rate

Returns

Name
Type
Description

presentValue

uint256

The present value of the repoToken

getNormalizedRepoTokenAmount

Get the normalized amount of a repoToken in base asset precision

function getNormalizedRepoTokenAmount(
    address repoToken,
    uint256 repoTokenAmount,
    uint256 purchaseTokenPrecision,
    uint256 repoRedemptionHaircut
) internal view returns (uint256 repoTokenAmountInBaseAssetPrecision);

Parameters

Name
Type
Description

repoToken

address

The address of the repoToken

repoTokenAmount

uint256

The amount of the repoToken

purchaseTokenPrecision

uint256

The precision of the purchase token

repoRedemptionHaircut

uint256

The haircut to be applied to the repoToken for bad debt

Returns

Name
Type
Description

repoTokenAmountInBaseAssetPrecision

uint256

The normalized amount of the repoToken in base asset precision

Last updated