Skip to content

Commit cdb9eb8

Browse files
committed
address some feedback
1 parent cdf2eb9 commit cdb9eb8

File tree

2 files changed

+34
-21
lines changed

2 files changed

+34
-21
lines changed

delegation-toolkit/concepts/delegation/index.md

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import TabItem from "@theme/TabItem";
1010
# Delegation
1111

1212
*Delegation* is the ability for a [MetaMask smart account](../smart-accounts.md) to grant permission to another smart account
13-
or externally owned account (EOA) to perform specific executions on its behalf, under defined rules and restrictions.
13+
or externally owned account (EOA) to perform specific executions on its behalf.
1414
The account that grants the permission is called the *delegator account*, while the account that receives the permission
1515
is called the *delegate account*.
1616

@@ -22,36 +22,46 @@ For example: Alice delegates the ability to spend her USDC to Bob, limiting the
2222

2323
The delegation lifecycle is as follows:
2424

25-
1. **Delegation creation** - A delegation is initialized, and the delegator account signs it.
25+
1. **Create a delegation** - The delegator account creates and signs a delegation.
2626

27-
2. **Caveat enforcement** - The caveats applied to the delegation specify conditions under which
27+
2. **Apply caveats** - The caveats applied to the delegation specify conditions under which
2828
the delegation can be redeemed.
2929

30-
3. **Delegation storage** - The delegation can be stored, enabling retrieval for future redemption.
30+
3. **Store the delegation** - A dapp can store the delegation, enabling retrieval for future redemption.
3131

32-
4. **Delegation redemption** - The delegate (the account being granted the permission) redeems the delegation via the Delegation Manager,
32+
4. **Redeem the delegation** - The delegate (the account being granted the permission) redeems the delegation via the Delegation Manager,
3333
which verifies that the delegated authority is valid in order to perform the execution.
3434

