Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
196 changes: 196 additions & 0 deletions subgraphs/Aragon-Agreement/entities.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
# Aragon Agreement Entities

- [`Agreement`](#agreement)
- [`Signer`](#signer)
- [`Signature`](#signature)
- [`Action`](#action)
- [`Challenge`](#Challenge)
- [`Dispute`](dispute)
- [`Evidence`](#evidence)
- [`Version`](#version)
- [`Disputable`](#disputable)
- [`CollateralRequirement`](#collateralrequirement)
- [`Staking`](staking)
- [`StakingMovement`](#stakingmovement)
- [`ERC20`](#erc20)
- [`ArbitratorFee`](#arbitratorfee)
- [`AragonInfo`](#aragoninfo)

## Agreement

| Field | Type | Description |
| -------------- | ------------- | ------------------------------- |
| id | ID! | Agreement id |
| dao | Bytes! | Dao address |
| stakingFactory | Bytes | Staking factory address |
| currentVersion | Version | Current version of the agrement |
| actions | [Action!] | Agreement actions |
| signers | [Signer!] | Agreement signers |
| versions | [Version!] | Agreement versions |
| disputables | [Disputable!] | Agreement disputables |

## Signer

| Field | Type | Description |
| ---------- | ------------ | -------------------------------- |
| id | ID! | Signer id |
| agreement | Agreement! | Agreements signed by the signer |
| address | Bytes! | Signer address |
| actions | [Action!] | Actions in relation to signer |
| signatures | [Signature!] | Signatures in relation to signer |

## Signature

| Field | Type | Description |
| --------- | -------- | ------------------------------- |
| id | ID! | Signature id |
| signer | Signer! | Signer in relation to signature |
| version | Version! | Signature version |
| createdAt | BigInt! | Block signiture was created |

## Action

| Field | Type | Description |
| --------------------- | ---------------------- | -------------------------------------- |
| id | ID! | Action id |
| agreement | Agreement! | Agreement in relation to action |
| disputable | Disputable! | Disputable in relation to action |
| actionId | BigInt! | Unique identifier |
| disputableActionId | BigInt! | Disputable action id |
| context | Bytes! | Context of the action |
| closed | Boolean! | Checks wether action is open or closed |
| submitter | Signer! | Signer that submitted the action |
| version | Version! | Agreement version |
| collateralRequirement | CollateralRequirement! | Collateral requirement for action |
| lastChallenge | Challenge | Last challenge |
| challenges | [Challenge!] | Action challenges |
| createdAt | BigInt! | Block action was created |

## Challenge

| Field | Type | Description |
| ----------------------- | --------------- | ---------------------------------- |
| id | ID! | Challenge id |
| action | Action! | Challenge action |
| challengeId | BigInt! | Unique challenge identifier |
| context | Bytes! | Context of the challenge |
| endDate | BigInt! | Challenge end date |
| challenger | Bytes! | Challenger |
| settlementOffer | BigInt! | Settlement offer for the challenge |
| state | ChallengeState! | Current state of the challenge |
| submitterArbitratorFee | ArbitratorFee | Submitter arbitrator fee |
| challengerArbitratorFee | ArbitratorFee! | Challenger arbitrator fee |
| dispute | Dispute | Challenge dispute |
| createdAt | BigInt! | Block challenge was created |

## Dispute

| Field | Type | Description |
| -------------------------- | ----------- | ----------------------------------------- |
| id | ID! | Dispute id |
| disputeId | BigInt! | Unique dispute identifier |
| ruling | BigInt! | Dispute ruling |
| challenge | Challenge! | Dispute challenge |
| submitterFinishedEvidence | Boolean! | Check wether submitter finished evidence |
| challengerFinishedEvidence | Boolean! | Check wether challenger finished evidence |
| evidences | [Evidence!] | Evidence in relation to Dispute |
| createdAt | BigInt! | Block dispute was created |

## Evidence

| Field | Type | Description |
| --------- | -------- | ------------------------------- |
| id | ID! | Evidence id |
| dispute | Dispute! | Dispute in relation to evidence |
| data | Bytes! | Evidence data |
| submitter | Bytes! | Submitter address |
| createdAt | BigInt! | Block evidence was created |

## Version

| Field | Type | Description |
| -------------- | ------------ | --------------------------------- |
| id | ID! | Version id |
| agreement | Agreement! | Version agreement |
| versionId | BigInt! | Unique version identifier |
| content | Bytes! | Version content |
| title | String! | Version title |
| arbitrator | Bytes! | Arbitrator address |
| appFeesCashier | Bytes! | App fees cashier address |
| effectiveFrom | BigInt! | Block app version is effective |
| signatures | [Signature!] | Signitures in relation to Version |

## Disputable

| Field | Type | Description |
| ---------------------------- | ------------------------ | -------------------------------- |
| id | ID! | Disputable id |
| address | Bytes! | Disputable address |
| agreement | Agreement! | Agreement in relation to dispute |
| activated | Boolean! | Check wether dispute is active |
| currentCollateralRequirement | CollateralRequirement! | Current collateral requirement |
| collateralRequirements | [CollateralRequirement!] | Collateral requirements |
| actions | [Action!] | Actions in relation to dispute |

## CollateralRequirement

| Field | Type | Description |
| ----------------- | ----------- | ------------------------- |
| id | ID! | Collateral requirement id |
| disputable | Disputable! | Disputable collateral |
| token | ERC20! | Token address |
| challengeDuration | BigInt! | Duration of the challenge |
| actionAmount | BigInt! | Action amount |
| challengeAmount | BigInt! | Challenge Amount |

## Staking

| Field | Type | Description |
| ---------- | ------------------ | ------------------------------- |
| id | ID! | Staking id |
| user | Bytes! | User address |
| token | ERC20! | Token used for stake |
| available | BigInt! | Staking amount avilable |
| locked | BigInt! | Amount locked |
| challenged | BigInt! | Staking amount challenged |
| total | BigInt! | Total amount staked |
| movements | [StakingMovement!] | Movement in relation to staking |

## StakingMovement

| Field | Type | Description |
| --------------- | ----------------------- | ------------------------------- |
| id | ID! | Staking movement id |
| staking | Staking! | Staking info |
| amount | BigInt! | Movement amount |
| agreement | Agreement! | Staking agreement |
| action | Action! | Action in realtion to stake |
| actionState | StakingActionState! | Current state of staking action |
| collateralState | StakingCollateralState! | Current state of collateral |
| createdAt | BigInt! | Block movement was created |

## ERC20

| Field | Type | Description |
| -------- | ------- | -------------------- |
| id | ID! | Token address |
| name | String! | Name of token |
| symbol | String! | Token symbol |
| decimals | Int! | Decimals value of 18 |

## ArbitratorFee

| Field | Type | Description |
| ------ | ------- | ----------------------------- |
| id | ID! | Arbitrator fee id |
| token | ERC20! | Token used for arbitrator fee |
| amount | BigInt! | Arbitrator fee amount |

## AragonInfo

| Field | Type | Description |
| ------ | --------- | ---------------------- |
| id | ID! | Aragon info id |
| orgs | [Bytes!]! | Organization addresses |
| apps | [Bytes!]! | Apps addresses |
| tokens | [Bytes!]! | Token address |
193 changes: 193 additions & 0 deletions subgraphs/Aragon-Agreement/queries.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
# Querying Aragon Agreement

You can build your own queries using a [GraphQL Explorer](https://graphiql-online.com/graphiql) and enter your endpoint to limit the data to exactly what you need.

Each entity has a plural version and a singular version. When querying for a single record response (e.g. account), you will need to supply the id for the entity. When querying for a list of responses (e.g. accounts), you may add filters using the 'where' clause.

Below are some sample queries you can use to gather information from the Aragon Agreement contracts.

## Examples

### This query fetches the first 5 agreements and signers

```graphql
{
agreements(first: 5) {
id
dao
stakingFactory
currentVersion {
id
}
}
signers(first: 5) {
id
agreement {
id
}
address
actions {
id
}
}
}
```

### Returns

```graphql
{
"data": {
"agreements": [
{
"id": "0x02dec3487c1b7dbadd7e716dbc80ca948bd53d96",
"dao": "0x4cc26143871843ff1334d9bef3f93f0fd0ad3ebb",
"stakingFactory": "0xe71331aef803baec606423b105e4d1c85f012c00",
"currentVersion": {
"id": "0x02dec3487c1b7dbadd7e716dbc80ca948bd53d96-version-1"
}
},
{
"id": "0x07c882b746d9ef16c56ac3dbf0d6b720f57344b8",
"dao": "0x6d986e213d0d66456a8d22841f29d022c1d95120",
"stakingFactory": "0xe71331aef803baec606423b105e4d1c85f012c00",
"currentVersion": {
"id": "0x07c882b746d9ef16c56ac3dbf0d6b720f57344b8-version-1"
}
},
{
"id": "0x09aaaf8cea7f56f14cdedb46718f05bb8c929175",
"dao": "0xb3f3da0080a8811d887531ca4c0dbfe3490bd1a1",
"stakingFactory": "0xe71331aef803baec606423b105e4d1c85f012c00",
"currentVersion": {
"id": "0x09aaaf8cea7f56f14cdedb46718f05bb8c929175-version-1"
}
},
{
"id": "0x0afb27d68580e9169cdfc192563f2d8912449586",
"dao": "0x919c45abdd2025d115b09392dc151b77586aa3f1",
"stakingFactory": "0xe71331aef803baec606423b105e4d1c85f012c00",
"currentVersion": {
"id": "0x0afb27d68580e9169cdfc192563f2d8912449586-version-1"
}
},
{
"id": "0x0f2239cdba335d2c51795e0cd43fb681b305a8d2",
"dao": "0x2050eabe84409e480ad1062001fdb6dfbc836192",
"stakingFactory": "0xe71331aef803baec606423b105e4d1c85f012c00",
"currentVersion": {
"id": "0x0f2239cdba335d2c51795e0cd43fb681b305a8d2-version-1"
}
}
],
"signers": [
{
"id": "0x02dec3487c1b7dbadd7e716dbc80ca948bd53d96-signer-0x5f672d71399d8cdba64f596394b4f4381247e025",
"agreement": {
"id": "0x02dec3487c1b7dbadd7e716dbc80ca948bd53d96"
},
"address": "0x5f672d71399d8cdba64f596394b4f4381247e025",
"actions": []
},
{
"id": "0x07c882b746d9ef16c56ac3dbf0d6b720f57344b8-signer-0x2c2fb1006b3d887330bd5fda14ed1f53e1e1c182",
"agreement": {
"id": "0x07c882b746d9ef16c56ac3dbf0d6b720f57344b8"
},
"address": "0x2c2fb1006b3d887330bd5fda14ed1f53e1e1c182",
"actions": []
},
{
"id": "0x07c882b746d9ef16c56ac3dbf0d6b720f57344b8-signer-0x3ebea5e6a6b41f151cd3da67e2f2c74dc577749f",
"agreement": {
"id": "0x07c882b746d9ef16c56ac3dbf0d6b720f57344b8"
},
"address": "0x3ebea5e6a6b41f151cd3da67e2f2c74dc577749f",
"actions": []
},
{
"id": "0x07c882b746d9ef16c56ac3dbf0d6b720f57344b8-signer-0x44cf9cc59bef89c316f633639bc852b33bc3b5df",
"agreement": {
"id": "0x07c882b746d9ef16c56ac3dbf0d6b720f57344b8"
},
"address": "0x44cf9cc59bef89c316f633639bc852b33bc3b5df",
"actions": []
},
{
"id": "0x07c882b746d9ef16c56ac3dbf0d6b720f57344b8-signer-0x809c9f8dd8ca93a41c3adca4972fa234c28f7714",
"agreement": {
"id": "0x07c882b746d9ef16c56ac3dbf0d6b720f57344b8"
},
"address": "0x809c9f8dd8ca93a41c3adca4972fa234c28f7714",
"actions": []
}
]
}
}
```

#### This query fetches the first 5 collateral requirements with duration and symbol of token

```graphql
{
collateralRequirements(first: 5) {
challengeAmount
challengeDuration
id
token {
symbol
}
}
}
```

#### Result

```graphql
{
"data": {
"collateralRequirements": [
{
"challengeAmount": "10000000000000000000000",
"challengeDuration": "604800",
"id": "0x02dec3487c1b7dbadd7e716dbc80ca948bd53d96-disputable-0x33a91b955764d4beb70f91d53cb7e3efc3c2fbf4-collateral-requirement-1",
"token": {
"symbol": "DRGIV3"
}
},
{
"challengeAmount": "10000000000000000000000",
"challengeDuration": "604800",
"id": "0x02dec3487c1b7dbadd7e716dbc80ca948bd53d96-disputable-0x539e4b7756bb2b6d405a897b134e4d2563697402-collateral-requirement-1",
"token": {
"symbol": "DRGIV3"
}
},
{
"challengeAmount": "100000000000000000",
"challengeDuration": "259200",
"id": "0x07c882b746d9ef16c56ac3dbf0d6b720f57344b8-disputable-0x4e20482124aab5fc96d7f1abc209ea23ba325002-collateral-requirement-1",
"token": {
"symbol": "gCRC"
}
},
{
"challengeAmount": "100000000000000000",
"challengeDuration": "259200",
"id": "0x07c882b746d9ef16c56ac3dbf0d6b720f57344b8-disputable-0x5dd85d7f3cca8efbce982f86306b2ac1df885bdf-collateral-requirement-1",
"token": {
"symbol": "gCRC"
}
},
{
"challengeAmount": "10000000000000000000000",
"challengeDuration": "604800",
"id": "0x09aaaf8cea7f56f14cdedb46718f05bb8c929175-disputable-0x9ece49cc91cf0c272f5665a819612c694a18b54a-collateral-requirement-1",
"token": {
"symbol": "DRGIV2"
}
}
]
}
}
```
Loading