Skip to content

Commit ba5b065

Browse files
authored
Merge pull request ensdomains#258 from ensdomains/testnet-deploy
Deploy to Sepolia
2 parents 286d1de + b15f236 commit ba5b065

34 files changed

Lines changed: 12786 additions & 101 deletions

deploy/dnsregistrar/10_deploy_dnsregistrar.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
4040
}
4141

4242
func.tags = ['DNSRegistrar']
43-
func.dependencies = ['registry', 'dnssec-oracle', 'OffchainDNSResolver', 'Root']
43+
func.dependencies = [
44+
'registry',
45+
'dnssec-oracle',
46+
'OffchainDNSResolver',
47+
'Root',
48+
'setupRoot',
49+
]
4450

4551
export default func

deploy/ethregistrar/00_deploy_base_registrar_implementation.ts

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@ import { keccak256 } from 'js-sha3'
66

77
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
88
const { getNamedAccounts, deployments, network } = hre
9-
const { deploy, fetchIfDifferent } = deployments
10-
const { deployer, owner } = await getNamedAccounts()
9+
const { deploy } = deployments
10+
const { deployer } = await getNamedAccounts()
1111

1212
if (!network.tags.use_root) {
1313
return true
1414
}
1515

1616
const registry = await ethers.getContract('ENSRegistry')
17-
const root = await ethers.getContract('Root')
1817

1918
const deployArgs = {
2019
from: deployer,
@@ -24,22 +23,6 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
2423

2524
const bri = await deploy('BaseRegistrarImplementation', deployArgs)
2625
if (!bri.newlyDeployed) return
27-
28-
const registrar = await ethers.getContract('BaseRegistrarImplementation')
29-
30-
const tx1 = await registrar.transferOwnership(owner, { from: deployer })
31-
console.log(
32-
`Transferring ownership of registrar to owner (tx: ${tx1.hash})...`,
33-
)
34-
await tx1.wait()
35-
36-
const tx2 = await root
37-
.connect(await ethers.getSigner(owner))
38-
.setSubnodeOwner('0x' + keccak256('eth'), registrar.address)
39-
console.log(
40-
`Setting owner of eth node to registrar on root (tx: ${tx2.hash})...`,
41-
)
42-
await tx2.wait()
4326
}
4427

4528
func.id = 'registrar'
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import namehash from 'eth-ens-namehash'
2+
import { ethers } from 'hardhat'
3+
import { DeployFunction } from 'hardhat-deploy/types'
4+
import { HardhatRuntimeEnvironment } from 'hardhat/types'
5+
import { keccak256 } from 'js-sha3'
6+
7+
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
8+
const { getNamedAccounts, deployments, network } = hre
9+
const { deployer, owner } = await getNamedAccounts()
10+
11+
if (!network.tags.use_root) {
12+
return true
13+
}
14+
15+
const root = await ethers.getContract('Root')
16+
const registrar = await ethers.getContract('BaseRegistrarImplementation')
17+
18+
console.log('Running base registrar setup')
19+
20+
const tx1 = await registrar.transferOwnership(owner, { from: deployer })
21+
console.log(
22+
`Transferring ownership of registrar to owner (tx: ${tx1.hash})...`,
23+
)
24+
await tx1.wait()
25+
26+
const tx2 = await root
27+
.connect(await ethers.getSigner(owner))
28+
.setSubnodeOwner('0x' + keccak256('eth'), registrar.address)
29+
console.log(
30+
`Setting owner of eth node to registrar on root (tx: ${tx2.hash})...`,
31+
)
32+
await tx2.wait()
33+
}
34+
35+
func.id = 'setupRegistrar'
36+
func.tags = ['setupRegistrar']
37+
//Runs after the root is setup
38+
func.dependencies = ['setupRoot']
39+
40+
export default func

deploy/ethregistrar/02_deploy_legacy_eth_registrar_controller.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ func.dependencies = [
5959
'registry',
6060
'wrapper',
6161
'LegacyPublicResolver',
62+
'ExponentialPremiumPriceOracle',
6263
'ReverseRegistrar',
6364
]
6465

deploy/ethregistrar/03_deploy_eth_registrar_controller.ts

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77,25 +77,15 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
7777

