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

[subgraph-bean] Add Seasons entity to group snapshots #1152

Merged
merged 11 commits into from
Oct 16, 2024
24 changes: 13 additions & 11 deletions projects/subgraph-basin/manifests/arbitrum.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,27 @@ dataSources:
handler: handleBoreWell
file: ../src/handlers/AquiferTemplateHandler.ts
- kind: ethereum/contract
name: Beanstalk
name: HourlySnapshots
network: arbitrum-one
source:
address: "0xD1A0060ba708BC4BCD3DA6C37EFa8deDF015FB70"
abi: Beanstalk
startBlock: 261772156 # Reseed
address: "0xBA51AAAa8C2f911AE672e783707Ceb2dA6E97521"
abi: Aquifer
startBlock: 261000001
mapping:
kind: ethereum/events
apiVersion: 0.0.7
language: wasm/assemblyscript
entities:
- Beanstalk
- Well
abis:
- name: Beanstalk
file: ../../subgraph-core/abis/Beanstalk/Beanstalk-BIP50.json
eventHandlers:
- event: Sunrise(indexed uint256)
handler: handleSunrise
file: ../src/handlers/BeanstalkHandler.ts
- name: Aquifer
file: ../../subgraph-core/abis/Aquifer.json
blockHandlers:
- handler: handleBlock
filter:
kind: polling
every: 1200 # 5 minutes on arbitrum
file: ../src/handlers/HourlySnapshotHandler.ts
templates:
- kind: ethereum/contract
name: Well
Expand Down
24 changes: 13 additions & 11 deletions projects/subgraph-basin/manifests/ethereum.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,27 @@ dataSources:
handler: handleBoreWell
file: ../src/handlers/AquiferTemplateHandler.ts
- kind: ethereum/contract
name: Beanstalk
name: HourlySnapshots
network: mainnet
source:
address: "0xC1E088fC1323b20BCBee9bd1B9fC9546db5624C5"
abi: Beanstalk
startBlock: 17977922
address: "0xBA51AAAA95aeEFc1292515b36D86C51dC7877773"
abi: Aquifer
startBlock: 17977923
mapping:
kind: ethereum/events
apiVersion: 0.0.7
language: wasm/assemblyscript
entities:
- Beanstalk
- Well
abis:
- name: Beanstalk
file: ../../subgraph-core/abis/Beanstalk/Beanstalk-BIP50.json
eventHandlers:
- event: Sunrise(indexed uint256)
handler: handleSunrise
file: ../src/handlers/BeanstalkHandler.ts
- name: Aquifer
file: ../../subgraph-core/abis/Aquifer.json
blockHandlers:
- handler: handleBlock
filter:
kind: polling
every: 25 # 5 minutes on ethereum
file: ../src/handlers/HourlySnapshotHandler.ts
templates:
- kind: ethereum/contract
name: Well
Expand Down
41 changes: 21 additions & 20 deletions projects/subgraph-basin/src/entities/Well.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Address, BigInt, Bytes, ethereum } from "@graphprotocol/graph-ts";
import { Address, BigDecimal, BigInt, Bytes, ethereum } from "@graphprotocol/graph-ts";
import {
Well,
WellDailySnapshot,
Expand Down Expand Up @@ -247,7 +247,7 @@ export function takeWellDailySnapshot(wellAddress: Address, dayID: i32, block: e
let newSnapshot = loadOrCreateWellDailySnapshot(wellAddress, well.lastSnapshotDayID, block);

newSnapshot.deltalpTokenSupply = newSnapshot.lpTokenSupply.minus(priorSnapshot.lpTokenSupply);
newSnapshot.deltaLiquidityUSD = newSnapshot.totalLiquidityUSD.minus(priorSnapshot.totalLiquidityUSD);
newSnapshot.deltaLiquidityUSD = newSnapshot.totalLiquidityUSD.minus(priorSnapshot.totalLiquidityUSD).truncate(2);

newSnapshot.deltaTradeVolumeReserves = subBigIntArray(
newSnapshot.cumulativeTradeVolumeReserves,
Expand All @@ -256,8 +256,8 @@ export function takeWellDailySnapshot(wellAddress: Address, dayID: i32, block: e
newSnapshot.deltaTradeVolumeReservesUSD = subBigDecimalArray(
newSnapshot.cumulativeTradeVolumeReservesUSD,
priorSnapshot.cumulativeTradeVolumeReservesUSD
);
newSnapshot.deltaTradeVolumeUSD = newSnapshot.cumulativeTradeVolumeUSD.minus(priorSnapshot.cumulativeTradeVolumeUSD);
).map<BigDecimal>((bd) => bd.truncate(2));
newSnapshot.deltaTradeVolumeUSD = newSnapshot.cumulativeTradeVolumeUSD.minus(priorSnapshot.cumulativeTradeVolumeUSD).truncate(2);
newSnapshot.deltaBiTradeVolumeReserves = subBigIntArray(
newSnapshot.cumulativeBiTradeVolumeReserves,
priorSnapshot.cumulativeBiTradeVolumeReserves
Expand All @@ -269,8 +269,8 @@ export function takeWellDailySnapshot(wellAddress: Address, dayID: i32, block: e
newSnapshot.deltaTransferVolumeReservesUSD = subBigDecimalArray(
newSnapshot.cumulativeTransferVolumeReservesUSD,
priorSnapshot.cumulativeTransferVolumeReservesUSD
);
newSnapshot.deltaTransferVolumeUSD = newSnapshot.cumulativeTransferVolumeUSD.minus(priorSnapshot.cumulativeTransferVolumeUSD);
).map<BigDecimal>((bd) => bd.truncate(2));
newSnapshot.deltaTransferVolumeUSD = newSnapshot.cumulativeTransferVolumeUSD.minus(priorSnapshot.cumulativeTransferVolumeUSD).truncate(2);

newSnapshot.deltaDepositCount = newSnapshot.cumulativeDepositCount - priorSnapshot.cumulativeDepositCount;
newSnapshot.deltaWithdrawCount = newSnapshot.cumulativeWithdrawCount - priorSnapshot.cumulativeWithdrawCount;
Expand All @@ -285,13 +285,12 @@ export function takeWellHourlySnapshot(wellAddress: Address, hourID: i32, block:

let priorHourID = well.lastSnapshotHourID;
well.lastSnapshotHourID = hourID;
well.save();

let priorSnapshot = loadOrCreateWellHourlySnapshot(wellAddress, priorHourID, block);
let newSnapshot = loadOrCreateWellHourlySnapshot(wellAddress, hourID, block);

newSnapshot.deltalpTokenSupply = newSnapshot.lpTokenSupply.minus(priorSnapshot.lpTokenSupply);
newSnapshot.deltaLiquidityUSD = newSnapshot.totalLiquidityUSD.minus(priorSnapshot.totalLiquidityUSD);
newSnapshot.deltaLiquidityUSD = newSnapshot.totalLiquidityUSD.minus(priorSnapshot.totalLiquidityUSD).truncate(2);

newSnapshot.deltaTradeVolumeReserves = subBigIntArray(
newSnapshot.cumulativeTradeVolumeReserves,
Expand All @@ -300,8 +299,8 @@ export function takeWellHourlySnapshot(wellAddress: Address, hourID: i32, block:
newSnapshot.deltaTradeVolumeReservesUSD = subBigDecimalArray(
newSnapshot.cumulativeTradeVolumeReservesUSD,
priorSnapshot.cumulativeTradeVolumeReservesUSD
);
newSnapshot.deltaTradeVolumeUSD = newSnapshot.cumulativeTradeVolumeUSD.minus(priorSnapshot.cumulativeTradeVolumeUSD);
).map<BigDecimal>((bd) => bd.truncate(2));
newSnapshot.deltaTradeVolumeUSD = newSnapshot.cumulativeTradeVolumeUSD.minus(priorSnapshot.cumulativeTradeVolumeUSD).truncate(2);
newSnapshot.deltaBiTradeVolumeReserves = subBigIntArray(
newSnapshot.cumulativeBiTradeVolumeReserves,
priorSnapshot.cumulativeBiTradeVolumeReserves
Expand All @@ -313,8 +312,8 @@ export function takeWellHourlySnapshot(wellAddress: Address, hourID: i32, block:
newSnapshot.deltaTransferVolumeReservesUSD = subBigDecimalArray(
newSnapshot.cumulativeTransferVolumeReservesUSD,
priorSnapshot.cumulativeTransferVolumeReservesUSD
);
newSnapshot.deltaTransferVolumeUSD = newSnapshot.cumulativeTransferVolumeUSD.minus(priorSnapshot.cumulativeTransferVolumeUSD);
).map<BigDecimal>((bd) => bd.truncate(2));
newSnapshot.deltaTransferVolumeUSD = newSnapshot.cumulativeTransferVolumeUSD.minus(priorSnapshot.cumulativeTransferVolumeUSD).truncate(2);

newSnapshot.deltaDepositCount = newSnapshot.cumulativeDepositCount - priorSnapshot.cumulativeDepositCount;
newSnapshot.deltaWithdrawCount = newSnapshot.cumulativeWithdrawCount - priorSnapshot.cumulativeWithdrawCount;
Expand All @@ -332,8 +331,8 @@ export function takeWellHourlySnapshot(wellAddress: Address, hourID: i32, block:
well.rollingDailyTradeVolumeReservesUSD = subBigDecimalArray(
well.rollingDailyTradeVolumeReservesUSD,
oldest24h.deltaTradeVolumeReservesUSD
);
well.rollingDailyTradeVolumeUSD = well.rollingDailyTradeVolumeUSD.minus(oldest24h.deltaTradeVolumeUSD);
).map<BigDecimal>((bd) => bd.truncate(2));
well.rollingDailyTradeVolumeUSD = well.rollingDailyTradeVolumeUSD.minus(oldest24h.deltaTradeVolumeUSD).truncate(2);
well.rollingDailyBiTradeVolumeReserves = subBigIntArray(well.rollingDailyBiTradeVolumeReserves, oldest24h.deltaBiTradeVolumeReserves);
well.rollingDailyTransferVolumeReserves = subBigIntArray(
well.rollingDailyTransferVolumeReserves,
Expand All @@ -342,15 +341,15 @@ export function takeWellHourlySnapshot(wellAddress: Address, hourID: i32, block:
well.rollingDailyTransferVolumeReservesUSD = subBigDecimalArray(
well.rollingDailyTransferVolumeReservesUSD,
oldest24h.deltaTransferVolumeReservesUSD
);
well.rollingDailyTransferVolumeUSD = well.rollingDailyTransferVolumeUSD.minus(oldest24h.deltaTransferVolumeUSD);
).map<BigDecimal>((bd) => bd.truncate(2));
well.rollingDailyTransferVolumeUSD = well.rollingDailyTransferVolumeUSD.minus(oldest24h.deltaTransferVolumeUSD).truncate(2);
if (oldest7d != null) {
well.rollingWeeklyTradeVolumeReserves = subBigIntArray(well.rollingWeeklyTradeVolumeReserves, oldest7d.deltaTradeVolumeReserves);
well.rollingWeeklyTradeVolumeReservesUSD = subBigDecimalArray(
well.rollingWeeklyTradeVolumeReservesUSD,
oldest7d.deltaTradeVolumeReservesUSD
);
well.rollingWeeklyTradeVolumeUSD = well.rollingWeeklyTradeVolumeUSD.minus(oldest7d.deltaTradeVolumeUSD);
).map<BigDecimal>((bd) => bd.truncate(2));
well.rollingWeeklyTradeVolumeUSD = well.rollingWeeklyTradeVolumeUSD.minus(oldest7d.deltaTradeVolumeUSD).truncate(2);
well.rollingWeeklyBiTradeVolumeReserves = subBigIntArray(
well.rollingWeeklyBiTradeVolumeReserves,
oldest7d.deltaBiTradeVolumeReserves
Expand All @@ -362,9 +361,11 @@ export function takeWellHourlySnapshot(wellAddress: Address, hourID: i32, block:
well.rollingWeeklyTransferVolumeReservesUSD = subBigDecimalArray(
well.rollingWeeklyTransferVolumeReservesUSD,
oldest7d.deltaTransferVolumeReservesUSD
);
well.rollingWeeklyTransferVolumeUSD = well.rollingWeeklyTransferVolumeUSD.minus(oldest7d.deltaTransferVolumeUSD);
).map<BigDecimal>((bd) => bd.truncate(2));
well.rollingWeeklyTransferVolumeUSD = well.rollingWeeklyTransferVolumeUSD.minus(oldest7d.deltaTransferVolumeUSD).truncate(2);
}
}
well.lastUpdateTimestamp = block.timestamp;
well.lastUpdateBlockNumber = block.number;
well.save();
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import { v } from "../utils/constants/Version";
import { Sunrise } from "../../generated/Basin-ABIs/Beanstalk";
import { ethereum } from "@graphprotocol/graph-ts";
import { checkForSnapshot } from "../utils/Well";
import { getAquifer } from "../../../subgraph-core/constants/RuntimeConstants";
import { toAddress } from "../../../subgraph-core/utils/Bytes";
import { loadOrCreateAquifer } from "../entities/WellComponents";
import { v } from "../utils/constants/Version";
import { getAquifer } from "../../../subgraph-core/constants/RuntimeConstants";

export function handleSunrise(event: Sunrise): void {
// Right now this is a manual list of aquifers that are checked for deployments and wells updated
// Keeping this manual is reasonable as each aquifer has to be defined as a datasource in subgraph.yaml

// Used to take hourly snapshots in the absense of pool trading activity.
// This handler should be configured for infrequent polling
export function handleBlock(block: ethereum.Block): void {
const aquifer = loadOrCreateAquifer(getAquifer(v()));
const wells = aquifer.wells.load();

for (let i = 0; i < wells.length; i++) {
checkForSnapshot(toAddress(wells[i].id), event.block);
checkForSnapshot(toAddress(wells[i].id), block);
}
}
24 changes: 12 additions & 12 deletions projects/subgraph-basin/src/utils/Volume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,16 @@ function updateVolumeStats(well: Well, deltaTradeVolumeReserves: BigInt[], delta
rollingWeeklyTransferVolumeReserves[i] = rollingWeeklyTransferVolumeReserves[i].plus(deltaTransferVolumeReserves[i].abs());
let usdTransferAmount = toDecimal(deltaTransferVolumeReserves[i].abs(), tokenInfo.decimals).times(tokenInfo.lastPriceUSD);

tradeVolumeReservesUSD[i] = tradeVolumeReservesUSD[i].plus(usdTradeAmount);
rollingDailyTradeVolumeReservesUSD[i] = rollingDailyTradeVolumeReservesUSD[i].plus(usdTradeAmount);
rollingWeeklyTradeVolumeReservesUSD[i] = rollingWeeklyTradeVolumeReservesUSD[i].plus(usdTradeAmount);
tradeVolumeReservesUSD[i] = tradeVolumeReservesUSD[i].plus(usdTradeAmount).truncate(2);
rollingDailyTradeVolumeReservesUSD[i] = rollingDailyTradeVolumeReservesUSD[i].plus(usdTradeAmount).truncate(2);
rollingWeeklyTradeVolumeReservesUSD[i] = rollingWeeklyTradeVolumeReservesUSD[i].plus(usdTradeAmount).truncate(2);

transferVolumeReservesUSD[i] = transferVolumeReservesUSD[i].plus(usdTransferAmount);
rollingDailyTransferVolumeReservesUSD[i] = rollingDailyTransferVolumeReservesUSD[i].plus(usdTransferAmount);
rollingWeeklyTransferVolumeReservesUSD[i] = rollingWeeklyTransferVolumeReservesUSD[i].plus(usdTransferAmount);
transferVolumeReservesUSD[i] = transferVolumeReservesUSD[i].plus(usdTransferAmount).truncate(2);
rollingDailyTransferVolumeReservesUSD[i] = rollingDailyTransferVolumeReservesUSD[i].plus(usdTransferAmount).truncate(2);
rollingWeeklyTransferVolumeReservesUSD[i] = rollingWeeklyTransferVolumeReservesUSD[i].plus(usdTransferAmount).truncate(2);

totalTradeUSD = totalTradeUSD.plus(usdTradeAmount);
totalTransferUSD = totalTransferUSD.plus(usdTransferAmount);
totalTradeUSD = totalTradeUSD.plus(usdTradeAmount).truncate(2);
totalTransferUSD = totalTransferUSD.plus(usdTransferAmount).truncate(2);
}

well.cumulativeTradeVolumeReserves = tradeVolumeReserves;
Expand All @@ -154,19 +154,19 @@ function updateVolumeStats(well: Well, deltaTradeVolumeReserves: BigInt[], delta
// but this is preferable to having the most recent values being delayed.
well.rollingDailyTradeVolumeReserves = rollingDailyTradeVolumeReserves;
well.rollingDailyTradeVolumeReservesUSD = rollingDailyTradeVolumeReservesUSD;
well.rollingDailyTradeVolumeUSD = well.rollingDailyTradeVolumeUSD.plus(totalTradeUSD);
well.rollingDailyTradeVolumeUSD = well.rollingDailyTradeVolumeUSD.plus(totalTradeUSD).truncate(2);
well.rollingDailyBiTradeVolumeReserves = rollingDailyBiTradeVolumeReserves;
well.rollingDailyTransferVolumeReserves = rollingDailyTransferVolumeReserves;
well.rollingDailyTransferVolumeReservesUSD = rollingDailyTransferVolumeReservesUSD;
well.rollingDailyTransferVolumeUSD = well.rollingDailyTransferVolumeUSD.plus(totalTransferUSD);
well.rollingDailyTransferVolumeUSD = well.rollingDailyTransferVolumeUSD.plus(totalTransferUSD).truncate(2);

well.rollingWeeklyTradeVolumeReserves = rollingWeeklyTradeVolumeReserves;
well.rollingWeeklyTradeVolumeReservesUSD = rollingWeeklyTradeVolumeReservesUSD;
well.rollingWeeklyTradeVolumeUSD = well.rollingWeeklyTradeVolumeUSD.plus(totalTradeUSD);
well.rollingWeeklyTradeVolumeUSD = well.rollingWeeklyTradeVolumeUSD.plus(totalTradeUSD).truncate(2);
well.rollingWeeklyBiTradeVolumeReserves = rollingWeeklyBiTradeVolumeReserves;
well.rollingWeeklyTransferVolumeReserves = rollingWeeklyTransferVolumeReserves;
well.rollingWeeklyTransferVolumeReservesUSD = rollingWeeklyTransferVolumeReservesUSD;
well.rollingWeeklyTransferVolumeUSD = well.rollingWeeklyTransferVolumeUSD.plus(totalTransferUSD);
well.rollingWeeklyTransferVolumeUSD = well.rollingWeeklyTransferVolumeUSD.plus(totalTransferUSD).truncate(2);
}

// Returns the provided token amounts in their appropriate position with respect to well reserve tokens
Expand Down
4 changes: 2 additions & 2 deletions projects/subgraph-basin/src/utils/Well.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ export function updateWellTokenUSDPrices(wellAddress: Address, blockNumber: BigI
}
}

well.reservesUSD = getCalculatedReserveUSDValues(well.tokens, well.reserves);
well.totalLiquidityUSD = getBigDecimalArrayTotal(well.reservesUSD);
well.reservesUSD = getCalculatedReserveUSDValues(well.tokens, well.reserves).map<BigDecimal>((bd) => bd.truncate(2));
well.totalLiquidityUSD = getBigDecimalArrayTotal(well.reservesUSD).truncate(2);
well.save();
}

Expand Down
2 changes: 1 addition & 1 deletion projects/subgraph-basin/src/utils/constants/Version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as BeanstalkArb from "../../../../subgraph-core/constants/raw/Beanstalk

export function handleInitVersion(block: ethereum.Block): void {
const versionEntity = new Version("subgraph");
versionEntity.versionNumber = "3.1.0";
versionEntity.versionNumber = "3.1.1";
versionEntity.subgraphName = subgraphNameForBlockNumber(block.number);
versionEntity.protocolAddress = protocolForBlockNumber(block.number);
versionEntity.chain = chainForBlockNumber(block.number);
Expand Down
33 changes: 15 additions & 18 deletions projects/subgraph-basin/tests/Exchange.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { dayFromTimestamp, hourFromTimestamp } from "../../subgraph-core/utils/D
import { BigDecimal, BigInt } from "@graphprotocol/graph-ts";
import { BEAN_ERC20 } from "../../subgraph-core/constants/raw/BeanstalkEthConstants";
import { initL1Version } from "./entity-mocking/MockVersion";
import { assertBDClose } from "../../subgraph-core/tests/Assert";

describe("Well Entity: Exchange Tests", () => {
beforeEach(() => {
Expand Down Expand Up @@ -66,15 +67,13 @@ describe("Well Entity: Exchange Tests", () => {
let transferAmounts = updatedStore.cumulativeTransferVolumeReservesUSD;

assert.stringEquals("0", tradeAmounts[0].toString());
assert.stringEquals(WETH_USD_AMOUNT.times(BigDecimal.fromString("1.5")).toString(), tradeAmounts[1].toString());
assert.stringEquals(BEAN_USD_AMOUNT.times(BigDecimal.fromString("2.5")).toString(), transferAmounts[0].toString());
assert.stringEquals(WETH_USD_AMOUNT.times(BigDecimal.fromString("3.5")).toString(), transferAmounts[1].toString());
assert.stringEquals(WETH_USD_AMOUNT.times(BigDecimal.fromString("1.5")).toString(), updatedStore.cumulativeTradeVolumeUSD.toString());
assert.stringEquals(
BEAN_USD_AMOUNT.times(BigDecimal.fromString("2.5"))
.plus(WETH_USD_AMOUNT.times(BigDecimal.fromString("3.5")))
.toString(),
updatedStore.cumulativeTransferVolumeUSD.toString()
assertBDClose(WETH_USD_AMOUNT.times(BigDecimal.fromString("1.5")), tradeAmounts[1]);
assertBDClose(BEAN_USD_AMOUNT.times(BigDecimal.fromString("2.5")), transferAmounts[0]);
assertBDClose(WETH_USD_AMOUNT.times(BigDecimal.fromString("3.5")), transferAmounts[1]);
assertBDClose(WETH_USD_AMOUNT.times(BigDecimal.fromString("1.5")), updatedStore.cumulativeTradeVolumeUSD);
assertBDClose(
BEAN_USD_AMOUNT.times(BigDecimal.fromString("2.5")).plus(WETH_USD_AMOUNT.times(BigDecimal.fromString("3.5"))),
updatedStore.cumulativeTransferVolumeUSD
);
});
test("Previous day snapshot entity created", () => {
Expand Down Expand Up @@ -123,16 +122,14 @@ describe("Well Entity: Exchange Tests", () => {
let tradeAmounts = updatedStore.cumulativeTradeVolumeReservesUSD;
let transferAmounts = updatedStore.cumulativeTransferVolumeReservesUSD;

assert.stringEquals(BEAN_USD_AMOUNT.times(BigDecimal.fromString("1.5")).toString(), tradeAmounts[0].toString());
assertBDClose(BEAN_USD_AMOUNT.times(BigDecimal.fromString("1.5")), tradeAmounts[0]);
assert.stringEquals("0", tradeAmounts[1].toString());
assert.stringEquals(BEAN_USD_AMOUNT.times(BigDecimal.fromString("3.5")).toString(), transferAmounts[0].toString());
assert.stringEquals(WETH_USD_AMOUNT.times(BigDecimal.fromString("2.5")).toString(), transferAmounts[1].toString());
assert.stringEquals(BEAN_USD_AMOUNT.times(BigDecimal.fromString("1.5")).toString(), updatedStore.cumulativeTradeVolumeUSD.toString());
assert.stringEquals(
BEAN_USD_AMOUNT.times(BigDecimal.fromString("3.5"))
.plus(WETH_USD_AMOUNT.times(BigDecimal.fromString("2.5")))
.toString(),
updatedStore.cumulativeTransferVolumeUSD.toString()
assertBDClose(BEAN_USD_AMOUNT.times(BigDecimal.fromString("3.5")), transferAmounts[0]);
assertBDClose(WETH_USD_AMOUNT.times(BigDecimal.fromString("2.5")), transferAmounts[1]);
assertBDClose(BEAN_USD_AMOUNT.times(BigDecimal.fromString("1.5")), updatedStore.cumulativeTradeVolumeUSD);
assertBDClose(
BEAN_USD_AMOUNT.times(BigDecimal.fromString("3.5")).plus(WETH_USD_AMOUNT.times(BigDecimal.fromString("2.5"))),
updatedStore.cumulativeTransferVolumeUSD
);
});
});
Expand Down
Loading
Loading