Skip to main content
Every deposit, trade, and withdrawal you make through Quantum Finance is handled by the TradingVault smart contract deployed on BNB Smart Chain. The contract is written in Solidity, audited against OpenZeppelin’s security primitives, and enforces all fund custody rules on-chain — no centralized server can move your funds. This page describes what each function does, what events the contract emits, and where to find the deployed contract.

Deployed contract

The TradingVault is deployed at the following address on BNB Smart Chain Testnet:
You can inspect every transaction, balance, and event on the block explorer: View on BscScan Testnet
The Quantum Finance interface calls all contract functions automatically on your behalf. You do not need to interact with the contract directly — this reference is provided for transparency and for developers who want to verify behavior.

Contract overview

The TradingVault is built on top of OpenZeppelin’s Ownable and ReentrancyGuard contracts, which protect against ownership exploits and reentrancy attacks. Key properties enforced by the contract:
  • Minimum deposit: 0.01 BNB
  • Maximum trade size: 10 BNB (or 5,000 tokens for token-denominated trades)
  • Max slippage: 5% per swap on PancakeSwap
  • Cooldown: 30 seconds between trades per user
  • Fee: 50% of trade output goes to the protocol treasury; 50% is credited to your profit balance

Functions

Called when you enter an amount and confirm a deposit in the Trading tab. The function is payable, meaning it accepts BNB directly. Your deposited amount is recorded against your wallet address in the contract’s internal ledger.
Requirements:
  • Amount must be greater than zero
  • Amount must be at least 0.01 BNB (MIN_DEPOSIT)
Emits: Deposited(address indexed user, uint256 amount)
Called when you enter an amount in the Withdraw field and confirm. The contract checks that your recorded balance covers the requested amount before transferring BNB back to your wallet.
Requirements:
  • amount must be greater than zero
  • Your vault balance must cover amount
  • The contract must hold sufficient BNB
Emits: Withdrawn(address indexed user, uint256 amount)
Called automatically by the engine when it enters a trade. The engine swaps BNB from your vault balance into the quote token (USDT or USDC) via PancakeSwap. Your vault balance is debited, and the resulting tokens are held in the contract. After fees, your profit balance is credited.
Subject to: 30-second cooldown, MAX_TRADE_SIZE limit, slippage checkEmits: TradeExecuted(...), ProfitDistributed(...)
Called automatically by the engine when it exits a trade. The engine swaps tokens from your profit balance back into BNB via PancakeSwap. After fees, your BNB vault balance is increased.
Subject to: 30-second cooldown, MAX_TRADE_SIZE_TOKENS limit, slippage checkEmits: TradeExecuted(...), ProfitDistributed(...)
Called when you withdraw accumulated USDT or USDC profits. The function transfers the requested token amount from the contract to your wallet.
Requirements:
  • token must be USDT or USDC
  • Your profit balance must cover amount
  • The contract must hold sufficient token balance
Returns a snapshot of your vault state. The Quantum Finance interface calls this function to display your live balance and profit figures in the dashboard.
This is a read-only (view) call — it costs no gas and does not modify any state.

Events

The contract emits the following events. You can query them directly on BscScan or via any EVM-compatible indexer.

DEX integration

The TradingVault routes all swaps through PancakeSwap. The router addresses used are:
PancakeSwap Testnet has limited liquidity. Real on-chain swaps may fail if a liquidity pool does not exist for the selected pair. Use Demo mode to test trading logic without requiring on-chain liquidity.