Skip to content

feat(traderjoe): add support for traderjoe swap #109

Merged
Quazia merged 44 commits intorabbitholegg:mainfrom
mmackz:traderjoe-swap
Dec 4, 2023
Merged

feat(traderjoe): add support for traderjoe swap #109
Quazia merged 44 commits intorabbitholegg:mainfrom
mmackz:traderjoe-swap

Conversation

@mmackz
Copy link
Collaborator

@mmackz mmackz commented Nov 19, 2023

Integration of traderjoe Plugin for QuestDK

This PR introduces the integration of the traderjoe plugin for QuestDK.

About The Project

Trader Joe is a popular decentralized trading platform on the Avalanche network and more recently Arbitrum One. It is known for its extensive range of swap functionalities and token offerings.

Implementation Details

This plugin supports all tokens featured in the "top" token section of the Trader Joe user interface. It has been thoroughly tested to ensure functionality across all 9 available swap methods. Additional testing is done to make sure that undefined parameters do not cause any unintended false negatives. The plugin permits using "any" token as tokenIn or tokenOut without negative impacts on the transaction's validity.

Current Limitations

  • For some swap methods, amount parameters will not be very accurate. This is due to the reliance on amountOutMin which can be significantly lower then expected. Especially if the user sets high slippage. amountIn and amountInMax have a similar issue, where amount will be higher than expected.
  • This Plugin will need to be updated if/when the LBRouter contract is migrated to a new version.
  • The plugin only supports swaps on Arbitrum One at this time. Avalanche and/or other networks can be added at a later date.

@mmackz mmackz requested a review from a team as a code owner November 19, 2023 01:06
@changeset-bot
Copy link

changeset-bot bot commented Nov 19, 2023

🦋 Changeset detected

Latest commit: 246d63e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@rabbitholegg/questdk-plugin-traderjoe Minor
@rabbitholegg/questdk-plugin-registry Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mmackz mmackz changed the title Traderjoe swap feat(traderjoe): add support for traderjoe swap Nov 19, 2023
@mmackz mmackz requested a review from Quazia November 19, 2023 01:09
Copy link
Contributor

@Quazia Quazia left a comment

Choose a reason for hiding this comment

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

LGTM - love the new and/or pattern for multiple function signature you have here. For the import { ChainId } from '@traderjoe-xyz/sdk-core' I don't think it's worth importing that package given that the chain ids are stable/not project specific and we can use our own internal chain ids. Whether we make that change now or once we add the intenal utils package I totally leave up to your judgement but long term I don't think it's worth having to import this package for that one object.

},
},
{
$or: [
Copy link
Contributor

Choose a reason for hiding this comment

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

I like this pattern for the optional params vs repeating the params that are always the same for each function signature. It's cool to see the plugin approaches evolve.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We had a lot of duplicate code, so figured I would test this approach. It looks much cleaner.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah agreed - going to default to this going forward it's definitely much cleaner

type SwapActionParams,
GreaterThanOrEqual,
} from '@rabbitholegg/questdk'
import { ChainId } from '@traderjoe-xyz/sdk-core'
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we use this package for anything else? Probably makes sense to just hard-code it and avoid the import then switch over to the internal utils chain id definitions once those are accesible.

@Quazia Quazia merged commit e7f7288 into rabbitholegg:main Dec 4, 2023
@mmackz mmackz deleted the traderjoe-swap branch December 7, 2023 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants