Skip to content

Commit

Permalink
Fix Tau validations in ECLP Math (#1185)
Browse files Browse the repository at this point in the history
  • Loading branch information
joaobrunoah authored Dec 20, 2024
1 parent 2cb4ac9 commit 080bdd7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/pool-gyro/contracts/lib/GyroECLPMath.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ library GyroECLPMath {
error DerivedTauAlphaNotNormalized();
error DerivedTauBetaNotNormalized();
error StretchingFactorWrong();
error DerivedTauAlphaYWrong();
error DerivedTauBetaYWrong();
error DerivedTauXWrong();
error DerivedUWrong();
error DerivedVWrong();
error DerivedWWrong();
Expand Down Expand Up @@ -89,6 +92,11 @@ library GyroECLPMath {
IGyroECLPPool.EclpParams memory params,
IGyroECLPPool.DerivedEclpParams memory derived
) internal pure {
// If tau is not within the range below, the pool math may be messed.
require(derived.tauAlpha.y > 0, DerivedTauAlphaYWrong());
require(derived.tauBeta.y > 0, DerivedTauBetaYWrong());
require(derived.tauBeta.x > derived.tauAlpha.x, DerivedTauXWrong());

int256 norm2;
norm2 = scalarProdXp(derived.tauAlpha, derived.tauAlpha);

Expand Down

0 comments on commit 080bdd7

Please sign in to comment.