Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(breaker): ValueDeltaBreaker #86

Merged
merged 7 commits into from
Dec 14, 2022

Conversation

bowd
Copy link
Contributor

@bowd bowd commented Dec 7, 2022

Description

Value Delta Breaker is an extension of the Median Delta Breaker, but instead of moving with the median, this breaker ensures that the oracle value always stays in a threshold of a reference value. This is useful for the USDC/USD oracles where we want to ensure that trading stops if the reported USDC price moves outside of a comfortable range, 1 USD +/- 5bps for example.

Other changes

Because breakers share a lot of logic when it comes to their cooldown and threshold management, I abstracted that away in utility contracts that are shared by both the MedianDeltaBreaker and the ValueDeltaBreaker.

Tested

Copied over the MedianDeltaBreaker tests and changed them accordingly.

Related issues

Backwards compatibility

Changes are additive

Documentation

The BreakerBox doc need to be updated.

@bowd bowd changed the base branch from develop to feature/mcmint December 7, 2022 11:31
@bowd bowd changed the title Value delta breaker feat(breaker): ValueDeltaBreaker Dec 8, 2022
@bowd bowd requested a review from bayological December 8, 2022 14:53
test/ValueDeltaBreaker.t.sol Show resolved Hide resolved
test/ValueDeltaBreaker.t.sol Show resolved Hide resolved
contracts/ValueDeltaBreaker.sol Outdated Show resolved Hide resolved
contracts/ValueDeltaBreaker.sol Show resolved Hide resolved
test/ValueDeltaBreaker.t.sol Outdated Show resolved Hide resolved
test/ValueDeltaBreaker.t.sol Outdated Show resolved Hide resolved
test/ValueDeltaBreaker.t.sol Outdated Show resolved Hide resolved
contracts/MedianDeltaBreaker.sol Outdated Show resolved Hide resolved
contracts/MedianDeltaBreaker.sol Outdated Show resolved Hide resolved
test/MedianDeltaBreaker.t.sol Show resolved Hide resolved
Copy link
Member

@bayological bayological left a comment

Choose a reason for hiding this comment

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

LGTM

@ninabarbakadze ninabarbakadze merged commit 9aefa17 into feature/mcmint Dec 14, 2022
@ninabarbakadze ninabarbakadze deleted the feature/static-value-breaker branch December 14, 2022 13:50
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.

Static Value Breaker
3 participants