FeeProxy
FeeProxy lets anyone who brings activity to Intuition earn a fee on it. A wallet, app, agent or community registers once as an affiliate and chooses its fees. Its users then send deposits and atom or triple creations through FeeProxy, naming the affiliate. FeeProxy takes the disclosed fee, pays it to the affiliate in the same transaction and forwards the rest to MultiVault.
| Network | FeeProxy address |
|---|---|
| Intuition mainnet, chain 1155 | 0x45B65BB9FFC4BC51C9e3a56902d9183dcff51B55 |
| Intuition testnet, chain 13579 | 0x847801465DcB17811089107c0051c49E0135F6B8 |
Become an affiliate
Registration is permissionless. The address that calls registerAffiliate becomes the affiliate. It controls its own configuration from then on.
| Mainnet setting | Value | Getter |
|---|---|---|
| Registration fee | 100 TRUST, sent to the protocol treasury | registrationFee() |
| Maximum rate | 2,000 bps (20%) on each side | maxFeeBps() |
| Maximum fixed fee | 50 TRUST per routed call on each side | maxFixedFee() |
Values were read at Intuition mainnet block 12,026,592. The protocol admin can change them, so read the getters before registering.
-
Choose your fees. A
FeeConfighas four fields:depositBps,creationBps,depositFixedFeeandcreationFixedFee. Rates are basis points out of 10,000. Fixed fees are in native TRUST wei. Deposits and creations are priced separately, and any field can be zero. -
Choose a fee recipient. The recipient can be any nonzero address that accepts native TRUST, such as a treasury or a splitter contract. If the recipient rejects the transfer, every routed call fails, so test it first.
-
Register. Send exactly the registration fee with the call. Each address can register once.
cast send 0x45B65BB9FFC4BC51C9e3a56902d9183dcff51B55 \
"registerAffiliate((uint256,uint256,uint256,uint256),address)" \
"(50,100,0,0)" 0xYourFeeRecipient \
--value 100ether --rpc-url https://rpc.intuition.systemsThis example charges 0.5% on deposits and 1% on creations with no fixed fee. On Intuition,
100ethermeans 100 TRUST. -
Check the result.
isAffiliateActive(affiliate)returnstrue, andaffiliateConfig(affiliate)returns the fees, recipient and registration time.
After registering, the affiliate can call updateAffiliateFees(fees) and updateFeeRecipient(recipient) at any time, including while the affiliate or the whole proxy is paused. New fees must be within the current caps. There is no way to deregister. To stop charging, set every fee to zero.
Prompt for your agentPrepare an affiliate registration
Goal: prepare my FeeProxy affiliate registration for me to send.
Read https://docs.intuition.systems/docs/contracts/fee-proxy.md and https://docs.intuition.systems/docs/contracts/deployments.md.
Network: [Intuition mainnet or testnet]. Check the RPC chain ID before reading anything.
Read registrationFee, maxFeeBps and maxFixedFee from FeeProxy. Check isAffiliateActive for my address, because each address can register only once.
My fees: [deposit and creation rates in basis points, and any fixed fees]. Check each value against the caps.
Fee recipient: [address]. Confirm it can receive native TRUST, because a recipient that rejects payment makes every routed call fail.
Prepare the registerAffiliate call with exactly the registration fee as its value, then stop. Show me the encoded call, value and caps, and wait for my approval. Never sign or send it yourself.
After I send it, confirm that isAffiliateActive returns true and that affiliateConfig matches what I approved.
Report the checks you actually ran and anything you could not verify.
Paste this into your coding agent. It points the agent at the Markdown version of each page and leaves every signature to you.
The fee
FeeProxy charges one fee per routed call:
fee = ⌊grossAssets × bps / 10,000⌋ + fixedFee
forwarded = grossAssets − fee
bps and fixedFee come from the deposit side or the creation side, depending on the route. The fee must be smaller than the gross amount. In a batch, the fee is computed once on the total. The forwarded total is split across items in proportion to their gross amounts, and the last item receives the rounding remainder.
For example, a 1,000 TRUST deposit through an affiliate charging 50 bps with a 1 TRUST fixed fee pays the affiliate 6 TRUST and forwards 994 TRUST. MultiVault then applies its own fees to the 994 TRUST, as for any direct deposit.
previewDepositFee(affiliate, grossAssets) and previewCreationFee(affiliate, grossAssets) return the fee and the forwarded amount. They do only the arithmetic. They do not check pauses, caps or approvals.
Route a call
Each route takes the affiliate's address, the gross amounts and a FeeGuard. msg.value must be at least the total gross amount.
| Function | MultiVault call it makes |
|---|---|
depositVia(affiliate, receiver, termId, curveId, grossAssets, minShares, feeGuard) | deposit for the receiver |
depositBatchVia(affiliate, receiver, termIds, curveIds, grossAssets, minShares, feeGuard) | depositBatch for the receiver |
createAtomsVia(affiliate, atomDatas, grossAssets, feeGuard) | createAtomsFor with the caller as creator |
createAtomsWithUrisVia(affiliate, atomDatas, grossAssets, uris, feeGuard) | createAtomsWithUris with the caller as creator |
createTriplesVia(affiliate, subjectIds, predicateIds, objectIds, grossAssets, feeGuard) | createTriplesFor with the caller as creator |
Set minShares for the forwarded amount, not the gross amount. For a creation, the forwarded amount per item must still cover the atom or triple cost.
Protect users with a fee guard
FeeGuard {maxFeeBps, maxFixedFee} is the highest rate and fixed fee the user agreed to. FeeProxy compares the affiliate's configured values at execution time with the guard and reverts if either is higher. This stops an affiliate from raising its fees between the moment a user sees a quote and the moment the transaction lands. Set the guard to the fees you displayed.
Approvals
MultiVault only lets FeeProxy act for an account that has approved it. A user approves FeeProxy once by calling approve(feeProxy, approvalType) on MultiVault.
| Route | Approval needed |
|---|---|
| Deposits | The receiver must give FeeProxy DEPOSIT approval, even when depositing for themselves. If the caller is not the receiver, the receiver must also give the caller DEPOSIT approval. |
| Creations | The caller must give FeeProxy CREATION approval. |
approve replaces the approval for that address, not adds to it. To allow both deposits and creations through FeeProxy, approve once with DEPOSIT_AND_CREATION, value 5. Approving CREATION (4) after DEPOSIT (1) leaves only creation approval. The values are bit flags: DEPOSIT 1, REDEMPTION 2, CREATION 4. Check with isApprovedToDeposit(feeProxy, receiver) and isApprovedToCreate(feeProxy, creator).
Payouts and refunds
The order of operations within a routed call is fixed.
- FeeProxy checks the receiver approval, the affiliate status, the caps and the fee guard.
- It calls MultiVault with the forwarded amount.
- It records the affiliate's stats.
- It pays the fee to the affiliate's recipient and emits
AffiliateFeePaid, including when the fee is zero. - It returns any
msg.valueabove the gross amount to the caller.
If the caller cannot receive the refund, FeeProxy records a credit instead and emits RefundCredited. The caller recovers it with claimRefund() or claimRefundTo(recipient). Read pendingRefund(account) for the credit. FeeProxy accepts plain native transfers only from MultiVault and from itself.
Affiliate stats
FeeProxy keeps running totals for each affiliate, updated only by successful routed calls. A batch counts as one transaction.
| Getter | Returns |
|---|---|
affiliateStats(affiliate) | txCount, uniqueUsers, total gross, fees and forwarded amounts, and the same figures split into deposit and creation counts and totals |
affiliateUserStats(affiliate, user) | The same figures for one user, without uniqueUsers |
Events
| Event | Emitted when |
|---|---|
AffiliateRegistered(affiliate, feeRecipient, fees, registrationFee) | An affiliate registers |
AffiliateFeesUpdated(affiliate, previous, current), AffiliateFeeRecipientUpdated(affiliate, previous, current) | An affiliate changes its configuration |
DepositedVia(user, affiliate, termId, grossAssets, affiliateFee, forwardedAssets, shares) | A single deposit routes |
DepositedBatchVia, CreatedAtomsVia, CreatedTriplesVia | A batch deposit or a creation routes. Each includes the totals and the affiliate fee. |
AffiliateFeePaid(affiliate, user, affiliateFee) | The fee is paid |
AffiliatePaused, AffiliateUnpaused | The protocol pauses or unpauses one affiliate |
RefundCredited, RefundClaimed | A refund falls back to the ledger, or is claimed |
user is always the address that called FeeProxy. A routed call also produces MultiVault's own Deposited, AtomCreated or TripleCreated events in the same receipt. Event and error definitions
Roles and pausing
| Role | Can |
|---|---|
PAUSER_ROLE | Pause the whole proxy with pause(), or one affiliate with pauseAffiliate(affiliate) |
DEFAULT_ADMIN_ROLE | Unpause either, set maxFeeBps, maxFixedFee and registrationFee, and grant roles |
On mainnet, the pauser multisig holds PAUSER_ROLE and the admin multisig holds DEFAULT_ADMIN_ROLE. If the admin lowers a cap, routes for an affiliate above the new cap revert until the affiliate lowers its fees. The other side keeps working if it is within the cap. The MultiVault and treasury addresses are set at initialization and have no setters.
FeeProxy implementation · SDK plan
Related
- Route writes through the FeeProxy quotes and submits routed calls from an app.
- Periphery contracts places FeeProxy alongside the other contracts around the core.
- Events and errors explains how to decode FeeProxy reverts.
Applies to V2 · @0xintuition/periphery 0.1.1 · @0xintuition/sdk 4.1.0