generated from Kwenta/foundry-scaffold
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
32d3793
commit 543a34c
Showing
5 changed files
with
94 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters