This is an example / proof-of-concept: Adding contract for bulk subname operations by serenae-fansubs · Pull Request #269 · ensdomains/ens-contracts · GitHub
- Mainnet: 0xED9F5C4d1a90E21F874B9C6DE20FAB6C45d9854e
- Goerli: 0x7f1b789BcC73E86684bC1fffA0A85074303B3bEe
- Sepolia: 0x977b9aeB1eD787e230c54De46e3badE1c8dC8597
- I want to create a bunch of subnames without needing to click around a dozen places and approve a separate transaction for each one.
- I have a bunch of pre-existing subnames that I already created before the Name Wrapper was released. Now, I want to wrap them all, as easily as possible.
- And at the same time, maybe I want to burn fuses/permissions on them too
- I have a bunch of pre-existing wrapped subnames, and now I want to emancipate and/or lock all of them.
- I just extended the expiry for my parent name, and now I want to extend the expiry on all my subnames to match.
This contract just takes some of the regular subname operations (like
setSubnodeRecord) and wraps them up in for-loops, so you can create/replace/wrap/unwrap multiple subnames all in one transaction.
These functions can only be used if the parent name is unwrapped.
Bulk Create/Replace Unwrapped Subnames
These functions can only be used if the parent name is wrapped.
Bulk Create/Replace Wrapped Subnames
You can use these to wrap pre-existing unwrapped subnames too.
Bulk Set Wrapped Subname Fuses/Expiry
Bulk Extend Wrapped Subname Expiry
Bulk Unwrap Wrapped Subnames
If your parent name is unwrapped, then approve this contract as an operator in the core registry. If your parent name is wrapped, then approve this contract as an operator in the name wrapper.
If you are planning on burning any fuses/permissions on the subnames, then you also need to make sure your parent name is wrapped and Locked first.
After you’ve done that, then you will be able to call the above functions. The inputs are the same as the corresponding methods from Registry / NameWrapper, except you provide multiple labels/labelhashes in an array.
The motivation for this was multiple people in the discord or support tickets asking for such functionality. Well hope it helps!
Feel free to review the PR and let me know if you find anything glaring. I’ll eventually get around to creating a frontend tool for these operations too.