Skip to content

add max total stake cap#380

Merged
Yunusabdul38 merged 1 commit intoWeb3Novalabs:mainfrom
EDOHWARES:feature/max-total-stake-cap-322
Feb 26, 2026
Merged

add max total stake cap#380
Yunusabdul38 merged 1 commit intoWeb3Novalabs:mainfrom
EDOHWARES:feature/max-total-stake-cap-322

Conversation

@EDOHWARES
Copy link
Contributor

Summary

This PR adds an optional maximum total liquidity cap for prediction pools. Pool creators can set a max_total_stake limit (with 0 meaning “no cap”). Once the cap is reached, further predictions are rejected to prevent additional liquidity from entering the market. The pool creator can increase the cap (or remove it by setting to 0) before the market ends.

Changes

  • Pool struct

    • Added max_total_stake: i128 to Pool
    • Default value set to 0 in create_pool to preserve existing behavior (unlimited cap)
  • Prediction placement

    • Updated place_prediction to enforce the global cap:
      • If max_total_stake > 0 and total_stake + amount > max_total_stake, the call aborts with PredifiError::MaxTotalStakeExceeded
  • Cap management

    • Added increase_max_total_stake(env, creator, pool_id, new_max_total_stake):
      • Creator-only
      • Only allowed while pool is active and before end_time
      • Must be >= current total_stake
      • Only allows increasing (or setting unlimited 0)
  • Errors

    • Added PredifiError::MaxTotalStakeExceeded = 104

Behavior Notes

  • Existing pools and flows remain unchanged unless the cap is explicitly increased/set.
  • Cap is applied globally at the pool level (across all outcomes).

Testing

  • No new tests were added in this minimal implementation; existing compilation diagnostics show

Closes #322

@vercel
Copy link

vercel bot commented Feb 25, 2026

@EDOHWARES is attempting to deploy a commit to the shola's projects Team on Vercel.

A member of the Team first needs to authorize it.

@EDOHWARES
Copy link
Contributor Author

@Yunusabdul38 , pls review PR

Copy link
Collaborator

@Yunusabdul38 Yunusabdul38 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Yunusabdul38 Yunusabdul38 merged commit ea6957b into Web3Novalabs:main Feb 26, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Max Cap on Total Pool Liquidity

2 participants