ERC-8226: Regulated Agent Mandate

Agreed on the boundary, and your framing is cleaner.

On the two open items: we offered earlier to write the Rationale note, and that offer stands.

Rather than wait to be asked, here’s draft text for both. They don’t depend on the same thing, so I’ve kept them apart.

This one holds whatever identityRef turns out to mean:

> checkPrincipal answers whether a principal is eligible. It is not a general channel for the state of an asset. Facts that hold regardless of who holds the instrument, maturity, cancellation, issuer default, have no principal in them and belong to the asset’s own compliance logic. Routing them through the provider makes the answer depend on which principal is asked, which breaks the first time two principals hold positions in the same instrument.

This one only works if the broad reading is the intended one, and that is the authors’ call:

> identityRef scopes the eligibility question. A provider MAY treat it as naming the specific right or position against which the principal is evaluated, rather than only as a pointer to identity evidence. Under that reading a principal who is still a valid person, but no longer holds the right the mandate was granted over, is correctly reported ineligible for that identityRef while remaining eligible under another.

If the broad reading isn’t intended, drop the second one, but then the principal-to-right relationship needs somewhere else to live and we’d want to help work out where. Pull either apart before it goes anywhere near a PR.

2 Likes

Thanks both. There are two deliberately decoupled layers here, and the question @chugarchugarr is asking is the right one to resolve first: which mutable facts must still be true at execution, and which layer owns each.

RAMS registry: does this agent have authority from this principal, for this action, on this asset, within these caps and this validity window? canExecute() answers that from registry state only. It makes no external provider call. That is intentional because putting an external dependency in the execution path would allow a reverting, unavailable, or badly upgraded provider to halt activity for every asset relying on the registry.

Asset/compliance layer: is this action permissible now? That is evaluated per action by the asset where such compliance logic exists.

IComplianceProvider is therefore a grant-time eligibility gate. checkPrincipal() is called on grantMandate() and again on extendMandate(), not from canExecute().

For changes during the mandate window, the owner depends on what changed.

If the asset or right itself changes, such as a pledge, transfer restriction, maturity, cancellation, or similar instrument state, the asset’s compliance logic owns that check at execution time.

If the principal’s eligibility changes, an authorized enforcer can propagate that into freezePrincipal(). That is a reversible enforcement stop. It does not revoke the mandate. freezeAgent() serves the same purpose when the issue belongs to the agent itself.

Short mandates renewed through extendMandate() also give a natural re-verification interval because extension runs checkPrincipal() again.

One naming point: there is currently no PRINCIPAL_INELIGIBLE execution reason. A mid-window eligibility stop is represented through the freeze state, for example PRINCIPAL_FROZEN or AGENT_FROZEN.

On identityRef, the intended meaning is identity evidence about the principal, such as a DID or attestation. It is not intended to identify the asset or right itself. If the principal-to-right relationship needs explicit representation, that should live elsewhere rather than overloading identityRef.

On ENFORCER_ROLE, the ERC does not require the compliance provider to hold it. Role assignment is deployment-specific. A provider can simply publish eligibility facts or events, while an authorized relay or registry operator propagates them into a freeze. Holding the provider role does not imply general freeze authority.

One thing worth discussing further is whether the current reference implementation should support finer-grained enforcer permissions. Today, in the current reference implementation, a holder of ENFORCER_ROLE can freeze any agent or principal. Would it make sense to scope an enforcer to a specific principal or set of principals?

Thanks, that settles identityRef, and it settles it against how we were using it. We read it as the context of the right being evaluated. You are saying it is evidence about the person. So our provider is doing the wrong thing with that field, and we will move it.

Where it moves is the part your answer already names. Instrument state belongs to the asset’s compliance logic at execution time, so that is where our registry state goes: the asset consults the state of the specific instrument, instead of borrowing the provider’s principal-level record for a fact that was never about the principal. Honestly it is a better fit for us anyway. We do not attest identity and we would rather not be read as attesting it. The IComplianceProvider seat was always a slightly wrong shape for a registry.

One consequence I do not think is resolved, and we hit it building rather than reading. A mandate names an asset, which is a contract address, and a contract can hold many instruments. If identityRef is identity evidence only, nothing in the mandate says which right the mandate was granted over. We had to solve that outside the standard: our asset carries its own fixed set of instrument identifiers, set at deployment, because a mandate scoped to every identifier a contract holds does not survive the determinate-object requirement I mentioned in post 38. It works, but it means two implementations can express “a mandate over this particular note” in two different ways and neither of them is wrong. @chugarchugarr said in 41 that the principal-to-right relationship needs to live somewhere explicit. I would add that the somewhere has no shape at all right now.

While I am here, two things in post 38 that need correcting. I wrote that PRINCIPAL_INELIGIBLE gives the caller something actionable. You are right that it does not exist. I took the name from the discussion instead of from the enum, which is careless in a post whose whole point was measured figures. And the gas numbers in that post are superseded. Re-measured from committed code, forked at a pinned Sepolia block so anyone can reproduce it: checkPrincipal 12,195 cold and 1,423 warm, canExecute 6,308, a full gated operation 68,346 on the first call and 14,944 repeated. They are lower than what I posted, so the cost argument gets easier rather than harder, which is exactly why I would rather have the reproducible ones on the record.

On scoping the enforcer, yes, and it is cleaner than it looked before your ruling. Our case is the one that motivates it. An operator publishing registry facts about instruments held by many unrelated principals has to hold freeze authority over every principal in the registry in order to propagate one fact about one of them. We would rather decline that than accept it, which is an awkward place to stand for anyone trying to build exactly the relay you describe. Scoping an enforcer to a set of principals fixes that.

Worth separating it from something it does not fix. Freezing a principal still halts every mandate that principal granted, so a scoped enforcer with authority over one holder still stops that holder everywhere. That used to bother us. It stops mattering under the boundary you just drew, because the case that made it bite was an instrument fact, and instrument facts are now the asset’s. So per-principal scoping looks sufficient, as long as that boundary holds.

On the mechanics, for whoever builds it: freezeAgent and freezePrincipal are the only two functions gated on ENFORCER_ROLE today, and revokeMandate takes the principal’s own signature, so it is not an enforcement path. Nothing reaches a single mandate. We measured propagation on Sepolia across five events, one to two blocks and twelve to thirty-six seconds, relay up on an idle network. That is the range and not the best case, since the thirty-six came out of that same run with no congestion to blame.

1 Like

I think that identifies the remaining hole cleanly. The mandate needs a determinate object below the asset address whenever one asset can contain multiple independently actionable rights. The asset address gives us the namespace, but not the specific right inside that namespace. identityRef cannot carry that meaning because we have now settled it as evidence about the principal, and the mutable state of the instrument still belongs to the asset at execution time.

So the missing relationship is simply the mandate binding the principal and agent to an asset-defined right identifier. Conceptually:

principal → mandate → (asset, rightRef)

rightRef does not need to describe the instrument or duplicate its state. It only needs to identify, canonically within that asset, which right the mandate governs. The asset remains responsible for resolving that identifier to its current instrument state when the action executes.

For an asset with one determinate right, the asset address can effectively be the singleton scope. For an asset containing many rights, the right identifier has to be explicit. Otherwise two implementations can both conform while interpreting the same mandate as authority over different objects, which means the mandate itself is not determinate.

That seems like the boundary that survives everything above: identity belongs to the principal and instrument state belongs to the asset, and the mandate carries only the explicit relationship between them.

Really interesting point you raised, @chugarchugarr and @JES-Factos.co. This is exactly why action is a bytes32 rather than being fixed to a function selector.

An implementation could define an action as transferFrom(), to authorize transferFrom generally, or something more specific, like IERC721.transferFrom(alice, bob, uint256(99))

So the granularity of action is intentionally an implementation decision. It can represent just the operation, or a more specific operation bound to selected call parameters.

We should make that flexibility clearer in the spec, because it is easy to read action today as selector-only.

If you already have an implementation of the instrument-specific case, we would love to see it tested using a parameter-scoped action against the current registry!

Built it, and it works. Same agent, same principal, same asset, same mandate, and both instruments current in our registry with the same holder, so registry state is not what separates them.

asset 0x16EFE870B7E1a50bd95f70d80196B8ECd49d3B65 Sourcify, exact match
action keccak256(selector, instrumentId)

At block 11674884 on Sepolia, against 0xB7e7B1ca762144A135FB43F9f543Ee76B21B8583:

instrument 1 canExecute (true, OK)
instrument 2 canExecute (false, 6) tx 0xc8a4923c…40ae5025 reverts NoMandate(agent, 6)

The mandate enumerates one action, the one for instrument 1. Instrument 2 never reaches our compliance logic; your registry stops it first. So the answer to @chugarchugarr’s rightRef in 45 is that the field already exists, which is a better answer than the one I gave in 44.

It also let us delete something. Our other asset carries a fixed set of instrument identifiers, set at deployment, because a mandate scoped to every identifier a contract holds does not survive the determinate-object requirement I mentioned in 38. With a parameter-scoped action that field is not needed for that requirement any more: the binding lives where the standard puts it. This asset does not have it. What it keeps is the registry read, because a parameter-scoped action binds at grant time and is static, and the endorsement case is precisely a binding that was correct on day one and stopped being true on day forty.

One thing worth a line in the spec if you make the flexibility explicit. Reason 6 is ACTION_NOT_ENABLED, and here that is true in a misleading way: the action is enabled, on a different object. The two failures have opposite remedies, ask for a different operation versus ask for a mandate over the right instrument, and a caller cannot tell them apart. The enum already draws that distinction one level up with WRONG_ASSET for the address. It cannot draw it one level down for the right inside the asset. Not asking for a new code, just noting that the moment action is documented as carrying parameters, that code starts answering two different questions.

Separately, a reproducibility note that might save someone else time. My fork tests were pinned to a block, but the public RPC prunes historical state, so they only passed on my machine through Foundry’s local cache. A freshly cloned repo failed. Pinning the block is not enough on its own; it needs an archive endpoint. Fixed and re-verified from a cold cache.

The Sepolia test resolves the rightRef question. The field was already present: action is the determinate scope below the asset address when selected call parameters are bound into the label. Two specification clarifications follow from that result.

First, the current statement that a mandate “covers every identifier that contract holds” is too strong once parameter-scoped actions are supported. What is identifier-agnostic is the cap accounting, not necessarily the delegated authority. A more precise rule would be:

“RAMS caps transferred quantity rather than maintaining per-identifier cap accounting. A mandate’s authority MAY nevertheless be narrower than the asset address when an enabled action binds selected call parameters, including a token or instrument identifier.”

Second, ACTION_NOT_ENABLED should mean exactly:

“the exact supplied bytes32 action is not enabled for this mandate.”

Because action is opaque to RAMS, the registry cannot determine whether a mismatch came from the operation selector, an instrument identifier, recipient, or another parameter encoded by the integrator.

That gives the boundary:

asset = authority namespace
action = immutable delegated scope inside that namespace
asset/compliance logic = mutable instrument state at execution
caps = aggregate quantity accounting across recorded actions

The conformance case is the one already exercised: same agent, principal, asset, and mandate; two instrument-bound action labels; only one enabled. The enabled label passes and the other returns ACTION_NOT_ENABLED. No additional rightRef field is required.

The remaining enforcer-permission question can remain an implementation/access-control concern under the existing design; it does not require changing the mandate semantics.

I have a question about multi-asset delegation in ERC-8226.

As I understand it, an active mandate is keyed by (agent, principal), while each mandate specifies a single asset.

Does this mean the following two mandates cannot coexist in the same AgentMandate registry?

  • Principal P + Agent A → Token A
  • Principal P + Agent A → Token B

If so, what is the intended pattern for an agent managing multiple assets for the same principal?

  1. Use a different agent address per asset?
  2. Deploy separate AgentMandate registries per asset?
  3. Or is supporting multiple mandates for the same (agent, principal) pair something being considered, e.g. (agent, principal, asset) or a mandateId?

I’m mainly curious whether the one-active-mandate-per-pair constraint is intentional, and what deployment pattern you would recommend for multi-asset use cases.

1 Like

Thanks @saltsugarpotato, you read it correctly. In the current version, mandates are keyed by (agent, principal) and only one can be active per pair. So P + A → Token A and P + A → Token B cannot coexist in the same registry. The second grant reverts with MandateAlreadyActive.

Why a mandate covers one asset: Caps are in the asset’s own units. A cap shared across assets would add amounts that do not compare and would need a price oracle in the transfer path, which RAMS avoids on purpose. One asset per mandate also gives one budget and one event history per instrument, which sets limits and report exposure.

