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

# 📂 HITBNB Smart Contract

https\://bscscan.com/token/0x658310C8219B1a92773523e52CA84B55fB333F43

#### Overview

The **HITBNB Token Contract** is a UUPS (Universal Upgradeable Proxy Standard) upgradeable BEP-20 token that integrates staking logic, automated reward distribution, buy restrictions, and controlled token emissions over 20 years upgrade function is only for new functions.

#### 🔧 Key Features

* Inherits `ERC20`, `Ownable`, `UUPSUpgradeable`, `Pausable`, and `Initializable`
* Uses **Chainlink Keepers** or external cron to trigger monthly reward logic
* Handles DEX buy restrictions (only whitelisted addresses can trigger buys)
* Emits monthly tokens from a locked balance (1000 tokens per month for 20 years)
* Automatically sends unlocked tokens to:
  * ROI Wallet (500 tokens)
  * Top Holders (100 tokens)
  * Development Wallet (50 tokens)
  * Marketing Wallet (350 tokens)

#### 🔐 Key Roles

| Role                           | Description                                                                 |
| ------------------------------ | --------------------------------------------------------------------------- |
| Owner                          | Can set wallet addresses, pause/unpause, whitelist DEXs                     |
| Automation (Keeper or Backend) | Calls `performUpkeep()` to trigger `distributeShareholderRewards()` monthly |

#### ⚙️ Core Functions

* `initialize()`
  * Standard proxy initializer. Sets token name, symbol, total supply, wallet addresses, etc.
* `setWallets()`
  * Admin-only function to configure ROI, development, and marketing wallets
* `setWhitelist(address, bool)`
  * Enables or disables DEX/contract address for buy eligibility
* `_beforeTokenTransfer()`
  * Blocks buys unless sender is whitelisted (anti-bot/DEX restriction)
* `distributeShareholderRewards()`
  * Monthly token unlock + reward distribution logic
  * Internally calls `_releaseLockedTokens()`
* `_releaseLockedTokens()`
  * Releases 1000 tokens if 30+ days have passed since last release
  * Transfers tokens according to the fixed reward split
* `pause()` / `unpause()`
  * Emergency control over token transfers

#### 🧮 Storage Structure

```
uint256 public totalLocked;          // Initially 100,000 HITBNB
uint256 public tokensReleased;       // Tracks monthly release count
uint256 public lastReleaseTime;      // Last time tokens were unlocked
mapping(address => bool) public whitelist; // DEX whitelisting
```

#### 🔄 Upgradeability

This contract uses the **UUPSUpgradeable** pattern. Only the contract owner can upgrade logic using: (this upgrade function is only for deploying new function it's not change the old deployed functions.)

```
function _authorizeUpgrade(address newImplementation) internal override onlyOwner {}
```

All future upgrades must maintain storage layout compatibility.&#x20;

#### 🔍 Integration Notes

* **Chainlink Keepers** is required to call `distributeShareholderRewards()` every 30 days.
* No manual minting allowed — token emission is strictly controlled via vesting.
* Tokens bought via `HITBNBBuyer` contract are transferred to ROI wallet, not users directly.
* Buy restriction ensures tokens can’t be bought directly by bots/snipers unless explicitly allowed.

#### 🔒 Security Recommendations

* Keep DEX routers whitelisted using `setWhitelist()`
* Use `pause()` function in case of emergency or exploit
