Contracts
Staking

Staking Pool Factory

The StakingPoolFactory contract is responsible for creating and managing staking pools. It allows the creation of staking pools for different tokens and keeps track of all the created pools.

State Variables

  • feeTo: The address that is supposed to receive the protocol fee.
  • feeToSetter: The address that can set the feeTo address.
  • getPool: A mapping from token address to pool address, which stores the pool address for each token.
  • allPools: An array containing all the pool addresses.

Events

  • PoolCreated(address indexed token, address pool, uint256 timeStamp): Event emitted when a new staking pool is created. It includes the token address, pool address, and the timestamp of the creation.

Constructor

  • constructor(address _feeToSetter): Initializes the feeToSetter variable with the provided address during contract deployment.

External Functions

  • allPoolsLength() external view returns (uint256): Returns the length of the allPools array.

  • createPool(address stoken, address rtoken) external returns (address): Creates a new staking pool for the specified staking token (stoken) and reward token (rtoken). It checks that the staking token address is not zero and there is no existing pool for the token. It deploys a new StakingPool contract, sets the pool address in the getPool mapping, adds the pool address to the allPools array, and emits the PoolCreated event. Returns the address of the created pool.

  • setFeeTo(address _feeTo) external: Sets the feeTo address to the provided address. Only the feeToSetter can call this function.

  • setFeeToSetter(address _feeToSetter) external: Sets the feeToSetter address to the provided address. Only the current feeToSetter can call this function.