Skip to content

centrifuge/pools-subql

Repository files navigation

Centrifuge Subquery

SubQuery

A GraphQL API to query the Centrifuge Parachain on Polkadot.

🌱 Staging

Pipeline

Use GraphQL query endpoint at https://api.subquery.network/sq/embrio-tech/centrifuge-subql or try the API with the SubQuery Playground.

👷‍♂️ Development

We highly recommend to develop using the overarching centrifuge-development repository. It allows to run all required services and databases with Docker Compose.

Environment

  • Typescript are required to compile project and define types.
  • Both SubQuery CLI and generated Project have dependencies and require Node.
    • node: version specified in .nvmrc
  • Yarn

Code generation

To generate the entities based on schema.graphql, run:

yarn codegen

Access

Open your browser and head to http://localhost:3000.

Finally, you should see a GraphQL playground is showing in the explorer and the schemas that are ready to query.

Linter

Automatic Linting

Staged code is linted automatically with a pre-commit hook.

Manual Linting

You can run the linter with

yarn lint

To fix fixable lint errors use

yarn lint:fix

Commit

This repository uses commitlint to enforce commit message conventions. You have to specify the type of the commit in your commit message. Use one of the supported types.

git commit -m "[type]: foo bar"

🗄️ Data Model

!!! Data fields ending with an underscore _ are automatically reset at the end of a period and bust be of type BigInt!!!

erDiagram
    Account ||--o{ TrancheBalance: ""
    Account ||--o{ CurrencyBalance: ""

    Loan ||--|| LoanState: ""
    Loan ||--o{ LoanSnapshot: ""
    LoanState ||..|| LoanSnapshot: "onNewPeriod"

    Pool ||--|| PoolState: ""
    Pool ||--o{ PoolSnapshot: ""
    PoolState ||..|| PoolSnapshot: "onNewPeriod"

    Tranche }o--|| Pool: ""
    Tranche ||--|| TrancheState: ""
    Tranche ||--o{ TrancheSnapshot: ""
    TrancheState ||..|| TrancheSnapshot: "onNewPeriod"

    Epoch }|--|| Pool: ""
    Epoch }o--|| EpochState: ""
    EpochState ||--|| Tranche: ""

    InvestorTransaction }o--|| Account: ""
    InvestorTransaction ||--|| Pool: ""
    InvestorTransaction ||--|| Tranche: ""
    InvestorTransaction ||--|| Epoch: ""

    OutstandingOrder }o--|| Account: ""
    OutstandingOrder ||--|| Pool: ""
    OutstandingOrder ||--|| Tranche: ""
    OutstandingOrder ||--|| Epoch: ""

    BorrowerTransaction }o--|| Account: ""
    BorrowerTransaction ||--|| Epoch: ""
    BorrowerTransaction ||--|| Loan: ""

    Currency ||--|{ Pool: ""