Acala x Compound Chain - Gateway to Polkadot

tl;dr: Acala wants to build a Starport on Acala as a gateway into the Polkadot ecosystem. The purpose of this post is to share our proposal and receive feedback from the community.

Introduction

Acala pioneered the idea and implementation of a full-stack (Substrate + EVM) specialized blockchain focusing on decentralized finance (DeFi), and created multiple DeFi primitives that became a DeFi hub and infrastructure serving the Polkadot and Kusama ecosystem: multi-collateralized stablecoin using DOT and cross-chain assets like BTC, integrated liquidation process using Off-chain workers and a hybrid of built-in AMM and auctions, tokenized staked assets e.g. Liquid DOT (LDOT), and bring-your-own-gas where fees are payable in any supported assets like stablecoins.

Polkadot is a layer-0 protocol that merely provides shared PoS security and cross-chain communication for its connected parachains. Other chain-specific and application-specific logic, such as EVM and smart contracts, are implemented on parachains. Acala’s parachain plays the role of DeFi hub and a landing pad that aggregates assets and liquidity from a variety of blockchains.

Acala is a firm believer and a long-term builder for the multi-chain future - reducing liquidity fragmentation, increasing composability and DeFi accessibility to everyone, and sharing the same vision as the Compound Chain/Gateway. The Acala team has been building on and contributing to the Substrate code-base for 2+ years, and therefore would like to contribute to Compound Chain’s effort by deploying Acala Starport as a gateway into the Polkadot ecosystem, making such Starport implementation also available to all Polkadot parachains, and providing tooling to read events from and to both chains.

Proposal

Acala would like to propose the following:

#1 Deploy Acala Starport as the gateway into the Polkadot Ecosystem

Acala will deploy Starport as a Substrate pallet, whereby all assets are downloadable to the Starport will be available to all DeFi protocols available on Acala, in the Acala EVM useable by smart contracts, cross-chain capable with Polkadot and its parachains, and later available in Ink!. Acala will also contribute to extend and make the events and offchain workers more generic for varied blockchains.

We will integrate the Polkadot{js} extension which is the predominant signer/wallet for the Polkadot Ecosystem to the Compound Cash Dashboard. We will also integrate the Compound-Acala service into the Acala DApp and/or the mobile app via Polkawallet.

All of the Acala Starport code would be generic enough to be adopted by any parachains and Substrate-based chains for that matter, with a goal to accelerate the innovation for bridging more cross-chain assets together.

#2 New collateral asset: DOT

We’d like to propose DOT as a new collateral asset on Compound Chain. DOT can be trustlessly transferred between Polkadot Relay Chain and the Acala parachain via Cross-chain Message Passing (XCMP). Polkadot Relay chain keeps the DOT balances of each parachain, and the balances are updated when a transfer happens between the Relay chain and a parachain, as well as between parachains, all trustlessly. Since Polkadot Relay chain does not host any logic (smart contracts or pallets) other than those essential to a Relay chain, namely PoS consensus and cross-chain communication, DOT uploaded to Compound Chain will have to be done on a parachain. Shared Protected Runtime Execution Enclaves (SPREE), which is on Polkadot’s roadmap (later the year), will add another level of security guarantee to this.

Acala’s source code has been audited and any new features will also be audited before launching on mainnet. Acala’s governance is managed on-chain for both voting and execution. We employ delayed execution for runtime upgrades and parameter changes on-chain. Monitoring can be easily set up to alert any suspicious behaviors as another added layer of protection for DOT integrity.

#3 New collateral asset: Liquid DOT (LDOT)

In addition to DOT, we’d like to propose another native asset as collateral on Compound Chain - Liquid DOT (LDOT). LDOT ****is the tokenized staked DOT (similar to DAI-and-cDAI) bearing Polkadot’s staking yield. Polkadot’s economy has a targeted staking ratio of 50%, parachain bonding of about 30%, and the remainder is liquid. With an average staking yield of 20% APY, DOT is relatively expensive to be used directly in DeFi. And one also would not want to sacrifice network security for yield farming.

Therefore Acala created the Liquid Staking protocol that allows users to trustlessly stake DOT, and use the tokenized staked DOT, LDOT, in trading, borrowing, lending and other DeFi activities. We believe with its trustless and yield-bearing nature, LDOT would be a quality and popular addition to the Compound Chain collateral set.

#4 Download CASH and a potential fee token

Once CASH is downloaded to the Acala Starport pallet, it would immediately be plugged into Acala’s DeFi protocols, e.g. listed in AMM DeX, and also be cross-chain capable via cross-chain consensus (XCM) to the Polkadot Relay Chain and other connected parachains. Acala will also make CASH available as a pre-compiled ERC20 contract readily composable in the EVM.

Beyond that, we also propose to make CASH a native fee token on Acala. With pooled peer-blockchain-assets-to-protocol liquidity, the interest-bearing CASH can be expected to be a popular asset that users would hold and use to pay for things. It’s a great usability booster for CASH users to transact on Acala without the need to hold Acala/Polkadot native assets.

Motivation

Polkadot is a layer-0 blockchain scalability solution that provides network security as a service (“shared security”) and trustless cross-chain communication as a service to all parachains connected to it. Each parachain can be customized and optimized for its domain (i.e. Acala is optimized for DeFi), and many DApps (in the form of Substrate pallet or smart contract or both) can be deployed on each parachain.

Acala aims to democratize finance and make DeFi more accessible to everyone with a full-stack chain to DApp approach to delivering the user experience that would not otherwise possible. Acala’s suite of DeFi products has gained significant traction through its slick DApp design and native mobile experience via Polkawallet (a founding member of Acala, Polkawallet has 45,000+ installs and a recognized tool by Polkadot). Acala’s live testnet (TC5) has 50,000+ new accounts, and 780,000+ signed extrinsics (See Subscan) with a large and ever-growing community. Acala has completed three security audits from Trail of Bits, SRLabs and Slow Mist. As soon as parachain slots become available on Polkadot, Acala is ready to launch mainnet.

Compound is one of the most respected and established protocols in DeFi, serving many users and as a DeFi primitive to many other protocols on Ethereum. Compound Chain is a significant step towards serving a much wider audience by bridging together digital assets from a variety of blockchains. Therefore it is beneficial to all three ecosystems for us to bring Compound’s service to the wider Polkadot ecosystem through Acala’s parachain.

The Acala team is one of the earliest Substrate Builders, members of the team (e.g. @xlc) are also top contributors (outside of Parity) to the Substrate code-base. Not only would we deliver high-quality code and products, we will also make the code generic enough to be applicable for all parachains and Substrate-based chains for that matter. We have done this before - we are the creator of the open-runtime-module-library - a community repo that includes a set of common-good pallets to accelerate application development on Substrate. We have also pioneered XCM implementation for fungible tokens which has been adopted by many parachains testing on Rococo (Polkadot’s parachain testnet).

We can’t wait to make this happen!

Development Plan

Milestone #1 Starport pallet

  • Support lock to upload asset
  • Support execTrxRequest to execute transaction request on Compound Chain
  • Support invoke to execute notices from Compound Chain
  • Necessary Governance features

Milestone #2 Offchain Worker & Message Passing

  • Develop Substrate RPC client for Offchain Worker
    • Support subscript events to fetch and decode events from a Substrate full node
  • Basic XCM asset handling in Compound Chain

Milestone #3 Integration & Oracle

  • End-to-end integration
  • Add LDOT and DOT price feed to the Open Price Feed

Milestone #4 Dapps

  • Launch Compound-Acala service in Acala web and/or mobile DApps
  • Acala Starport information will be readily queryable

Effort Estimation

Total effort: 25 weeks (1 FTE)

  • Milestone #1: 8 weeks (1 FTE Engineer)
  • Milestone #2: 12 weeks (1 FTE Engineer)
  • Milestone #3: 6 weeks (1 FTE Engineer)
  • Milestone #4: 6 weeks (1 FTE)
    • 1-2 week FTE Designer
    • 4-55 week FTE Full-stack Engineer
  • 5 weeks FTE Product Manager

Delivery estimate: ~3 months as M1, part of M2 and M4 can be developed concurrently. If we put 2 FTE Engineers on the project, then delivery can be shortened to ~2 months.

Rough bare cost: USD$111k~

Conclusion

The Acala team firmly believes that this contribution will be beneficial to Compound Chain, Acala and Polkadot ecosystem creating a win-win-win situation with a more evolved and cheaper money market service, more collateral asset variety, and much wider user adoption across multiple blockchains. We may request small amount of grant from the Compound treasury and Web3 Foundation to partially fund the initiative, but in principle, we are keen to carry out the plan regardless.

We hope to hear your thoughts, feedback and suggestions in the thread below.

https://acala.network/

https://github.com/AcalaNetwork

Regards

Bette & Bryan @Acala

20 Likes

I think this is really exciting and would love to see Acala supported to start building the Polkadot Starport to Gateway. Also, I would like to welcome Bette, Bryan, and the rest of Acala to the Compound community, I believe they will prove to be major assets to us.

Their team has a great deal of experience and expertise in Substrate, and are very forward thinking. I can tell by the details of the proposal how much thought they have put in to understand the Gateway system and integrate with it in a really high quality way. I also applaud them for putting forth the first real Starport proposal to the community, as a really positive way to introduce themselves and start discussing the idea.

I think there is probably some overlapping discussion to be had with the Compound Grants Program, which makes this especially relevant as that proposal is up for a vote now. I would love to see @sukernik or other committee members chime in with thoughts or feedback on how to approach this!

7 Likes

While I am cautiously optimistic the grants program will pass I’ll hold out commenting on that aspect until the voting has closed.

Gauntlet has been in talks with the Acala team for quite some time. We have been impressed with their rate of development. The Acala team and Compound community seem to have similar goals on governance, risk, and development. This is a great proposal and I look forward to hearing feedback from other community members.

2 Likes

While I am cautiously optimistic the grants program will pass I’ll hold out commenting on that aspect until the voting has closed.

A little confused by this, wouldn’t it be good for voters to understand how the committee would approach it?

1 Like

My comment was not to skirt discussion about process. I did not want to assume CP040 would pass and side track a project Acala sounds like they will proceed with regardless. The initial and subsequent posts by @sukernik in Compound Grants Program lay out our planned process so far. This will surely evolve. For a proposal with as large of scope as this one I would be tapping dev/data science on the Gauntlet team to weigh in. Maybe M1-M4 warrant separate grants, revision, or removal of certain aspects. I’m confident the Acala team and the grants committee would want to continue this conversation in the forums transparently.

3 Likes

This is a fantastic proposal @bettec. It’s clear, concise, and well-documented. Bravo!

To mirror the comments of @jared and @inkymaze, I do think this proposal would be eligible for the Compound Grants Program which is currently undergoing a community vote. Having said that, we don’t want to put the cart before the horse — let’s wait for the community to finish voting on the grants program before the committee begins to formally evaluate proposals!

In the meantime, maybe I can ask some questions in my capacity as a Compound community member (rather than the lead for the grants program).

  • Could you please provide more details on how each milestone would benefit Compound and its community? I think it’s important for the community to know exactly how it stands to benefit from the work you propose to do.
  • Are there challenges that you know of today that would make it difficult for you to achieve these milestones on time (e.g., challenges with R&D, lack of FT resources)? It’s important to list out these difficulties in advance for two reasons: (i) acknowledging them ahead of time makes it easier to prepare for the challenges, and (ii) perhaps Compound’s community can help with these challenges.

I also agree with @inkymaze on the funding process. If the grants proposal passes and you apply for a grant, I do think it makes sense to apply for new grant each time a new milestone is met. For example, you could apply for a $10-$30k grant upfront to give you the resources to get started, and then apply for further grants as milestones are delivered.

For full transparency, I should also mention that I invested in Acala while I was at DCG. I know and respect the team, and I believe they can deliver what they say they will deliver. It’s also important to note that I have no economic exposure to Acala (and as far as I know, none of the grants committee members do either…if that’s not the case, they can chime in themselves).

6 Likes

Cool,really like your thoughts~

Thanks for the warm welcome and feedback.

We have approached the grants program to discuss this. Since the grants program is still being shaped up, we intend to proceed the design and development of the Starport in parallel of the discussion with the grants program. We will report back.

Yup, that makes sense. This Proposal is more to lay out our overall intention so folks can have a full picture of deliverables and outcome. We will certainly need to engage relevant stakeholders and parties along our design and development process, whether that results in separating the milestones, or add additional (asset etc) deployment milestones. We will report back.

Thanks again for the feedback.

2 Likes

Thanks Larry. Also applaud your transparency.

To answer your questions re benefits

  • #1 Develop Acala Starport pallet
    This will essentially bridge Compound Chain and Polkadot, allowing accepted Polkadot assets to be uploaded to Compound Chain as collaterals, and allowing CASH to be downloaded and used in Polkadot ecosystem. Polkadot in itself is layer-0, so it relys on parachains to deploy business logics like bridging and smart contract executions etc. Acala as the DeFi hub parachain offers a set of DeFi primitives such as stablecoin lending, AMM DeX and liquid staking, and therefore provides good asset variety and liquidity as a Starport to Compound.

  • #2 Develop Offchain Worker & Message Passing
    This will essentially allow any Substrate-based chain be able to bridge to the Compound Chain. This is certainly a common-good development that will enable many subsequent bridges to Compound Chain, although each Starport deployment will still subject to governance, the barrier of deployment is significantly lowered.

  • #3 Integration & Oracle
    This will ensure Compound Cash App works seamlessly with Acala to bring new assets (e.g. DOT and LDOT) on as collaterals, so as to download CASH to Acala. I can foresee this milestone can be broken down further to add economic and risk analysis for each new collaterals namely DOT and LDOT, and set up the initial parameters so as ongoing monitoring and adjustment procedure.

  • #4 integrating Compound Cash into Acala Dapps
    This essentially exposes the Compound Chain money market services to the Acala (and therefore Polkadot) users and community. In addition, integrating CASH into Acala DApps, using it to pay for transaction/gas fees will further the demand and utility of this new asset. We believe this will result in a positive trickle-up effect for the three communities: Compound, Acala and Polkadot.

To answer your questions re challenges
As we are one of the earliest and most experienced Substrate development teams, and after a thorough study of Compound Chain’s source code, we don’t foresee technical challenges. We do however anticipate potential challenges in setting up a brand new collateral asset class (DOT and LDOT). We will likely need help from experts like Gaunlet and the Labs team to help profile the new assets; in addition, we also need help to bootstrap initial liquidity - we can come up with liquidity programs, but it’s likely that it’d need support from multi-parties to make it work effectively.

Other than that, in order to add CASH as a fee token on Acala, which would be a great use case of CASH and benefits the Compound community, we will need help to add CASH liquidity to our AMM DeX which is used as a unified fee settlement layer. Again we can come up with liquidity programs, it’s likely to be an effort of multi-parties.

Re the grants program
We’re open to the suggestions and would also like to have a further discussion to learn more about the grants program. We’ll report back once having a chat with you.

Again thanks for the warm welcome and feedback~

3 Likes

Thanks for the in-depth reply @bettec.

For everyone else following along — the Compound Grants Program scheduled a call with the Acala team to walk through the proposal in greater detail. If this proposal gets funded, we will be sure to update this thread with the details.

4 Likes

For folks who are following along, I’d like to report back that we had a call with the Compound Grants Program, further detailed our plan and benefits to the COMP community with this initiative. And just heard back from @sukernik that the grant has been approved :grinning:

Details of the grant as per below:
Total Grant approved: $35k

  • 1/5 upfront
  • 1/5 on completion of milestone 1
  • 1/5 on completion of milestone 2
  • 1/5 on completion of milestone 3
  • 1/5 on completion of milestone 4

The rationale behind this is that while the initiative is partially funded by the Grants Program, but it can hold Acala accountable for the entire delivery which is in the best interest of the Compound community.

Thanks again for everyone’s input, also shoutout to the Grants team especially @sukernik 's effort for moving this work forward. We will continue to update everyone here as we progress.

Regards
Bette

4 Likes

awesome proposal! Cant wait to see it in prod.

Thanks for that proposal, Acala team!

tl;dr We have completed the first milestone of building a Starport pallet to upload & download Acala/Polkadot/CASH assets between Compound Gateway and Acala network (testnet), code merged & local testnet available :tada:

CC: @sukernik from the grants team

Milestone 1 Starport Pallet

This delivery includes

  1. Support lock to upload asset
  2. Support execTrxRequest to execute transaction request on Compound Chain (this is done on the Compound Chain side, on Acala chain, we just need to support the notice arrived #3 :point_down:)
  3. Support invoke to execute notices from Compound Chain
  4. Necessary Governance features

Which essentially enables the following features

  1. Upload Acala chain assets e.g. DOT, LDOT via the Starport to Compound Chain
  2. Download Compound Chain assets e.g. Compound CASH to the Acala chain via Gateway Notice
  3. Preliminary administrative functions such as setting supply cap, setting authorities to verify Gateway Notices etc.

Local Testnet

Live testnet integration won’t be available until Milestone #3 is delivered. Currently you can try the above features via Acala local testenet.

Here’s the code & the guide.

Next Step

Milestone #2 is about cross-chain communication, specifically between the Compound Gateway Substrate chain and the Acala Substrate chain.

There are multiple options available to achieve this, including using Cross-chain Message Passing developed by the Parity team, alternatively using off-chain query service like Subquery and potentially other options. There were numerous exchanges between the two dev teams to finalize the design.

In addition, here’s a list of open issues.

Will report back as we progress further.

Testnet Examples

Upload Acala asset e.g. DOT to Compound Chain

Download Compound Chain asset e.g. CASH

Regards

Bette & Bryan @Acala

6 Likes

Congrats @bettec - super amazing to see the connection between Compound Gateway and Acala! Can’t wait to see where this goes

2 Likes

Fantastic update @bettec!

Super exciting news !! Keep up the great work !