Skip to main content

publicServiceStaking

Function Type: external
Function Signature: publicServiceStaking(address,address,bool,uint256,uint256,bytes,uint256,uint256,bool,bytes)

The publicServiceStaking function allows smart contracts (services) to stake on behalf of users when public staking is enabled. This function includes additional verification to ensure the service address contains contract code.

Parameters

ParameterTypeDescription
useraddressAddress of the user who owns the stake
serviceaddressAddress of the smart contract performing the staking
isStakingbooltrue = Stake, false = Unstake
amountOfStakinguint256Amount of staking tokens to stake/unstake
nonceuint256Unique nonce for this staking operation
signaturebytesSignature proving authorization for service staking
priorityFee_EVVMuint256EVVM priority fee (only for staking)
nonce_EVVMuint256EVVM nonce (only for staking)
priorityFlag_EVVMboolEVVM priority flag (only for staking)
signature_EVVMbytesEVVM signature (only for staking)
note

Workflow

  1. Public Staking Status: Verifies allowPublicStaking.flag is enabled
  2. Service Verification: Confirms the service address contains contract code using extcodesize
  3. Signature Verification: For staking operations, validates the service staking signature
  4. Service Matching: For unstaking operations, ensures service equals user address
  5. Nonce Validation: Confirms the contract nonce is valid and unused
  6. Process Execution: Calls the internal stakingServiceProcess function
  7. Nonce Update: Increments the contract nonce for the user