Who Pays an ERC-3643 Transfer Fee, and How Is It Taken?
An ERC-3643 transfer fee is a per-transfer charge that the T-REX TransferFeesModule collects after a transfer completes, by calling the token's agent-only forcedTransfer to move the fee from the receiver to a collector wallet. The sender's amount is never reduced: the receiver nets the amount minus the fee, and every fee leaves a second Transfer event.
TL;DR — Key Takeaways
- ✓The payer: In T-REX the fee is not deducted from the sender. The full amount moves first; then the TransferFeesModule calls forcedTransfer to move the fee from the receiver to a collector wallet.
- ✓The setup: The rate is an integer in 0.01% units, capped at 10000. The collector must be verified when setFee runs, and the module must be a token agent or it will not bind.
- ✓The exemptions: No fee on mint, burn, transfers between wallets of the same ONCHAINID, transfers to or from the collector address, or any transfer where rounding makes the fee zero.
- ✓The side effects: The fee hop is a full forcedTransfer, so every module's post-transfer hook runs on it. In code reading, a holding cap can apply to the collector, and module order can revert a first purchase.
- ✓The records: Each charged transfer emits two Transfer events in one transaction. No per-fee event exists, so reconciliation must pair the collector leg with its parent transfer.

How does the T-REX TransferFeesModule take a fee?
It waits until the transfer has settled, computes value times rate divided by 10000, and calls the token's forcedTransfer to move that amount from the receiver to the collector. The sender's transfer is never reduced, and the receiver pays.
The sequence runs through three contracts. Token.transfer checks that the receiver is verified and that canTransfer passes, moves the full amount with _transfer, and then calls compliance.transferred(from, to, value). ModularCompliance.transferred loops over every bound module and calls its moduleTransferAction. In TransferFeesModule, that hook is where the fee is taken. Its moduleCheck always returns true, so the module never blocks a transfer on its own; it only acts after one.
This is one of the post-transfer, stateful patterns that separate ERC-3643 from plain ERC-20 tokens; the guide to RWA token standards places ERC-3643 among the other permissioned designs. The point for operations is that the fee is not a parameter of the transfer. It is a second transfer that the token performs on the receiver's behalf, inside the same transaction.
“uint256 feeAmount = (_value * fee.rate) / 10000; if (feeAmount == 0) { return; } IToken token = IToken(IModularCompliance(msg.sender).getTokenBound()); bool sent = token.forcedTransfer(_to, fee.collector, feeAmount); require(sent, "transfer fee collection failed");”
TransferFeesModule.sol, moduleTransferAction, TokenySolutions/T-REX main @ f1390127
Tokeny's own documentation for the module describes the same order of events: the fee “is transferred from the receiver to the collector's wallet after the transfer process”, using the token's forcedTransfer function.
How is the fee configured?
With one call, setFee(rate, collector), made by the compliance owner through callModuleFunction. The rate is an integer where 1 means 0.01% and 10000 means 100%; the collector must pass isVerified on the token's Identity Registry at that moment.
| Setting or rule | What the code does (f1390127) | Failure mode |
|---|---|---|
| Rate unit | uint256 in 0.01% steps: 1 = 0.01%, 100 = 1%, 10000 = 100% | Above 10000 reverts FeeRateIsOutOfRange |
| Collector | One wallet per compliance contract, checked with isVerified | Unverified collector reverts CollectorAddressIsNotVerified |
| Caller | setFee is onlyComplianceCall; the compliance owner reaches it through callModuleFunction | Direct calls to the module revert |
| Binding | isPlugAndPlay is false; canComplianceBind requires the module to be a token agent | addModule reverts “compliance is not suitable for binding to the module” |
| Scope | Fees are stored per compliance address, so one module deployment can serve several tokens | Each token needs its own setFee and its own agent grant |
| Change log | FeeUpdated(compliance, rate, collector), plus ModuleInteraction from the compliance | No effective date: the new rate applies to the next transfer |
Two configuration points deserve a written procedure. First, the order of setup is fixed: grant the agent role to the module address on the token, then call addModule, then call setFee. Tokeny's documentation states that without agent status “the transfer cannot be made”. Second, the collector is checked once. If its identity later fails isVerified, for example because a required claim expired, nothing re-checks it at configuration level. The next charged transfer will fail instead, as the section on side effects explains.
Tokeny's page also says the module allows “the exclusion of certain addresses from the fee mechanism”. In the code at f1390127 there is no exclusion list. The only exemptions are the collector address itself and transfers within one ONCHAINID.
Which transfers are charged, and which are exempt?
Every transfer that runs compliance.transferred between two different identities is charged, including transferFrom and agent forcedTransfer. Mints, burns, same-identity moves, collector legs and transfers where the rounded fee is zero are not.
| Operation | Fee taken? | Why, in the code |
|---|---|---|
Holder transfer / batchTransfer | Yes, per row | Each row calls transferred; the fee is computed on that row's value |
transferFrom (for example a DvP contract) | Yes, from the receiver | Calls transferred like transfer |
Agent forcedTransfer between identities | Yes, from the receiver | Also calls transferred |
Agent recoveryAddress | No | Both wallets resolve to the same ONCHAINID during the inner forcedTransfer |
| Transfer between two wallets of one investor | No | Sender and receiver identity are equal |
| Transfer to or from the collector wallet | No | Checked by wallet address, not identity |
mint, burn | No | Mint and burn hooks are empty |
| Fee rounds to zero | No | Integer division; zero is skipped |
Rounding is the exemption most likely to surprise. The fee is value * rate / 10000, rounded down, in base units. Illustrative example (invented numbers). A share token uses 0 decimals and a rate of 25 (0.25%). A transfer of 399 shares pays 0; 400 pays 1; 799 still pays 1. Splitting one 799-share trade into two 399-share transfers moves 798 shares fee-free. With 18 decimals the same rate rounds away only dust. The fee policy is therefore a function of the token's decimals, the same issue covered for subscriptions in how token decimals corrupt RWA subscription amounts.
The collector exemption is by wallet address. Other wallets linked to the collector's ONCHAINID are treated like any other holder, so a treasury that moves fees out of the collector wallet into a sibling wallet is exempt only because the sender is the collector address.
What does the receiver actually get in a DvP trade?
The delivered amount minus the fee. In a swap of a fee-bearing T-REX token against cash, Tokeny's documentation says the fee is taken from the counterparty receiving the T-REX token, so the buyer ends with less than the trade size unless the instruction is grossed up.
A DvP contract that calls transferFrom(seller, buyer, amount) triggers the same post-transfer hook as a holder transfer. The buyer's balance rises by amount - fee, and the collector's by the fee, all inside the settlement transaction. If the trade confirmation says the buyer receives 1,000 units, someone has to decide whether the seller delivers more or the buyer accepts less. Illustrative example (invented numbers). At a rate of 100 (1%), delivering 1,010 units charges 10 and nets the buyer 1,000; delivering 1,011 also charges 10 because of rounding down, and nets 1,001.
“the fee will be taken from the counterpart receiving the TREX token.”
Tokeny documentation, transfer types (swap of a T-REX token against an ERC-20)
The same page warns about double charging when a settlement contract applies its own fee: “if fees are configured at DvD level, fees should not be configured, to avoid duplication.” If both layers charge, the buyer pays twice. Settlement design beyond the fee, including why both legs must settle or neither, is covered in the related article on atomic settlement.
Why must the module be an agent, and what does that grant?
forcedTransfer is onlyAgent, so the module address needs the token agent role to collect. In T-REX that role is not split by function: the same address could, by its code, call mint, burn, freeze or forcedTransfer on any holder.
The deployed module code only ever calls forcedTransfer(receiver, collector, fee). The governance question is who can change that code. TransferFeesModule inherits AbstractModuleUpgradeable, which is UUPS-upgradeable with _authorizeUpgrade gated by onlyOwner. Reading the code, the module owner can therefore replace the logic behind an address that holds agent rights on every token it serves. That is a standard upgrade pattern, not a flaw, but it means the module owner key belongs on the same register of privileged keys as the token agents, with the same multisig and change controls discussed in who really controls an ERC-3643 token's agent keys.
“function canComplianceBind(address _compliance) external view returns (bool) { address tokenAddress = IModularCompliance(_compliance).getTokenBound(); return AgentRole(tokenAddress).isAgent(address(this)); }”
TransferFeesModule.sol, TokenySolutions/T-REX main @ f1390127
Removing the agent role from the module after binding does not unbind it. In code reading, the next charged transfer would revert inside forcedTransfer because the module is no longer an agent, and every fee-bearing transfer on the token would stop until the role is restored, the rate is set to 0, or the module is removed.
What side effects does the fee hop have?
The fee hop is a full forcedTransfer, so it skips canTransfer but runs every bound module's moduleTransferAction for the receiver-to-collector leg. Any stateful module records the fee as a transfer, and any failure inside the hop reverts the parent transfer.
Token.forcedTransfer checks only that the collector passes isVerified, then calls _transfer and compliance.transferred(receiver, collector, fee). Inside that nested call, TransferFeesModule sees the collector as receiver and returns, so the hop does not recurse. The other modules do not return early. The list below is code reading at f1390127; we ran no unit or fork test for any of it.
- Collector loses verification. If the collector's identity fails
isVerified,forcedTransferreverts “Transfer not possible”, and every charged transfer reverts with it. Claim expiry is the usual cause, the same liveness risk described in how expired KYC can make an ERC-3643 position unsellable, but here one wallet can stop the whole secondary market. - Pause. Holder transfers are blocked by
whenNotPaused, butforcedTransferhas no pause modifier, so agent forced transfers during a pause still pay the fee. - Batches.
batchTransferandbatchForcedTransferare plain loops, so a fee-hop failure on one row reverts every row, the same all-or-nothing behaviour covered for ERC-3643 batch mints. Mints are not charged, so a batch mint is unaffected by the fee module itself. - Corrections. An agent that reverses a mistaken transfer with
forcedTransferbetween two different identities pays a second fee on the reversal. Refunding both fees takes a separate transfer out of the collector, which is exempt.
How does the fee interact with MaxBalanceModule?
In code reading only, two ways. The collector's identity accumulates fees inside the holding-cap ledger and can hit the cap; and if TransferFeesModule runs before MaxBalanceModule, a first purchase by a new holder can revert on an underflow.
We have not executed either case: no fork or unit test was available, so treat both as findings from reading MaxBalanceModule.sol and ModularCompliance.sol at f1390127. How the cap ledger is built and preset is covered in adding a holding cap to a live ERC-3643 token; this section covers only what the fee hop adds.
1. The collector counts toward the cap. MaxBalanceModule's moduleTransferAction adds the value to the receiver identity's tracked balance, subtracts it from the sender identity, and reverts MaxBalanceExceeded if the receiver is above the cap. On the fee hop the receiver is the collector. Once accumulated fees push the collector identity above the cap, every charged transfer reverts. A capped token needs either regular sweeps out of the collector or a collector identity with known headroom.
2. Module order can matter. transferred calls modules in the order of the _modules array. If TransferFeesModule comes first, the fee hop runs before MaxBalanceModule has credited the receiver with the incoming amount. The nested call then subtracts the fee from the receiver identity's tracked balance. For a new holder whose tracked balance is 0, that subtraction underflows, and Solidity 0.8.17 checked arithmetic reverts the whole transfer. If MaxBalanceModule comes first, the receiver is credited before the hop and the subtraction is safe. getModules() returns the current order. Note that removeModule moves the last module into the removed slot, so removing an unrelated module can change the order.
“_IDBalance[msg.sender][_idTo] += _value; _IDBalance[msg.sender][_idFrom] -= _value; if (_IDBalance[msg.sender][_idTo] > _maxBalance[msg.sender]) revert MaxBalanceExceeded(msg.sender, _value);”
MaxBalanceModule.sol, moduleTransferAction, TokenySolutions/T-REX main @ f1390127
We read only MaxBalanceModule for this interaction. Other modules that keep counters in moduleTransferAction will also see the fee hop as a transfer from the receiver to the collector; check each one bound to your token before switching fees on.
How should operations reconcile fees and pre-flight transfers?
Pair each Transfer into the collector with the preceding Transfer in the same transaction, and simulate the full post-transfer path, fee hop and caps included, before sending an instruction. The module emits no event per fee, so the pairing rule is the only record.
| Control | What to check | Evidence |
|---|---|---|
| Event pairing | Per transaction: Transfer(sender, receiver, value) then Transfer(receiver, collector, fee), with fee equal to value times rate over 10000, rounded down | Pair table with tx hash and log index |
| Register | Record the receiver's net position, not the instructed amount | Register extract matched to balanceOf |
| Rate history | Apply the rate in force at each block from FeeUpdated events, not today's getFee | Rate timeline by block |
| Collector health | isVerified(collector), claim expiry dates, and cap headroom if MaxBalanceModule is bound | Daily read-back |
| Module setup | Module is an agent; getModules() order; module owner key on the privileged-key register | Signed configuration snapshot |
| Pre-flight | Simulate the transaction with eth_call against current state, since canTransfer does not run post-transfer hooks | Simulation result stored with the instruction |
The pre-flight point is the one most teams miss. canTransfer runs only moduleCheck, and the fee module's check always returns true. A transfer can pass canTransfer and still revert in the fee hop or in a cap hook. Only a simulation of the full call shows that. Blockmaze's compliance tooling is built around checks that run before an instruction is sent; for fee-bearing tokens, that check has to include the post-transfer path.
Who does this apply to, and what was not checked?
It applies to issuers, transfer agents and settlement operators running a T-REX token with TransferFeesModule bound. Everything here is read from TokenySolutions/T-REX main at commit f1390127; that repository is archived.
The successor repository, ERC-3643/ERC-3643 (main at commit 2f0704de), ships no transfer fee module: its modular modules folder contains only AbstractModule, AbstractModuleUpgradeable, IModule, ModuleProxy and TestModule. Its Token.forcedTransfer and ModularCompliance.transferred match the code above, so a fee module written the same way would inherit the same behaviour. The T-REX module file carries a Creative Commons Attribution-NonCommercial 4.0 licence on top of GPL-3.0, which matters for teams copying it.
We did not run tests, so the MaxBalanceModule interactions, the agent-revocation effect and the collector-verification failure are code reading. We did not check which deployed tokens use this module, and Tokeny's statement that conditional transfers take fees from both sender and recipient was not traced in code. None of this describes an exploit: each point is a configuration or operations property of a permissioned token whose agents and owners control every step.
Sources: TransferFeesModule.sol, MaxBalanceModule.sol, AbstractModuleUpgradeable.sol, ModularCompliance.sol and Token.sol, all TokenySolutions/T-REX main @ f1390127 (repository archived); ERC-3643/ERC-3643 contracts @ 2f0704de; Tokeny documentation, Transfer Fees Module and transfer types.
Frequently Asked Questions
Who pays the transfer fee on an ERC-3643 token?
The receiver. In the T-REX TransferFeesModule the full amount moves from sender to receiver first. Then, inside the compliance post-transfer hook, the module calls forcedTransfer to move the fee from the receiver to the collector wallet. The receiver's balance rises by the amount minus the fee. Tokeny's documentation says the same: the fee is transferred from the receiver to the collector after the transfer.
Why must the TransferFeesModule be a token agent?
Because it collects the fee by calling forcedTransfer, which is onlyAgent on the token. The module's canComplianceBind returns true only when the module address is an agent of the bound token, and isPlugAndPlay returns false, so addModule refuses to bind it otherwise. The agent role in T-REX is not granular: the module address holds the same agent rights as any other agent key.
How is the fee rate expressed, and what is the maximum?
As an integer in units of 0.01%. A rate of 1 is 0.01%, 100 is 1% and 10000 is 100%. setFee reverts with FeeRateIsOutOfRange above 10000. The fee is value times rate divided by 10000, rounded down, so at a rate of 25 any transfer below 400 base units pays nothing. A rate of 0 disables the fee.
Are mints, burns and wallet recoveries charged a fee?
No. The module's moduleMintAction and moduleBurnAction are empty, so issuance and redemption by burn carry no fee. Wallet recovery calls forcedTransfer between two wallets of the same ONCHAINID, and the module skips any transfer whose sender and receiver resolve to the same identity. Holder transfers, transferFrom and agent forcedTransfer between different identities are charged.
How do you reconcile fee events on a T-REX token?
Pair them by transaction. A charged transfer emits two Transfer events in one transaction: sender to receiver for the full amount, then receiver to collector for the fee. The module emits no event per fee, only FeeUpdated when the rate or collector changes. A reconciliation rule should match each Transfer into the collector to the preceding Transfer in the same transaction.
Does the ERC-3643/ERC-3643 repository ship a transfer fee module?
Not at main commit 2f0704de. Its modular compliance modules folder holds only AbstractModule, AbstractModuleUpgradeable, IModule, ModuleProxy and TestModule. The Token.forcedTransfer and ModularCompliance.transferred code there matches the archived TokenySolutions/T-REX code read for this article, so a custom fee module built the same way would behave the same way.
Related Articles
What Does Atomic Settlement Actually Change?
Atomic delivery-versus-payment removes principal risk by making both legs settle or neither, and changes liquidity needs.
Who Can Upgrade an ERC-3643 Token's Code?
Who holds the upgrade path for an ERC-3643 token suite, and what governance that key needs.
What Happens When an ERC-3643 Investor Changes Country?
In T-REX the investor country is a per-wallet code an agent sets with updateCountry, not a KYC claim.
How Should an RWA Issuer Recover a Lost Wallet?
Wallet recovery restores a holding after a lost key; the identity record, balance and services must be reconciled.