Aquantis

Aquantis lets fee-on-transfer tokens like gold-backed XAUH run trading strategies on 1inch’s Aqua.

Aquantis

Created At

ETHGlobal Mumbai

Winner of

1inch

1inch - Build an Aqua App - Continuity Track 2nd place

Project Description

Aquantis makes it possible to use a fee-on-transfer (FoT) token on the Aqua protocol, and here is how we got there.

We started with Aquantis – Telegram Mini App (TMA), our Telegram Mini App with a built-in AI agent, which worked with the Aqua protocol and its strategies. The next step felt natural: add [Herculis Gold Coin (XAUH)] (https://xauh.gold/), a gold-backed real-world-asset token, so users could run Aqua strategies on a gold-backed asset. That’s where we hit a wall. XAUH takes a fee on every transfer, so the amount received is lower than the amount sent, and tokens like this are notoriously difficult to integrate into DeFi. Aqua was no exception. So we set out to solve it. Aquantis now enables XAUH, a fee-on-transfer token, to run trading strategies on Aqua.

And because we built on top of TMA, you also get a bonus: a convenient, all-in-one Telegram experience for managing your XAUH portfolio, where the agent lets you pick an XAUH trading strategy and routes it through whichever Aqua Strategies offer the best terms. On top of that, we’ve integrated [ID Quantique’s] (https://www.idquantique.com/) quantum random number generator (QRNG), bringing true, physically sourced randomness into the product.

The Token Behind Aquantis: XAUH.

Herculis Gold Coin is a Swiss gold-backed payment token issued by [Herculis Tokens SA] (https://herculis.ch/herculis-tokens-sa), where each token represents one gram of 999.9-purity [LBMA] (https://www.lbma.org.uk/) gold that is refined, audited, stored, and insured in Swiss vaults. XAUH is already live across four networks – [Ethereum] (https://ethereum.org/), [TON] (https://ton.org/), [TRON] (https://tron.network/), and [Polkadot] (https://polkadot.com/), with [JAMTON] (https://app.jamton.network/) serving as the bridge connecting TON and Polkadot infrastructure. On Ethereum specifically, it's deployed as a verified ERC-20 token tracked on [Etherscan] (https://etherscan.io/token/0xa9b17f572341219703Bc951725Bdb3CA756B1A65), with an active XAUH/USDT liquidity pool on [Uniswap] (https://app.uniswap.org/explore/tokens/ethereum/0xa9b17f572341219703Bc951725Bdb3CA756B1A65).

Addressing Aqua’s Fee-on-Transfer Limitation.

A key technical limitation of Aqua, 1inch's self-custodial shared-liquidity protocol, is that it does not natively support fee-on-transfer tokens – assets that deduct a percentage on every transfer, so the amount received is less than the amount sent. Because Aqua's core contract and its AquaApps track maker and taker balances based on the amount specified in a swap rather than the amount actually delivered, an unhandled FoT token can desynchronize that internal accounting, breaking pricing logic and putting maker funds at risk; 1inch itself lists "Lack of support for Fee-on-Transfer (FoT) tokens" as out of scope in its bug bounty program, treating it as a known, unaddressed gap rather than a bug to be patched. Solving it matters because Aqua's own stated ambition is to become a venue for real-world-asset trading – letting users swap tokenized gold, equities, and other real-world assets (RWA) directly against each other – and fee-on-transfer mechanics are common in exactly that asset class, so leaving this gap unhandled quietly locks a meaningful share of RWA tokens out of Aqua's strategies. Because XAUH is central to what we’re building, we fixed it at the transfer level: Aquantis adds fee-aware transfer handling on top of Aqua, so XAUH swaps settle accurately.

How it's Made

Fee-on-transfer token support in SwapVM + Aqua

About Aqua.sol

The change: Aqua.push now measures the maker's balanceOf before and after safeTransferFrom and credits the received delta instead of the nominal amount:

uint256 before = IERC20(token).balanceOf(maker);
IERC20(token).safeTransferFrom(msg.sender, maker, amount);
uint256 received = IERC20(token).balanceOf(maker) - before;
balance.store(prevBalance + received, tokensCount);

Why this is the only option. The drift is created in exactly one place: push credits the maker's virtual balance with the nominal amount, but the transfer delivers only amount times (1 minus r) to the maker's wallet (the fee is deducted from the recipient). Because that virtual balance is what SwapVM prices against and what Aqua.pull authorizes against, the mismatch compounds into phantom liquidity - reverse swaps can revert, and the pool prices as if it received more input than it did. There is no router-side fix: the router can only choose the single amount passed to push, and push both credits and transfers that same number, so the credited amount must be the measured receipt.

Fully backwards compatible. For a regular token the delta equals amount, so behavior is unchanged. pull is untouched (the maker sends the nominal amount, so its wallet delta is already amount). No signature change, no new entry point.

About AquaSwapVMRouter.sol

The problem. SwapVM's registers assume transferred equals accounted. For an FOT token that is false: the input leg delivers less than the nominal input (maker overpays), and the output leg delivers less than the quoted output (taker receives less than quoted). The AMM therefore priced the wrong amounts and the quote was dishonest.

FeeOnTransfer instruction makes the VM FOT-aware. Two new opcodes - FeeOnTransferIn (slot 23) and FeeOnTransferOut (slot 24), args [uint32 feeBps, uint8 feeFloor], 1e9 = 100%. FeeOnTransferIn: tokenIn is FOT, price on the net input and keep the gross the taker pays. FeeOnTransferOut: tokenOut is FOT, keep the net the taker receives and gross the pull up in settlement. A feeFloor flag mirrors the token's ceil/floor fee so the computed net matches the token exactly. Because the fee is always deducted from the recipient, the taker absorbs the tax and the registers stay taker-facing - amountIn equals gross, amountOut equals net - so quote() is honest and slippage thresholds are checked in the taker's own units. A single bidirectional strategy branches on direction with the existing jumpIfTokenIn, so one shipped strategy serves both legs.

Two-hop vs one-hop, both covered. One-hop (resolver, useTransferFromAndAquaPush=false) transfers once; two-hop (EOA, =true) transfers taker to router to maker and double-taxes the input. A twoHop flag is derived from the taker's flag; FeeOnTransferIn prices G times (1 minus r) versus G times (1 minus r) squared accordingly, and the two-hop transferIn measures the router's received balance and pushes that net. Result: one strategy, a fair quote, and no maker loss, in both modes.

General-purpose SettlementContext. Context gains SettlementRegisters { amountInDelta, amountOutDelta, twoHop }, expressing settlement amount equals quote amount plus delta. It lives on Context, not SwapRegisters, to keep the IExtruction ABI stable. It is a generic settlement-versus-quote channel, not FOT-specific.

Backwards compatible. New opcodes fill the reserved slots (no renumbering, so existing program bytecode is untouched); regular tokens have zero deltas and the push delta equals amount; the Extruction ABI is preserved; the full unit suite passes. The diff is minimal: one new instruction file plus small edits to VM.sol, AquaOpcodes.sol, and SwapVM.sol.

Not covered currently. Rebasing/reflection tokens are unsupported; push costs two extra balanceOf calls; the Pushed event now emits net; FeeProtocol combined with FOT is untested; the SDK opcode table still needs slots 23/24; and two-hop (EOA) inherently pays two transfer fees.

background image mobile

Join the mailing list

Get the latest news and updates