Skip to content

Commit

Permalink
fix: handle when diff before is 0.
Browse files Browse the repository at this point in the history
  • Loading branch information
clement-ux committed Feb 6, 2025
1 parent 61cd6c9 commit 052c7e3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions contracts/contracts/strategies/BaseCurveAMOStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,14 @@ contract BaseCurveAMOStrategy is InitializableAbstractStrategy {
int256 diffAfter = balancesAfter[ethCoinIndex].toInt256() -
balancesAfter[oethCoinIndex].toInt256();

if (diffBefore <= 0) {
if (diffBefore == 0) {
require(diffAfter == 0, "Position balance is worsened");
} else if (diffBefore < 0) {
// If the pool was originally imbalanced in favor of OETH, then
// we want to check that the pool is now more balanced
require(diffAfter <= 0, "OTokens overshot peg");
require(diffBefore < diffAfter, "OTokens balance worse");
}
if (diffBefore >= 0) {
} else if (diffBefore > 0) {
// If the pool was originally imbalanced in favor of ETH, then
// we want to check that the pool is now more balanced
require(diffAfter >= 0, "Assets overshot peg");
Expand Down

0 comments on commit 052c7e3

Please sign in to comment.