Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional harvest fields #1

Closed
wants to merge 2 commits into from
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
8 changes: 8 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,14 @@ type BeefyCLVaultHarvestEvent @entity(immutable: true) {

"Total usd value of the harvest"
harvestValueUSD: BigDecimal!

"The vault's balance of token0 at time of harvest"
underlyingBalance0: BigDecimal!
"The vault's balance of token1 at time of harvest"
underlyingBalance1: BigDecimal!

"The price of token0 in token1 at time of harvest"
priceOfToken0InToken1: BigDecimal!
}

#######################
Expand Down
3 changes: 3 additions & 0 deletions src/harvest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ export function handleStrategyHarvest(event: HarvestEvent): void {
harvest.harvestedAmount0USD = harvest.harvestedAmount0.times(token0PriceInUSD)
harvest.harvestedAmount1USD = harvest.harvestedAmount1.times(token1PriceInUSD)
harvest.harvestValueUSD = harvest.harvestedAmount0USD.plus(harvest.harvestedAmount1USD)
harvest.underlyingBalance0 = vaultBalanceUnderlying0
harvest.underlyingBalance1 = vaultBalanceUnderlying1
harvest.priceOfToken0InToken1 = currentPriceInToken1
harvest.save()

vault.currentPriceOfToken0InToken1 = currentPriceInToken1
Expand Down
Loading