Skip to content

feat(forge): add ability to set ENS names for smart contracts #10604

Open
@abhijeetbhagat

Description

@abhijeetbhagat

Component

Forge

Describe the feature you would like

Foundry is one of the primary tools for smart contracts management. A new feature that allows smart contract developers to assign ENS names to smart contracts, that implement Ownable, ReverseClaimer interfaces, directly using forge will be a nice addition to promote smart contracts naming.

With this update, devs can set ENS names for their smart contracts via the forge tool like:

# new forge subcommand that auto generates a name and sets it for contract address 0x9b095c05882945a50e804dbb1ba9ca7aa0b56303
> forge name  --contract-address 0x9b095c05882945a50e804dbb1ba9ca7aa0b56303  --rpc-url https://some/rpc/url --interactive

# explicitly set nkfsl123.abhi.eth as the ENS name via forge name
> forge name --ens-name nkfsl123.abhi.eth  --contract-address 0x9b095c05882945a50e804dbb1ba9ca7aa0b56303 --reverse-claimer  --rpc-url https://some/rpc/url --interactive

# enable ENS name setting via forge create
> forge create --interactive --ens-name jfgdkf123.abhi.eth  --rpc-url https://some/rpc/url  --broadcast counter/src/OwnableTest.sol:HelloWorld --constructor-args "hello" 1

# explicitly set wruisd123.abhi.eth ENS name setting via forge script
> forge script script/Counter.s.sol:CounterScript --ens-name wruisd123.abhi.eth  --chain-id 11155111  --rpc-url https://some/rpc/url --broadcast --interactive

# auto generate an ENS name and set it via forge script
> forge script script/Counter.s.sol:CounterScript --auto-name  --chain-id 11155111  --rpc-url https://some/rpc/url --broadcast --interactive

Additional context

Inspiration: hex addresses of smart contracts are not user friendly to interact with; user friendly names of smart contracts otoh are. the goal here is to promote naming smart contracts as much as possible by adding such a feature.

EDIT: accompanying pr: #10605

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions