-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e28ed92
commit ae74971
Showing
9 changed files
with
115 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.7.0; | ||
|
||
import "@uniswap/v3-core/contracts/libraries/SqrtPriceMath.sol"; | ||
|
||
contract LiquidityAmountsCalculator { | ||
function getNextSqrtPriceFromAmount0RoundingUp( | ||
uint160 sqrtPX96, | ||
uint128 liquidity, | ||
uint256 amount, | ||
bool add | ||
) external pure returns (uint160 sqrtPriceX96) { | ||
sqrtPriceX96 = SqrtPriceMath.getNextSqrtPriceFromAmount0RoundingUp(sqrtPX96, liquidity, amount, add); | ||
} | ||
|
||
function getNextSqrtPriceFromAmount1RoundingDown( | ||
uint160 sqrtPX96, | ||
uint128 liquidity, | ||
uint256 amount, | ||
bool add | ||
) external pure returns (uint160 sqrtPriceX96) { | ||
sqrtPriceX96 = SqrtPriceMath.getNextSqrtPriceFromAmount1RoundingDown(sqrtPX96, liquidity, amount, add); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
interface ILiquidityAmountsCalculator { | ||
function getNextSqrtPriceFromAmount0RoundingUp( | ||
uint160 sqrtPX96, | ||
uint128 liquidity, | ||
uint256 amount, | ||
bool add | ||
) external pure returns (uint160 sqrtQX96); | ||
|
||
function getNextSqrtPriceFromAmount1RoundingDown( | ||
uint160 sqrtPX96, | ||
uint128 liquidity, | ||
uint256 amount, | ||
bool add | ||
) external pure returns (uint160 sqrtQX96); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters