changed minor

This commit is contained in:
q1q0 2023-06-25 03:47:23 -04:00
parent b7002335b7
commit c40454f23b

View File

@ -129,259 +129,259 @@ describe("Morpho-Aave-v3", function () {
}); });
describe("Main", function () { describe("Main", function () {
// it("Should deposit 10 ETH", async function () { it("Should deposit 10 ETH", async function () {
// const spells = [ const spells = [
// { {
// connector: connectorName, connector: connectorName,
// method: "deposit", method: "deposit",
// args: [tokens.eth.address, "10000000000000000000", "0", "0"], // 10 ETH args: [tokens.eth.address, "10000000000000000000", "0", "0"], // 10 ETH
// }, },
// ]; ];
// const tx = await dsaWallet0 const tx = await dsaWallet0
// .connect(wallet0) .connect(wallet0)
// .cast(...encodeSpells(spells), wallet1.getAddress()); .cast(...encodeSpells(spells), wallet1.getAddress());
// await tx.wait(); await tx.wait();
// expect(expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte( expect(expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(
// parseUnits('990', 18)) parseUnits('990', 18))
// ); );
// }) })
// it("Should deposit 1 ETH with MaxIteration", async function () { it("Should deposit 1 ETH with MaxIteration", async function () {
// const spells = [ const spells = [
// { {
// connector: connectorName, connector: connectorName,
// method: "depositWithMaxIterations", method: "depositWithMaxIterations",
// args: [tokens.eth.address, "1000000000000000000", 5, "0", "0"], // 1 ETH args: [tokens.eth.address, "1000000000000000000", 5, "0", "0"], // 1 ETH
// }, },
// ]; ];
// const tx = await dsaWallet0 const tx = await dsaWallet0
// .connect(wallet0) .connect(wallet0)
// .cast(...encodeSpells(spells), wallet1.getAddress()); .cast(...encodeSpells(spells), wallet1.getAddress());
// await tx.wait(); await tx.wait();
// expect(expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte( expect(expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(
// parseUnits('989', 18)) parseUnits('989', 18))
// ); );
// }) })
// it("Should deposit 10 ETH on behalf", async function () { it("Should deposit 10 ETH on behalf", async function () {
// const spells = [ const spells = [
// { {
// connector: connectorName, connector: connectorName,
// method: "depositOnBehalf", method: "depositOnBehalf",
// args: [tokens.eth.address, "10000000000000000000", user, "0", "0"], // 1 ETH args: [tokens.eth.address, "10000000000000000000", user, "0", "0"], // 1 ETH
// }, },
// ]; ];
// const tx = await dsaWallet0 const tx = await dsaWallet0
// .connect(wallet0) .connect(wallet0)
// .cast(...encodeSpells(spells), wallet1.getAddress()); .cast(...encodeSpells(spells), wallet1.getAddress());
// await tx.wait(); await tx.wait();
// expect(expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte( expect(expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(
// parseUnits('979', 18)) parseUnits('979', 18))
// ); );
// }) })
// it("Should deposit 1 ETH on behalf with MaxIteration", async function () { it("Should deposit 1 ETH on behalf with MaxIteration", async function () {
// const spells = [ const spells = [
// { {
// connector: connectorName, connector: connectorName,
// method: "depositOnBehalfWithMaxIterations", method: "depositOnBehalfWithMaxIterations",
// args: [tokens.eth.address, "1000000000000000000", user, 5, "0", "0"], // 1 ETH args: [tokens.eth.address, "1000000000000000000", user, 5, "0", "0"], // 1 ETH
// }, },
// ]; ];
// const tx = await dsaWallet0 const tx = await dsaWallet0
// .connect(wallet0) .connect(wallet0)
// .cast(...encodeSpells(spells), wallet1.getAddress()); .cast(...encodeSpells(spells), wallet1.getAddress());
// await tx.wait(); await tx.wait();
// expect(expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte( expect(expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(
// parseUnits('978', 18)) parseUnits('978', 18))
// ); );
// }) })
// it("Should deposit collateral 2000 USDC", async function () { it("Should deposit collateral 2000 USDC", async function () {
// const spells = [ const spells = [
// { {
// connector: connectorName, connector: connectorName,
// method: "depositCollateral", method: "depositCollateral",
// args: [tokens.usdc.address, "2000000000", "0", "0"], // 50 USDC args: [tokens.usdc.address, "2000000000", "0", "0"], // 50 USDC
// }, },
// ]; ];
// const tx = await dsaWallet0 const tx = await dsaWallet0
// .connect(wallet0) .connect(wallet0)
// .cast(...encodeSpells(spells), wallet1.getAddress()); .cast(...encodeSpells(spells), wallet1.getAddress());
// await tx.wait(); await tx.wait();
// expect(await token_usdc.connect(wallet0).balanceOf(dsaWallet0.address)).to.be.lte( expect(await token_usdc.connect(wallet0).balanceOf(dsaWallet0.address)).to.be.lte(
// parseUnits('3000', 6) parseUnits('3000', 6)
// ); );
// }) })
// it("Should deposit collateral 2000 USDC on behalf with maxValue", async function () { it("Should deposit collateral 2000 USDC on behalf with maxValue", async function () {
// const spells = [ const spells = [
// { {
// connector: connectorName, connector: connectorName,
// method: "depositCollateralOnBehalf", method: "depositCollateralOnBehalf",
// args: [tokens.usdc.address, dsaMaxValue, user, "0", "0"], // ~3000 USDC args: [tokens.usdc.address, dsaMaxValue, user, "0", "0"], // ~3000 USDC
// }, },
// ]; ];
// const tx = await dsaWallet0 const tx = await dsaWallet0
// .connect(wallet0) .connect(wallet0)
// .cast(...encodeSpells(spells), wallet1.getAddress()); .cast(...encodeSpells(spells), wallet1.getAddress());
// await tx.wait(); await tx.wait();
// expect(await token_usdc.connect(wallet0).balanceOf(dsaWallet0.address)).to.be.lte( expect(await token_usdc.connect(wallet0).balanceOf(dsaWallet0.address)).to.be.lte(
// parseUnits('1', 6) parseUnits('1', 6)
// ); );
// }) })
// it("Should withdraw 10 ETH", async function () { it("Should withdraw 10 ETH", async function () {
// const spells = [ const spells = [
// { {
// connector: connectorName, connector: connectorName,
// method: "withdraw", method: "withdraw",
// args: [tokens.eth.address, "10000000000000000000", "0", "0"], // 10 ETH args: [tokens.eth.address, "10000000000000000000", "0", "0"], // 10 ETH
// }, },
// ]; ];
// const tx = await dsaWallet0 const tx = await dsaWallet0
// .connect(wallet0) .connect(wallet0)
// .cast(...encodeSpells(spells), wallet1.getAddress()); .cast(...encodeSpells(spells), wallet1.getAddress());
// await tx.wait(); await tx.wait();
// expect(expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte( expect(expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte(
// parseUnits('978', 18)) parseUnits('978', 18))
// ); );
// }) })
// it("Should withdraw on behalf of user with maxValue", async function () { it("Should withdraw on behalf of user with maxValue", async function () {
// let ethBala = await ethers.provider.getBalance(user) let ethBala = await ethers.provider.getBalance(user)
// let wethBala = await token_weth.balanceOf(user) let wethBala = await token_weth.balanceOf(user)
// const spells = [ const spells = [
// { {
// connector: connectorName, connector: connectorName,
// method: "withdrawOnBehalf", method: "withdrawOnBehalf",
// args: [tokens.eth.address, dsaMaxValue, dsaWallet0.address, user, "0", "0"], // Max ETH args: [tokens.eth.address, dsaMaxValue, dsaWallet0.address, user, "0", "0"], // Max ETH
// }, },
// ]; ];
// const tx = await dsaWallet0 const tx = await dsaWallet0
// .connect(wallet0) .connect(wallet0)
// .cast(...encodeSpells(spells), wallet1.getAddress()); .cast(...encodeSpells(spells), wallet1.getAddress());
// await tx.wait(); await tx.wait();
// ethBala = await ethers.provider.getBalance(user) ethBala = await ethers.provider.getBalance(user)
// wethBala = await token_weth.balanceOf(user) wethBala = await token_weth.balanceOf(user)
// }) })
// it("Should borrow WETH into DSA", async function () { it("Should borrow WETH into DSA", async function () {
// const balance = await token_weth.balanceOf(dsaWallet0.address); const balance = await token_weth.balanceOf(dsaWallet0.address);
// const spells = [ const spells = [
// { {
// connector: connectorName, connector: connectorName,
// method: "borrow", method: "borrow",
// args: [tokens.weth.address, "500000000000000000", "0", "0"], // 0.5 WETH args: [tokens.weth.address, "500000000000000000", "0", "0"], // 0.5 WETH
// }, },
// ]; ];
// const tx = await dsaWallet0 const tx = await dsaWallet0
// .connect(wallet0) .connect(wallet0)
// .cast(...encodeSpells(spells), wallet1.getAddress()); .cast(...encodeSpells(spells), wallet1.getAddress());
// await tx.wait(); await tx.wait();
// expect((await token_weth.balanceOf(dsaWallet0.address)).sub(balance)) expect((await token_weth.balanceOf(dsaWallet0.address)).sub(balance))
// .to.be.eq(parseUnits('5', 17)); .to.be.eq(parseUnits('5', 17));
// }) })
// it("Should borrow WETH into user", async function () { it("Should borrow WETH into user", async function () {
// const balance = await token_weth.balanceOf(user); const balance = await token_weth.balanceOf(user);
// const spells = [ const spells = [
// { {
// connector: connectorName, connector: connectorName,
// method: "borrowOnBehalf", method: "borrowOnBehalf",
// args: [tokens.weth.address, "200000000000000000", dsaWallet0.address, user, "0", "0"], // 0.7 WETH args: [tokens.weth.address, "200000000000000000", dsaWallet0.address, user, "0", "0"], // 0.7 WETH
// }, },
// ]; ];
// const tx = await dsaWallet0 const tx = await dsaWallet0
// .connect(wallet0) .connect(wallet0)
// .cast(...encodeSpells(spells), wallet1.getAddress()); .cast(...encodeSpells(spells), wallet1.getAddress());
// await tx.wait(); await tx.wait();
// expect((await token_weth.balanceOf(user)).sub(balance)) expect((await token_weth.balanceOf(user)).sub(balance))
// .to.be.eq(parseUnits('2', 17)); .to.be.eq(parseUnits('2', 17));
// }) })
// it("Should borrow WETH into wallet1 using iteration", async function () { it("Should borrow WETH into wallet1 using iteration", async function () {
// const balance = await token_weth.balanceOf(dsaWallet0.address); const balance = await token_weth.balanceOf(dsaWallet0.address);
// const spells = [ const spells = [
// { {
// connector: connectorName, connector: connectorName,
// method: "borrowWithMaxIterations", method: "borrowWithMaxIterations",
// args: [tokens.weth.address, "20000000000000000", dsaWallet0.address, 10, "0", "0"], // 0.02 WETH args: [tokens.weth.address, "20000000000000000", dsaWallet0.address, 10, "0", "0"], // 0.02 WETH
// }, },
// ]; ];
// const tx = await dsaWallet0 const tx = await dsaWallet0
// .connect(wallet0) .connect(wallet0)
// .cast(...encodeSpells(spells), wallet1.getAddress()); .cast(...encodeSpells(spells), wallet1.getAddress());
// await tx.wait(); await tx.wait();
// expect((await token_weth.balanceOf(dsaWallet0.address)).sub(balance)) expect((await token_weth.balanceOf(dsaWallet0.address)).sub(balance))
// .to.be.eq(parseUnits('2', 16)); .to.be.eq(parseUnits('2', 16));
// }) })
// it("Test withdrawCollateral ", async function () { it("Test withdrawCollateral ", async function () {
// await hre.network.provider.request({ await hre.network.provider.request({
// method: 'hardhat_impersonateAccount', method: 'hardhat_impersonateAccount',
// params: [ACC_USDC], params: [ACC_USDC],
// }) })
// const signer_usdc = await ethers.getSigner(ACC_USDC) const signer_usdc = await ethers.getSigner(ACC_USDC)
// await token_usdc.connect(signer_usdc).transfer(dsaWallet0.address, parseUnits('500', 6)) await token_usdc.connect(signer_usdc).transfer(dsaWallet0.address, parseUnits('500', 6))
// await hre.network.provider.request({ await hre.network.provider.request({
// method: 'hardhat_stopImpersonatingAccount', method: 'hardhat_stopImpersonatingAccount',
// params: [ACC_USDC], params: [ACC_USDC],
// }) })
// expect(await token_usdc.connect(masterSigner).balanceOf(dsaWallet0.address)).to.be.gte( expect(await token_usdc.connect(masterSigner).balanceOf(dsaWallet0.address)).to.be.gte(
// parseUnits('500', 6) parseUnits('500', 6)
// ); );
// const balance = await token_usdc.balanceOf(dsaWallet0.address); const balance = await token_usdc.balanceOf(dsaWallet0.address);
// console.log('balance: ', balance.toString()); console.log('balance: ', balance.toString());
// const spells = [ const spells = [
// { {
// connector: connectorName, connector: connectorName,
// method: "depositCollateral", method: "depositCollateral",
// args: [tokens.usdc.address, "20000000", "0", "0"], // 20 USDC args: [tokens.usdc.address, "20000000", "0", "0"], // 20 USDC
// }, },
// { {
// connector: connectorName, connector: connectorName,
// method: "withdrawCollateral", method: "withdrawCollateral",
// args: [tokens.usdc.address, "19000000", dsaWallet0.address, "0", "0"], // 19 USDC args: [tokens.usdc.address, "19000000", dsaWallet0.address, "0", "0"], // 19 USDC
// }, },
// ]; ];
// const tx = await dsaWallet0 const tx = await dsaWallet0
// .connect(wallet0) .connect(wallet0)
// .cast(...encodeSpells(spells), wallet1.getAddress()); .cast(...encodeSpells(spells), wallet1.getAddress());
// await tx.wait(); await tx.wait();
// }) })
it("Test withdrawCollateralOnBehalf with maxValue", async function () { it("Test withdrawCollateralOnBehalf with maxValue", async function () {
await hre.network.provider.request({ await hre.network.provider.request({
@ -496,19 +496,19 @@ describe("Morpho-Aave-v3", function () {
); );
}) })
// it("approve manger", async () => { it("approve manger", async () => {
// const spells = [ const spells = [
// { {
// connector: connectorName, connector: connectorName,
// method: "approveManager", method: "approveManager",
// args: [user, true], args: [user, true],
// }, },
// ] ]
// const tx = await dsaWallet0 const tx = await dsaWallet0
// .connect(wallet0) .connect(wallet0)
// .cast(...encodeSpells(spells), wallet1.getAddress()); .cast(...encodeSpells(spells), wallet1.getAddress());
// await tx.wait(); await tx.wait();
// }) })
}); });
}); });