"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createFixture = createFixture;
const tslib_1 = require("tslib");
const hardhat_1 = tslib_1.__importDefault(require("hardhat"));
function createFixture(setup) {
    let result;
    let snapshotId;
    return async () => {
        if (snapshotId !== undefined) {
            const reverted = await hardhat_1.default.network.provider.send("evm_revert", [snapshotId]);
            if (reverted) {
                snapshotId = (await hardhat_1.default.network.provider.send("evm_snapshot", []));
                return result;
            }
        }
        result = await setup();
        snapshotId = (await hardhat_1.default.network.provider.send("evm_snapshot", []));
        return result;
    };
}
//# sourceMappingURL=utils.js.map