Staking

This documentation provides an overview of the key functions within the Staking contract, detailing their purposes, access controls, and parameters. It is intended to assist developers and users in understanding and interacting with the contract effectively.

Constructor

  • Initializes the contract with the GPRO token address, the price feed contract address, and the blacklist period. The deployer is set as the initial admin.

Setter Functions

registerPool

  • Purpose: Registers a new staking pool.

  • Access: Only callable by an admin.

  • Parameters:

    • _poolName: The name of the pool.

    • _duration: The duration of the pool.

    • _discount: The discount rate for the pool.

    • _amount: The amount required for staking.

    • _lockDuration: The lock duration for pool withdrawing.

    • _poolMax: The maximum number of deposits allowed.

depositPool

  • Purpose: Allows a user to deposit tokens into a pool.

  • Parameters:

    • _poolID: The pool ID.

  • Requirements: The user must have completed KYC, not be blacklisted, and have sufficient token balance.

withdrawalPool

  • Purpose: Allows a user to withdraw their deposit from a pool.

  • Parameters:

    • _poolID: The pool ID.

  • Requirements: The user must not be blacklisted, and the lock duration must have passed.

updatePoolData

  • Purpose: Updates the maximum deposits and status of a pool.

  • Access: Only callable by an admin.

  • Parameters:

    • _poolID: The ID of the pool to update.

    • _poolMax: The new maximum number of deposits.

    • status: The new status of the pool (active or inactive).

updateAddressPool

  • Purpose: Updates the pool details for an address after minting.

  • Access: Only callable by the GEMNFTs smart contract.

  • Parameters:

    • _address: The address of the depositor.

    • _poolID: The ID of the pool to update.

    • _index: The index of the deposit.

addAdmin

  • Purpose: Adds or removes an admin.

  • Access: Only callable by the owner.

  • Parameters:

    • _address: The address to update.

    • _status: The new admin status (true or false).

addAuthority

  • Purpose: Adds or removes an authority.

  • Access: Only callable by the owner.

  • Parameters:

    • _address: The address to update.

    • _status: The new authority status (true or false).

addBlacklist

  • Purpose: Adds or removes an address from the blacklist.

  • Access: Only callable by an authority.

  • Parameters:

    • _address: The address to update.

    • _status: The new blacklist status (true or false).

setGEMMintingContract

  • Purpose: Sets the address for the GEM Minting contract.

  • Access: Only callable by the owner.

  • Parameters:

    • _address: The address of the GEM Minting contract.

updatePricesContract

  • Purpose: Updates the address of the price feed contract.

  • Access: Only callable by the owner.

  • Parameters:

    • _address: The new price feed contract address.

approveGemContract

  • Purpose: Approves the GEMNFTs contract to spend a specified amount of GPRO tokens.

  • Access: Only callable by an admin.

  • Parameters:

    • _amount: The amount to approve.

changeBlackPeriod

  • Purpose: Modifies the time period for blacklist fund withdrawal.

  • Access: Only callable by an admin.

  • Parameters:

    • _blackPeriod: The new black period duration.

updateKYCAddress

  • Purpose: Updates the KYC status of an address.

  • Access: Only callable by an admin.

  • Parameters:

    • _address: The address to update.

    • _status: The new KYC status (true or false).

updateKYCAddressBatch

  • Purpose: Updates the KYC status of multiple addresses.

  • Access: Only callable by an admin.

  • Parameters:

    • _address: An array of addresses to update.

    • _status: An array of new KYC statuses.

blacklistAddressWithdrawalPool

  • Purpose: Allows the owner to withdraw funds from a blacklisted address.

  • Access: Only callable by the owner.

  • Parameters:

    • _receiver: The address to receive the withdrawn funds.

    • _address: The blacklisted address.

    • _poolID: The pool ID.

    • _index: The index of the deposit.

Getter Functions

getDiscount

  • Purpose: Retrieves the discount for a specific deposit.

  • Parameters:

    • _poolID: The pool ID.

    • _address: The address of the depositor.

    • _index: The index of the deposit.

  • Returns: The discount rate.

poolInfo

  • Purpose: Retrieves information about a specific pool.

  • Parameters:

    • _poolID: The pool ID.

  • Returns: Pool ID, name, duration, amount, discount, lock duration, and status.

poolPrice

  • Purpose: Retrieves the amount required for a specific pool.

  • Parameters:

    • _poolID: The pool ID.

  • Returns: The amount required for the pool.

poolStatus

  • Purpose: Retrieves the status of a specific pool.

  • Parameters:

    • _poolID: The pool ID.

  • Returns: The status of the pool (active or inactive).

poolDiscount

  • Purpose: Retrieves the discount of a specific pool.

  • Parameters:

    • _poolID: The pool ID.

  • Returns: The discount of the pool..

poolAmountPerAddress

  • Purpose: Retrieves the deposit amount for a specific address and pool.

  • Parameters:

    • _poolID: The pool ID.

    • _address: The address of the depositor.

    • _index: The index of the deposit.

  • Returns: The deposit amount.

poolDataPerAddress

  • Purpose: Retrieves detailed deposit data for a specific address and pool.

  • Parameters:

    • _poolID: The pool ID.

    • _address: The address of the depositor.

    • _index: The index of the deposit.

  • Returns: Amount, deposit date, epoch, GPRO price, and gold price.

poolDepositDatePerAddress

  • Purpose: Retrieves the deposit date for a specific address and pool.

  • Parameters:

    • _poolID: The pool ID.

    • _address: The address of the depositor.

    • _index: The index of the deposit.

  • Returns: The deposit date.

poolGPROPricePerAddress

  • Purpose: Retrieves the GPRO price at the time of deposit for a specific address and pool.

  • Parameters:

    • _poolID: The pool ID.

    • _address: The address of the depositor.

    • _index: The index of the deposit.

  • Returns: The GPRO price.

poolGoldPricePerAddress

  • Purpose: Retrieves the gold price at the time of deposit for a specific address and pool.

  • Parameters:

    • _poolID: The pool ID.

    • _address: The address of the depositor.

    • _index: The index of the deposit.

  • Returns: The gold price.

poolEpochPerAddress

  • Purpose: Retrieves the epoch at the time of deposit for a specific address and pool.

  • Parameters:

    • _poolID: The pool ID.

    • _address: The address of the depositor.

    • _index: The index of the deposit.

  • Returns: The epoch.

retrieveKYCStatus

  • Purpose: Retrieves the KYC status of a specific address.

  • Parameters:

    • _address: The address to check.

  • Returns: The KYC status (true or false).

retrieveAddressArrayPool

  • Purpose: Retrieves the deposit indices for a specific address and pool.

  • Parameters:

    • _address: The address of the depositor.

    • _pool: The pool ID.

  • Returns: An array of deposit indices.

retrieveAddressCounterPool

  • Purpose: Retrieves the deposit counter for a specific address and pool.

  • Parameters:

    • _address: The address of the depositor.

    • _pool: The pool ID.

  • Returns: The deposit counter.

retrieveBlackListStatus

  • Purpose: Retrieves the blacklist status of a specific address.

  • Parameters:

    • _address: The address to check.

  • Returns: The blacklist status (true or false).

Last updated