import { deployScript } from '@rocketh';
import legacyArtifactRaw from '../../deployments/archive/ETHRegistrarController_mainnet_9380471.sol/ETHRegistrarController_mainnet_9380471.json';
const legacyArtifact = {
    ...legacyArtifactRaw,
    metadata: '{}',
    abi: legacyArtifactRaw.abi,
};
export default deployScript(async ({ deploy, get, execute: write, namedAccounts, registerLegacyNames, }) => {
    const { deployer, owner } = namedAccounts;
    const registrar = get('BaseRegistrarImplementation');
    const registrarSecurityController = get('RegistrarSecurityController');
    const priceOracle = get('ExponentialPremiumPriceOracle');
    const controller = await deploy('LegacyETHRegistrarController', {
        account: deployer,
        artifact: legacyArtifact,
        args: [registrar.address, priceOracle.address, 60n, 86400n],
    });
    console.log(`  - Adding LegacyETHRegistrarController via RegistrarSecurityController`);
    await write(registrarSecurityController, {
        functionName: 'addRegistrarController',
        args: [controller.address],
        account: owner,
    });
    if (registerLegacyNames) {
        console.log('  - Running registerLegacyNames hook');
        await registerLegacyNames();
    }
}, {
    id: 'ETHRegistrarController v1.0.0',
    tags: ['category:ethregistrar', 'LegacyETHRegistrarController'],
    dependencies: [
        'BaseRegistrarImplementation',
        'RegistrarSecurityController',
        'ExponentialPremiumPriceOracle',
    ],
});
