Unwrap costs 3.47% not the documented 2%: burn tax is deducted from the payout on top of the fee #512
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic#512
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Unwrapping LUNC-C to native LUNC effectively costs 3.47%, not the documented 2% unwrap fee: the chain's burn tax (currently 1.5%) is deducted from the treasury's payout transfer, so the recipient receives
withdraw_amount − tax— the tax stacks on top of the fee and is silently paid by the user.Reported by community member Spaceship Racer in the Telegram group (they couldn't reach GitLab); verified independently on-chain before filing.
Evidence (mainnet tx)
Tx
C282C337B3F3E4AC7ECC95B92E82DCD1484C2E6FA766A07DBFAFAC49F6B280A0(block 29871998, 2026-08-09 13:36 UTC):unwrap(wrap-mapperterra1xuuuhpmyd5t29ry7mydg7ra2q2phrwhx7j28nx7x9sjw6zznkumsz0nmd2)terra1437qslye72t7qmmahn4t5chz50r8a62g45phwkquwpyu2l62u6ksqssgdg(LUNC-C)Transfer events show the treasury (
terra16j5u6ey…sem3lr2) paying the recipient 9,653 LUNC while 147 LUNC (= exactly 1.5% of 9,800) goes to the tax module and is split onward (14.7 + 14.7 + 117.6). So:10,000 → −2% fee → −1.5% burn tax → 9,653, i.e. 3.47% total.Why
The burn tax on the treasury's native
InstantWithdrawbank send is deducted from the transferred amount (receiver pays), and the unwrap flow computeswithdraw_amountbefore tax. NATIVE_TOKEN_WRAPPING.md's "1 tax event for unwrapping output" design anticipated the tax event itself, but the incidence falls on the user on top of the 2% fee, which neither the fee math nor the UI accounts for.Suggested fixes (either)
withdraw_amount / (1 − tax_rate)(query/terra/treasury/v1beta1/tax_rateor compute from params) so the recipient nets exactlygross − fee. Tax is then effectively paid out of the 2% fee margin.(A governance burn-tax whitelist for the treasury was considered and discarded — per community feedback, LUNC governance would not whitelist CL8Y DEX contracts under the current validator set, so it is not a realistic path.)
Addendum: exchange-deposit recipient trap (same flow, second hazard)
Because
Unwrap { recipient }accepts any address, users may set an exchange deposit address as the recipient to "save a hop" (and one transfer's burn tax). This silently loses the funds: the payout arrives as a contract-triggered transfer from the treasury, which at least MEXC's deposit crediting ignores even with the correct memo — the LUNC lands at the exchange's address but is never credited. Confirmed the hard way by community member Spaceship Racer (reported in Telegram 2026-08-09 16:39).Suggested mitigation: the unwrap UI should warn "withdraw to your own wallet, then transfer to an exchange normally — exchange deposit systems do not credit contract-initiated transfers."
Happy to retest once a fix lands — we run automated tooling against the DEX and can verify quickly.
changed the description
changed the description
mentioned in issue #513
Approved for investigation
Further note: "the displayed amount for wraping is incorrect, the recieve amount is right tho, it displays 9751 but user correctly recieve 9800"
Fix approved
mentioned in commit
df885e0f62mentioned in merge request !1049
Implemented in !1049 (branch
fix/issue-512-unwrap-burn-tax).Done in this MR (dApp):
/wrap(W11)make verify-issue-512Not in this MR:
Verification:
make verify-issue-512passed twice locally.mentioned in commit
3d950c52d5Merge sanity check (!1049 → main)
Merged via
glab mr merge 331(no automerge; CI wasci_quota_exceeded, not waited on). Localmake verify-issue-512passed (11/11) on the MR branch before merge.Acceptance vs #512
/wrap+ Swap wrap/unwrap)minimum_receivepost-fee pre-tax (R3)Remaining gaps / follow-ups (not merge blockers)
unwrap_outputroutes — When Swap usesnativeRouteInfo.needsUnwrapOutput(CW20 → LUNC via pool + unwrap), You Receive /routerMinReceiveBaseare correct, but the W10 fee-line disclosure and W11 exchange-deposit warning only render for direct unwrap (wrapUnwrapType === 'unwrap'). Either extend disclosure toneedsUnwrapOutputor explicitly scope W10/W11 to direct unwrap in docs.SwapPagecomponent coverage for the exchange warning / burn-tax fee note; no WrapPage UI assertion for unwrap ~9.653 on 10k input (unit math is covered inrouter.test.ts/nativeTransferTax.test.ts).Manual mainnet retest from the MR test plan is still useful once the dApp ships this build.
mentioned in issue PlasticDigits2/ustr-cmm#9
mentioned in issue #516
Confirming this also affects cUSTC → USTC unwraps at the same 3.47% — reported independently by CryptoGeezer in Telegram today. Same mechanism (USTC/uusd is burn-taxed identically to LUNC/uluna), so one fix covers both wrapped tokens.
mentioned in issue PlasticDigits2/ustr-cmm#13
mentioned in issue #521
On-chain 3.47% stack is retuned (no gross-up)
ustr-cmm#9/#13 shipped asymmetric fees on columbus-5: wrap-mapper
fee_wrap_bps=200/fee_unwrap_bps=51(code11574). Product fix is fee split, not InstantWithdraw gross-up. W8–W11 disclosure from this issue stays.Empirical unwrap 10 000 → ≈9 800 (not 9 653) still needs the #13 live probes + Coolify rebuild of #516. Router
unwrap_outputfollow-up: #523.This issue stays closed.
mentioned in issue #531
mentioned in issue #533
Thanks for the fast fix on the unwrap quote (!1049) and for the follow-through on the wrap-mapper fee retune — much cleaner outcome than a gross-up.
mentioned in issue #587
mentioned in issue #599
mentioned in issue #613
mentioned in issue #661