Skip to content

Commit

Permalink
Fix deposited amount mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
soilking committed Sep 24, 2024
1 parent fd03aa6 commit c023cb0
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 11 deletions.
5 changes: 3 additions & 2 deletions projects/subgraph-beanstalk/manifests/ethereum.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,9 @@ dataSources:
handler: handleRemoveWithdrawal
- event: RemoveWithdrawals(indexed address,indexed address,uint32[],uint256)
handler: handleRemoveWithdrawals
# This can continue to occur during v2-v3 migration.
- event: RemoveDeposit(indexed address,indexed address,uint32,uint256)
handler: handleRemoveDeposit_v2
file: ../src/handlers/legacy/LegacySiloHandler.ts
- kind: ethereum/contract
name: LegacySilo-Replanted-SeedGauge
Expand All @@ -467,8 +470,6 @@ dataSources:
eventHandlers:
- event: AddDeposit(indexed address,indexed address,uint32,uint256,uint256)
handler: handleAddDeposit_v2
- event: RemoveDeposit(indexed address,indexed address,uint32,uint256)
handler: handleRemoveDeposit_v2
- event: RemoveDeposits(indexed address,indexed address,uint32[],uint256[],uint256)
handler: handleRemoveDeposits_v2
- event: AddWithdrawal(indexed address,indexed address,uint32,uint256)
Expand Down
44 changes: 38 additions & 6 deletions projects/subgraph-beanstalk/manifests/no-apy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ dataSources:
address: "0xC1E088fC1323b20BCBee9bd1B9fC9546db5624C5"
abi: Reseed
startBlock: 15277986 # Replanted (Silo currently has no support for pre-exploit)
endBlock: 191919191 # Reseed Pause on L1
mapping:
kind: ethereum/events
apiVersion: 0.0.6
Expand Down Expand Up @@ -90,6 +91,32 @@ dataSources:
- event: UpdatedStalkPerBdvPerSeason(indexed address,uint32,uint32)
handler: handleUpdatedStalkPerBdvPerSeason
file: ../src/handlers/SiloHandler.ts
- kind: ethereum/contract
name: LegacySilo-Replanted-Reseed
network: mainnet
source:
address: "0xC1E088fC1323b20BCBee9bd1B9fC9546db5624C5"
abi: SeedGauge
startBlock: 15277986 # Replanted
endBlock: 191919191 # Reseed Pause on L1
mapping:
kind: ethereum/events
apiVersion: 0.0.6
language: wasm/assemblyscript
entities:
- Silo
abis:
- name: SeedGauge
file: ../../subgraph-core/abis/Beanstalk/Beanstalk-BIP45.json
eventHandlers:
- event: RemoveWithdrawal(indexed address,indexed address,uint32,uint256)
handler: handleRemoveWithdrawal
- event: RemoveWithdrawals(indexed address,indexed address,uint32[],uint256)
handler: handleRemoveWithdrawals
# This can continue to occur during v2-v3 migration.
- event: RemoveDeposit(indexed address,indexed address,uint32,uint256)
handler: handleRemoveDeposit_v2
file: ../src/handlers/legacy/LegacySiloHandler.ts
- kind: ethereum/contract
name: LegacySilo-Replanted-SeedGauge
network: mainnet
Expand All @@ -110,8 +137,6 @@ dataSources:
eventHandlers:
- event: AddDeposit(indexed address,indexed address,uint32,uint256,uint256)
handler: handleAddDeposit_v2
- event: RemoveDeposit(indexed address,indexed address,uint32,uint256)
handler: handleRemoveDeposit_v2
- event: RemoveDeposits(indexed address,indexed address,uint32[],uint256[],uint256)
handler: handleRemoveDeposits_v2
- event: AddWithdrawal(indexed address,indexed address,uint32,uint256)
Expand Down Expand Up @@ -170,6 +195,7 @@ dataSources:
address: "0xC1E088fC1323b20BCBee9bd1B9fC9546db5624C5"
abi: SeedGauge
startBlock: 19927634 # SeedGauge
endBlock: 191919191 # Reseed Pause on L1
mapping:
kind: ethereum/events
apiVersion: 0.0.6
Expand All @@ -182,10 +208,6 @@ dataSources:
eventHandlers:
- event: WhitelistToken(indexed address,bytes4,uint32,uint256,bytes4,bytes4,uint128,uint64)
handler: handleWhitelistToken_v4
- event: RemoveWithdrawal(indexed address,indexed address,uint32,uint256)
handler: handleRemoveWithdrawal
- event: RemoveWithdrawals(indexed address,indexed address,uint32[],uint256)
handler: handleRemoveWithdrawals
file: ../src/handlers/legacy/LegacySiloHandler.ts
###
# SEED GAUGE
Expand All @@ -197,6 +219,7 @@ dataSources:
address: "0xC1E088fC1323b20BCBee9bd1B9fC9546db5624C5"
abi: Reseed
startBlock: 19628074
endBlock: 191919191 # Reseed Pause on L1
mapping:
kind: ethereum/events
apiVersion: 0.0.6
Expand Down Expand Up @@ -230,6 +253,7 @@ dataSources:
address: "0xC1E088fC1323b20BCBee9bd1B9fC9546db5624C5"
abi: SeedGauge
startBlock: 19628074
endBlock: 191919191 # Reseed Pause on L1
mapping:
kind: ethereum/events
apiVersion: 0.0.6
Expand Down Expand Up @@ -259,6 +283,7 @@ dataSources:
address: "0xC1E088fC1323b20BCBee9bd1B9fC9546db5624C5"
abi: SeedGauge
startBlock: 12974075 # Field has all-time support
endBlock: 191919191 # Reseed Pause on L1
mapping:
kind: ethereum/events
apiVersion: 0.0.6
Expand Down Expand Up @@ -325,6 +350,7 @@ dataSources:
address: "0xC1E088fC1323b20BCBee9bd1B9fC9546db5624C5"
abi: Reseed
startBlock: 14148509 # BIP-11 Pod Marketplace
endBlock: 191919191 # Reseed Pause on L1
mapping:
kind: ethereum/events
apiVersion: 0.0.6
Expand All @@ -346,6 +372,7 @@ dataSources:
address: "0xC1E088fC1323b20BCBee9bd1B9fC9546db5624C5"
abi: SeedGauge
startBlock: 14148509 # BIP-11 Pod Marketplace
endBlock: 191919191 # Reseed Pause on L1
mapping:
kind: ethereum/events
apiVersion: 0.0.6
Expand Down Expand Up @@ -429,6 +456,7 @@ dataSources:
address: "0x402c84De2Ce49aF88f5e2eF3710ff89bFED36cB6"
abi: Fertilizer
startBlock: 14910573
endBlock: 191919191 # Reseed Pause on L1
mapping:
kind: ethereum/events
apiVersion: 0.0.6
Expand All @@ -453,6 +481,7 @@ dataSources:
address: "0xC1E088fC1323b20BCBee9bd1B9fC9546db5624C5"
abi: Reseed
startBlock: 15277986
endBlock: 191919191 # Reseed Pause on L1
mapping:
kind: ethereum/events
apiVersion: 0.0.6
Expand All @@ -478,6 +507,7 @@ dataSources:
address: "0xC1E088fC1323b20BCBee9bd1B9fC9546db5624C5"
abi: Reseed
startBlock: 12974075
endBlock: 191919191 # Reseed Pause on L1
mapping:
kind: ethereum/events
apiVersion: 0.0.6
Expand Down Expand Up @@ -506,6 +536,7 @@ dataSources:
address: "0xC1E088fC1323b20BCBee9bd1B9fC9546db5624C5"
abi: Reseed
startBlock: 17671557 # SiloV3
endBlock: 191919191 # Reseed Pause on L1
mapping:
kind: ethereum/events
apiVersion: 0.0.6
Expand Down Expand Up @@ -616,6 +647,7 @@ dataSources:
address: "0xC1E088fC1323b20BCBee9bd1B9fC9546db5624C5"
abi: SeedGauge
startBlock: 12974075
endBlock: 191919191 # Reseed Pause on L1
mapping:
kind: ethereum/events
apiVersion: 0.0.6
Expand Down
6 changes: 3 additions & 3 deletions projects/subgraph-beanstalk/src/handlers/SiloHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { unripeChopped } from "../utils/Barn";
import { beanDecimals, getProtocolToken, isUnripe, stalkDecimals } from "../../../subgraph-core/constants/RuntimeConstants";
import { v } from "../utils/constants/Version";
import { WhitelistToken } from "../../generated/Beanstalk-ABIs/Reseed";
import { BI_10, ZERO_BI } from "../../../subgraph-core/utils/Decimals";
import { BI_10 } from "../../../subgraph-core/utils/Decimals";

export function handleAddDeposit(event: AddDeposit): void {
addDeposits({
Expand Down Expand Up @@ -101,8 +101,8 @@ export function handlePlant(event: Plant): void {
event.address,
event.address,
getProtocolToken(v(), event.block.number),
ZERO_BI.minus(event.params.beans),
ZERO_BI.minus(event.params.beans),
event.params.beans.neg(),
event.params.beans.neg(),
event.block
);
}
Expand Down

0 comments on commit c023cb0

Please sign in to comment.