Skip to content

Commit

Permalink
Remove pawnshop info from subgraph request
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandersazonof committed Oct 31, 2024
1 parent e244dfa commit 17b54b0
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 47 deletions.
19 changes: 0 additions & 19 deletions src/strategies/sacra-subgraph/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,4 @@ Calculates users power by hero score from Sacra subgraph.
) {
score
}
pawnshopPositionEntities(
where:{
borrower: $address
open: true
collateralHero_not: null
}
orderBy: collateralHero__score
orderDirection: desc
first: 1000
) {
collateralHero {
score
}
borrower {
id
}
}
```
28 changes: 0 additions & 28 deletions src/strategies/sacra-subgraph/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,6 @@ export async function strategy(
user: {
id: true
}
},
pawnshopPositionEntities: {
__args: {
where: {
borrower_in: addresses.map((address) => address.toLowerCase()),
open: true,
collateralHero_not: null
},
orderBy: 'collateralHero__score',
orderDirection: 'desc',
first: 1000
},
collateralHero: {
score: true
},
borrower: {
id: true
}
}
};

Expand All @@ -77,8 +59,6 @@ export async function strategy(
queryOne.heroEntities.__args.block = { number: snapshot };
// @ts-ignore
queryOne.itemEntities.__args.block = { number: snapshot };
// @ts-ignore
queryOne.pawnshopPositionEntities.__args.block = { number: snapshot };
}

const queryResultOne = await subgraphRequest(SUBGRAPH_URL[network], queryOne);
Expand All @@ -100,14 +80,6 @@ export async function strategy(
const score = itemEntity.score;
scores[userAddress] = (scores[userAddress] ?? 0) + score;
}
const pawnshopHeroEntities = queryResultOne.pawnshopPositionEntities
? queryResultOne.pawnshopPositionEntities
: [];
for (const pawnshopHeroEntity of pawnshopHeroEntities) {
const userAddress = getAddress(pawnshopHeroEntity.borrower.id);
const score = pawnshopHeroEntity.collateralHero.score;
scores[userAddress] = (scores[userAddress] ?? 0) + score;
}
}

return scores || {};
Expand Down

0 comments on commit 17b54b0

Please sign in to comment.