Repository navigation
feat(backstop): implement per-feed underwriting exposure limits and concentration caps (#240) - #502
Open
umpireboulianne-design wants to merge 1 commit into
Conversation
…oncentration caps (Refract-Protocol#240) Closes Refract-Protocol#240
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements per-feed and per-policyholder-per-feed underwriting exposure tracking and concentration caps in
RefractBackstop, wired intoRefractPool's policy sale, settlement, and expiry flows.Closes #240
Changes
backstop/src/lib.rs):feed_exposure(env, feed): tracks active underwritten coverage per feed symbol.holder_feed_exposure(env, holder, feed): tracks active underwritten coverage per(holder, feed)pair.aggregate_feed_exposure(env)andtracked_feeds(env): maintain the aggregate exposure invariant across all tracked feeds.backstop/src/lib.rs):set_feed_cap(env, caller, feed, max_feed_coverage, max_feed_coverage_bps, max_holder_feed_coverage)andfeed_cap(env, feed): configure absolute feed caps, relative caps in basis points oftotal_capital, and per-holder-per-feed caps.backstop/src/lib.rs,pool/src/lib.rs):check_exposure_capsandrecord_policy_exposure: enforce configured caps prior to underwriting and recordPolicyExposureRecordperpolicy_id.release_policy_exposure: idempotent perpolicy_idso that concurrent or sequential settlement + expiry paths can never double-decrement feed or aggregate exposure.DataKey::Backstopinpool/src/lib.rs(set_backstop,backstop,PoolError::FeedCapExceeded) intobuy_policy,process_claim, andexpire_policy.SPEC.md,backstop/src/test.rs):SPEC.md.Checklist
unwrap(),expect(), orpanic!()calls in non-test contract codepolicy_idSPEC.mdupdated and unit tests added