How to integrate

This page explains how you can integrate your app with impactMarket contracts.

All of our codebase is open source (available on GitHub).

How to integrate with communities

First, it's necessary to understand the flow.

  1. Anyone opens our app, creates a request to create a community. That is simply an entry on our database, with community name, description, UBI contract parameters, address of who's requesting to create the community, and a few more details. All pending communities are then listed to ambassadors on a specific page within the app.

  2. Ambassadors then claim a community. They can edit all information. Once it's all ready, approve community.

  3. When approved , the council see a request to deploy the community. To do so, a proposal needs to be generated. This is very similar to a DAO proposal, with the difference that, only the council members vote and there are not limits. Council member are selected by the DAO. See move on v2 changes here.

  4. Once voting ends, if the proposal is accepted, it can be executed.

  5. Once executed the community contract is deployed (calls this) adding the first manager (the person who requested to create the community) and after that everything happens within the community. The ambassador that claimed the community is responsible for that community, and add managers. A manager adds beneficiaries. Beneficiaries claim.

You don't need to integrate steps 1-4, only 5.

So, to find out if a given address is a beneficiary or manager in a community, you can use our subgraph (source code here) running the following query

{
  beneficiaryEntity(id: "lower-case-user-address-here") {
    community {
      id
    }
  }
  managerEntity(id: "lower-case-user-address-here") {
    community {
      id
    }
  }
}

It either returns null or an object. Feel free to test it. See documentation on the yaml file on source code.

PLEASE NOTE that this is a self-hosted service from TheGraph. While we recommend using it (as we also use it) this is a free (and reliable service), it will eventually change in the future are TheGraph migrates to the decentralized network and start being a paid service. Learn more here.

And finally, let's suppose the community was just deployed, and the manager is now found through the query above so it will be shown accordingly on the app. The next steps are to add more managers and add beneficiaries so they can start to claim. All of those actions are on the community contract. Now, all it's needed to do is to call those methods accordingly. First addBeneficiary, then the beneficiary enters the app, and using the subgraph query above it's possible to know it's a beneficiary so we allow to claim.

That's all it's needed for the base integration. Don't hesitate to go to our discord and ask any questions you might have.

Last updated