Skip to content

Commit

Permalink
Add fee collected event
Browse files Browse the repository at this point in the history
  • Loading branch information
prevostc committed Mar 23, 2024
1 parent eef81ff commit afb7ed6
Show file tree
Hide file tree
Showing 5 changed files with 271 additions and 61 deletions.
51 changes: 47 additions & 4 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -466,25 +466,21 @@ type BeefyCLVaultHarvestEvent @entity(immutable: true) {
underlyingAmount0: BigDecimal!
"Underlying balance of the second token after the harvest"
underlyingAmount1: BigDecimal!

"Underlying balance of the first token after the harvest in USD"
underlyingAmount0USD: BigDecimal!
"Underlying balance of the second token after the harvest in USD"
underlyingAmount1USD: BigDecimal!

"Total value locked in the vault after the harvest in USD"
totalValueLockedUSD: BigDecimal!

"The amount of first underlying tokens harvested"
harvestedAmount0: BigDecimal!
"The amount of second underlying tokens harvested"
harvestedAmount1: BigDecimal!

"The amount of first underlying tokens harvested in USD"
harvestedAmount0USD: BigDecimal!
"The amount of second underlying tokens harvested in USD"
harvestedAmount1USD: BigDecimal!

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

Expand All @@ -494,6 +490,53 @@ type BeefyCLVaultHarvestEvent @entity(immutable: true) {
priceOfToken0InUSD: BigDecimal!
}

"""
This event is emitted when we collect earned trading fees from the underlying pool.
It has a different meaning as the harvest event as we may collect fees on multiple occasions, including on harvest.
"""
type BeefyCLVaultUnderlyingFeesCollectedEvent @entity(immutable: true) {
"transaction hash + log index"
id: Bytes!

"The vault the harvest event is for"
vault: BeefyCLVault!
"The strategy that harvested the vault"
strategy: BeefyCLStrategy!

"The transaction that created the vault harvest event"
createdWith: Transaction!

"The timestamp of the harvest event so you can sort by time"
timestamp: BigInt!

"Underlying balance of the first token after the harvest"
underlyingAmount0: BigDecimal!
"Underlying balance of the second token after the harvest"
underlyingAmount1: BigDecimal!
"Underlying balance of the first token after the harvest in USD"
underlyingAmount0USD: BigDecimal!
"Underlying balance of the second token after the harvest in USD"
underlyingAmount1USD: BigDecimal!
"Total value locked in the vault after the harvest in USD"
totalValueLockedUSD: BigDecimal!

"Amount of collected fees in the first token"
collectedAmount0: BigDecimal!
"Amount of collected fees in the second token"
collectedAmount1: BigDecimal!
"Amount of collected fees in the first token in USD"
collectedAmount0USD: BigDecimal!
"Amount of collected fees in the second token in USD"
collectedAmount1USD: BigDecimal!
"Total usd value of the collected fees"
collectedValueUSD: BigDecimal!

"Price of the first token in expressed as the second token at the time of the harvest"
priceOfToken0InToken1: BigDecimal!
"Price of the first token in USD at the time of the harvest"
priceOfToken0InUSD: BigDecimal!
}

#######################
##### CL Incentive ####
#######################
Expand Down
7 changes: 5 additions & 2 deletions src/mapping/strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ export {
handleStrategyUnpaused as handleUnpaused,
} from "../vault-lifecycle"
export { handleStrategyOwnershipTransferred as handleOwnershipTransferred } from "../ownership"
export { handleStrategyHarvest as handleHarvest } from "../harvest"
export { handleChargedFees } from "../vault-fees"
export {
handleStrategyHarvest as handleHarvest,
handleStrategyClaimedFees as handleClaimedFees,
} from "../vault-compound"
export { handleStrategyChargedFees as handleChargedFees } from "../vault-fees"
export {
handleStrategySetLpToken0ToNativePath as handleSetLpToken0ToNativePath,
handleStrategySetLpToken1ToNativePath as handleSetLpToken1ToNativePath,
Expand Down
Loading

0 comments on commit afb7ed6

Please sign in to comment.