|
|
@@ -11,14 +11,19 @@ contract Calc {
|
|
|
|
|
|
function getQuote(address tokenA, uint amountA, address tokenB, uint24 fee) public view returns (uint256 amountB) {
|
|
|
(int24 tick,) = OracleLibrary.consult(factory.getPool(tokenA, tokenB, fee), 60);
|
|
|
- return OracleLibrary.getQuoteAtTick(tick, uint128(amountA), tokenA, tokenB) * (100000 - fee) / 100000;
|
|
|
+ return OracleLibrary.getQuoteAtTick(tick, uint128(amountA), tokenA, tokenB);
|
|
|
}
|
|
|
|
|
|
- function calc1(uint num1, uint24 fee) public view returns (uint256 rst1) {
|
|
|
- return num1 * fee;
|
|
|
+ function getQuoteHandleFee(address tokenA, uint amountA, address tokenB, uint24 fee) public view returns (uint256 amountB) {
|
|
|
+ (int24 tick,) = OracleLibrary.consult(factory.getPool(tokenA, tokenB, fee), 60);
|
|
|
+ return OracleLibrary.getQuoteAtTick(tick, uint128(amountA) * (1_000_000 - fee) / 1_000_000, tokenA, tokenB);
|
|
|
+ }
|
|
|
+
|
|
|
+ function calc1(uint num1, uint24 fee) public pure returns (uint256 rst1) {
|
|
|
+ return num1 * (1_000_000 - fee);
|
|
|
}
|
|
|
|
|
|
- function calc2(uint num2, uint24 fee) public view returns (uint256 rst2) {
|
|
|
- return num2 * fee / 100000;
|
|
|
+ function calc2(uint num2, uint24 fee) public pure returns (uint256 rst2) {
|
|
|
+ return num2 * (1_000_000 - fee) / 1_000_000;
|
|
|
}
|
|
|
}
|