BasePricing

Git Source

Inherits: Pricing

Functions

validate

function validate(Starport.Loan calldata loan) external view virtual override returns (bytes4);

getPaymentConsideration

function getPaymentConsideration(Starport.Loan calldata loan)
    public
    view
    virtual
    override
    returns (SpentItem[] memory repayConsideration, SpentItem[] memory carryConsideration);

getInterest

Computes the interest for a given loan

function getInterest(
    Starport.Loan calldata loan,
    uint256 rate,
    uint256 start,
    uint256 end,
    uint256 index,
    uint256 decimals
) public pure returns (uint256);

Parameters

NameTypeDescription
loanStarport.LoanThe loan to compute the interest for
rateuint256The interest rate
startuint256The start time frame
enduint256The end time frame
indexuint256The index of the debt to compute the interest for
decimalsuint256The decimals of the debt asset

calculateInterest

Computes the interest

function calculateInterest(uint256 delta_t, uint256 amount, uint256 rate, uint256 decimals)
    public
    pure
    virtual
    returns (uint256);

Parameters

NameTypeDescription
delta_tuint256The time delta
amountuint256The amount to compute the interest for
rateuint256The interest rate
decimalsuint256The decimals of the base asset

Structs

Details

struct Details {
    uint256 rate;
    uint256 carryRate;
    uint256 decimals;
}