The rule
No single key can move user funds on PredictStreet.Vault.withdrawERC20 on-chain checks two signatures:
- User signature — EIP-712 from the vault owner EOA.
- Backend signature — EIP-712 from a platform backend key: any
address holding
BACKEND_ROLEon the VaultFactory (VaultFactory.isBackend(signer)).
OwnerAndBackendSignerMustDiffer);
a vault owner who holds BACKEND_ROLE cannot collapse the dual signature into one.
If either signature is missing, invalid, or replayed, the vault reverts. msg.sender
of the tx is unconstrained — a relayer, the user, or a third party can submit.
Sequence
Why two signatures
- User signature. Proves user authorised this specific withdrawal.
- Backend signature. Attests the request passed platform compliance (AML, banned-destination, restrictions).
- Unilateral backend moves are impossible. The backend’s key alone doesn’t unlock the vault.
What the on-chain verifies
Simplified, in check order:- Digest-based replay protection — single-use per digest (
usedDigests[digest]). - Revocable before execution — the vault owner or a platform
backend key can call
invalidateDigest(digest)(or the batchinvalidateDigests) to burn a signed withdrawal before it is submitted; any later submission of that digest reverts. See Digest invalidation. - Emergency withdraw — if the backend is gone or refusing
legitimate withdrawals, the vault owner calls
initiateEmergencyWithdraw(); after a 7-day timelock (EMERGENCY_TIMELOCK), it can drain the vault (balanceOf, including off-ledger surplus) to the owner address during a 7-day window (EMERGENCY_EXECUTION_WINDOW), with no backend signature. Executing an emergency drain freezes the owner’s limits inDepositLimitRegistryand permanently disables trading settlement on that vault (tradingDisabledAfterEmergency = true). See Emergency withdraw. - Expired reservations & automatic recovery — if a withdrawal’s deadline
passes before execution, the vault contract rejects late submissions
(
WithdrawExpired). Unlike splits/merges (which feature a manualPOST /api/me/splits-merges/{opId}/unlockendpoint), withdrawals have no user-facing unlock endpoint. Instead, the platform’s backend chain-watcher automatically verifies that the on-chain digest is unconsumed, transitions the row toEXPIRED, and refunds the locked balance (locked -> available). Users can also cancel in-flight withdrawals before submission viaPOST /api/me/withdrawals/{id}/cancel.
Backend co-signer security
The backend co-signing keys are the addresses holdingBACKEND_ROLE on
the VaultFactory. More than one can be active at a time, and any of
them can be revoked on-chain via revokeRole. The vault checks isBackend when the
withdrawal executes, so a signature from a revoked key no longer
verifies.