Why only one active mandate per scope: A mandate must state, clearly, who may act, within which limits, and until when. One active mandate per scope means each action maps to exactly one authorisation, one budget and one revocation point. That is what makes the delegation defensible to custodians and supervisors.

What is changing: The scope is too narrow today, because one agent managing a portfolio for one principal is a normal case. We are widening it to: mandateKey = keccak256(abi.encode(agent, principal, asset)) with one active mandate per mandateKey.

Both mandates in your example will then coexist, each with its own caps, validity and revocation.

One agent address covers the portfolio, and one freezeAgent still stops it on every asset. We chose a derived key rather than a free mandateId because a gated token runs inside a normal transfer and cannot receive an ID from the caller, but it can compute (msg.sender, holder, address(this)).

We also chose it over an array of assets: per-asset caps would still be needed, and adding one asset would mean re-issuing the mandate, which resets every other asset’s budget. Until the update lands, use separate agent addresses per asset rather than separate registries, and remember that each address needs its own freeze. Separate registries split enforcement and the audit trail.

We will post here the update when it is out.

Hello everyone,

A new update to RAMS (ERC-8226) has been shipped: one agent can now hold mandates on several assets for the same principal. Before, mandates were keyed by (agent, principal), so an agent needed a separate wallet for each asset. Now they are keyed by (agent, principal, asset), with one active mandate per key, and each asset keeps its own caps, validity and revocation.

On the interface side, revokeMandate, extendMandate, recordExecution, isActionEnabled and getMandate now take the asset, a token can only record executions against its own mandates, and WRONG_ASSET is gone (an asset with no mandate returns NONEXISTENT). Agent and principal freezes still cover all assets at once. The spec update is already merged in the ERCs repo.

The new contracts are live on testnet:

Ethereum Sepolia

  • AgentMandate: 0x7944E36415086c0ef50d59570826b79e1da8C349
  • ComplianceProvider: 0x58F4A2cb61e90682a71Cae28a59539C0e5CA43A5
  • RamsGatedURWA20 (test token): 0x01205736DC5f2e07d6C11Cb9a09023149306e620

Base Sepolia

  • AgentMandate: 0xb554F62924cA3532921D8E3A3cb8a40155d4640f
  • ComplianceProvider: 0x87503D38C8fe5507e3EF819b7650ffBF36057ea7
  • RamsGatedURWA20 (test token): 0xF244b23aB7cAedfD8c116674B333668Dc0c1c4b8

Your feedback is appreciated.

@chugarchugarr asked earlier in this thread which mutable facts must still hold at execution, and which layer owns each. A first cut, split across three layers. I used ERC-8320’s own claim types where they fit, and said “payload” where the spec leaves the specific status to the schema.

The grant (8226): the agent is authorized, within scope, cap and validity, not revoked, and neither agent nor principal is frozen.

Token compliance (7943, and 7246 for balance-level encumbrance): the token is not frozen, the address is eligible to hold or transact, and balance and allowance are sufficient.

Instrument state (8320), the layer this thread’s gap is about: the instrument still exists, is not cancelled, matured or in default (EVENT, specific status in the claim payload); no competing charge or pledge on it (BACKING, encumbrance field); still backed, coverage present (BACKING); still held by the same party of record (BACKING, holderRef, a recorded reference, not a legitimation of title); and appraised value, if a consumer needs one, is a separate VALUATION claim the consumer applies, not backing.

Two things the split makes explicit. 8320 has no dedicated ownership claim type: “who holds it” rides in the backing claim as a recorded reference, and current eligibility to hold is COMPLIANCE, the same question the token layer already answers. And everything in the instrument-state layer is about the right behind the token, which the grant and the token layer cannot see. A mandate can pass the first two layers and fail the third: that is the composition we ran on Sepolia, where an 8226 act() reverts when the asset’s BACKING claim is suspended while the mandate stays valid.

Boundaries welcome, especially where a fact belongs to a different layer or claim type than I put it.

1 Like

Thamer, a heads-up from testing RAMS integration on Sepolia. The deployed AgentMandate diverges from the published ERC-8226 interface in two places, and the two deployments I found disagree with each other. Flagging it so integrators (us included) target the right one.

1. recordExecution. The spec has recordExecution(agent, principal, asset, action, amount), but both deployed contracts expose recordExecution(agent, principal, action, amount) with no asset parameter. The contract derives the asset from msg.sender (it must equal mandate.asset). So code written against the published signature hits a selector that is not there.

