Skip to content

Commit

Permalink
Merge branch 'main' into prevent-collateral-update-with-pending-orders
Browse files Browse the repository at this point in the history
  • Loading branch information
leomassazza authored Jul 11, 2023
2 parents 87f03d8 + d0d6c78 commit a17ffea
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions markets/perps-market/contracts/interfaces/IMarketEvents.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,19 @@
pragma solidity >=0.8.11 <0.9.0;

interface IMarketEvents {
/**
* @notice Gets fired when the size of a market is updated by new orders or liquidations.
* @param marketId Id of the market used for the trade.
* @param price Price at the time of this event.
* @param skew Market skew at the time of the trade. Positive values mean more longs.
* @param size Size of the entire market after settlement.
* @param sizeDelta Change in market size during this update.
* @param currentFundingRate The current funding rate of this market (0.001 = 0.1% per day)
* @param currentFundingVelocity The current rate of change of the funding rate (0.001 = +0.1% per day)
*/
event MarketUpdated(
uint128 marketId,
uint256 price,
int256 skew,
uint256 size,
int256 sizeDelta,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ contract AsyncOrderSettlementModule is IAsyncOrderSettlementModule, IMarketEvent
.updatePositionData(runtime.accountId, newPosition);
emit MarketUpdated(
updateData.marketId,
price,
updateData.skew,
updateData.size,
runtime.sizeDelta,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ describe('Settle Offchain Async Order test', () => {
});

it('emits market updated event', async () => {
const price = bn(1000);
const marketSize = bn(1);
const marketSkew = bn(1);
const sizeDelta = bn(1);
Expand All @@ -421,6 +422,7 @@ describe('Settle Offchain Async Order test', () => {
});
const params = [
ethMarketId,
price,
marketSkew,
marketSize,
sizeDelta,
Expand Down

0 comments on commit a17ffea

Please sign in to comment.