Sorrel Banq
Launch App
  • Introduction
  • Sorrel Deck
  • Getting Started
  • Smart Contracts
    • Bank Depository
    • Transfer Comptroller
    • Convert Comptroller
    • Batch Transfer Comptroller
    • Vault Depository
  • addons
    • Administrative Services
    • Wallet NFC Cards
    • AIA Concierge
    • AIA Team
    • Branch Lounges
    • Sorrel Pay
    • Family Office
Powered by GitBook
On this page
  1. Smart Contracts

Bank Depository

Core Banq functions as a shared hybrid non-custodial contract wallet.

PreviousSmart ContractsNextTransfer Comptroller

Last updated 1 year ago

Mainnet

Nile

Github

The BankDepository contract is a smart contract that facilitates the deposit, withdrawal, transfer, and exchange of gStable tokens. Here's an explanation of the contract's main functionalities:

  1. usddId: This variable stores the ID of the USDD stablecoin.

  2. gStableTotalValueMap: This mapping keeps track of the total value of gStable tokens for each gStable ID.

  3. gStableBalanceMap: This mapping keeps track of the balance of gStable tokens for each gStable ID and user address.

  4. gStableAccumulatedFeeMap: This mapping tracks the accumulated fees for each gStable ID.

  5. deposit: This function allows users to deposit gStable tokens into the contract. It transfers the tokens from the user to the contract, deducts the fees, and updates the balances and total values accordingly.

  6. withdraw: This function enables users to withdraw their gStable tokens from the contract. It deducts the requested amount from the user's balance, updates the total value, and transfers the tokens back to the user, after deducting the withdrawal fees.

  7. send: This function allows users to send gStable tokens to another address. It deducts the tokens from the sender's balance, adds them to the recipient's balance (after deducting fees), and updates the accumulated fees.

  8. exchange: This function allows users to exchange gStable tokens for another gStable token. It deducts the tokens from the sender's balance, calculates the equivalent amount of tokens for the target gStable token, updates the balances and accumulated fees, and mints/burns the necessary tokens based on the exchange rate.

  9. exchangeGL: This function allows the admin to perform an exchange of gStable tokens on behalf of a user. It follows a similar logic to the exchange function but is only accessible to the admin.

  10. moveGL: This function allows the admin to transfer gStable tokens from one user to another. It deducts the tokens from the sender's balance, adds them to the recipient's balance (after deducting fees), and updates the accumulated fees.

  11. claim: This function allows the admin to claim rewards on behalf of users. It interacts with another contract (rewards) to claim the rewards and transfers the claimed USDD tokens to the admin.

  12. Various modifiers and events are used to control access, validate inputs, and emit relevant events for deposit, withdrawal, transfer, exchange, and claim operations.

The contract also includes some setter functions (setRewards, setUsddId, setGStableLookup, and setFeeBasisPoint) to set various parameters and addresses, as well as functions to pause and unpause the contract. Additionally, the contract inherits from several other contracts (AdminAuth, Pausable, and ReentrancyGuard) to provide additional functionality related to administration, pausing, and preventing reentrancy attacks.

Explanation Generated by Sorrel's AIA Team - Powered by ChatGPT

https://tronscan.org/#/contract/TMrak7rc3XnJykLwGfi1JkHooLfjbwibFc
https://nile.tronscan.org/#/contract/TUR4za3qj9bZed33hJc9oBQrwTEz8JMq36
https://github.com/Paracosm-Labs/sorrel-contracts/blob/main/BankDepository.sol