Derby Finance Docs
  • Introduction
  • Products
    • Vaults
      • User interactions
        • Deposit
        • Withdraw
        • Relevant view functions
      • Deployed vaults
        • USDC_Low_Risk
      • Cross-chain implementation
      • Rebalancing
      • Gas efficiency
      • Currency swapping
      • Automatic yield harvesting
  • Game
    • User interactions
      • Mint new basket
      • Rebalance basket
      • Redeem rewards
      • Basket allocated tokens
      • Basket allocations in protocol
      • Basket redeemed rewards
      • Basket unredeemed rewards
    • DeFi yield optimization
    • The game
    • Formulas
    • Decentralized reputation
    • NFTs as user profiles
    • Delegation
  • Developers
    • Architecture
      • Single chain
      • Cross-chain
      • Other important flows
    • Contract overview
    • Deployed contract addresses
    • Security
  • DAO
    • Governance
    • The DRB token
    • Adding a new vault
    • Adding new protocols to an existing vault
    • Important parameters
    • Keeper
    • Guardian
  • Roadmap
    • Roadmap
Powered by GitBook
On this page
  1. Developers
  2. Architecture

Single chain

PreviousArchitectureNextCross-chain

Last updated 2 years ago

In the following diagram an overview is given of our single chain architecture. In the picture the two most important contracts are the Game contract and the Vault contract. Users that like to invest funds into our vault interact with the Vault contract. Users/ Derby token holders that like to play our investment game interact with the Game contract.

Funds enter the vault through a deposit. Every rebalancing period the funds are transferred from the Vault contract to the vault contracts of the underlying DeFi protocols. Each of these protocols have a number associated with them in our vault contract. Our controller contract maps these numbers to a provider contract. Each DeFi protocol has a custom provider contract written by us that functions as a translator between our vault and controller to the underlying DeFi protocol. For example, to deposit funds from our vault to a protocol with number i we would call the associated provider deposit function belonging to protocol i through the mapping in the controller. This function then calls the function from the underlying DeFi protocol to deposit funds, the name and parameters in this function can differ from our deposit function.

A player of our investment game can mint a NFT by locking some of their DRB tokens and receives votes accordingly. In this NFT, referred to as basket, the player can allocate his or her votes to the whitelisted DeFi protocols. Once per rebalancing period all votes are summed up and pushed to the vaults, so that they know how to rebalance their funds.