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

PrivaDEX MVP: Grant Application for a cross-chain DEX aggregator #1398

Merged
merged 2 commits into from
Dec 29, 2022
Merged

PrivaDEX MVP: Grant Application for a cross-chain DEX aggregator #1398

merged 2 commits into from
Dec 29, 2022

Conversation

kapilsinha
Copy link
Contributor

@kapilsinha kapilsinha commented Dec 23, 2022

Project Abstract

Our team is building PrivaDEX, a cross-chain DEX aggregator that enables cross-chain trading and unifies Polkadot's fragmented DeFi ecosystem. We request 55,000 USDT to finish developing our MVP and launch it in Q1 2023.

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.
  • A BTC, Ethereum (USDC/DAI) or Polkadot/Kusama (aUSD/USDT) address for the payment of the milestones is provided in the application.
  • 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)

@CLAassistant
Copy link

CLAassistant commented Dec 23, 2022

CLA assistant check
All committers have signed the CLA.

@kapilsinha kapilsinha changed the title Add grant proposal for PrivaDEX's cross-chain DEX aggregator MVP PrivaDEX MVP: Grant Application for a cross-chain DEX aggregator Dec 24, 2022
Copy link
Collaborator

@Noc2 Noc2 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 grant application. First of all, you can always apply for a grant for more than 30k. In this case, it’s simply a level 3 grant and requires two additional approvals. Could you update the level in your grant application accordingly? Apart from this, why do you focus on Phala Network and Phat Contracts for this specific implementation? Something to be aware of is that we usually don’t want to support a specific parachain, but rather try to be as objective as possible. Additionally, we are not the best team when it comes to evaluating these Phat Contracts. Have you already talked to Phala directly about it? That said, we would definitely still be interested in supporting the milestones that don’t contain the phat contracts since the open-source code is probably useful for other aggregators as well (milestones 1 and 2).

@Noc2 Noc2 self-assigned this Dec 26, 2022
@Noc2 Noc2 added the changes requested The team needs to clarify a few things first. label Dec 26, 2022
@kapilsinha
Copy link
Contributor Author

kapilsinha commented Dec 27, 2022

@Noc2 Thanks for the feedback - updated! I have bumped the level from 2 to 3. I haven't squashed commits yet to be able to easily track changes to the proposal for now.
Regarding your questions on Phat Contract, I have added an "FAQs on Phat Contract" section under Milestone 3. I've pasted it at the bottom of this message for convenience.

I think evaluating the Phat Contract code will actually be relatively straightforward since each component can be tested in isolation. In my opinion, a lot of the components in this project that will be useful for other teams/projects reside in milestone 3. There currently are few examples of raw interfacing with XCM, extrinsics, etc. from a lightweight computing environment (i.e. ruling out blockchain runtimes and subxt-like libraries that generate large artifacts); this DEX aggregator provides exactly those in the executor module. Milestone 4 brings the MVP to completion, which directly brings value to Polkadot. Thus I would love to have milestones 3-4 included in the proposal, but if you still have any concerns please let me know!

FAQs on Phat Contract

What is Phat Contract?

  • Phat Contract is a decentralized off-chain computation framework developed by Phala Network. Note that there is zero connection between Phat Contract and the Phala blockchain, as this framework is entirely off-chain.

Why use Phat Contract?

  • Phat Contract allows us to securely store our protocol's keys (both wallet secret keys and off-chain storage API keys) in the contract (via the Trusted Execution Environment). As a result, we can submit transactions/extrinsics from a decentralized and transparent computing environment instead of a centralized service.

How can we evaluate Phat Contract?

  • We will place all business logic in separate modules, and create a thin Phat Contract wrapper that ties the components together. That means that every logical component can be run from a standard computer because it will be normal Rust code (similar to Substrate blockchain code). In fact, one can even perform an end-to-end test (that moves and swaps real tokens) from a local environment since secret keys can be kept locally.

Copy link
Collaborator

@Noc2 Noc2 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 detailed reply. I think it also makes sense to support the phat contract part, and I’m generally happy to go ahead with it and mark it as ready for review. But I have one additional question: Have you already looked into front running and other potential ways to attack your solution? We are aware that with XCM comes front-running, and I think it’s better to make these things transparent for everyone immediately, which is why we have an interest in supporting any kind of research in this area.

@Noc2 Noc2 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 Dec 28, 2022
Copy link
Contributor

@alxs alxs left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the detailed proposal.

@kapilsinha
Copy link
Contributor Author

Have you already looked into front running and other potential ways to attack your solution?
Great point, I have given this some thought but as you mentioned I’m sure this will be a point of research on both coming up with attacks and defending against them.

  1. After the MVP, I plan to perform some of the cross chain steps in parallel instead of purely serially by holding some funds in the escrow wallet. For example, if we plan to send DOT to Moonbeam and then swap xcDOT for GLMR, we don’t have to wait for the XCM transfer if we hold that quantity of xcDOT on Moonbeam. If we hold the 98th percentile trade size amount of the most commonly bridged tokens, we can speed up the cross chain swaps and give less time for front runners.
  2. Since users submit their trades to Phat Contract anonymously, a third party can track on chain fund transfers but cannot know what the resulting trades will be. For example, Bob knows that Alice sent 100 DOT to the escrow and thus will perform some trade. But he does not know she plans to swap it for GLMR on Moonbeam until the protocol begins to execute those transactions

Copy link

@BenWhiteJam BenWhiteJam left a comment

Choose a reason for hiding this comment

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

Excellent, great cross-chain idea! Please keep on providing updates

@Noc2 Noc2 merged commit 9fc315d into w3f:master Dec 29, 2022
@github-actions
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 of our README 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.

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! 🚀

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.

7 participants