Bank Depository
Core Banq functions as a shared hybrid non-custodial contract wallet.
Last updated
Core Banq functions as a shared hybrid non-custodial contract wallet.
Last updated
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:
usddId
: This variable stores the ID of the USDD stablecoin.
gStableTotalValueMap
: This mapping keeps track of the total value of gStable tokens for each gStable ID.
gStableBalanceMap
: This mapping keeps track of the balance of gStable tokens for each gStable ID and user address.
gStableAccumulatedFeeMap
: This mapping tracks the accumulated fees for each gStable ID.
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.
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.
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.
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.
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.
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.
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.
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