Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
novaknole committed Feb 28, 2025
1 parent 178ee5e commit ca76a70
Show file tree
Hide file tree
Showing 3 changed files with 256 additions and 128 deletions.
6 changes: 3 additions & 3 deletions src/escrow/increasing/QuadraticIncreasingEscrow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,8 @@ contract QuadraticIncreasingEscrow is
}
}

uNew.slope = (_newLocked.amount / CurveConstantLib.MAX_TIME).toUint128();
uNew.bias = _newLocked.amount + uNew.slope * accumulationDur;
uNew.slope = ((_newLocked.amount * 1e18 / CurveConstantLib.MAX_TIME).toUint128());
uNew.bias = _newLocked.amount * 1e18 + uNew.slope * accumulationDur;
uNew.start = _newLocked.start;
uNew.ts = currentTime;

Expand All @@ -392,7 +392,7 @@ contract QuadraticIncreasingEscrow is
if(userEpoch > 0) {
UserPoint storage p = _userPointHistory[_tokenId][userEpoch];
uint48 endOld = (p.start + CurveConstantLib.MAX_TIME).toUint48();

if(_newLocked.amount == 0) {
if(endOld <= uNew.ts) {
// we already subtracted p.slope in the above for loop,
Expand Down
4 changes: 2 additions & 2 deletions src/libs/BalanceLogicLibrary.sol
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ library BalanceLogicLibrary {
uint128 slope = _point.slope;
uint256 ts = _point.ts; // changes in for loop.
uint256 t_i = (ts / WEEK) * WEEK;

for (uint256 i = 0; i < 255; ++i) {
t_i += WEEK;
uint128 dSlope = 0;
Expand All @@ -149,6 +149,6 @@ library BalanceLogicLibrary {
if (bias < 0) {
bias = 0;
}
return uint256(bias); // TODO: USE safe cast
return uint256(bias / 1e18); // TODO: USE safe cast
}
}
Loading

0 comments on commit ca76a70

Please sign in to comment.