Skip to content
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
snapshot.js/src/strategies/ocean-marketplace/
snapshot.js/src/strategies/ocean-marketplace/
This branch is 13 commits ahead, 571 commits behind snapshot-labs:master.

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 

Ocean marketplace Snapshot strategy

version 0.1

This strategy gives score aka votes to the liquidity providers on the Ocean marketplace. This means that they can vote for OceanDAO votes hosted on the Snapshot platform without the need to remove their liquidity.

Solution description

The solution pulls the needed data from the Ocean Protocol mainnet subgraph endpoint: https://subgraph.mainnet.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph

It is pulling a bit more information than currently used so the solution can also be extended. The current limitation comes from only considering liquidity providers and ignoring pure token holders. This means that the tokens added to the liquidity pool by the pure token holders are accredited to the liquidity providers. This can be fixed but is a bit more complicated as the ratio of datatokens to Ocean tokens has to be considered in a general manner. And the token holders for each pool have to be extracted from the subgraph.

So the current solution checks for active pools with participants and then attributes votes to them like this:

user_votes = user_pool_shares * (total_Ocean_in_the_pool / total_number_of_pool_shares)

This is done for all pools and the votes for the users are added up.

To extend or run this strategy please use the setup described here.

GraphQL queries:

Pools

pools (first: 1000, orderBy: oceanReserve, orderDirection: desc) {
  id,
  holderCount,
  oceanReserve,
  active,
  totalShares,
  shares (first: 1000) {
    id,
    userAddress {
      id,
      tokensOwned {
        id
      }
    },
    balance
  },
  tokens {
    balance,
    denormWeight,
    tokenId {
      id
    }
  }
}

Datatokens

{
datatokens {
  id,
  balances {
    userAddress {
      id
    }
    balance
  }
}
}