diff --git a/test/AsyncOrder.t.sol b/test/AsyncOrder.t.sol index f93b7e4b..047f38d3 100644 --- a/test/AsyncOrder.t.sol +++ b/test/AsyncOrder.t.sol @@ -1,7 +1,8 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.20; -import {Bootstrap, IPerpsMarketProxy} from "test/utils/Bootstrap.sol"; +import {Bootstrap} from "test/utils/Bootstrap.sol"; +import {IPerpsMarketProxy} from "src/interfaces/synthetix/IPerpsMarketProxy.sol"; import {SynthetixMock} from "test/utils/mocks/SynthetixMock.sol"; contract AsyncOrderTest is Bootstrap, SynthetixMock { diff --git a/test/ConditionalOrder.t.sol b/test/ConditionalOrder.t.sol index 5666bb2b..3571257c 100644 --- a/test/ConditionalOrder.t.sol +++ b/test/ConditionalOrder.t.sol @@ -1,10 +1,11 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.20; -import {Bootstrap, IPerpsMarketProxy} from "test/utils/Bootstrap.sol"; +import {Bootstrap} from "test/utils/Bootstrap.sol"; import {ConditionalOrderSignature} from "test/utils/ConditionalOrderSignature.sol"; import {IEngine} from "src/interfaces/IEngine.sol"; +import {IPerpsMarketProxy} from "src/interfaces/synthetix/IPerpsMarketProxy.sol"; import {PythMock} from "test/utils/mocks/PythMock.sol"; import {SynthetixMock} from "test/utils/mocks/SynthetixMock.sol"; diff --git a/test/utils/Bootstrap.sol b/test/utils/Bootstrap.sol index 33e84149..9c194d4d 100644 --- a/test/utils/Bootstrap.sol +++ b/test/utils/Bootstrap.sol @@ -14,7 +14,7 @@ import { Setup } from "script/Deploy.s.sol"; import {IERC20} from "src/interfaces/tokens/IERC20.sol"; -import {IPerpsMarketProxy} from "src/interfaces/synthetix/IPerpsMarketProxy.sol"; +import {IPerpsMarketProxy} from "test/utils/interfaces/IPerpsMarketProxy.sol"; import {ISpotMarketProxy} from "src/interfaces/synthetix/ISpotMarketProxy.sol"; import {IPyth} from "src/interfaces/oracles/IPyth.sol"; import {SynthMinter} from "test/utils/SynthMinter.sol"; diff --git a/test/utils/interfaces/IPerpsMarketProxy.sol b/test/utils/interfaces/IPerpsMarketProxy.sol new file mode 100644 index 00000000..0999890a --- /dev/null +++ b/test/utils/interfaces/IPerpsMarketProxy.sol @@ -0,0 +1,88 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +pragma solidity 0.8.20; + +interface IPerpsMarketProxy { + function createAccount() external returns (uint128 accountId); + + function getAccountOwner(uint128 accountId) + external + view + returns (address owner); + + function grantPermission( + uint128 accountId, + bytes32 permission, + address user + ) external; + + function hasPermission(uint128 accountId, bytes32 permission, address user) + external + view + returns (bool hasPermission); + + function isAuthorized(uint128 accountId, bytes32 permission, address target) + external + view + returns (bool isAuthorized); + + struct Data { + uint256 settlementTime; + OrderCommitmentRequest request; + } + + struct OrderCommitmentRequest { + uint128 marketId; + uint128 accountId; + int128 sizeDelta; + uint128 settlementStrategyId; + uint256 acceptablePrice; + bytes32 trackingCode; + address referrer; + } + + function commitOrder(OrderCommitmentRequest memory commitment) + external + returns (Data memory retOrder, uint256 fees); + + function requiredMarginForOrder( + uint128 accountId, + uint128 marketId, + int128 sizeDelta + ) external view returns (uint256 requiredMargin); + + function computeOrderFees(uint128 marketId, int128 sizeDelta) + external + view + returns (uint256 orderFees, uint256 fillPrice); + + function modifyCollateral( + uint128 accountId, + uint128 synthMarketId, + int256 amountDelta + ) external; + + function getCollateralAmount(uint128 accountId, uint128 synthMarketId) + external + view + returns (uint256); + + function totalCollateralValue(uint128 accountId) + external + view + returns (uint256); + + function getOpenPosition(uint128 accountId, uint128 marketId) + external + view + returns (int256 totalPnl, int256 accruedFunding, int128 positionSize); + + function getAvailableMargin(uint128 accountId) + external + view + returns (int256 availableMargin); + + function getMaxMarketSize(uint128 marketId) + external + view + returns (uint256 maxMarketSize); +} diff --git a/test/utils/mocks/SynthetixMock.sol b/test/utils/mocks/SynthetixMock.sol index f239b377..5470ddf4 100644 --- a/test/utils/mocks/SynthetixMock.sol +++ b/test/utils/mocks/SynthetixMock.sol @@ -1,8 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.20; -import {EIP7412} from "src/utils/EIP7412.sol"; -import {IPerpsMarketProxy} from "src/interfaces/synthetix/IPerpsMarketProxy.sol"; +import {IPerpsMarketProxy} from "test/utils/interfaces/IPerpsMarketProxy.sol"; import {Test} from "lib/forge-std/src/Test.sol"; contract SynthetixMock is Test {