Gelato-automations/test/helpers/services/getContracts.js

138 lines
4.5 KiB
JavaScript
Raw Normal View History

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
const GelatoCoreLib = require("@gelatonetwork/core");
const InstaIndex = require("../../../pre-compiles/InstaIndex.json");
const InstaList = require("../../../pre-compiles/InstaList.json");
const ConnectGelato = require("../../../pre-compiles/ConnectGelato.json");
const ConnectMaker = require("../../../pre-compiles/ConnectMaker.json");
const ConnectCompound = require("../../../pre-compiles/ConnectCompound.json");
const ConnectInstaPool = require("../../../pre-compiles/ConnectInstaPool.json");
const InstaConnector = require("../../../pre-compiles/InstaConnectors.json");
const InstaMapping = require("../../../pre-compiles/InstaMapping.json");
const DssCdpManager = require("../../../pre-compiles/DssCdpManager.json");
const GetCdps = require("../../../pre-compiles/GetCdps.json");
const IERC20 = require("../../../pre-compiles/IERC20.json");
const CTokenInterface = require("../../../pre-compiles/CTokenInterface.json");
const CompoundResolver = require("../../../pre-compiles/InstaCompoundResolver.json");
const DsaProviderModuleABI = require("../../../pre-compiles/ProviderModuleDsa_ABI.json");
const InstaPoolResolver = require("../../../artifacts/contracts/interfaces/InstaDapp/resolvers/IInstaPoolResolver.sol/IInstaPoolResolver.json");
2020-10-30 17:35:11 +00:00
2020-11-15 14:08:12 +00:00
module.exports = async function () {
const instaMaster = await ethers.provider.getSigner(
hre.network.config.InstaMaster
);
2020-10-30 17:35:11 +00:00
// ===== Get Deployed Contract Instance ==================
const instaIndex = await ethers.getContractAt(
2020-10-30 17:35:11 +00:00
InstaIndex.abi,
hre.network.config.InstaIndex
);
const instaMapping = await ethers.getContractAt(
2020-10-30 17:35:11 +00:00
InstaMapping.abi,
hre.network.config.InstaMapping
);
const instaList = await ethers.getContractAt(
2020-10-30 17:35:11 +00:00
InstaList.abi,
hre.network.config.InstaList
);
const connectGelato = await ethers.getContractAt(
2020-10-30 17:35:11 +00:00
ConnectGelato.abi,
hre.network.config.ConnectGelato
);
const connectMaker = await ethers.getContractAt(
2020-10-30 17:35:11 +00:00
ConnectMaker.abi,
hre.network.config.ConnectMaker
);
const connectInstaPool = await ethers.getContractAt(
2020-10-30 17:35:11 +00:00
ConnectInstaPool.abi,
hre.network.config.ConnectInstaPool
);
const connectCompound = await ethers.getContractAt(
2020-10-30 17:35:11 +00:00
ConnectCompound.abi,
hre.network.config.ConnectCompound
);
const dssCdpManager = await ethers.getContractAt(
2020-10-30 17:35:11 +00:00
DssCdpManager.abi,
hre.network.config.DssCdpManager
);
const getCdps = await ethers.getContractAt(
GetCdps.abi,
hre.network.config.GetCdps
);
const DAI = await ethers.getContractAt(IERC20.abi, hre.network.config.DAI);
const gelatoCore = await ethers.getContractAt(
2020-10-30 17:35:11 +00:00
GelatoCoreLib.GelatoCore.abi,
hre.network.config.GelatoCore
);
const cDaiToken = await ethers.getContractAt(
2020-10-30 17:35:11 +00:00
CTokenInterface.abi,
hre.network.config.CDAI
);
const cEthToken = await ethers.getContractAt(
2020-10-30 17:35:11 +00:00
CTokenInterface.abi,
hre.network.config.CETH
);
const instaConnectors = await ethers.getContractAt(
2020-10-30 17:35:11 +00:00
InstaConnector.abi,
hre.network.config.InstaConnectors
);
const compoundResolver = await ethers.getContractAt(
2020-10-30 17:35:11 +00:00
CompoundResolver.abi,
hre.network.config.CompoundResolver
);
const dsaProviderModule = await ethers.getContractAt(
DsaProviderModuleABI,
hre.network.config.ProviderModuleDsa
);
const instaPoolResolver = await ethers.getContractAt(
InstaPoolResolver.abi,
hre.network.config.InstaPoolResolver
);
2020-10-30 17:35:11 +00:00
// ===== Get deployed contracts ==================
const priceOracleResolver = await ethers.getContract("PriceOracleResolver");
const conditionMakerVaultUnsafe = await ethers.getContract(
2020-10-30 17:35:11 +00:00
"ConditionMakerVaultUnsafe"
);
const conditionDebtBridgeIsAffordable = await ethers.getContract(
"ConditionDebtBridgeIsAffordable"
);
const connectGelatoProviderPayment = await ethers.getContract(
2020-10-30 17:35:11 +00:00
"ConnectGelatoProviderPayment"
);
const makerResolver = await ethers.getContract("MakerResolver");
const connectGelatoDataFullRefinanceMaker = await ethers.getContract(
"ConnectGelatoDataFullRefinanceMaker"
2020-10-30 17:35:11 +00:00
);
2020-11-02 10:51:49 +00:00
2020-10-30 17:35:11 +00:00
return {
2020-11-02 10:51:49 +00:00
connectGelato,
connectMaker,
connectInstaPool,
connectCompound,
connectGelatoDataFullRefinanceMaker,
2020-11-02 10:51:49 +00:00
instaIndex,
instaList,
instaMapping,
dssCdpManager,
getCdps,
DAI,
gelatoCore,
cDaiToken,
cEthToken,
instaMaster,
instaConnectors,
compoundResolver,
conditionMakerVaultUnsafe,
connectGelatoProviderPayment,
priceOracleResolver,
2020-10-30 17:35:11 +00:00
dsa: ethers.constants.AddressZero,
2020-11-02 10:51:49 +00:00
makerResolver,
instaPoolResolver,
dsaProviderModule,
conditionDebtBridgeIsAffordable,
2020-10-30 17:35:11 +00:00
};
2020-11-15 14:08:12 +00:00
};