PartyB Facet

Changes:

acceptCancelRequest()

Before:

// send trading Fee back to partyA
accountLayout.allocatedBalances[quote.partyA] += LibQuote.getTradingFee(quoteId);

After:

// send trading Fee back to partyA
uint256 fee = LibQuote.getTradingFee(quoteId);
accountLayout.allocatedBalances[quote.partyA] += fee;
emit SharedEvents.BalanceChangePartyA(quote.partyA, fee, SharedEvents.BalanceChangeType.PLATFORM_FEE_IN);

Explanation: Added emission of BalanceChangePartyA event when returning the trading fee to Party A upon quote cancellation.

openPosition()

Before:

accountLayout.balances[GlobalAppStorage.layout().feeCollector] +=
    (filledAmount * quote.requestedOpenPrice * quote.tradingFee) / 1e36;
...
accountLayout.balances[GlobalAppStorage.layout().feeCollector] +=
    (filledAmount * quote.marketPrice * quote.tradingFee) / 1e36;
...
accountLayout.pendingLockedBalances[quote.partyA].subQuote(quote);
...
accountLayout.allocatedBalances[newQuote.partyA] += LibQuote.getTradingFee(newQuote.id);
...
accountLayout.pendingLockedBalances[quote.partyA].sub(filledLockedValues);
...
newQuote.lockedValues = quote.lockedValues.sub(filledLockedValues);

After:

Explanation: Added emission of BalanceChangePartyA in all places where the allocated balance of the user changes. Also, platform fees are now paid to fee collectors of each affiliate separately.

emergencyClosePosition()

Before:

After:

Explanation: From time to time, Binance delists some of its pairs. In the current version, we had to put partyBs in emergency mode to let them close their positions without user requests. In the next version, if a symbol becomes invalid, partyB can emergency close all its positions.

Last updated