@nradko/metric-omm-sdk-v1 0.2.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +123 -49
- package/dist/abis/DepositAllowlistExtension.d.ts +440 -0
- package/dist/abis/DepositAllowlistExtension.d.ts.map +1 -0
- package/dist/abis/DepositAllowlistExtension.js +572 -0
- package/dist/abis/DepositAllowlistExtension.js.map +1 -0
- package/dist/abis/MetricOmmPool.d.ts +150 -30
- package/dist/abis/MetricOmmPool.d.ts.map +1 -1
- package/dist/abis/MetricOmmPool.js +186 -34
- package/dist/abis/MetricOmmPool.js.map +1 -1
- package/dist/abis/MetricOmmPoolDataProvider.d.ts +1 -137
- package/dist/abis/MetricOmmPoolDataProvider.d.ts.map +1 -1
- package/dist/abis/MetricOmmPoolDataProvider.js +1 -178
- package/dist/abis/MetricOmmPoolDataProvider.js.map +1 -1
- package/dist/abis/MetricOmmPoolFactory.d.ts +76 -18
- package/dist/abis/MetricOmmPoolFactory.d.ts.map +1 -1
- package/dist/abis/MetricOmmPoolFactory.js +93 -19
- package/dist/abis/MetricOmmPoolFactory.js.map +1 -1
- package/dist/abis/MetricOmmPoolLiquidityAdder.d.ts +68 -8
- package/dist/abis/MetricOmmPoolLiquidityAdder.d.ts.map +1 -1
- package/dist/abis/MetricOmmPoolLiquidityAdder.js +85 -9
- package/dist/abis/MetricOmmPoolLiquidityAdder.js.map +1 -1
- package/dist/abis/MetricOmmPoolStateView.d.ts +238 -0
- package/dist/abis/MetricOmmPoolStateView.d.ts.map +1 -0
- package/dist/abis/MetricOmmPoolStateView.js +315 -0
- package/dist/abis/MetricOmmPoolStateView.js.map +1 -0
- package/dist/abis/MetricOmmSimpleRouter.d.ts +619 -0
- package/dist/abis/MetricOmmSimpleRouter.d.ts.map +1 -0
- package/dist/abis/MetricOmmSimpleRouter.js +805 -0
- package/dist/abis/MetricOmmSimpleRouter.js.map +1 -0
- package/dist/abis/MetricOmmSwapQuoter.d.ts +576 -0
- package/dist/abis/MetricOmmSwapQuoter.d.ts.map +1 -0
- package/dist/abis/MetricOmmSwapQuoter.js +748 -0
- package/dist/abis/MetricOmmSwapQuoter.js.map +1 -0
- package/dist/abis/OracleProvider.d.ts +106 -0
- package/dist/abis/OracleProvider.d.ts.map +1 -0
- package/dist/abis/OracleProvider.js +62 -0
- package/dist/abis/OracleProvider.js.map +1 -0
- package/dist/abis/OracleValueStopLossExtension.d.ts +936 -0
- package/dist/abis/{MetricOmmPoolSwapper.d.ts.map → OracleValueStopLossExtension.d.ts.map} +1 -1
- package/dist/abis/OracleValueStopLossExtension.js +1214 -0
- package/dist/abis/OracleValueStopLossExtension.js.map +1 -0
- package/dist/abis/PriceProvider.d.ts +6 -112
- package/dist/abis/PriceProvider.d.ts.map +1 -1
- package/dist/abis/PriceProvider.js +6 -143
- package/dist/abis/PriceProvider.js.map +1 -1
- package/dist/abis/PriceVelocityGuardExtension.d.ts +454 -0
- package/dist/abis/PriceVelocityGuardExtension.d.ts.map +1 -0
- package/dist/abis/PriceVelocityGuardExtension.js +590 -0
- package/dist/abis/PriceVelocityGuardExtension.js.map +1 -0
- package/dist/abis/SwapAllowlistExtension.d.ts +440 -0
- package/dist/abis/{PriceProviderUi.d.ts.map → SwapAllowlistExtension.d.ts.map} +1 -1
- package/dist/abis/SwapAllowlistExtension.js +572 -0
- package/dist/abis/SwapAllowlistExtension.js.map +1 -0
- package/dist/abis/index.d.ts +8 -2
- package/dist/abis/index.d.ts.map +1 -1
- package/dist/abis/index.js +8 -2
- package/dist/abis/index.js.map +1 -1
- package/dist/addresses.d.ts +16 -9
- package/dist/addresses.d.ts.map +1 -1
- package/dist/addresses.js +33 -16
- package/dist/addresses.js.map +1 -1
- package/dist/constants.d.ts +4 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +7 -2
- package/dist/constants.js.map +1 -1
- package/dist/extensions/admin/depositAllowlist.d.ts +8 -0
- package/dist/extensions/admin/depositAllowlist.d.ts.map +1 -0
- package/dist/extensions/admin/depositAllowlist.js +10 -0
- package/dist/extensions/admin/depositAllowlist.js.map +1 -0
- package/dist/extensions/admin/oracleStopLoss.d.ts +56 -0
- package/dist/extensions/admin/oracleStopLoss.d.ts.map +1 -0
- package/dist/extensions/admin/oracleStopLoss.js +87 -0
- package/dist/extensions/admin/oracleStopLoss.js.map +1 -0
- package/dist/extensions/admin/priceVelocityGuard.d.ts +12 -0
- package/dist/extensions/admin/priceVelocityGuard.d.ts.map +1 -0
- package/dist/extensions/admin/priceVelocityGuard.js +17 -0
- package/dist/extensions/admin/priceVelocityGuard.js.map +1 -0
- package/dist/extensions/admin/swapAllowlist.d.ts +8 -0
- package/dist/extensions/admin/swapAllowlist.d.ts.map +1 -0
- package/dist/extensions/admin/swapAllowlist.js +10 -0
- package/dist/extensions/admin/swapAllowlist.js.map +1 -0
- package/dist/extensions/index.d.ts +8 -0
- package/dist/extensions/index.d.ts.map +1 -0
- package/dist/extensions/index.js +8 -0
- package/dist/extensions/index.js.map +1 -0
- package/dist/extensions/init/index.d.ts +13 -0
- package/dist/extensions/init/index.d.ts.map +1 -0
- package/dist/extensions/init/index.js +12 -0
- package/dist/extensions/init/index.js.map +1 -0
- package/dist/extensions/orders.d.ts +7 -0
- package/dist/extensions/orders.d.ts.map +1 -0
- package/dist/extensions/orders.js +24 -0
- package/dist/extensions/orders.js.map +1 -0
- package/dist/extensions/types.d.ts +23 -0
- package/dist/extensions/types.d.ts.map +1 -0
- package/dist/extensions/types.js +10 -0
- package/dist/extensions/types.js.map +1 -0
- package/dist/index.d.ts +7 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/oracle/index.d.ts +5 -0
- package/dist/oracle/index.d.ts.map +1 -0
- package/dist/oracle/index.js +5 -0
- package/dist/oracle/index.js.map +1 -0
- package/dist/oracle/registry.d.ts +53 -0
- package/dist/oracle/registry.d.ts.map +1 -0
- package/dist/oracle/registry.js +70 -0
- package/dist/oracle/registry.js.map +1 -0
- package/dist/pool/create.d.ts +11 -6
- package/dist/pool/create.d.ts.map +1 -1
- package/dist/pool/create.js +5 -3
- package/dist/pool/create.js.map +1 -1
- package/dist/pool/index.d.ts +1 -1
- package/dist/pool/index.d.ts.map +1 -1
- package/dist/pool/index.js.map +1 -1
- package/dist/pool/liquidity.d.ts +13 -5
- package/dist/pool/liquidity.d.ts.map +1 -1
- package/dist/pool/liquidity.js +25 -10
- package/dist/pool/liquidity.js.map +1 -1
- package/dist/pool/read.d.ts +0 -6
- package/dist/pool/read.d.ts.map +1 -1
- package/dist/pool/read.js +21 -14
- package/dist/pool/read.js.map +1 -1
- package/dist/quoter/index.d.ts +6 -0
- package/dist/quoter/index.d.ts.map +1 -0
- package/dist/quoter/index.js +6 -0
- package/dist/quoter/index.js.map +1 -0
- package/dist/quoter/quote.d.ts +58 -0
- package/dist/quoter/quote.d.ts.map +1 -0
- package/dist/quoter/quote.js +74 -0
- package/dist/quoter/quote.js.map +1 -0
- package/dist/quoter/quotePath.d.ts +65 -0
- package/dist/quoter/quotePath.d.ts.map +1 -0
- package/dist/quoter/quotePath.js +108 -0
- package/dist/quoter/quotePath.js.map +1 -0
- package/dist/router/index.d.ts +2 -1
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/index.js +2 -1
- package/dist/router/index.js.map +1 -1
- package/dist/router/swap.d.ts +37 -92
- package/dist/router/swap.d.ts.map +1 -1
- package/dist/router/swap.js +97 -299
- package/dist/router/swap.js.map +1 -1
- package/dist/router/swapPath.d.ts +56 -0
- package/dist/router/swapPath.d.ts.map +1 -0
- package/dist/router/swapPath.js +98 -0
- package/dist/router/swapPath.js.map +1 -0
- package/dist/swap/path.d.ts +13 -0
- package/dist/swap/path.d.ts.map +1 -0
- package/dist/swap/path.js +74 -0
- package/dist/swap/path.js.map +1 -0
- package/dist/types.d.ts +3 -4
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -7
- package/src/abis/DepositAllowlistExtension.ts +571 -0
- package/src/abis/MetricOmmPool.ts +186 -34
- package/src/abis/MetricOmmPoolDataProvider.ts +1 -178
- package/src/abis/MetricOmmPoolFactory.ts +93 -19
- package/src/abis/MetricOmmPoolLiquidityAdder.ts +85 -9
- package/src/abis/MetricOmmPoolStateView.ts +314 -0
- package/src/abis/MetricOmmSimpleRouter.ts +804 -0
- package/src/abis/MetricOmmSwapQuoter.ts +747 -0
- package/src/abis/OracleProvider.ts +61 -0
- package/src/abis/OracleValueStopLossExtension.ts +1213 -0
- package/src/abis/PriceProvider.ts +6 -143
- package/src/abis/PriceVelocityGuardExtension.ts +589 -0
- package/src/abis/SwapAllowlistExtension.ts +571 -0
- package/src/abis/index.ts +8 -2
- package/src/addresses.ts +47 -21
- package/src/constants.ts +7 -2
- package/src/extensions/admin/depositAllowlist.ts +16 -0
- package/src/extensions/admin/oracleStopLoss.ts +141 -0
- package/src/extensions/admin/priceVelocityGuard.ts +27 -0
- package/src/extensions/admin/swapAllowlist.ts +16 -0
- package/src/extensions/index.ts +31 -0
- package/src/extensions/init/index.ts +21 -0
- package/src/extensions/orders.ts +33 -0
- package/src/extensions/types.ts +33 -0
- package/src/index.ts +95 -23
- package/src/oracle/index.ts +14 -0
- package/src/oracle/registry.ts +146 -0
- package/src/pool/create.ts +12 -8
- package/src/pool/index.ts +1 -0
- package/src/pool/liquidity.ts +41 -15
- package/src/pool/read.ts +34 -16
- package/src/quoter/index.ts +28 -0
- package/src/quoter/quote.ts +193 -0
- package/src/quoter/quotePath.ts +240 -0
- package/src/router/index.ts +24 -25
- package/src/router/swap.ts +143 -481
- package/src/router/swapPath.ts +181 -0
- package/src/swap/path.ts +107 -0
- package/src/types.ts +3 -4
- package/dist/abis/MetricOmmPoolSwapper.d.ts +0 -917
- package/dist/abis/MetricOmmPoolSwapper.js +0 -1185
- package/dist/abis/MetricOmmPoolSwapper.js.map +0 -1
- package/dist/abis/PriceProviderUi.d.ts +0 -433
- package/dist/abis/PriceProviderUi.js +0 -318
- package/dist/abis/PriceProviderUi.js.map +0 -1
- package/src/abis/MetricOmmPoolSwapper.ts +0 -1184
- package/src/abis/PriceProviderUi.ts +0 -317
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @nradko/metric-omm-sdk-v1
|
|
2
2
|
|
|
3
|
-
TypeScript SDK for **v1** Metric OMM contracts: **
|
|
3
|
+
TypeScript SDK for **v1** Metric OMM contracts: **SimpleRouter**, **SwapQuoter**, **LiquidityAdder**, pool `addLiquidity` / `removeLiquidity`, **extensions**, and factory-backed reads.
|
|
4
4
|
|
|
5
|
-
Pinned
|
|
5
|
+
Pinned **metric-periphery** `dccbda7970da36d55a86108e3dbcce1e794c9634` (core via periphery `lib/metric-core`).
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -16,72 +16,150 @@ Or via the combined package:
|
|
|
16
16
|
import { v1 } from "@nradko/metric-omm-sdk";
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
## Ethereum mainnet addresses
|
|
19
|
+
## Ethereum mainnet and Base addresses
|
|
20
|
+
|
|
21
|
+
Protocol contracts use the **same addresses** on Ethereum mainnet and Base (CREATE2). Wrapped native differs per chain (WETH).
|
|
20
22
|
|
|
21
23
|
| Contract | Address |
|
|
22
24
|
| -------- | ------- |
|
|
23
|
-
| MetricOmmPoolFactory | `
|
|
24
|
-
| MetricOmmPoolDeployer | `
|
|
25
|
-
| MetricOmmPoolLiquidityAdder | `
|
|
26
|
-
| MetricOmmPoolDataProvider | `
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
| MetricOmmPoolFactory | `0x567C7205107257650dC73a73d87b879a45F5b6F6` |
|
|
26
|
+
| MetricOmmPoolDeployer | `0xBe34D0cEb6CF1acbf55dEf35E4dC3e17BDfb6AE4` |
|
|
27
|
+
| MetricOmmPoolLiquidityAdder | `0x323B95ABcE8b3025829980bb19d1Fd819808FCB2` |
|
|
28
|
+
| MetricOmmPoolDataProvider | `0x5A100da447833D94b8e50AeD1916D7488D15D3fc` |
|
|
29
|
+
| MetricOmmSimpleRouter | `0x18f85056444452E718cD680A08f219B2347FE672` |
|
|
30
|
+
| DepositAllowlistExtension | `0x088B0CCBdb17531132173a30428f66c1d5A73794` |
|
|
31
|
+
| SwapAllowlistExtension | `0x952D844e166E6FAaF73a5e56F0fB0C54543a0f69` |
|
|
32
|
+
| OracleValueStopLossExtension | `0x9694959a452283d86eBF4EF4eB5651dEAa1eCec1` |
|
|
33
|
+
| PriceVelocityGuardExtension | `0xa53E5db6c18Ce258b3090F1470c5fE7f2e0215Fc` |
|
|
34
|
+
| WETH (Ethereum) | `0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2` |
|
|
35
|
+
| WETH (Base) | `0x4200000000000000000000000000000000000006` |
|
|
36
|
+
|
|
37
|
+
`addresses.quoter` is a zero placeholder until a public SwapQuoter deployment is wired in this SDK release. Pass `quoterAddress` to quote helpers or set the bundled address when available.
|
|
38
|
+
|
|
39
|
+
`MetricOmmPoolDataProvider` is the deployed lens: pool reads (`slot0`, `binStates`, `positionBinShares`, …). Pass `addresses.dataProvider` to read helpers and liquidity builders (`dataProviderAddress` param).
|
|
33
40
|
|
|
34
41
|
```typescript
|
|
35
42
|
import { getAddressesOrThrow, ChainId, isChainSupported } from "@nradko/metric-omm-sdk-v1";
|
|
36
43
|
|
|
37
44
|
const a = getAddressesOrThrow(ChainId.ETHEREUM);
|
|
38
|
-
//
|
|
45
|
+
// getAddressesOrThrow(ChainId.BASE) — same protocol addresses as Ethereum
|
|
46
|
+
// isChainSupported(ChainId.ARBITRUM) === false — use DeployedChainId / getSupportedChainIds()
|
|
39
47
|
```
|
|
40
48
|
|
|
41
|
-
|
|
49
|
+
ChainId lists future chain IDs for typing; **Ethereum mainnet and Base** have entries in ADDRESSES for this release.
|
|
50
|
+
|
|
51
|
+
## Swaps (SimpleRouter)
|
|
42
52
|
|
|
43
|
-
|
|
53
|
+
### Single hop
|
|
44
54
|
|
|
45
55
|
```typescript
|
|
46
56
|
import {
|
|
47
|
-
|
|
57
|
+
buildExactInputSingleParams,
|
|
48
58
|
getAddressesOrThrow,
|
|
49
59
|
ChainId,
|
|
50
60
|
} from "@nradko/metric-omm-sdk-v1";
|
|
51
|
-
import {
|
|
61
|
+
import { MetricOmmSimpleRouterAbi } from "@nradko/metric-omm-sdk-v1/abis";
|
|
52
62
|
|
|
53
63
|
const addresses = getAddressesOrThrow(ChainId.ETHEREUM);
|
|
54
64
|
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
});
|
|
65
|
+
const params = await buildExactInputSingleParams({
|
|
66
|
+
publicClient,
|
|
67
|
+
pool: poolAddress,
|
|
68
|
+
tokenIn,
|
|
69
|
+
tokenOut,
|
|
70
|
+
recipient: account,
|
|
71
|
+
amountIn: 1_000_000_000_000_000_000n,
|
|
72
|
+
slippagePercent: 0.5,
|
|
73
|
+
deadline: BigInt(Math.floor(Date.now() / 1000) + 1200),
|
|
74
|
+
quoterAddress, // required until addresses.quoter is set
|
|
75
|
+
});
|
|
67
76
|
|
|
68
77
|
await walletClient.writeContract({
|
|
69
|
-
address: addresses.
|
|
70
|
-
abi:
|
|
71
|
-
functionName: "
|
|
72
|
-
args,
|
|
78
|
+
address: addresses.simpleRouter,
|
|
79
|
+
abi: MetricOmmSimpleRouterAbi,
|
|
80
|
+
functionName: "exactInputSingle",
|
|
81
|
+
args: [params],
|
|
82
|
+
account,
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Multihop
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
import { buildExactInputParams, encodeExactInputCalldata } from "@nradko/metric-omm-sdk-v1";
|
|
90
|
+
|
|
91
|
+
const pathParams = await buildExactInputParams({
|
|
92
|
+
publicClient,
|
|
93
|
+
tokenIn,
|
|
94
|
+
tokenOut,
|
|
95
|
+
pools: [poolA, poolB],
|
|
96
|
+
recipient: account,
|
|
97
|
+
amountIn,
|
|
98
|
+
slippagePercent: 0.5,
|
|
99
|
+
deadline,
|
|
100
|
+
quoterAddress,
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
await walletClient.sendTransaction({
|
|
104
|
+
to: addresses.simpleRouter,
|
|
105
|
+
data: encodeExactInputCalldata(pathParams),
|
|
73
106
|
account,
|
|
74
107
|
});
|
|
75
108
|
```
|
|
76
109
|
|
|
77
|
-
|
|
110
|
+
Approve the **SimpleRouter** for input tokens (ERC-20 path). Swap allowlist extensions gate the **router contract address**, not the end-user EOA.
|
|
111
|
+
|
|
112
|
+
## Quotes (SwapQuoter)
|
|
113
|
+
|
|
114
|
+
Live quotes simulate the quoter contract (eth_call). Pass `quoterAddress` when `addresses.quoter` is unset.
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
import { quoteLiveExactInSingle, quoteLiveExactIn } from "@nradko/metric-omm-sdk-v1";
|
|
118
|
+
|
|
119
|
+
const single = await quoteLiveExactInSingle({
|
|
120
|
+
publicClient,
|
|
121
|
+
pool: poolAddress,
|
|
122
|
+
tokenIn,
|
|
123
|
+
tokenOut,
|
|
124
|
+
recipient: account,
|
|
125
|
+
amountIn,
|
|
126
|
+
quoterAddress,
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
const path = await quoteLiveExactIn({
|
|
130
|
+
publicClient,
|
|
131
|
+
tokenIn,
|
|
132
|
+
tokenOut,
|
|
133
|
+
pools: [poolA, poolB],
|
|
134
|
+
recipient: account,
|
|
135
|
+
amountIn,
|
|
136
|
+
quoterAddress,
|
|
137
|
+
});
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Hypothetical quotes: `quoteHypotheticalExactInputSingle`, `quoteHypotheticalExactInput`, and exact-output variants with per-pool bid/ask prices.
|
|
78
141
|
|
|
79
142
|
## Liquidity
|
|
80
143
|
|
|
81
144
|
- **Add (EOA):** approve **LiquidityAdder**, then `addLiquidityExactShares` / `addLiquidityWeighted` on the adder (see `encodeAddLiquidity*` helpers).
|
|
82
145
|
- **Remove:** `removeLiquidity` on the pool — build deltas with `buildModifyLiquidityArgsForRemoval` / `encodeRemoveLiquidityCalldata`.
|
|
83
146
|
|
|
84
|
-
|
|
147
|
+
## Extensions
|
|
148
|
+
|
|
149
|
+
Pools support up to seven **extensions** (periphery contracts) configured at creation via `extensions`, `extensionOrders`, and `extensionInitData`. Swap and liquidity encoders forward optional **`extensionData`** (defaults to `0x`).
|
|
150
|
+
|
|
151
|
+
See extension admin encoders (`encodeSetAllowedToDepositCalldata`, `encodeSetAllowedToSwapCalldata`, …) and [HOW_TO.md](../metric-omm-sdk/HOW_TO.md) for pool-creation examples.
|
|
152
|
+
|
|
153
|
+
## Oracle registration
|
|
154
|
+
|
|
155
|
+
For providers-oracle price feeds, register pools before attributed reads:
|
|
156
|
+
|
|
157
|
+
```typescript
|
|
158
|
+
import { getPoolOracleStatus, registerPool } from "@nradko/metric-omm-sdk-v1";
|
|
159
|
+
|
|
160
|
+
const status = await getPoolOracleStatus(publicClient, oracleAddress, feedId, poolAddress);
|
|
161
|
+
await registerPool({ publicClient, walletClient, oracleAddress, feedId, pool: poolAddress, factory, account });
|
|
162
|
+
```
|
|
85
163
|
|
|
86
164
|
## Pool reads
|
|
87
165
|
|
|
@@ -100,8 +178,14 @@ const slot0 = await getSlot0(publicClient, addresses.dataProvider, poolAddress);
|
|
|
100
178
|
import {
|
|
101
179
|
MetricOmmPoolAbi,
|
|
102
180
|
MetricOmmPoolDataProviderAbi,
|
|
103
|
-
|
|
181
|
+
MetricOmmSimpleRouterAbi,
|
|
182
|
+
MetricOmmSwapQuoterAbi,
|
|
104
183
|
MetricOmmPoolLiquidityAdderAbi,
|
|
184
|
+
DepositAllowlistExtensionAbi,
|
|
185
|
+
SwapAllowlistExtensionAbi,
|
|
186
|
+
PriceVelocityGuardExtensionAbi,
|
|
187
|
+
OracleValueStopLossExtensionAbi,
|
|
188
|
+
OracleProviderAbi,
|
|
105
189
|
} from "@nradko/metric-omm-sdk-v1/abis";
|
|
106
190
|
```
|
|
107
191
|
|
|
@@ -111,30 +195,20 @@ Regenerate from pinned contracts:
|
|
|
111
195
|
npm run setup:contracts # init submodules, hardhat build, sync ABIs
|
|
112
196
|
```
|
|
113
197
|
|
|
114
|
-
All pinned contracts (including `MetricOmmPoolDataProvider`) are compiled by Hardhat from the pinned `@metric/core` and `@metric/periphery` git dependencies (periphery remappings use core's libs via `lib/metric-core`).
|
|
115
|
-
|
|
116
198
|
## Development
|
|
117
199
|
|
|
118
200
|
```bash
|
|
119
201
|
npm run build # tsc only (default prepare)
|
|
120
202
|
npm run setup:contracts # refresh ABIs from pinned git deps (maintainers)
|
|
121
203
|
npm test # Hardhat tests (needs matching @metric/* in node_modules)
|
|
204
|
+
npm run verify # lint, format, typecheck, test — publish gate
|
|
122
205
|
```
|
|
123
206
|
|
|
124
|
-
In the monorepo, run v1 tests with an isolated install (same pattern as v0):
|
|
125
|
-
|
|
126
207
|
```bash
|
|
127
|
-
# from dev_sdk/
|
|
128
208
|
cd v1
|
|
129
209
|
npm ci
|
|
130
|
-
npm run
|
|
210
|
+
npm run setup:contracts
|
|
131
211
|
npm test
|
|
132
212
|
```
|
|
133
213
|
|
|
134
|
-
## Tests
|
|
135
|
-
|
|
136
|
-
```bash
|
|
137
|
-
npm run sync:contracts && npm test
|
|
138
|
-
```
|
|
139
|
-
|
|
140
214
|
Fork tests: set `ETHEREUM_RPC_URL` (optional `ETHEREUM_FORK_BLOCK_NUMBER`).
|
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
export declare const DepositAllowlistExtensionAbi: readonly [{
|
|
2
|
+
readonly inputs: readonly [{
|
|
3
|
+
readonly internalType: "address";
|
|
4
|
+
readonly name: "factory_";
|
|
5
|
+
readonly type: "address";
|
|
6
|
+
}];
|
|
7
|
+
readonly stateMutability: "nonpayable";
|
|
8
|
+
readonly type: "constructor";
|
|
9
|
+
}, {
|
|
10
|
+
readonly inputs: readonly [];
|
|
11
|
+
readonly name: "ExtensionNotImplemented";
|
|
12
|
+
readonly type: "error";
|
|
13
|
+
}, {
|
|
14
|
+
readonly inputs: readonly [];
|
|
15
|
+
readonly name: "NotAllowedToDeposit";
|
|
16
|
+
readonly type: "error";
|
|
17
|
+
}, {
|
|
18
|
+
readonly inputs: readonly [{
|
|
19
|
+
readonly internalType: "address";
|
|
20
|
+
readonly name: "caller";
|
|
21
|
+
readonly type: "address";
|
|
22
|
+
}, {
|
|
23
|
+
readonly internalType: "address";
|
|
24
|
+
readonly name: "factory";
|
|
25
|
+
readonly type: "address";
|
|
26
|
+
}];
|
|
27
|
+
readonly name: "OnlyFactory";
|
|
28
|
+
readonly type: "error";
|
|
29
|
+
}, {
|
|
30
|
+
readonly inputs: readonly [{
|
|
31
|
+
readonly internalType: "address";
|
|
32
|
+
readonly name: "caller";
|
|
33
|
+
readonly type: "address";
|
|
34
|
+
}, {
|
|
35
|
+
readonly internalType: "address";
|
|
36
|
+
readonly name: "factory";
|
|
37
|
+
readonly type: "address";
|
|
38
|
+
}];
|
|
39
|
+
readonly name: "OnlyPool";
|
|
40
|
+
readonly type: "error";
|
|
41
|
+
}, {
|
|
42
|
+
readonly inputs: readonly [{
|
|
43
|
+
readonly internalType: "address";
|
|
44
|
+
readonly name: "pool";
|
|
45
|
+
readonly type: "address";
|
|
46
|
+
}, {
|
|
47
|
+
readonly internalType: "address";
|
|
48
|
+
readonly name: "caller";
|
|
49
|
+
readonly type: "address";
|
|
50
|
+
}, {
|
|
51
|
+
readonly internalType: "address";
|
|
52
|
+
readonly name: "admin";
|
|
53
|
+
readonly type: "address";
|
|
54
|
+
}];
|
|
55
|
+
readonly name: "OnlyPoolAdmin";
|
|
56
|
+
readonly type: "error";
|
|
57
|
+
}, {
|
|
58
|
+
readonly anonymous: false;
|
|
59
|
+
readonly inputs: readonly [{
|
|
60
|
+
readonly indexed: true;
|
|
61
|
+
readonly internalType: "address";
|
|
62
|
+
readonly name: "pool";
|
|
63
|
+
readonly type: "address";
|
|
64
|
+
}, {
|
|
65
|
+
readonly indexed: true;
|
|
66
|
+
readonly internalType: "address";
|
|
67
|
+
readonly name: "depositor";
|
|
68
|
+
readonly type: "address";
|
|
69
|
+
}, {
|
|
70
|
+
readonly indexed: false;
|
|
71
|
+
readonly internalType: "bool";
|
|
72
|
+
readonly name: "allowed";
|
|
73
|
+
readonly type: "bool";
|
|
74
|
+
}];
|
|
75
|
+
readonly name: "AllowedToDepositSet";
|
|
76
|
+
readonly type: "event";
|
|
77
|
+
}, {
|
|
78
|
+
readonly inputs: readonly [];
|
|
79
|
+
readonly name: "FACTORY";
|
|
80
|
+
readonly outputs: readonly [{
|
|
81
|
+
readonly internalType: "address";
|
|
82
|
+
readonly name: "";
|
|
83
|
+
readonly type: "address";
|
|
84
|
+
}];
|
|
85
|
+
readonly stateMutability: "view";
|
|
86
|
+
readonly type: "function";
|
|
87
|
+
}, {
|
|
88
|
+
readonly inputs: readonly [{
|
|
89
|
+
readonly internalType: "address";
|
|
90
|
+
readonly name: "";
|
|
91
|
+
readonly type: "address";
|
|
92
|
+
}, {
|
|
93
|
+
readonly internalType: "address";
|
|
94
|
+
readonly name: "";
|
|
95
|
+
readonly type: "address";
|
|
96
|
+
}, {
|
|
97
|
+
readonly internalType: "uint80";
|
|
98
|
+
readonly name: "";
|
|
99
|
+
readonly type: "uint80";
|
|
100
|
+
}, {
|
|
101
|
+
readonly components: readonly [{
|
|
102
|
+
readonly internalType: "int256[]";
|
|
103
|
+
readonly name: "binIdxs";
|
|
104
|
+
readonly type: "int256[]";
|
|
105
|
+
}, {
|
|
106
|
+
readonly internalType: "uint256[]";
|
|
107
|
+
readonly name: "shares";
|
|
108
|
+
readonly type: "uint256[]";
|
|
109
|
+
}];
|
|
110
|
+
readonly internalType: "struct LiquidityDelta";
|
|
111
|
+
readonly name: "";
|
|
112
|
+
readonly type: "tuple";
|
|
113
|
+
}, {
|
|
114
|
+
readonly internalType: "uint256";
|
|
115
|
+
readonly name: "";
|
|
116
|
+
readonly type: "uint256";
|
|
117
|
+
}, {
|
|
118
|
+
readonly internalType: "uint256";
|
|
119
|
+
readonly name: "";
|
|
120
|
+
readonly type: "uint256";
|
|
121
|
+
}, {
|
|
122
|
+
readonly internalType: "bytes";
|
|
123
|
+
readonly name: "";
|
|
124
|
+
readonly type: "bytes";
|
|
125
|
+
}];
|
|
126
|
+
readonly name: "afterAddLiquidity";
|
|
127
|
+
readonly outputs: readonly [{
|
|
128
|
+
readonly internalType: "bytes4";
|
|
129
|
+
readonly name: "";
|
|
130
|
+
readonly type: "bytes4";
|
|
131
|
+
}];
|
|
132
|
+
readonly stateMutability: "nonpayable";
|
|
133
|
+
readonly type: "function";
|
|
134
|
+
}, {
|
|
135
|
+
readonly inputs: readonly [{
|
|
136
|
+
readonly internalType: "address";
|
|
137
|
+
readonly name: "";
|
|
138
|
+
readonly type: "address";
|
|
139
|
+
}, {
|
|
140
|
+
readonly internalType: "address";
|
|
141
|
+
readonly name: "";
|
|
142
|
+
readonly type: "address";
|
|
143
|
+
}, {
|
|
144
|
+
readonly internalType: "uint80";
|
|
145
|
+
readonly name: "";
|
|
146
|
+
readonly type: "uint80";
|
|
147
|
+
}, {
|
|
148
|
+
readonly components: readonly [{
|
|
149
|
+
readonly internalType: "int256[]";
|
|
150
|
+
readonly name: "binIdxs";
|
|
151
|
+
readonly type: "int256[]";
|
|
152
|
+
}, {
|
|
153
|
+
readonly internalType: "uint256[]";
|
|
154
|
+
readonly name: "shares";
|
|
155
|
+
readonly type: "uint256[]";
|
|
156
|
+
}];
|
|
157
|
+
readonly internalType: "struct LiquidityDelta";
|
|
158
|
+
readonly name: "";
|
|
159
|
+
readonly type: "tuple";
|
|
160
|
+
}, {
|
|
161
|
+
readonly internalType: "uint256";
|
|
162
|
+
readonly name: "";
|
|
163
|
+
readonly type: "uint256";
|
|
164
|
+
}, {
|
|
165
|
+
readonly internalType: "uint256";
|
|
166
|
+
readonly name: "";
|
|
167
|
+
readonly type: "uint256";
|
|
168
|
+
}, {
|
|
169
|
+
readonly internalType: "bytes";
|
|
170
|
+
readonly name: "";
|
|
171
|
+
readonly type: "bytes";
|
|
172
|
+
}];
|
|
173
|
+
readonly name: "afterRemoveLiquidity";
|
|
174
|
+
readonly outputs: readonly [{
|
|
175
|
+
readonly internalType: "bytes4";
|
|
176
|
+
readonly name: "";
|
|
177
|
+
readonly type: "bytes4";
|
|
178
|
+
}];
|
|
179
|
+
readonly stateMutability: "nonpayable";
|
|
180
|
+
readonly type: "function";
|
|
181
|
+
}, {
|
|
182
|
+
readonly inputs: readonly [{
|
|
183
|
+
readonly internalType: "address";
|
|
184
|
+
readonly name: "";
|
|
185
|
+
readonly type: "address";
|
|
186
|
+
}, {
|
|
187
|
+
readonly internalType: "address";
|
|
188
|
+
readonly name: "";
|
|
189
|
+
readonly type: "address";
|
|
190
|
+
}, {
|
|
191
|
+
readonly internalType: "bool";
|
|
192
|
+
readonly name: "";
|
|
193
|
+
readonly type: "bool";
|
|
194
|
+
}, {
|
|
195
|
+
readonly internalType: "int128";
|
|
196
|
+
readonly name: "";
|
|
197
|
+
readonly type: "int128";
|
|
198
|
+
}, {
|
|
199
|
+
readonly internalType: "uint128";
|
|
200
|
+
readonly name: "";
|
|
201
|
+
readonly type: "uint128";
|
|
202
|
+
}, {
|
|
203
|
+
readonly internalType: "uint256";
|
|
204
|
+
readonly name: "";
|
|
205
|
+
readonly type: "uint256";
|
|
206
|
+
}, {
|
|
207
|
+
readonly internalType: "uint256";
|
|
208
|
+
readonly name: "";
|
|
209
|
+
readonly type: "uint256";
|
|
210
|
+
}, {
|
|
211
|
+
readonly internalType: "uint128";
|
|
212
|
+
readonly name: "";
|
|
213
|
+
readonly type: "uint128";
|
|
214
|
+
}, {
|
|
215
|
+
readonly internalType: "uint128";
|
|
216
|
+
readonly name: "";
|
|
217
|
+
readonly type: "uint128";
|
|
218
|
+
}, {
|
|
219
|
+
readonly internalType: "int128";
|
|
220
|
+
readonly name: "";
|
|
221
|
+
readonly type: "int128";
|
|
222
|
+
}, {
|
|
223
|
+
readonly internalType: "int128";
|
|
224
|
+
readonly name: "";
|
|
225
|
+
readonly type: "int128";
|
|
226
|
+
}, {
|
|
227
|
+
readonly internalType: "uint256";
|
|
228
|
+
readonly name: "";
|
|
229
|
+
readonly type: "uint256";
|
|
230
|
+
}, {
|
|
231
|
+
readonly internalType: "bytes";
|
|
232
|
+
readonly name: "";
|
|
233
|
+
readonly type: "bytes";
|
|
234
|
+
}];
|
|
235
|
+
readonly name: "afterSwap";
|
|
236
|
+
readonly outputs: readonly [{
|
|
237
|
+
readonly internalType: "bytes4";
|
|
238
|
+
readonly name: "";
|
|
239
|
+
readonly type: "bytes4";
|
|
240
|
+
}];
|
|
241
|
+
readonly stateMutability: "nonpayable";
|
|
242
|
+
readonly type: "function";
|
|
243
|
+
}, {
|
|
244
|
+
readonly inputs: readonly [{
|
|
245
|
+
readonly internalType: "address";
|
|
246
|
+
readonly name: "pool";
|
|
247
|
+
readonly type: "address";
|
|
248
|
+
}, {
|
|
249
|
+
readonly internalType: "address";
|
|
250
|
+
readonly name: "depositor";
|
|
251
|
+
readonly type: "address";
|
|
252
|
+
}];
|
|
253
|
+
readonly name: "allowedDepositor";
|
|
254
|
+
readonly outputs: readonly [{
|
|
255
|
+
readonly internalType: "bool";
|
|
256
|
+
readonly name: "";
|
|
257
|
+
readonly type: "bool";
|
|
258
|
+
}];
|
|
259
|
+
readonly stateMutability: "view";
|
|
260
|
+
readonly type: "function";
|
|
261
|
+
}, {
|
|
262
|
+
readonly inputs: readonly [{
|
|
263
|
+
readonly internalType: "address";
|
|
264
|
+
readonly name: "";
|
|
265
|
+
readonly type: "address";
|
|
266
|
+
}, {
|
|
267
|
+
readonly internalType: "address";
|
|
268
|
+
readonly name: "owner";
|
|
269
|
+
readonly type: "address";
|
|
270
|
+
}, {
|
|
271
|
+
readonly internalType: "uint80";
|
|
272
|
+
readonly name: "";
|
|
273
|
+
readonly type: "uint80";
|
|
274
|
+
}, {
|
|
275
|
+
readonly components: readonly [{
|
|
276
|
+
readonly internalType: "int256[]";
|
|
277
|
+
readonly name: "binIdxs";
|
|
278
|
+
readonly type: "int256[]";
|
|
279
|
+
}, {
|
|
280
|
+
readonly internalType: "uint256[]";
|
|
281
|
+
readonly name: "shares";
|
|
282
|
+
readonly type: "uint256[]";
|
|
283
|
+
}];
|
|
284
|
+
readonly internalType: "struct LiquidityDelta";
|
|
285
|
+
readonly name: "";
|
|
286
|
+
readonly type: "tuple";
|
|
287
|
+
}, {
|
|
288
|
+
readonly internalType: "bytes";
|
|
289
|
+
readonly name: "";
|
|
290
|
+
readonly type: "bytes";
|
|
291
|
+
}];
|
|
292
|
+
readonly name: "beforeAddLiquidity";
|
|
293
|
+
readonly outputs: readonly [{
|
|
294
|
+
readonly internalType: "bytes4";
|
|
295
|
+
readonly name: "";
|
|
296
|
+
readonly type: "bytes4";
|
|
297
|
+
}];
|
|
298
|
+
readonly stateMutability: "view";
|
|
299
|
+
readonly type: "function";
|
|
300
|
+
}, {
|
|
301
|
+
readonly inputs: readonly [{
|
|
302
|
+
readonly internalType: "address";
|
|
303
|
+
readonly name: "";
|
|
304
|
+
readonly type: "address";
|
|
305
|
+
}, {
|
|
306
|
+
readonly internalType: "address";
|
|
307
|
+
readonly name: "";
|
|
308
|
+
readonly type: "address";
|
|
309
|
+
}, {
|
|
310
|
+
readonly internalType: "uint80";
|
|
311
|
+
readonly name: "";
|
|
312
|
+
readonly type: "uint80";
|
|
313
|
+
}, {
|
|
314
|
+
readonly components: readonly [{
|
|
315
|
+
readonly internalType: "int256[]";
|
|
316
|
+
readonly name: "binIdxs";
|
|
317
|
+
readonly type: "int256[]";
|
|
318
|
+
}, {
|
|
319
|
+
readonly internalType: "uint256[]";
|
|
320
|
+
readonly name: "shares";
|
|
321
|
+
readonly type: "uint256[]";
|
|
322
|
+
}];
|
|
323
|
+
readonly internalType: "struct LiquidityDelta";
|
|
324
|
+
readonly name: "";
|
|
325
|
+
readonly type: "tuple";
|
|
326
|
+
}, {
|
|
327
|
+
readonly internalType: "bytes";
|
|
328
|
+
readonly name: "";
|
|
329
|
+
readonly type: "bytes";
|
|
330
|
+
}];
|
|
331
|
+
readonly name: "beforeRemoveLiquidity";
|
|
332
|
+
readonly outputs: readonly [{
|
|
333
|
+
readonly internalType: "bytes4";
|
|
334
|
+
readonly name: "";
|
|
335
|
+
readonly type: "bytes4";
|
|
336
|
+
}];
|
|
337
|
+
readonly stateMutability: "nonpayable";
|
|
338
|
+
readonly type: "function";
|
|
339
|
+
}, {
|
|
340
|
+
readonly inputs: readonly [{
|
|
341
|
+
readonly internalType: "address";
|
|
342
|
+
readonly name: "";
|
|
343
|
+
readonly type: "address";
|
|
344
|
+
}, {
|
|
345
|
+
readonly internalType: "address";
|
|
346
|
+
readonly name: "";
|
|
347
|
+
readonly type: "address";
|
|
348
|
+
}, {
|
|
349
|
+
readonly internalType: "bool";
|
|
350
|
+
readonly name: "";
|
|
351
|
+
readonly type: "bool";
|
|
352
|
+
}, {
|
|
353
|
+
readonly internalType: "int128";
|
|
354
|
+
readonly name: "";
|
|
355
|
+
readonly type: "int128";
|
|
356
|
+
}, {
|
|
357
|
+
readonly internalType: "uint128";
|
|
358
|
+
readonly name: "";
|
|
359
|
+
readonly type: "uint128";
|
|
360
|
+
}, {
|
|
361
|
+
readonly internalType: "uint256";
|
|
362
|
+
readonly name: "";
|
|
363
|
+
readonly type: "uint256";
|
|
364
|
+
}, {
|
|
365
|
+
readonly internalType: "uint128";
|
|
366
|
+
readonly name: "";
|
|
367
|
+
readonly type: "uint128";
|
|
368
|
+
}, {
|
|
369
|
+
readonly internalType: "uint128";
|
|
370
|
+
readonly name: "";
|
|
371
|
+
readonly type: "uint128";
|
|
372
|
+
}, {
|
|
373
|
+
readonly internalType: "bytes";
|
|
374
|
+
readonly name: "";
|
|
375
|
+
readonly type: "bytes";
|
|
376
|
+
}];
|
|
377
|
+
readonly name: "beforeSwap";
|
|
378
|
+
readonly outputs: readonly [{
|
|
379
|
+
readonly internalType: "bytes4";
|
|
380
|
+
readonly name: "";
|
|
381
|
+
readonly type: "bytes4";
|
|
382
|
+
}];
|
|
383
|
+
readonly stateMutability: "nonpayable";
|
|
384
|
+
readonly type: "function";
|
|
385
|
+
}, {
|
|
386
|
+
readonly inputs: readonly [{
|
|
387
|
+
readonly internalType: "address";
|
|
388
|
+
readonly name: "";
|
|
389
|
+
readonly type: "address";
|
|
390
|
+
}, {
|
|
391
|
+
readonly internalType: "bytes";
|
|
392
|
+
readonly name: "";
|
|
393
|
+
readonly type: "bytes";
|
|
394
|
+
}];
|
|
395
|
+
readonly name: "initialize";
|
|
396
|
+
readonly outputs: readonly [{
|
|
397
|
+
readonly internalType: "bytes4";
|
|
398
|
+
readonly name: "";
|
|
399
|
+
readonly type: "bytes4";
|
|
400
|
+
}];
|
|
401
|
+
readonly stateMutability: "nonpayable";
|
|
402
|
+
readonly type: "function";
|
|
403
|
+
}, {
|
|
404
|
+
readonly inputs: readonly [{
|
|
405
|
+
readonly internalType: "address";
|
|
406
|
+
readonly name: "pool_";
|
|
407
|
+
readonly type: "address";
|
|
408
|
+
}, {
|
|
409
|
+
readonly internalType: "address";
|
|
410
|
+
readonly name: "depositor";
|
|
411
|
+
readonly type: "address";
|
|
412
|
+
}];
|
|
413
|
+
readonly name: "isAllowedToDeposit";
|
|
414
|
+
readonly outputs: readonly [{
|
|
415
|
+
readonly internalType: "bool";
|
|
416
|
+
readonly name: "";
|
|
417
|
+
readonly type: "bool";
|
|
418
|
+
}];
|
|
419
|
+
readonly stateMutability: "view";
|
|
420
|
+
readonly type: "function";
|
|
421
|
+
}, {
|
|
422
|
+
readonly inputs: readonly [{
|
|
423
|
+
readonly internalType: "address";
|
|
424
|
+
readonly name: "pool_";
|
|
425
|
+
readonly type: "address";
|
|
426
|
+
}, {
|
|
427
|
+
readonly internalType: "address";
|
|
428
|
+
readonly name: "depositor";
|
|
429
|
+
readonly type: "address";
|
|
430
|
+
}, {
|
|
431
|
+
readonly internalType: "bool";
|
|
432
|
+
readonly name: "allowed";
|
|
433
|
+
readonly type: "bool";
|
|
434
|
+
}];
|
|
435
|
+
readonly name: "setAllowedToDeposit";
|
|
436
|
+
readonly outputs: readonly [];
|
|
437
|
+
readonly stateMutability: "nonpayable";
|
|
438
|
+
readonly type: "function";
|
|
439
|
+
}];
|
|
440
|
+
//# sourceMappingURL=DepositAllowlistExtension.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DepositAllowlistExtension.d.ts","sourceRoot":"","sources":["../../src/abis/DepositAllowlistExtension.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0jB/B,CAAC"}
|