7878
const artifact = await deployments.getArtifact('IETHRegistrarController')
7979
const interfaceId = computeInterfaceId(new Interface(artifact.abi))
80-
const provider = new ethers.providers.StaticJsonRpcProvider(
81-
ethers.provider.connection.url,
82-
{
83-
...ethers.provider.network,
84-
ensAddress: (await ethers.getContract('ENSRegistry')).address,
85-
},
86-
)
87-
const resolver = await provider.getResolver('eth')
88-
if (resolver === null) {
89-
registrar.setResolver(ethOwnedResolver.address)
80+
81+
const resolver = await registry.resolver(ethers.utils.namehash('eth'))
82+
if (resolver === ethers.constants.AddressZero) {
9083
console.log(
9184
`No resolver set for .eth; not setting interface ${interfaceId} for ETH Registrar Controller`,
9285
)
9386
return
9487
}
95-
const resolverContract = await ethers.getContractAt(
96-
'PublicResolver',
97-
resolver.address,
98-
)
88+
const resolverContract = await ethers.getContractAt('OwnedResolver', resolver)
9989
const tx3 = await resolverContract.setInterface(
10090
ethers.utils.namehash('eth'),
10191
interfaceId,

deploy/ethregistrar/04_deploy_bulk_renewal.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,15 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
3737
ensAddress: registry.address,
3838
},
3939
)
40-
const resolver = await provider.getResolver('eth')
41-
if (resolver === null) {
40+
41+
const resolver = await registry.resolver(ethers.utils.namehash('eth'))
42+
if (resolver === ethers.constants.AddressZero) {
4243
console.log(
43-
'No resolver set for .eth; not setting interface for BulkRenewal',
44+
`No resolver set for .eth; not setting interface ${interfaceId} for BulkRenewal`,
4445
)
4546
return
4647
}
47-
const resolverContract = await ethers.getContractAt(
48-
'PublicResolver',
49-
resolver.address,
50-
)
48+
const resolverContract = await ethers.getContractAt('OwnedResolver', resolver)
5149
const tx = await resolverContract.setInterface(
5250
ethers.utils.namehash('eth'),
5351
interfaceId,

deploy/registry/00_deploy_registry.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
1212
const { deployer, owner } = await getNamedAccounts()
1313

1414
if (network.tags.legacy) {
15+
console.log(deployer)
16+
console.log(owner)
1517
const contract = await deploy('LegacyENSRegistry', {
16-
from: deployer,
18+
from: owner,
1719
args: [],
1820
log: true,
1921
contract: await deployments.getArtifact('ENSRegistry'),
@@ -22,7 +24,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
2224
const legacyRegistry = await ethers.getContract('LegacyENSRegistry')
2325

2426
const rootTx = await legacyRegistry
25-
.connect(await ethers.getSigner(deployer))
27+
.connect(await ethers.getSigner(owner))
2628
.setOwner(ZERO_HASH, owner)
2729
console.log(`Setting owner of root node to owner (tx: ${rootTx.hash})`)
2830
await rootTx.wait()
Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,37 @@
11
import { DeployFunction } from 'hardhat-deploy/types'
22
import { HardhatRuntimeEnvironment } from 'hardhat/types'
3+
import { ethers } from 'hardhat'
34

45
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
56
const { getNamedAccounts, deployments } = hre
67
const { deploy } = deployments
7-
const { deployer } = await getNamedAccounts()
8+
const { deployer, owner } = await getNamedAccounts()
89

910
const deployArgs = {
1011
from: deployer,
1112
args: [],
1213
log: true,
1314
}
1415
const ethOwnedResolver = await deploy('OwnedResolver', deployArgs)
16+
17+
if (!ethOwnedResolver.newlyDeployed) return
18+
19+
const registry = await ethers.getContract('ENSRegistry', owner)
20+
const registrar = await ethers.getContract(
21+
'BaseRegistrarImplementation',
22+
owner,
23+
)
24+
25+
const tx = await registrar.setResolver(ethOwnedResolver.address)
26+
await tx.wait()
27+
28+
const resolver = await registry.resolver(ethers.utils.namehash('eth'))
29+
console.log(`set resolver for .eth to ${resolver}`)
1530
if (!ethOwnedResolver.newlyDeployed) return
1631
}
1732

18-
func.id = 'owned-resolver'
19-
func.tags = ['resolvers', 'OwnedResolver']
20-
func.dependencies = []
33+
func.id = 'eth-owned-resolver'
34+
func.tags = ['resolvers', 'OwnedResolver', 'EthOwnedResolver']
35+
func.dependencies = ['Registry']
2136

2237
export default func

deploy/root/00_deploy_root.ts

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ import { ethers } from 'hardhat'
22
import { DeployFunction } from 'hardhat-deploy/types'
33
import { HardhatRuntimeEnvironment } from 'hardhat/types'
44

5-
const ZERO_HASH =
6-
'0x0000000000000000000000000000000000000000000000000000000000000000'
7-
85
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
96
const { getNamedAccounts, deployments, network } = hre
107
const { deploy } = deployments
@@ -22,42 +19,6 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
2219
log: true,
2320
})
2421

25-
const root = await ethers.getContract('Root')
26-
27-
const tx1 = await registry.setOwner(ZERO_HASH, root.address)
28-
console.log(
29-
`Setting owner of root node to root contract (tx: ${tx1.hash})...`,
30-
)
31-
await tx1.wait()
32-
33-
const rootOwner = await root.owner()
34-
35-
switch (rootOwner) {
36-
case deployer:
37-
const tx2 = await root
38-
.connect(await ethers.getSigner(deployer))
39-
.transferOwnership(owner)
40-
console.log(
41-
`Transferring root ownership to final owner (tx: ${tx2.hash})...`,
42-
)
43-
await tx2.wait()
44-
case owner:
45-
if (!(await root.controllers(owner))) {
46-
const tx2 = await root
47-
.connect(await ethers.getSigner(owner))
48-
.setController(owner, true)
49-
console.log(
50-
`Setting final owner as controller on root contract (tx: ${tx2.hash})...`,
51-
)
52-
await tx2.wait()
53-
}
54-
break
55-
default:
56-
console.log(
57-
`WARNING: Root is owned by ${rootOwner}; cannot transfer to owner account`,
58-
)
59-
}
60-
6122
return true
6223
}
6324

deploy/root/00_setup_root.ts

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import { ethers } from 'hardhat'
2+
import { DeployFunction } from 'hardhat-deploy/types'
3+
import { HardhatRuntimeEnvironment } from 'hardhat/types'
4+
5+
const ZERO_HASH =
6+
'0x0000000000000000000000000000000000000000000000000000000000000000'
7+
8+
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
9+
const { getNamedAccounts, deployments, network } = hre
10+
const { deployer, owner } = await getNamedAccounts()
11+
12+
if (!network.tags.use_root) {
13+
return true
14+
}
15+
16+
console.log('Running root setup')
17+
18+
const registry = await ethers.getContract('ENSRegistry')
19+
const root = await ethers.getContract('Root')
20+
21+
const tx1 = await registry.setOwner(ZERO_HASH, root.address)
22+
console.log(
23+
`Setting owner of root node to root contract (tx: ${tx1.hash})...`,
24+
)
25+
await tx1.wait()
26+
27+
const rootOwner = await root.owner()
28+
29+
switch (rootOwner) {
30+
case deployer:
31+
const tx2 = await root
32+
.connect(await ethers.getSigner(deployer))
33+
.transferOwnership(owner)
34+
console.log(
35+
`Transferring root ownership to final owner (tx: ${tx2.hash})...`,
36+
)
37+
await tx2.wait()
38+
case owner:
39+
if (!(await root.controllers(owner))) {
40+
const tx2 = await root
41+
.connect(await ethers.getSigner(owner))
42+
.setController(owner, true)
43+
console.log(
44+
`Setting final owner as controller on root contract (tx: ${tx2.hash})...`,
45+
)
46+
await tx2.wait()
47+
}
48+
break
49+
default:
50+
console.log(
51+
`WARNING: Root is owned by ${rootOwner}; cannot transfer to owner account`,
52+
)
53+
}
54+
55+
return true
56+
}
57+
58+
func.id = 'setupRoot'
59+
func.tags = ['setupRoot']
60+
func.dependencies = ['Root']
61+
62+
export default func

0 commit comments

Comments
 (0)