Skip to content
This repository has been archived by the owner on Jan 18, 2023. It is now read-only.

Commit

Permalink
Updated javadocs. Clarified price calculations.
Browse files Browse the repository at this point in the history
  • Loading branch information
bweick committed Jan 18, 2019
1 parent 36f0944 commit b06e724
Showing 1 changed file with 6 additions and 5 deletions.
Expand Up @@ -22,7 +22,7 @@ import { RebalancingHelperLibrary } from "../RebalancingHelperLibrary.sol";


/**
* @title OpenLinearAuctionPriceCurve
* @title LinearAuctionPriceCurve
* @author Set Protocol
*
* Contract used in rebalancing auctions to calculate price based off of a linear curve
Expand All @@ -42,6 +42,8 @@ contract LinearAuctionPriceCurve {
* Declare price denominator (or precision) of price curve
*
* @param _priceDenominator The priceDenominator you want this library to always return
* @param _usesStartPrice Boolean indicating if provided auctionStartPrice is used (true) or
* auction starts at 0 (false)
*/
constructor(
uint256 _priceDenominator,
Expand Down Expand Up @@ -100,7 +102,7 @@ contract LinearAuctionPriceCurve {
uint256 priceNumerator = _auctionParameters.auctionPivotPrice;
uint256 currentPriceDenominator = priceDenominator;

// Determine the auctionStartPrice based on if it should be sef-defined
// Determine the auctionStartPrice based on if it should be self-defined
uint256 auctionStartPrice = 0;
if (usesStartPrice) {
auctionStartPrice = _auctionParameters.auctionStartPrice;
Expand Down Expand Up @@ -146,10 +148,9 @@ contract LinearAuctionPriceCurve {
if (elapsed <= _auctionParameters.auctionTimeToPivot) {
// Calculate the priceNumerator as a linear function of time between _auctionStartPrice and
// _auctionPivotPrice
uint256 linearPriceDifference = _auctionParameters.auctionPivotPrice.sub(auctionStartPrice);
priceNumerator = auctionStartPrice.add(
elapsed.mul(
_auctionParameters.auctionPivotPrice.sub(auctionStartPrice)
).div(_auctionParameters.auctionTimeToPivot)
elapsed.mul(linearPriceDifference).div(_auctionParameters.auctionTimeToPivot)
);
} else {
// Calculate how many 30 second increments have passed since pivot was reached
Expand Down

0 comments on commit b06e724

Please sign in to comment.