Skip to content

Commit

Permalink
feat: update validateSwap
Browse files Browse the repository at this point in the history
  • Loading branch information
clemlak committed Nov 16, 2023
1 parent 49a97b9 commit fd82036
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion contracts/strategies/G3MStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
pragma solidity 0.8.19;

import "./IG3MStrategy.sol";
import "./G3MStrategyLib.sol";

contract G3MStrategy is IG3MStrategy {
address public immutable portfolio;
Expand Down Expand Up @@ -46,7 +47,19 @@ contract G3MStrategy is IG3MStrategy {
int256 invariant,
uint256 reserveX,
uint256 reserveY
) external view returns (bool, int256) { }
) external view returns (bool, int256) {
uint256 postInvariant = G3MStrategyLib.computeInvariant(
reserveX,
configs[poolId].weightX,
reserveY,
FixedPointMathLib.WAD - configs[poolId].weightX
);

return (
_validateSwap(uint256(invariant), postInvariant),
int256(postInvariant)
);
}

function _validateSwap(
uint256 preInvariant,
Expand Down

0 comments on commit fd82036

Please sign in to comment.