🫐
Blueberry Product Docs
  • 🫐Welcome to Blueberry Protocol
  • Blueberry Overview
    • 👋What is Blueberry?
    • 🔍Concept Overview
    • 🔬Front End
  • 💸Earn
    • ⚖️Leveraged Strategies
    • 🌊Liquidation Process on Blueberry
      • The Concept of Liquidation
      • Liquidations on Blueberry
      • Role of Bots in the Liquidation Process
      • Mitigating Liquidation Risk
    • 📈Earn Token Listing
    • 📉Earn Token Delisting
    • 📏Strategy Listing and Delisting
    • 💲Fee Structure
    • ⁉️Earn Error Codes
  • 💰Lending Protocol
    • 🔎Overview
      • 🔨Governance
        • 💱Flash Loans
        • 🛑Delist
    • 🪙bToken Introduction
      • bToken Address
    • 📈Interest Rate Model
    • 💲Price Oracle
    • ⁉️Error Code
      • ⁉️Key Events
      • ⁉️bToken Error Code
      • ⁉️Comptroller Error Code
    • 💾Change Log
  • 🪙Tokenomics
    • 🔵BLB Governance Token
    • 💰ibTokens
    • 🍩$bdBLB
    • ⚓Lockdrop
    • 📀Token Distribution
  • 🖥️developer-guides
    • 📜Contracts
      • Blueberry Bank
        • Introduction
        • Blueberry Bank Contract
          • Variables
          • Modifiers
        • Fee Manager
        • ProtocolConfig
      • Oracle
        • Introduction
        • AggregatorOracle
        • CoreOracle
      • Spell
        • Introduction
        • AuraSpell
        • BasicSpell
        • ConvexSpell
        • IchiSpell
        • LongShortSpell
      • Vault
        • Introduction
        • HardVault
        • SoftVault
      • Utils
        • BlueBerryConst
        • BlueBerryErrors
        • EnsureApprove
        • ERC1155NaiveReceiver
      • Wrapper
        • Introduction
        • WAuraPools
        • WConvexPools
        • WCurveGauge
        • WERC20
        • WIchiFarm
      • Interact with Blueberry V1
    • 📔Deployed Contracts
  • 🛡️Security
    • 🛡️Audits
    • 🛡️Bug Bounty
  • Legal
    • 📃Terms of Service
    • 📃Privacy Policy
    • 📄Risks
  • Miscellaneous
    • 💙Early Adopter Wallet List
Powered by GitBook
On this page
  • State Variables
  • Events
  • Functions
  1. developer-guides
  2. Contracts
  3. Vault

HardVault

The Hard Vault contract is designed to hold LP (Liquidity Provider) tokens as collateral. The contract is ERC1155 compliant, which means that the underlying LP tokens are identified by casted tokenId from token address.

State Variables

The Hard Vault contract has the following state variables:

  • config: The address of the protocol configuration contract.

Events

The Hard Vault contract emits the following events:

  • Deposited: Emitted when a user deposits LP tokens into the vault.

  • Withdrawn: Emitted when a user withdraws LP tokens from the vault.

Functions

initialize

initialize(IProtocolConfig _config) external initializer

The initialize function is an initializer function that is called when the contract is deployed. It initializes the state variables of the contract.

Parameters:

  • _config(IProtocolConfig): The address of the protocol configuration contract.

_encodeTokenId

_encodeTokenId(address uToken) internal pure returns (uint)

The _encodeTokenId function takes an underlying token address and encodes it into a token ID.

Parameters:

  • uToken(address): The address of the underlying token.

_decodeTokenId

_decodeTokenId(uint tokenId) internal pure returns (address)

The _decodeTokenId function takes a token ID and decodes it into an underlying token address.

Parameters:

  • tokenId(uint): The token ID to decode.

balanceOfERC20

balanceOfERC20(address token, address user) external view override returns (uint256)

The balanceOfERC20 function returns the balance of an underlying ERC20 token for a given user.

Parameters:

  • token: The address of the ERC20 token.

  • user: The address of the user.

getUnderlyingToken

getUnderlyingToken(uint256 tokenId) external pure override returns (address token)

The getUnderlyingToken function returns the underlying ERC20 token address for a given ERC1155 token ID.

Parameters:

  • tokenId: The ERC1155 token ID.

deposit

deposit(address token, uint256 amount) external override nonReentrant returns (uint256 shareAmount)

The deposit function allows a user to deposit underlying assets into the vault and issue share tokens.

Parameters:

  • token: The address of the underlying token to deposit.

  • amount: The amount of underlying tokens to deposit.

withdraw

withdraw(address token, uint256 shareAmount) external override nonReentrant returns (uint256 withdrawAmount)

The withdraw function allows a user to withdraw underlying assets from the vault.

Parameters:

  • token: The address of the underlying token to withdraw.

  • shareAmount: The amount of share tokens to redeem.

PreviousIntroductionNextSoftVault

Last updated 2 years ago

🖥️
📜