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

Fix/deployment script #330

Merged
merged 5 commits into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
network.name
);

await managingDaoContract.setMetadata(
const setMetadataTX = await managingDaoContract.setMetadata(
ethers.utils.hexlify(ethers.utils.toUtf8Bytes(`ipfs://${metadataCIDPath}`))
);
await setMetadataTX.wait();
};
export default func;
func.tags = ['RegisterManagingDAO'];
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
);
};
export default func;
func.tags = ['RegisterManagingDAO'];
func.tags = ['RevokeManagingPermissionsDAO'];
6 changes: 6 additions & 0 deletions packages/contracts/networks.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,11 @@
"gasPrice": 40000000000,
"chainId": 137,
"feesUrl": "https://gasstation-mainnet.matic.network/v2"
},
"mumbai": {
"url": "https://rpc.ankr.com/polygon_mumbai",
"isTestnet": true,
"chainId": 80001,
"feesUrl": "https://gasstation-mumbai.matic.today/v2"
}
}
26 changes: 25 additions & 1 deletion packages/contracts/utils/ens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ export async function setupENS(domains: string[], hre: EHRE): Promise<any> {
const resolver = await deployments.get('PublicResolver');

for (let i = 0; i < domains.length; i++) {
console.log(`Registering subdomain ${domains[i]}`);

const resolvedResolver = await ens.resolver(ensDomainHash(domains[i]));
if (resolvedResolver === resolver.address) {
console.log(`${domains[i]} already registered. Skipping...`);
continue;
}

// Register subdomains in the reverse order
let domainNamesReversed = domains[i].split('.');
domainNamesReversed.push(''); //add the root domain
Expand All @@ -46,15 +54,31 @@ export async function setupENS(domains: string[], hre: EHRE): Promise<any> {
.filter(value => value !== '')
.reverse()
.join('.');
await ens.setSubnodeRecord(

// skipping if it is already set
const resolvedResolver = await ens.resolver(
ensDomainHash(
`${domainNamesReversed[i + 1]}${domain ? '.' + domain : ''}`
)
);
if (resolvedResolver !== ethers.constants.AddressZero) {
continue;
}

const tx = await ens.setSubnodeRecord(
ensDomainHash(domain),
ensLabelHash(domainNamesReversed[i + 1]),
deployer.address,
resolver.address,
0
);
await tx.wait();
}

console.log(`Registered subdomain ${domains[i]}`);
}

console.log(`ENS Setup complete!`);

return ens;
}