2020-10-30 17:35:11 +00:00
|
|
|
const hre = require("hardhat");
|
|
|
|
const {ethers} = hre;
|
|
|
|
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");
|
2020-11-03 11:48:00 +00:00
|
|
|
const DsaProviderModuleABI = require("../../../pre-compiles/ProviderModuleDsa_ABI.json");
|
2020-10-30 17:35:11 +00:00
|
|
|
|
2020-11-03 11:48:00 +00:00
|
|
|
async function getContracts(providerAddress) {
|
2020-10-30 17:35:11 +00:00
|
|
|
// Deployed instances
|
|
|
|
let connectGelato;
|
|
|
|
let connectMaker;
|
|
|
|
let connectInstaPool;
|
|
|
|
let connectCompound;
|
|
|
|
let instaIndex;
|
|
|
|
let instaList;
|
|
|
|
let dssCdpManager;
|
|
|
|
let getCdps;
|
2020-11-02 10:51:49 +00:00
|
|
|
let DAI;
|
2020-10-30 17:35:11 +00:00
|
|
|
let gelatoCore;
|
|
|
|
let cDaiToken;
|
|
|
|
let cEthToken;
|
|
|
|
let instaMaster;
|
|
|
|
let instaMapping;
|
|
|
|
let instaConnectors;
|
|
|
|
let compoundResolver;
|
2020-11-03 11:48:00 +00:00
|
|
|
let dsaProviderModule;
|
2020-10-30 17:35:11 +00:00
|
|
|
// Contracts to deploy and use for local testing
|
|
|
|
let conditionMakerVaultUnsafe;
|
|
|
|
let connectGelatoProviderPayment;
|
|
|
|
let priceOracleResolver;
|
2020-11-02 10:51:49 +00:00
|
|
|
let connectGelatoData;
|
|
|
|
let debtBridgeFromMakerForFullRefinance;
|
2020-10-30 17:35:11 +00:00
|
|
|
|
|
|
|
instaMaster = await ethers.provider.getSigner(hre.network.config.InstaMaster);
|
|
|
|
|
|
|
|
// ===== Get Deployed Contract Instance ==================
|
|
|
|
instaIndex = await ethers.getContractAt(
|
|
|
|
InstaIndex.abi,
|
|
|
|
hre.network.config.InstaIndex
|
|
|
|
);
|
|
|
|
instaMapping = await ethers.getContractAt(
|
|
|
|
InstaMapping.abi,
|
|
|
|
hre.network.config.InstaMapping
|
|
|
|
);
|
|
|
|
instaList = await ethers.getContractAt(
|
|
|
|
InstaList.abi,
|
|
|
|
hre.network.config.InstaList
|
|
|
|
);
|
|
|
|
connectGelato = await ethers.getContractAt(
|
|
|
|
ConnectGelato.abi,
|
|
|
|
hre.network.config.ConnectGelato
|
|
|
|
);
|
|
|
|
connectMaker = await ethers.getContractAt(
|
|
|
|
ConnectMaker.abi,
|
|
|
|
hre.network.config.ConnectMaker
|
|
|
|
);
|
|
|
|
connectInstaPool = await ethers.getContractAt(
|
|
|
|
ConnectInstaPool.abi,
|
|
|
|
hre.network.config.ConnectInstaPool
|
|
|
|
);
|
|
|
|
connectCompound = await ethers.getContractAt(
|
|
|
|
ConnectCompound.abi,
|
|
|
|
hre.network.config.ConnectCompound
|
|
|
|
);
|
|
|
|
dssCdpManager = await ethers.getContractAt(
|
|
|
|
DssCdpManager.abi,
|
|
|
|
hre.network.config.DssCdpManager
|
|
|
|
);
|
|
|
|
getCdps = await ethers.getContractAt(GetCdps.abi, hre.network.config.GetCdps);
|
2020-11-02 10:51:49 +00:00
|
|
|
DAI = await ethers.getContractAt(IERC20.abi, hre.network.config.DAI);
|
2020-10-30 17:35:11 +00:00
|
|
|
gelatoCore = await ethers.getContractAt(
|
|
|
|
GelatoCoreLib.GelatoCore.abi,
|
|
|
|
hre.network.config.GelatoCore
|
|
|
|
);
|
|
|
|
cDaiToken = await ethers.getContractAt(
|
|
|
|
CTokenInterface.abi,
|
|
|
|
hre.network.config.CDAI
|
|
|
|
);
|
|
|
|
cEthToken = await ethers.getContractAt(
|
|
|
|
CTokenInterface.abi,
|
|
|
|
hre.network.config.CETH
|
|
|
|
);
|
|
|
|
instaConnectors = await ethers.getContractAt(
|
|
|
|
InstaConnector.abi,
|
|
|
|
hre.network.config.InstaConnectors
|
|
|
|
);
|
|
|
|
compoundResolver = await ethers.getContractAt(
|
|
|
|
CompoundResolver.abi,
|
|
|
|
hre.network.config.CompoundResolver
|
|
|
|
);
|
2020-11-03 11:48:00 +00:00
|
|
|
dsaProviderModule = await ethers.getContractAt(
|
|
|
|
DsaProviderModuleABI,
|
|
|
|
hre.network.config.ProviderModuleDsa
|
|
|
|
);
|
2020-10-30 17:35:11 +00:00
|
|
|
|
|
|
|
// ===== Deploy Needed Contract ==================
|
|
|
|
|
|
|
|
const PriceOracleResolver = await ethers.getContractFactory(
|
|
|
|
"PriceOracleResolver"
|
|
|
|
);
|
|
|
|
priceOracleResolver = await PriceOracleResolver.deploy();
|
|
|
|
await priceOracleResolver.deployed();
|
|
|
|
|
|
|
|
const ConditionMakerVaultUnsafe = await ethers.getContractFactory(
|
|
|
|
"ConditionMakerVaultUnsafe"
|
|
|
|
);
|
|
|
|
conditionMakerVaultUnsafe = await ConditionMakerVaultUnsafe.deploy();
|
|
|
|
await conditionMakerVaultUnsafe.deployed();
|
|
|
|
|
|
|
|
const ConnectGelatoProviderPayment = await ethers.getContractFactory(
|
|
|
|
"ConnectGelatoProviderPayment"
|
|
|
|
);
|
|
|
|
connectGelatoProviderPayment = await ConnectGelatoProviderPayment.deploy(
|
2020-11-03 11:48:00 +00:00
|
|
|
(await instaConnectors.connectorLength()).add(2),
|
|
|
|
providerAddress
|
2020-10-30 17:35:11 +00:00
|
|
|
);
|
|
|
|
await connectGelatoProviderPayment.deployed();
|
|
|
|
|
2020-11-02 10:51:49 +00:00
|
|
|
const MakerResolver = await ethers.getContractFactory("MakerResolver");
|
|
|
|
const makerResolver = await MakerResolver.deploy();
|
|
|
|
await makerResolver.deployed();
|
|
|
|
|
2020-10-30 17:35:11 +00:00
|
|
|
return {
|
2020-11-02 10:51:49 +00:00
|
|
|
connectGelato,
|
|
|
|
connectMaker,
|
|
|
|
connectInstaPool,
|
|
|
|
connectCompound,
|
|
|
|
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
|
|
|
connectGelatoData,
|
|
|
|
debtBridgeFromMakerForFullRefinance,
|
|
|
|
makerResolver,
|
2020-11-03 11:48:00 +00:00
|
|
|
dsaProviderModule,
|
2020-10-30 17:35:11 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = getContracts;
|