2020-11-16 16:55:04 +00:00
|
|
|
const { expect } = require("chai");
|
2020-10-30 17:35:11 +00:00
|
|
|
const hre = require("hardhat");
|
2020-11-16 16:55:04 +00:00
|
|
|
const { ethers } = hre;
|
2020-10-30 17:35:11 +00:00
|
|
|
|
2020-11-15 14:08:12 +00:00
|
|
|
const InstaAccount = require("../../../../pre-compiles/InstaAccount.json");
|
2020-10-30 17:35:11 +00:00
|
|
|
|
2020-11-15 14:08:12 +00:00
|
|
|
module.exports = async function (userAddress, instaIndex, instaList) {
|
2020-10-30 17:35:11 +00:00
|
|
|
//#region User create a DeFi Smart Account
|
|
|
|
|
|
|
|
// User create a Instadapp DeFi Smart Account
|
|
|
|
// who give him the possibility to interact
|
|
|
|
// with a large list of DeFi protocol through one
|
|
|
|
// Proxy account.
|
|
|
|
|
|
|
|
const dsaAccountCount = await instaList.accounts();
|
|
|
|
|
|
|
|
await expect(instaIndex.build(userAddress, 1, userAddress)).to.emit(
|
|
|
|
instaIndex,
|
|
|
|
"LogAccountCreated"
|
|
|
|
);
|
|
|
|
const dsaID = dsaAccountCount.add(1);
|
2020-11-04 17:09:34 +00:00
|
|
|
expect(await instaList.accounts()).to.be.equal(dsaID);
|
2020-10-30 17:35:11 +00:00
|
|
|
|
|
|
|
// Instantiate the DSA
|
|
|
|
const dsa = await ethers.getContractAt(
|
|
|
|
InstaAccount.abi,
|
|
|
|
await instaList.accountAddr(dsaID)
|
|
|
|
);
|
|
|
|
|
|
|
|
return dsa;
|
|
|
|
|
|
|
|
//#endregion
|
2020-11-15 14:08:12 +00:00
|
|
|
};
|