From cf35eb7577f0a32ae66186473247c1010a4d29cb Mon Sep 17 00:00:00 2001 From: Richa-iitr Date: Sun, 4 Sep 2022 10:13:54 +0530 Subject: [PATCH] fix --- .../compound-v3-import.test.ts | 55 +++++++++++-------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/test/mainnet/compound-import/compound-v3-import.test.ts b/test/mainnet/compound-import/compound-v3-import.test.ts index 39c3aa9c..4bb2169d 100644 --- a/test/mainnet/compound-import/compound-v3-import.test.ts +++ b/test/mainnet/compound-import/compound-v3-import.test.ts @@ -151,6 +151,16 @@ const cometABI = [ outputs: [{ internalType: "string", name: "", type: "string" }], stateMutability: "view", type: "function" + }, + { + inputs: [ + { internalType: "address", name: "manager", type: "address" }, + { internalType: "bool", name: "isAllowed_", type: "bool" } + ], + name: "allow", + outputs: [], + stateMutability: "nonpayable", + type: "function" } ]; @@ -316,26 +326,27 @@ describe("Import Compound v3 Position", function () { // let interface_ = new ethers.Contract("0x285617313887d43256F852cAE0Ee4de4b68D45B0", cometABI); // await comet.connect(walletSigner).allowBySig(wallet.address, dsaWallet0.address, true, nonce, expiry,v, ethers.utils.hexlify(r), ethers.utils.hexlify(s)); - const spells1 = [ - { - connector: "COMPOUND-V3-X", - method: "toggleAccountManagerWithPermit", - args: [ - market, - wallet.address, - dsaWallet0.address, - true, - nonce, - expiry, - v, - ethers.utils.hexlify(r), - ethers.utils.hexlify(s) - ] - } - ]; + await comet.connect(walletSigner).allow(dsaWallet0.address, true); + // const spells1 = [ + // { + // connector: "COMPOUND-V3-X", + // method: "toggleAccountManagerWithPermit", + // args: [ + // market, + // wallet.address, + // dsaWallet0.address, + // true, + // nonce, + // expiry, + // v, + // ethers.utils.hexlify(r), + // ethers.utils.hexlify(s) + // ] + // } + // ]; - let tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells1), wallet0.address); - const receipt = await tx.wait(); + // let tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells1), wallet0.address); + // const receipt = await tx.wait(); console.log("DSA Permitted as manager"); const flashSpells = [ @@ -346,8 +357,8 @@ describe("Import Compound v3 Position", function () { }, { connector: "COMPOUND-V3-X", - method: "transferAssetFromUsingManager", - args: [market, tokens.eth.address, wallet.address, dsaWallet0.address, ethers.constants.MaxUint256, 0, 0] + method: "transferAssetOnBehalf", + args: [market, tokens.weth.address, wallet.address, dsaWallet0.address, ethers.constants.MaxUint256, 0, 0] }, { connector: "COMPOUND-V3-X", @@ -368,7 +379,7 @@ describe("Import Compound v3 Position", function () { } ]; - tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet0.address); + let tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet0.address); await tx.wait(); });