-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add liquidity example #373
Conversation
@brunoguerios - "Reduce add liquidity amount as otherwise the priceImpact calculation (swap queries) will revert with the pool used, due to revert MaxAmountInRatio" - is that a bug in priceImpact? |
export class Pools { | ||
readonly poolStateQuery = ` | ||
query GetPool($id: String!) { | ||
poolGetPool(id:$id) { | ||
query poolGetPool($id: String!, $chain: GqlChain!) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't realise the API had changed to require the chain field. Seems nicely handled 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM and runs locally.
I tried to simulate the query on tenderly and it reverted. https://dashboard.tenderly.co/mcquardt/project/simulator/a4c4577e-ab88-44c9-88e9-244a97e9450f?trace=0.1.0.2.2.0.7.3 numbers I used were from a debugging run |
Price Impact calculation for Add Liquidity Unbalanced relies on |
@brunoguerios - any further comments before this gets merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM ✅
This pr fixes the add-liquidity-example. The following changes were made:
revert MaxAmountInRatio
Chain.name
from https://github.com/wevm/viem/blob/main/src/types/chain.ts#L49. However, even with uppercasing them they do not perfectly match with what the api expects.