Encumbra
Menu

Agents: per-charge authorization

A creditor can submit each draw with the agent's EIP-712 signature, and the contract blocks replay and signature malleability.

Per-charge authorization with EIP-712

The credit limit alone is coarse consent: it lets the creditor charge anything up to the cap. For bounded, per-draw authority, the agent signs each charge off-chain and the creditor submits the signature with chargeWithAuth.

The creditor chooses this path. charge is always available to the creditor on every lien, so neither the owner nor the agent can force per-draw signatures through the contract.

This is the ERC-7710/7715 delegated-spend model: the agent grants the creditor permission for exactly this amount, on exactly this lien, once.

  1. Agent signs off-chainan EIP-712 Charge message
  2. Creditor submitschargeWithAuth, paying the gas
  3. Contract checkssigner, nonce, deadline, credit limit
  4. Debt growsand the nonce is incremented
Only the creditor can submit the signature, and the contract accepts it only if the agent signed it.

The signature is an EIP-712 typed Charge message. It is bound to:

  • the lien id
  • the amount
  • a per-lien nonce
  • a deadline

The contract adds three protections:

  • It increments the nonce on use, so a captured signature cannot be replayed.
  • It rejects high-s signatures (EIP-2), so a valid signature cannot be malleated into a second distinct one.
  • It rejects an expired deadline.
// The agent holds a wallet (any EIP-712 signer).
// It authorizes a single $5 draw on its own line.
const amount = 5n * 1_000_000n; // USDC, 6 decimals

await encumbra.chargeWithAuth(
  lienId,
  amount,
  agentWallet, // signs the typed Charge message off-chain
  creditorAddress, // the creditor pays gas and submits
);
The agent signs; the creditor submits chargeWithAuth.

Under the hood, the SDK's chargeWithAuth:

  • reads the current chargeNonce(id) and the chain id
  • builds the EIP-712 domain (name Encumbra, version 1) bound to the verifying contract
  • sets a deadline one hour out
  • asks the agent's signer for the typed signature

The creditor relays the signature. The agent never needs gas and never holds the creditor's keys.

A creditor uses charge (role-authorized by the credit limit) for the simplest integration, and chargeWithAuth when it wants the agent to consent to each draw explicitly. Because the creditor can always call charge, an agent that wants per-draw consent has to agree this with the creditor off-chain. Both are bounded by the same on-chain credit limit and the same freeze.

Keep reading

Local proof of concept. The SDK, x402 server, and underwriter run against an in-process EVM or a local chain with no real funds. The contract is unaudited, and nothing here is financial, legal, or investment advice.