Skip to main content

presaleStaking

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

The presaleStaking function enables presale participants to stake or unstake their MATE tokens under specific restrictions. This function ensures exclusive access for qualifying presale users while enforcing operational limits.

Restrictions

  • Fixed amount of 1 staking token per operation
  • Maximum allocation of 2 staking tokens per user
  • Requires active allowPresaleStaking flag
  • Not available when allowPublicStaking flag is active (presale users must use publicStaking instead)
info

Note: In this repository's contract implementation the constructor enables allowPresaleStaking.flag by default and leaves allowPublicStaking.flag disabled. Deployments and testnets may use different defaults; consult the deployed contract metadata for runtime flag values.

Parameters

ParameterTypeDescription
useraddressPresale participant's wallet address
isStakingbooltrue = Stake, false = Unstake
nonceuint256Staking contract nonce for replay protection
signaturebytesUser authorization signature

Note: For presale staking the function enforces a fixed amount of 1 token; therefore the signed message must include _amountOfStaking = 1.| priorityFee_EVVM | uint256 | EVVM priority fee | | nonce_EVVM | uint256 | EVVM payment operation nonce | | priorityFlag_EVVM | bool | EVVM execution mode (true = async, false = sync) | | signature_EVVM | bytes | EVVM payment authorization |

note

Workflow

The function supports two execution paths:

  • Fisher-Mediated: A designated fisher captures the transaction from the fishing spot and submits it to the contract
  • Direct User Submission: The user directly submits the transaction to the contract

Staking Process

  1. Signature Verification: Validates the authenticity of the user signature
  2. Nonce Validation: Calls internal verifyAsyncNonce(user, nonce) which reverts with AsyncNonceAlreadyUsed() if the nonce was already used; after successful execution the contract calls markAsyncNonceAsUsed(user, nonce) to prevent replays
  3. Presale Claims Processing: Calls presaleClaims() to verify presale participation and enforce 2-token limit
  4. Presale Staking Status: Verifies allowPresaleStaking.flag is enabled
  5. Process Execution: Calls the internal stakingBaseProcess function with:
    • User address and IsAService=false in AccountMetadata
    • Fixed amount of 1 staking token
    • Standard EVVM payment processing
    • Historical record updates and reward distribution
  6. Nonce Update: Marks the staking nonce as used to prevent replay attacks
info

For detailed information about the stakingBaseProcess function, refer to the stakingBaseProcess.

presaleStaking Staking Happy Path presaleStaking Staking Failed Path

Unstaking Process

  1. Signature Verification: Validates the authenticity of the user signature
  2. Nonce Validation: Calls internal verifyAsyncNonce(user, nonce) which reverts with AsyncNonceAlreadyUsed() if the nonce was already used; after successful execution the contract calls markAsyncNonceAsUsed(user, nonce) to prevent replays
  3. Presale Claims Processing: Calls presaleClaims() to verify presale participation and validate unstaking eligibility
  4. Presale Staking Status: Verifies allowPresaleStaking.flag is enabled
  5. Process Execution: Calls the internal stakingBaseProcess function with:
    • User address and IsAService=false in AccountMetadata
    • Fixed amount of 1 staking token
    • Standard EVVM payment processing
    • Historical record updates and reward distribution
  6. Nonce Update: Marks the staking nonce as used to prevent replay attacks
info

For detailed information about the stakingBaseProcess function, refer to the stakingBaseProcess.

presaleStaking Unstaking Happy Path presaleStaking Unstaking Failed Path