diff --git a/scripts/config.ts b/scripts/config.ts index 1e0337f..f359f6b 100644 --- a/scripts/config.ts +++ b/scripts/config.ts @@ -73,11 +73,24 @@ const configSchema = yup.object({ /** The address of the ENS public resolver contract. If empty or 0x0, a new one has to be deployed. */ ensResolver: yup.string().optional().nullable(), }), + avalanche: yup.object({ + /** The address of the ENS registry contract. If empty or 0x0, a new registry has to be deployed. */ + ensRegistry: yup.string().optional().nullable(), + /** The address of the ENS public resolver contract. If empty or 0x0, a new one has to be deployed. */ + ensResolver: yup.string().optional().nullable(), + }), + fuji: yup.object({ + /** The address of the ENS registry contract. If empty or 0x0, a new registry has to be deployed. */ + ensRegistry: yup.string().optional().nullable(), + /** The address of the ENS public resolver contract. If empty or 0x0, a new one has to be deployed. */ + ensResolver: yup.string().optional().nullable(), + }), + // mainnet, goerli, ropsten, etc use the official ENS contracts }), ethereum: yup.object({ /** The Ethereum network ID being used */ - networkId: yup.string().oneOf(["mainnet", "goerli", "xdai", "sokol", "rinkeby", "matic", "unknown"]).required(), + networkId: yup.string().oneOf(["mainnet", "goerli", "xdai", "sokol", "rinkeby", "matic", "unknown", "avalanche", "fuji"]).required(), /** The Ethereum chain ID being used */ chainId: yup.number().min(0).required(), /** The Web3 endpoint to use for deploying the contracts */ diff --git a/scripts/deploy.ts b/scripts/deploy.ts index b0492f4..8c12706 100644 --- a/scripts/deploy.ts +++ b/scripts/deploy.ts @@ -52,6 +52,13 @@ else if (config.ethereum.networkId == "sokol") { else if (config.ethereum.networkId == "matic") { rpcParams = { chainId: config.ethereum.chainId, name: config.ethereum.networkId, ensAddress: config.contracts.matic.ensRegistry } } +else if (config.ethereum.networkId == "avalanche") { + rpcParams = { chainId: config.ethereum.chainId, name: config.ethereum.networkId, ensAddress: config.contracts.avalanche.ensRegistry } +} +else if (config.ethereum.networkId == "fuji") { + transactionOptions.gasPrice = utils.parseUnits("25", "gwei") + rpcParams = { chainId: config.ethereum.chainId, name: config.ethereum.networkId, ensAddress: config.contracts.fuji.ensRegistry } +} else { rpcParams = { chainId: config.ethereum.chainId, name: config.ethereum.networkId, ensAddress: ENS_GLOBAL_REGISTRY } } @@ -98,7 +105,8 @@ async function deployEnsContracts() { console.log("ENS contracts") // Deploy the ENS registry and resolver (if relevant) - if (config.ethereum.networkId == "xdai" || config.ethereum.networkId == "sokol" || config.ethereum.networkId == "matic") { + if (config.ethereum.networkId == "xdai" || config.ethereum.networkId == "sokol" || config.ethereum.networkId == "matic" || + config.ethereum.networkId == "fuji" || config.ethereum.networkId == "avalanche") { const ensRegistryFactory = new ContractFactory(ENSRegistryAbi, ENSRegistryBytecode, wallet) if (config.features.ensRegistry) { @@ -323,7 +331,8 @@ async function setEnsDomainNames(contractAddresses: { ensRegistry: string, ensPu let vocdoniEthNode: string // if sokol or xdai set registry owner and register .eth TLD and voc.eth domain - if (config.ethereum.networkId == "xdai" || config.ethereum.networkId == "sokol" || config.ethereum.networkId == "matic") { + if (config.ethereum.networkId == "xdai" || config.ethereum.networkId == "sokol" || config.ethereum.networkId == "matic" + || config.ethereum.networkId == "fuji" || config.ethereum.networkId == "avalanche") { // Check that the root is registered correctly if ((await ensRegistryInstance.owner(rootNode)) != wallet.address) { const tx = await ensRegistryInstance.setOwner(rootNode, wallet.address)