Skip to content

Commit

Permalink
Aproximate curve more
Browse files Browse the repository at this point in the history
  • Loading branch information
xavikh committed Dec 11, 2024
1 parent 94593ee commit c604641
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ lcov*
# multisig addresses
script/multisig-*.json
^script/multisig-members.json

.DS_Store
2 changes: 1 addition & 1 deletion src/libs/CurveConstantLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pragma solidity ^0.8.0;
library CurveConstantLib {
int256 internal constant SHARED_CONSTANT_COEFFICIENT = 1e18;
/// @dev 2 / (7 * 2_weeks) - expressed in fixed point
int256 internal constant SHARED_LINEAR_COEFFICIENT = 826714169348;
int256 internal constant SHARED_LINEAR_COEFFICIENT = 826719576719;
/// @dev 1 / (7 * (2_weeks)^2) - expressed in fixed point
int256 internal constant SHARED_QUADRATIC_COEFFICIENT = 0;

Expand Down
10 changes: 5 additions & 5 deletions test/escrow/curve/QuadraticCurveMath.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ contract TestQuadraticIncreasingCurve is QuadraticCurveBase {
// solmate (optimized): 449.206254284606635135
assertEq(
curve.votingPowerAt(tokenIdFirst, block.timestamp),
510837615298044126114,
510838204935452985628,
"Balance incorrect after warmup"
);
assertEq(curve.isWarm(tokenIdFirst), true, "Still warming up");
Expand All @@ -117,7 +117,7 @@ contract TestQuadraticIncreasingCurve is QuadraticCurveBase {
// solmate: 1067784483312193385000000000
assertEq(
curve.votingPowerAt(tokenIdSecond, block.timestamp),
1214285139409170948000000000,
1214286541005141519000000000,
"Balance incorrect after warmup II"
);

Expand All @@ -130,12 +130,12 @@ contract TestQuadraticIncreasingCurve is QuadraticCurveBase {
// solmate2: 600.985163959347101952
assertEq(
curve.votingPowerAt(tokenIdFirst, block.timestamp),
841377248369081041152,
841379999999706526656,
"Balance incorrect after p1"
);

uint256 expectedMaxI = 2524126241845405205760;
uint256 expectedMaxII = 5999967296216704000000000000;
uint256 expectedMaxI = 2524139999998532633280;
uint256 expectedMaxII = 5999999999996512000000000000;

// warp to the final period
// TECHNICALLY, this should finish at exactly 5 periods and 6 * voting power
Expand Down

0 comments on commit c604641

Please sign in to comment.