From b2bb07bafdb14b9e65c063b8398b74f0d305f320 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Brand=C3=A3o?= Date: Tue, 14 Nov 2023 10:40:34 +0000 Subject: [PATCH] Fixes to balance calculations on Aave V3 and Beefy --- core/src/asset-strategies/AaveV3DepositStrategy.ts | 6 +++--- core/src/asset-strategies/BeefyDepositStrategy.ts | 4 ++-- core/tests/protocols/beefy.spec.ts | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/asset-strategies/AaveV3DepositStrategy.ts b/core/src/asset-strategies/AaveV3DepositStrategy.ts index 26306af..b9177dc 100644 --- a/core/src/asset-strategies/AaveV3DepositStrategy.ts +++ b/core/src/asset-strategies/AaveV3DepositStrategy.ts @@ -117,7 +117,7 @@ export class AaveV3DepositStrategy extends InterfaceStrategy { routerOperation.steps.push({ stepAddress: asset.address, stepEncodedCall: IERC20.encodeFunctionData("balanceOf", [ - asset.address, + walletAddress, ]), storeOperations: [ { @@ -156,14 +156,14 @@ export class AaveV3DepositStrategy extends InterfaceStrategy { routerOperation.steps.push({ stepAddress: asset.address, stepEncodedCall: IERC20.encodeFunctionData("balanceOf", [ - asset.address, + walletAddress, ]), storeOperations: [ { storeOpType: StoreOpType.RetrieveResultAddStore, storeNumber: storeNumberTo, offset: balanceOfToOffsets[0], - fraction: newFraction * FRACTION_MULTIPLIER, + fraction: FRACTION_MULTIPLIER, }, { storeOpType: StoreOpType.SubtractStoreFromStore, diff --git a/core/src/asset-strategies/BeefyDepositStrategy.ts b/core/src/asset-strategies/BeefyDepositStrategy.ts index 215e336..d5e72aa 100644 --- a/core/src/asset-strategies/BeefyDepositStrategy.ts +++ b/core/src/asset-strategies/BeefyDepositStrategy.ts @@ -134,7 +134,7 @@ export class BeefyDepositStrategy extends InterfaceStrategy { routerOperation.steps.push({ stepAddress: asset.address, stepEncodedCall: IERC20.encodeFunctionData("balanceOf", [ - asset.address, + walletAddress, ]), storeOperations: [ { @@ -170,7 +170,7 @@ export class BeefyDepositStrategy extends InterfaceStrategy { routerOperation.steps.push({ stepAddress: asset.address, stepEncodedCall: IERC20.encodeFunctionData("balanceOf", [ - asset.address, + walletAddress, ]), storeOperations: [ { diff --git a/core/tests/protocols/beefy.spec.ts b/core/tests/protocols/beefy.spec.ts index 4ef0c2c..93a577d 100644 --- a/core/tests/protocols/beefy.spec.ts +++ b/core/tests/protocols/beefy.spec.ts @@ -10,7 +10,7 @@ test("generateTransaction: USDC to QUICK (beefyDeposit)", async () => { }); }); -test.skip("generateTransaction: beefy.finance (beefyDeposit) to USDC", async () => { +test("generateTransaction: beefy.finance (beefyDeposit) to USDC", async () => { await simulateSingleAssetToSingleAsset({ chainId: 137, inputAssetId: "fecfd33d-e6a7-476b-89cb-910a0058fa48",