@continuumdao/ctm-mpc-defi 0.1.3 → 0.2.0

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.
Files changed (68) hide show
  1. package/README.md +16 -1
  2. package/dist/agent/catalog.cjs +913 -142
  3. package/dist/agent/catalog.cjs.map +1 -1
  4. package/dist/agent/catalog.d.cts +834 -12
  5. package/dist/agent/catalog.d.ts +834 -12
  6. package/dist/agent/catalog.js +863 -143
  7. package/dist/agent/catalog.js.map +1 -1
  8. package/dist/chains/evm/index.cjs +13 -0
  9. package/dist/chains/evm/index.cjs.map +1 -1
  10. package/dist/chains/evm/index.d.cts +3 -1
  11. package/dist/chains/evm/index.d.ts +3 -1
  12. package/dist/chains/evm/index.js +13 -1
  13. package/dist/chains/evm/index.js.map +1 -1
  14. package/dist/core/index.cjs +76 -0
  15. package/dist/core/index.cjs.map +1 -1
  16. package/dist/core/index.d.cts +35 -2
  17. package/dist/core/index.d.ts +35 -2
  18. package/dist/core/index.js +70 -1
  19. package/dist/core/index.js.map +1 -1
  20. package/dist/index.cjs +934 -141
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +3 -2
  23. package/dist/index.d.ts +3 -2
  24. package/dist/index.js +927 -142
  25. package/dist/index.js.map +1 -1
  26. package/dist/protocols/evm/aave-v4/index.cjs +1987 -0
  27. package/dist/protocols/evm/aave-v4/index.cjs.map +1 -0
  28. package/dist/protocols/evm/aave-v4/index.d.cts +500 -0
  29. package/dist/protocols/evm/aave-v4/index.d.ts +500 -0
  30. package/dist/protocols/evm/aave-v4/index.js +1943 -0
  31. package/dist/protocols/evm/aave-v4/index.js.map +1 -0
  32. package/dist/protocols/evm/ethena/index.cjs +965 -0
  33. package/dist/protocols/evm/ethena/index.cjs.map +1 -0
  34. package/dist/protocols/evm/ethena/index.d.cts +161 -0
  35. package/dist/protocols/evm/ethena/index.d.ts +161 -0
  36. package/dist/protocols/evm/ethena/index.js +943 -0
  37. package/dist/protocols/evm/ethena/index.js.map +1 -0
  38. package/dist/protocols/evm/euler-v2/index.cjs +2263 -0
  39. package/dist/protocols/evm/euler-v2/index.cjs.map +1 -0
  40. package/dist/protocols/evm/euler-v2/index.d.cts +317 -0
  41. package/dist/protocols/evm/euler-v2/index.d.ts +317 -0
  42. package/dist/protocols/evm/euler-v2/index.js +2238 -0
  43. package/dist/protocols/evm/euler-v2/index.js.map +1 -0
  44. package/dist/protocols/evm/lido/index.cjs +834 -0
  45. package/dist/protocols/evm/lido/index.cjs.map +1 -0
  46. package/dist/protocols/evm/lido/index.d.cts +120 -0
  47. package/dist/protocols/evm/lido/index.d.ts +120 -0
  48. package/dist/protocols/evm/lido/index.js +809 -0
  49. package/dist/protocols/evm/lido/index.js.map +1 -0
  50. package/dist/protocols/evm/maple/index.cjs +707 -0
  51. package/dist/protocols/evm/maple/index.cjs.map +1 -0
  52. package/dist/protocols/evm/maple/index.d.cts +109 -0
  53. package/dist/protocols/evm/maple/index.d.ts +109 -0
  54. package/dist/protocols/evm/maple/index.js +693 -0
  55. package/dist/protocols/evm/maple/index.js.map +1 -0
  56. package/dist/protocols/evm/sky/index.cjs +1254 -0
  57. package/dist/protocols/evm/sky/index.cjs.map +1 -0
  58. package/dist/protocols/evm/sky/index.d.cts +218 -0
  59. package/dist/protocols/evm/sky/index.d.ts +218 -0
  60. package/dist/protocols/evm/sky/index.js +1229 -0
  61. package/dist/protocols/evm/sky/index.js.map +1 -0
  62. package/dist/protocols/evm/uniswap-v4/index.cjs +31 -11
  63. package/dist/protocols/evm/uniswap-v4/index.cjs.map +1 -1
  64. package/dist/protocols/evm/uniswap-v4/index.d.cts +2 -1
  65. package/dist/protocols/evm/uniswap-v4/index.d.ts +2 -1
  66. package/dist/protocols/evm/uniswap-v4/index.js +31 -11
  67. package/dist/protocols/evm/uniswap-v4/index.js.map +1 -1
  68. package/package.json +37 -3
