Skip to main content

EVM V2 On-Chain Partner Fees

V2 uses SweeprBatchV5PartnerFees, a Permit2-based EVM contract that atomically splits sweep output between the user, partner, and Sweepr protocol recipient. V2 does not support cross-chain sweeps. Each V2 sweep is single-chain.

Flow

Partner app
  -> POST /sweepr/v2/sweep/build
  <- Permit2 typed data, V5 transaction template, signed fee authorization

User wallet
  -> signs Permit2 typed data
  -> sends V5 transaction

V5 contract
  -> verifies Sweepr fee authorization
  -> pulls tokens through Permit2
  -> executes whitelisted router swaps
  -> splits output atomically

Partner app
  -> POST /sweepr/v2/sweep/status/:id/confirm
  <- Sweepr confirms actual split from SweepExecutedV5 event

Fee Math

grossOutput = output balance after swaps
totalFee = grossOutput * totalFeeBps / 10000
partnerFee = totalFee * partnerShareBps / 10000
protocolFee = totalFee - partnerFee
userAmount = grossOutput - totalFee
partnerShareBps is the partner’s share of the Sweepr platform fee. It is not charged directly against the full swap output.

Dynamic Partner Fees

Partner fee share is configured in Sweepr’s backend per partner. The partner cannot override it in the build request. For each V2 build, Sweepr signs a short-lived FeeAuthorization:
user
partnerId
partnerRecipient
protocolRecipient
outputToken
totalFeeBps
partnerShareBps
nonce
deadline
The V5 contract verifies:
  • Signature is from the configured Sweepr fee signer.
  • Signed user is msg.sender.
  • Deadline is still valid.
  • Nonce has not been used.
  • Signed chain and contract match the EIP-712 domain.
  • Output token matches the actual sweep output token.
  • Fee is under the hard cap.
  • Required recipients are non-zero.

Rollback

V4 remains available. If Sweepr sets:
SWEEPR_EVM_BUILD_MODE=v4_fallback
the backend can return the V4 path without requiring partner app changes.
Last modified on June 14, 2026