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

Swush : DEX Aggregator on Polkadot Asset Hub #2440

Merged
merged 17 commits into from
Dec 19, 2024
Merged

Conversation

muddlebee
Copy link
Contributor

@muddlebee muddlebee commented Nov 5, 2024

Project Abstract

Swush is a DEX aggregator built on Polkadot Asset Hub, specifically to meet the needs of Polkadot’s cross-chain DeFi users. By leveraging cross-chain messaging (XCM), and aggregating assets from multiple parachains, Swush allows users to swap assets seamlessly across the ecosystem with minimal friction.

Full proposal can be found here

Grant level

  • Level 1: Up to $10,000, 2 approvals
  • Level 2: Up to $30,000, 3 approvals
  • Level 3: Unlimited, 5 approvals (for >$100k: Web3 Foundation Council approval)

Application Checklist

  • The application template has been copied and aptly renamed (project_name.md).
  • I have read the application guidelines.
  • Payment details have been provided (Polkadot AssetHub (USDC & DOT) address in the application and bank details via email, if applicable).
  • I understand that an agreed upon percentage of each milestone will be paid in vested DOT, to the Polkadot address listed in the application.
  • I am aware that, in order to receive a grant, I (and the entity I represent) have to successfully complete a KYC/KYB check.
  • The software delivered for this grant will be released under an open-source license specified in the application.
  • The initial PR contains only one commit (squash and force-push if needed).
  • The grant will only be announced once the first milestone has been accepted (see the announcement guidelines).
  • I prefer the discussion of this application to take place in a private Element/Matrix channel. My username is: @_______:matrix.org (change the homeserver if you use a different one)

@github-actions github-actions bot added the admin-review This application requires a review from an admin. label Nov 5, 2024
@muddlebee muddlebee marked this pull request as ready for review November 6, 2024 01:06
@muddlebee
Copy link
Contributor Author

@keeganquigley like we discussed earlier :)
apologies for the delay, can you please review? thank you

@keeganquigley keeganquigley self-assigned this Nov 6, 2024
@keeganquigley keeganquigley self-requested a review November 6, 2024 02:03
@muddlebee
Copy link
Contributor Author

muddlebee commented Nov 6, 2024

We plan to store all the assets including all the parachain assets like HDX,GLMR as foreign assets at Polkadot Asset Hub.

https://wiki.polkadot.network/docs/build-integrate-assets#foreign-assets

Foreign assets are those assets in Asset Hub whose native blockchain is not Asset Hub. These are mainly native tokens from other parachains or bridged tokens from other consensus systems (such as Ethereum). Once a foreign asset has been registered in Asset Hub (by its root origin), users are enabled to send this token from its native blockchain to Asset Hub and operate with it as if it were any other asset.

I will update the proposal with above info for better clarification. Proposal updated with above info

@muddlebee
Copy link
Contributor Author

muddlebee commented Nov 7, 2024

I have added some more architecture diagrams in Project Details -> Core Components section and some other clarifications in the proposal.
Please let me know if any further clarficiation required, more than happy to explain or add anything :)

Copy link
Contributor

@keeganquigley keeganquigley left a comment

Choose a reason for hiding this comment

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

Thanks for the application @muddlebee I think the biggest point of contention when discussing this internally with the other committee members was whether this should be funded by a DeFi protocol or DeFi grants program instead of W3F. But seeing that it will be fully integrated with Asset Hub, and have a focus on Plaza, makes me believe that perhaps this could help to jumpstart a solution for what might become an urgent need once smart contracts are live on AH.

One thing I'm not seeing in the application is a comparison to the other mentioned projects. Could you perhaps make a brief comparison to Chain Flip and Squid Router, and how these projects differ? EDIT: I do see that you compare to the other aggregators.

Also, do you foresee any uncertainties related to Plaza's ongoing development? Anything that might need to change along the way?

@keeganquigley keeganquigley added the changes requested The team needs to clarify a few things first. label Nov 12, 2024
@muddlebee
Copy link
Contributor Author

muddlebee commented Nov 13, 2024

@keeganquigley thank you for your response.

Could you perhaps make a brief comparison to Chain Flip and Squid Router, and how these projects differ?

Hey these are cross chain DEX's which help swap across blockchain networks like MoonBeam <-> Ethereum and other Ethereum L2s outside of Polkadot. I mentioned it as an example to highlight the importance of cross chain solutions.
I will clarify this in the proposal.

Also, do you foresee any uncertainties related to Plaza's ongoing development? Anything that might need to change along the way?

Currently I dont think so. In our development scope we have added only for Polkadot Asset Hub DEX and Hydration DEX which doesn't involve any smart contracts yet. But down the road we have to figure out on how to integrate smart contracts, which is beyond the scope of development roadmap proposed.

@muddlebee
Copy link
Contributor Author

also some updates on our current Development Status

Latest UI : https://swush-labs.github.io/swush-me-app/

UI features enabled

  • Asset Swap/Conversion
  • Confirmation screen after clicking "Swap"
  • Responsive UI for mobile/tablet view
  • Asset Conversion Details/Route

UI demo

Recording.2024-11-18.135554.mp4

Still in development, we plan to iterate it further :)

Copy link
Contributor

@keeganquigley keeganquigley left a comment

Choose a reason for hiding this comment

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

Thanks @muddlebee looks good. I am willing to give it a shot to help jumpstart the initial PoC, but in my opinion after this it would be great if you could hopefully apply for treasury funding or some other source. I will mark as ready for review so the rest of the committee can comment.

@keeganquigley keeganquigley added ready for review The project is ready to be reviewed by the committee members. and removed changes requested The team needs to clarify a few things first. labels Nov 20, 2024
@muddlebee
Copy link
Contributor Author

I recently made a huge swap on Hydration and ended up paying high fees. A similar transaction on StellaSwap (Moonbeam) would have cost much less in fees. This highlights how a DEX aggregator can simplify the process by fetching the best rates across the ecosystem. :)

image

Copy link
Contributor

@keeganquigley keeganquigley left a comment

Choose a reason for hiding this comment

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

@muddlebee I don't believe you've gone through the KYC/KYB process yet. While waiting for further reviews, could you please complete either KYC verification (for individual check) or KYB verification (for legal entity check, if any). Thanks!

@muddlebee
Copy link
Contributor Author

@muddlebee I don't believe you've gone through the KYC/KYB process yet. While waiting for further reviews, could you please complete either KYC verification (for individual check) or KYB verification (for legal entity check, if any). Thanks!

@keeganquigley I have completed my individual KYC. We don't have any legal entity as such.

@keeganquigley keeganquigley removed the admin-review This application requires a review from an admin. label Dec 3, 2024
@takahser takahser self-requested a review December 4, 2024 13:33
@takahser
Copy link
Collaborator

takahser commented Dec 4, 2024

I recently made a huge swap on Hydration and ended up paying high fees. A similar transaction on StellaSwap (Moonbeam) would have cost much less in fees. This highlights how a DEX aggregator can simplify the process by fetching the best rates across the ecosystem. :)

@muddlebee just out of curiosity—did you really pay over 28 DOT in fees for a swap on Hydration? That sounds unusually high. Do you know what caused it? I’ve never encountered trading fees anywhere near that level, and to my knowledge, their pools typically yield around ~0.3% APR, so I’m quite surprised.

In the meantime, I’ll be reviewing your proposal in detail and will provide additional feedback soon.

@muddlebee
Copy link
Contributor Author

muddlebee commented Dec 4, 2024

I recently made a huge swap on Hydration and ended up paying high fees. A similar transaction on StellaSwap (Moonbeam) would have cost much less in fees. This highlights how a DEX aggregator can simplify the process by fetching the best rates across the ecosystem. :)

@muddlebee just out of curiosity—did you really pay over 28 DOT in fees for a swap on Hydration? That sounds unusually high. Do you know what caused it? I’ve never encountered trading fees anywhere near that level, and to my knowledge, their pools typically yield around ~0.3% APR, so I’m quite surprised.

In the meantime, I’ll be reviewing your proposal in detail and will provide additional feedback soon.

ahh yes, little less than that actually. The screenshot is after I made the swap and realized where the rest of my DOTs went. The reason for high trading fees is due to

Dynamic Fees during Increased Volatility
Protocol fees are dynamic and adjusted based on the current market volatility. If prices in the Omnipool are volatile, each swap will incur higher Protocol fees
https://docs.hydration.net/products/trading/liquidity/impermanent_loss#dynamic-fees-during-increased-volatility

Copy link
Member

@semuelle semuelle left a comment

Choose a reason for hiding this comment

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

Hi @muddlebee. Sorry for the long wait. I asked our legal team for input, and they asked me to verify that you are not building a DEX yourself, but an aggregator. I can see that this is the case, but just to make sure, is this on your roadmap at all?

Otherwise happy to support!

@muddlebee
Copy link
Contributor Author

Hi @muddlebee. Sorry for the long wait. I asked our legal team for input, and they asked me to verify that you are not building a DEX yourself, but an aggregator. I can see that this is the case, but just to make sure, is this on your roadmap at all?

Otherwise happy to support!

Hi @semuelle. No worries, and thank you for following up! We are not building a DEX, nor is it on our roadmap. Our primary goal is to serve as a hub for parachain DEXes or a DEX aggregator.

@PieWol
Copy link
Member

PieWol commented Dec 5, 2024

Hey @muddlebee
thanks for your application.

Different from the similar projects in the ecosystem that you listed I saw Kheopswap which is not focussed on pooling assets themselves or being limited to a single chain. It's also open source and has been retroactively funded via OpenGov. Do you think that it would be possible for you to reuse a lot of it's code? To my understanding there is a lot of overlap in the features between your project and Kheopswap. Maybe this could both reduce your development work and the price of the grant.

Otherwise I'm fond of your idea and I would like to see it happening. Please let me know your thoughts here.

Best,
Piet

@muddlebee
Copy link
Contributor Author

muddlebee commented Dec 5, 2024

