Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directory structure #4

Merged
merged 2 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions packages/panoptic-sdk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Panoptic SDK

Typescript SDK for Panoptic

## API

- Entities

- [x] `PanopticFactory`: The factory contract in the Panoptic protocol
- [x] `PanopticSemiFungiblePositionManager`: The semi-fungible position manager in the Panoptic protocol
- [x] `PanopticPool`
- [x] `PanopticPoolData`
- [x] `PanopticCollateral`
- [x] `PanopticCollateralData`
- [x] `PanopticPosition`
- [x] `PanopticPositionData`
- [x] `PanopticCollateralPosition`
- [x] `PanopticCollateralPositionData`

- Utilities

- [ ] `createPanopticPool`
- [ ] `createPanopticCollateral`
- [ ] `createPanopticPosition`
- [ ] `createPanopticCollateralPosition`
- [ ] `calculatePanopticMintOptions`
- [ ] `calculatePanopticRollOptions`
- [ ] `calculatePanopticBurnOptions`
- [ ] `calculatePanopticForceExercise`
- [ ] `calcuatePanopticLiquidateAccount`
- [ ] `calculatePanopticCollateralMint`
- [ ] `calculatePanopticCollateralDeposit`
- [ ] `calculatePanopticCollateralRedeem`
- [ ] `calculatePanopticCollateralWithdraw`

- Public Actions

- [ ] `getPanopticPool`
- [ ] `getPanopticPoolData`
- [ ] `getPanopticCollateral`
- [ ] `getPanopticCollateralData`
- [ ] `getPanopticCollateralPositionData`
- [ ] `getPanopticPositionData`

- Wallet Actions
- [ ] `simulatePanopticMintOptions`
- [ ] `simulatePanopticRollOptions`
- [ ] `simulatePanopticBurnOptions`
- [ ] `simulatePanopticForceExercise`
- [ ] `simulatePanopticLiquidateAccount`
- [ ] `simulatePanopticCollateralMint`
- [ ] `simulatePanopticCollateralDeposit`
- [ ] `simulatePanopticCollateralRedeem`
- [ ] `simulatePanopticCollateralWithdraw`

- Chains

- [ ] `sepoliaPanoptic`

- ABIs

- [ ] `panopticFactoryABI`
- [ ] `panopticCollateralTrackerABI`
- [ ] `panopticPoolABI`
- [ ] `panopticSemiFuniblePositionManagerABI`
6 changes: 3 additions & 3 deletions packages/panoptic-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
"viem": ">=1"
},
"devDependencies": {
"@biomejs/biome": "^1.1.2",
"@biomejs/biome": "^1.2.2",
"tsup": "^7.2.0",
"typescript": "^5.2.2",
"viem": "^1.10.13"
"viem": "^1.11.1"
},
"dependencies": {
"reverse-mirage": "^0.1.11",
"reverse-mirage": "1.0.0-next.0",
"tiny-invariant": "^1.3.1",
"uniswap-v3-sdk": "workspace:*"
}
Expand Down
Empty file.
2 changes: 2 additions & 0 deletions packages/panoptic-sdk/src/types/PanopticFactory.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { WETH } from "reverse-mirage";
import type { UniswapV3Factory } from "uniswap-v3-sdk";
import type { Address } from "viem/accounts";

