TGAI's $11.9K Loss and How Olympix Would Have Prevented It
At 09:09:44 UTC on April 7, 2026, a single transaction on BNB Smart Chain borrowed 2,417,531 USDT, spent most of it buying TGAI, and then asked one of TGAI's own contracts to pour its savings into the market. The contract obliged. A few log entries later the loan was repaid in full and 11,939.32 USDT sat in the attacker's wallet.
The contract that paid for it was TGing, the staking and swap contract that sits beside the TGAI token. It had a function anyone could call that sent its USDT into the TGAI/USDT PancakeSwap pair and told the pair to recount its reserves. Buy first, call that function, sell after, and the difference is yours.
A Token Built Around Its Own Pool
TGAI is the token of the Computility project, and most of its design is about controlling trades against one PancakeSwap V2 pair. The verified TGAI token contract caps every buy and sell at a tenth of the pool's TGAI reserve, makes each buyer wait a minute before trading again, burns and splits a small fee on buys, and charges a 20% sell fee, taken from the profit when a seller's buy history covers part of the sale. Those rules live in the token's transfer logic and only fire when the pair is on one side of a transfer.
TGing is the companion contract. It holds USDT and TGAI for the project's staking and referral system, and it exposes helper functions for trading through the pair, including swapTGToUSDT, which takes a user's TGAI, sells it through the PancakeSwap router and sends the USDT back to the user.
It also has a public function called sync. The TGing implementation verified on Sourcify shows exactly what it does:
There's no owner check, no role and no limit on when it runs. Any caller can make TGing hand its entire USDT balance to the pair and then force the pair to adopt the new balance as its reserve. A pair holding more USDT against the same TGAI prices TGAI higher, so whoever holds TGAI at that moment can sell it for more than they paid.
Twenty-Five Buyers and One Donation
According to ExVul's alert, the attacker flash-loaned about 2.4 million USDT, deployed 25 CREATE2 helper contracts to buy TGAI, used sync() to push about 17.5K USDT into the pair, and sold through swapTGToUSDT. The transaction's logs fill in the numbers.
The loan came from a Moolah lending contract: 2,417,531.152 USDT to the attack contract. The helpers then bought TGAI one after another, each paying into the pair and forwarding its TGAI to the attack contract. Spreading the buys across fresh addresses kept each one under the token's per-trade cap and sidestepped the one-minute cooldown, which is tracked per recipient.
With the buying done, the attack contract called TGing's sync(). TGing transferred 17,540.12 USDT into the pair and the pair synced, so its reserves now counted USDT that no trader had paid in.
The exit went through TGing as well. The attack contract handed TGing 181,843.45 TGAI and called swapTGToUSDT, and TGing sold the whole amount into the pair. The full 181,843.45 TGAI reached the pair in one transfer, with none of the burn or fee transfers that a direct sell triggers, and the pair paid out 2,309,849.51 USDT. The attack contract repaid Moolah's 2,417,531.152 USDT and sent the remaining 11,939.32 USDT to the attacker's wallet.
Where the Money Came From
The pool's books tell you who paid. Across the transaction the pair ended up 5,600.80 USDT richer and 2,769.19 TGAI poorer, while TGing lost the 17,540.12 USDT it had pushed in. The attacker's 11,939.32 USDT profit is the part of TGing's donation that the inflated sell price carried straight back out of the pool.
That's why the loss is small next to a 2.4 million USDT loan. The attacker couldn't take more than TGing held, and the loan only had to be big enough to own a large share of the pool's TGAI when the donation landed. A larger USDT balance in TGing would have meant a proportionally larger payout from the same transaction.
A Pool Rule Nobody Wrote Down
TGAI's token spends hundreds of lines protecting its pair from fast, outsized trades. Caps, cooldowns and fees all assume that the pair's USDT reserve only changes when someone trades. TGing's sync() broke that assumption from outside the token, where none of those protections run.
The fix is small. A function that moves a contract's funds into a pool and resyncs it needs an access check, or a design where reserve top-ups can't be timed by a trader holding a position. Pushing funds into a pair is an ordinary operation in tokenomics contracts. Leaving the trigger public turns it into a bonus payable to whoever bought just before it fired.
How Olympix Would Have Caught a Public Reserve Top-Up
Olympix reads a contract as states, transitions and entry points, and takes in the context around the code to infer the invariants the system depends on. Here the state that matters is the pair's USDT reserve and TGing's own USDT balance, and sync() is an external entry point that moves one into the other with nothing gating the caller. The engine would have mapped it next to the trading paths that read the same reserves.
The invariant follows from what TGing holds: no outside caller should be able to move TGing's funds into a position that pays them. From all the paths through TGing and the token, Olympix narrows to the feasible ones and then to the ones that touch that rule. A sequence that buys TGAI, calls sync() and sells would have broken it, since the seller ends with USDT that came out of TGing's balance.
Had the team run Olympix on TGing, that sequence would have come back as a counterexample with the minimal conditions that make it profitable: a TGAI position bought before the call, a USDT balance in TGing and a sell after. It would also have come with a generated Forge test that replays it. That test would have been the April 7 drain, produced in development instead of against the live pool, and because the engine runs at every merge and before release, it would have surfaced as soon as sync() shipped without a caller check.
It's a familiar shape on BNB Chain. Mid-trade reserve edits followed by a sync are also what cost PHX's WBNB pools $89.6K in July, when a sell fee burned tokens out of its pair.
Guard Every Path Into the Pair
Token teams on constant-product AMMs tend to harden the token and forget the contracts around it. TGAI's transfer rules were strict. The staking contract next to it could rewrite the pool's reserves on anyone's command. Every function that can move funds into a pair or call sync() on it belongs in the same review as the trading logic, because the pool can't tell a market move from a donation.
To see how Olympix would map those paths in your own contracts and return a runnable counterexample for every break, book a technical walkthrough.
On-Chain References
Exploit tx (BSC, block 91117997): 0x6031...f621
Attacker EOA: 0xf25d...e5e8
Attack contract (flash loan receiver): 0x8f87...2567
TGing contract (victim, proxy): 0xadd1...9c1d
TGing implementation: 0x4e52...8a09
TGAI token: 0xf04b...c2f1
TGAI/USDT PancakeSwap pair: 0x6b9a...3569
Flash loan source (Moolah): 0x8f73...8d5c
More post-mortems
See every post-mortem →See what Olympix finds on your own code
Send us a repo that's already been audited, and we'll run Olympix at the same commit and show you what comes back.




