@trustvc/eip7702 1.0.0-beta.1 → 1.1.0-beta.1

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/README.md CHANGED
@@ -138,16 +138,54 @@ npx hardhat run scripts/mintDocumentGasless.ts --network sepolia
138
138
 
139
139
  ## Environment variables
140
140
 
141
+ Deploy/registry/paymaster addresses are network-scoped — suffix the variable with `_SEPOLIA` or `_AMOY` (e.g. `FACTORY_ADDRESS_SEPOLIA`, `FACTORY_ADDRESS_AMOY`). `scripts/lib/network.ts` resolves the suffix from `--network <name>` (hardhat scripts) or the `NETWORK` env var (viem/permissionless scripts). See `.env.example` for the full annotated list.
142
+
143
+ ### Wallets & RPC
144
+
141
145
  | Variable | Description |
142
146
  | --- | --- |
143
- | `PRIVATE_KEY` | Deployer wallet private key |
147
+ | `PRIVATE_KEY` | Deployer/gas-payer wallet — pays for deployments, delegation txs, staking |
148
+ | `PRIVATE_KEY2` | Secondary wallet (optional — testing with a second account) |
149
+ | `OWNER_PRIVATE_KEY` | Platform owner / whitelisted user — signs UserOps, needs no ETH for gasless ops |
144
150
  | `SEPOLIA_RPC_URL` | Sepolia RPC endpoint |
151
+ | `AMOY_RPC_URL` | Polygon Amoy RPC endpoint |
145
152
  | `PIMLICO_API_KEY` | Pimlico bundler API key |
146
- | `TDOC_DEPLOYER_ADDRESS` | Deployed TDocDeployer address |
147
- | `PAYMASTER_IMPLEMENTATION` | PlatformPaymaster implementation address |
148
- | `FACTORY_ADDRESS` | PlatformAccountFactory address |
149
- | `PAYMASTER_ADDRESS` | Deployed paymaster clone address |
150
- | `EIP7702_IMPL_ADDRESS` | EIP7702Implementation address |
153
+ | `NETWORK` | `sepolia` \| `amoy` — target network for viem/permissionless scripts (default: `sepolia`) |
154
+ | `ENTRY_POINT` | EntryPoint v0.8 address (default: `0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108`, same on all supported chains) |
155
+
156
+ ### Deployed addresses (network-suffixed)
157
+
158
+ | Variable | Description |
159
+ | --- | --- |
160
+ | `EIP7702_IMPL_ADDRESS_<NETWORK>` | Deployed `EIP7702Implementation` address |
161
+ | `PAYMASTER_IMPLEMENTATION_<NETWORK>` | Deployed `PlatformPaymaster` implementation address |
162
+ | `FACTORY_ADDRESS_<NETWORK>` | Deployed `PlatformAccountFactory` address |
163
+ | `PAYMASTER_ADDRESS_<NETWORK>` | Deployed paymaster clone address |
164
+ | `TDOC_DEPLOYER_ADDRESS_<NETWORK>` | TrustVC `TDocDeployer` address (pre-deployed infra) |
165
+ | `TDOC_IMPLEMENTATION_<NETWORK>` | TDoc implementation to clone via `deployRegistry` |
166
+ | `REGISTRY_ADDRESS_<NETWORK>` | Registry deployed via `deployRegistryGasless.ts` |
167
+ | `TITLE_ESCROW_ADDRESS_<NETWORK>` | Title escrow captured via `mintDocumentGasless.ts` |
168
+
169
+ ### Gasless script inputs
170
+
171
+ | Variable | Description |
172
+ | --- | --- |
173
+ | `TOKEN_NAME` / `TOKEN_SYMBOL` | Name/symbol for the TradeTrust token registry (`deployRegistryGasless.ts`) |
174
+ | `TOKEN_ID` | Document token ID as `uint256` (`mintDocumentGasless.ts`) |
175
+ | `BENEFICIARY_ADDRESS` / `HOLDER_ADDRESS` | Document beneficiary/holder (`mintDocumentGasless.ts`) |
176
+ | `REMARK` | Optional remark bytes/text attached to the document |
177
+ | `NOMINEE_ADDR` / `NEW_HOLDER_ADDR` | Used by the `scripts/trFunctions/*` title-escrow helpers |
178
+
179
+ ### Optional deploy/stake overrides
180
+
181
+ | Variable | Description |
182
+ | --- | --- |
183
+ | `PLATFORM_ADDRESS` | Paymaster owner EOA for `deployPlatformPaymaster.ts` (default: deployer) |
184
+ | `DAILY_LIMIT_ETH` | Per-user daily gas limit in ETH (default: `0` = unlimited) |
185
+ | `DEPLOY_SALT` | Hex `bytes32` CREATE2 salt (default: random) |
186
+ | `STAKE_AMOUNT_ETH` | ETH locked as EntryPoint stake (default: `0.01`) |
187
+ | `DEPOSIT_AMOUNT_ETH` | ETH deposited into the gas pool (default: `0.05`) |
188
+ | `UNSTAKE_DELAY_SEC` | Stake lock period in seconds (default: `86400` = 1 day) |
151
189
 
152
190
  ## Tech stack
153
191
 
@@ -8,8 +8,12 @@ import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
8
8
  contract PlatformAccountFactory is Ownable {
9
9
  address public tdocDeployer;
10
10
  address public paymasterImplementation;
11
+ mapping(address => address) public attachedPaymaster;
11
12
 
12
- event PlatformOnboarded(address indexed platformAddress, address indexed paymaster);
13
+ event PlatformOnboarded(
14
+ address indexed platformAddress,
15
+ address indexed paymaster
16
+ );
13
17
  event TdocDeployerUpdated(address indexed newDeployer);
14
18
  event ImplementationUpdated(address indexed newImplementation);
15
19
 
@@ -17,10 +21,19 @@ contract PlatformAccountFactory is Ownable {
17
21
  address _tdocDeployer,
18
22
  address _paymasterImplementation
19
23
  ) Ownable(msg.sender) {
24
+ require(_tdocDeployer != address(0), "Zero address");
25
+ require(_paymasterImplementation != address(0), "Zero address");
20
26
  tdocDeployer = _tdocDeployer;
21
27
  paymasterImplementation = _paymasterImplementation;
22
28
  }
23
29
 
30
+ function setAttachedPaymaster(
31
+ address platformAddress
32
+ ) external view returns (address) {
33
+ address paymaster = attachedPaymaster[platformAddress];
34
+ return paymaster;
35
+ }
36
+
24
37
  function updateTdocDeployer(address _tdocDeployer) external onlyOwner {
25
38
  require(_tdocDeployer != address(0), "Zero address");
26
39
  tdocDeployer = _tdocDeployer;
@@ -39,12 +52,23 @@ contract PlatformAccountFactory is Ownable {
39
52
  bytes32 salt
40
53
  ) external returns (address paymaster) {
41
54
  paymaster = Clones.cloneDeterministic(paymasterImplementation, salt);
42
- PlatformPaymaster(payable(paymaster)).initialize(platformAddress, dailyLimit, tdocDeployer);
55
+ PlatformPaymaster(payable(paymaster)).initialize(
56
+ platformAddress,
57
+ dailyLimit,
58
+ tdocDeployer
59
+ );
43
60
  emit PlatformOnboarded(platformAddress, paymaster);
44
61
  }
45
62
 
46
63
  // Address is determined solely by implementation + salt (not by constructor args).
47
- function computePaymasterAddress(bytes32 salt) external view returns (address) {
48
- return Clones.predictDeterministicAddress(paymasterImplementation, salt, address(this));
64
+ function computePaymasterAddress(
65
+ bytes32 salt
66
+ ) external view returns (address) {
67
+ return
68
+ Clones.predictDeterministicAddress(
69
+ paymasterImplementation,
70
+ salt,
71
+ address(this)
72
+ );
49
73
  }
50
74
  }
@@ -49,6 +49,9 @@ contract PlatformPaymaster is BasePaymaster {
49
49
  );
50
50
 
51
51
  bytes32 private constant DEFAULT_ADMIN_ROLE = bytes32(0);
52
+ bytes32 private constant RESTORER_ROLE = keccak256("RESTORER_ROLE");
53
+ bytes32 private constant ACCEPTER_ROLE = keccak256("ACCEPTER_ROLE");
54
+ bytes32 private constant MINTER_ROLE = keccak256("MINTER_ROLE");
52
55
 
53
56
  ITDocDeployer public tdocDeployer;
54
57
 
@@ -141,13 +144,11 @@ contract PlatformPaymaster is BasePaymaster {
141
144
  bytes memory params = abi.encode(name, symbol, address(this));
142
145
  deployed = tdocDeployer.deploy(implementation, params);
143
146
 
144
- // Hand admin to the calling EOA
145
147
  IAccessControl(deployed).grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
148
+ IAccessControl(deployed).grantRole(RESTORER_ROLE, msg.sender);
149
+ IAccessControl(deployed).grantRole(ACCEPTER_ROLE, msg.sender);
150
+ IAccessControl(deployed).grantRole(MINTER_ROLE, msg.sender);
146
151
 
147
- // Paymaster keeps only the operational roles it needs
148
- // (MINTER_ROLE, RESTORER_ROLE, ACCEPTER_ROLE were granted to address(this) via initialize)
149
-
150
- // Relinquish admin — EOA is now sole admin
151
152
  IAccessControl(deployed).renounceRole(
152
153
  DEFAULT_ADMIN_ROLE,
153
154
  address(this)
package/dist/index.d.mts CHANGED
@@ -320,6 +320,20 @@ declare const platformAccountFactoryAbi: readonly [{
320
320
  }];
321
321
  readonly name: "TdocDeployerUpdated";
322
322
  readonly type: "event";
323
+ }, {
324
+ readonly inputs: readonly [{
325
+ readonly internalType: "address";
326
+ readonly name: "";
327
+ readonly type: "address";
328
+ }];
329
+ readonly name: "attachedPaymaster";
330
+ readonly outputs: readonly [{
331
+ readonly internalType: "address";
332
+ readonly name: "";
333
+ readonly type: "address";
334
+ }];
335
+ readonly stateMutability: "view";
336
+ readonly type: "function";
323
337
  }, {
324
338
  readonly inputs: readonly [{
325
339
  readonly internalType: "bytes32";
@@ -382,6 +396,20 @@ declare const platformAccountFactoryAbi: readonly [{
382
396
  readonly outputs: readonly [];
383
397
  readonly stateMutability: "nonpayable";
384
398
  readonly type: "function";
399
+ }, {
400
+ readonly inputs: readonly [{
401
+ readonly internalType: "address";
402
+ readonly name: "platformAddress";
403
+ readonly type: "address";
404
+ }];
405
+ readonly name: "setAttachedPaymaster";
406
+ readonly outputs: readonly [{
407
+ readonly internalType: "address";
408
+ readonly name: "";
409
+ readonly type: "address";
410
+ }];
411
+ readonly stateMutability: "view";
412
+ readonly type: "function";
385
413
  }, {
386
414
  readonly inputs: readonly [];
387
415
  readonly name: "tdocDeployer";
package/dist/index.d.ts CHANGED
@@ -320,6 +320,20 @@ declare const platformAccountFactoryAbi: readonly [{
320
320
  }];
321
321
  readonly name: "TdocDeployerUpdated";
322
322
  readonly type: "event";
323
+ }, {
324
+ readonly inputs: readonly [{
325
+ readonly internalType: "address";
326
+ readonly name: "";
327
+ readonly type: "address";
328
+ }];
329
+ readonly name: "attachedPaymaster";
330
+ readonly outputs: readonly [{
331
+ readonly internalType: "address";
332
+ readonly name: "";
333
+ readonly type: "address";
334
+ }];
335
+ readonly stateMutability: "view";
336
+ readonly type: "function";
323
337
  }, {
324
338
  readonly inputs: readonly [{
325
339
  readonly internalType: "bytes32";
@@ -382,6 +396,20 @@ declare const platformAccountFactoryAbi: readonly [{
382
396
  readonly outputs: readonly [];
383
397
  readonly stateMutability: "nonpayable";
384
398
  readonly type: "function";
399
+ }, {
400
+ readonly inputs: readonly [{
401
+ readonly internalType: "address";
402
+ readonly name: "platformAddress";
403
+ readonly type: "address";
404
+ }];
405
+ readonly name: "setAttachedPaymaster";
406
+ readonly outputs: readonly [{
407
+ readonly internalType: "address";
408
+ readonly name: "";
409
+ readonly type: "address";
410
+ }];
411
+ readonly stateMutability: "view";
412
+ readonly type: "function";
385
413
  }, {
386
414
  readonly inputs: readonly [];
387
415
  readonly name: "tdocDeployer";
package/dist/index.js CHANGED
@@ -438,6 +438,25 @@ var platformAccountFactoryAbi = [
438
438
  "name": "TdocDeployerUpdated",
439
439
  "type": "event"
440
440
  },
441
+ {
442
+ "inputs": [
443
+ {
444
+ "internalType": "address",
445
+ "name": "",
446
+ "type": "address"
447
+ }
448
+ ],
449
+ "name": "attachedPaymaster",
450
+ "outputs": [
451
+ {
452
+ "internalType": "address",
453
+ "name": "",
454
+ "type": "address"
455
+ }
456
+ ],
457
+ "stateMutability": "view",
458
+ "type": "function"
459
+ },
441
460
  {
442
461
  "inputs": [
443
462
  {
@@ -519,6 +538,25 @@ var platformAccountFactoryAbi = [
519
538
  "stateMutability": "nonpayable",
520
539
  "type": "function"
521
540
  },
541
+ {
542
+ "inputs": [
543
+ {
544
+ "internalType": "address",
545
+ "name": "platformAddress",
546
+ "type": "address"
547
+ }
548
+ ],
549
+ "name": "setAttachedPaymaster",
550
+ "outputs": [
551
+ {
552
+ "internalType": "address",
553
+ "name": "",
554
+ "type": "address"
555
+ }
556
+ ],
557
+ "stateMutability": "view",
558
+ "type": "function"
559
+ },
522
560
  {
523
561
  "inputs": [],
524
562
  "name": "tdocDeployer",
package/dist/index.mjs CHANGED
@@ -436,6 +436,25 @@ var platformAccountFactoryAbi = [
436
436
  "name": "TdocDeployerUpdated",
437
437
  "type": "event"
438
438
  },
439
+ {
440
+ "inputs": [
441
+ {
442
+ "internalType": "address",
443
+ "name": "",
444
+ "type": "address"
445
+ }
446
+ ],
447
+ "name": "attachedPaymaster",
448
+ "outputs": [
449
+ {
450
+ "internalType": "address",
451
+ "name": "",
452
+ "type": "address"
453
+ }
454
+ ],
455
+ "stateMutability": "view",
456
+ "type": "function"
457
+ },
439
458
  {
440
459
  "inputs": [
441
460
  {
@@ -517,6 +536,25 @@ var platformAccountFactoryAbi = [
517
536
  "stateMutability": "nonpayable",
518
537
  "type": "function"
519
538
  },
539
+ {
540
+ "inputs": [
541
+ {
542
+ "internalType": "address",
543
+ "name": "platformAddress",
544
+ "type": "address"
545
+ }
546
+ ],
547
+ "name": "setAttachedPaymaster",
548
+ "outputs": [
549
+ {
550
+ "internalType": "address",
551
+ "name": "",
552
+ "type": "address"
553
+ }
554
+ ],
555
+ "stateMutability": "view",
556
+ "type": "function"
557
+ },
520
558
  {
521
559
  "inputs": [],
522
560
  "name": "tdocDeployer",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trustvc/eip7702",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.1.0-beta.1",
4
4
  "description": "EIP-7702 smart account, platform paymaster, and factory contracts for TrustVC",
5
5
  "author": "DexTech",
6
6
  "license": "MIT",