Skip to content
Open
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
99651a0
Add showName
makoto Oct 15, 2025
eb8e968
Add owner and resolver info
makoto Oct 15, 2025
4a0b6d3
Add expiry date
makoto Oct 16, 2025
0041977
Transfer owner
makoto Oct 16, 2025
103f83f
Renwed name
makoto Oct 16, 2025
3a11a2b
Add subnames
makoto Oct 16, 2025
787b0e6
Add UserRegistry to deployment script
makoto Oct 16, 2025
f3914d3
Bridge name
makoto Oct 16, 2025
ce5ad48
Disable bridgeName function for now
makoto Oct 16, 2025
0e494be
Enable bridgeName.eth
makoto Oct 16, 2025
4ceef91
fix encoding, use waitFor
adraffy Oct 16, 2025
80f7973
Add bridge.eth to showName
makoto Oct 17, 2025
b1a7efe
Deploy l1 resolver before bridging
makoto Oct 17, 2025
1ababa2
Change showName format
makoto Oct 17, 2025
b000385
Check the actual resolver
makoto Oct 17, 2025
1d07dfa
Refactoring
makoto Oct 17, 2025
14e4ee8
Add changeRole
makoto Oct 17, 2025
d0f9508
Make description shorter
makoto Oct 17, 2025
3b39334
Add linkName
makoto Oct 17, 2025
efd3de3
Refactor some functions
makoto Oct 17, 2025
83f77eb
Remove created
makoto Oct 17, 2025
c4483e4
Clean up unused variables and comments
makoto Oct 17, 2025
7962587
Remove relay var
makoto Oct 17, 2025
0fd7186
Merge branch 'main' into add-tests
makoto Oct 17, 2025
ad398d5
Remove RESOLVER_ABI constant
makoto Oct 17, 2025
227a624
Simplify the code
makoto Oct 17, 2025
cc5d90c
Use parseName
makoto Oct 17, 2025
d1da503
Fix 0x address issue
makoto Oct 17, 2025
a32baa9
Use constant
makoto Oct 20, 2025
b87211a
Simplify traverseL2Registry
makoto Oct 20, 2025
aa3b0d0
Extract into getParentWithSubregistry
makoto Oct 20, 2025
1371395
Use multicall
makoto Oct 20, 2025
8f739ad
Use pareseName
makoto Oct 20, 2025
1981aec
Add registry info
makoto Oct 20, 2025
4c1d9f0
Remove some console.log
makoto Oct 20, 2025
767be6d
Fix type check error
makoto Oct 20, 2025
801c492
Merge branch 'main' into add-tests
makoto Oct 21, 2025
a615c6d
Extract into testNames
makoto Oct 21, 2025
97ed241
Add --testNames flag
makoto Oct 21, 2025
d062970
Add reregisterName
makoto Oct 21, 2025
fc9b893
Add trackGas
makoto Oct 23, 2025
999f11f
Fix type check error
makoto Oct 23, 2025
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
25 changes: 25 additions & 0 deletions contracts/deploy/shared/01_UserRegistry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { artifacts, execute } from "@rocketh";

export default execute(
async ({ deploy, get, namedAccounts: { deployer } }) => {
const registryDatastore =
get<(typeof artifacts.RegistryDatastore)["abi"]>("RegistryDatastore");

const registryMetadata = get<
(typeof artifacts.SimpleRegistryMetadata)["abi"]
>("SimpleRegistryMetadata");

await deploy("UserRegistryImpl", {
account: deployer,
artifact: artifacts.UserRegistry,
args: [
registryDatastore.address,
registryMetadata.address,
],
});
},
{
tags: ["UserRegistry", "shared"],
dependencies: ["RegistryDatastore", "RegistryMetadata"],
},
);
64 changes: 62 additions & 2 deletions contracts/script/runDevnet.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import { getAddress, toHex } from "viem";
import { setupCrossChainEnvironment } from "./setup.js";
import { registerTestNames } from "./testNames.js";
import {
registerTestNames,
showName,
transferName,
renewName,
createSubname,
bridgeName,
changeRole,
linkName,
} from "./testNames.js";
import { setupMockRelay } from "./mockRelay.js";
import { createServer } from "node:http";
import { parseArgs } from "node:util";
import { ROLES } from "../deploy/constants.js";

const t0 = Date.now();

Expand Down Expand Up @@ -68,8 +78,58 @@ for (const lx of [env.l1, env.l2]) {
})),
);
}
// Register all test names with default 1 year expiry
await registerTestNames(env, [
"test",
"example",
"demo",
"newowner",
"renew",
"parent",
"bridge",
"changerole",
]);

await registerTestNames(env, ["test", "example", "demo"]);
// Transfer newowner.eth to user
await transferName(env, "newowner.eth", env.namedAccounts.user.address);

// Renew renew.eth for 365 days
await renewName(env, "renew.eth", 365);

// Create subnames - need to create children too so sub1.sub2.parent.eth has a subregistry
const createdSubnames = await createSubname(env, "wallet.sub1.sub2.parent.eth");

// Change roles on changerole.eth - grant ROLE_SET_RESOLVER to user, revoke ROLE_SET_TOKEN_OBSERVER
await changeRole(
env,
"changerole.eth",
env.namedAccounts.user.address,
ROLES.OWNER.EAC.SET_RESOLVER,
ROLES.OWNER.EAC.SET_TOKEN_OBSERVER,
);

// Link sub1.sub2.parent.eth to parent.eth with different label (creates linked.parent.eth with shared children)
// Now wallet.linked.parent.eth and wallet.sub1.sub2.parent.eth will be the same token
await linkName(env, "sub1.sub2.parent.eth", "parent.eth", "linked");

const allNames = [
"test.eth",
"example.eth",
"demo.eth",
"newowner.eth",
"renew.eth",
"parent.eth",
"bridge.eth",
"changerole.eth",
...createdSubnames,
"linked.parent.eth",
"wallet.linked.parent.eth", // Should also be same as wallet.sub1.sub2.parent.eth
];

// Bridge bridge.eth from L2 to L1
await bridgeName(env, "bridge.eth");

await showName(env, allNames);

console.log(new Date(), `Ready! <${Date.now() - t0}ms>`);

Expand Down
23 changes: 23 additions & 0 deletions contracts/script/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
publicActions,
testActions,
zeroAddress,
encodeFunctionData,
type Account,
type Chain,
type GetContractReturnType,
Expand Down Expand Up @@ -52,6 +53,7 @@ const sharedContracts = {
SimpleRegistryMetadata: artifacts.SimpleRegistryMetadata.abi,
VerifiableFactory: artifacts.VerifiableFactory.abi,
DedicatedResolverImpl: artifacts.DedicatedResolver.abi,
UserRegistryImpl: artifacts.UserRegistry.abi,
// common
MockBridge: artifacts.MockBridgeBase.abi,
ETHRegistry: artifacts.PermissionedRegistry.abi,
Expand Down Expand Up @@ -211,6 +213,25 @@ export class ChainDeployment<
salt,
});
}
deployUserRegistry(
account: Account,
roles: bigint,
admin: string,
salt?: bigint,
) {
return deployVerifiableProxy({
walletClient: createClient(this.transport, this.client.chain, account),
factoryAddress: this.contracts.VerifiableFactory.address,
implAddress: this.contracts.UserRegistryImpl.address,
implAbi: this.contracts.UserRegistryImpl.abi,
callData: encodeFunctionData({
abi: this.contracts.UserRegistryImpl.abi,
functionName: "initialize",
args: [roles, admin],
} as any) as `0x${string}`,
salt,
});
}
}

export async function setupCrossChainEnvironment({
Expand Down Expand Up @@ -255,6 +276,8 @@ export async function setupCrossChainEnvironment({
console.log("Deploying ENSv2...");
await patchArtifactsV1();

await patchArtifactsV1();

const names = ["deployer", "owner", "bridger", "user", "user2"];
extraAccounts += names.length;

Expand Down
Loading
Loading