Skip to content

Commit

Permalink
update mainnet minimum_eth_locked
Browse files Browse the repository at this point in the history
  • Loading branch information
mzywang committed May 9, 2024
1 parent b37b491 commit 161da3f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"semi": false,
"singleQuote": true,
"printWidth": 120,
"trailingComma": "all"
}
5 changes: 0 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,5 @@
"npm-run-all": "^4.1.5",
"prettier": "^1.18.2",
"typescript": "^3.5.2"
},
"prettier": {
"printWidth": 120,
"semi": false,
"singleQuote": true
}
}
9 changes: 6 additions & 3 deletions src/utils/pricing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,16 @@ const STABLE_COINS: string[] = [
'0x4dd28568d05f09b02220b09c2cb307bfd837cb95',
]

const MINIMUM_ETH_LOCKED = BigDecimal.fromString('60')
const MINIMUM_ETH_LOCKED = BigDecimal.fromString('20')

const Q192 = BigInt.fromI32(2).pow(192 as u8)
export function sqrtPriceX96ToTokenPrices(sqrtPriceX96: BigInt, token0: Token, token1: Token): BigDecimal[] {
const num = sqrtPriceX96.times(sqrtPriceX96).toBigDecimal()
const denom = BigDecimal.fromString(Q192.toString())
const price1 = num.div(denom).times(exponentToBigDecimal(token0.decimals)).div(exponentToBigDecimal(token1.decimals))
const price1 = num
.div(denom)
.times(exponentToBigDecimal(token0.decimals))
.div(exponentToBigDecimal(token1.decimals))

const price0 = safeDiv(BigDecimal.fromString('1'), price1)
return [price0, price1]
Expand Down Expand Up @@ -132,7 +135,7 @@ export function getTrackedAmountUSD(
tokenAmount0: BigDecimal,
token0: Token,
tokenAmount1: BigDecimal,
token1: Token
token1: Token,
): BigDecimal {
const bundle = Bundle.load('1')!
const price0USD = token0.derivedETH.times(bundle.ethPriceUSD)
Expand Down

0 comments on commit 161da3f

Please sign in to comment.