VRGDA

Git Source

Authors: transmissions11 t11s@paradigm.xyz, FrankieIsLost frankie@paradigm.xyz

Sell tokens roughly according to an issuance schedule.

State Variables

targetPrice

Target price for a token, to be scaled according to sales pace.

Represented as an 18 decimal fixed point number.

int256 public immutable targetPrice;

decayConstant

Precomputed constant that allows us to rewrite a pow() as an exp().

Represented as an 18 decimal fixed point number.

int256 internal immutable decayConstant;

Functions

constructor

Sets target price and per time unit price decay for the VRGDA.

constructor(int256 _targetPrice, int256 _priceDecayPercent);

Parameters

NameTypeDescription
_targetPriceint256The target price for a token if sold on pace, scaled by 1e18.
_priceDecayPercentint256The percent price decays per unit of time with no sales, scaled by 1e18.

getVRGDAPrice

Calculate the price of a token according to the VRGDA formula.

function getVRGDAPrice(int256 timeSinceStart, uint256 sold) public view virtual returns (uint256);

Parameters

NameTypeDescription
timeSinceStartint256Time passed since the VRGDA began, scaled by 1e18.
solduint256The total number of tokens that have been sold so far.

Returns

NameTypeDescription
<none>uint256The price of a token according to VRGDA, scaled by 1e18.

getTargetSaleTime

Given a number of tokens sold, return the target time that number of tokens should be sold by.

function getTargetSaleTime(int256 sold) public view virtual returns (int256);

Parameters

NameTypeDescription
soldint256A number of tokens sold, scaled by 1e18, to get the corresponding target sale time for.

Returns

NameTypeDescription
<none>int256The target time the tokens should be sold by, scaled by 1e18, where the time is relative, such that 0 means the tokens should be sold immediately when the VRGDA begins.