Skip to content

Commit

Permalink
check partyB leverage
Browse files Browse the repository at this point in the history
  • Loading branch information
hookman2 committed Sep 20, 2023
1 parent 9e07da9 commit ad242c5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion contracts/facets/PartyA/PartyAFacetImpl.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ library PartyAFacetImpl {
lockedValues.totalForPartyA() <= notionalValue,
"PartyAFacet: Leverage can't be lower than one"
);
// TODO: should we check for partyB
require(
lockedValues.totalForPartyB() <= notionalValue,
"PartyAFacet: Leverage for partyB can't be lower than one"
);
require(
lockedValues.lf >=
(symbolLayout.symbols[symbolId].minAcceptablePortionLF * lockedValues.totalForPartyA()) /
Expand Down
6 changes: 3 additions & 3 deletions contracts/libraries/LibQuote.sol
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ library LibQuote {
AccountStorage.Layout storage accountLayout = AccountStorage.layout();
SymbolStorage.Layout storage symbolLayout = SymbolStorage.layout();

require(quote.lockedValues.cva * filledAmount / LibQuote.quoteOpenAmount(quote) > 0, "LibQuote: Low filled amount");
require(quote.lockedValues.partyAmm * filledAmount / LibQuote.quoteOpenAmount(quote) > 0, "LibQuote: Low filled amount");
require(quote.lockedValues.partyBmm * filledAmount / LibQuote.quoteOpenAmount(quote) > 0, "LibQuote: Low filled amount");
require(quote.lockedValues.cva == 0 || quote.lockedValues.cva * filledAmount / LibQuote.quoteOpenAmount(quote) > 0, "LibQuote: Low filled amount");
require(quote.lockedValues.partyAmm == 0 || quote.lockedValues.partyAmm * filledAmount / LibQuote.quoteOpenAmount(quote) > 0, "LibQuote: Low filled amount");
require(quote.lockedValues.partyBmm == 0 || quote.lockedValues.partyBmm * filledAmount / LibQuote.quoteOpenAmount(quote) > 0, "LibQuote: Low filled amount");
require(quote.lockedValues.lf * filledAmount / LibQuote.quoteOpenAmount(quote) > 0, "LibQuote: Low filled amount");
LockedValues memory lockedValues = LockedValues(
quote.lockedValues.cva -
Expand Down

0 comments on commit ad242c5

Please sign in to comment.