Skip to content

Commit

Permalink
Update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
xavikh committed Dec 11, 2024
1 parent 2bd0c19 commit 0c7eab2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
File renamed without changes.
13 changes: 6 additions & 7 deletions src/libs/CurveConstantLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@ pragma solidity ^0.8.0;

/// @title CurveConstantLib
/// @notice Precomputed coefficients for escrow curve
/// This curve implementation is a quadratic curve of the form y = (1/7)t^2 + (2/7)t + 1
/// Which is a transformation of the quadratic curve y = (x^2 + 6)/7
/// That starts with 1 unit of voting in period 1, and max 6 in period 6.
/// This curve implementation is a linear curve of the form y = t + 1
/// That starts with 1 unit of voting in epoch 1 (t=0),
/// and max 6 at the end of epoch 5 (t=5).
/// To use this in zero indexed time, with a per-second rate of increase,
/// we transform this to the polynomial y = (1/7)t^2 + (2/7)t + 1
/// where t = timestamp / 2_weeks (2 weeks is one period)
/// where t = timestamp / 2_weeks (2 weeks is one epoch)
/// Below are the shared coefficients for the linear and quadratic terms
library CurveConstantLib {
int256 internal constant SHARED_CONSTANT_COEFFICIENT = 1e18;
/// @dev 2 / (7 * 2_weeks) - expressed in fixed point
/// @dev 1e18 / (3600 * 24 * 14) - expressed in fixed point
int256 internal constant SHARED_LINEAR_COEFFICIENT = 826719576719;
/// @dev 1 / (7 * (2_weeks)^2) - expressed in fixed point
/// @dev Zero, since the curve is linear
int256 internal constant SHARED_QUADRATIC_COEFFICIENT = 0;

/// @dev the maxiumum number of epochs the curve can keep increasing
Expand Down

0 comments on commit 0c7eab2

Please sign in to comment.