@etherplay/delegation 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-present Ronan Sandford
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -43,7 +43,7 @@ contract MyGame is UsingDelegation {
43
43
 
44
44
  That is the whole adoption. `UsingDelegation` declares **no storage of its own** (the library keeps its state in an ERC-7201 namespaced region), so it adds nothing to your layout and shifts nothing you already have, which is what makes it safe to add to a contract already live behind a proxy.
45
45
 
46
- It gives your contract six external functions:
46
+ It gives your contract seven external functions:
47
47
 
48
48
  ```solidity
49
49
  function registerDelegate(address delegate, address payable payee) external payable;
@@ -54,15 +54,18 @@ function registerDelegateViaSignature(
54
54
  bytes calldata signature
55
55
  ) external payable;
56
56
  function revokeDelegate(address delegate) external;
57
+ function resignDelegate(address owner, address payable payee) external payable;
57
58
  function delegationStatus(address owner, address delegate) external view returns (bool allowed, bool withdrawn);
58
59
  function delegationMessage(address delegate, uint256 deadline) external view returns (string memory);
59
60
  function delegationDigest(address delegate, uint256 deadline) external view returns (bytes32);
60
61
  ```
61
62
 
62
- If you want fewer, or different ones, use `Delegation` (the library) directly and write your own; `UsingDelegation` is only those six written once. `IDelegation` is the same set as a type, for a router composing a selector list or a caller that does not compile against you.
63
+ If you want fewer, or different ones, use `Delegation` (the library) directly and write your own; `UsingDelegation` is only those seven written once. `IDelegation` is the same set as a type, for a router composing a selector list or a caller that does not compile against you.
63
64
 
64
65
  **What you are handing over:** a delegate authorised at your contract may do anything at your contract that its owner could do through the paths you resolve with `_requireAccountForSender`. Not a scope, not one action. It can do nothing anywhere else. If that is more than you mean to grant, narrow it in the override.
65
66
 
67
+ **Withdrawing, from either side.** `revokeDelegate(delegate)` is the owner's: sent from the account, it withdraws any of its delegates, including one it no longer holds the key for. `resignDelegate(owner, payee)` is the delegate's: sent from the delegate key itself, it withdraws that key's own authorisation and forwards the attached value to `payee`. An app that funds a key for its user uses it to give the user both things they want when they turn the key off, the access gone and the funds back, in one transaction with no wallet prompt and nothing needed from an account that may hold nothing. Both land in the same withdrawn state, so either way only the owner can authorise that delegate again, and only by a transaction (a public registration signature must not be able to undo it). Only a delegate that is currently allowed may resign.
68
+
66
69
  **Enumeration is the event.** There is no onchain list of an account's delegates; `DelegationChanged(owner, delegate, allowed)` is indexed on both addresses, and the set is reconstructed by replaying it. Note that many public RPCs cap `eth_getLogs` ranges, so a browser reconstructing from genesis wants a stored deployment block and paging.
67
70
 
68
71
  ## TypeScript
@@ -369,6 +369,49 @@ library Delegation {
369
369
  emit DelegationChanged(owner, delegate, false);
370
370
  }
371
371
 
372
+ /// @notice `delegate` gives up its own authorisation to act for `owner`:
373
+ /// the same end state as {revoke}, reached from the other side.
374
+ ///
375
+ /// AUTHORISES NOTHING ITSELF: the adopting contract must already have
376
+ /// established that `delegate` is the one asking, normally by passing
377
+ /// `msg.sender`. Passing anything else would let anyone withdraw anyone's
378
+ /// delegate.
379
+ ///
380
+ /// Why a delegate needs this at all. A delegate is typically a key an app
381
+ /// holds for its user, funded so that it can act without a prompt. When
382
+ /// the user wants that key to stop, {revoke} needs a transaction FROM THE
383
+ /// OWNER, who may hold nothing (the funds having gone to the key), and it
384
+ /// leaves the key's funds stranded on an address that can no longer do
385
+ /// anything useful. Resigning is sent by the key itself, so it needs no
386
+ /// owner prompt and no owner funds, and the adopting entry point can carry
387
+ /// the key's balance back in the same transaction.
388
+ ///
389
+ /// SAFE WITHOUT A SIGNATURE, because it can only REDUCE authority, and only
390
+ /// the caller's own: the worst a stolen delegate key achieves with it is to
391
+ /// stop being a delegate. It lands in the same Withdrawn state as {revoke},
392
+ /// deliberately, and not in "never authorised": the owner's registration
393
+ /// signature is public once submitted and carries no nonce, so a state a
394
+ /// signature could cross would let anyone, the thief included, put the key
395
+ /// straight back. Re-authorising THIS delegate therefore takes a
396
+ /// transaction from the owner ({register}), exactly as after {revoke}.
397
+ ///
398
+ /// Only a delegate that is CURRENTLY allowed may resign. Withdrawing an
399
+ /// address that was never authorised is meaningful when the owner does it
400
+ /// (see {revoke}), but from anyone else it would only write entries into
401
+ /// {DelegationChanged}, which is the enumeration API, for owners who never
402
+ /// had anything to do with the caller.
403
+ ///
404
+ /// @param owner the account `delegate` stops acting for
405
+ /// @param delegate the address resigning, i.e. `msg.sender`
406
+ function resign(address owner, address delegate) internal {
407
+ Layout storage $ = layout();
408
+ if ($.status[owner][delegate] != Status.Allowed) {
409
+ revert NotDelegate(owner, delegate);
410
+ }
411
+ $.status[owner][delegate] = Status.Withdrawn;
412
+ emit DelegationChanged(owner, delegate, false);
413
+ }
414
+
372
415
  // ------------------------------------------------------------------------
373
416
  // THE SIGNED TEXT
374
417
  // ------------------------------------------------------------------------
@@ -12,7 +12,7 @@ pragma solidity ^0.8.4;
12
12
  /// - A contract behind a ROUTER cannot say "these selectors are mine" by
13
13
  /// inheriting an abstract contract: the router needs a list of selectors,
14
14
  /// composed from interfaces, while the implementation lives elsewhere.
15
- /// Without a shared declaration every router restates the same six
15
+ /// Without a shared declaration every router restates the same seven
16
16
  /// signatures, and a restatement is a copy that can drift.
17
17
  /// - A client, a script or a test that calls into a contract it does not
18
18
  /// compile against - `IDelegation(target).delegationStatus(owner, delegate)`
@@ -20,7 +20,7 @@ pragma solidity ^0.8.4;
20
20
  /// `DELEGATION_ABI`, checked against this file by a test.
21
21
  ///
22
22
  /// DO NOT WRITE `is IDelegation, UsingDelegation`. It does not compile without
23
- /// restating all six functions as `override`, which is exactly the boilerplate
23
+ /// restating all seven functions as `override`, which is exactly the boilerplate
24
24
  /// {UsingDelegation} exists to spare an adopter. Inherit the implementation
25
25
  /// alone and use this interface where a TYPE is wanted; the two agreeing is
26
26
  /// covered by a test (test/solidity/IDelegation.t.sol), and on a router the
@@ -55,6 +55,13 @@ interface IDelegation {
55
55
  /// that one back.
56
56
  function revokeDelegate(address delegate) external;
57
57
 
58
+ /// @notice as the delegate, stop acting for `owner` here, and send whatever
59
+ /// value is attached to `payee`.
60
+ function resignDelegate(
61
+ address owner,
62
+ address payable payee
63
+ ) external payable;
64
+
58
65
  /// @notice whether `delegate` may act for `owner` here, and whether `owner`
59
66
  /// withdrew it.
60
67
  function delegationStatus(
@@ -97,6 +97,29 @@ abstract contract UsingDelegation {
97
97
  Delegation.revoke(msg.sender, delegate);
98
98
  }
99
99
 
100
+ /// @notice stop acting for `owner` here, as the delegate itself, and send
101
+ /// whatever value comes with the call to `payee`.
102
+ ///
103
+ /// The delegate's side of {revokeDelegate}: sent BY the delegate, so the
104
+ /// owner signs nothing and pays nothing. An app holding a funded key for
105
+ /// its user calls this from that key with the key's balance (less the gas)
106
+ /// and `payee` set to the owner, and the user gets their access withdrawn
107
+ /// AND their funds back in one transaction, with no wallet prompt.
108
+ ///
109
+ /// `payee` is free rather than forced to `owner`, for the same reason it is
110
+ /// free in {registerDelegate}: it is the sender's own money. Value with no
111
+ /// payee reverts rather than being kept by this contract.
112
+ ///
113
+ /// Re-authorising this delegate afterwards takes a transaction from the
114
+ /// owner, as after {revokeDelegate}. See {Delegation-resign}.
115
+ function resignDelegate(
116
+ address owner,
117
+ address payable payee
118
+ ) external payable virtual {
119
+ Delegation.resign(owner, msg.sender);
120
+ Payments.forward(payee, msg.value);
121
+ }
122
+
100
123
  /// @notice whether `delegate` may act for `owner` here, and whether `owner`
101
124
  /// withdrew it.
102
125
  ///
package/dist/abi.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The delegation surface as an ABI, for a client that calls a contract it does not compile against.
3
3
  *
4
- * The same six functions {@link file://../contracts/IDelegation.sol} declares, plus the event and
4
+ * The same seven functions {@link file://../contracts/IDelegation.sol} declares, plus the event and
5
5
  * the errors an adopter of `UsingDelegation` actually exposes - the event because it IS the
6
6
  * enumeration API (there is no onchain list of an account's delegates, so the set is reconstructed
7
7
  * by replaying these logs), and the errors so a revert decodes into something an app can act on
@@ -52,6 +52,18 @@ export declare const DELEGATION_ABI: readonly [{
52
52
  readonly type: "address";
53
53
  }];
54
54
  readonly outputs: readonly [];
55
+ }, {
56
+ readonly type: "function";
57
+ readonly name: "resignDelegate";
58
+ readonly stateMutability: "payable";
59
+ readonly inputs: readonly [{
60
+ readonly name: "owner";
61
+ readonly type: "address";
62
+ }, {
63
+ readonly name: "payee";
64
+ readonly type: "address";
65
+ }];
66
+ readonly outputs: readonly [];
55
67
  }, {
56
68
  readonly type: "function";
57
69
  readonly name: "delegationStatus";
package/dist/abi.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"abi.d.ts","sourceRoot":"","sources":["../src/abi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8HjB,CAAC"}
1
+ {"version":3,"file":"abi.d.ts","sourceRoot":"","sources":["../src/abi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwIjB,CAAC"}
package/dist/abi.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The delegation surface as an ABI, for a client that calls a contract it does not compile against.
3
3
  *
4
- * The same six functions {@link file://../contracts/IDelegation.sol} declares, plus the event and
4
+ * The same seven functions {@link file://../contracts/IDelegation.sol} declares, plus the event and
5
5
  * the errors an adopter of `UsingDelegation` actually exposes - the event because it IS the
6
6
  * enumeration API (there is no onchain list of an account's delegates, so the set is reconstructed
7
7
  * by replaying these logs), and the errors so a revert decodes into something an app can act on
@@ -43,6 +43,16 @@ export const DELEGATION_ABI = [
43
43
  inputs: [{ name: 'delegate', type: 'address' }],
44
44
  outputs: [],
45
45
  },
46
+ {
47
+ type: 'function',
48
+ name: 'resignDelegate',
49
+ stateMutability: 'payable',
50
+ inputs: [
51
+ { name: 'owner', type: 'address' },
52
+ { name: 'payee', type: 'address' },
53
+ ],
54
+ outputs: [],
55
+ },
46
56
  {
47
57
  type: 'function',
48
58
  name: 'delegationStatus',
package/dist/abi.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"abi.js","sourceRoot":"","sources":["../src/abi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC7B;QACC,I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AE,OAAO;QACb,IAAI,EAAE,qBAAqB;QAC3B,MAAM,EAAE;YACP,EAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAC;YAChC,EAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAC;SACnC;KACD;IACD;QACC,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,kBAAkB;QACxB,MAAM,EAAE,EAAE;KACV;IACD;QACC,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,iBAAiB;QACvB,MAAM,EAAE,EAAE;KACV;IACD;QACC,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,kBAAkB;QACxB,MAAM,EAAE,CAAC,EAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAC,CAAC;KAC7C;IACD;QACC,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,oBAAoB;QAC1B,MAAM,EAAE,EAAE;KACV;IACD;QACC,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,wBAAwB;QAC9B,MAAM,EAAE,EAAE;KACV;IACD;QACC,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,gBAAgB;QACtB,MAAM,EAAE,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAC,CAAC;KAC1C;IACD;QACC,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,kBAAkB;QACxB,MAAM,EAAE,CAAC,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAC,CAAC;KAC3C;CACQ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etherplay/delegation",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Onchain delegation for Etherplay Accounts - Solidity library, the TypeScript builder for the message it verifies, and the ABI, kept in agreement by a shared vectors file",
5
5
  "keywords": [
6
6
  "ethereum",
package/src/abi.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The delegation surface as an ABI, for a client that calls a contract it does not compile against.
3
3
  *
4
- * The same six functions {@link file://../contracts/IDelegation.sol} declares, plus the event and
4
+ * The same seven functions {@link file://../contracts/IDelegation.sol} declares, plus the event and
5
5
  * the errors an adopter of `UsingDelegation` actually exposes - the event because it IS the
6
6
  * enumeration API (there is no onchain list of an account's delegates, so the set is reconstructed
7
7
  * by replaying these logs), and the errors so a revert decodes into something an app can act on
@@ -43,6 +43,16 @@ export const DELEGATION_ABI = [
43
43
  inputs: [{name: 'delegate', type: 'address'}],
44
44
  outputs: [],
45
45
  },
46
+ {
47
+ type: 'function',
48
+ name: 'resignDelegate',
49
+ stateMutability: 'payable',
50
+ inputs: [
51
+ {name: 'owner', type: 'address'},
52
+ {name: 'payee', type: 'address'},
53
+ ],
54
+ outputs: [],
55
+ },
46
56
  {
47
57
  type: 'function',
48
58
  name: 'delegationStatus',