Add configurable transfer fee on TFT→SPORE conversion #6

Merged
mahmoud merged 1 commit from development_transfer_fees into development 2026-03-01 09:55:18 +00:00
Owner

Description

Adds a transfer fee that the bridge retains on each TFT→SPORE conversion, matching the existing refund fee
pattern. Configurable via TRANSFER_FEE_PLANCK env var (default: 100,000 planck / 0.01 TFT).

Changes

  • Add transfer_fee_planck field to Config struct, loaded from TRANSFER_FEE_PLANCK env var
  • Deduct fee in TftToSporeHandler::handle() before SPORE amount calculation
  • Reject transfers where amount <= fee with InvalidEvent error
  • Log gross amount, fee, and net amount in conversion trace
  • Add tests for fee deduction, equal-to-fee rejection, and below-fee rejection
  • Update all test_config() helpers across the codebase
### Description Adds a transfer fee that the bridge retains on each TFT→SPORE conversion, matching the existing refund fee pattern. Configurable via `TRANSFER_FEE_PLANCK` env var (default: 100,000 planck / 0.01 TFT). ### Changes - Add `transfer_fee_planck` field to `Config` struct, loaded from `TRANSFER_FEE_PLANCK` env var - Deduct fee in `TftToSporeHandler::handle()` before SPORE amount calculation - Reject transfers where amount <= fee with `InvalidEvent` error - Log gross amount, fee, and net amount in conversion trace - Add tests for fee deduction, equal-to-fee rejection, and below-fee rejection - Update all `test_config()` helpers across the codebase ### Related Issues - https://forge.ourworld.tf/lhumina_code/hero_tfspores/issues/5
feat: add configurable transfer fee on TFT→SPORE conversion
All checks were successful
Test / test (push) Successful in 4m12s
Test / test (pull_request) Successful in 4m6s
2675f79c96
- Add transfer_fee_planck config field (env: TRANSFER_FEE_PLANCK, default 0.01 TFT)
- Deduct fee from transfer amount before SPORE calculation
- Reject transfers where amount <= fee
- Log gross, fee, and net amounts in conversion handler
mahmoud merged commit a35b1f7ff8 into development 2026-03-01 09:55:18 +00:00
mahmoud deleted branch development_transfer_fees 2026-03-01 09:55:22 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_tfspores!6
No description provided.