# PIGGY BANK

### DESCRIPTION

The bank contract serves as a basic banking system for tokens. It includes functions to add tokens to the bank, deposit tokens into the bank, withdraw tokens from the bank, and retrieve token balances. The contract maintains mappings for tokens and their balances. The owner, specified during contract deployment, has additional privileges such as adding tokens and withdrawing tokens from the bank. Users can deposit tokens by transferring them from their accounts to the bank. The contract ensures that users have sufficient token balances before executing transfers.

### FUNCTIONS

1. **addToken:** Allows the owner to add a token to the bank by specifying its token address. Only the owner can add tokens to the bank.
2. **deposit:** Allows users to deposit a specified amount of a token into the bank. It requires the user to have sufficient balance and transfers the tokens from the user's account to the bank.
3. **withdraw:** Allows the owner to withdraw a specified amount of a token from the bank. It requires the owner to have a sufficient balance and transfer the tokens from the bank to the owner's account.
4. **getBalance:** Retrieves the balance of a particular token that the bank is holding.
5. **owner()**

### EXTRA PARAMETERS

**Contract Level:** Easy

**Utility Tags:** Token Management, Deposit, Withdraw, Balance Tracking

### USES

1. **Token Storage:** The bank contract can be used as a secure storage mechanism for various tokens, allowing users to deposit and withdraw tokens as needed.
2. **Token Wallet:** The contract can serve as a wallet for managing token balances and enabling secure transactions.
3. **Decentralized Finance (DeFi):** The contract can be utilized in DeFi applications as a component for token deposit, withdrawal, and balance tracking.
4. **Token Exchange:** The contract can be integrated into a decentralized exchange platform to manage token deposits and withdrawals during trading activities.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sinqlarity.gitbook.io/sinqlarity-docs/contract-details/piggy-bank.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
