presaleClaims
Function Type: internal
The presaleClaims
function manages presale staking limits and permissions by enforcing the 2 staking token limit for presale users and tracking their staking amounts. This function is called by presaleStaking
to validate and update presale user constraints.
Parameters
Parameter | Type | Description |
---|---|---|
_isStaking | bool | true = Stake (increments count), false = Unstake (decrements count) |
_user | address | Address of the presale user |
Workflow
The function handles two operation types with different validation flows:
- Staking Operations: Validates limits and increments staking counter
- Unstaking Operations: Validates existing stakes and decrements counter
Staking Process
- Public Staking Status Check: Verifies
allowPublicStaking.flag
is disabled, reverts withPresaleStakingDisabled()
if public staking is active (presale staking is only valid when public staking is not active) - Presale Participant Verification: Confirms the user is registered as a presale participant using
userPresaleStaker[_user].isAllow
, reverts withUserIsNotPresaleStaker()
if not authorized - Limit Check: Ensures
userPresaleStaker[_user].stakingAmount < 2
, reverts withUserPresaleStakerLimitExceeded()
if limit reached - Counter Increment: Increments
userPresaleStaker[_user].stakingAmount++
Unstaking Process
- Public Staking Status Check: Verifies
allowPublicStaking.flag
is disabled, reverts withPresaleStakingDisabled()
if public staking is active (presale staking is only valid when public staking is not active) - Presale Participant Verification: Confirms the user is registered as a presale participant using
userPresaleStaker[_user].isAllow
, reverts withUserIsNotPresaleStaker()
if not authorized - Balance Check: Ensures
userPresaleStaker[_user].stakingAmount > 0
, reverts withUserPresaleStakerLimitExceeded()
if no stakes to unstake - Counter Decrement: Decrements
userPresaleStaker[_user].stakingAmount--