-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
10 changed files
with
224 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.10; | ||
|
||
import "./state/IOverlayV1BaseState.sol"; | ||
import "./state/IOverlayV1PriceState.sol"; | ||
import "./state/IOverlayV1OIState.sol"; | ||
import "./state/IOverlayV1PositionState.sol"; | ||
|
||
interface IOverlayV1State is | ||
IOverlayV1BaseState, | ||
IOverlayV1PriceState, | ||
IOverlayV1OIState, | ||
IOverlayV1PositionState | ||
{} |
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,17 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.10; | ||
|
||
import "@overlay/v1-core/contracts/interfaces/IOverlayV1Factory.sol"; | ||
import "@overlay/v1-core/contracts/interfaces/IOverlayV1Market.sol"; | ||
import "@overlay/v1-core/contracts/libraries/Oracle.sol"; | ||
|
||
interface IOverlayV1BaseState { | ||
// immutables | ||
function factory() external view returns (IOverlayV1Factory); | ||
|
||
// market associated with given feed | ||
function market(address feed) external view returns (IOverlayV1Market market_); | ||
|
||
// latest oracle data associated with given feed | ||
function data(address feed) external view returns (Oracle.Data memory data_); | ||
} |
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,31 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.10; | ||
|
||
import "./IOverlayV1BaseState.sol"; | ||
import "./IOverlayV1PriceState.sol"; | ||
|
||
interface IOverlayV1OIState is IOverlayV1BaseState, IOverlayV1PriceState { | ||
// aggregate open interest values on market associated with feed | ||
function ois(address feed) external view returns (uint256 oiLong_, uint256 oiShort_); | ||
|
||
// cap on aggregate open interest on market associated with feed | ||
function capOi(address feed) external view returns (uint256 capOi_); | ||
|
||
// fraction of cap on aggregate open interest given oi amount | ||
function fractionOfCapOi(address feed, uint256 oi) | ||
external | ||
view | ||
returns (uint256 fractionOfCapOi_); | ||
|
||
// funding rate on market associated with feed | ||
function fundingRate(address feed) external view returns (int256 fundingRate_); | ||
|
||
// circuit breaker level on market associated with feed | ||
function circuitBreakerLevel(address feed) | ||
external | ||
view | ||
returns (uint256 circuitBreakerLevel_); | ||
|
||
// rolling minted amount on market associated with feed | ||
function minted(address feed) external view returns (int256 minted_); | ||
} |
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,103 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.10; | ||
|
||
import "@overlay/v1-core/contracts/libraries/Position.sol"; | ||
|
||
import "./IOverlayV1BaseState.sol"; | ||
import "./IOverlayV1OIState.sol"; | ||
import "./IOverlayV1PriceState.sol"; | ||
|
||
interface IOverlayV1PositionState is IOverlayV1BaseState, IOverlayV1PriceState, IOverlayV1OIState { | ||
// position on the market associated with feed | ||
function position( | ||
address feed, | ||
address owner, | ||
uint256 id | ||
) external view returns (Position.Info memory position_); | ||
|
||
// debt of position on the market associated with feed | ||
function debt( | ||
address feed, | ||
address owner, | ||
uint256 id | ||
) external view returns (uint256 debt_); | ||
|
||
// cost basis of position on the market associated with feed | ||
function cost( | ||
address feed, | ||
address owner, | ||
uint256 id | ||
) external view returns (uint256 cost_); | ||
|
||
// open interest of position on the market associated with feed | ||
function oi( | ||
address feed, | ||
address owner, | ||
uint256 id | ||
) external view returns (uint256 oi_); | ||
|
||
// collateral backing position on the market associated with feed | ||
function collateral( | ||
address feed, | ||
address owner, | ||
uint256 id | ||
) external view returns (uint256 collateral_); | ||
|
||
// value of position on the market associated with feed | ||
function value( | ||
address feed, | ||
address owner, | ||
uint256 id | ||
) external view returns (uint256 value_); | ||
|
||
// notional of position on the market associated with feed | ||
function notional( | ||
address feed, | ||
address owner, | ||
uint256 id | ||
) external view returns (uint256 notional_); | ||
|
||
// trading fee charged to unwind position on the market associated with feed | ||
function tradingFee( | ||
address feed, | ||
address owner, | ||
uint256 id | ||
) external view returns (uint256 tradingFee_); | ||
|
||
// whether position is liquidatable on the market associated with feed | ||
function liquidatable( | ||
address feed, | ||
address owner, | ||
uint256 id | ||
) external view returns (bool liquidatable_); | ||
|
||
// liquidation fee rewarded to liquidator for position on market associated | ||
// with feed | ||
function liquidationFee( | ||
address feed, | ||
address owner, | ||
uint256 id | ||
) external view returns (uint256 liquidationFee_); | ||
|
||
// maintenance margin requirement for position on market associated with feed | ||
function maintenanceMargin( | ||
address feed, | ||
address owner, | ||
uint256 id | ||
) external view returns (uint256 maintenanceMargin_); | ||
|
||
// remaining margin before liquidation for position on market associated | ||
// with feed | ||
function marginExcessBeforeLiquidation( | ||
address feed, | ||
address owner, | ||
uint256 id | ||
) external view returns (int256 excess_); | ||
|
||
// liquidation price for position on market associated with feed | ||
function liquidationPrice( | ||
address feed, | ||
address owner, | ||
uint256 id | ||
) external view returns (uint256 liquidationPrice_); | ||
} |
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,42 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.10; | ||
|
||
import "./IOverlayV1BaseState.sol"; | ||
|
||
interface IOverlayV1PriceState is IOverlayV1BaseState { | ||
// bid on the market associated with the feed given new volume from fractionOfCapOi | ||
function bid(address feed, uint256 fractionOfCapOi) external view returns (uint256 bid_); | ||
|
||
// ask on the market associated with the feed given new volume from fractionOfCapOi | ||
function ask(address feed, uint256 fractionOfCapOi) external view returns (uint256 ask_); | ||
|
||
// mid on the market associated with the feed | ||
function mid(address feed) external view returns (uint256 mid_); | ||
|
||
// volume on the bid of the market associated with the feed given | ||
// new volume from fractionOfCapOi | ||
function volumeBid(address feed, uint256 fractionOfCapOi) | ||
external | ||
view | ||
returns (uint256 volumeBid_); | ||
|
||
// volume on the ask of the market associated with the feed given | ||
// new volume from fractionOfCapOi | ||
function volumeAsk(address feed, uint256 fractionOfCapOi) | ||
external | ||
view | ||
returns (uint256 volumeAsk_); | ||
|
||
// bid, ask, mid prices of the market associated with the feed | ||
function prices(address feed) | ||
external | ||
view | ||
returns ( | ||
uint256 bid_, | ||
uint256 ask_, | ||
uint256 mid_ | ||
); | ||
|
||
// bid, ask volumes of the market associated with the feed | ||
function volumes(address feed) external view returns (uint256 volumeBid_, uint256 volumeAsk_); | ||
} |
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