Fraction ProtocolgenericFacetspriceFacetsbondingCurvePriceFacetslinearCurveFacetlibs

LinearCurve

Curve

struct Curve {
  uint256 startPrice;
  uint256 priceIncreasePerToken;
}

averageMintPrice

function averageMintPrice(struct LinearCurve.Curve curve, uint256 amount, uint256 currentSupply) internal pure returns (uint256)

Calculates the per-token price of minting the specified amount of tokens

Parameters

NameTypeDescription
curvestruct LinearCurve.CurveParameters of the Curve
amountuint256Amount of tokens to mint
currentSupplyuint256Supply of tokens before minting

Return Values

NameTypeDescription
[0]uint256average price of minting one token in a batch

averageBurnPrice

function averageBurnPrice(struct LinearCurve.Curve curve, uint256 amount, uint256 currentSupply) internal pure returns (uint256)

Calculates the per-token refund for burning the specified amount of tokens

Parameters

NameTypeDescription
curvestruct LinearCurve.CurveParameters of the Curve
amountuint256Amount of tokens to burn
currentSupplyuint256Supply of tokens before burning

Return Values

NameTypeDescription
[0]uint256average refund of burning one token in a batch

priceAt

function priceAt(struct LinearCurve.Curve curve, uint256 targetSupply) internal pure returns (uint256)

Calculates price of a token at a point with specified supply equals to mintPrice(1, targetSupply, curveParams) or burnPrice(1, targetSupply+1, curveParams)

Parameters

NameTypeDescription
curvestruct LinearCurve.CurveParameters of the Curve
targetSupplyuint256Supply of tokens to get price

On this page