fill notifications and chart autoupdate
This commit is contained in:
@@ -31,7 +31,7 @@ export function uniswapV3PoolAddress(chainId, tokenAddrA, tokenAddrB, fee) {
|
||||
|
||||
export function uniswapV3AveragePrice(amountIn, amountOut, fee) {
|
||||
if (amountIn === 0n || amountOut === 0n) return null
|
||||
const fmtX18 = {decimals: 18, width: 256, signed: false};
|
||||
const fmtX18 = {decimals: 18, width: 512, signed: false};
|
||||
let result = FixedNumber.fromValue(amountOut, 0, fmtX18)
|
||||
.div(FixedNumber.fromValue(amountIn, 0, fmtX18)).toUnsafeFloat()
|
||||
result /= (1 - fee / 1_000_000) // adjust for pool fee
|
||||
|
||||
Reference in New Issue
Block a user