Skip to content

feat: configure configurable deposit cap - #156

Open
hpmaxi wants to merge 2 commits into
feat/78-authorization-modelfrom
feat/152-deposit-cap
Open

hpmaxi wants to merge 2 commits into
feat/78-authorization-modelfrom
feat/152-deposit-cap

Conversation

@hpmaxi

@hpmaxi hpmaxi commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Summary of changes

  • Add deposit_cap configuration key to instance storage, defaulting to None (unbounded deposits).
  • Provide governance-gated entrypoint set_deposit_cap(Option<i128>, caller) to set, adjust, or clear the cap.
  • Add view entrypoints deposit_cap() -> Option<i128> and total_economic_assets() -> i128 (cash held + net deployed - committed redemptions).
  • Enforce the cap at subscription time in deposit::request, returning VaultError::DepositCapExceeded (6062) if the deposit would breach the cap.
  • Ensure pending cancellations restore available headroom under the cap upon refund.
  • Emit DepositCapUpdated event capturing previous and new cap values.
  • Add comprehensive test coverage in contracts/async-vault/src/test/deposit_cap.rs verifying boundary values, cancellations, deployments, redemptions, and unauthorized access rejection.

Closes #152

@vercel

vercel Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
strata-vault-kit-app Ready Ready Preview Sep 25, 2026 6:08pm UTC

Request Review

@hpmaxi
hpmaxi requested a review from luchobonatti September 23, 2026 20:09
@hpmaxi
hpmaxi force-pushed the feat/152-deposit-cap branch from a2480ef to 249ef4a Compare September 24, 2026 19:43
@hpmaxi
hpmaxi changed the base branch from main to feat/78-authorization-model September 24, 2026 19:43
@luchobonatti
luchobonatti added this pull request to stack #158 September 25, 2026 16:43
Add deposit_cap setting for governance to configure maximum vault
assets, defaulting to unbounded. Enforces cap at deposit request time,
restores headroom upon cancellation, and emits DepositCapUpdated.

Closes #152

@luchobonatti luchobonatti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Cap logic reads sound and the rebase is clean. Two small things inline.

}

#[only_admin]
pub fn set_deposit_cap(e: &Env, cap: Option<i128>, caller: Address) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

New governance parameter, but §8.8's Configuration row still lists only bounds, freshness, timelock and wind-down delay. Worth adding the cap there?

@@ -164,6 +165,27 @@ impl AsyncVault {
.unwrap_or_else(|| panic_with_error!(e, VaultError::AmountTooLarge))
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The PR body names total_economic_assets(), which is not in the diff. Leftover from before the metric was simplified?

This branch was successfully deployed

1 active deployment
Preview — a5990a4b Deployed Sep 25, 2026 by vercel[bot]
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.

Configure deposit cap on subscriptions

2 participants