Astra DAO
  • 👋Introduction
  • Astra DAO
    • Indices
      • iTokens
      • Tokenomics
      • Staking
      • Fees
    • Launchpad Overview
      • Whitelisting (KYC)
      • Vesting
      • Cross-Chain Staking
    • Roadmap
  • Governance
    • Astra DAO
    • Proposals and Voting
  • Tutorials
    • Indices
      • Creating an Index
      • Entering an Astra DAO Index
      • Staking iTokens
      • Leaving an Astra DAO Index
      • Staking ASTRADAO
        • Claiming Rewards - iTokens Staking and Liquidity Mining
        • Shut-Down an Index
    • Launchpad
      • How to Create a Token Sale
      • How to Invest in a Token Sale
      • How to Complete PureFi KYC
  • Oracle
    • Chainlink
  • Developers
    • Contracts
      • Mainnet
        • Arbitrum
      • Testnet
        • Polygon Mumbai
        • BSC Testnet
    • Transaction details
      • Chef
      • Indices
      • LM Pool
      • Governance
    • Smart Contract Functionality
      • Vesting
      • Payment
      • Indices
      • Governance
      • Chef
      • LM Pool
      • AstraDAO Whitelist
      • LaunchpadConfiguration
      • Launchpad
      • LaunchpadFactory
      • LaunchpadVesting
      • CrossChainSaleManager
  • Security
    • Time Lock
    • Ownership
    • Pausing
    • Security Audits
    • Bug Bounty Program
Powered by GitBook
On this page

Was this helpful?

  1. Developers
  2. Smart Contract Functionality

Indices

This is the main contract for the indices pool. Here users can create custom pools, deposit, rebalance, and withdraw from the pool.

Methods

addPublicPool (address[],uint[],uint,uint,string,string)

This method is used to add the public index/pool in the contract. For the public user need to manually provide the details like which token index will buy and other configuration detail.

  • Parameters

  • address[] _tokens: List of tokens that will be used in the index.

  • uint[] _weights: This is used to calculate the percentage of the tokens by dividing them by total weight.

  • uint _threshold: Threshold after which the index will start buying tokens.

  • uint _rebalanceTime: Rebalance time after which index details will be updated

  • string _name: Name of the new iToken that will be created.

  • string _symbol: Symbol of iToken.

addNewList ()

This method is used to add the Astra DAO index into the contract. This can only be called by Admin and all details will come from the Provable contract.

poolIn(address[],uint[],uint)

Deposit into the pool either by using stablecoin or ether. If you want to use ether then send the first two parameters as blank arrays. If the user chooses Ether deposit it will first be converted into DAI.

  • Parameters

  • address[] _tokens: List of stable coins that will be used for deposit in the index.

  • uint[] _value: Amount of token user is willing to spend

  • uint _poolIndex: Index of indices in which user want to deposit

updatePool(address[],uint[],uint,uint)

This method is used to update the public index/pool in the contract. For the public user need to manually provide the details like which token index will buy and other configuration detail. For the TM managed pool you need to send blank value. It will automatically fetch from the pool

  • Parameters

  • address[] _tokens: Updated list of tokens that will be used in the index.

  • uint[] _weights: This is used to calculate the percentage of the tokens by dividing them by total weight.

  • uint _threshold: Threshold after which the index will start buying tokens.

  • uint _rebalanceTime: Rebalance time after which index details will be updated

withdraw(uint, bool, bool, uint)

Withdraw from the index by returning your iToken. iToken will be burned at the time of withdrawal. The User has the option to stake early exit fees and to stake the complete amount for additional payout.

  • Parameters

  • uint _poolIndex: Index of indices from which user want to withdraw

  • bool stakeEarlyFees: Users has the option to stake the early fees to get rewards instead of paying fees.

  • bool stakePremium: Users has the option to stake the withdrawn amount to get additional 2 percent rewards.

  • uint withdrawAmount: Amount of iToken user wants to withdraw

PreviousPaymentNextGovernance

Last updated 1 year ago

Was this helpful?