An abstract bonding curve for purchasing FEI and routing of the purchased asset to PCV.
The amount of PCV it takes in a purchase transaction to bring the curve to a total amount of FEI issued T is determined by integrating the price function between the current FEI amount issued C by the bonding curve and the target amount T after the transaction.
The quantity T-C is the amount of FEI received by the transaction. Since C is a known constant, we solve for T by setting the formula equal to a PCV purchase quantity Q and rearranging terms.
Post scale, the price should be $1 + b times the peg, where b is the variance buffer and the peg is reported as X per FEI. In the implementation, we use $1 - b because the peg is inverted so the price relationship is also inverted.
Incoming PCV is held temporarily to allow for batch transactions via the
allocate() function. The PCV allocation gets split into a weighted list of PCV deposit contracts, (see PCVSplitter). While allocations can be called at any time, there is a 500 FEI incentive for calling it after each 24 hour window. To determine eligibility for the incentive, simply call
isTimeEnded() on the contract. The time until the next incentive is available is
Purchase of FEI on bonding curve
recipient of FEI
amount of purchase asset
amount of FEI
Allocate held PCV
the sender of the allocation transaction
the amount of PCV allocated
Governance change of Scale target
new Scale target
Governance change of Buffer
Changes the FEI reward for calling
new incentive amount
function getCurrentPrice() external view returns (Decimal.D256 memory);
Returns current instantaneous bonding curve price. The price reported as FEI per X, with X being the underlying asset. This is analogous to the peg reported by the oracle.
function getAverageUSDPrice(uint256 amountIn)externalviewreturns (Decimal.D256 memory);
Returns the average price of a transaction of size
amountIn ETH along bonding curve. The price here is reported as USD per FEI.
function getAmountOut(uint256 amountIn)externalviewreturns (uint256 amountOut);
Returns the amount
amountOutof FEI received for a purchase of
function scale() external view returns (uint256);
totalPurchased after which the bonding curve price switches to a fixed premium on the peg.
function atScale() external view returns (bool);
Returns true when
totalPurchased() is greater than
function buffer() external view returns (uint256);
The multiplier applied to the peg price when post-Scale.
function BUFFER_GRANULARITY() external view returns (uint256);
The granularity of the buffer. Constant at 10,000.
function totalPurchased() external view returns (uint256);
Returns the cumulative amount of FEI issued via the bonding curve. Used in the bonding curve formula as the supply amount.
function getTotalPCVHeld() external view returns (uint256);
Returns the amount of PCV held in the contract and ready for allocation.
function incentiveAmount() external view returns (uint256);
Returns the amount of FEI sent to the keeper who calls
allocate() while the incentive is active.
function purchase(address to, uint256 amountIn)externalpayablereturns (uint256 amountOut);
amountOut FEI along the bonding curve for
amountIn ETH and send the FEI to address
function allocate() external;
Allocate the PCV held by the bonding curve to the weighted PCV allocations returned by
function setBuffer(uint256 _buffer) external;
Sets the buffer to
_buffer. Must be less than
function setScale(uint256 _scale) external;
Sets the Scale target to
function setIncentiveAmount(uint256 _incentiveAmount) external;
function setIncentiveFrequency(uint256 _frequency) external;
Sets the Timed duration to
function setAllocation(address calldata pcvDeposits,uint256 calldata ratios) external;
Sets the PCV allocation to
pcvDeposits with weights
ratios. The ratios must sum to
ALLOCATION_GRANULARITY which is constant at 10,000.