-
Notifications
You must be signed in to change notification settings - Fork 9
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
Bill broker #203
Bill broker #203
Conversation
Bill broker
🚨 Report Summary
For more details view the full report in OpenZeppelin Code Inspector |
b94e279
to
0be78f3
Compare
950ab24
to
23e37d6
Compare
5071161
to
6c1cfbc
Compare
b446cb6
to
d996baf
Compare
3fc3b50
to
433e6c1
Compare
d996baf
to
e724ee4
Compare
f14dd36
to
e2ab56d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still need to look at the Appraiser
spot-vaults/contracts/_interfaces/IBillBrokerPricingStrategy.sol
Outdated
Show resolved
Hide resolved
error InvalidARBound(); | ||
|
||
/// @notice Expected pre and post swap AR delta to be non-increasing or non-decreasing. | ||
error UnexpectedARDelta(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering the best way to organize vault code. I kind of view vaults like the BillBroker as being outside the core protocol. Should we have a Errors files inside the vault directory for ones like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer breaking errors out from the main contract file, mostly because it make the file smaller. We could call these BillBrokerErrors
or VaultErrors
rather than ProtocolErrors
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the name can be whatever you think is best. The most important piece is moving it so it's clear it's "outside" the core protocol and next to the vault implementation wherever that is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea its a question of if we want them to be listed on the top of the BillBroker.sol file or in a different file. I'm leaning toward moving it out to BillBrokerErrors.sol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure that works. If BillBroker was a 1-file protocol, having them at the top would make sense.
9d46ac2
to
fa2611c
Compare
// If the market price of the USD coin fallen too much below 1$, | ||
// it's an indication of some systemic issue with the USD token | ||
// and thus its price should be considered unreliable. | ||
return (ONE, (v && p > USD_LOWER_BOUND)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic is saying that if the market price of the dollar coin is less than the lower bound (.99 now), then the oracle report is bad. But, it could be a good report representing the real market value of the dollar coin.
Whether we want to operate that far outside the bands of normality is still a sane question to ask... but that's application specific rather than oracle specific. The oracle's job is to deliver data. WDYT, should we move this check into the business logic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The approach here is at times of volatility (or low confidence on the pricing function, I think of both interchangeably), the bill-broker stops all trading activity. Similar to an mm pull liquidity and waiting out the storm.
If the price of the dollar coin deviates a lot from its 1$ peg, its an indication that we now have lower confidence in the pricing function we use (ie 1 dollar coin = 1 dollar).
* internal audit fixes * code review fixes * Update spot-vaults/contracts/_interfaces/BillBrokerErrors.sol Co-authored-by: Brandon Iles <brandon@fragments.org> --------- Co-authored-by: Brandon Iles <brandon@fragments.org>
* updated per-tranche mint cap * removed redundant constant * added dr to the spot and vault interface * added mintedSupplyPerTranche cleanup * updated rounding * updated unit test * renamed constants in rollover vault to keep consistant with perp * Bill broker (#203) * bill broker * BB Internal audit fixes (#210) * internal audit fixes * code review fixes * Update spot-vaults/contracts/_interfaces/BillBrokerErrors.sol Co-authored-by: Brandon Iles <brandon@fragments.org> --------- Co-authored-by: Brandon Iles <brandon@fragments.org> --------- Co-authored-by: Brandon Iles <brandon@fragments.org> * updated yarn lock * bumped up ci version --------- Co-authored-by: Brandon Iles <brandon@fragments.org>
* spot subgraph update (#207) * Removed fixed per-tranche mint cap (#206) * updated per-tranche mint cap * removed redundant constant * added dr to the spot and vault interface * added mintedSupplyPerTranche cleanup * updated rounding * updated unit test * renamed constants in rollover vault to keep consistant with perp * Bill broker (#203) * bill broker * BB Internal audit fixes (#210) * internal audit fixes * code review fixes * Update spot-vaults/contracts/_interfaces/BillBrokerErrors.sol Co-authored-by: Brandon Iles <brandon@fragments.org> --------- Co-authored-by: Brandon Iles <brandon@fragments.org> --------- Co-authored-by: Brandon Iles <brandon@fragments.org> * updated yarn lock * bumped up ci version --------- Co-authored-by: Brandon Iles <brandon@fragments.org> * ci config update * Peck audit changes (#212) * pve001 * pve002 * using msg.sender instead of _msgSender * Perp upgrade and bill-broker deployment (#213) * perp min-cap upgrade deployed to testnet * mock contracts for testnet * tasks to interact with bb * oz testnet deployment * updated yarn lock * removed todo comment * upgraded perp on mainnet * bb mainnet deployment * minor task updates * Delete spot-contracts/notes.txt deleted unused file --------- Co-authored-by: Brandon Iles <brandon@fragments.org>
Simple on-chain vault which trades SPOT <> USD.