From 5e6e736597b5a7c972e4fbe3b61b1a51a44c0e55 Mon Sep 17 00:00:00 2001 From: Sunny Vempati <5723490+sunnyvempati@users.noreply.github.com> Date: Mon, 14 Aug 2023 10:55:54 -0500 Subject: [PATCH] rename perps market proxy (#1768) Co-authored-by: Peiman <25097709+Rickk137@users.noreply.github.com> --- markets/perps-market/cannonfile.toml | 6 ++--- .../contracts/storage/AsyncOrder.sol | 2 +- markets/perps-market/storage.dump.sol | 26 +++++++++++++------ 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/markets/perps-market/cannonfile.toml b/markets/perps-market/cannonfile.toml index 8ac92e657a..19e5a06062 100644 --- a/markets/perps-market/cannonfile.toml +++ b/markets/perps-market/cannonfile.toml @@ -138,9 +138,9 @@ args = [ depends = [ "invoke.upgrade_proxy" ] -factory.AccountProxy.abiOf = ["synthetix.AccountRouter"] -factory.AccountProxy.event = "AssociatedSystemSet" -factory.AccountProxy.arg = 2 +factory.PerpsAccountProxy.abiOf = ["synthetix.AccountRouter"] +factory.PerpsAccountProxy.event = "AssociatedSystemSet" +factory.PerpsAccountProxy.arg = 2 # add pool owner to feature flag allow list [invoke.addPerpsMarketToFeatureFlag] diff --git a/markets/perps-market/contracts/storage/AsyncOrder.sol b/markets/perps-market/contracts/storage/AsyncOrder.sol index ab9b84ccfb..3e1e2dbc42 100644 --- a/markets/perps-market/contracts/storage/AsyncOrder.sol +++ b/markets/perps-market/contracts/storage/AsyncOrder.sol @@ -62,7 +62,7 @@ library AsyncOrder { /** * @notice Thrown when fill price exceeds the acceptable price set at submission. */ - error AcceptablePriceExceeded(uint256 acceptablePrice, uint256 fillPrice); + error AcceptablePriceExceeded(uint256 fillPrice, uint256 acceptablePrice); /** * @notice Gets thrown when pending orders exist and attempts to modify collateral. diff --git a/markets/perps-market/storage.dump.sol b/markets/perps-market/storage.dump.sol index 5579446c2d..b1f6dc9c36 100644 --- a/markets/perps-market/storage.dump.sol +++ b/markets/perps-market/storage.dump.sol @@ -423,10 +423,16 @@ interface IAsyncOrderSettlementModule { int128 newPositionSize; int128 sizeDelta; int256 pnl; + int256 accruedFunding; uint256 pnlUint; uint256 amountToDeduct; uint256 settlementReward; - PerpsMarketFactory.Data factory; + uint256 fillPrice; + uint256 totalFees; + uint256 referralFees; + uint256 feeCollectorFees; + Position.Data newPosition; + PerpsMarket.MarketUpdateData updateData; } } @@ -471,13 +477,8 @@ contract PerpsMarketFactoryModule { // @custom:artifact contracts/storage/AsyncOrder.sol:AsyncOrder library AsyncOrder { struct Data { - uint128 accountId; - uint128 marketId; - int128 sizeDelta; - uint128 settlementStrategyId; uint256 settlementTime; - uint256 acceptablePrice; - bytes32 trackingCode; + OrderCommitmentRequest request; } struct OrderCommitmentRequest { uint128 marketId; @@ -486,12 +487,18 @@ library AsyncOrder { uint128 settlementStrategyId; uint256 acceptablePrice; bytes32 trackingCode; + address referrer; } struct SimulateDataRuntime { + int128 sizeDelta; + uint128 accountId; + uint128 marketId; uint fillPrice; uint orderFees; uint availableMargin; uint currentLiquidationMargin; + uint accumulatedLiquidationRewards; + uint currentLiquidationReward; int128 newPositionSize; uint newNotionalValue; int currentAvailableMargin; @@ -530,6 +537,8 @@ library GlobalPerpsMarket { library GlobalPerpsMarketConfiguration { bytes32 private constant _SLOT_GLOBAL_PERPS_MARKET_CONFIGURATION = keccak256(abi.encode("io.synthetix.perps-market.GlobalPerpsMarketConfiguration")); struct Data { + address feeCollector; + mapping(address => uint256) referrerShare; mapping(uint128 => uint) maxCollateralAmounts; uint128[] synthDeductionPriority; uint minLiquidationRewardUsd; @@ -608,12 +617,13 @@ library PerpsMarketConfiguration { uint256 maxFundingVelocity; uint256 skewScale; uint256 initialMarginRatioD18; - uint256 maintenanceMarginRatioD18; + uint256 maintenanceMarginScalarD18; uint256 lockedOiRatioD18; uint256 maxLiquidationLimitAccumulationMultiplier; uint256 maxSecondsInLiquidationWindow; uint256 liquidationRewardRatioD18; uint256 minimumPositionMargin; + uint256 minimumInitialMarginRatioD18; } function load(uint128 marketId) internal pure returns (Data storage store) { bytes32 s = keccak256(abi.encode("io.synthetix.perps-market.PerpsMarketConfiguration", marketId));