stakingBaseProcess
Function Type: internal
The stakingBaseProcess
function implements the core staking and unstaking logic, serving as the central processing engine for all staking operations within the contract.
Parameters
Parameter | Type | Description |
---|---|---|
userAccount | address | Address of the user paying for the transaction |
stakingAccount | address | Address that will receive the stake/unstake |
isStaking | bool | true = Stake, false = Unstake |
amountOfStaking | uint256 | Amount of staking tokens to stake/unstake |
priorityFee_EVVM | uint256 | EVVM priority fee |
nonce_EVVM | uint256 | EVVM nonce |
priorityFlag_EVVM | bool | EVVM priority flag |
signature_EVVM | bytes | EVVM signature |
Workflow
Staking Process
- Re-Staking Eligibility: Verifies the user can stake again after their last full unstaking using the
getTimeToUserUnlockStakingTime
function - Payment Processing: Calls the internal
makePay
function to process payments through EVVM - Staker Status Update: Sets the user's staking flag to
0x01
using thepointStaker
function in the EVVM contract - Historical Record Creation: Logs critical transaction data:
- Staking indicator
- Amount staked in this transaction
- Timestamp of operation
- Updated total stake amount
- Priority Fee Distribution: Distributes the priority fee to the transaction executor using the
makeCaPay
function - Reward Distribution: Allocates rewards to the transaction executor using the
makeCaPay
function with enhanced amounts for stakers
info
For detailed information about the helper functions, refer to:
- makePay
- makeCaPay
- Getter Functions for time lock functions
Unstaking Process
- Full Unstaking Cooldown Verification: For complete unstaking, validates that the required cooldown period has elapsed using the
getTimeToUserUnlockFullUnstakingTime
function- If valid: Updates staking flag to
0x00
via thepointStaker
function - If invalid: Reverts the transaction
- If valid: Updates staking flag to
- Priority Fee Processing: For transactions with priority fees, calls the internal
makePay
function - Token Withdrawal: Processes the unstaking withdrawal using the
makeCaPay
function - Historical Record Creation: Logs critical transaction data:
- Unstaking indicator
- Amount unstaked in this transaction
- Timestamp of operation
- Updated total stake amount
- Priority Fee Distribution: Distributes the priority fee to the transaction executor
- Reward Distribution: Allocates rewards to the transaction executor with enhanced amounts for stakers
info
For detailed information about the helper functions, refer to:
- makePay
- makeCaPay
- Getter Functions for time lock functions