Skip to content

Commit

Permalink
dir layout
Browse files Browse the repository at this point in the history
  • Loading branch information
kyscott18 committed Sep 20, 2023
1 parent 448052c commit 74e42bb
Show file tree
Hide file tree
Showing 63 changed files with 110 additions and 98 deletions.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
98 changes: 0 additions & 98 deletions packages/panoptic-sdk/src/types.ts

This file was deleted.

30 changes: 30 additions & 0 deletions packages/panoptic-sdk/src/types/PanopticCollateral.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import type { BaseERC20, ERC20Amount, Fraction } from "reverse-mirage";

export type PanopticCollateral = BaseERC20<"poERC20"> & {
underlyingToken: BaseERC20;
};

export type PanopticCollateralParamters = {
type: "panopticCollateralParameters";
maintenanceMarginRatio: Fraction;
commissionFee: Fraction;
ITMSpreadFee: Fraction;
sellCollateralRatio: Fraction;
buyCollateralRatio: Fraction;
targetPoolUtilization: Fraction;
saturatedPoolUtilization: Fraction;
exerciseCost: Fraction;
};

export type PanopticCollateralPositionData = ERC20Amount<PanopticCollateral> & {
// position array
};

export type PanopticCollateralData = {
type: "panopticCollateralData";
collateral: PanopticCollateral;
parameters: PanopticCollateralParamters;
poolAssets: ERC20Amount<BaseERC20>;
inAmm: ERC20Amount<BaseERC20>;
totalSupply: ERC20Amount<BaseERC20>;
};
10 changes: 10 additions & 0 deletions packages/panoptic-sdk/src/types/PanopticFactory.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { UniswapV3Factory } from "uniswap-v3-sdk";
import type { Address } from "viem/accounts";

export type PanopticFactory = {
type: "panopticFactory";
address: Address;
owner: Address;
uniswapFactory: UniswapV3Factory;
blockCreated: bigint;
};
24 changes: 24 additions & 0 deletions packages/panoptic-sdk/src/types/PanopticPool.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { UniswapV3Pool, UniswapV3PoolData } from "uniswap-v3-sdk";
import type { Address } from "viem/accounts";
import type {
PanopticCollateral,
PanopticCollateralData,
} from "./PanopticCollateral.js";
import type { PanopticFactory } from "./PanopticFactory.js";

export type PanopticPool = {
type: "panopticPool";
uniswapPool: UniswapV3Pool;
factory: PanopticFactory;
collateralTracker0: PanopticCollateral;
collateralTracker1: PanopticCollateral;
address: Address;
blockCreated: bigint;
};

export type PanopticPoolData = {
type: "panopticPoolData";
panopticPool: PanopticPool;
uniswapPoolData: UniswapV3PoolData;
collateralTracker0Data: PanopticCollateralData;
};
33 changes: 33 additions & 0 deletions packages/panoptic-sdk/src/types/PanopticPosition.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import type { ERC1155, ERC1155Data, Fraction, Tuple } from "reverse-mirage";
import type { UniswapV3Tick } from "uniswap-v3-sdk";
import type { Address } from "viem/accounts";
import type { PanopticPool } from "./PanopticPool.js";

type PanoptionLeg = {
asset: "token0" | "token1";
optionRatio: number;
position: "long" | "short";
riskPartnerIndex: 0 | 1 | 2 | 3;
tickLower: UniswapV3Tick;
tickUpper: UniswapV3Tick;
};

export type PanopticPosition = ERC1155 & {
type: "panopticPosition";
pool: PanopticPool;
owner: Address;
legs: Tuple<PanoptionLeg, 4>;
};

export type PanopticPositionData = ERC1155Data<PanopticPosition> & {
liquidityAdded: bigint;
liquidityRemoved: bigint;
accountPremiumOwed0: bigint;
accountPremiumOwed1: bigint;
accountPremiumGross0: bigint;
accountPremiumGross1: bigint;
baseFee0: bigint;
baseFee1: bigint;
token0Utilization: Fraction;
token1Utilization: Fraction;
};
12 changes: 12 additions & 0 deletions packages/panoptic-sdk/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export type {
PanopticCollateral,
PanopticCollateralData,
PanopticCollateralParamters,
PanopticCollateralPositionData,
} from "./PanopticCollateral.js";
export type { PanopticFactory } from "./PanopticFactory.js";
export type { PanopticPool, PanopticPoolData } from "./PanopticPool.js";
export type {
PanopticPosition,
PanopticPositionData,
} from "./PanopticPosition.js";
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
1 change: 1 addition & 0 deletions packages/uniswap-v3-sdk/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ src/generated.ts
# build
dist/
coverage/
.DS_Store

0 comments on commit 74e42bb

Please sign in to comment.