> 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-vault-contract.md).

# 🏦 HITBNB Vault Contract

https\://bscscan.com/address/0x7de1d440a20b3fd16658ad619201eee91ac07de8

#### Overview

The **HITBNB Vault** is a smart contract that securely manages reward allocations, token distributions, pending withdrawals, and claim functions for users in the HITBNB ecosystem. It serves as a central hub (it's works decentralized no central control for any transaction ) where all automated and user-initiated token claims are executed.

#### 🔐 Key Responsibilities

* Holding HITBNB tokens for monthly ROI, staking, and reward purposes
* Managing **pending claims** set by the backend logic (after calculations)
* Ensuring secure and gas-optimized withdrawals by users
* Facilitating automated top-holder reward releases (Chainlink Functions)

#### 🔁 Fund Flow

1. Tokens enter the vault from the ROI Wallet.
2. &#x20;Dapp Back-end sets pending rewards or ROI for a user.
3. User claims through the Web3 UI → `claimTokens()` function.
4. HITBNB is transferred from Vault to the user’s wallet.

#### 🔧 Core Functions

* `setPendingWithdrawal(address user, uint256 amount)`\
  Sets the user’s pending amount available for claim. Callable only by backend/admin.
* `claimTokens()`\
  Lets user claim their assigned HITBNB rewards. Automatically transfers to connected wallet.
* `getPendingAmount(address user)`\
  View function to check how much HITBNB a user can claim.

#### 🔒 Security Measures

* Only whitelisted HITBNB dApp wallets can set pending balances
* Claimable amounts are stored in mappings and not released until the user initiates a claim
* Vault holds HITBNB in custody until explicitly distributed to ensure automation compatibility

#### ⚙️ Integration Points

* **Chainlink Keepers** connects to Vault for setting claimable amounts monthly
* **HITBNB dApp** shows claimable balances and triggers claim transactions
* **Chainlink Automation** : For top holder monthly reward releases

#### 🧪 Sample Flow

```
USDT → HITBNBBuyer → Buys HITBNB → Sent to ROI Wallet
             ↓
        ROI Wallet → HITBNB Vault (if needed)
             ↓
     Admin sets: setPendingWithdrawal(user, 1000)
             ↓
     User visits dashboard → Clicks "Claim"
             ↓
     HITBNB Vault sends 1000 HITBNB to user
```

#### 📌 Notes

* Vault must always be sufficiently funded buy chainlink automation from ROI Wallet
* Tokens are not claimable unless explicitly marked as pending
* Vault helps decouple calculation logic from distribution, improving scalability and modularity
