Skip to content

Commit

Permalink
fix: Optimism canHedge calc
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelxuwu authored May 25, 2023
1 parent b0f0551 commit 2f61aa0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sdk/src/utils/canHedgeOptimism.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { BigNumber } from 'ethers'

import { PoolHedgerParams } from '../admin'
import { UNIT } from '../constants/bn'
import { SNXPerpsV2PoolHedger } from '../contracts/newport/typechain/NewportSNXPerpsV2PoolHedger'
import { Option } from '../option'
import getCappedExpectedHedge from './getCappedExpectedHedge'
Expand All @@ -13,7 +14,7 @@ const hasEnoughMarketDepth = (
longInterest: BigNumber
) => {
const interest = hedge.lt(0) ? shortInterest : longInterest
const marketUsage = interest.add(hedge.abs().mul(marketDepthBuffer))
const marketUsage = interest.add(hedge.abs().mul(marketDepthBuffer).div(UNIT))
return marketUsage.lt(maxTotalMarketSize)
}

Expand All @@ -34,6 +35,7 @@ export default function canHedgeOnOptimism(
shortInterest,
longInterest,
maxTotalMarketSize,
curveRateStable,
} = hedgerView

if (marketSuspended) {
Expand All @@ -59,7 +61,7 @@ export default function canHedgeOnOptimism(
return true
}
// check that the curve swap rates are acceptable
if (!hedgerView.curveRateStable) {
if (!curveRateStable) {
return false
}

Expand Down

0 comments on commit 2f61aa0

Please sign in to comment.