https://github.com/tasitlabs/gnosis-safe-subgraph
A subgraph for The Graph that indexes events for the Gnosis Safe contracts on Ethereum
https://github.com/tasitlabs/gnosis-safe-subgraph
contract-based-account ethereum gnosis gnosis-safe graph graphql safe the-graph wallet
Last synced: 6 months ago
JSON representation
A subgraph for The Graph that indexes events for the Gnosis Safe contracts on Ethereum
- Host: GitHub
- URL: https://github.com/tasitlabs/gnosis-safe-subgraph
- Owner: tasitlabs
- License: mit
- Created: 2019-05-11T21:55:07.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2022-12-10T17:22:15.000Z (almost 3 years ago)
- Last Synced: 2025-03-28T14:11:09.850Z (7 months ago)
- Topics: contract-based-account, ethereum, gnosis, gnosis-safe, graph, graphql, safe, the-graph, wallet
- Language: TypeScript
- Homepage: https://thegraph.com/explorer/subgraph/tasitlabs/gnosis-safe
- Size: 1.67 MB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://contractbasedaccounts.com).
![]()
For more information see the [Gnosis Safe docs](https://gnosis-safe.readthedocs.io/en/latest/) and/or the [docs for The Graph](https://thegraph.com/docs/).
We've also built a related subgraph, the [Argent subgraph](https://github.com/tasitlabs/argent-subgraph).
### Why is this interesting?
Well, for example [this contract-based account](https://etherscan.io/address/0xafc2f2d803479a2af3a72022d54cc0901a0ec0d6) has 5,000 ETH in it.
### Schema
```graphql
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.
```graphql
{
contractBasedAccounts(first: 2, orderBy: timeCreated, orderDirection: desc) {
id
timeCreated
}
}
```### Sample response
```json
{
"data": {
"contractBasedAccounts": [
{
"id": "0x3bcebeafee1476ae989ef108c2c825ad3be7a38b",
"timeCreated": "1557234021"
},
{
"id": "0xafc2f2d803479a2af3a72022d54cc0901a0ec0d6",
"timeCreated": "1557156465"
}
]
}
}
```Built by the [Tasit](https://tasit.io) 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.