2. canExecute return. The spec returns (bool ok, MandateReason reason), and 0xB7e7B1ca762144A135FB43F9f543Ee76B21B8583 does return the tuple. But the address the docs point to, 0xD68E1bb972cA4EF7F5764FBf6d685a6DfC26778e, returns a single bool (32-byte returndata), so decoding the tuple against it reverts. The tuple matches the ExecutionReason return you mentioned adding; one deployment has it, the docs one does not.

Net: following the published spec plus docs.brickken.com fails against the address the docs recommend.

Which one is canonical, and will 0xD68E be redeployed to match the spec? We adapted by narrowing our side to the (bool) subset, which decodes against both, and our 8226 x 8320 composition runs clean against 0xD68E that way. Happy to share the exact calls if useful.

1 Like

Hey @JES-Factos.co, thanks for testing this and flagging it! Looks like you picked up the older deployments; the docs haven’t been updated yet. Please use the addresses I posted above; the Ethereum Sepolia AgentMandate is 0x7944E36415086c0ef50d59570826b79e1da8C34. Appreciate you putting the composition together!

Found this while browsing and wanted to add my two cents on provider safeguards. We could use multi-sig registries or staking models to keep verifiers honest and cut off rogue providers quickly. Has anyone tested how principal-custodied setups handle sudden mandate revocations mid-trade, especially if the agent goes offline?

1 Like

Hi all,

We opened a PR with the next update of ERC-8226: Update ERC-8226: Scope mandates by target with actions and limits by thamerdridi · Pull Request #2191 · ethereum/ERCs · GitHub

The main changes:

  • Mandates are keyed by (agent, principal, target) instead of (agent, principal, asset). The target is any contract the agent calls: a token, a pool or a router.
  • A mandate scope has actions, each with calldata constraints (EQUALS, NOT_EQUALS, AT_MOST, AT_LEAST), and limits per asset and direction (OUTFLOW, INFLOW) shared by all actions. This replaces the single per-asset caps.
  • Each execution reports a list of (asset, direction, amount) flows. A non-zero flow with no limit fails with NO_LIMIT.
  • Three enforcement venues: the token gate, the principal’s account (shared EIP-7702 delegate code or a module), and a standalone executor for chains without EIP-7702.
  • The executor measures the principal’s balance changes instead of reading amounts from calldata. IAgentExecutor is now an optional interface in the Specification.
  • An operator can also grant mandates and sign for the principal. Only the principal can approve an operator, and an enforcer can remove one.
  • A new grant clears the prior actions and limits, and the principal signs the starting cumulativeUsed.
  • New views: getActions, getLimits and getConstraints.

More updates will follow. Feedback is welcome.

Thanks for the input @fibesoyi

On provider: RAMS does not fix how a provider is governed. The provider is named in the mandate at grant, and a provider can be a multisig-governed contract, a staked adapter, or any other model.

The standard limits what a rogue provider can do:

  • The registry calls the provider only at grantMandate and extendMandate, canExecute never calls it. Because canExecute does not ask the provider, a principal who loses eligibility during a mandate is stopped by a freeze relay: it watches PrincipalRevoked events and calls freezePrincipal at once. For a provider that reads an external backend, such as EAS, the relay watches the backend’s revocation events instead.
  • A compromised provider can approve an ineligible principal, or refuse an eligible one, at grant or extension. On assets with their own compliance check, that check still runs on each transfer. In every venue, an enforcer can freeze the agent or the principal at once.
  • The Security Considerations recommend providers with audited, time-locked upgrades.

On revocation mid-trade: each agent call is one atomic transaction. The executor checks the mandate before the call and records the flows after it, in the same transaction. If the revocation lands first, the call reverts with REVOKED and nothing moves. If the trade lands first, it completes in full. A trade cannot be half-executed. A strategy that spans several transactions stops at the next call after the revocation.

If the agent goes offline, nothing happens to the funds. In the principal-custodied venues (EIP-7702 or a module), the assets never leave the principal’s account, and the principal or an operator can revoke at any time without the agent. The reference test suite covers execution after revocation.

Hi everyone, for those who want to try the latest ERC-8226 updates, the contracts are live and verified on Ethereum Sepolia and Base Sepolia:

Ethereum Sepolia

Base Sepolia

Feedback is welcome always!

1 Like