Skip to content

Commit f1fb146

Browse files
committed
add a nicer error message when pool is completely tilted into 1 direction
1 parent cbf4344 commit f1fb146

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

contracts/contracts/strategies/algebra/StableSwapAMMStrategy.sol

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ contract StableSwapAMMStrategy is InitializableAbstractStrategy {
9797

9898
// Get the amount of OToken received from selling 1 asset. This is buying OToken.
9999
uint256 oTokenAmount = IPair(pool).getAmountOut(1e18, asset);
100+
101+
// If the pool is degenerate, then the pool is not valid and we can't deposit.
102+
require(oTokenAmount > 0, "Pool degenerate");
103+
100104
// Convert to a OToken/asset price = asset / OToken
101105
uint256 buyPrice = 1e36 / oTokenAmount;
102106

0 commit comments

Comments
 (0)