Hey @PieWol thank you for reviewing.

Kheopswap is a DEX only for Asset Hubs(Polkadot and Kusama) and my use case is a DEX aggregator to find optimal routes for asset swaps from any of the DEX'es like Asset Hub or Parachain DEX'es like hydration or moonbeam.

Do you think that it would be possible for you to reuse a lot of it's code? To my understanding there is a lot of overlap in the features between your project and Kheopswap.

for our DEX aggregator we will using the AssetConversion/Assets pallets exposed by the Asset Hub's runtime to get pool liquidity data, asset conversion which I believe must be used by Kheopswap as well. That's the only overlap I could think of.

keeganquigley
keeganquigley previously approved these changes Dec 9, 2024
@muddlebee
Copy link
Contributor Author

muddlebee commented Dec 16, 2024

I'm exploring an alternative plan to test the end-to-end functionalities using Chopsticks instead of creating live assets on Asset Hub and Hydration or handling cross-chain asset transfers (XCM). Chopsticks by Acala allows forking live networks and running simulations with developer accounts like Alice and Bob.

Initially, I was doubtful whether these tools could fully test all functionalities of our DEX Aggregator. However, after exploring the Asset Transfer API by Parity and Chopsticks, I found that they match some of our use cases. That said, this approach could have some limitations which we have not faced or explored yet, and they might affect our proposed milestones.

@semuelle semuelle self-requested a review December 18, 2024 14:03
Copy link
Collaborator

@takahser takahser left a comment

Choose a reason for hiding this comment

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

@muddlebee if you could add this feature, I'd be happy to support this proposal as well.

applications/swush-dex-aggregator.md Outdated Show resolved Hide resolved
@takahser takahser self-assigned this Dec 18, 2024
@muddlebee
Copy link
Contributor Author

@muddlebee if you could add this feature, I'd be happy to support this proposal as well.

working on it :) exploring the limitations currently so we don't miss out on milestone goals

@github-actions github-actions bot added the admin-review This application requires a review from an admin. label Dec 18, 2024
@keeganquigley keeganquigley removed the admin-review This application requires a review from an admin. label Dec 18, 2024
@muddlebee
Copy link
Contributor Author

muddlebee commented Dec 19, 2024

hey @keeganquigley we can use Chopsticks in addition to creating live assets on Asset Hub and Hydration as mentioned here

so I'm thinking how to include this in my current milestones. some concerns were raised for creation of live assets on the Polkadot Asset Hub, so is it okay to keep this in addition to chopsticks?

Copy link
Collaborator

@takahser takahser left a comment

Choose a reason for hiding this comment

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

@muddlebee thanks for your replies.

Regarding the Add Liquidity feature I changed my mind: I changed my mind.
Happy to support this as well. 💪

@keeganquigley
Copy link
Contributor

Thanks @muddlebee can you explain how it would change the milestones? I think the use of Chopsticks isn't an issue...

Copy link
Member

@semuelle semuelle left a comment

Choose a reason for hiding this comment

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

Happy to proceed.

@semuelle semuelle merged commit 87c577a into w3f:master Dec 19, 2024
8 of 9 checks passed
Copy link
Contributor

Congratulations and welcome to the Web3 Foundation Grants Program! Please refer to our Milestone Delivery repository for instructions on how to submit milestones and invoices, our FAQ for frequently asked questions and the support section on our website for more ways to find answers to your questions.

Before you start, take a moment to read through our announcement guidelines for all communications related to the grant or make them known to the right person in your organisation. In particular, please don't announce the grant publicly before at least the first milestone of your project has been approved. At that point or shortly before, you can get in touch with us at [email protected] and we'll be happy to collaborate on an announcement about the work you’re doing.

Also, if you haven't yet, consider signing up for the Polkadot Alpha Program. The program offers plenty of resources for people building on Polkadot. Lastly, please remember to let us know in case you run into any delays or deviate from the deliverables in your application. You can either leave a comment here or directly request to amend your application via PR. We wish you luck with your project! 🚀

@muddlebee
Copy link
Contributor Author

hey @keeganquigley
as per the proposed milestones 2 plan was to complete this using live assets, but I later found out its achievable with chopsticks as I mentioned above.

also I added a simulation testing env in Milestone 1. Here earlier plan was to create mock APIs from scratch and create a simulation test env, but this is also achievable with Chopsticks.
{25542513-BAD6-449B-9503-65636EDC9075}

So if creating live assets on AH and hydration is not an issue in Milestone 2, we can keep as it is and for the simulation testing env in Milestone 1, I can just use chopsticks?
Does this sound okay? or you have any better suggestions in mind? :)

@muddlebee
Copy link
Contributor Author

Thank you so much, team, for approving the proposal 🚀 and for your patience throughout the process. I’m really excited and ambitious about the DEX Aggregator, which could be further boosted by the full-fledged release of Plaza and the upcoming smart contracts support on Asset Hub.

A big thanks to @keeganquigley for helping shape the idea and brainstorming with me to bring this proposal together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review The project is ready to be reviewed by the committee members.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants