Polygon/Matic Starport

There’s been a lot of interest in building a Gateway Starport on Polygon. So let’s do it! I suggest we use this thread going forward to organize discussion around the topic.

I’m trying to schedule a bi-weekly call to sync amongst those interested in contributing to this effort to coordinate ourselves, please DM me your email address in Compound Discord if you’d like to be on this list.

In the meantime, Compound has started a living document on How to Build a Starport.



For programmers following along, I have some PRs that are work in progress. Feel free to look over them


These will end up being reviewed/merged after the next testnet release with some necessary rebase modifications.

1 Like

Won’t this fragment the coin markets?

For example; If a user deposits ETH or any other token from Polygon does it become a different market than the original?

Yes by default Polygon ETH will be different than Ethereum ETH, although governance could decide to handle it differently.

This is something that can be defined as part of the runtime changes that are proposed to Gateway, or changed later. It’s probably easier to start with distinct assets and think about combining them down the road.

1 Like

Looking forward to collaborating with the Compound community and interacting more in future to kickstarting Polygon deployment.


For those following the dev work I just merged https://github.com/compound-finance/gateway/pull/341 into develop.

This creates a failing integration test. Now, practical integration testing for wip polygon rust side by waynenilsen · Pull Request #330 · compound-finance/gateway · GitHub will start.


Updated wip polygon rust side by waynenilsen · Pull Request #330 · compound-finance/gateway · GitHub with some code that actually works. I am happy to hear review from anyone that wants to comment.

We have a successful lock at this point in an integration test. There is a lot of work still to do but this is a first step.

Here is a sketch of what I see as the roadmap after we merge this. Roadmap items marked with c denote those items that are not perhaps entirely necessary if we don’t need to launch with cash token.

  • Lock (soon :tm: )
  • Unlock
  • c / LockCash
  • c / UnlockCash
  • Figure out governance
  • c / Sync index / cash interest rate and process notices
  • Integration testing with multiple chains and scenarios
  • Upgrade testing integration testing using governance on Ethereum to set the starport and enable matic.
  • Testnet
  • Audit
  • Mainnet

There is not necessarily an order here although some things are blocking others. Feel free to ask questions.

Polygon Starport Call Notes - Call #1 (June 1st, 2021)

Hello! Thanks everyone that participated in today’s call. I took some notes during the call. Please let me know if I misunderstood an explanation or have some info in here that is not accurate. I can make edits with corrections and clarifications. The next call will take place in 2 weeks from today, likely at a slightly earlier time. We will post future call details soon!

  • Wayne (Compound Labs) has made some progress on a Polygon Starport. The development process of the Starport so far has been to run 2 Ganache chains locally, one for Ethereum and one for Polygon. Also run an instance of a Gateway node locally that hooks up to those Ganache instances.
  • Wayne is deploying both a Polygon Starport contract and a CASH contract to the Ganache instance, and attempting to get the Lock operation to work locally.
  • Wayne is working on creating a test to run the operation; the test currently fails. Once this test passes, it will be the first milestone in development of the Polygon starport.
  • There is a forum thread to discuss the progress of the Starport
  • We went over introductions of everyone in the call. Included several members of Compound Labs, Polygon Team, and interested community members.
  • Jared (Compound Labs) took time to cover what a Starport is: Each peer chain to Gateway needs to have a Starport in order to enable collateral to be supplied to Gateway. It is required that assets be locked in the Starport of the peer chain and also an event must be emitted regarding the Lock, so that Gateway can read it, and recognize the account’s new balance. Once the collateral is Locked and the event is processed by Gateway, the user earns interest in CASH and can borrow another asset.
  • Gateway is the v3 of the Compound protocol. The current instance on Ethereum is v2 of the Compound protocol.
  • Jared asked about how block finality works on Polygon.
  • Jaynti (Polygon) says that it works similar to Ethereum, there is a checkpoint every 3 hours. Transactions go onto Ethereum every 3 hours and then they are considered final. Info can be read from the receipt on Ethereum at any time. A checkpoint is when all nodes on Polygon agree, then the data is verified and written to Ethereum.
  • Mihailo (Polygon) asked about other examples of Starports being built (EVM and non-EVM) so they can refer to those when building a Polygon Starport
  • Jared said that Polygon will likely be the first EVM based chain. Flow is being worked on, but it is not close to completion currently. The Polygon Starport might be the first completed besides the Ethereum Starport.
  • Adam (Compound Labs) Asked what code changes must be made to Gateway in order to include a new Gateway Starport.
  • Jared said the runtime (Gateway code) must be modified and voted in through Compound governance (soft-fork). Gateway workers need to be made to fetch the events emitted by the new peer chain. Several enums need to be made in Gateway for the new chain, and then applied through a soft-fork code upgrade. Examples of some of the enums needed on Gateway are the addresses of the Starport and CASH token on the peer chain, and also the first block in which the Starport is recognized.
  • Toni (Compound Labs) Asked what is a good wait time for events on Polygon? For Ethereum, 6 blocks is a good measure. What is a good amount of blocks on Polygon?
  • Jaynti: 128 blocks is a good measure.
  • Max (Compound Labs) asked do we need to wait for the checkpoint to be posted on Ethereum to be considered final?
  • Jaynti said yes, but this depends on how the Starport will work. Many applications are interacting with the chain directly. You can wait a certain number of blocks instead of waiting for the checkpoint. The process for re-orgs will be similar to Ethereum but we will need to do some more research on this implementation specifically before we know the answer.
  • Jay (community) asked: how can the community members help out? (for those that are not a part of Compound Labs or Polygon)
  • Jared: By reviewing the code that we publicly push to GitHub, like Wayne’s branch. This can be reviewed by the community which would be helpful.
  • Mihailo proposed for the group to come up with a roadmap for the project
  • Hamzah (Polygon) We should come up with the roadmap on the forums.
  • Mihailo asked: Are Gateway and Ethereum deployed to production (mainnet)?
  • Jared: No, we are using Ropsten testnet and we are awaiting audits. We should launch the Polygon Starport first on the Polygon testnet before a mainnet hookup.
1 Like

Are there any permissions needed to comment/review on PRs? my github account is kaishaku-ogami. when trying to add a comment, it was not saved on PR #330.

1 Like

I think its because you are a new GitHub user and your account was created 44m ago, we don’t have any settings in our repository limiting these kinds of interactions. Do you have another account you could use? Or perhaps just waiting a day will solve the problem.

1 Like

Ok, I will wait and see. Makes sense.

1 Like

Sounds good. Thanks for putting this together.

@jared - would love to work together to put a roadmap for the deployment and also how we can optimally engage community.

1 Like

i hope comp can support matic layer

1 Like