From 1585ef2c1f36f62ed742073ec96be2d646a113ab Mon Sep 17 00:00:00 2001 From: clemlak Date: Tue, 5 Dec 2023 18:48:09 +0400 Subject: [PATCH] feat: add computeISFunction --- contracts/strategies/G3MStrategyLib.sol | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/contracts/strategies/G3MStrategyLib.sol b/contracts/strategies/G3MStrategyLib.sol index 15dc455b..49078f46 100644 --- a/contracts/strategies/G3MStrategyLib.sol +++ b/contracts/strategies/G3MStrategyLib.sol @@ -159,4 +159,15 @@ library G3MStrategyLib { return FixedPointMathLib.WAD - (FixedPointMathLib.WAD.divWadUp(FixedPointMathLib.WAD + boop)); } + + function computeISFunction(uint256 t) internal pure returns (uint256 x) { + uint256 boop = uint256( + int256( + FixedPointMathLib.WAD.divWadUp( + FixedPointMathLib.WAD - t - FixedPointMathLib.WAD + ) + ).powWad(-(int256(FixedPointMathLib.WAD.divWadUp(2)))) + ); + return FixedPointMathLib.WAD.divWadUp(FixedPointMathLib.WAD + boop); + } }