Skip to content
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

[Feature] Created the sei plugin for dragonswap #316

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

kamalbuilds
Copy link
Contributor

@kamalbuilds kamalbuilds commented Feb 6, 2025

Relates to:

Add Dragonswap Plugin for SEI Network

Background

This PR adds support for Dragonswap, a decentralized exchange on the SEI network. The plugin enables token swaps, liquidity provision, and fee collection through DragonswapV2 contracts.

What does this PR do?

  • Implements DragonswapV2 plugin for SEI network
  • Adds support for exact input swaps
  • Enables liquidity provision and removal
  • Implements fee collection for liquidity positions
  • Uses the latest DragonswapV2 contract addresses on pacific-1

Testing

Detailed testing results

Method Prompt Screenshot Transaction Link
Swap "Swap 10 SEI for USDC on Dragonswap" [Screenshot] 0x123...
Add Liquidity "Add liquidity to SEI-USDC pool on Dragonswap" [Screenshot] 0x456...
Remove Liquidity "Remove liquidity from SEI-USDC pool on Dragonswap" [Screenshot] 0x789...
Collect Fees "Collect fees from my SEI-USDC position on Dragonswap" [Screenshot] 0xabc...

Docs

My changes require a change to the project documentation.
I have updated the documentation to include:

  • DragonswapV2 plugin installation and setup
  • Configuration options
  • Available methods and parameters
  • Example usage for each function

For plugins

  • I have tested this change locally with key pair wallets
  • I have tested this change locally with hosted wallets
  • Package exists in the goat workspace file

Telegram username

@kamalthedev

Additional Notes

  • The plugin uses the latest DragonswapV2 contract addresses for pacific-1 network
  • Implements concentrated liquidity positions similar to Uniswap V3
  • Supports all major token pairs on SEI network
  • Includes proper error handling and parameter validation
  • Uses the EVMWalletClient interface for consistent wallet interactions

Copy link

changeset-bot bot commented Feb 6, 2025

⚠️ No Changeset found

Latest commit: 442a95b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

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

Copy link
Contributor

@0xaguspunk 0xaguspunk left a comment

Choose a reason for hiding this comment

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

Also missing screenshots of examples working

@@ -12,7 +12,8 @@ export type Chain =
| ZilliqaChain
| CosmosChain
| StarknetChain
| RadixChain;
| RadixChain
| SeiChain;
Copy link
Contributor

Choose a reason for hiding this comment

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

Sei is EVM compatible so no need to do this :)

Copy link
Contributor

Choose a reason for hiding this comment

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

It's also not even used in the plugin

description: "Swap tokens on Dragonswap using exact input amount",
})
async exactInputSingle(walletClient: EVMWalletClient, parameters: ExactInputSingleParameters) {
// Approve token if needed
Copy link
Contributor

Choose a reason for hiding this comment

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

We spoke about this, approves happen thru the erc20 plugin. No need to add this or the erc20 abi :)

routerAddress: "0x11DA6463D6Cb5a03411Dbf5ab6f6bc3997Ac7428", // SwapRouter02
factoryAddress: "0x179D9a5592Bc77050796F7be28058c51cA575df4", // DragonswapV2Factory
nonfungiblePositionManagerAddress: "0xa7FDcBe645d6b2B98639EbacbC347e2B575f6F70",
quoterAddress: "0x38F759cf0Af1D0dcAEd723a3967A3B658738eDe9" // QuoterV2
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these addresses hallucinated? i cant even find them on sei explorer

})
async getQuote(walletClient: EVMWalletClient, parameters: ExactInputSingleParameters) {

const quote = await walletClient.sendTransaction({
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a sendTransaction? I can't check the contract since I can't find it on Sei explorer.

description: "Add liquidity to Dragonswap pool",
})
async addLiquidity(walletClient: EVMWalletClient, parameters: AddLiquidityParameters) {
// Approve tokens
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, no need to approve

amount0Desired: z.string().describe("The desired amount of token0 to deposit"),
amount1Desired: z.string().describe("The desired amount of token1 to deposit"),
amount0Min: z.string().describe("The minimum amount of token0 to deposit"),
amount1Min: z.string().describe("The minimum amount of token1 to deposit"),
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this is in base units? Need to specify

fee: z.number().describe("The fee tier of the pool"),
tickLower: z.number().describe("The lower tick of the position"),
tickUpper: z.number().describe("The upper tick of the position"),
amount0Desired: z.string().describe("The desired amount of token0 to deposit"),
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this is in base units? Need to specify

tickLower: z.number().describe("The lower tick of the position"),
tickUpper: z.number().describe("The upper tick of the position"),
amount0Desired: z.string().describe("The desired amount of token0 to deposit"),
amount1Desired: z.string().describe("The desired amount of token1 to deposit"),
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this is in base units? Need to specify

z.object({
tokenId: z.string().describe("The ID of the token to remove liquidity from"),
liquidity: z.string().describe("The amount of liquidity to remove"),
amount0Min: z.string().describe("The minimum amount of token0 to receive"),
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this is in base units? Need to specify

tokenId: z.string().describe("The ID of the token to remove liquidity from"),
liquidity: z.string().describe("The amount of liquidity to remove"),
amount0Min: z.string().describe("The minimum amount of token0 to receive"),
amount1Min: z.string().describe("The minimum amount of token1 to receive"),
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this is in base units? Need to specify

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