Commons Swarm Outcomes (1/3): A plug-and-play bonding curve

Commons Swarm work is coming to an end so it’s time to show off the outcomes of our last months of work. This is the first of a series of posts explaining the products that we have produced for 1hive’s future network of DAOs (aka Gardens):

  • Part 1: The Augmented Bonding Curve: A plug-and-play bonding curve
  • Part 2: The Hatch: A fundraising module for DAOs
  • Part 3: EVM-Crispr: A tool to mutate a DAO’s DNA

I think the community is going to enjoy each one of these articles, so let’s start with the first one: The Augmented Bonding Curve.

Bonding curves previously in 1hive

1hive took Aragon Black Fundraising suite and transformed it into the Marketplace apps and a template previously known as Gardens (today we would be calling it Commons). The main differences between Aragon Black Fundraising and 1hive Marketplace suites were as follows:

  • The DAO template was simplified, so we did not have a board / beneficiary mulisig anymore, but a common pool governed with Conviction Voting.
  • We also removed the Tap app, a mechanism similar to the DAICO proposed by Vitalik. The common pool was funded instead using the bonding curve entry and exit tributes, as it was proposed by the Commons Stack model.
  • The batched bancor market maker was simplified to not require to wait for some blocks to be mined in order to perform a buy or a sell in the Bonding Curve. The new bancor market maker used the minReturn approach to prevent front running instead of the batched bonding curve method.

The 1hive Marketplace apps were composed of:

  • The Presale app, a fundraising app that can be used to bootstrap a DAO. It has the goal to reach a certain amount of funding in a specific period of time, and distribute the initial DAO tokens.
  • The Bancor Formula app, an external contract that encodes the mathematical functions to calculate the amount of tokens that can be bought or sold for a specific amount of collateral tokens.
  • The Bancor Market Maker app, an app connected to the Bancor Formula that mints/burns tokens based on the amount of funds that users deposits/withdraws from the reserve. It is also the piece of software that applies the entry and exit tributes.
  • The Marketplace Controller, an app that has permissions over the Presale and the Bancor Market Maker and is used as a Mediator to interact with them.

The template was tested by 1hive during a short period of time, but we pivoted to a simpler token policy DAO that used the Issuance app when 1hive was lauched to xDai. New 1hive Gardens will follow this simplified design by default as well.

This is not the case of the Token Engineering Commons Garden, which is following the Commons Stack original design of using an Augmented Bonding Curve along with Conviction Voting to govern the funds of the DAO. For making it possible we reused the work that 1hive did previously on the marketplace app.

Bonding curves with Commons Swarm

The marketplace apps still had to be used as a pack, since both Presale and Bancor Market Maker had Marketplace Controller as a dependency. This fact made the use of the individual apps difficult, so our work focused on decoupling those apps into:

  • The Hatch app (previously Presale): Now we can do a DAO fundraising without the need of installing a Bonding Curve. More on this on the second part of this series of articles.
  • The Augmented Bonding Curve app: A single app that has all the features of the previous marketplace bonding curve, but without the need of installing multiple apps. Thanks to that, now it is much much easier to install a Bonding Curve on a pre-existing DAO as it can be seen in the last section of this article.

We also adapted the Aragon Convert frontend, previously used by Aragon to convert ANT into ANJ and viceversa, to use the new non-batched bonding curve. You can find it under the name of TEC convert. It has the following features:

  • We generalized the frontend so now it can be used with any pair of tokens.
  • It now applies the entry and exit tributes to the predicted amount of returned tokens.
  • It fetches the reserve ratio, virtual balance and virtual supply from the smart contract, so you don’t have to.

With very little changes (some configurations and few images) this front-end can be used for any Garden that wants to use a bonding curve. An example of how it works can be seen at rinkeby.convert.tecommons.org.

How to install a Bonding Curve on an existing DAO

We can install the a Bonding Curve using the following steps:

  1. Install a vault that we will use as the reserve.
  2. Install an augmented-bonding-curve.open app with the following initialization parameters:
    • Token manager
    • Bancor Formula address (0x9ac140f489df1481c20feb318f09b29a4f744915 in Rinkeby)
    • New vault (reserve)
    • Old vault (common pool)
    • Entry tribute (in pct)
    • Exit tribute (in pct)
  3. Create the following Augmented Bonding Curve permissions:
    • OPEN_TRADING_ROLE granted to Voting
    • MAKE_BUY_ORDER_ROLE granted to ANY_ENTITY
    • MAKE_SELL_ORDER_ROLE granted to ANY_ENTITY
    • ADD_COLLATERAL_TOKEN_ROLE granted to Voting
  4. Grant the following permissions to Augmented Bonding Curve:
    • Token Manager’s MINT_ROLE
    • Token Manager’s BURN_ROLE
    • New vault’s TRANSFER_ROLE
  5. Execute addCollateralToken with the following parameters:
    • Collateral token address
    • Virtual supply (can be set to 0)
    • Virtual balance (can be set to 0)
    • Reserve ratio (in PPM)
  6. Execute open to open trading in the Augmented Bonding Curve.

When the EVM-crispr is available (wait for third part of this series), we will be able to encode all of those commands within the following script:

import { EVMcrispr, evmcl } from '@1hive/evmcrispr'
import { ethers } from 'hardhat'

const pct = pct => Math.floor(pct * 1e18)
const ppm = ppm => Math.floor(ppm * 1000000)

const daoAddr = 'your-dao.aragonpm.eth' // Address or ENS of the DAO
const formulaAddress = '0x9ac140f489df1481c20feb318f09b29a4f744915' // Bancor Formula
const collateral = '0xe91d153e0b41518a2ce8dd3d7944fa863463a97d' // wxDAI
const entryTribute = pct(0) // 0%
const exitTribute = pct(0.2) // 20%
const reserveRatio = ppm(0.1) // 10%

const script = evmcl`
  install agent:reserve
  install augmented-bonding-curve.open:abc token-manager ${formulaAddress} agent:reserve agent:0 ${entryTribute} ${exitTribute}
  grant voting augmented-bonding-curve.open:abc OPEN_TRADING_ROLE voting
  grant ANY_ENTITY augmented-bonding-curve.open:abc MAKE_BUY_ORDER_ROLE voting
  grant ANY_ENTITY augmented-bonding-curve.open:abc MAKE_SELL_ORDER_ROLE voting
  grant voting augmented-bonding-curve.open:abc ADD_COLLATERAL_TOKEN_ROLE voting
  grant augmented-bonding-curve.open:abc token-manager MINT_ROLE
  grant augmented-bonding-curve.open:abc token-manager BURN_ROLE
  grant augmented-bonding-curve.open:abc agent:reserve TRANSFER_ROLE voting
  exec augmented-bonding-curve.open:abc addCollateralToken ${collateral} 1 0 ${reserveRatio}
  exec augmented-bonding-curve.open:abc open
`

async function main() {
  const signer = (await ethers.getSigners())[0]
  const evm = new EVMcrispr(signer)
  await evm.connect(daoAddr)
  await evm.forward(script, { path: ['token-manager', 'voting'] })
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error)
    process.exit(1)
  });

5 Likes

Thank you for taking the time to write this up. Really useful recap. Particularly appreciate the historical context :heart:

3 Likes

sem you’re the man I learn so much from these posts.

On behalf of future Gardens thanks for making all this work available and giving the documentation to implement.

2 Likes