Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

fix: fix price impact calculation for 100% sell tax #53

Merged
merged 5 commits into from
Oct 13, 2023

Conversation

tinaszheng
Copy link
Contributor

this is a swap from 0 token in to 0 token out, so the price impact for the swap is 0!

@tinaszheng tinaszheng merged commit 845cf1a into main Oct 13, 2023
1 check passed
@tinaszheng tinaszheng deleted the tina/fix-price-impact branch October 13, 2023 21:20
@@ -198,13 +198,21 @@ export class Trade<TInput extends Currency, TOutput extends Currency, TTradeType
return this._priceImpact
}

if (this.outputTax.equalTo(ONE_HUNDRED_PERCENT)) {
throw new Error('Unable to calculate price impact for a 100% buy-tax token')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we be throwing here? imo probably not because it makes the devx pretty rough for people using this SDK

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants