This commit is contained in:
Richa-iitr 2022-09-01 23:28:58 +05:30
parent f8b2e31e24
commit 6289a0ae81
2 changed files with 12 additions and 3 deletions

View File

@ -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_);

View File

@ -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 () {