Skip to content

Commit

Permalink
rename depeg var to be more clear what its for
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronmgdr committed Feb 7, 2024
1 parent 33f54fb commit 3b3e4b4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/cli/src/commands/exchange/celo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { checkNotDangerousExchange } from '../../utils/exchange'
import { enumEntriesDupWithLowercase } from '../../utils/helpers'
import { getMentoBroker } from '../../utils/mento-broker-adaptor'

const depeggedPricePercentage = 20
const MAX_DEPEG_PRICE_PERCENTAGE = 20

const stableTokenOptions = enumEntriesDupWithLowercase(Object.entries(StableToken))
export default class ExchangeCelo extends BaseCommand {
Expand Down Expand Up @@ -75,7 +75,7 @@ export default class ExchangeCelo extends BaseCommand {
kit,
sellAmount,
new BigNumber(expectedAmountToReceive.toString()),
depeggedPricePercentage,
MAX_DEPEG_PRICE_PERCENTAGE,
stableTokenInfos[stableToken]
)
if (!check) {
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/exchange-stable-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { binaryPrompt, displaySendEthersTxViaCK, displaySendTx } from './utils/c
import { CustomFlags } from './utils/command'
import { checkNotDangerousExchange } from './utils/exchange'
import { getMentoBroker } from './utils/mento-broker-adaptor'
const depeggedPricePercentage = 20
const MAX_DEPEG_PRICE_PERCENTAGE = 20
export default class ExchangeStableBase extends BaseCommand {
static flags = {
...BaseCommand.flags,
Expand Down Expand Up @@ -68,7 +68,7 @@ export default class ExchangeStableBase extends BaseCommand {
kit,
sellAmount,
new BigNumber(expectedAmountToReceive.toString()),
depeggedPricePercentage,
MAX_DEPEG_PRICE_PERCENTAGE,
stableTokenInfos[this._stableCurrency as StableToken],
true
)
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/utils/exchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export async function checkNotDangerousExchange(
kit: ContractKit,
sellAmount: BigNumber,
quotedAmountToReceiveWithBuffer: BigNumber,
depeggedPricePercentage: number,
maxDepegPricePercentage: number,
stableTokenInfo: StableTokenInfo = stableTokenInfos[StableToken.cUSD],
flipOracle = false
): Promise<boolean> {
Expand All @@ -37,7 +37,7 @@ export async function checkNotDangerousExchange(
quotedAmountToReceiveWithBuffer,
oracleMedianRate
)
if (Math.abs(expectedSlippage) > depeggedPricePercentage) {
if (Math.abs(expectedSlippage) > Math.abs(maxDepegPricePercentage)) {
const check = await binaryPrompt(
`Warning ${
stableTokenInfo.symbol
Expand Down

0 comments on commit 3b3e4b4

Please sign in to comment.