"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.setupUmaEcosystem = setupUmaEcosystem;
const getContractFactory_1 = require("../utils/getContractFactory");
const constants_1 = require("../constants");
const utils_1 = require("../../src/utils");
async function setupUmaEcosystem(owner) {
    const timer = await (await (0, getContractFactory_1.getContractFactory)("Timer", owner)).deploy();
    const finder = await (await (0, getContractFactory_1.getContractFactory)("Finder", owner)).deploy();
    const identifierWhitelist = await (await (0, getContractFactory_1.getContractFactory)("IdentifierWhitelist", owner)).deploy();
    const mockOracle = await (await (0, getContractFactory_1.getContractFactory)("MockOracleAncillary", owner)).deploy(finder.address, timer.address);
    const optimisticOracle = await (await (0, getContractFactory_1.getContractFactory)("SkinnyOptimisticOracle", owner)).deploy(constants_1.refundProposalLiveness, finder.address, timer.address);
    const collateralWhitelist = await (await (0, getContractFactory_1.getContractFactory)("AddressWhitelist", owner)).deploy();
    const store = await (await (0, getContractFactory_1.getContractFactory)("Store", owner)).deploy({ rawValue: "0" }, { rawValue: "0" }, timer.address);
    await finder.changeImplementationAddress((0, utils_1.utf8ToHex)("CollateralWhitelist"), collateralWhitelist.address);
    await finder.changeImplementationAddress((0, utils_1.utf8ToHex)("IdentifierWhitelist"), identifierWhitelist.address);
    await finder.changeImplementationAddress((0, utils_1.utf8ToHex)("SkinnyOptimisticOracle"), optimisticOracle.address);
    await finder.changeImplementationAddress((0, utils_1.utf8ToHex)("Store"), store.address);
    await finder.changeImplementationAddress((0, utils_1.utf8ToHex)("Oracle"), mockOracle.address);
    await identifierWhitelist.addSupportedIdentifier(constants_1.identifier);
    return {
        timer,
        finder,
        collateralWhitelist,
        identifierWhitelist,
        store,
        optimisticOracle,
        mockOracle,
    };
}
//# sourceMappingURL=UmaEcosystemFixture.js.map