Convenience contract for bulk subname operations

This is an example / proof-of-concept: Adding contract for bulk subname operations by serenae-fansubs · Pull Request #269 · ensdomains/ens-contracts · GitHub

Deployed on:


Current Problems

  • 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.
  • etc.

BulkSubnames

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.

Unwrapped Operations

These functions can only be used if the parent name is unwrapped.

Bulk Create/Replace Unwrapped Subnames

  • bulkSetSubnodeOwner
  • bulkSetSubnodeRecord

Wrapped Operations

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.

  • bulkSetWrappedSubnodeOwner
  • bulkSetWrappedSubnodeRecord

Bulk Set Wrapped Subname Fuses/Expiry

  • bulkSetChildFuses

Bulk Extend Wrapped Subname Expiry

  • bulkExtendExpiry

Bulk Unwrap Wrapped Subnames

  • bulkUnwrap

Usage:

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.

For example:


Next Steps

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.

7 Likes