3535
See [how to perform executions on a user's behalf](../../guides/delegation/execute-on-users-behalf.md) to get started with the delegation lifecycle.
3636

3737
## Delegation types
3838

39-
There are multiple types of delegations you can create:
39+
You can create the following delegation types:
40+
41+
- **Root delegation** - A root delegation is a delegation that doesn't derive its authority from another delegation.
42+
It is when a delegator delegates its own authority away.
43+
For example, Alice delegates the ability to spend her USDC to Bob, limiting the amount to 100 USDC.
4044

41-
- A **root delegation** is a delegation that doesn't derive its authority from another delegation.
42-
It is when a delegator delegates its own authority away, as opposed to a redelegation.
4345
Use [`createDelegation`](../../reference/api/delegation.md#createdelegation) to create a root delegation.
4446

45-
- An **open root delegation** is a root delegation that doesn't specify a delegate.
47+
- **Open root delegation** - An open root delegation is a root delegation that doesn't specify a delegate.
4648
This means that any account can redeem the delegation.
49+
For example, Alice delegates the ability to spend 100 of her USDC to anyone.
50+
4751
You must create open root delegations carefully, to ensure that they are not misused.
4852
Use [`createOpenDelegation`](../../reference/api/delegation.md#createopendelegation) to create a root delegation.
4953

50-
- A delegate can **redelegate** permissions that have been granted to them, creating a chain of delegations across trusted parties.
54+
- **Redelegation** - A delegate can redelegate permissions that have been granted to them, creating a chain of delegations across trusted parties.
55+
For example, Alice delegates the ability to spend 100 of her USDC to Bob.
56+
Bob redelegates the ability to spend 50 of Alice's 100 USDC to Carol.
57+
5158
Use [`createDelegation`](../../reference/api/delegation.md#createdelegation) to create a redelegation.
5259

53-
- An **open redelegation** is a redelegation that doesn't specify a delegate.
60+
- **Open redelegation** - An open redelegation is a redelegation that doesn't specify a delegate.
5461
This means that any account can redeem the redelegation.
62+
For example, Alice delegates the ability to spend 100 of her USDC to Bob.
63+
Bob redelegates the ability to spend 50 of Alice's 100 USDC to anyone.
64+
5565
As with open root delegations, you must create open redelegations carefully, to ensure that they are not misused.
5666
Use [`createOpenDelegation`](../../reference/api/delegation.md#createopendelegation) to create an open redelegation.
5767

@@ -95,7 +105,7 @@ It consists of the following components:
95105

96106
## Delegation flow
97107

98-
This diagram illustrates how a delegation is created and subsequently redeemed on the Delegation Manager.
108+
This diagram shows how a delegation is created and redeemed with the Delegation Manager.
99109
The Delegation Manager is responsible for validating the signature of the delegation and the caveat enforcers.
100110
If everything is correct, it allows a delegate to execute an action on behalf of the delegator.
101111

@@ -148,15 +158,17 @@ The Delegation Toolkit supports several execution modes based on [ERC-7579](http
148158

149159
### `SINGLE` execution modes
150160

151-
In `SINGLE` execution modes, only a single delegation chain and a single execution can be provided. This mode processes delegations sequentially:
161+
In `SINGLE` modes, you can provide only one delegation chain and one execution.
162+
Processing is sequential:
152163

153164
1. For each delegation in the chain, all caveats' `before` hooks are called.
154165
2. The single redeemed action is executed.
155166
3. For each delegation in the chain, all caveats' `after` hooks are called.
156167

157168
### `BATCH` execution modes
158169

159-
In `BATCH` execution modes, multiple delegation chains and multiple executions can be provided. This mode executes delegations in an interleaved way:
170+
In `BATCH` modes, you can provide multiple delegation chains and multiple executions.
171+
Processing is interleaved:
160172

161173
1. For each chain in the batch, and each delegation in the chain, all caveats' `before` hooks are called.
162174
2. Each redeemed action is executed.

delegation-toolkit/guides/delegation/execute-on-users-behalf.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ import TabItem from "@theme/TabItem";
1111

1212
[Delegation](../../concepts/delegation/index.md) is the ability for a [MetaMask smart account](../../concepts/smart-accounts.md) to grant permission to another account to perform executions on its behalf.
1313

14-
This guide demonstrates how to create a *delegator account* (the account that grants the permission) and *delegate account* (the account that receives the permission), and complete the delegation lifecycle (create, sign, and redeem a delegation).
15-
16-
This guide will refer to the delegator account as "Alice," who grants permission to "Bob," the delegate account, to perform executions on her behalf.
14+
In this guide, you'll create a delegator account (Alice) and a delegate account (Bob), and grant Bob permission to perform executions on Alice's behalf.
15+
You'll complete the delegation lifecycle (create, sign, and redeem a delegation).
1716

1817
## Prerequisites
1918

2019
[Install and set up the Delegation Toolkit.](../../get-started/install.md)
2120

2221
## Steps
2322

24-
### 1. Set up a Public Client
23+
### 1. Create a Public Client
2524

26-
Set up a [Viem Public Client](https://viem.sh/docs/clients/public) using Viem's `createPublicClient` function. This client will let the delegator account query the signer's account state and interact with smart contracts.
25+
Create a [Viem Public Client](https://viem.sh/docs/clients/public) using Viem's `createPublicClient` function.
26+
Your dapp can use the Public Client to query the signer's account state and interact with smart contracts.
2727

2828
```typescript
2929
import { createPublicClient, http } from "viem"
@@ -35,9 +35,10 @@ const publicClient = createPublicClient({
3535
})
3636
```
3737

38-
### 2. Set up a Bundler Client
38+
### 2. Create a Bundler Client
3939

40-
Set up a [Viem Bundler Client](https://viem.sh/account-abstraction/clients/bundler) using Viem's `createBundlerClient` function. This lets you use the bundler service to estimate gas for user operations and submit transactions to the network.
40+
Create a [Viem Bundler Client](https://viem.sh/account-abstraction/clients/bundler) using Viem's `createBundlerClient` function.
41+
Your dapp can use the bundler service to estimate gas for user operations and submit transactions to the network.
4142

4243
```typescript
4344
import { createBundlerClient } from "viem/account-abstraction"

0 commit comments

Comments
 (0)