🤖Conservative Staking
Last updated
Last updated
ConservativeStaking is a smart contract intended for staking purposes within a blockchain ecosystem. It integrates with other contracts such as ConservativeStakingPool
and utilises Pass
for additional functionalities. This contract is designed to offer a conservative staking mechanism, allowing users to stake tokens, claim profits, and participate in a structured reward distribution system.
Staking: Users can stake tokens in different pools.
Profit Calculation and Distribution: Calculates profit based on staked amounts and distributes it accordingly.
Claiming: Users can claim their profits from individual pools or all at once.
Conservative Pool Management: Supports opening new pools and closing existing ones based on specific conditions.
Element | Description |
---|---|
Function name | Description |
---|---|
The ConservativeStaking
contract provides a comprehensive solution for staking mechanisms, emphasizing security with its non-reentrancy guard and flexibility through dynamic pool management
Variables
- Stores contract state such as pools, staked amounts, profits, and roles.
Events
- Signals significant actions in the contract like pool openings/closings, staking, claiming, etc.
Public Functions
- Functions accessible to all users for actions like staking, claiming, and viewing contract data.
External Functions
- Functions callable from other contracts, mainly for administrative purposes.
Internal Functions
- Utility functions for internal contract management, not accessible externally.
getStaked(address staker)
Returns the amount staked by a specific user.
totalClaimed()
Returns the total amount of tokens claimed by all users
totalStaked()
Returns the total amount of tokens staked in the contract
totalProfit()
Returns the total profit generated by the contract
totalStakers()
Returns the total number of users who have staked tokens
getActivePoolCount()
, getStakedPoolsCount(address staker)
, getProfit(address staker)
, getClaimable(address staker)
Provide detailed information about pools and profits.
stake(address staker, uint256 amount)
Allows a user to stake a specified amount of tokens.
claim(address pool)
, claimAll()
Allows users to claim profits from specific or all pools.
withdraw(address pool)
Allows users to withdraw their staked amount from a specific pool.
setCalculatingWindow(uint256 _window)
Adjusts the calculation window for profit distribution
setMinAllowedAmount(uint256 _amount)
Sets the minimum amount of tokens that can be staked.
newPool()
Manually triggers the creation of a new staking pool.