@raac/rpc 2.0.0-beta.21 → 2.0.0-beta.23
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/dist/RPCLibrary.js +8 -3
- package/dist/artifacts/core/pools/StabilityPool/LiquidationSwap.sol/LiquidationSwap.json +472 -0
- package/dist/artifacts/core/psm/v2/PSMVaultV2.sol/PSMVaultV2.json +2373 -0
- package/dist/artifacts/core/psm/v3/PSMVaultV3.sol/PSMVaultV3.json +2373 -0
- package/dist/configs/chains/1.json +1 -0
- package/dist/configs/chains/11155111.json +17 -2
- package/dist/contracts/governance/gauge/getUserGaugeState.js +4 -5
- package/dist/contracts/psm/_helpers.js +32 -2
- package/dist/contracts/psm/getVaultInfo.js +4 -4
- package/dist/contracts/psm/getVaultSettings.js +15 -4
- package/dist/pools/stabilityPool/liquidation.js +211 -138
- package/dist/types/RPCLibrary.d.ts +9 -4
- package/dist/types/configs/chains/index.d.ts +2 -0
- package/dist/types/configs/index.d.ts +1 -0
- package/dist/types/contracts/governance/gauge/getUserGaugeState.d.ts +3 -4
- package/dist/types/contracts/psm/_helpers.d.ts +13 -0
- package/dist/types/contracts/psm/getVaultInfo.d.ts +3 -1
- package/dist/types/contracts/psm/getVaultSettings.d.ts +6 -0
- package/dist/types/pools/stabilityPool/liquidation.d.ts +166 -52
- package/dist/types/utils/artifacts.d.ts +119 -1
- package/dist/types/utils/contracts.d.ts +2 -0
- package/dist/utils/artifacts.js +12 -1
- package/package.json +2 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Planning StabilityPool.liquidateBorrower, mirroring LiquidationStrategyProxy:
|
|
3
3
|
* 1. the seized collateral is deposited into the RWAVault for vault-token shares, unless it already is the vault token;
|
|
4
4
|
* 2. the stability pool's whole vault-token balance (the proxy runs under delegatecall) is split by BPS into
|
|
5
|
-
* mint (treasury
|
|
6
|
-
* 3.
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
5
|
+
* mint (treasury), burn, swap and liquidity (fee collector);
|
|
6
|
+
* 3. the swap slice is sold on Curve through LiquidationSwap, whose floor is the vault's NAV less a tolerance;
|
|
7
|
+
* 4. the reserve asset the pool then holds (swap proceeds plus whatever it held before) repays the debt; a shortfall
|
|
8
|
+
* is drawn from the pool's rTokens through the LendingPool, and the call reverts (InsufficientBalance) if too few.
|
|
9
|
+
*
|
|
10
|
+
* The plan sizes the swap on Curve's get_dy and values every other leg at NAV. Any gap between the swap and the debt
|
|
11
|
+
* is reserve asset the Treasury sends to the pool beforehand, and the unsold vault tokens go to the Treasury for it.
|
|
11
12
|
*/
|
|
12
13
|
import { type Provider } from "ethers";
|
|
13
14
|
import { ChainId } from "../../configs/chains/index";
|
|
@@ -21,29 +22,71 @@ export interface LiquidationSplit {
|
|
|
21
22
|
export declare const SPLIT_KEYS: readonly ["mintBps", "burnBps", "swapBps", "liquidityBps"];
|
|
22
23
|
export declare const splitTotal: (s: LiquidationSplit) => bigint;
|
|
23
24
|
export declare const sameSplit: (a: LiquidationSplit, b: LiquidationSplit) => boolean;
|
|
24
|
-
/** The stability pool's liquidation route,
|
|
25
|
+
/** The stability pool's liquidation route and everything on chain that decides how a liquidation can go, at one block. */
|
|
25
26
|
export interface LiquidationContext {
|
|
26
27
|
stabilityPool: string;
|
|
28
|
+
lendingPool: string;
|
|
27
29
|
liquidationSwap: string;
|
|
28
30
|
liquidityPool: string;
|
|
29
31
|
rwaVault: string;
|
|
32
|
+
treasury: string;
|
|
33
|
+
feeCollector: string;
|
|
30
34
|
vaultToken: string;
|
|
31
35
|
vaultSymbol: string;
|
|
36
|
+
/** The reserve asset the debt is in (crvUSD or pmUSD) and the pool's rToken for it. */
|
|
37
|
+
reserveAsset: string;
|
|
38
|
+
rToken: string;
|
|
32
39
|
iIn: bigint;
|
|
33
40
|
iOut: bigint;
|
|
34
41
|
split: LiquidationSplit;
|
|
35
42
|
/** Vault tokens already in the stability pool; the split divides these too. */
|
|
36
43
|
poolVaultTokens: bigint;
|
|
37
|
-
/**
|
|
44
|
+
/** Reserve asset the stability pool holds; the proxy counts it toward the debt before drawing on rTokens. */
|
|
45
|
+
poolReserve: bigint;
|
|
46
|
+
/** rTokens the stability pool holds, which is the most a shortfall can draw from the LendingPool. */
|
|
38
47
|
rTokens: bigint;
|
|
39
|
-
/**
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
/** What depositors are owed; above the rTokens held, the pool is under-backed by the difference. */
|
|
49
|
+
deTokenSupply: bigint;
|
|
50
|
+
/** Reserve asset the LendingPool can pay out now: the rToken contract's buffer plus what its yield vault lets it withdraw (null when that read is unavailable). */
|
|
51
|
+
idleCash: {
|
|
52
|
+
buffer: bigint;
|
|
53
|
+
vaultWithdrawable: bigint | null;
|
|
54
|
+
};
|
|
55
|
+
/** The LendingPool's accounting the buffer rebalance after repayment works from: total liquidity, the buffer ratio it keeps, and the smallest rebalance it bothers with. */
|
|
56
|
+
lendingPoolLiquidity: {
|
|
57
|
+
total: bigint;
|
|
58
|
+
bufferRatioBps: bigint;
|
|
59
|
+
minRebalance: bigint;
|
|
60
|
+
};
|
|
61
|
+
/** Curve: get_dy for one vault token, the reserve asset side's balance, and the pool's current fee in bps. */
|
|
62
|
+
curve: {
|
|
63
|
+
spot: bigint;
|
|
64
|
+
depth: bigint;
|
|
65
|
+
feeBps: bigint;
|
|
66
|
+
};
|
|
67
|
+
/** NAV: the vault's price per share in USD and the oracle's USD price of the reserve asset, both 1e18; `priceTimestamp` when the oracle reports one. */
|
|
68
|
+
nav: {
|
|
44
69
|
pricePerShare: bigint;
|
|
45
70
|
oraclePrice: bigint;
|
|
46
|
-
|
|
71
|
+
priceTimestamp: number | null;
|
|
72
|
+
};
|
|
73
|
+
/** Vault tokens in existence: the burn leg runs before the swap and raises the price per share the floor is computed from. */
|
|
74
|
+
vaultTokenSupply: bigint;
|
|
75
|
+
/** LiquidationSwap's floor: when on, the swap must return at least NAV less `bps`. `owner` can change it. */
|
|
76
|
+
floor: {
|
|
77
|
+
enabled: boolean;
|
|
78
|
+
bps: bigint;
|
|
79
|
+
owner: string;
|
|
80
|
+
};
|
|
81
|
+
/** The liquidity leg reverts while the FeeCollector is paused or its fee type is not registered. */
|
|
82
|
+
feeCollectorState: {
|
|
83
|
+
paused: boolean;
|
|
84
|
+
liquidityFeeTypeRegistered: boolean;
|
|
85
|
+
};
|
|
86
|
+
/** The Treasury leg deposits vault tokens into the Treasury contract, which must list them. */
|
|
87
|
+
treasurySupportsVaultToken: boolean;
|
|
88
|
+
/** LendingPool grace period, in seconds, before an insured position can be finalized. */
|
|
89
|
+
gracePeriod: number;
|
|
47
90
|
}
|
|
48
91
|
/** Everything liquidateBorrower needs for one position, plus its state on chain. */
|
|
49
92
|
export interface LiquidationTarget {
|
|
@@ -57,56 +100,127 @@ export interface LiquidationTarget {
|
|
|
57
100
|
/** The collateral already is the vault token, so no RWAVault deposit happens. */
|
|
58
101
|
isVaultToken: boolean;
|
|
59
102
|
collateralValue: bigint;
|
|
103
|
+
/** Vault tokens this liquidation adds: shares minted for the collateral, or the collateral itself. */
|
|
104
|
+
sharesFromCollateral: bigint;
|
|
60
105
|
/** getPositionScaledDebt: the debt with accrued interest, which is what the liquidation repays. */
|
|
61
106
|
debt: bigint;
|
|
62
107
|
isUnderLiquidation: boolean;
|
|
63
108
|
isInsured: boolean;
|
|
64
109
|
liquidationStartTime: number;
|
|
65
110
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
|
|
70
|
-
/**
|
|
111
|
+
/** The operator's policy, all in basis points. */
|
|
112
|
+
export interface PlanParams {
|
|
113
|
+
/** Share burned. */
|
|
114
|
+
burnBps: bigint;
|
|
115
|
+
/** The Treasury's base fee, before any gap it funds. */
|
|
116
|
+
treasuryBps: bigint;
|
|
117
|
+
/** The most the liquidity leg gets once the Treasury funds a gap; without a gap it takes the whole remainder. */
|
|
118
|
+
liquidityCapBps: bigint;
|
|
119
|
+
/** The swap stops growing once its realised rate falls this far below Curve's spot rate. */
|
|
120
|
+
impactCapBps: bigint;
|
|
121
|
+
/** The highest floor tolerance the plan may propose setting on LiquidationSwap. */
|
|
122
|
+
toleranceCeilingBps: bigint;
|
|
123
|
+
/** Added to the tolerance the swap needs when one is proposed, against drift between the quote and execution; the swap is sized so that needed plus cushion stays under the ceiling. */
|
|
124
|
+
toleranceCushionBps: bigint;
|
|
125
|
+
/** Added to the debt, since it accrues until the transaction executes. */
|
|
126
|
+
marginBps: bigint;
|
|
127
|
+
}
|
|
128
|
+
export declare const DEFAULT_PLAN_PARAMS: PlanParams;
|
|
129
|
+
/** DeFi sells on Curve as much as the debt needs; OTC sells nothing and the Treasury funds the whole debt. */
|
|
130
|
+
export type PlanMode = "defi" | "otc";
|
|
131
|
+
/** What stopped the swap growing: the debt is covered, the impact cap, the floor at the tolerance ceiling, the whole balance, or the mode. */
|
|
132
|
+
export type SwapBound = "debt" | "impact" | "floor" | "balance" | "mode";
|
|
133
|
+
export type PlanRoute = "covered" | "partial" | "otc";
|
|
134
|
+
export interface LiquidationPlan {
|
|
135
|
+
mode: PlanMode;
|
|
136
|
+
params: PlanParams;
|
|
137
|
+
/** What the split divides: the shares for the collateral plus the pool's existing vault tokens. */
|
|
71
138
|
totalVaultTokens: bigint;
|
|
139
|
+
/** The debt plus the margin. */
|
|
140
|
+
required: bigint;
|
|
141
|
+
/** `required` less the reserve asset the pool already holds: what the swap and the Treasury must bring. */
|
|
142
|
+
toCover: bigint;
|
|
72
143
|
swapAmount: bigint;
|
|
73
|
-
/** get_dy
|
|
74
|
-
swapOut: bigint
|
|
75
|
-
/**
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
144
|
+
/** get_dy for `swapAmount`. */
|
|
145
|
+
swapOut: bigint;
|
|
146
|
+
/** How far the swap's realised rate falls below Curve's spot rate. */
|
|
147
|
+
priceImpactBps: bigint;
|
|
148
|
+
/** The floor tolerance this swap needs: get_dy against NAV as it stands after the burn leg. */
|
|
149
|
+
toleranceNeededBps: bigint;
|
|
150
|
+
/** The tolerance to set on LiquidationSwap before the swap, the need plus the cushion; null when the current one suffices or nothing is swapped. */
|
|
151
|
+
proposedToleranceBps: bigint | null;
|
|
152
|
+
bound: SwapBound;
|
|
153
|
+
/** The largest swap at the tolerance on chain, at the ceiling less the cushion, and under the impact cap. */
|
|
154
|
+
ceilings: {
|
|
155
|
+
atCurrent: bigint;
|
|
156
|
+
atCeiling: bigint;
|
|
157
|
+
underImpact: bigint;
|
|
158
|
+
};
|
|
159
|
+
split: LiquidationSplit;
|
|
160
|
+
/** Each leg in vault tokens, computed the way the proxy does. */
|
|
161
|
+
legs: {
|
|
162
|
+
swap: bigint;
|
|
163
|
+
burn: bigint;
|
|
164
|
+
treasury: bigint;
|
|
165
|
+
liquidity: bigint;
|
|
166
|
+
};
|
|
167
|
+
/** Reserve asset the Treasury must send to the stability pool before the liquidation. */
|
|
168
|
+
gap: bigint;
|
|
169
|
+
/** The Treasury's vault tokens at NAV, and that less the gap it funds: negative means a loss. */
|
|
170
|
+
treasuryValue: bigint;
|
|
171
|
+
treasuryNet: bigint;
|
|
172
|
+
/** The liquidity leg was held to the cap, or set to zero because the FeeCollector would revert. */
|
|
173
|
+
liquidityCapped: boolean;
|
|
174
|
+
liquidityDisabled: boolean;
|
|
175
|
+
route: PlanRoute;
|
|
176
|
+
/**
|
|
177
|
+
* The alternative for a gap: the pool's rTokens cover it through the LendingPool. Feasible when the pool holds
|
|
178
|
+
* enough rTokens and the LendingPool enough idle cash; null when the idle cash is unknown. `inject` is the reserve
|
|
179
|
+
* asset to send to the rToken contract so the withdrawal clears when the idle cash falls short.
|
|
180
|
+
*/
|
|
181
|
+
absorb: {
|
|
182
|
+
feasible: boolean | null;
|
|
183
|
+
rTokensAfter: bigint;
|
|
184
|
+
inject: bigint;
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* The LendingPool rebalances its buffer when the debt is written off, before the repayment reaches it, so it wants
|
|
188
|
+
* `shortage` more in the buffer and takes it from the yield vault. A build that rebalances strictly (Sepolia)
|
|
189
|
+
* reverts when the vault cannot give that much; `inject` is the reserve asset to send to the rToken contract first:
|
|
190
|
+
* the whole shortage, since harvesting yield inside the rebalance lowers what the vault then allows.
|
|
191
|
+
*/
|
|
192
|
+
rebalance: {
|
|
193
|
+
shortage: bigint;
|
|
194
|
+
feasible: boolean | null;
|
|
195
|
+
inject: bigint;
|
|
196
|
+
};
|
|
93
197
|
}
|
|
94
|
-
/**
|
|
198
|
+
/** get_dy for an amount of vault tokens; null when Curve reverts. */
|
|
199
|
+
export type Quote = (amount: bigint) => Promise<bigint | null>;
|
|
200
|
+
/** Reads the stability pool's liquidation route, balances, Curve, NAV, floor and leg prerequisites at one block. */
|
|
95
201
|
export declare function readLiquidationContext(chainId: ChainId, provider: Provider): Promise<LiquidationContext>;
|
|
96
202
|
/** Assembles liquidateBorrower's arguments and the position's state for one position id ("user:adapter:key"). */
|
|
97
203
|
export declare function readLiquidationTarget(chainId: ChainId, provider: Provider, ctx: LiquidationContext, positionId: string): Promise<LiquidationTarget>;
|
|
98
|
-
/**
|
|
99
|
-
export declare
|
|
204
|
+
/** get_dy on the context's Curve pool. */
|
|
205
|
+
export declare const curveQuote: (provider: Provider, ctx: LiquidationContext) => Quote;
|
|
206
|
+
/** Reserve asset that `shares` vault tokens are worth at NAV, as LiquidationSwap computes its expected output. */
|
|
207
|
+
export declare const valueAtNav: (ctx: Pick<LiquidationContext, "nav">, shares: bigint) => bigint;
|
|
208
|
+
/** Vault tokens worth `value` of reserve asset at NAV, rounded up. */
|
|
209
|
+
export declare const sharesAtNav: (ctx: Pick<LiquidationContext, "nav">, value: bigint) => bigint;
|
|
100
210
|
/**
|
|
101
|
-
* The
|
|
102
|
-
* burn
|
|
211
|
+
* The floor tolerance a swap of `amount` returning `out` needs: how far `out` falls below NAV, in bps, rounded up.
|
|
212
|
+
* The proxy burns the burn leg before it swaps, which lifts the vault's price per share by the burned share of the
|
|
213
|
+
* supply, so the floor LiquidationSwap applies is computed on that higher NAV; `burned` accounts for it.
|
|
103
214
|
*/
|
|
104
|
-
export declare function
|
|
105
|
-
/**
|
|
106
|
-
export declare
|
|
215
|
+
export declare function toleranceNeeded(ctx: Pick<LiquidationContext, "nav" | "vaultTokenSupply">, amount: bigint, out: bigint, burned?: bigint): bigint;
|
|
216
|
+
/** How far the realised rate of a swap falls below Curve's spot rate, in bps. */
|
|
217
|
+
export declare function priceImpact(ctx: Pick<LiquidationContext, "curve">, amount: bigint, out: bigint): bigint;
|
|
218
|
+
/** The largest swap share (bps) whose output clears the floor at `toleranceBps` once `burned` vault tokens are gone; the whole balance when the floor is off. */
|
|
219
|
+
export declare function largestClearingFloor(ctx: Pick<LiquidationContext, "nav" | "floor" | "vaultTokenSupply">, quote: Quote, total: bigint, toleranceBps: bigint, burned?: bigint): Promise<bigint>;
|
|
107
220
|
/**
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* layout cannot be used; otherwise the revert reason, or "" when it succeeds.
|
|
221
|
+
* Sizes the swap, derives the split and says what the Treasury must send. `quote` is Curve's get_dy, so a test can
|
|
222
|
+
* pass a synthetic curve. In "otc" mode nothing is swapped and the Treasury funds the whole uncovered debt.
|
|
111
223
|
*/
|
|
112
|
-
export declare function
|
|
224
|
+
export declare function planLiquidation(ctx: LiquidationContext, target: LiquidationTarget, quote: Quote, params?: PlanParams, mode?: PlanMode): Promise<LiquidationPlan>;
|
|
225
|
+
/** minSharesOut for the RWAVault deposit: previewDeposit less `slippageBps`. Zero when nothing is deposited. */
|
|
226
|
+
export declare const minSharesOut: (target: LiquidationTarget, slippageBps: bigint) => bigint;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import PSMVaultArtifact from "../artifacts/core/psm/PSMVault.sol/PSMVault.json";
|
|
2
|
+
import PSMVaultV2Artifact from "../artifacts/core/psm/v2/PSMVaultV2.sol/PSMVaultV2.json";
|
|
3
|
+
import PSMVaultV3Artifact from "../artifacts/core/psm/v3/PSMVaultV3.sol/PSMVaultV3.json";
|
|
1
4
|
declare const ABIS: {
|
|
2
5
|
crvusd: ({
|
|
3
6
|
inputs: {
|
|
@@ -607,6 +610,63 @@ declare const ABIS: {
|
|
|
607
610
|
type: string;
|
|
608
611
|
anonymous?: undefined;
|
|
609
612
|
})[];
|
|
613
|
+
liquidationswap: ({
|
|
614
|
+
inputs: {
|
|
615
|
+
internalType: string;
|
|
616
|
+
name: string;
|
|
617
|
+
type: string;
|
|
618
|
+
}[];
|
|
619
|
+
stateMutability: string;
|
|
620
|
+
type: string;
|
|
621
|
+
name?: undefined;
|
|
622
|
+
anonymous?: undefined;
|
|
623
|
+
outputs?: undefined;
|
|
624
|
+
} | {
|
|
625
|
+
inputs: {
|
|
626
|
+
internalType: string;
|
|
627
|
+
name: string;
|
|
628
|
+
type: string;
|
|
629
|
+
}[];
|
|
630
|
+
name: string;
|
|
631
|
+
type: string;
|
|
632
|
+
stateMutability?: undefined;
|
|
633
|
+
anonymous?: undefined;
|
|
634
|
+
outputs?: undefined;
|
|
635
|
+
} | {
|
|
636
|
+
anonymous: boolean;
|
|
637
|
+
inputs: {
|
|
638
|
+
indexed: boolean;
|
|
639
|
+
internalType: string;
|
|
640
|
+
name: string;
|
|
641
|
+
type: string;
|
|
642
|
+
}[];
|
|
643
|
+
name: string;
|
|
644
|
+
type: string;
|
|
645
|
+
stateMutability?: undefined;
|
|
646
|
+
outputs?: undefined;
|
|
647
|
+
} | {
|
|
648
|
+
inputs: any[];
|
|
649
|
+
name: string;
|
|
650
|
+
outputs: {
|
|
651
|
+
internalType: string;
|
|
652
|
+
name: string;
|
|
653
|
+
type: string;
|
|
654
|
+
}[];
|
|
655
|
+
stateMutability: string;
|
|
656
|
+
type: string;
|
|
657
|
+
anonymous?: undefined;
|
|
658
|
+
} | {
|
|
659
|
+
inputs: {
|
|
660
|
+
internalType: string;
|
|
661
|
+
name: string;
|
|
662
|
+
type: string;
|
|
663
|
+
}[];
|
|
664
|
+
name: string;
|
|
665
|
+
outputs: any[];
|
|
666
|
+
stateMutability: string;
|
|
667
|
+
type: string;
|
|
668
|
+
anonymous?: undefined;
|
|
669
|
+
})[];
|
|
610
670
|
raacminter: ({
|
|
611
671
|
inputs: {
|
|
612
672
|
internalType: string;
|
|
@@ -3109,6 +3169,62 @@ declare const getABI: (name: keyof typeof ABIS) => any[] | ({
|
|
|
3109
3169
|
type: string;
|
|
3110
3170
|
stateMutability?: undefined;
|
|
3111
3171
|
outputs?: undefined;
|
|
3172
|
+
} | {
|
|
3173
|
+
inputs: any[];
|
|
3174
|
+
name: string;
|
|
3175
|
+
outputs: {
|
|
3176
|
+
internalType: string;
|
|
3177
|
+
name: string;
|
|
3178
|
+
type: string;
|
|
3179
|
+
}[];
|
|
3180
|
+
stateMutability: string;
|
|
3181
|
+
type: string;
|
|
3182
|
+
anonymous?: undefined;
|
|
3183
|
+
} | {
|
|
3184
|
+
inputs: {
|
|
3185
|
+
internalType: string;
|
|
3186
|
+
name: string;
|
|
3187
|
+
type: string;
|
|
3188
|
+
}[];
|
|
3189
|
+
name: string;
|
|
3190
|
+
outputs: any[];
|
|
3191
|
+
stateMutability: string;
|
|
3192
|
+
type: string;
|
|
3193
|
+
anonymous?: undefined;
|
|
3194
|
+
})[] | ({
|
|
3195
|
+
inputs: {
|
|
3196
|
+
internalType: string;
|
|
3197
|
+
name: string;
|
|
3198
|
+
type: string;
|
|
3199
|
+
}[];
|
|
3200
|
+
stateMutability: string;
|
|
3201
|
+
type: string;
|
|
3202
|
+
name?: undefined;
|
|
3203
|
+
anonymous?: undefined;
|
|
3204
|
+
outputs?: undefined;
|
|
3205
|
+
} | {
|
|
3206
|
+
inputs: {
|
|
3207
|
+
internalType: string;
|
|
3208
|
+
name: string;
|
|
3209
|
+
type: string;
|
|
3210
|
+
}[];
|
|
3211
|
+
name: string;
|
|
3212
|
+
type: string;
|
|
3213
|
+
stateMutability?: undefined;
|
|
3214
|
+
anonymous?: undefined;
|
|
3215
|
+
outputs?: undefined;
|
|
3216
|
+
} | {
|
|
3217
|
+
anonymous: boolean;
|
|
3218
|
+
inputs: {
|
|
3219
|
+
indexed: boolean;
|
|
3220
|
+
internalType: string;
|
|
3221
|
+
name: string;
|
|
3222
|
+
type: string;
|
|
3223
|
+
}[];
|
|
3224
|
+
name: string;
|
|
3225
|
+
type: string;
|
|
3226
|
+
stateMutability?: undefined;
|
|
3227
|
+
outputs?: undefined;
|
|
3112
3228
|
} | {
|
|
3113
3229
|
inputs: {
|
|
3114
3230
|
internalType: string;
|
|
@@ -5475,4 +5591,6 @@ declare const getABI: (name: keyof typeof ABIS) => any[] | ({
|
|
|
5475
5591
|
type: string;
|
|
5476
5592
|
anonymous?: undefined;
|
|
5477
5593
|
})[];
|
|
5478
|
-
|
|
5594
|
+
/** PSMVault ABI per implementation major version, matched against the `version` of a chain config `psm` entry. */
|
|
5595
|
+
declare const PSM_VAULT_ABIS: Record<number, typeof PSMVaultArtifact.abi | typeof PSMVaultV2Artifact.abi | typeof PSMVaultV3Artifact.abi>;
|
|
5596
|
+
export { getABI, ABIS, PSM_VAULT_ABIS };
|
|
@@ -133,6 +133,7 @@ export declare const getConfigs: () => {
|
|
|
133
133
|
psm: {
|
|
134
134
|
"rpsm-susds": {
|
|
135
135
|
id: string;
|
|
136
|
+
version: string;
|
|
136
137
|
name: string;
|
|
137
138
|
contract: string;
|
|
138
139
|
rateProvider: string;
|
|
@@ -408,6 +409,7 @@ declare const _default: {
|
|
|
408
409
|
psm: {
|
|
409
410
|
"rpsm-susds": {
|
|
410
411
|
id: string;
|
|
412
|
+
version: string;
|
|
411
413
|
name: string;
|
|
412
414
|
contract: string;
|
|
413
415
|
rateProvider: string;
|
package/dist/utils/artifacts.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ABIS = exports.getABI = void 0;
|
|
6
|
+
exports.PSM_VAULT_ABIS = exports.ABIS = exports.getABI = void 0;
|
|
7
7
|
const crvUSDToken_json_1 = __importDefault(require("../artifacts/mocks/core/tokens/crvUSDToken.sol/crvUSDToken.json")); // assert { type: "json" };
|
|
8
8
|
const pmUSD_json_1 = __importDefault(require("../artifacts/mocks/core/tokens/pmUSD.sol/pmUSD.json")); // assert { type: "json" };
|
|
9
9
|
const xPM_json_1 = __importDefault(require("../artifacts/mocks/core/tokens/xPM.sol/xPM.json")); // assert { type: "json" };
|
|
@@ -11,6 +11,7 @@ const veRAACToken_json_1 = __importDefault(require("../artifacts/core/tokens/veR
|
|
|
11
11
|
const RToken_json_1 = __importDefault(require("../artifacts/core/tokens/RToken.sol/RToken.json")); // assert { type: "json" };
|
|
12
12
|
const LendingPool_json_1 = __importDefault(require("../artifacts/core/pools/LendingPool/LendingPool.sol/LendingPool.json")); // assert { type: "json" };
|
|
13
13
|
const StabilityPool_json_1 = __importDefault(require("../artifacts/core/pools/StabilityPool/StabilityPool.sol/StabilityPool.json")); // assert { type: "json" };
|
|
14
|
+
const LiquidationSwap_json_1 = __importDefault(require("../artifacts/core/pools/StabilityPool/LiquidationSwap.sol/LiquidationSwap.json")); // assert { type: "json" };
|
|
14
15
|
// import LiquidityPoolArtifact from "../artifacts/LiquidityPool/LiquidityPool.sol/LiquidityPool.json"; // assert { type: "json" };
|
|
15
16
|
const RAACNFT_json_1 = __importDefault(require("../artifacts/core/tokens/RAACNFT.sol/RAACNFT.json")); // assert { type: "json" };
|
|
16
17
|
const DEToken_json_1 = __importDefault(require("../artifacts/core/tokens/DEToken.sol/DEToken.json")); // assert { type: "json" };
|
|
@@ -63,6 +64,8 @@ const AladdinZap_json_1 = __importDefault(require("../artifacts/zap/AladdinZap.s
|
|
|
63
64
|
// Testnet faucet (hand-written ABI, Sepolia only)
|
|
64
65
|
const Faucet_json_1 = __importDefault(require("../artifacts/faucet/Faucet.json"));
|
|
65
66
|
const PSMVault_json_1 = __importDefault(require("../artifacts/core/psm/PSMVault.sol/PSMVault.json"));
|
|
67
|
+
const PSMVaultV2_json_1 = __importDefault(require("../artifacts/core/psm/v2/PSMVaultV2.sol/PSMVaultV2.json"));
|
|
68
|
+
const PSMVaultV3_json_1 = __importDefault(require("../artifacts/core/psm/v3/PSMVaultV3.sol/PSMVaultV3.json"));
|
|
66
69
|
const RateProvider_json_1 = __importDefault(require("../artifacts/core/psm/RateProvider.sol/RateProvider.json"));
|
|
67
70
|
const CRVUSD_ABI = crvUSDToken_json_1.default.abi;
|
|
68
71
|
const PMUSD_ABI = pmUSD_json_1.default.abi;
|
|
@@ -112,6 +115,7 @@ const ABIS = {
|
|
|
112
115
|
// Pools
|
|
113
116
|
lendingpool: RAACLENDINGPOOL_ABI,
|
|
114
117
|
stabilitypool: RAACSTABILITYPOOL_ABI,
|
|
118
|
+
liquidationswap: LiquidationSwap_json_1.default.abi,
|
|
115
119
|
// liquiditypool: LIQUIDITYPOOL_ABI,
|
|
116
120
|
raacminter: RAACMINTER_ABI,
|
|
117
121
|
// contracts
|
|
@@ -172,3 +176,10 @@ const getABI = (name) => {
|
|
|
172
176
|
return ABIS[name];
|
|
173
177
|
};
|
|
174
178
|
exports.getABI = getABI;
|
|
179
|
+
/** PSMVault ABI per implementation major version, matched against the `version` of a chain config `psm` entry. */
|
|
180
|
+
const PSM_VAULT_ABIS = {
|
|
181
|
+
1: PSMVault_json_1.default.abi,
|
|
182
|
+
2: PSMVaultV2_json_1.default.abi,
|
|
183
|
+
3: PSMVaultV3_json_1.default.abi,
|
|
184
|
+
};
|
|
185
|
+
exports.PSM_VAULT_ABIS = PSM_VAULT_ABIS;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raac/rpc",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.23",
|
|
4
4
|
"description": "RPC Library for RAAC",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"test:unit": "node -r ts-node/register -r tsconfig-paths/register --test tests/loader.unit.test.ts",
|
|
17
17
|
"test:integration": "node -r ts-node/register -r tsconfig-paths/register --test tests/loader.integration.test.ts",
|
|
18
18
|
"test:e2e": "npm run build && node -r ts-node/register -r tsconfig-paths/register --test tests/loader.e2e.test.ts",
|
|
19
|
+
"test:fork": "node --env-file-if-exists=.env -r ts-node/register/transpile-only tests/liquidationFork.test.ts",
|
|
19
20
|
"test:browser": "node tests/browser/server.js --local",
|
|
20
21
|
"test:browser:published": "open tests/browser/index.html",
|
|
21
22
|
"sync": "bash setup.sh",
|