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.
- Agent signs off-chainan EIP-712 Charge message
- Creditor submitschargeWithAuth, paying the gas
- Contract checkssigner, nonce, deadline, credit limit
- Debt growsand the nonce is incremented
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-
ssignatures (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
);Under the hood, the SDK's chargeWithAuth:
- reads the current
chargeNonce(id)and the chain id - builds the EIP-712 domain (name
Encumbra, version1) 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.
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.