Project guide: How to integrate dual distributions with Astroport Generators

Note: This is a technical article aimed at the creators and contributors of other projects on Terra. It summarises the steps necessary to integrate with Astroport’s dual distribution functionality. The text was updated on Nov. 5, 2021 to more accurately describe the ASTRO Generators as distributing governance awards.

What are ASTRO Generators?

The Astroport protocol will have its own governance token, ASTRO, which will also be distributed to Astroport LPs through liquidity mining, as determined by the Astral Assembly governance process.

ASTRO Generators are architected to enable an LP to claim the dual governance awards of both ASTRO and the tokens of the extrinsic DeFi communities associated with the pool (e.g. MIR or ANC) where available.

Dual distributions should benefit both Astroport and third party projects. LPs receive more tokens than they would otherwise (since they’re receiving two tokens). Exposure on Astroport’s Generator UI could garner more liquidity for Terra projects, and LPs will have a better user experience with fewer steps and transactions.

As explained in the Litepaper:

Rather than depositing their Astroport LP tokens in the third-party staking contract directly, LPs can deposit their Astroport LP tokens into one of Astroport’s ASTRO Generators. Through a proxy contract architecture, the ASTRO Generators forward the LP tokens into the relevant third-party staking contract. Because the user is liquidity mining on third-party contracts through an ASTRO Generator, the same LP-tokens can be tracked both by those third-party contracts and Astroport. Therefore, LPs accrue both sets of grants (both ASTRO and the third-party protocol tokens). When an LP wishes to claim these granted tokens, (1) the ASTRO generator transfers the appropriate amount of ASTRO to the LP, and (2) the proxy contract claims the third-party tokens due to the LP and transfers them as well.

This and associated mechanisms are explained fully in the Astroport Litepaper.

How to Integrate with an ASTRO Generator

There are four main steps a project should take:

  1. Ensure your token already has an existing Astroport pool
  2. Create a liquidity mining mechanism to distribute your governance token to LPs in the Astroport pool
  3. Deploy a generator proxy contract specific to your liquidity mining mechanism and Astroport pool
  4. Reach out to the Astrochads via Discord, Twitter or any other channel

We will go into detail for each below.

Note: prior to Astroport’s launch you will need to be added to the git repository in order to see the example contracts. Reach out to Luke on Twitter with details of your project in order to be added.

1. Ensure your token already has an existing Astroport pool

If a suitable pool doesn’t exist for the relevant asset pair then one will need to be created. Pool creation is permissionless.

See here for the relevant documentation: https://github.com/astroport-fi/astroport/tree/master/contracts/factory#create_pair

Or alternatively reach out to the Astroport contributors.

2. Create a liquidity mining mechanism

Astroport provides an example generator proxy contract compatible with the Mirror staking contracts. For new projects that want their liquidity mining mechanism to integrate with Astroport generators, the simplest path is basing your liquidity mining contracts on the Mirror design.

https://github.com/Mirror-Protocol/mirror-contracts/tree/main/contracts/mirror_staking

Alternatively Anchor’s liquidity mining mechanism is simpler and should not require big changes to the example generator proxy contract.

https://github.com/Anchor-Protocol/anchor-token-contracts/tree/main/contracts/staking

Generator integration is still possible if you have a different liquidity mining mechanism but it requires a custom generator proxy contract in the next step.

3. Deploy a generator contract

The generator proxy contract acts as an adaptor between the ASTRO generator and your liquidity mining mechanism. You can create and deploy this yourself.

Astroport provides a proxy template which you can customise:

https://github.com/astroport-fi/astroport/tree/master/templates/generator_proxy_template

Astroport also provides a full example proxy contract designed for the Mirror liquidity mining mechanism:

https://github.com/astroport-fi/astroport/tree/master/contracts/tokenomics/generator_proxy_to_mirror

If you plan to deploy your own contract, please make sure you read and understand Mirror’s contracts, and feel free to contact the Astroport contributors if you have any questions.

4. Reach out to the Astrochads

The final step is for the new proxy contract to be registered with the generator. Eventually this will be done via a governance vote, but for now a multisig transaction is required.

Reach out to an Astroport contributor on Twitter, Discord or any other channel and they can add you to the appropriate group to discuss your contract. Current contributors include Luke and Jose at Delphi Labs.

Onwards and upwards

With benefits for DEXes, third party projects and LPs, we believe dual distributions will become an industry standard. We look forward to connecting with other projects in the Terra ecosystem to push the concept forward and help Astroport bring massive liquidity to all Terra tokens and beyond. Be part of the journey by following Astroport on Twitter now: https://twitter.com/astroport_fi.

An automated, decentralised exchange protocol on the Terra blockchain. http://astroport.fi