@@ -0,0 +1,218 @@
1
+ import { d as ProtocolModule } from '../../../types-Ce2qNHai.js';
2
+ import { Address, createPublicClient } from 'viem';
3
+ import { K as KeyGenSubsetForPermit } from '../../../keygen-DsINazx8.js';
4
+
5
+ /**
6
+ * Sky LockStake on Ethereum mainnet.
7
+ * @see https://developers.skyeco.com/protocol/rewards/staking-engine/
8
+ * @see https://developers.skyeco.com/guides/sky/token-governance-upgrade/key-info/ (contract list)
9
+ */
10
+ /** Sky (SKY token) on Ethereum mainnet. */
11
+ declare const SKY_ETHEREUM_MAINNET = "0x56072C95FAA701256059aa122697B133aDEd9279";
12
+ declare const SKY_ETHEREUM_MAINNET_CHAIN_ID = 1;
13
+ declare const USDS_ETHEREUM_MAINNET = "0xdC035D45d973E3EC169d2276DDab16f1e407384F";
14
+ /** sUSDS ERC-4626 vault (share token); deposit USDS → mint shares, redeem shares → USDS. @see https://developers.skyeco.com/protocol/tokens/susds/ */
15
+ declare const SUSDS_VAULT_ERC4626_MAINNET = "0xa3931d71877C0E7a3148CB7Eb4463524FEc27fbD";
16
+ /**
17
+ * Staking Engine (LockStake) — **Chief V3 / SKY** (active; `LSEV2-SKY-A` ilk). This is the contract users should call.
18
+ * Do not use Seal Engine V1 (`0x2b16C07D…`, MKR / Chief V2 legacy); it has little traffic and is not the current SKY engine.
19
+ * Dual entrypoints: legacy `lock`/`free` (MKR path) vs **`lockSky`/`freeSky`** for SKY collateral via `mkrSky`.
20
+ */
21
+ declare const SKY_LOCKSTAKE_ENGINE_MAINNET = "0xCe01C90dE7FD1bcFa39e237FE6D8D9F569e8A6a3";
22
+ /**
23
+ * Wrapped SKY used inside the urn after `lockSky`; StakingRewards farms must list this ERC-20 as `stakingToken()`.
24
+ * @see Symbol `lsSKY`.
25
+ */
26
+ declare const SKY_LS_SKY_ERC20_MAINNET = "0xf9A9cfD3229E985B91F99Bc866d42938044FFa1C";
27
+ /**
28
+ * Default staking rewards farm on {@link SKY_LOCKSTAKE_ENGINE_MAINNET} — must be ACTIVE and `stakingToken() === lsSKY`.
29
+ * (Older Seal-engine farm addresses are not whitelisted on the current engine.)
30
+ */
31
+ declare const SKY_LOCKSTAKE_DEFAULT_FARM_MAINNET = "0xB44C2Fb4181D7Cb06bdFf34A46FdFe4a259B40Fc";
32
+ declare const SKY_LOCKSTAKE_DEFAULT_FARM_REF = 1;
33
+ /**
34
+ * Rough UI collateral factor for “remaining borrow (USD)” estimate in the LockStake dialog only.
35
+ * Not protocol liquidation collateralization; see `SkyLockstakeDialog` disclosures.
36
+ */
37
+ declare const SKY_LOCKSTAKE_UI_COLLATERAL_FACTOR = 0.65;
38
+ declare const SKY_TOKEN_DECIMALS = 18;
39
+ declare const USDS_DECIMALS = 18;
40
+
41
+ /**
42
+ * Sky LockStake Engine (Ethereum): multisign batches for stake/open position, borrow, repay, close.
43
+ * Pattern mirrors `ethenaStakeMultisign.ts` (sequential txs, `proposalTxParams`, `batchMeta`).
44
+ */
45
+
46
+ declare const SKY_LOCKSTAKE_MULTICALL_FALLBACK_GAS = 5000000n;
47
+ type SkyMultisignBatchStep = {
48
+ to: Address;
49
+ data: `0x${string}`;
50
+ value: bigint;
51
+ meta: Record<string, unknown>;
52
+ };
53
+ type SkyMultisignChainDetailRow = {
54
+ legacy?: boolean;
55
+ gasLimit?: number;
56
+ gasMultiplier?: number;
57
+ gasPrice?: number;
58
+ baseFee?: number;
59
+ priorityFee?: number;
60
+ baseFeeMultiplier?: number;
61
+ };
62
+ type ChainRow = SkyMultisignChainDetailRow;
63
+ declare function appendSerializedSkyBatch(args: {
64
+ steps: SkyMultisignBatchStep[];
65
+ publicClient: ReturnType<typeof createPublicClient>;
66
+ executor: Address;
67
+ chainId: number;
68
+ rpcUrl: string;
69
+ chainDetail: ChainRow;
70
+ useCustomGas: boolean;
71
+ customGasChainDetails?: Record<string, unknown> | null;
72
+ purposePrefix: string;
73
+ keyGen: KeyGenSubsetForPermit;
74
+ destinationChainID: string;
75
+ }): Promise<{
76
+ bodyForSign: Record<string, unknown>;
77
+ messageToSign: string;
78
+ }>;
79
+ declare function buildSkyLockstakeStakePositionBatch(args: {
80
+ keyGen: KeyGenSubsetForPermit;
81
+ chainId: number;
82
+ rpcUrl: string;
83
+ chainDetail: ChainRow;
84
+ useCustomGas: boolean;
85
+ customGasChainDetails?: Record<string, unknown> | null;
86
+ executorAddress: Address;
87
+ purposeText: string;
88
+ /** Human SKY amount */
89
+ amountHuman: string;
90
+ farm?: Address;
91
+ farmRef?: number;
92
+ /**
93
+ * Add SKY to this urn (multicall omits `open`). Must be `< ownerUrnsCount`.
94
+ * If omitted and `ownerUrnsCount > 0`, defaults to urn `0` (single-position UX). If omitted and count is 0, opens urn `0`.
95
+ */
96
+ existingUrnIndex?: bigint;
97
+ }): Promise<{
98
+ bodyForSign: Record<string, unknown>;
99
+ messageToSign: string;
100
+ }>;
101
+ declare function buildSkyLockstakeDrawBatch(args: {
102
+ keyGen: KeyGenSubsetForPermit;
103
+ chainId: number;
104
+ rpcUrl: string;
105
+ chainDetail: ChainRow;
106
+ useCustomGas: boolean;
107
+ customGasChainDetails?: Record<string, unknown> | null;
108
+ executorAddress: Address;
109
+ purposeText: string;
110
+ urnIndex: bigint;
111
+ /** Human USDS */
112
+ amountHuman: string;
113
+ to?: Address;
114
+ }): Promise<{
115
+ bodyForSign: Record<string, unknown>;
116
+ messageToSign: string;
117
+ }>;
118
+ declare function buildSkyLockstakeGetRewardBatch(args: {
119
+ keyGen: KeyGenSubsetForPermit;
120
+ chainId: number;
121
+ rpcUrl: string;
122
+ chainDetail: ChainRow;
123
+ useCustomGas: boolean;
124
+ customGasChainDetails?: Record<string, unknown> | null;
125
+ executorAddress: Address;
126
+ purposeText: string;
127
+ urnIndex: bigint;
128
+ /** Urn’s selected staking rewards farm (must be non-zero). */
129
+ farmAddress: Address;
130
+ /** Recipient of claimed ERC-20 rewards; defaults to executor. */
131
+ rewardRecipient?: Address;
132
+ }): Promise<{
133
+ bodyForSign: Record<string, unknown>;
134
+ messageToSign: string;
135
+ rewardToken: Address;
136
+ }>;
137
+ declare function buildSkyLockstakeWipeBatch(args: {
138
+ keyGen: KeyGenSubsetForPermit;
139
+ chainId: number;
140
+ rpcUrl: string;
141
+ chainDetail: ChainRow;
142
+ useCustomGas: boolean;
143
+ customGasChainDetails?: Record<string, unknown> | null;
144
+ executorAddress: Address;
145
+ purposeText: string;
146
+ urnIndex: bigint;
147
+ wipeAll: boolean;
148
+ amountHuman?: string;
149
+ }): Promise<{
150
+ bodyForSign: Record<string, unknown>;
151
+ messageToSign: string;
152
+ }>;
153
+ declare function buildSkyLockstakeCloseBatch(args: {
154
+ keyGen: KeyGenSubsetForPermit;
155
+ chainId: number;
156
+ rpcUrl: string;
157
+ chainDetail: ChainRow;
158
+ useCustomGas: boolean;
159
+ customGasChainDetails?: Record<string, unknown> | null;
160
+ executorAddress: Address;
161
+ purposeText: string;
162
+ urnIndex: bigint;
163
+ inkWei: bigint;
164
+ skyRecipient?: Address;
165
+ }): Promise<{
166
+ bodyForSign: Record<string, unknown>;
167
+ messageToSign: string;
168
+ }>;
169
+ /**
170
+ * True when `extraJSON.batchMeta[i].evm.type` pulls ERC-20 inside the same batched approve flow,
171
+ * so `eth_estimateGas` on this step alone skips prior approvals (similar to Ethena sUSDe deposit).
172
+ */
173
+ declare function isSkyLockstakeIsolationEstimateGasFragileBatchStep(detail: Record<string, unknown> | null | undefined, batchIndex: number): boolean;
174
+ /** Prefer `proposalTxParams[i].gasLimit` from proposal time — isolated RPC estimate often reverts. */
175
+ declare function resolveSkyLockstakeBatchStepGasFromSignRequest(detail: Record<string, unknown> | null | undefined, batchIndex: number): bigint | null;
176
+
177
+ /**
178
+ * Sky sUSDS — ERC-4626 deposit (USDS → mint shares) and redeem (burn shares → USDS).
179
+ * Serialization matches {@link appendSerializedSkyBatch} from `skyLockstakeMultisign.ts`.
180
+ */
181
+
182
+ declare function buildSkySusdsRedeemToUsdsBatch(args: {
183
+ keyGen: KeyGenSubsetForPermit;
184
+ chainId: number;
185
+ rpcUrl: string;
186
+ chainDetail: SkyMultisignChainDetailRow;
187
+ useCustomGas: boolean;
188
+ customGasChainDetails?: Record<string, unknown> | null;
189
+ executorAddress: Address;
190
+ purposeText: string;
191
+ /** Human sUSDS (vault share) amount to redeem */
192
+ sharesHuman: string;
193
+ /** Address receiving USDS from redeem (defaults to executor). */
194
+ receiver?: Address;
195
+ }): Promise<{
196
+ bodyForSign: Record<string, unknown>;
197
+ messageToSign: string;
198
+ }>;
199
+ declare function buildSkySusdsDepositFromUsdsBatch(args: {
200
+ keyGen: KeyGenSubsetForPermit;
201
+ chainId: number;
202
+ rpcUrl: string;
203
+ chainDetail: SkyMultisignChainDetailRow;
204
+ useCustomGas: boolean;
205
+ customGasChainDetails?: Record<string, unknown> | null;
206
+ executorAddress: Address;
207
+ purposeText: string;
208
+ /** Human USDS amount to deposit into the vault. */
209
+ assetsHuman: string;
210
+ }): Promise<{
211
+ bodyForSign: Record<string, unknown>;
212
+ messageToSign: string;
213
+ }>;
214
+
215
+ declare const SKY_PROTOCOL_ID = "sky";
216
+ declare const skyProtocolModule: ProtocolModule;
217
+
218
+ export { SKY_ETHEREUM_MAINNET, SKY_ETHEREUM_MAINNET_CHAIN_ID, SKY_LOCKSTAKE_DEFAULT_FARM_MAINNET, SKY_LOCKSTAKE_DEFAULT_FARM_REF, SKY_LOCKSTAKE_ENGINE_MAINNET, SKY_LOCKSTAKE_MULTICALL_FALLBACK_GAS, SKY_LOCKSTAKE_UI_COLLATERAL_FACTOR, SKY_LS_SKY_ERC20_MAINNET, SKY_PROTOCOL_ID, SKY_TOKEN_DECIMALS, SUSDS_VAULT_ERC4626_MAINNET, type SkyMultisignBatchStep, type SkyMultisignChainDetailRow, USDS_DECIMALS, USDS_ETHEREUM_MAINNET, appendSerializedSkyBatch, buildSkyLockstakeCloseBatch, buildSkyLockstakeDrawBatch, buildSkyLockstakeGetRewardBatch, buildSkyLockstakeStakePositionBatch, buildSkyLockstakeWipeBatch, buildSkySusdsDepositFromUsdsBatch, buildSkySusdsRedeemToUsdsBatch, isSkyLockstakeIsolationEstimateGasFragileBatchStep, resolveSkyLockstakeBatchStepGasFromSignRequest, skyProtocolModule };