Skip to content

Create delegation

To create a delegation, the user (or another entity acting on the userโ€™s behalf) calls one of the delegation functions. The same functions are also called to remove delegations.

FunctionInterfaceImplementation
delegateAll ๐Ÿ”— ๐Ÿ”—
delegateAllFor ๐Ÿ”— ๐Ÿ”—
delegateContract ๐Ÿ”— ๐Ÿ”—
delegateContractFor ๐Ÿ”— ๐Ÿ”—

Step by step directions

  1. Set up environment variables.

    VariableMeaningHow to get it
    PRIVATE_KEYYour private keyYou can usually get it from the wallet
    REGISTRAR_IDThe Royal ID of the registryIf you know the registryโ€™s address, use this function ๐Ÿ”—
  2. If necessary, install Foundry ๐Ÿ”—.

  3. Run these commands to use the cast command ๐Ÿ”—.

    Terminal window
    DELEGATE_REGISTRY=0x000000f1CABe81De9e020C9fac95318b14B80F14
    ENDPOINT=https://mainnet.base.org
    cast send --rpc-url $ENDPOINT \
    --private-key $PRIVATE_KEY $DELEGATE_REGISTRY \
    "delegateAll(uint256, bytes32, bool)" $REGISTRAR_ID `cast to-bytes32 0x0` 1
  4. When you get the transaction hash, you can use a block explorer ๐Ÿ”— to see the log entry with your delegation. Alternatively, you can use this function ๐Ÿ”— with the registrarโ€™s ID to see your delegation.