mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
fix testcases
This commit is contained in:
parent
99b672d78d
commit
48cf6a02fe
|
@ -27,7 +27,7 @@ module.exports = {
|
||||||
version: "0.7.6",
|
version: "0.7.6",
|
||||||
settings: {
|
settings: {
|
||||||
optimizer: {
|
optimizer: {
|
||||||
enabled: false,
|
enabled: true,
|
||||||
runs: 200,
|
runs: 200,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -63,10 +63,9 @@ module.exports = {
|
||||||
hardhat: {
|
hardhat: {
|
||||||
forking: {
|
forking: {
|
||||||
url: `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_ID}`,
|
url: `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_ID}`,
|
||||||
blockNumber: 12796965,
|
blockNumber: 12696000,
|
||||||
},
|
},
|
||||||
blockGasLimit: 12000000,
|
blockGasLimit: 12000000,
|
||||||
gasPrice: parseInt(utils.parseUnits("300", "gwei"))
|
|
||||||
},
|
},
|
||||||
matic: {
|
matic: {
|
||||||
url: "https://rpc-mainnet.maticvigil.com/",
|
url: "https://rpc-mainnet.maticvigil.com/",
|
||||||
|
|
|
@ -13,6 +13,8 @@ const constants = require("../../scripts/constant/constant");
|
||||||
const addLiquidity = require("../../scripts/addLiquidity");
|
const addLiquidity = require("../../scripts/addLiquidity");
|
||||||
const { ethers } = hre;
|
const { ethers } = hre;
|
||||||
|
|
||||||
|
const ALCHEMY_ID = process.env.ALCHEMY_ID;
|
||||||
|
|
||||||
describe("Aave V1", function() {
|
describe("Aave V1", function() {
|
||||||
const connectorName = "AAVEV1-TEST-A";
|
const connectorName = "AAVEV1-TEST-A";
|
||||||
|
|
||||||
|
@ -23,6 +25,18 @@ describe("Aave V1", function() {
|
||||||
let masterSigner;
|
let masterSigner;
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
|
try {
|
||||||
|
await hre.network.provider.request({
|
||||||
|
method: "hardhat_reset",
|
||||||
|
params: [
|
||||||
|
{
|
||||||
|
forking: {
|
||||||
|
jsonRpcUrl: hre.config.networks.hardhat.forking.url,
|
||||||
|
blockNumber: 12796965,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
[wallet0, wallet1] = await ethers.getSigners();
|
[wallet0, wallet1] = await ethers.getSigners();
|
||||||
masterSigner = await getMasterSigner();
|
masterSigner = await getMasterSigner();
|
||||||
instaConnectorsV2 = await ethers.getContractAt(
|
instaConnectorsV2 = await ethers.getContractAt(
|
||||||
|
@ -36,6 +50,9 @@ describe("Aave V1", function() {
|
||||||
connectors: instaConnectorsV2,
|
connectors: instaConnectorsV2,
|
||||||
});
|
});
|
||||||
console.log("Connector address", connector.address);
|
console.log("Connector address", connector.address);
|
||||||
|
} catch (err) {
|
||||||
|
console.log("error", err);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should have contracts deployed", async () => {
|
it("should have contracts deployed", async () => {
|
||||||
|
|
|
@ -23,6 +23,17 @@ describe("Aave V2", function() {
|
||||||
let masterSigner;
|
let masterSigner;
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
|
await hre.network.provider.request({
|
||||||
|
method: "hardhat_reset",
|
||||||
|
params: [
|
||||||
|
{
|
||||||
|
forking: {
|
||||||
|
jsonRpcUrl: hre.config.networks.hardhat.forking.url,
|
||||||
|
blockNumber: 12796965,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
[wallet0, wallet1] = await ethers.getSigners();
|
[wallet0, wallet1] = await ethers.getSigners();
|
||||||
masterSigner = await getMasterSigner();
|
masterSigner = await getMasterSigner();
|
||||||
instaConnectorsV2 = await ethers.getContractAt(
|
instaConnectorsV2 = await ethers.getContractAt(
|
||||||
|
|
|
@ -13,7 +13,7 @@ const abis = require("../../scripts/constant/abis");
|
||||||
const constants = require("../../scripts/constant/constant");
|
const constants = require("../../scripts/constant/constant");
|
||||||
const tokens = require("../../scripts/constant/tokens");
|
const tokens = require("../../scripts/constant/tokens");
|
||||||
|
|
||||||
const connectV2CompoundArtifacts = require("../../artifacts/contracts/mainnet/connectors/b.protocol/compound/main.sol/ConnectV1BCompound.json")
|
const connectV2CompoundArtifacts = require("../../artifacts/contracts/mainnet/connectors/b.protocol/compound/main.sol/ConnectV2BCompound.json")
|
||||||
|
|
||||||
describe("B.Compound", function () {
|
describe("B.Compound", function () {
|
||||||
const connectorName = "B.COMPOUND-TEST-A"
|
const connectorName = "B.COMPOUND-TEST-A"
|
||||||
|
@ -26,6 +26,17 @@ describe("B.Compound", function () {
|
||||||
const wallets = provider.getWallets()
|
const wallets = provider.getWallets()
|
||||||
const [wallet0, wallet1, wallet2, wallet3] = wallets
|
const [wallet0, wallet1, wallet2, wallet3] = wallets
|
||||||
before(async () => {
|
before(async () => {
|
||||||
|
await hre.network.provider.request({
|
||||||
|
method: "hardhat_reset",
|
||||||
|
params: [
|
||||||
|
{
|
||||||
|
forking: {
|
||||||
|
jsonRpcUrl: hre.config.networks.hardhat.forking.url,
|
||||||
|
blockNumber: 13300000,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
masterSigner = await getMasterSigner(wallet3)
|
masterSigner = await getMasterSigner(wallet3)
|
||||||
instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2);
|
instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2);
|
||||||
connector = await deployAndEnableConnector({
|
connector = await deployAndEnableConnector({
|
||||||
|
|
|
@ -36,6 +36,17 @@ describe("B.Liquity", function () {
|
||||||
const wallets = provider.getWallets()
|
const wallets = provider.getWallets()
|
||||||
const [wallet0, wallet1, wallet2, wallet3] = wallets
|
const [wallet0, wallet1, wallet2, wallet3] = wallets
|
||||||
before(async () => {
|
before(async () => {
|
||||||
|
await hre.network.provider.request({
|
||||||
|
method: "hardhat_reset",
|
||||||
|
params: [
|
||||||
|
{
|
||||||
|
forking: {
|
||||||
|
jsonRpcUrl: hre.config.networks.hardhat.forking.url,
|
||||||
|
blockNumber: 12996875,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
masterSigner = await getMasterSigner(wallet3)
|
masterSigner = await getMasterSigner(wallet3)
|
||||||
instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2);
|
instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2);
|
||||||
connector = await deployAndEnableConnector({
|
connector = await deployAndEnableConnector({
|
||||||
|
|
|
@ -13,7 +13,7 @@ const abis = require("../../scripts/constant/abis");
|
||||||
const constants = require("../../scripts/constant/constant");
|
const constants = require("../../scripts/constant/constant");
|
||||||
const tokens = require("../../scripts/constant/tokens");
|
const tokens = require("../../scripts/constant/tokens");
|
||||||
|
|
||||||
const connectorMakerArtifacts = require("../../artifacts/contracts/mainnet/connectors/b.protocol/makerdao/main.sol/ConnectV1BMakerDAO.json")
|
const connectorMakerArtifacts = require("../../artifacts/contracts/mainnet/connectors/b.protocol/makerdao/main.sol/ConnectV2BMakerDAO.json")
|
||||||
|
|
||||||
describe("B.Maker", function () {
|
describe("B.Maker", function () {
|
||||||
const connectorName = "B.MAKER-TEST-A"
|
const connectorName = "B.MAKER-TEST-A"
|
||||||
|
@ -30,6 +30,17 @@ describe("B.Maker", function () {
|
||||||
const wallets = provider.getWallets()
|
const wallets = provider.getWallets()
|
||||||
const [wallet0, wallet1, wallet2, wallet3] = wallets
|
const [wallet0, wallet1, wallet2, wallet3] = wallets
|
||||||
before(async () => {
|
before(async () => {
|
||||||
|
await hre.network.provider.request({
|
||||||
|
method: "hardhat_reset",
|
||||||
|
params: [
|
||||||
|
{
|
||||||
|
forking: {
|
||||||
|
jsonRpcUrl: hre.config.networks.hardhat.forking.url,
|
||||||
|
blockNumber: 12696000,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
masterSigner = await getMasterSigner(wallet3)
|
masterSigner = await getMasterSigner(wallet3)
|
||||||
instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2);
|
instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2);
|
||||||
connector = await deployAndEnableConnector({
|
connector = await deployAndEnableConnector({
|
||||||
|
|
|
@ -38,6 +38,17 @@ describe("BASIC-ERC1155", function () {
|
||||||
const wallets = provider.getWallets()
|
const wallets = provider.getWallets()
|
||||||
const [wallet0, wallet1, wallet2, wallet3] = wallets
|
const [wallet0, wallet1, wallet2, wallet3] = wallets
|
||||||
before(async () => {
|
before(async () => {
|
||||||
|
await hre.network.provider.request({
|
||||||
|
method: "hardhat_reset",
|
||||||
|
params: [
|
||||||
|
{
|
||||||
|
forking: {
|
||||||
|
jsonRpcUrl: hre.config.networks.hardhat.forking.url,
|
||||||
|
blockNumber: 13300000,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
await hre.network.provider.request({
|
await hre.network.provider.request({
|
||||||
method: "hardhat_impersonateAccount",
|
method: "hardhat_impersonateAccount",
|
||||||
params: [TOKEN_OWNER_ADDR],
|
params: [TOKEN_OWNER_ADDR],
|
||||||
|
|
|
@ -38,6 +38,17 @@ describe("BASIC-ERC721", function () {
|
||||||
const wallets = provider.getWallets()
|
const wallets = provider.getWallets()
|
||||||
const [wallet0, wallet1, wallet2, wallet3] = wallets
|
const [wallet0, wallet1, wallet2, wallet3] = wallets
|
||||||
before(async () => {
|
before(async () => {
|
||||||
|
await hre.network.provider.request({
|
||||||
|
method: "hardhat_reset",
|
||||||
|
params: [
|
||||||
|
{
|
||||||
|
forking: {
|
||||||
|
jsonRpcUrl: hre.config.networks.hardhat.forking.url,
|
||||||
|
blockNumber: 13300000,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
await hre.network.provider.request({
|
await hre.network.provider.request({
|
||||||
method: "hardhat_impersonateAccount",
|
method: "hardhat_impersonateAccount",
|
||||||
params: [TOKEN_OWNER_ADDR],
|
params: [TOKEN_OWNER_ADDR],
|
||||||
|
|
|
@ -26,6 +26,17 @@ describe("Compound", function () {
|
||||||
const wallets = provider.getWallets()
|
const wallets = provider.getWallets()
|
||||||
const [wallet0, wallet1, wallet2, wallet3] = wallets
|
const [wallet0, wallet1, wallet2, wallet3] = wallets
|
||||||
before(async () => {
|
before(async () => {
|
||||||
|
await hre.network.provider.request({
|
||||||
|
method: "hardhat_reset",
|
||||||
|
params: [
|
||||||
|
{
|
||||||
|
forking: {
|
||||||
|
jsonRpcUrl: hre.config.networks.hardhat.forking.url,
|
||||||
|
blockNumber: 13300000,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
masterSigner = await getMasterSigner(wallet3)
|
masterSigner = await getMasterSigner(wallet3)
|
||||||
instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2);
|
instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2);
|
||||||
connector = await deployAndEnableConnector({
|
connector = await deployAndEnableConnector({
|
||||||
|
|
|
@ -27,6 +27,17 @@ describe("Instapool", function () {
|
||||||
const wallets = provider.getWallets()
|
const wallets = provider.getWallets()
|
||||||
const [wallet0, wallet1, wallet2, wallet3] = wallets
|
const [wallet0, wallet1, wallet2, wallet3] = wallets
|
||||||
before(async () => {
|
before(async () => {
|
||||||
|
await hre.network.provider.request({
|
||||||
|
method: "hardhat_reset",
|
||||||
|
params: [
|
||||||
|
{
|
||||||
|
forking: {
|
||||||
|
jsonRpcUrl: hre.config.networks.hardhat.forking.url,
|
||||||
|
blockNumber: 13300000,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
masterSigner = await getMasterSigner(wallet3)
|
masterSigner = await getMasterSigner(wallet3)
|
||||||
instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2);
|
instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2);
|
||||||
connector = await deployAndEnableConnector({
|
connector = await deployAndEnableConnector({
|
||||||
|
|
|
@ -21,6 +21,17 @@ describe("Liquity", () => {
|
||||||
let liquity = null;
|
let liquity = null;
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
|
await hre.network.provider.request({
|
||||||
|
method: "hardhat_reset",
|
||||||
|
params: [
|
||||||
|
{
|
||||||
|
forking: {
|
||||||
|
jsonRpcUrl: hre.config.networks.hardhat.forking.url,
|
||||||
|
blockNumber: 13300000,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
liquity = await helpers.deployAndConnect(contracts, true);
|
liquity = await helpers.deployAndConnect(contracts, true);
|
||||||
expect(liquity.troveManager.address).to.exist;
|
expect(liquity.troveManager.address).to.exist;
|
||||||
expect(liquity.borrowerOperations.address).to.exist;
|
expect(liquity.borrowerOperations.address).to.exist;
|
||||||
|
|
|
@ -20,6 +20,17 @@ describe("Test InstaMapping contract", () => {
|
||||||
const testRoleAddress = "0x2971AdFa57b20E5a416aE5a708A8655A9c74f723";
|
const testRoleAddress = "0x2971AdFa57b20E5a416aE5a708A8655A9c74f723";
|
||||||
|
|
||||||
before("get signers", async () => {
|
before("get signers", async () => {
|
||||||
|
await hre.network.provider.request({
|
||||||
|
method: "hardhat_reset",
|
||||||
|
params: [
|
||||||
|
{
|
||||||
|
forking: {
|
||||||
|
jsonRpcUrl: hre.config.networks.hardhat.forking.url,
|
||||||
|
blockNumber: 12796965,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
[account] = await ethers.getSigners();
|
[account] = await ethers.getSigners();
|
||||||
|
|
||||||
const IndexContract = await ethers.getContractAt(
|
const IndexContract = await ethers.getContractAt(
|
||||||
|
@ -33,6 +44,11 @@ describe("Test InstaMapping contract", () => {
|
||||||
params: [masterAddress],
|
params: [masterAddress],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await network.provider.send("hardhat_setBalance", [
|
||||||
|
masterAddress,
|
||||||
|
"0x1000000000000000000000000",
|
||||||
|
]);
|
||||||
|
|
||||||
instaMaster = await ethers.getSigner(masterAddress);
|
instaMaster = await ethers.getSigner(masterAddress);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,17 @@ describe("UniswapV3", function () {
|
||||||
const wallets = provider.getWallets()
|
const wallets = provider.getWallets()
|
||||||
const [wallet0, wallet1, wallet2, wallet3] = wallets
|
const [wallet0, wallet1, wallet2, wallet3] = wallets
|
||||||
before(async () => {
|
before(async () => {
|
||||||
|
await hre.network.provider.request({
|
||||||
|
method: "hardhat_reset",
|
||||||
|
params: [
|
||||||
|
{
|
||||||
|
forking: {
|
||||||
|
jsonRpcUrl: hre.config.networks.hardhat.forking.url,
|
||||||
|
blockNumber: 13005785,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
masterSigner = await getMasterSigner(wallet3)
|
masterSigner = await getMasterSigner(wallet3)
|
||||||
instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2);
|
instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2);
|
||||||
nftManager = await ethers.getContractAt(nftManagerAbi, "0xC36442b4a4522E871399CD717aBDD847Ab11FE88");
|
nftManager = await ethers.getContractAt(nftManagerAbi, "0xC36442b4a4522E871399CD717aBDD847Ab11FE88");
|
||||||
|
@ -184,7 +195,7 @@ describe("UniswapV3", function () {
|
||||||
const data = await nftManager.positions(tokenIds[0])
|
const data = await nftManager.positions(tokenIds[0])
|
||||||
|
|
||||||
expect(data.liquidity).to.be.equals(liquidities[0]);
|
expect(data.liquidity).to.be.equals(liquidities[0]);
|
||||||
})
|
}).timeout(10000000000);
|
||||||
|
|
||||||
it("Should deposit successfully", async function () {
|
it("Should deposit successfully", async function () {
|
||||||
const daiAmount = ethers.utils.parseEther("400") // 1 ETH
|
const daiAmount = ethers.utils.parseEther("400") // 1 ETH
|
||||||
|
|
|
@ -48,6 +48,17 @@ describe("UniswapV3", function () {
|
||||||
const wallets = provider.getWallets()
|
const wallets = provider.getWallets()
|
||||||
const [wallet0, wallet1, wallet2, wallet3] = wallets
|
const [wallet0, wallet1, wallet2, wallet3] = wallets
|
||||||
before(async () => {
|
before(async () => {
|
||||||
|
await hre.network.provider.request({
|
||||||
|
method: "hardhat_reset",
|
||||||
|
params: [
|
||||||
|
{
|
||||||
|
forking: {
|
||||||
|
jsonRpcUrl: hre.config.networks.hardhat.forking.url,
|
||||||
|
blockNumber: 13300000,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
masterSigner = await getMasterSigner(wallet3)
|
masterSigner = await getMasterSigner(wallet3)
|
||||||
instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2);
|
instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2);
|
||||||
nftManager = await ethers.getContractAt(nftManagerAbi, "0xC36442b4a4522E871399CD717aBDD847Ab11FE88");
|
nftManager = await ethers.getContractAt(nftManagerAbi, "0xC36442b4a4522E871399CD717aBDD847Ab11FE88");
|
||||||
|
|
|
@ -32,6 +32,17 @@ describe("Yearn", function () {
|
||||||
const wallets = provider.getWallets()
|
const wallets = provider.getWallets()
|
||||||
const [wallet0, wallet1, wallet2, wallet3] = wallets
|
const [wallet0, wallet1, wallet2, wallet3] = wallets
|
||||||
before(async () => {
|
before(async () => {
|
||||||
|
await hre.network.provider.request({
|
||||||
|
method: "hardhat_reset",
|
||||||
|
params: [
|
||||||
|
{
|
||||||
|
forking: {
|
||||||
|
jsonRpcUrl: hre.config.networks.hardhat.forking.url,
|
||||||
|
blockNumber: 12996975,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
masterSigner = await getMasterSigner(wallet3)
|
masterSigner = await getMasterSigner(wallet3)
|
||||||
instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2);
|
instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2);
|
||||||
connector = await deployAndEnableConnector({
|
connector = await deployAndEnableConnector({
|
||||||
|
|
Loading…
Reference in New Issue
Block a user