Payment

This contract is used for depositing ASTRADAO tokens when creating a new index. The deposited amount will go directly to the treasury address.

Methods

initialize(address,address,address,address)

This function is used to initialize the necessary things for the payment contract. At the time of setup, users need to send the Astra DAO contract, configuration contract, swap contract, and treasury address.

  • Parameter

  • address _ASTRTokenAddress: Astra DAO token address.

  • address _poolConf: Configuration contract address.

  • address _exchangeContract: Exchange contract address for token swapping.

  • address _treasury: Treasury address.

calculateMinimumReturn(uint256)

Function to calculate the minimum return for implementing slippage.

  • Parameter

  • uint256 _amount: Input amount to calculate output amount after implementing slippage.

swapAndTransfer(address,uint256)

Internal function called by deposit function. Buy ASTRADAO and send it to the treasury address if the user deposits in any other supported coin.

  • Parameter

  • address _token: Token address to swap with ASTRADAO.

  • uint256 _value: Amount of input token from swap.

setAstraAmount(uint256)

Set the minimum number of Astra DAO tokens required to deposit. Only the owner can call this function.

  • Parameter

  • uint256 _amount: Minimum ASTRADAO amount for the deposit.

setTreasury(address)

Set the treasury address. The owner can only call this function.

  • Parameter

  • address _treasury: New treasury address.

deposit(address,uint256)

Function users need to call to make a deposit. Here users need to send the deposit token’s address and amount. If the token is not supported, the transaction will be reverted; else, it will convert it to ASTRADAO and send it to the treasury. Users can use ASTRADAO directly.

  • Parameter

  • address _tokenAddress: Token address to make a deposit.

  • uint256 _amount: Amount of token to deposit.

Last updated