Expand All @@ -6,5 +7,6 @@ export type PanopticFactory = {
address: Address;
owner: Address;
uniswapFactory: UniswapV3Factory;
weth: WETH;
blockCreated: bigint;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { UniswapV3Factory } from "uniswap-v3-sdk";
import type { Address } from "viem/accounts";

export type PanopticSemiFungiblePositionManager = {
type: "panopticSemiFungiblePositionManager";
address: Address;
uniswapFactory: UniswapV3Factory;
blockCreated: bigint;
};
1 change: 1 addition & 0 deletions packages/panoptic-sdk/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ export type {
PanopticPosition,
PanopticPositionData,
} from "./PanopticPosition.js";
export type { PanopticSemiFungiblePositionManager } from "./PanopticSemiFungiblePositionManager.js";
Empty file.
44 changes: 37 additions & 7 deletions packages/uniswap-v3-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,46 @@

Typescript SDK for Uniswap V3

## Features
## API

- [ ] **`UniswapV3Pool.sol`**
- Entities

- [ ] Read and parse from contracts
- [ ] Replicate math
- [ ] Simulate transactions
- [ ] Send state modifying transactions
- [x] `UniswapV3Factory`: The factory contract in the Uniswap protocol
- [x] `UniswapV3Pool`: A pool created by `UniswapV3Factory`
- [x] `UniswapV3PoolData`: The state of a `UniswapV3Pool`
- [x] `UniswapV3Tick`: A tick in a `UniswapV3Pool`
- [x] `UniswapV3TickData`: The state of a `UniswapV3Tick`
- [x] `UniswapV3Position`: A user position in a `UniswapV3Pool`
- [x] `UniswapV3PositionData`: The state of a `UniswapV3Position`

- [ ] **`NonFungiblePositionManager.sol`**
- Utilities

- [x] `createUniswapV3Pool`
- [x] `createUniswapV3Tick`
- [x] `createUniswapV3Position`
- [x] `calculateUniswapV3PositionID`
- [x] `calculateUniswapV3PoolMint`
- [x] `calculateUniswapV3PoolBurn`
- [x] `calculateUniswapV3PoolSwap`
- [x] `q128ToFraction`
- [x] `fractionToQ128`
- [x] `q96ToFraction`
- [x] `fractionToQ96`

- Public Actions

- [x] `getUniswapV3PoolData`
- [x] `getUniswapV3TickData`
- [x] `getUniswapV3PositionData`

- Chains

- [x] `mainnetUniswapV3`

- ABIs

- [x] `uniswapV3FactoryABI`
- [x] `uniswapV3PoolABI`

## Comparisons

Expand Down
10 changes: 5 additions & 5 deletions packages/uniswap-v3-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@
"viem": ">=1"
},
"devDependencies": {
"@biomejs/biome": "^1.1.2",
"@biomejs/biome": "^1.2.2",
"@uniswap/sdk-core": "^4.0.7",
"@uniswap/v3-sdk": "^3.10.0",
"@vitest/coverage-v8": "^0.34.4",
"@vitest/coverage-v8": "^0.34.5",
"tsup": "^7.2.0",
"typescript": "^5.2.2",
"viem": "^1.10.13",
"vitest": "^0.34.4"
"viem": "^1.11.1",
"vitest": "^0.34.5"
},
"dependencies": {
"reverse-mirage": "^0.1.11",
"reverse-mirage": "1.0.0-next.0",
"tiny-invariant": "^1.3.1"
}
}
134 changes: 134 additions & 0 deletions packages/uniswap-v3-sdk/src/abi/uniswapV3FactoryABI.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
export const uniswapV3FactoryABI = [
{ stateMutability: "nonpayable", type: "constructor", inputs: [] },
{
type: "event",
anonymous: false,
inputs: [
{ name: "fee", internalType: "uint24", type: "uint24", indexed: true },
{
name: "tickSpacing",
internalType: "int24",
type: "int24",
indexed: true,
},
],
name: "FeeAmountEnabled",
},
{
type: "event",
anonymous: false,
inputs: [
{
name: "oldOwner",
internalType: "address",
type: "address",
indexed: true,
},
{
name: "newOwner",
internalType: "address",
type: "address",
indexed: true,
},
],
name: "OwnerChanged",
},
{
type: "event",
anonymous: false,
inputs: [
{
name: "token0",
internalType: "address",
type: "address",
indexed: true,
},
{
name: "token1",
internalType: "address",
type: "address",
indexed: true,
},
{ name: "fee", internalType: "uint24", type: "uint24", indexed: true },
{
name: "tickSpacing",
internalType: "int24",
type: "int24",
indexed: false,
},
{
name: "pool",
internalType: "address",
type: "address",
indexed: false,
},
],
name: "PoolCreated",
},
{
stateMutability: "nonpayable",
type: "function",
inputs: [
{ name: "tokenA", internalType: "address", type: "address" },
{ name: "tokenB", internalType: "address", type: "address" },
{ name: "fee", internalType: "uint24", type: "uint24" },
],
name: "createPool",
outputs: [{ name: "pool", internalType: "address", type: "address" }],
},
{
stateMutability: "nonpayable",
type: "function",
inputs: [
{ name: "fee", internalType: "uint24", type: "uint24" },
{ name: "tickSpacing", internalType: "int24", type: "int24" },
],
name: "enableFeeAmount",
outputs: [],
},
{
stateMutability: "view",
type: "function",
inputs: [{ name: "", internalType: "uint24", type: "uint24" }],
name: "feeAmountTickSpacing",
outputs: [{ name: "", internalType: "int24", type: "int24" }],
},
{
stateMutability: "view",
type: "function",
inputs: [
{ name: "", internalType: "address", type: "address" },
{ name: "", internalType: "address", type: "address" },
{ name: "", internalType: "uint24", type: "uint24" },
],
name: "getPool",
outputs: [{ name: "", internalType: "address", type: "address" }],
},
{
stateMutability: "view",
type: "function",
inputs: [],
name: "owner",
outputs: [{ name: "", internalType: "address", type: "address" }],
},
{
stateMutability: "view",
type: "function",
inputs: [],
name: "parameters",
outputs: [
{ name: "factory", internalType: "address", type: "address" },
{ name: "token0", internalType: "address", type: "address" },
{ name: "token1", internalType: "address", type: "address" },
{ name: "fee", internalType: "uint24", type: "uint24" },
{ name: "tickSpacing", internalType: "int24", type: "int24" },
],
},
{
stateMutability: "nonpayable",
type: "function",
inputs: [{ name: "_owner", internalType: "address", type: "address" }],
name: "setOwner",
outputs: [],
},
] as const;
Loading