Skip to content

Latest commit

 

History

History
64 lines (47 loc) · 1.91 KB

README.md

File metadata and controls

64 lines (47 loc) · 1.91 KB

Gnosis Safe Subgraph

Modern wallets like the Gnosis Safe use contract-based accounts to manage funds. This subgraph indexes new deployments of contract-based accounts for users of the Gnosis Safe.

There's a UI that uses this subgraph at contractbasedaccounts.com.

For more information see the Gnosis Safe docs and/or the docs for The Graph.

We've also built a related subgraph, the Argent subgraph.

Why is this interesting?

Well, for example this contract-based account has 5,000 ETH in it.

Schema

type ContractBasedAccount @entity {
  id: ID!
  timeCreated: BigInt!
}

Sample query

Get the two most recent Gnosis Safe contract-based accounts, with the newest one shown first.

{
  contractBasedAccounts(first: 2, orderBy: timeCreated, orderDirection: desc) {
    id
    timeCreated
  }
}

Sample response

{
  "data": {
    "contractBasedAccounts": [
      {
        "id": "0x3bcebeafee1476ae989ef108c2c825ad3be7a38b",
        "timeCreated": "1557234021"
      },
      {
        "id": "0xafc2f2d803479a2af3a72022d54cc0901a0ec0d6",
        "timeCreated": "1557156465"
      }
    ]
  }
}

Built by the Tasit team.

Notes

As the creation of new contracts is a very gas-consuming operation, the Gnosis Safe contracts use a proxy pattern where a master copy of the contract is deployed once and all its copies are deployed as minimal proxy contracts pointing to the master copy contract. This means that we can track the creation of new contract-based accounts by indexing an event from the ProxyFactory contract.