An abstract bonding curve for purchasing RUSD 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 RUSD issued T is determined by integrating the price function between the current RUSD amount issued C by the bonding curve and the target amount T after the transaction.
Amount of PCV out for a purchase
The quantity T-C is the amount of RUSD 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.
The price should be $1 + b times the peg, where b is the variance buffer and the peg is reported as X per RUSD. 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 100 RUSD 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 remainingTime().