Gelato-automations/test/gas/debt_bridge/full/from_maker/helpers/setupFullRefinanceMakerToNewMaker.mock.js
2020-11-25 13:20:57 +01:00

77 lines
2.4 KiB
JavaScript

const getWallets = require("../../../../../helpers/services/getWallets");
const getContracts = require("../../../../../helpers/services/getContracts");
const getDebtBridgeFromMakerConstants = require("../../../../../integration/debt_bridge/from_maker/services/getDebtBridgeFromMakerConstants");
const provideFunds = require("../../../../../helpers/services/gelato/provideFunds");
const providerAssignsExecutor = require("../../../../../helpers/services/gelato/providerAssignsExecutor");
const addProviderModuleDSA = require("../../../../../helpers/services/gelato/addProviderModuleDSA");
const createDSA = require("../../../../../helpers/services/InstaDapp/createDSA");
const initializeMakerCdp = require("../../../../../helpers/services/maker/initializeMakerCdp");
const createVaultForETHB = require("../../../../../helpers/services/maker/createVaultForETHB");
const getMockSpellsETHAnewETHB = require("./services/getSpells-ETHA-newETHB.mock");
const getABI = require("../../../../../helpers/services/getABI");
module.exports = async function (mockRoute) {
const wallets = await getWallets();
const contracts = await getContracts();
const constants = await getDebtBridgeFromMakerConstants();
const ABI = getABI();
// Gelato Testing environment setup.
await provideFunds(
wallets.gelatoProviderWallet,
contracts.gelatoCore,
constants.GAS_LIMIT,
constants.GAS_PRICE_CEIL
);
await providerAssignsExecutor(
wallets.gelatoProviderWallet,
contracts.mockDebtBridgeETHBExecutor.address,
contracts.gelatoCore
);
await addProviderModuleDSA(
wallets.gelatoProviderWallet,
contracts.gelatoCore,
contracts.dsaProviderModule.address
);
contracts.dsa = await createDSA(
wallets.userAddress,
contracts.instaIndex,
contracts.instaList
);
const vaultAId = await initializeMakerCdp(
wallets.userAddress,
contracts.DAI,
contracts.dsa,
contracts.getCdps,
contracts.dssCdpManager,
constants.MAKER_INITIAL_ETH,
constants.MAKER_INITIAL_DEBT,
ABI.ConnectMakerABI
);
const vaultBId = await createVaultForETHB(
wallets.userAddress,
contracts.DAI,
contracts.dsa,
contracts.getCdps,
contracts.dssCdpManager
);
const spells = await getMockSpellsETHAnewETHB(
wallets,
contracts,
constants,
mockRoute,
vaultAId,
vaultBId
);
return {
wallets,
contracts,
constants,
vaultAId,
vaultBId,
spells,
ABI,
};
};