Use the ownership transfer scope
The ownership transfer scope restricts a delegation to ownership transfer calls only. For example, Alice has deployed a smart contract, and she delegates to Bob the ability to transfer ownership of that contract.
Internally, this scope uses the ownershipTransfer
caveat enforcer.
Prerequisites
- Install and set up the Delegation Toolkit.
- Configure the Delegation Toolkit.
- Create a delegator account.
- Create a delegate account.
Ownership transfer scope
This scope requires a contractAddress
, which represents the address of the deployed contract.
import { createDelegation } from "@metamask/delegation-toolkit";
const contractAddress = "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"
const delegation = createDelegation({
scope: {
type: "ownershipTransfer",
contractAddress,
},
to: delegateAccount,
from: delegatorAccount,
environment: delegatorAccount.environment,
});
Next steps
See how to further refine the authority of a delegation using caveat enforcers.