Dfyn’s liquidity node (AMM) and Router’s cross-chain bridge on Conflux Network

1) Funding Tier

Please specify the funding tier and total grant amount of your proposal.

Tier 2: Funding amount requested - $50K


2) Project Overview

Project title and description of the project.

Title: Dfyn’s liquidity node (AMM) and Router’s cross-chain bridge on Conflux Network

Description: We are building a suite of cross-chain liquidity infra primitives that aims to promote seamless liquidity movement between current and emerging Layer 1 and Layer 2 blockchain solutions. At first, we aim to establish Dfyn AMM nodes across multiple Layer 1 and Layer 2 blockchains. Having these nodes will allow Dfyn to plug into a liquidity super-mesh, enabling users to perform their asset trades seamlessly on several blockchains from a single interface. Further, by integrating Router’s cross-chain liquidity protocol, our vision is to transition to a truly cross-chain DEX. Router’s liquidity bridges across multiple Layer 1 and Layer 2 networks will allow Dfyn to aggregate liquidity across these networks. Aside from connecting blockchains and enabling a free flow of information, Router will also enable one-click token mapping in a trustless manner. This means that projects launching their token on any one chain will be able to use Router’s cross-chain liquidity protocol (XCLP) to map their token across all the chains connected by Router’s bridges.

How will this project be integrated into Conflux?

First, Dfyn’s existing AMM contracts (deployed on Polygon and OKExChain) will be modified to suit the Conflux blockchain. Once they are modified and properly tested on the Conflux testnet, an AMM node will be launched on the Conflux mainnet. Post this, a custom bridge contract will be coded for the Conflux chain. Since it is an EVM-compatible chain, we will be able to refactor some of the code from the Ethereum bridge contract. After rigorous testing and audits, we will launch a Router bridge between Ethereum, Polygon and Conflux (and also OKExChain, if that’s ready by that time). After the launch of the bridge, we will be able to attract a large amount of liquidity on the Conflux blockchain. To further incentivize liquidity migration to Conflux, we will be launching a highly rewarding farming ecosystem on Dfyn’s Conflux node.

Why is your team interested in creating this project?

The crypto industry was built on a fundamental premise; the fragmentation and limitations endemic to traditional finance needed to be replaced with a better, more robust system with user needs at the heart of it. Unfortunately, even the crypto market is littered with fragmented liquidity pools and creating the infrastructure that bridges the gap between them is becoming increasingly important. With over 5,000 different cryptocurrencies on the market encapsulating over a trillion dollars in value, there has never been a more pressing need for porting liquidity across them. At Dfyn, we want to solve this problem of widely fragmented liquidity by building multiple Dfyn nodes spread across Layer 1 and Layer 2 blockchains and connected through Router’s cross-chain liquidity protocol (XCLP). To do this, we need to deploy Dfyn nodes and Router bridges on all the major chains, Conflux being one of them.


3) Project Details

High-level technical approach, product flow & architecture (along with a diagram).

Architecture

  • Dfyn nodes - Liquidity nodes present across multiple Layer 1 and Layer 2 blockchains acting as AMMs.
  • A network of bridges - Router’s cross-chain liquidity protocol (XCLP) forms a network of bridges between isolated Dfyn nodes present on different blockchains. This concept can be better understood with the help of the following analogy: Dfyn nodes can be thought of as far-flung cities and Router as the highway that connects this city, thereby facilitating free movement of vehicles (in this case, assets) from any one city to the other.
  • ParaRouter - Every chain that has a Dfyn node on top of it will have a bridge contract known as ParaRouter deployed on it. In case of cross-chain asset transfers, the ParaRouter is able to lock a stablecoin and broadcast an event that can be picked up by the listener associated with Central Route to take action.
  • Central Router - It is the hub that listens to the event on ParaRouters, validates them, and forwards the event for further processing to the destination chain.

Working of Router’s XCLP

Router will build a cross-chain liquidity mesh which allows transportation of liquidity from one chain to another with stablecoin as the medium of value transfer.

When users submit their asset on the source chain, they are converted to stablecoins and locked in the source chain’s bridge contract, known as ParaRouter. The conversion to stablecoins takes place using an AMM contract on the source chain that offers the best price. If the user-submitted asset is a stablecoin itself, the asset is directly locked in the bridge contract. Following this, the ParaRouter reserve on the source chain emits an event to be received by the event listener function. Upon receiving the event, this function parses the event into a general bridge message, including the number of tokens to be transferred, the recipient wallet address, and the destination chain’s ID. This bridge message is relayed to the Central Router, where it is verified by validators. On successful verification, the message is sent to the writer function, which converts the message to a valid transaction and submits it on the target blockchain. Once this transaction is submitted, the target chain’s ParaRouter unlocks the proportionate number of stablecoins and credits it to the user’s wallet. In case the user-requested asset is not a stablecoin, the ParaRouter converts the stablecoins to the user-requested asset using AMM contracts on the target chain and sends it to the user’s wallet.

How do we ensure that the Destination Reserve has enough liquidity of stablecoins?

In order to attract liquidity, Router Protocol encourages farmers to stake stablecoins on various ParaRouters. For example, every USDC that’s locked in the ParaRouter, the user will given RUSDC, a representation or a proof, akin to LP Token, that can be used in other DeFi protocols, such as Dfyn Exchange, where yield could be earned for providing liquidity on RUSDC/USDC pool.

The Dfyn Advantage

Dfyn.network is a fully decentralized multi-chain protocol which relies on automated market makers (AMMs) instead of order books to enable token swaps. On low-gas networks like Polygon, Dfyn eliminates gas fees altogether by integrating meta transactions. Currently available on Polygon and OKExChain, Dfyn will eventually deploy AMM nodes on multiple layer 1 and layer 2 blockchains. These nodes will allow Router to carry out cross-chain transfers in case the liquidity reserve in any of the ParaRouters gets exhausted.

Suppose, in a cross-chain transfer, the target chain’s ParaRouter does not have sufficient liquidity to fulfill the transaction itself. In that case, the ParaRouter will mint RSTABLE tokens (for example: RUSDC, RUSDT, etc.) and swap them for the user-requested asset on the Dfyn AMM. The swapped asset is then transferred to the user’s target chain wallet.

Any mockup designs of user facing components.

  1. Router Testnet (live here)
  • Dashboard

  • Swap Page

  • Liquidity Mining Page


  1. Dfyn Exchange (live here)


  1. Dfyn Farms

Overview of the technology stack being used, including API specifications, and documentation of core components.

Tech Stack used: ReactJS for front end, Solidity for AMM contracts and bridge contracts, NodeJS for pathfinder algorithm (to find the best price), Rust for writing the Central Router (to connect the bridge contracts)

Smart contracts to be deployed on Conflux blockchain:

  • ParaRouter (bridge) contract
  • AMM Factory Contract
  • AMM Router Contract
  • Prediction Market Contract
  • Farming Ecosystem Contracts

All the deployed contract addresses for Dfyn’s Polygon node can be found here: https://docs.dfyn.network/technical/contracts.

Dfyn’s Graph API node for Polygon analytics can be found here: https://thegraph.com/legacy-explorer/subgraph/ss-sonic/dfyn-v5.

Ecosystem fit: How can the project benefit Conflux Network’s ecosystem?

The integration of Dfyn’s AMM node and Router’s XCLP with Conflux will allow users operating on Conflux to be able to trade as they please without worrying about the amount of the liquidity that the network holds — thanks to the cross chain smart-order routing primitives that Router Protocol offers. Other benefits to the Conflux ecosystem will include:

  1. launch of an AMM-based DEX on Conflux
  2. increased liquidity on the network via liquidity mining events on Dfyn Exchange, where liquidity providers are rewarded for adding liquidity to the AMM
  3. mapping of new projects to the Conflux ecosystem via Router’s cross-chain bridge

Dfyn has already demonstrated its utility and effectiveness since the Dfyn AMM node deployed currently on the Polygon network is home to over $250 million in liquidity and is processing over 60,000 transactions on a daily basis. Our activity on Polygon has also resulted in the on-boarding and mapping of at least 30 new projects on the Polygon chain.


4) Team

  • Ramani Ramachandran (CEO & Co-founder)

MIT, Deloitte, Moody’s, Schlumberger; In Crypto since 2014, built and ran Asia’s earliest crypto fund, returned 4x; Built Fordex - the world’s first stablecoin DEX; Qume, an institutional grade crypto exchange; Launched Asia’s first crypto-index token

Email: [email protected]

LinkedIn: /in/ramaniram/

Twitter: @CrypoMan_Ram

  • Shubham Singh (CTO & Co-founder)

Full-stack Developer and Technical Architect building in crypto and blockchain since 2016; Built a crypto-index (108token) as well as Fordex - the world’s first stablecoin DEX

Email: [email protected]

LinkedIn: /in/dev-shubham

Github: ss-sonic

  • Chandan Choudhury (Co-founder)

Head of Strategy at Bitpolo, leading Indian crypto exchange; Veteran trader and advisor across asset classes spanning over 15 years. Energy trader at Futures first; Managed crypto fund, generating 4x returns; Head of Ops & Market Research at Tradelab

Email: [email protected]

LinkedIn: /in/chandan-choudhury-3b748a23/

Twitter: @cchoudury

  • Monica Durga (Chief Solutions Architect & Co-founder)

Full-stack Developer and Technical Architect building in crypto /blockchain since 2016; Built 108token (Asia’s first crypto index token) and Fordex, the world’s first stablecoin DEX with 0x grant; Worked on matching engine for crypto derivatives platform

Email: [email protected]

LinkedIn: /in/Monica-durga/

Github: sudomon

  • Priyeshu Garg (Co-founder)

Engineer/Growth hacker/Product Manager; Technical Advisor @ Umbrella Network; Software Engineer @ Ola; Journalist @ Cryptoslate & @ 8BTC

Email: [email protected]

LinkedIn: /in/priyeshu/

Twitter: @priyeshugarg

Provide the name and registered address of the legal entity that will be delivering the project

Name: Kailaasa Infotech Pte. Ltd

Registered Address: 160, Singapore Business Federation Center, Robinson Road, Singapore, 068914

Team’s Github code repositories.


5) Development Roadmap

In bold → Milestones
T0 denotes the start of the development

Task

Deliverable Team member(s) involved Estimated Completion Time

1. Planning the architecture of our AMM and bridge contracts to suit the Conflux ecosystem. The goal of this step is to simplify the development process.

A clear architecture depicting the business logic of the smart contracts and mapping out a path for developers to follow during the coding process.

Shubham Singh and Shashvat Mohane

(Blockchain Engineer at Dfyn)

T0 + 5
2. AMM contracts will be modified and compiled. AMM contracts that have been properly compiled (Note: at this point, the contracts will not be tested). Shubham Singh and Shashvat Mohane T0 + 9

3. Adding test cases to the AMM contracts and performing rigorous manual testing.

Working smart contracts free from major bugs and issues, ready to be deployed on the testnet. Shubham Singh and Shashvat Mohane T0 + 12
4. Revamping the UI to support the new AMM contracts. An attractive entry point to the whole project. Mayank Rawat (UI/Graphic Designer at Dfyn) T0 + 13
5. Deploying the AMM contracts on Conflux testnet. A working version of Dfyn AMM on Conflux testnet. Shubham Singh T0 + 14
6. Building analytics and deploying a Graph node. If Graph doesn’t support Conflux, we might have to build our own indexing server for this. A decentralized indexing protocol for organizing Dfyn’s data on Conflux. Shubham Singh and Shashvat Mohane T0 + 18
7. Recording all the transactions while testing on test-net, analyzing results of all transactions with actual business logic of smart contracts. Stats detailing the reception of the testnet by the community, points to address, analytics etc. Shashvat Mohane T0 + 21
8. Unit testing and bug fixes. Finalized AMM contracts, ready for deployment on the mainnet. Shubham Singh and Shashvat Mohane T0 + 27
9. Deployment of AMM contracts on mainnet. An active Dfyn node on the Conflux blockchain. Shubham Singh T0 + 28
10. Starting the integration of Dfyn node on Conflux with Router’s existing infrastructure. A testnet bridge contract deployed on Conflux testnet. Monica Durga and Siva Ganesh (Senior Blockchain Engineer at Dfyn) T0 + 35
11. Integrating the bridge contract with the testnet UI. Updated UI to test cross-chain transfers between Kovan, Polygon testnet and Conflux testnet. Mayank Rawat T0 + 40
12. Adding swap functionality to the bridge contract. Updated testnet bridge contracts supporting swaps between Kovan, Polygon testnet and Conflux testnet. Monica Durga, Siva Ganesh T0 + 49
13. Performing rigorous manual testing and optimizing the smart contracts. Optimized smart contracts free from major bugs. Monica Durga and Siva Ganesh, Shashvat Mohane T0 + 56
14. Building Router analytics. An analytics engine to monitor on-chain stats. Siva Ganesh and Mayank Rawat T0 + 60
15. Unit testing, bug fixes & Smart contract audit by a third party. Finalized bridge contract, ready for deployment on the Conflux mainnet. Monica Durga and Siva Ganesh T0 + 60
16. Deployment of bridge contract on mainnet. Router bridge contract deployed on Conflux mainnet, supporting cross-chain swaps and transfers between Conflux and other blockchains. Monica Durga and Siva Ganesh T0 + 63
17. Refactoring Polygon farm contracts and deploying them on the Conflux blockchain. A vibrant yield farming ecosystem on Conflux mainnet. Shubham Singh and Shashvat Mohane T0 + 77

Specification of the software or deliverable (will be used to confirm milestones have been reached

  • Deliverable from Milestone 1: Dfyn AMM node on top of Conflux Testnet

In the first phase of the project, we will be making changes in the existing AMM contracts to make it compatible with Conflux testnet. At the end of this phase, we intend to have a functional Dfyn DEX on top of Conflux testnet.

ETA: 2 weeks from the start of the project

  • Deliverable from Milestone 2: Dfyn AMM node on top of Conflux Mainnet

After the first phase of the project, we will be recording all the transactions while testing on test-net and analysing results of all transactions. Furthermore, the smart contracts will go through unit testing and an indexing server (a Graph node) will also be deployed. At the end of this second phase, Dfyn AMM contracts will be deployed on the Conflux Mainnet.

ETA: 2 weeks from the attainment of the first milestone

  • Deliverable from Milestone 3: Router’s bridge contract on Conflux testnet

The third phase of the project will involve deploying a bridge contract on Conflux testnet that will allow transfers between Kovan, Polygon testnet and Conflux testnet.

ETA: 1 week from the attainment of the second milestone

  • Deliverable from Milestone 4: Swap functionality in the Router testnet

This phase will involve the integration of the Dfyn node on Conflux with Router’s bridge contract. At the end of this phase, users will be able to swap assets on Polygon testnet and Kovan directly from Conflux’s testnet.

ETA: 2 weeks from the attainment of the third milestone

  • Deliverable from Milestone 5: Router’s cross-chain bridge on Conflux mainnet

The fifth phase of the project will involve testing the bridge contract, getting it audited and then finally deploying it on Conflux mainnet. The deployment of the Router bridge on Conflux mainnet will enable the movement of liquidity from Ethereum and Polygon to Conflux.

ETA: 2 weeks from the attainment of the fourth milestone

  • Deliverable from Milestone 6: A vibrant yield farming ecosystem on Dfyn AMM

To increase TVL and boost community engagement, Dfyn will be launching a number of highly rewarding farms on the Conflux mainnet.

ETA: 2 weeks from the attainment of the fifth milestone

Requested funding, number of full time employees on each milestone, and the cost involved in each milestone day.

Profile Cost/day
Senior Blockchain Engineer $400
Junior Blockchain Engineer $250
Front-end Engineer $250
  • Milestone 1

Number of full time employees: 1 Senior Blockchain Engineer for 10 days, 1 Junior Blockchain Engineer for 6 days, 1 Front-end Engineer for 2 days

Cost Involved: $6000

  • Milestone 2

Number of full time employees: 1 Senior Blockchain Engineer for 8 days, 1 Junior Blockchain Engineer for 10 days

Cost Involved: $5700

  • Milestone 3

Number of full time employees: 2 Senior Blockchain Engineers for 5 days

Cost Involved: $4000

  • Milestone 4

Number of full time employees: 2 Senior Blockchain Engineers for 10 days, 1 Front-end Engineer for 4 days,

Cost Involved: $9000

  • Milestone 5

Number of full time employees: 2 Senior Blockchain Engineers for 10 days, 1 Junior Blockchain Engineer for 6 days, 1 Front-end Engineer for 4 days

Cost Involved: $10,500 + approx. $8,000 (Smart Contract Audit Cost)

  • Milestone 6

Number of full time employees: 1 Senior Blockchain Engineer for 10 days, 1 Junior Blockchain Engineer for 10 days

Cost Involved: $6500

Reporting Obligations

To facilitate transparency, our team will provide brief progress reports for the work done at the completion of each milestone. To ensure a smooth collaborative experience, a telegram/discord channel will be set up for integrations and project discussion.

Total estimated duration and cost of the whole project.

Estimated Duration: 10-12 weeks

Estimated Cost: $41,700 + Audit Costs (approx. $8,000) = $49,700


6) Long Term Vision

What is the team’s long term vision for the project?

At Dfyn, we are committed to establishing a multi-blockchain ecosystem empowered by a completely secure, seamless and scalable cross-chain liquidity protocol coupled with an ultra-fast multi-chain DEX. Our long term vision is to build a thriving multi-chain ecosystem, that a) allows for a range of use cases that leverage and extend the composability of DeFi across various blockchains, b) promotes liquidity migration and developer efforts towards various emerging chains and solutions, and c) on-boards the next wave of crypto users.


7) Other

Please include any further information or attachments that are relevant to your application.

Dfyn Resources

Router Resources

7 Likes

Thank you @Dfyn for sharing your proposal. We’ll have the committee look it over.

2 Likes

This is a great proposal. It’s a beautiful template that all other global projects could follow.

I look forward to the development of Dfyn on Conflux. Moreover, I look to see a flourish Indian Community from the Dfyn team!

All the best to the Dfyn Team

5 Likes

Awesome comprehensive post! Really love the multi-chain approach. Looks like you covered most everything and we’ll discuss and get back to you with questions. Thank you!!

2 Likes

Yes! Finally we’re getting closer to multi-chain LPs, and the router protocol serves this purpose!
As Conflux Network fully supports the multi-chain future, I’m certain that a long-term partnership will be mutually beneficial!

As the security of assets will be of high priority for users, I’d like to ask whether you can share existing audit reports for both Dfyn and the Router Protocol with the community.

Looking forward to Dfyn launching on Conflux!

2 Likes

Welcome to the Conflux community Dfyn! This is a great proposal, and very well structured. I think Dfyn’s multi chain DEX and Router’s bridge protocol would be great additions to the Conflux ecosystem!

Does the Router bridge also support the transfer of arbitrary messages across supported chains?

3 Likes

Thanks for your question @Oneofall! We take the security of our products very seriously. Router Protocol has already been audited by Certik, and is currently being audited by Halborn as we speak. We haven’t made the audit reports live as Router isn’t live on mainnet yet. We are still resolving some issues pointed out in the report. Once we resolve those issues, we will get the code audited again and go live with both the mainnet and the audit report.
As far as Dfyn is concerned, since Dfyn is a clean fork of Uniswap, Dfyn’s contracts haven’t been separately audited. However, all the Dfyn contracts on Polygon are verified. DfynV2Factory contract can be found here and the DfynV2Router Contract can be found here. Also, we are going to be launching a new version of Dfyn soon which will be coded from the ground up. Those contracts will definitely be audited.

Hey @Geoff, thanks! To answer your question - yes. Router’s bridges will support the flow of contract level data across chains.

4 Likes

This is awesome. A data bridge has been on our bucket list for quite some time!

A question, is Router Protocol considered trustless?

edit can you explain more deeply what does make it trustless

1 Like

Thanks, that’s great to hear! Some follow up questions:

  1. Is token listing on Dfyn permissionless? Or if not, how does that process work?
  2. Is the Router cross-chain bridge open-sourced?
1 Like

It seems like all “reputable” cross-chain products have been hacked in the recent month, from Anyswap to O3Swap and Poly Network. Which security measurements does Router Protocol have so that the existing exploits cannot be replicated?

2 Likes

Thanks for your questions @Grants_Committee.

  1. Yes, token listing on Dfyn is permissionless.
  2. The Router codebase isn’t open right now. Only the team and auditors have access to our code. We believe in facilitating open source development, so we’ll eventually make the code open source. The timeline around that hasn’t been decided that, but the general idea is to open the code after we launch and gain some traction.
3 Likes

Thanks @SmoothCB :grinning:!

To answer your question, the trustless nature of the bridge eventually rests on the number of validator nodes that are involved in the bridge. In the current iteration, for security reasons, we have a PoS setup where only users with only a very large amount of $ROUTE staked on the bridge can take part in the validation process. As we move forward and relax the conditions for becoming a validator which will lead to the addition of more validator nodes, we will achieve complete decentralization. Besides, we are also ideating a more robust validation mechanism involving new approaches like MPC, therefore Router’s XCLP will eventually be considered trustless.

To answer the second part of your question, let us consider the token mapping process that can be carried out via our bridge:

Whenever a certain token is to be mapped on chains where it does not already exist, the token creator can submit the request for the same to Router. In what would be an instant process, Router’s XCLP will map the token across all the alternate chains which are part of its super-mesh. After that, the authority to burn and mint tokens across all the chains will rest with the bridge contracts that can interact with each other, and not with any human entity. This will preserve the integrity and trustless nature of the system.

Hope that answers your questions. Please feel free to ask any follow-up questions :grin:!

1 Like

Very good point @Christian!

To ensure that Router is free from any security vulnerabilities, we are getting the code audited by not just one but two of the most dependable audit firms in the space, Certik and Halborn. Our Certik audit is done and we are making changes in our code as suggested by them.

We are also live with our ImmuneFi bug bounty program, which incentivizes a whole community of whitehat hackers to find security vulnerabilities in our code base. The program has yielded some great suggestions which we are also incorporating.

We have also hired highly experienced security advisors that are helping us to make the code free from all possible attack vectors. Post making these changes, our code will again be audited by Halborn.

Finally, we will also use a phased roll out plan which will reduce the risks of bridge failures and will make it easier for our team to fix the issues, if any.

Even though putting these security measures in place has delayed our launch by more than a month, we believe that users’ security is of the utmost importance and we don’t want to take any chances whatsoever. We will only launch the product when we are absolutely certain that there are no vulnerabilities in our code that can be exploited.

4 Likes

Thanks for the detailed response!

On your first point Conflux was actually born out of the lab or Dr. Andrew Yao who received the Turing award in 2000 for MPC related research like ‘Yao’s Millionaires Problem’.

I’m sure that we can all theorize together on best trustless approaches!

3 Likes

Thanks for the Reply! Great to hear that you guys have a lot ongoing to ensure high security of user’s assets!

1 Like

Great project and i love crosschain applications. Im glad your taking security seriously with all the breaches weve had in the past few months on other blockchains.

1 Like

Congratulations @Dfyn! Dfyn’s grant application has been approved by the Global Grants Committee!

For reference, below are the voting results:

2 Likes

Thanks @Grants_Committee for the trust and support shown!

2 Likes

How is this project going?