@agenticprimitives/contracts 0.1.0-alpha.3 → 1.0.0-alpha.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenticprimitives/contracts",
3
- "version": "0.1.0-alpha.3",
3
+ "version": "1.0.0-alpha.4",
4
4
  "description": "Solidity contracts + ABIs + flattened sources + per-network deployment addresses for the agenticprimitives stack.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -51,12 +51,26 @@ import "./governance/IGovernance.sol";
51
51
  * The hash deliberately omits `paymasterAndData` from the userOp
52
52
  * because the signature lives there.
53
53
  *
54
+ * Construction modes (R5.7 / PKG-PAYMASTER-002 closure — external audit P0-2):
55
+ * The constructor takes `bool devMode_` + `address verifyingSigner_`
56
+ * EXPLICITLY. There is no implicit fail-open default; pre-R5.7 the
57
+ * constructor forcibly set `_dev = true` and production deploys had to
58
+ * remember to call `setDevMode(false) + setVerifyingSigner(...)` AFTER
59
+ * the broadcast, which left a window where the paymaster would sponsor
60
+ * any userOp on the freshly-deployed network. Now: testnet deploys pass
61
+ * `devMode_=true`; production deploys pass `devMode_=false` with a
62
+ * verifying signer (or allowlist seed). See `Deploy.s.sol`.
63
+ *
54
64
  * Production checklist:
55
- * 1. Call `setDevMode(false)` (governance only) to leave dev mode.
56
- * 2. Call `setVerifyingSigner(<KMS-backed signer addr>)` to enable
57
- * verifying-paymaster mode (preferred). OR populate `_acceptList`
58
- * via `setAccepted` if you want allowlist mode.
59
- * 3. Monitor `getDeposit()` and alert below a runway threshold.
65
+ * 1. Construct with `devMode_=false` AND either:
66
+ * - a non-zero `verifyingSigner_` for verifying-paymaster mode
67
+ * (preferred Pimlico/Stackup/Alchemy pattern), OR
68
+ * - `verifyingSigner_=address(0)` to start in allowlist mode (no
69
+ * sender is sponsored until `setAccepted` runs). The fall-back
70
+ * to allowlist is fail-closed: every userOp reverts with
71
+ * `SenderNotAccepted` until governance explicitly opts a sender
72
+ * in. That is the documented safe state.
73
+ * 2. Monitor `getDeposit()` and alert below a runway threshold.
60
74
  *
61
75
  * @dev Inherits `addStake`, `unlockStake`, `withdrawStake`, `deposit`,
62
76
  * and `withdrawTo` from `BasePaymaster`. Ownable owner is set in
@@ -102,15 +116,28 @@ contract SmartAgentPaymaster is BasePaymaster {
102
116
  /// begins: 20 (paymaster addr) + 16 (verifGas) + 16 (postOpGas).
103
117
  uint256 private constant PM_DATA_OFFSET = 52;
104
118
 
119
+ /// @param devMode_ true → accept-all (dev/anvil); false → require
120
+ /// verifying-signer or allowlist. R5.7 removed
121
+ /// the implicit fail-open default.
122
+ /// @param verifyingSigner_ EOA that signs paymaster envelopes when
123
+ /// `devMode_=false`. Pass `address(0)` to start
124
+ /// in allowlist mode (fail-closed until
125
+ /// `setAccepted` runs).
105
126
  constructor(
106
127
  IEntryPoint entryPointAddr,
107
128
  address initialOwner,
108
- address governance_
129
+ address governance_,
130
+ bool devMode_,
131
+ address verifyingSigner_
109
132
  ) BasePaymaster(entryPointAddr, initialOwner) {
110
133
  if (governance_ == address(0)) revert ZeroGovernance();
111
134
  governance = governance_;
112
- _dev = true;
113
- emit DevModeSet(true);
135
+ _dev = devMode_;
136
+ emit DevModeSet(devMode_);
137
+ if (verifyingSigner_ != address(0)) {
138
+ verifyingSigner = verifyingSigner_;
139
+ emit VerifyingSignerSet(address(0), verifyingSigner_);
140
+ }
114
141
  }
115
142
 
116
143
  // ─── Admin (governance-only) ────────────────────────────────────────