diff --git a/contracts/polygon/connectors/aave/v3-import/helpers.sol b/contracts/polygon/connectors/aave/v3-import/helpers.sol index b4e0da7e..a90cae8f 100644 --- a/contracts/polygon/connectors/aave/v3-import/helpers.sol +++ b/contracts/polygon/connectors/aave/v3-import/helpers.sol @@ -273,7 +273,7 @@ contract AaveHelpers is Helper { for (uint256 i = 0; i < _length; i++) { if (amts[i] > 0) { uint256 _amt = amts[i]; - address _token = tokens[i]; + address _token = address(atokenContracts[i]); _targets[_cntr] = "BASIC-A"; _data[_cntr] = abi.encodeWithSelector( basicWithdraw, @@ -345,7 +345,7 @@ contract AaveHelpers is Helper { for (uint256 i = 0; i < _length; i++) { if (amts[i] > 0) { uint256 _amt = amts[i]; - address _token = tokens[i]; + address _token = address(atokenContracts[i]); _targets[_cntr] = "BASIC-A"; _data[_cntr] = abi.encodeWithSelector( basicWithdraw, diff --git a/test/polygon/aave/v3-import-test.ts b/test/polygon/aave/v3-import-test.ts index 68b5f110..a2d27530 100644 --- a/test/polygon/aave/v3-import-test.ts +++ b/test/polygon/aave/v3-import-test.ts @@ -334,8 +334,7 @@ describe("Import Aave v3 Position", function () { walletBsigner = await ethers.getSigner(walletB.address); await token.connect(signer).transfer(dsaWallet2.address, ethers.utils.parseEther("10")); - console.log(dsaWallet1.address); - console.log(walletB.address); + const spells = [ //deposit DAI in aave { @@ -410,18 +409,18 @@ describe("Import Aave v3 Position", function () { it("Should merge Aave position", async () => { //Approving max amount const amount = ethers.constants.MaxUint256; - const tx0 = await aDai.connect(wallet0).approve(dsaWallet1.address, amount); + const tx0 = await aDai.connect(walletBsigner).approve(dsaWallet1.address, amount); - const amount0 = new BigNumber(await usdcToken.connect(wallet0).balanceOf(dsaWallet2.address)); + const amount0 = new BigNumber(await usdcToken.connect(walletBsigner).balanceOf(dsaWallet2.address)); const amountB = new BigNumber(amount0.toString()).multipliedBy(5).dividedBy(1e4); const amountWithFee = amount0.plus(amountB); - console.log(amount0.toFixed(0)); + console.log(amountWithFee.toString()); const flashSpells = [ { connector: "AAVE-V3-IMPORT-X", method: "importAave", - args: [dsaWallet2.address, [[DAI], [USDC], false, [amountB.toFixed(0)]]] //dsaWallet2 --> DSA_A DSA with aave position + args: [dsaWallet2.address, [[DAI], [USDC], false, [amountB.toFixed(0)]]] //dsaWallet2 --> DSA_A DSA with aave position }, { connector: "INSTAPOOL-C",