mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
update test script
This commit is contained in:
parent
04c60c20cf
commit
86741c7afd
|
@ -22,6 +22,18 @@ describe("Sparklend", function () {
|
||||||
let dsaWallet0: any;
|
let dsaWallet0: any;
|
||||||
let instaConnectorsV2: Contract;
|
let instaConnectorsV2: Contract;
|
||||||
let masterSigner: Signer;
|
let masterSigner: Signer;
|
||||||
|
const account = "0x72a53cdbbcc1b9efa39c834a540550e23463aacb";
|
||||||
|
let signer: any;
|
||||||
|
|
||||||
|
const ABI = [
|
||||||
|
"function balanceOf(address account) public view returns (uint256)",
|
||||||
|
"function approve(address spender, uint256 amount) external returns(bool)",
|
||||||
|
"function transfer(address recipient, uint256 amount) external returns (bool)"
|
||||||
|
];
|
||||||
|
|
||||||
|
const wethContract = new ethers.Contract(tokens.weth.address, ABI);
|
||||||
|
const daiContract = new ethers.Contract(tokens.dai.address, ABI);
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
await hre.network.provider.request({
|
await hre.network.provider.request({
|
||||||
method: "hardhat_reset",
|
method: "hardhat_reset",
|
||||||
|
@ -48,6 +60,12 @@ describe("Sparklend", function () {
|
||||||
connectors: instaConnectorsV2,
|
connectors: instaConnectorsV2,
|
||||||
});
|
});
|
||||||
console.log("Connector address", connector.address);
|
console.log("Connector address", connector.address);
|
||||||
|
|
||||||
|
await hre.network.provider.request({
|
||||||
|
method: "hardhat_impersonateAccount",
|
||||||
|
params: [account]
|
||||||
|
});
|
||||||
|
signer = await ethers.getSigner(account);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should have contracts deployed", async () => {
|
it("should have contracts deployed", async () => {
|
||||||
|
@ -222,5 +240,62 @@ describe("Sparklend", function () {
|
||||||
ethers.utils.parseEther("10")
|
ethers.utils.parseEther("10")
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should deposit without collateral and withdraw", async () => {
|
||||||
|
const amt = parseEther("1"); // 1 eth
|
||||||
|
const setId = "834782373";
|
||||||
|
const spells = [
|
||||||
|
{
|
||||||
|
connector: connectorName,
|
||||||
|
method: "depositWithoutCollateral",
|
||||||
|
args: [tokens.eth.address, amt, 0, setId],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
connector: connectorName,
|
||||||
|
method: "withdraw",
|
||||||
|
args: [tokens.eth.address, amt, setId, 0],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const tx = await dsaWallet0
|
||||||
|
.connect(wallet0)
|
||||||
|
.cast(...encodeSpells(spells), wallet1.getAddress());
|
||||||
|
await tx.wait();
|
||||||
|
expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte(
|
||||||
|
ethers.utils.parseEther("10")
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
// it("should deposit ETH in Sparklend", async function () {
|
||||||
|
// const amt = parseEther("1");
|
||||||
|
// const spells = [
|
||||||
|
// {
|
||||||
|
// connector: connectorName,
|
||||||
|
// method: "deposit",
|
||||||
|
// args: [tokens.eth.address, amt, 0, 0],
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// connector: connectorName,
|
||||||
|
// method: "borrow",
|
||||||
|
// args: [tokens.dai.address, amt.mul(300), 2, 0, 0],
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// connector: connectorName,
|
||||||
|
// method: "paybackWithATokens",
|
||||||
|
// args: [tokens.dai.address, amt.mul(300), 2, 0, 0],
|
||||||
|
// },
|
||||||
|
// ];
|
||||||
|
|
||||||
|
// const tx = await dsaWallet0
|
||||||
|
// .connect(wallet0)
|
||||||
|
// .cast(...encodeSpells(spells), wallet1.getAddress());
|
||||||
|
|
||||||
|
// await tx.wait();
|
||||||
|
|
||||||
|
// expect(await ethers.provider.getBalance(dsaWallet0.address)).to.eq(
|
||||||
|
// parseEther("9")
|
||||||
|
// );
|
||||||
|
// });
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user