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

Update OrderSettled event #1696

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ interface IAsyncOrderModule {
uint128 indexed accountId,
uint256 fillPrice,
int256 accountPnlRealized,
int128 sizeDelta,
int128 newSize,
uint256 collectedFees,
uint256 settelementReward,
uint256 settlementReward,
bytes32 indexed trackingCode,
address settler
);
Expand Down Expand Up @@ -59,6 +60,7 @@ interface IAsyncOrderModule {
struct SettleOrderRuntime {
uint128 marketId;
uint128 accountId;
int128 sizeDelta;
int128 newPositionSize;
int256 pnl;
uint256 pnlUint;
Expand Down
6 changes: 4 additions & 2 deletions markets/perps-market/contracts/modules/AsyncOrderModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ contract AsyncOrderModule is IAsyncOrderModule {
}

function settlePythOrder(bytes calldata result, bytes calldata extraData) external payable {
(uint128 marketId, uint128 asyncOrderId) = abi.decode(extraData, (uint128, uint128));
(uint128 marketId, uint128 accountId) = abi.decode(extraData, (uint128, uint128));
(
AsyncOrder.Data storage order,
SettlementStrategy.Data storage settlementStrategy
) = _performOrderValidityChecks(marketId, asyncOrderId);
) = _performOrderValidityChecks(marketId, accountId);

bytes32[] memory priceIds = new bytes32[](1);
priceIds[0] = settlementStrategy.feedId;
Expand Down Expand Up @@ -177,6 +177,7 @@ contract AsyncOrderModule is IAsyncOrderModule {

runtime.accountId = asyncOrder.accountId;
runtime.marketId = asyncOrder.marketId;
runtime.sizeDelta = asyncOrder.sizeDelta;

// check if account is flagged
GlobalPerpsMarket.load().checkLiquidation(runtime.accountId);
Expand Down Expand Up @@ -233,6 +234,7 @@ contract AsyncOrderModule is IAsyncOrderModule {
runtime.accountId,
fillPrice,
runtime.pnl,
runtime.sizeDelta,
runtime.newPositionSize,
totalFees,
runtime.settlementReward,
Expand Down
3 changes: 2 additions & 1 deletion markets/spot-market/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ To determine the fee, the client should first call getUpdateFee() from Pyth's ve
### OrderSettled

```solidity
event OrderSettled(uint128 marketId, uint128 asyncOrderId, uint256 finalOrderAmount, struct OrderFees.Data fees, uint256 collectedFees, address settler, uint256 price)
event OrderSettled(uint128 marketId, uint128 asyncOrderId, uint256 finalOrderAmount, struct OrderFees.Data fees, uint256 collectedFees, address settler, uint256 price, enum Transaction.Type orderType)
```

Gets fired when an order is settled.
Expand All @@ -214,6 +214,7 @@ To determine the fee, the client should first call getUpdateFee() from Pyth's ve
* `collectedFees` (*uint256*) - fees collected by the configured fee collector.
* `settler` (*address*) - address that settled the order.
* `price` (*uint256*) -
* `orderType` (*enum Transaction.Type*) -

## Atomic Order Module

Expand Down
22 changes: 1 addition & 21 deletions protocol/oracle-manager/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
### getNode

```solidity
function getNode(bytes32 nodeId) external view returns (struct NodeDefinition.Data node)
function getNode(bytes32 nodeId) external pure returns (struct NodeDefinition.Data node)
```

Returns a node's definition (type, parameters, and parents)
Expand Down Expand Up @@ -251,23 +251,3 @@
function isValid(struct NodeDefinition.Data nodeDefinition) internal view returns (bool valid)
```

## Router

### fallback

```solidity
fallback() external payable
```

### receive

```solidity
receive() external payable
```

### _forward

```solidity
function _forward() internal
```

Loading