diff --git a/contracts/mainnet/connectors/compound/v3/main.sol b/contracts/mainnet/connectors/compound/v3/main.sol index f9d89288..31e40a21 100644 --- a/contracts/mainnet/connectors/compound/v3/main.sol +++ b/contracts/mainnet/connectors/compound/v3/main.sol @@ -11,6 +11,7 @@ import { TokenInterface } from "../../../common/interfaces.sol"; import { Helpers } from "./helpers.sol"; import { Events } from "./events.sol"; import { CometInterface } from "./interface.sol"; +import "hardhat/console.sol"; abstract contract CompoundV3Resolver is Events, Helpers { /** @@ -212,7 +213,7 @@ abstract contract CompoundV3Resolver is Events, Helpers { uint256 initialBal = getAccountSupplyBalanceOfAsset( address(this), market, - token + token_ ); amt_ = amt_ == uint256(-1) ? initialBal : amt_; @@ -229,11 +230,15 @@ abstract contract CompoundV3Resolver is Events, Helpers { uint256 finalBal = getAccountSupplyBalanceOfAsset( address(this), market, - token + token_ ); amt_ = sub(initialBal, finalBal); + console.log(amt_); + console.log(initialBal); + console.log(finalBal); + convertWethToEth(isEth, tokenContract, amt_); setUint(setId, amt_); diff --git a/test/mainnet/compound/compound.iii.test.ts b/test/mainnet/compound/compound.iii.test.ts index be33d408..f1dc4eb5 100644 --- a/test/mainnet/compound/compound.iii.test.ts +++ b/test/mainnet/compound/compound.iii.test.ts @@ -366,6 +366,8 @@ describe("Compound III", function () { }); it("should withdraw some ETH collateral", async function () { + let initialBal = await ethers.provider.getBalance(dsaWallet0.address); + console.log(initialBal) const amount = ethers.utils.parseEther("2"); const spells = [ { @@ -380,7 +382,9 @@ describe("Compound III", function () { expect((await comet.connect(signer).userCollateral(dsaWallet0.address, tokens.weth.address)).balance).to.be.gte( ethers.utils.parseEther("4") ); - expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte(ethers.utils.parseEther("7")); + expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte( + ethers.utils.parseEther(initialBal.add(2).toString()) + ); }); it("manager should be able to withdraw collateral from the position", async function () {