Skip to content

Commit

Permalink
Merge pull request #101 from ensdomains/feat/namewrapper-upgrade
Browse files Browse the repository at this point in the history
feat: namewrapper update
  • Loading branch information
TateB authored Jan 24, 2023
2 parents 96180f1 + 4e74207 commit 19f2e76
Show file tree
Hide file tree
Showing 45 changed files with 1,920 additions and 876 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- run: pnpm install --frozen-lockfile

- name: Run tests
run: pnpm -F @ensdomains/ensjs tenv start
run: pnpm -F @ensdomains/ensjs tenv start --extra-time 11368000
env:
STATIC_ENS: ${{ matrix.type == 'static' }}
lint:
Expand Down
Binary file modified packages/ensjs/archive.tar.lz4
Binary file not shown.
17 changes: 15 additions & 2 deletions packages/ensjs/deploy/00_register_legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ const names: {
data: object | string
}
}
duration?: number
subnames?: Subname[]
}[] = [
{
Expand Down Expand Up @@ -287,6 +288,12 @@ const names: {
},
},
},
{
label: 'expired',
namedOwner: 'owner',
namedAddr: 'owner',
duration: 2419200,
},
...Array.from({ length: 34 }, (_, i) => ({
label: `${i}-dummy`,
namedOwner: 'owner2',
Expand All @@ -303,13 +310,19 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

await network.provider.send('anvil_setBlockTimestampInterval', [60])

for (const { label, namedOwner, namedAddr, records, subnames } of names) {
for (const {
label,
namedOwner,
namedAddr,
records,
subnames,
duration = 31536000,
} of names) {
const secret =
'0x0000000000000000000000000000000000000000000000000000000000000000'
const registrant = allNamedAccts[namedOwner]
const resolver = publicResolver.address
const addr = allNamedAccts[namedAddr]
const duration = 31536000

const commitment = await controller.makeCommitmentWithConfig(
label,
Expand Down
38 changes: 24 additions & 14 deletions packages/ensjs/deploy/00_register_wrapped.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,39 @@
/* eslint-disable import/no-extraneous-dependencies */
/* eslint-disable no-await-in-loop */
import { BigNumber } from '@ethersproject/bignumber'
import { ethers } from 'hardhat'
import { DeployFunction } from 'hardhat-deploy/types'
import { HardhatRuntimeEnvironment } from 'hardhat/types'
import { namehash } from '../src/utils/normalise'

const names = [
const names: {
label: string
namedOwner: string
data?: any[]
reverseRecord?: boolean
fuses?: number
subnames?: {
label: string
namedOwner: string
}[]
duration?: number
}[] = [
{
label: 'wrapped',
namedOwner: 'owner',
data: [],
reverseRecord: true,
fuses: 0,
},
{
label: 'wrapped-with-subnames',
namedOwner: 'owner',
data: [],
reverseRecord: false,
fuses: 0,
subnames: [{ label: 'test', namedOwner: 'owner2' }],
},
{
label: 'expired-wrapped',
namedOwner: 'owner',
subnames: [{ label: 'test', namedOwner: 'owner2' }],
duration: 2419200,
},
]

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
Expand All @@ -35,17 +48,16 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
for (const {
label,
namedOwner,
data,
reverseRecord,
fuses,
data = [],
reverseRecord = false,
fuses = 0,
subnames,
duration = 31536000,
} of names) {
const secret =
'0x0000000000000000000000000000000000000000000000000000000000000000'
const owner = allNamedAccts[namedOwner]
const resolver = publicResolver.address
const duration = 31536000
const wrapperExpiry = 1659467455 + duration

const commitment = await controller.makeCommitment(
label,
Expand All @@ -56,7 +68,6 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
data,
reverseRecord,
fuses,
wrapperExpiry,
)

const _controller = controller.connect(await ethers.getSigner(owner))
Expand All @@ -79,7 +90,6 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
data,
reverseRecord,
fuses,
wrapperExpiry,
{
value: price,
},
Expand All @@ -103,7 +113,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
resolver,
'0',
'0',
wrapperExpiry,
BigNumber.from(2).pow(64).sub(1),
)
console.log(` - ${subnameLabel} (tx: ${setSubnameTx.hash})...`)
await setSubnameTx.wait()
Expand Down
6 changes: 3 additions & 3 deletions packages/ensjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"license": "MIT",
"scripts": {
"tenv": "ens-test-env -a",
"denv": "pnpm tenv start -ns -nb --extra-time 11368000",
"denv": "pnpm tenv start -ns -nb --extra-time 11368000 --verbosity 1",
"generate-types": "ts-node scripts/runTypechain.ts",
"generate-abis": "hardhat export-abi",
"start": "ts-node --files src/index.test.ts",
Expand Down Expand Up @@ -86,9 +86,8 @@
"traverse": "^0.6.6"
},
"devDependencies": {
"ethers": "^5.7.2",
"@ensdomains/buffer": "^0.0.13",
"@ensdomains/ens-contracts": "^0.0.15",
"@ensdomains/ens-contracts": "^0.0.16",
"@ensdomains/ens-test-env": "workspace:*",
"@ethersproject/abi": "^5.6.4",
"@ethersproject/abstract-provider": "^5.7.0",
Expand Down Expand Up @@ -116,6 +115,7 @@
"dotenv": "^16.0.0",
"esbuild": "^0.15.6",
"eslint-plugin-jest": "^27.0.1",
"ethers": "^5.7.2",
"ganache": "^7.4.0",
"glob": "^8.0.3",
"hardhat": "2.10.2",
Expand Down
8 changes: 4 additions & 4 deletions packages/ensjs/src/contracts/getContractAddress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ const addresses: Record<
'1': '0x283af0b28c62c092c9727f1ee09c02ca627eb7f5',
'3': '0xa5627AB7Ae47063B533622C34FEBDb52d3281dF8',
'4': '0x283af0b28c62c092c9727f1ee09c02ca627eb7f5',
'5': '0x9C51161bA2FB02Cc0a403332B607117685f34831',
'5': '0xb7A1f9e633fdeaAa2ec44bE00a61a7Db9a733D70',
},
Multicall: '0xcA11bde05977b3631167028862bE2a173976CA11',
NameWrapper: {
'1': '0x0000000000000000000000000000000000000000',
'3': '0xF82155e2a43Be0871821E9654Fc8Ae894FB8307C',
'4': '0x0000000000000000000000000000000000000000',
'5': '0x582224b8d4534F4749EFA4f22eF7241E0C56D4B8',
'5': '0xEe1F756aCde7E81B2D8cC6aB3c8A1E2cE6db0F39',
},
PublicResolver: {
'1': '0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41',
'3': '0x13F0659Ee6bb7484C884FEeFb7F75C93951ef837',
'5': '0xE264d5bb84bA3b8061ADC38D3D76e6674aB91852',
'5': '0x2800Ec5BAB9CE9226d19E0ad5BC607e3cfC4347E',
},
ENSRegistry: {
'1': '0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e',
Expand All @@ -43,7 +43,7 @@ const addresses: Record<
ReverseRegistrar: {
'1': '0x084b1c3C81545d370f3634392De611CaaBFf8148',
'3': '0x806246b52f8cB61655d3038c58D2f63Aa55d4edE',
'5': '0xD5610A08E370051a01fdfe4bB3ddf5270af1aA48',
'5': '0x9a879320A9F7ad2BBb02063d67baF5551D6BD8B0',
},
UniversalResolver: {
'1': '0x74E20Bd2A1fE0cdbe45b9A1d89cb7e0a45b36376',
Expand Down
148 changes: 0 additions & 148 deletions packages/ensjs/src/functions/burnFuses.test.ts

This file was deleted.

16 changes: 0 additions & 16 deletions packages/ensjs/src/functions/burnFuses.ts

This file was deleted.

3 changes: 0 additions & 3 deletions packages/ensjs/src/functions/commitName.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ describe('commitName', () => {
expect(popTx).toBeTruthy()
expect(customData).toHaveProperty('secret')
expect(customData).toHaveProperty('commitment')
expect(customData).toHaveProperty('wrapperExpiry')

const tx = await provider.getSigner().sendTransaction(popTx)
await tx.wait()
Expand All @@ -47,11 +46,9 @@ describe('commitName', () => {
owner: accounts[1],
addressOrIndex: accounts[1],
secret,
wrapperExpiry: 100000,
})
await tx.wait()
expect(tx.customData).toBeTruthy()
expect(tx.customData!.wrapperExpiry).toBe(100000)
expect(tx.customData!.secret).toBe(secret)

const controller = await ensInstance.contracts!.getEthRegistrarController()!
Expand Down
Loading

0 comments on commit 19f2e76

Please sign in to comment.