Skip to content
Open
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
6 changes: 4 additions & 2 deletions src/strategies/strategies/wagdie-subgraph/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ The space config will look like this:

```JSON
{
// subgraphURL for the request
"subGraphURL": "https://subgrapher.snapshot.org/subgraph/arbitrum/CiuchCqNbcNs88KkbQqs7PwuaD2DrPqHqxuDVKrJ5ESM",
// subgraphURL for the request (The Graph Gateway)
"subGraphURL": "https://gateway.thegraph.com/api/subgraphs/id/CiuchCqNbcNs88KkbQqs7PwuaD2DrPqHqxuDVKrJ5ESM",
// Optional API key for The Graph Gateway; adds Authorization header
"apiKey": "YOUR_API_KEY_HERE",
// scoreMultiplier can be used to increase users' scores by a certain magnitude
"scoreMultiplier": 1,
// Array of location IDs to limit votes to specific locations. Can be set to ["all"] to include all locations.
Expand Down
5 changes: 3 additions & 2 deletions src/strategies/strategies/wagdie-subgraph/examples.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"strategy": {
"name": "wagdie-subgraph",
"params": {
"subGraphURL": "https://subgrapher.snapshot.org/subgraph/arbitrum/CiuchCqNbcNs88KkbQqs7PwuaD2DrPqHqxuDVKrJ5ESM",
"subGraphURL": "https://gateway.thegraph.com/api/subgraphs/id/CiuchCqNbcNs88KkbQqs7PwuaD2DrPqHqxuDVKrJ5ESM",
"apiKey": "EXAMPLE_API_KEY",
"scoreMultiplier": 1,
"location": ["all"]
}
Expand All @@ -16,6 +17,6 @@
"0x4F0EceDCd73dA0315134741d9D3830B08fE32e95",
"0xa027b41dc6fe7abec1b6ac69335383604766623c"
],
"snapshot": 16470969
"snapshot": 23363853
}
]
13 changes: 9 additions & 4 deletions src/strategies/strategies/wagdie-subgraph/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { getAddress } from '@ethersproject/address';
import { subgraphRequest } from '../../utils';

const SUBGRAPH_URL = {
'1': 'https://subgrapher.snapshot.org/subgraph/arbitrum/CiuchCqNbcNs88KkbQqs7PwuaD2DrPqHqxuDVKrJ5ESM'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @LookingForOwls it should work with this URL, i think the real problem is that this subgraph doesn't support historical queries, if you are are the owner of the subgraph, you'd need to redeploy with prune: never

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok will test this out. Thank you.

// Default to the WAGDIE World Subgraph
'1': 'https://gateway.thegraph.com/api/subgraphs/id/CiuchCqNbcNs88KkbQqs7PwuaD2DrPqHqxuDVKrJ5ESM'
};

export async function strategy(
Expand All @@ -19,8 +20,8 @@ export async function strategy(
scores[getAddress(address)] = 0;
}

// If graph doesn't exist return
if (!SUBGRAPH_URL[network]) {
// If no subgraph URL is provided or known for this network, return
if (!options?.subGraphURL && !SUBGRAPH_URL[network]) {
return scores;
}

Expand Down Expand Up @@ -56,7 +57,11 @@ export async function strategy(

let hasNext = true;
while (hasNext) {
const result = await subgraphRequest(SUBGRAPH_URL[network], params);
const url = options?.subGraphURL || SUBGRAPH_URL[network];
const requestOptions = options?.apiKey
? { headers: { Authorization: `Bearer ${options.apiKey}` } }
: undefined;
const result = await subgraphRequest(url, params, requestOptions);

const characters = result && result.characters ? result.characters : [];
const latest = characters[characters.length - 1];
Expand Down
2 changes: 1 addition & 1 deletion src/strategies/strategies/wagdie-subgraph/manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Wagdie Subgraph",
"author": "IcculusHerEmissary",
"version": "0.2.0"
"version": "0.3.0"
}
Loading