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

Cancellation cost calculation for keepers #2348

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
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
7 changes: 6 additions & 1 deletion auxiliary/OpGasPriceOracle/contracts/OpGasPriceOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ contract OpGasPriceOracle is IExternalNode {
uint256 executionKind;
}

/**
* @notice thrown when the execution kind is invalid
*/
error OpGasPriceOracleInvalidExecutionKind();

constructor(address _ovmGasPriceOracleAddress) {
// Addresses configuration
ovmGasPriceOracleAddress = _ovmGasPriceOracleAddress;
Expand Down Expand Up @@ -213,7 +218,7 @@ contract OpGasPriceOracle is IExternalNode {
gasUnitsL2 = runtimeParams.l2LiquidateGasUnits;
unsignedTxSize = runtimeParams.liquidateTxSize;
} else {
revert("Invalid execution kind");
revert OpGasPriceOracleInvalidExecutionKind();
}
}

Expand Down
4 changes: 2 additions & 2 deletions markets/perps-market/contracts/mocks/MockGasPriceNode.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ contract MockGasPriceNode is IExternalNode {
uint256 public flagCost;
uint256 public liquidateCost;

constructor() {}
error InvalidExecutionKind();

function setCosts(uint256 _settlementCost, uint256 _flagCost, uint256 _liquidateCost) external {
settlementCost = _settlementCost;
Expand Down Expand Up @@ -50,7 +50,7 @@ contract MockGasPriceNode is IExternalNode {
} else if (executionKind == KIND_LIQUIDATE) {
theOutput.price = int256(liquidateCost);
} else {
revert("Invalid execution kind");
revert InvalidExecutionKind();
}

return theOutput;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ contract AsyncOrderCancelModule is IAsyncOrderCancelModule, IMarketEvents, IAcco
runtime.accountId = asyncOrder.request.accountId;
runtime.marketId = asyncOrder.request.marketId;
runtime.acceptablePrice = asyncOrder.request.acceptablePrice;
runtime.settlementReward = settlementStrategy.settlementReward;
runtime.settlementReward = AsyncOrder.settlementRewardCost(settlementStrategy);
runtime.sizeDelta = asyncOrder.request.sizeDelta;

// check if account is flagged
Expand Down