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. Game
  2. User interactions

Rebalance basket

Once a user has minted a basket NFT it can then start to lock DRB tokens to it and start giving allocations to protocols. It does so by calling the following function in our game contract:

function rebalanceBasket(
  uint256 _basketId, 
  int256[][] memory _deltaAllocations
) external onlyBasketOwner(_basketId) nonReentrant

Where _basketId is the id refering to the NFT the user has minted, _deltaAllocations are the deltas in allocations where the first index refers to the chainId and the second index refers to the protocolId. The allocations are set by locking DRB tokens, where the decimals are in 10^18. Hence, 1 DRB token lets the user set 1 allocation by inputting 10^18.

PreviousMint new basketNextRedeem rewards

Last updated 2 years ago