> For the complete documentation index, see [llms.txt](https://smart-global.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://smart-global.gitbook.io/docs/smart-contracts/smart-global-bank.md).

# 🏦 Smart Global Bank

## SmartGlobalBank Overview

### 1. Overview

The `SmartGlobalBank` smart contract serves as the treasury, liquidity management engine, and token economy component of the Smart Global ecosystem. Deployed on the BNB Smart Chain, this contract manages, allocates, and routes the 9% tax share derived from incoming transactions at the educational package sales gateway (`SmartGlobalPay`).

The operational objectives of this treasury are to support network financial stability, execute native ecosystem token (`SGT`) buybacks from the PancakeSwap decentralized exchange, and allocate financial and rank rewards to qualified members and promoters. Operations are executed on-chain via Solidity code under the supervisory parameters of the Decentralized Autonomous Organization (DAO).

### 2. Financial Architecture & Liquidity Flow Management

Incoming liquidity to the treasury (9 USDT per educational package transaction) is managed by an automated allocation function named `distributeBank`. When the USDT balance in the treasury meets either the temporal threshold (1 hour and at least 36 USDT) or the volume threshold (80 USDT), the system divides the liquidity across 4 functional channels:

* Periodic Gift Pool (30%): Allocated to distribute 3 USDT gifts to eligible new buyers who have not yet generated binary points or expanded their downline network.
* Network Activator Reward (3%): Distributed as a direct incentive to the wallet address of the caller invoking the `distributeBank` function (capped at a cumulative total of 30 USDT per user address).
* Development & Maintenance Fee (2%): Transferred directly to the infrastructure and maintenance fund address (`_feeWallet`).
* Automated Buyback Engine (Remaining Balance \~ 65%): The remaining USDT balance in the treasury is swapped on PancakeSwap for the native `SGT` token. The acquired tokens are retained within the treasury vault to fund the rank reward distribution pool.

### 3. Security Architecture & Protection Mechanisms

The source code of `SmartGlobalBank` incorporates specific security standards to manage treasury assets:

* ReentrancyGuard: Implemented to prevent reentrancy attacks across liquidity distribution, token buyback, and reward distribution functions.
* EOA Restriction: Critical functions, such as rank reward claiming (`claimRankReward`), are restricted by the condition `tx.origin == msg.sender` to prevent unauthorized automated bot interactions.
* Immutable Parameters: Key addresses—including the PancakeSwap exchange router, Liquidity Pool (LP), native token contract, and fee treasury—are defined as immutable parameters in the contract code to prevent post-deployment alteration.
* V1 Migration Bridge: The contract includes a query interface linked to the legacy V1 bank (`_oldBank`). The system cross-references the legacy database prior to disbursing rewards to prevent duplicate reward payouts during the migration phase.

### 4. Governance Levels & Separation of Powers

Treasury management functions are organized into three distinct operational tiers:

* 1\. Independent Users & Promoters: Registered owners have access to core treasury functions: claiming complimentary entrance tokens ($4 USD equivalent in `SGT` tokens), purchasing tokens directly from the bank contract at the official exchange rate, enrolling in the periodic gift queue, and claiming honorary rank rewards (ranging from 5% to 20% of the USD value of their accumulated points in `SGT` tokens).
* 2\. DAO Governance: Structural modifications to the bank infrastructure (such as liquidity migration or updating the payment gateway contract address) require a two-stage voting process:
  * Stage One (300-Point Club): The proposal must receive majority approval from members of the 300-point club.
  * Stage Two (100-Point Club): Upon passing Stage One, members of the 100-point club must grant final verification by a simple majority (>50%) before changes are executed on-chain.
* 3\. Founder & Technical Administrator: The founder account authority within the treasury is restricted to the initial configuration of the payment gateway address (`setGlobalPay`, which locks after 1 successful execution), recording the liquidity lock link (`setLPLockLink`), and initiating governance proposals. The founder account holds no functions to execute direct withdrawals of USDT or tokens retained in the bank vault.

### 5. Technical Documentation Guide

To details the Solidity logic and conditions governing the treasury, documentation for `SmartGlobalBank` is structured into three categories under this section:

* Operational & Reward Functions: Technical analysis of 5 user financial functions: periodic gifts, treasury distribution, complimentary entrance tokens, direct purchases, and rank rewards.
* Admin Functions: Reference for configuration functions: initial setup and liquidity lock link recording.
* Governance Functions: Logic, conditions, and mathematical parameters governing proposal creation and two-stage voting across the 300 and 100-point clubs.
