Stability Pool / Emissions Controller#134
Conversation
Adds a new oracle relayer that allows reading from a CurveStableSwapNG pool. We will use the relayer to return a price of HAI / BOLD from the HAI / BOLD curve pool at https://www.curve.finance/dex/optimism/pools/factory-stable-ng-81 This feed will then be combined with the existing BOLD / USD Chainlink compatible Pyth feed to produce a HAI / USD price. The pool's `price_oracle(i)` returns an EMA, however because HAI has an external rate oracle configured for the pool, the redemption price, we need to adjust the raw value by the rate to get the actual HAI / BOLD exchange rate. Additional Changes - bumped `evm_version` to `shanghai` because needed the `PUSH0` opcode - updated fork block in end to end oracle tests and fixed broken beefy / yearn tests in that file
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: da810f7c0e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 45a3b1a442
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 16ae80726f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6ecd98880b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Codex Review: Didn't find any major issues. You're on a roll. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…n can trade more than previewed.
…cade into deposit/withdraw failures while rewards are active.
…historical claims.
…im transfer success.
…ense/large routes
…n because it does not model reserve changes from remove+swap atomically.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1a8c119388
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7814edc4e4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
chore: repo cleanup (#142)
Feat: StakingManager cooldown
* chore: repo cleanup (#142) * Merge pull request #144 from hai-on-op/feat/staking-manager-cooldown Feat: StakingManager cooldown * feat: tenderly tooling * chore: formatting * Stability Pool Audit Fixes (#146) * fix: ECR-01S: Inexistent Sanitization of Input Addresses * fix: MHT-01S: Illegible Numeric Value Representation * fix: SPL-01S: Illegible Numeric Value Representations * fix: SPL-02S: Inexistent Sanitization of Input Addresses * fix: BVS-01M: Redundant Deadline Buffers * fix: BVS-03M: Insecure On-Chain Preview * fix: BVS-03M - scripts * fix: CSS-01M: Insecure On-Chain Preview * update: BVS-01M / CSS-01M - useOracleFloor config * fix: ECR-01M: Emission Rate Truncations * fix: ECR-02M: Uniform Deviation Direction * fix: EGN-01M: Inexistent Validation of Length * fix: MHT-01M: Insecure Negation of Signed Integers * fix: SPL-01M: First-Depositor Attack Susceptibility * fix: SPL-03M: Inexistent Validation of Step Sequence * fix: VCL-01M: Potentially Lingering Approval * fix: VCL-02M: Insecure On-Chain Preview * fix: VLP-01M: Redundant Deadline Buffer * fix: VLP-02M: Insecure On-Chain Preview * feat: remove instances of OZ Math * fix: VLR-01M: Redundant Deadline Buffer * fix: VLR-02M: Insecure Preview Assumption * fix: VLR-03M: Insecure On-Chain Preview * fix: VSS-01M: Redundant Deadline Buffers * fix: VSS-02M: Insecure On-Chain Preview * fix: BVS-01C: Function Selector Value Literal
…s-controller' into feat/stability-pool-and-emissions-controller # Conflicts: # script/tenderly/bootstrap-stability-pool.mjs # script/tenderly/stability-pool-config.mjs # script/tenderly/verify-stability-pool-manifest.mjs
Summary
This PR adds the Stability Pool, Emissions Controller, and strategy-step framework.
At a high level, users can now deposit HAI into the Stability Pool and receive
sHAI, the pool can participate in collateral auctions and route purchased collateral back into HAI through configurable onchain strategy pipelines, andKITE emissions are distributed through a standalone controller with dynamic splits between stability-side rewards and minting-side rewards.
This gives the protocol a dedicated HAI backstop with configurable liquidation routing, instead of relying on a single hardcoded unwind path per collateral.
It also decouples emissions logic from the pool itself, which makes reward distribution easier to reason about and easier to evolve over time.
What’s included
Stability Pool
StabilityPoolERC4626 vault for depositing HAI and mintingsHAIcoverAndRepayDebtsHAIlifecycle, with one-way transfer enablement once governance wants to cut emissions overEmissions Controller
EmissionsControllercontract to manage KITE emissions separately from the poolStrategy Steps
Notes
This PR is a pretty large feature drop and touches:
Most of the work here is around making those pieces compose cleanly.
Testing
Covered with unit + E2E tests across:
In Depth Guide: https://hackmd.io/@lets-get-hai/stability-pool-auditor-guide