Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fuji and Avalanche #41

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion scripts/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
13 changes: 11 additions & 2 deletions scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down