forked from ensdomains/ens-contracts
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
saransh
committed
Oct 30, 2021
1 parent
32607a1
commit 64221ec
Showing
14 changed files
with
2,296 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const { ethers } = require("hardhat"); | ||
const ZERO_HASH = "0x0000000000000000000000000000000000000000000000000000000000000000"; | ||
|
||
const ethernal = require('hardhat-ethernal'); | ||
|
||
const namehash = require('eth-ens-namehash'); | ||
const sha3 = require('web3-utils').sha3; | ||
|
||
module.exports = async ({getNamedAccounts, deployments, network}) => { | ||
const {deploy} = deployments; | ||
const {deployer, owner} = await getNamedAccounts(); | ||
|
||
const ens = await ethers.getContract('ENSRegistry') | ||
|
||
await deploy('BaseRegistrarImplementation', { | ||
from: deployer, | ||
args: [ens.address, namehash.hash('avax')], | ||
log: true | ||
}) | ||
|
||
const base = await ethers.getContract('BaseRegistrarImplementation'); | ||
|
||
const transactions = [] | ||
transactions.push(await base.addController(deployer)) | ||
transactions.push(await ens.setSubnodeOwner(ZERO_HASH, sha3('avax'), base.address)) | ||
|
||
console.log(`Waiting on ${transactions.length} transactions setting base registrar`); | ||
await Promise.all(transactions.map((tx) => tx.wait())); | ||
} | ||
|
||
|
||
module.exports.tags = ['baseregistrar']; | ||
module.exports.dependencies = ['registry'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const { ethers } = require("hardhat"); | ||
const ZERO_HASH = "0x0000000000000000000000000000000000000000000000000000000000000000"; | ||
const sha3 = require('web3-utils').sha3; | ||
const namehash = require('eth-ens-namehash'); | ||
module.exports = async ({getNamedAccounts, deployments, network}) => { | ||
const {deploy} = deployments; | ||
const {deployer, owner} = await getNamedAccounts(); | ||
|
||
const ens = await ethers.getContract('ENSRegistry'); | ||
const resolver = await ethers.getContract('PublicResolver'); | ||
|
||
await deploy('ReverseRegistrar', { | ||
from: deployer, | ||
args:[ens.address, resolver.address] | ||
}) | ||
const reverseRegistrar = await ethers.getContract('ReverseRegistrar'); | ||
|
||
const transactions = [] | ||
transactions.push(await ens.setSubnodeOwner(ZERO_HASH, sha3('reverse'), deployer)) | ||
transactions.push(await ens.setSubnodeOwner(namehash.hash('reverse'),sha3('addr'),reverseRegistrar.address)) | ||
console.log(`Waiting on settings to take place of reverse registrar ${transactions.length}`) | ||
await Promise.all(transactions.map((tx) => tx.wait())); | ||
} | ||
|
||
module.exports.tags = ['reverse-registrar']; | ||
module.exports.dependencies = ['registry', 'public-resolver'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const { ethers } = require("hardhat"); | ||
|
||
|
||
module.exports = async ({getNamedAccounts, deployments, network}) => { | ||
const {deploy} = deployments; | ||
const {deployer, owner} = await getNamedAccounts(); | ||
|
||
const baseRegistrar = await ethers.getContract('BaseRegistrarImplementation'); | ||
|
||
const priceOracle = await ethers.getContract('StablePriceOracle') | ||
|
||
await deploy('ETHRegistrarController', { | ||
from: deployer, | ||
args: [baseRegistrar.address, priceOracle.address, 600, 86400], | ||
log: true | ||
}) | ||
|
||
const controller = await ethers.getContract('ETHRegistrarController') | ||
const transactions = [] | ||
transactions.push(await baseRegistrar.addController(controller.address, {from: deployer})) | ||
// ESTIMATE GAS --> | ||
transactions.push(await controller.setPriceOracle(priceOracle.address, {from: deployer})); | ||
console.log(`Waiting on settings to take place ${transactions.length}`) | ||
await Promise.all(transactions.map((tx) => tx.wait())); | ||
|
||
|
||
|
||
|
||
|
||
} | ||
|
||
module.exports.tags = ['eth-registrar']; | ||
module.exports.dependencies = ['registry', 'oracles'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const { ethers } = require("hardhat"); | ||
|
||
module.exports = async ({getNamedAccounts, deployments, network}) => { | ||
const {deploy} = deployments; | ||
const {deployer, owner} = await getNamedAccounts(); | ||
const oracle = await deploy('DummyOracle', { | ||
from: deployer, | ||
args:[1000], | ||
log:true | ||
}) | ||
|
||
await deploy('StablePriceOracle', { | ||
from: deployer, | ||
args:[oracle.address,[1]], | ||
log:true | ||
}) | ||
|
||
|
||
} | ||
|
||
module.exports.tags = ['oracles']; | ||
module.exports.dependencies = ['registry'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const { ethers } = require("hardhat"); | ||
|
||
|
||
module.exports = async ({getNamedAccounts, deployments, network}) => { | ||
const {deploy} = deployments; | ||
const {deployer, owner} = await getNamedAccounts(); | ||
|
||
const ens = await ethers.getContract('ENSRegistry') | ||
|
||
const publicResolver = await deploy('DefaultReverseResolver', { | ||
from: deployer, | ||
args: [ens.address], | ||
log: true | ||
}) | ||
|
||
|
||
|
||
} | ||
|
||
module.exports.tags = ['reverse-resolver']; | ||
module.exports.dependencies = ['registry'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
const { ethers } = require("hardhat"); | ||
const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"; | ||
const ZERO_HASH = "0x0000000000000000000000000000000000000000000000000000000000000000" | ||
const sha3 = require('web3-utils').sha3; | ||
|
||
module.exports = async ({getNamedAccounts, deployments, network}) => { | ||
const {deploy} = deployments; | ||
const {deployer, owner} = await getNamedAccounts(); | ||
|
||
const ens = await ethers.getContract('ENSRegistry') | ||
|
||
await deploy('PublicResolver', { | ||
from: deployer, | ||
args: [ens.address, ZERO_ADDRESS], | ||
log: true | ||
}) | ||
|
||
const resolver = await ethers.getContract('PublicResolver') | ||
|
||
const transactions = [] | ||
transactions.push(await ens.setSubnodeOwner(ZERO_HASH, sha3('avax'), deployer)) | ||
transactions.push(await ens.setResolver(namehash.hash('avax'), resolver.address)) | ||
transactions.push(await resolver['setAddr(bytes32,address)'](namehash.hash('avax'), resolver.address)) | ||
console.log(`Waiting on settings to take place on resolvers ${transactions.length}`) | ||
await Promise.all(transactions.map((tx) => tx.wait())); | ||
|
||
// const rootOwner = await ens.owner(ZERO_HASH); | ||
// switch(rootOwner) { | ||
// case deployer: | ||
// // const tx = await base.addController(owner, {from: deployer}); | ||
// // console.log("Setting Controller on base (tx:${tx.hash})..."); | ||
// // await tx.wait(); | ||
// break; | ||
// case owner: | ||
// console.log('e') | ||
// const tx = await ens.setSubnodeOwner(ZERO_HASH, sha3('avax'), owner, {from: deployer}); | ||
// console.log("Setting Controller on base (tx:${tx.hash})..."); | ||
// await tx.wait(); | ||
// break; | ||
// default: | ||
// console.log(`WARNING: ENS registry root is owned by ${rootOwner}; cannot transfer to owner`); | ||
// } | ||
|
||
|
||
|
||
} | ||
|
||
module.exports.tags = ['public-resolver']; | ||
module.exports.dependencies = ['registry'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
43112 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"ens": 1635592240 | ||
} |
Oops, something went wrong.