Skip to content

Commit

Permalink
normalize snapshot timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
soilking committed Oct 8, 2024
1 parent d01479e commit 1fa2fce
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions projects/subgraph-beanstalk/src/entities/snapshots/Field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export function takeFieldSnapshots(field: Field, block: ethereum.Block): void {
hourly.seasonBlock = block.number;
hourly.soilSoldOut = false;
}
hourly.createdAt = hour;
hourly.createdAt = hour.times(BigInt.fromU32(3600));
hourly.updatedAt = block.timestamp;
hourly.save();

Expand Down Expand Up @@ -182,7 +182,7 @@ export function takeFieldSnapshots(field: Field, block: ethereum.Block): void {
daily.issuedSoil = field.soil;
daily.deltaIssuedSoil = field.soil;
}
daily.createdAt = day;
daily.createdAt = day.times(BigInt.fromU32(86400));
daily.updatedAt = block.timestamp;
daily.save();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export function takeMarketSnapshots(market: PodMarketplace, block: ethereum.Bloc
hourly.deltaPodVolume = hourly.podVolume;
hourly.deltaBeanVolume = hourly.beanVolume;
}
hourly.createdAt = hour;
hourly.createdAt = hour.times(BigInt.fromU32(3600));
hourly.updatedAt = block.timestamp;
hourly.save();

Expand Down Expand Up @@ -148,7 +148,7 @@ export function takeMarketSnapshots(market: PodMarketplace, block: ethereum.Bloc
daily.deltaPodVolume = daily.podVolume;
daily.deltaBeanVolume = daily.beanVolume;
}
daily.createdAt = day;
daily.createdAt = day.times(BigInt.fromU32(86400));
daily.updatedAt = block.timestamp;
daily.save();

Expand Down
4 changes: 2 additions & 2 deletions projects/subgraph-beanstalk/src/entities/snapshots/Silo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export function takeSiloSnapshots(silo: Silo, block: ethereum.Block): void {
hourly.deltaBeanMints = hourly.beanMints;
hourly.deltaActiveFarmers = hourly.activeFarmers;
}
hourly.createdAt = hour;
hourly.createdAt = hour.times(BigInt.fromU32(3600));
hourly.updatedAt = block.timestamp;
hourly.save();

Expand Down Expand Up @@ -124,7 +124,7 @@ export function takeSiloSnapshots(silo: Silo, block: ethereum.Block): void {
daily.deltaBeanMints = daily.beanMints;
daily.deltaActiveFarmers = daily.activeFarmers;
}
daily.createdAt = day;
daily.createdAt = day.times(BigInt.fromU32(86400));
daily.updatedAt = block.timestamp;
daily.save();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function takeSiloAssetSnapshots(siloAsset: SiloAsset, block: ethereum.Blo
hourly.deltaWithdrawnAmount = hourly.withdrawnAmount;
hourly.deltaFarmAmount = hourly.farmAmount;
}
hourly.createdAt = hour;
hourly.createdAt = hour.times(BigInt.fromU32(3600));
hourly.updatedAt = block.timestamp;
hourly.save();

Expand Down Expand Up @@ -84,7 +84,7 @@ export function takeSiloAssetSnapshots(siloAsset: SiloAsset, block: ethereum.Blo
daily.deltaWithdrawnAmount = daily.withdrawnAmount;
daily.deltaFarmAmount = daily.farmAmount;
}
daily.createdAt = day;
daily.createdAt = day.times(BigInt.fromU32(86400));
daily.updatedAt = block.timestamp;
daily.save();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export function takeUnripeTokenSnapshots(unripeToken: UnripeToken, block: ethere
hourly.deltaTotalChoppedBdv = hourly.totalChoppedBdv;
hourly.deltaTotalChoppedBdvReceived = hourly.totalChoppedBdvReceived;
}
hourly.createdAt = hour;
hourly.createdAt = hour.times(BigInt.fromU32(3600));
hourly.updatedAt = block.timestamp;
hourly.save();

Expand Down Expand Up @@ -140,7 +140,7 @@ export function takeUnripeTokenSnapshots(unripeToken: UnripeToken, block: ethere
daily.deltaTotalChoppedBdv = daily.totalChoppedBdv;
daily.deltaTotalChoppedBdvReceived = daily.totalChoppedBdvReceived;
}
daily.createdAt = day;
daily.createdAt = day.times(BigInt.fromU32(86400));
daily.updatedAt = block.timestamp;
daily.save();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export function takeWhitelistTokenSettingSnapshots(whitelistTokenSetting: Whitel
hourly.deltaGaugePoints = hourly.gaugePoints;
hourly.deltaOptimalPercentDepositedBdv = hourly.optimalPercentDepositedBdv;
}
hourly.createdAt = hour;
hourly.createdAt = hour.times(BigInt.fromU32(3600));
hourly.updatedAt = block.timestamp;
hourly.save();

Expand Down Expand Up @@ -138,7 +138,7 @@ export function takeWhitelistTokenSettingSnapshots(whitelistTokenSetting: Whitel
daily.deltaGaugePoints = daily.gaugePoints;
daily.deltaOptimalPercentDepositedBdv = daily.optimalPercentDepositedBdv;
}
daily.createdAt = day;
daily.createdAt = day.times(BigInt.fromU32(86400));
daily.updatedAt = block.timestamp;
daily.save();

Expand Down

0 comments on commit 1fa2fce

Please sign in to comment.