- Smart contract calls — which contract, which function, and often which argument values.
Fordefi expresses these as
ABI conditions,
matching on
address, integer, boolean,bytes, array, and tuple arguments. - Personal messages (
personal_sign, e.g. EIP-191) — see personal messages and messages on non-EVM chains. - Typed data (EIP-712) — see typed data messages, where you can deny signatures that match certain fields of the EIP-712 domain or message.
Because the EIP-712 path can do strictly more than the contract-call path, the tightest setup is
to close it entirely and operate through contract calls only.
Recommended policy
1
Block all EIP-712 signing on the MPC wallet
Every state-changing Derive action taken over the API is an EIP-712 signed action. Denying
EIP-712 outright means the MPC wallet can never trade, transfer, or withdraw through the
API — no allow-list to maintain and no new action type can slip through later.In Fordefi this is a typed data message
rule. Fordefi surfaces an EIP-712 message’s recipient as its
verifyingContract, so target
the rule at Derive’s action domain:Every Derive signed action uses this same
verifyingContract on every network, so one deny
rule on that address covers mainnet and testnet alike.2
Whitelist deposits
On Pin
OnchainActionManager, allow the two deposit entrypoints:owner and fallbackRecipient to the MPC wallet address. owner is what makes the MPC
wallet the account owner; fallbackRecipient is where a deposit lands if it cannot be applied
to its intended subaccount.3
Whitelist session-key registration, with the scopes pinned
Session keys are registered from L1 through the generic entrypoint:
Example (trade and withdraw only session key)
In this example we’re going to create a policy that will only allow your MPC wallet to create Session keys with thetrade:orderbook:perp and withdraw protocol scopes. Because only admin scoped keys can withdraw to any recipient, this policy will only allow withdrawals to the MPC wallet’s own subaccounts.Use the TypeScript SDK’s
session-key codec,
to produce the bytes you’ll use to create an MPC policy.Which bytes to pin in your MPC policy
You can modify what you pin depending on your needs.
Leave personal messages (EIP191)
allowed so session login keeps working and the MPC wallet retains
read-only account access through UX and API.
Related
Access scopes
The full protocol and off-chain scope catalog.
Session keys
What a session key is and how its lifecycle works.
Withdrawals
The withdrawal action and its recipient semantics.
