Skip to content

Commit

Permalink
add transaction hash to harvests
Browse files Browse the repository at this point in the history
  • Loading branch information
ReflectiveChimp committed Jul 13, 2024
1 parent c3cc977 commit 643cbbb
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/queries/VaultHarvests.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
fragment HarvestData on ClmHarvestEvent {
timestamp
compoundedAmount0
compoundedAmount1
token0ToNativePrice
token1ToNativePrice
nativeToUSDPrice
totalSupply: managerTotalSupply
createdWith {
id
}
}

query VaultHarvests($vault_address: ID!) {
clm(id: $vault_address) {
underlyingToken0 {
Expand All @@ -10,13 +23,7 @@ query VaultHarvests($vault_address: ID!) {
decimals
}
harvests(orderBy: timestamp, orderDirection: desc, first: 1000) {
timestamp
compoundedAmount0
compoundedAmount1
token0ToNativePrice
token1ToNativePrice
nativeToUSDPrice
totalSupply: managerTotalSupply
...HarvestData
}
}
}
3 changes: 3 additions & 0 deletions src/queries/VaultsHarvests.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ fragment HarvestData on ClmHarvestEvent {
token1ToNativePrice
nativeToUSDPrice
totalSupply: managerTotalSupply
createdWith {
id
}
}

query VaultsHarvests($since: BigInt!, $first: Int = 1000, $skip: Int = 0) {
Expand Down
3 changes: 3 additions & 0 deletions src/queries/VaultsHarvestsFiltered.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ fragment HarvestData on ClmHarvestEvent {
token1ToNativePrice
nativeToUSDPrice
totalSupply: managerTotalSupply
createdWith {
id
}
}

query VaultsHarvestsFiltered(
Expand Down
2 changes: 2 additions & 0 deletions src/routes/v1/vault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ export const vaultHarvestSchema = Type.Object({
token0ToUsd: setOpts(bigDecimalSchema, { description: 'The price of token0 in USD' }),
token1ToUsd: setOpts(bigDecimalSchema, { description: 'The price of token1 in USD' }),
totalSupply: setOpts(bigDecimalSchema, { description: 'The total supply of the vault' }),
transactionHash: Type.String({ description: 'Transaction hash of the harvest' }),
});
export type VaultHarvest = Static<typeof vaultHarvestSchema>;
const vaultHarvestsSchema = Type.Array(vaultHarvestSchema);
Expand Down Expand Up @@ -307,6 +308,7 @@ export function prepareVaultHarvests(vault: {
token0ToUsd: token0ToNativePrice.mul(nativeToUsd).toString(),
token1ToUsd: token1ToNativePrice.mul(nativeToUsd).toString(),
totalSupply: totalSupply.toString(),
transactionHash: harvest.createdWith.id,
};
});
}
Expand Down

0 comments on commit 643cbbb

Please sign in to comment.