@raac/rpc 2.0.0-beta.11 → 2.0.0-beta.13
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 +53 -22
- package/dist/configs/chains/11155111.json +16 -28
- package/dist/contracts/complianceRegistry/getStatuses.js +40 -0
- package/dist/contracts/crvUSDToUSDOracle/getState.js +58 -0
- package/dist/contracts/curve/common/_helpers.js +57 -0
- package/dist/contracts/curve/common/addLiquidity.js +30 -0
- package/dist/contracts/curve/common/calcTokenAmount.js +23 -0
- package/dist/contracts/curve/common/calcWithdrawOneCoin.js +21 -0
- package/dist/contracts/curve/common/exchange.js +33 -0
- package/dist/contracts/curve/common/getDy.js +22 -0
- package/dist/contracts/curve/common/index.js +7 -0
- package/dist/contracts/curve/common/removeLiquidity.js +30 -0
- package/dist/contracts/curve/common/removeLiquidityOneCoin.js +31 -0
- package/dist/contracts/faucet/claim.js +37 -0
- package/dist/contracts/faucet/index.js +17 -0
- package/dist/contracts/feeCollector/getState.js +100 -0
- package/dist/contracts/getRoles.js +35 -0
- package/dist/contracts/housePrices/getState.js +41 -0
- package/dist/contracts/psm/getVaultSettings.js +60 -0
- package/dist/contracts/treasury/getState.js +46 -0
- package/dist/minter/emissionSchedule.js +90 -0
- package/dist/pools/lendingPool/getAdminState.js +47 -0
- package/dist/pools/rwaVault/getRegisteredAdapters.js +78 -0
- package/dist/pools/rwaVault/getSeedStatus.js +45 -0
- package/dist/pools/stabilityPool/getAdminState.js +42 -0
- package/dist/pools/stabilityPool/liquidation.js +297 -0
- package/dist/prices/tokenPricesUSD.js +0 -2
- package/dist/types/RPCLibrary.d.ts +44 -14
- package/dist/types/contracts/complianceRegistry/getStatuses.d.ts +25 -0
- package/dist/types/contracts/crvUSDToUSDOracle/getState.d.ts +36 -0
- package/dist/types/contracts/curve/common/_helpers.d.ts +10 -1
- package/dist/types/contracts/curve/common/addLiquidity.d.ts +14 -0
- package/dist/types/contracts/curve/common/calcTokenAmount.d.ts +10 -0
- package/dist/types/contracts/curve/common/calcWithdrawOneCoin.d.ts +8 -0
- package/dist/types/contracts/curve/common/exchange.d.ts +16 -0
- package/dist/types/contracts/curve/common/getDy.d.ts +8 -0
- package/dist/types/contracts/curve/common/index.d.ts +7 -0
- package/dist/types/contracts/curve/common/removeLiquidity.d.ts +14 -0
- package/dist/types/contracts/curve/common/removeLiquidityOneCoin.d.ts +15 -0
- package/dist/types/contracts/faucet/claim.d.ts +18 -0
- package/dist/types/contracts/faucet/index.d.ts +1 -0
- package/dist/types/contracts/feeCollector/getState.d.ts +42 -0
- package/dist/types/contracts/getRoles.d.ts +15 -0
- package/dist/types/contracts/housePrices/getState.d.ts +24 -0
- package/dist/types/contracts/psm/getVaultSettings.d.ts +38 -0
- package/dist/types/contracts/treasury/getState.d.ts +24 -0
- package/dist/types/minter/emissionSchedule.d.ts +53 -0
- package/dist/types/pools/lendingPool/getAdminState.d.ts +26 -0
- package/dist/types/pools/rwaVault/getRegisteredAdapters.d.ts +33 -0
- package/dist/types/pools/rwaVault/getSeedStatus.d.ts +27 -0
- package/dist/types/pools/stabilityPool/getAdminState.d.ts +25 -0
- package/dist/types/pools/stabilityPool/liquidation.d.ts +112 -0
- package/dist/types/typechain-types/contracts/core/collectors/index.d.ts +0 -2
- package/dist/types/typechain-types/contracts/mocks/core/tokens/index.d.ts +0 -1
- package/dist/types/typechain-types/factories/contracts/core/collectors/index.d.ts +0 -1
- package/dist/types/typechain-types/factories/contracts/mocks/core/tokens/index.d.ts +0 -1
- package/dist/types/typechain-types/index.d.ts +0 -4
- package/dist/types/utils/artifacts.d.ts +0 -198
- package/dist/utils/artifacts.js +0 -4
- package/package.json +14 -4
- package/dist/artifacts/core/collectors/fee-streamer/RentStreamer.sol/RentStreamer.json +0 -838
- package/dist/artifacts/mocks/core/tokens/USDCTokenLimited.sol/USDCTokenLimited.json +0 -558
- package/dist/contracts/rentStreamer/_helpers.js +0 -19
- package/dist/contracts/rentStreamer/getEpochProjection.js +0 -91
- package/dist/contracts/rentStreamer/getScheduled.js +0 -19
- package/dist/contracts/rentStreamer/getState.js +0 -40
- package/dist/contracts/rentStreamer/previewRelease.js +0 -23
- package/dist/contracts/rentStreamer/release.js +0 -22
- package/dist/contracts/rentStreamer/sync.js +0 -21
- package/dist/types/contracts/rentStreamer/_helpers.d.ts +0 -4
- package/dist/types/contracts/rentStreamer/getEpochProjection.d.ts +0 -40
- package/dist/types/contracts/rentStreamer/getScheduled.d.ts +0 -12
- package/dist/types/contracts/rentStreamer/getState.d.ts +0 -33
- package/dist/types/contracts/rentStreamer/previewRelease.d.ts +0 -20
- package/dist/types/contracts/rentStreamer/release.d.ts +0 -12
- package/dist/types/contracts/rentStreamer/sync.d.ts +0 -11
- package/dist/types/typechain-types/contracts/core/collectors/fee-streamer/RentStreamer.d.ts +0 -422
- package/dist/types/typechain-types/contracts/core/collectors/fee-streamer/index.d.ts +0 -1
- package/dist/types/typechain-types/contracts/mocks/core/tokens/USDCTokenLimited.d.ts +0 -238
- package/dist/types/typechain-types/factories/contracts/core/collectors/fee-streamer/RentStreamer__factory.d.ts +0 -665
- package/dist/types/typechain-types/factories/contracts/core/collectors/fee-streamer/index.d.ts +0 -1
- package/dist/types/typechain-types/factories/contracts/mocks/core/tokens/USDCTokenLimited__factory.d.ts +0 -439
package/dist/RPCLibrary.js
CHANGED
|
@@ -146,12 +146,7 @@ const priceAt_1 = require("./contracts/zeno/priceAt");
|
|
|
146
146
|
const quoteBuy_1 = require("./contracts/zeno/quoteBuy");
|
|
147
147
|
const getBaseUri_1 = __importDefault(require("./nfts/getBaseUri"));
|
|
148
148
|
const claimRewardFromPool_1 = __importDefault(require("./contracts/feeCollector/claimRewardFromPool"));
|
|
149
|
-
const getState_1 = require("./contracts/
|
|
150
|
-
const previewRelease_1 = require("./contracts/rentStreamer/previewRelease");
|
|
151
|
-
const getScheduled_1 = require("./contracts/rentStreamer/getScheduled");
|
|
152
|
-
const getEpochProjection_1 = require("./contracts/rentStreamer/getEpochProjection");
|
|
153
|
-
const sync_1 = require("./contracts/rentStreamer/sync");
|
|
154
|
-
const release_1 = require("./contracts/rentStreamer/release");
|
|
149
|
+
const getState_1 = __importDefault(require("./contracts/feeCollector/getState"));
|
|
155
150
|
const getRawUserDepositsInLendingPool_1 = __importDefault(require("./pools/lendingPool/getRawUserDepositsInLendingPool"));
|
|
156
151
|
const getRawUserDepositsInStabilityPool_1 = __importDefault(require("./pools/stabilityPool/getRawUserDepositsInStabilityPool"));
|
|
157
152
|
const getEligibleUserDeposits_1 = __importDefault(require("./pools/lendingPool/getEligibleUserDeposits"));
|
|
@@ -189,6 +184,18 @@ const getWithdrawTimelockConfig_1 = require("./pools/stabilityPool/getWithdrawTi
|
|
|
189
184
|
const requestWithdraw_1 = require("./pools/stabilityPool/requestWithdraw");
|
|
190
185
|
// PSM
|
|
191
186
|
const getVaultInfo_1 = require("./contracts/psm/getVaultInfo");
|
|
187
|
+
const getVaultSettings_1 = require("./contracts/psm/getVaultSettings");
|
|
188
|
+
const getState_2 = __importDefault(require("./contracts/housePrices/getState"));
|
|
189
|
+
const getState_3 = __importDefault(require("./contracts/crvUSDToUSDOracle/getState"));
|
|
190
|
+
const getRoles_1 = __importDefault(require("./contracts/getRoles"));
|
|
191
|
+
const getState_4 = __importDefault(require("./contracts/treasury/getState"));
|
|
192
|
+
const getStatuses_1 = __importDefault(require("./contracts/complianceRegistry/getStatuses"));
|
|
193
|
+
const getAdminState_1 = __importDefault(require("./pools/stabilityPool/getAdminState"));
|
|
194
|
+
const liquidation_1 = require("./pools/stabilityPool/liquidation");
|
|
195
|
+
const emissionSchedule_1 = require("./minter/emissionSchedule");
|
|
196
|
+
const getRegisteredAdapters_1 = __importDefault(require("./pools/rwaVault/getRegisteredAdapters"));
|
|
197
|
+
const getSeedStatus_1 = __importDefault(require("./pools/rwaVault/getSeedStatus"));
|
|
198
|
+
const getAdminState_2 = __importDefault(require("./pools/lendingPool/getAdminState"));
|
|
192
199
|
const previewDeposit_2 = require("./contracts/psm/previewDeposit");
|
|
193
200
|
const previewRedeem_1 = require("./contracts/psm/previewRedeem");
|
|
194
201
|
const previewSwap_1 = require("./contracts/psm/previewSwap");
|
|
@@ -212,6 +219,7 @@ const controllerMethods = __importStar(require("./contracts/governance/gaugeCont
|
|
|
212
219
|
const gaugeSystemMethods = __importStar(require("./contracts/governance/gaugeSystems"));
|
|
213
220
|
// ===== Curve =====
|
|
214
221
|
const curveCommonMethods = __importStar(require("./contracts/curve/common"));
|
|
222
|
+
const faucetMethods = __importStar(require("./contracts/faucet"));
|
|
215
223
|
// ===== User aggregates (dashboard) =====
|
|
216
224
|
const userMethods = __importStar(require("./user"));
|
|
217
225
|
// Proposals
|
|
@@ -220,7 +228,7 @@ const getQuorumNumerator_1 = require("./contracts/governance/proposals/getQuorum
|
|
|
220
228
|
const getVotingPeriod_1 = require("./contracts/governance/proposals/getVotingPeriod");
|
|
221
229
|
const castVote_1 = require("./contracts/governance/proposals/castVote");
|
|
222
230
|
const getProposalInfo_1 = require("./contracts/governance/proposals/getProposalInfo");
|
|
223
|
-
const
|
|
231
|
+
const getState_5 = require("./contracts/governance/proposals/getState");
|
|
224
232
|
const execute_1 = require("./contracts/governance/proposals/execute");
|
|
225
233
|
const getProposalThreshold_1 = require("./contracts/governance/proposals/getProposalThreshold");
|
|
226
234
|
const getVotes_1 = require("./contracts/governance/proposals/getVotes");
|
|
@@ -234,7 +242,7 @@ const hasVoted_1 = require("./contracts/governance/proposals/hasVoted");
|
|
|
234
242
|
const getVoteReceipt_1 = require("./contracts/governance/proposals/getVoteReceipt");
|
|
235
243
|
const getProposalEta_1 = require("./contracts/governance/proposals/getProposalEta");
|
|
236
244
|
const getLabel_1 = require("./contracts/governance/proposals/getLabel");
|
|
237
|
-
const
|
|
245
|
+
const getRoles_2 = require("./contracts/governance/proposals/getRoles");
|
|
238
246
|
const hasRole_1 = require("./contracts/governance/proposals/hasRole");
|
|
239
247
|
const setParameter_1 = require("./contracts/governance/proposals/setParameter");
|
|
240
248
|
const setTimelock_1 = require("./contracts/governance/proposals/setTimelock");
|
|
@@ -246,7 +254,7 @@ const hashOperationBatch_1 = require("./contracts/governance/timelock/hashOperat
|
|
|
246
254
|
const isOperationDone_1 = require("./contracts/governance/timelock/isOperationDone");
|
|
247
255
|
const isOperationReady_1 = require("./contracts/governance/timelock/isOperationReady");
|
|
248
256
|
const isOperationPending_1 = require("./contracts/governance/timelock/isOperationPending");
|
|
249
|
-
const
|
|
257
|
+
const getRoles_3 = require("./contracts/governance/timelock/getRoles");
|
|
250
258
|
const hasRole_2 = require("./contracts/governance/timelock/hasRole");
|
|
251
259
|
// Tokens
|
|
252
260
|
// PMUSD
|
|
@@ -347,7 +355,7 @@ const getLocks_2 = require("./contracts/lockers/botLocker/getLocks");
|
|
|
347
355
|
const getLockedTokenIds_1 = require("./contracts/lockers/botLocker/getLockedTokenIds");
|
|
348
356
|
const getConfig_3 = require("./contracts/lockers/botLocker/getConfig");
|
|
349
357
|
const getUnlockWindow_1 = require("./contracts/lockers/botLocker/getUnlockWindow");
|
|
350
|
-
const
|
|
358
|
+
const getRoles_4 = require("./contracts/lockers/botLocker/getRoles");
|
|
351
359
|
const hasRole_3 = require("./contracts/lockers/botLocker/hasRole");
|
|
352
360
|
const grantRole_2 = require("./contracts/lockers/botLocker/grantRole");
|
|
353
361
|
const addRewardTokens_1 = require("./contracts/lockers/botLocker/addRewardTokens");
|
|
@@ -412,6 +420,7 @@ class RPCLibrary {
|
|
|
412
420
|
// prices
|
|
413
421
|
// Curve pools from the chain config's `curve` section
|
|
414
422
|
curve;
|
|
423
|
+
faucet;
|
|
415
424
|
// Aggregate reads of one user's position and claimables, composed from the methods above
|
|
416
425
|
user;
|
|
417
426
|
prices;
|
|
@@ -495,8 +504,19 @@ class RPCLibrary {
|
|
|
495
504
|
this.contracts = {
|
|
496
505
|
housePrices: {
|
|
497
506
|
getLatestPrice: getLatestPrice_1.default,
|
|
507
|
+
getState: getState_2.default,
|
|
498
508
|
setOracle: setOracle_1.default,
|
|
499
509
|
},
|
|
510
|
+
crvUSDToUSDOracle: {
|
|
511
|
+
getState: getState_3.default,
|
|
512
|
+
},
|
|
513
|
+
treasury: {
|
|
514
|
+
getState: getState_4.default,
|
|
515
|
+
},
|
|
516
|
+
complianceRegistry: {
|
|
517
|
+
getStatuses: getStatuses_1.default,
|
|
518
|
+
},
|
|
519
|
+
getRoles: getRoles_1.default,
|
|
500
520
|
minter: {
|
|
501
521
|
tick: tick_1.default,
|
|
502
522
|
get: get_1.default,
|
|
@@ -512,6 +532,10 @@ class RPCLibrary {
|
|
|
512
532
|
calculateScheduledMintableAmount: calculateScheduledMintableAmount_1.calculateScheduledMintableAmount,
|
|
513
533
|
getEmissionPerSecond: getEmissionPerSecond_1.getEmissionPerSecond,
|
|
514
534
|
isPaused: isPaused_1.isPaused,
|
|
535
|
+
getEmissionSchedule: emissionSchedule_1.getEmissionSchedule,
|
|
536
|
+
getSchedulePosition: emissionSchedule_1.getSchedulePosition,
|
|
537
|
+
getEmissionPerSecondForWeek: emissionSchedule_1.getEmissionPerSecondForWeek,
|
|
538
|
+
getMintingWeekForTimestamp: emissionSchedule_1.getMintingWeekForTimestamp,
|
|
515
539
|
},
|
|
516
540
|
getContractAddress: getContractAddress_1.default,
|
|
517
541
|
getContract: getContract_1.default,
|
|
@@ -522,14 +546,7 @@ class RPCLibrary {
|
|
|
522
546
|
getTokenMetadata: getTokenMetadata_1.getTokenMetadata,
|
|
523
547
|
feeCollector: {
|
|
524
548
|
claimRewardFromPool: claimRewardFromPool_1.default,
|
|
525
|
-
|
|
526
|
-
rentStreamer: {
|
|
527
|
-
getState: getState_1.getState,
|
|
528
|
-
previewRelease: previewRelease_1.previewRelease,
|
|
529
|
-
getScheduled: getScheduled_1.getScheduled,
|
|
530
|
-
getEpochProjection: getEpochProjection_1.getEpochProjection,
|
|
531
|
-
sync: sync_1.sync,
|
|
532
|
-
release: release_1.release,
|
|
549
|
+
getState: getState_1.default,
|
|
533
550
|
},
|
|
534
551
|
getABI: artifacts_1.getABI,
|
|
535
552
|
pmTreasury: {
|
|
@@ -675,7 +692,7 @@ class RPCLibrary {
|
|
|
675
692
|
getLockedTokenIds: getLockedTokenIds_1.getLockedTokenIds,
|
|
676
693
|
getConfig: getConfig_3.getConfig,
|
|
677
694
|
getUnlockWindow: getUnlockWindow_1.getUnlockWindow,
|
|
678
|
-
getRoles:
|
|
695
|
+
getRoles: getRoles_4.getRoles,
|
|
679
696
|
hasRole: hasRole_3.hasRole,
|
|
680
697
|
grantRole: grantRole_2.grantRole,
|
|
681
698
|
revokeRole: grantRole_2.revokeRole,
|
|
@@ -725,7 +742,7 @@ class RPCLibrary {
|
|
|
725
742
|
getVotingPeriod: getVotingPeriod_1.getVotingPeriod,
|
|
726
743
|
castVote: castVote_1.castVote,
|
|
727
744
|
getProposalInfo: getProposalInfo_1.getProposalInfo,
|
|
728
|
-
getState:
|
|
745
|
+
getState: getState_5.getState,
|
|
729
746
|
execute: execute_1.execute,
|
|
730
747
|
getProposalThreshold: getProposalThreshold_1.getProposalThreshold,
|
|
731
748
|
getVotes: getVotes_1.getVotes,
|
|
@@ -739,7 +756,7 @@ class RPCLibrary {
|
|
|
739
756
|
getVoteReceipt: getVoteReceipt_1.getVoteReceipt,
|
|
740
757
|
getProposalEta: getProposalEta_1.getProposalEta,
|
|
741
758
|
getLabel: getLabel_1.getLabel,
|
|
742
|
-
getRoles:
|
|
759
|
+
getRoles: getRoles_2.getRoles,
|
|
743
760
|
hasRole: hasRole_1.hasRole,
|
|
744
761
|
setParameter: setParameter_1.setParameter,
|
|
745
762
|
setTimelock: setTimelock_1.setTimelock,
|
|
@@ -752,12 +769,13 @@ class RPCLibrary {
|
|
|
752
769
|
isOperationDone: isOperationDone_1.isOperationDone,
|
|
753
770
|
isOperationReady: isOperationReady_1.isOperationReady,
|
|
754
771
|
isOperationPending: isOperationPending_1.isOperationPending,
|
|
755
|
-
getRoles:
|
|
772
|
+
getRoles: getRoles_3.getRoles,
|
|
756
773
|
hasRole: hasRole_2.hasRole,
|
|
757
774
|
},
|
|
758
775
|
};
|
|
759
776
|
this.psm = {
|
|
760
777
|
getVaultInfo: getVaultInfo_1.getVaultInfo,
|
|
778
|
+
getVaultSettings: getVaultSettings_1.getVaultSettings,
|
|
761
779
|
previewDeposit: previewDeposit_2.previewDeposit,
|
|
762
780
|
previewRedeem: previewRedeem_1.previewRedeem,
|
|
763
781
|
previewSwap: previewSwap_1.previewSwap,
|
|
@@ -777,6 +795,15 @@ class RPCLibrary {
|
|
|
777
795
|
getWithdrawRequestInfo: getWithdrawRequestInfo_1.getWithdrawRequestInfo,
|
|
778
796
|
getWithdrawTimelockConfig: getWithdrawTimelockConfig_1.getWithdrawTimelockConfig,
|
|
779
797
|
requestWithdraw: requestWithdraw_1.requestWithdraw,
|
|
798
|
+
getAdminState: getAdminState_1.default,
|
|
799
|
+
liquidation: {
|
|
800
|
+
getContext: liquidation_1.readLiquidationContext,
|
|
801
|
+
getTarget: liquidation_1.readLiquidationTarget,
|
|
802
|
+
quote: liquidation_1.quoteLiquidation,
|
|
803
|
+
suggestSplit: liquidation_1.suggestSplit,
|
|
804
|
+
simulateWithSplit: liquidation_1.simulateWithSplit,
|
|
805
|
+
minSharesOut: liquidation_1.minSharesOut,
|
|
806
|
+
},
|
|
780
807
|
},
|
|
781
808
|
// LendingPool
|
|
782
809
|
lendingPool: {
|
|
@@ -788,6 +815,7 @@ class RPCLibrary {
|
|
|
788
815
|
depositAssetToLendingPool: depositAssetToLendingPool_1.default,
|
|
789
816
|
withdrawAssetFromLendingPool: withdrawAssetFromLendingPool_1.default,
|
|
790
817
|
getLendingPoolInfo: getLendingPoolInfo_1.default,
|
|
818
|
+
getAdminState: getAdminState_2.default,
|
|
791
819
|
getRawUserDepositsInLendingPool: getRawUserDepositsInLendingPool_1.default,
|
|
792
820
|
getEligibleUserDeposits: getEligibleUserDeposits_1.default,
|
|
793
821
|
getHealthFactor: getHealthFactor_1.default,
|
|
@@ -818,6 +846,8 @@ class RPCLibrary {
|
|
|
818
846
|
depositToRWAVault: depositToRWAVault_1.default,
|
|
819
847
|
redeemNFTFromRWAVault: redeemNFTFromRWAVault_1.default,
|
|
820
848
|
getRWAVaultInfo: getRWAVaultInfo_1.default,
|
|
849
|
+
getRegisteredAdapters: getRegisteredAdapters_1.default,
|
|
850
|
+
getSeedStatus: getSeedStatus_1.default,
|
|
821
851
|
getNextRandomNFT: getNextRandomNFT_1.default,
|
|
822
852
|
checkRedeemEligibility: checkRedeemEligibility_1.checkRedeemEligibility,
|
|
823
853
|
requestRandomSeed: requestRandomSeed_1.default,
|
|
@@ -871,6 +901,7 @@ class RPCLibrary {
|
|
|
871
901
|
this.curve = {
|
|
872
902
|
common: curveCommonMethods,
|
|
873
903
|
};
|
|
904
|
+
this.faucet = faucetMethods;
|
|
874
905
|
this.user = userMethods;
|
|
875
906
|
this.prices = {
|
|
876
907
|
getPrices: getPrices_1.getPrices,
|
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
}
|
|
15
15
|
],
|
|
16
16
|
"contracts": {
|
|
17
|
+
"faucet": {
|
|
18
|
+
"id": "faucet",
|
|
19
|
+
"name": "Testnet Faucet",
|
|
20
|
+
"contract": "0xcFcAE14bC0Ef0CB5CD4466b916F518A393d7f2a7"
|
|
21
|
+
},
|
|
17
22
|
"raachouseprices": {
|
|
18
23
|
"id": "raachouseprices",
|
|
19
24
|
"name": "RAAC House Prices",
|
|
@@ -103,11 +108,6 @@
|
|
|
103
108
|
"id": "crvusdtousdoracle",
|
|
104
109
|
"name": "pmUSD to USD Oracle",
|
|
105
110
|
"contract": "0xDC97F7E1C11E339cfE91Dac799D168F922c57b20"
|
|
106
|
-
},
|
|
107
|
-
"rentstreamer": {
|
|
108
|
-
"id": "rentstreamer",
|
|
109
|
-
"name": "Rent Streamer",
|
|
110
|
-
"contract": "0xe1BD7Afe892509b752FA30cf04049Fb45Af022f3"
|
|
111
111
|
}
|
|
112
112
|
},
|
|
113
113
|
"gauges": {
|
|
@@ -135,12 +135,6 @@
|
|
|
135
135
|
"name": "r-ireetpmUSD (iREET/pmUSD LP)",
|
|
136
136
|
"contract": "0x084D7252d83AD886348EC58f4b1e5261Ab7f67c9",
|
|
137
137
|
"stakingToken": "0x7F7d0924C9082F4C3F0D5D97bF9a26C3D3DEf706"
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
"id": "r-leraacraacpmUSD",
|
|
141
|
-
"name": "r-leraacraacpmUSD (leRAAC/RAAC/pmUSD LP)",
|
|
142
|
-
"contract": "0x1239C9035Ba29e073b225C78ae97c1A5D6cD6a1E",
|
|
143
|
-
"stakingToken": "0x1D0805Bd3EF5338b66158770c28fD6f4Cd685F28"
|
|
144
138
|
}
|
|
145
139
|
]
|
|
146
140
|
},
|
|
@@ -148,16 +142,9 @@
|
|
|
148
142
|
"id": "rwagauges",
|
|
149
143
|
"label": "RWA Gauges",
|
|
150
144
|
"gaugeType": "RWAGauge",
|
|
151
|
-
"controller": "
|
|
152
|
-
"distributor": "
|
|
153
|
-
"gauges": [
|
|
154
|
-
{
|
|
155
|
-
"id": "rwa-ireetpmUSD",
|
|
156
|
-
"name": "rwa-ireetpmUSD (iREET/pmUSD LP)",
|
|
157
|
-
"contract": "0x9100E30Cd4E28027A8B769BCbA3C8BE06FC81cf8",
|
|
158
|
-
"stakingToken": "0x7F7d0924C9082F4C3F0D5D97bF9a26C3D3DEf706"
|
|
159
|
-
}
|
|
160
|
-
]
|
|
145
|
+
"controller": "0x0000000000000000000000000000000000000000",
|
|
146
|
+
"distributor": "0x0000000000000000000000000000000000000000",
|
|
147
|
+
"gauges": []
|
|
161
148
|
}
|
|
162
149
|
},
|
|
163
150
|
"proposals": [
|
|
@@ -174,6 +161,14 @@
|
|
|
174
161
|
"timelock": "0x16fe0d26550aEEca53f5eF2FFE2DBc9319B3F212"
|
|
175
162
|
}
|
|
176
163
|
],
|
|
164
|
+
"psm": {
|
|
165
|
+
"rpsm-susds": {
|
|
166
|
+
"id": "rpsm-sUSDS",
|
|
167
|
+
"name": "RAAC Peg Stability Module sUSDS",
|
|
168
|
+
"contract": "0xbcA54A6E7BeD62Ad3aA5660c0e51FeA1F6A47289",
|
|
169
|
+
"rateProvider": "0xB3b47F65dFeca20991148BAfe8dc34e1aDb6939b"
|
|
170
|
+
}
|
|
171
|
+
},
|
|
177
172
|
"pools": {
|
|
178
173
|
"stabilitypool": {
|
|
179
174
|
"id": "stabilitypool",
|
|
@@ -269,13 +264,6 @@
|
|
|
269
264
|
"decimals": 18,
|
|
270
265
|
"contract": "0x0D63FFffF740A0B5DbcC6C70774FDA1456195a3c"
|
|
271
266
|
},
|
|
272
|
-
"usdc": {
|
|
273
|
-
"id": "usdc",
|
|
274
|
-
"name": "USDC",
|
|
275
|
-
"symbol": "USDC",
|
|
276
|
-
"decimals": 6,
|
|
277
|
-
"contract": "0xBBfc1B017954e2F65378b189735dd7be279AbC2A"
|
|
278
|
-
},
|
|
279
267
|
"rtoken": {
|
|
280
268
|
"id": "rtoken",
|
|
281
269
|
"name": "RToken",
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const ethers_1 = require("ethers");
|
|
4
|
+
const contracts_1 = require("../../utils/contracts");
|
|
5
|
+
const artifacts_1 = require("../../utils/artifacts");
|
|
6
|
+
const rpcError_1 = require("../../utils/rpcError");
|
|
7
|
+
// ComplianceRegistry storage: AccessControl._roles at slot 0, _blacklisted at slot 1, sanctionsList at slot 2.
|
|
8
|
+
const BLACKLIST_SLOT = 1;
|
|
9
|
+
const SANCTIONS_SLOT = 2;
|
|
10
|
+
const listedSlot = (user) => ethers_1.ethers.keccak256(ethers_1.ethers.AbiCoder.defaultAbiCoder().encode(["address", "uint256"], [user, BLACKLIST_SLOT]));
|
|
11
|
+
/**
|
|
12
|
+
* Reads the sanctions list and each address's compliance status. `_blacklisted` is private, so the own-list flag is
|
|
13
|
+
* read from storage, trusted only when slot 2 matches `sanctionsList()`; otherwise `listed` is null where it cannot
|
|
14
|
+
* be told apart from a sanction.
|
|
15
|
+
* @param chainId The chain id.
|
|
16
|
+
* @param addresses The addresses to check.
|
|
17
|
+
* @param provider The provider to read with.
|
|
18
|
+
*/
|
|
19
|
+
async function getStatuses(chainId, addresses, provider) {
|
|
20
|
+
const at = (0, contracts_1.getContractAddress)(chainId, "complianceregistry");
|
|
21
|
+
try {
|
|
22
|
+
const reg = new ethers_1.ethers.Contract(at, (0, artifacts_1.getABI)("complianceregistry"), provider);
|
|
23
|
+
const [list, slot2] = await Promise.all([reg.sanctionsList(), provider.getStorage(at, SANCTIONS_SLOT).catch(() => null)]);
|
|
24
|
+
const layoutOk = slot2 !== null && BigInt(slot2) === BigInt(list);
|
|
25
|
+
const sanctions = list === ethers_1.ethers.ZeroAddress ? null : new ethers_1.ethers.Contract(list, ["function isSanctioned(address) view returns (bool)"], provider);
|
|
26
|
+
const statuses = await Promise.all(addresses.map(async (address) => {
|
|
27
|
+
const [blocked, sanctioned, listed] = await Promise.all([
|
|
28
|
+
reg.isBlacklisted(address),
|
|
29
|
+
sanctions ? sanctions.isSanctioned(address) : false,
|
|
30
|
+
layoutOk ? provider.getStorage(at, listedSlot(address)).then((v) => BigInt(v) !== BigInt(0)) : null,
|
|
31
|
+
]);
|
|
32
|
+
return { address, blocked, listed: listed ?? (sanctioned ? null : blocked), sanctioned };
|
|
33
|
+
}));
|
|
34
|
+
return { sanctionsList: list, statuses };
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
throw (0, rpcError_1.toRpcError)("complianceRegistry.getStatuses", error, { chainId, address: at });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.default = getStatuses;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CRVUSD_PRICE_SOURCES = void 0;
|
|
4
|
+
const ethers_1 = require("ethers");
|
|
5
|
+
const contracts_1 = require("../../utils/contracts");
|
|
6
|
+
const artifacts_1 = require("../../utils/artifacts");
|
|
7
|
+
const rpcError_1 = require("../../utils/rpcError");
|
|
8
|
+
/** Which route the crvUSD/USD price came from, as `getLatestPrice`'s third value reports it. */
|
|
9
|
+
exports.CRVUSD_PRICE_SOURCES = ["chainlink", "curve", "fallback"];
|
|
10
|
+
/**
|
|
11
|
+
* Reads the crvUSD/USD oracle's current price and route and every setting behind them. A reverting price read gives
|
|
12
|
+
* `price: null` instead of failing, since that is exactly when the settings matter.
|
|
13
|
+
* @param chainId The chain id.
|
|
14
|
+
* @param provider The provider to read with.
|
|
15
|
+
* @param oracleAddress Optional address, e.g. from `housePrices.getState`; defaults to the registry's `crvusdtousdoracle`.
|
|
16
|
+
*/
|
|
17
|
+
async function getState(chainId, provider, oracleAddress) {
|
|
18
|
+
const address = oracleAddress ?? (0, contracts_1.getContractAddress)(chainId, "crvusdtousdoracle");
|
|
19
|
+
try {
|
|
20
|
+
const oracle = new ethers_1.ethers.Contract(address, (0, artifacts_1.getABI)("crvusdtousdoracle"), provider);
|
|
21
|
+
const [owner, latest, circuitBreakerEnabled, minPriceThreshold, maxPriceThreshold, fallbackPriceInUSD, lastFallbackUpdateTimestamp, maxStableStaleTime, maxUnstableStaleTime, crvUSDDataFeed, ethDataFeed, curveOracle, K] = await Promise.all([
|
|
22
|
+
oracle.owner(),
|
|
23
|
+
oracle.getLatestPrice().catch(() => null),
|
|
24
|
+
oracle.circuitBreakerEnabled(),
|
|
25
|
+
oracle.minPriceThreshold(),
|
|
26
|
+
oracle.maxPriceThreshold(),
|
|
27
|
+
oracle.fallbackPriceInUSD(),
|
|
28
|
+
oracle.lastFallbackUpdateTimestamp(),
|
|
29
|
+
oracle.maxStableStaleTime(),
|
|
30
|
+
oracle.maxUnstableStaleTime(),
|
|
31
|
+
oracle.crvUSDDataFeed(),
|
|
32
|
+
oracle.ethDataFeed(),
|
|
33
|
+
oracle.curveOracle(),
|
|
34
|
+
oracle.K(),
|
|
35
|
+
]);
|
|
36
|
+
return {
|
|
37
|
+
owner,
|
|
38
|
+
price: latest ? latest[0] : null,
|
|
39
|
+
priceTimestamp: latest ? Number(latest[1]) : null,
|
|
40
|
+
source: latest ? (exports.CRVUSD_PRICE_SOURCES[Number(latest[2])] ?? null) : null,
|
|
41
|
+
circuitBreakerEnabled,
|
|
42
|
+
minPriceThreshold,
|
|
43
|
+
maxPriceThreshold,
|
|
44
|
+
fallbackPriceInUSD,
|
|
45
|
+
lastFallbackUpdateTimestamp: Number(lastFallbackUpdateTimestamp),
|
|
46
|
+
maxStableStaleTime,
|
|
47
|
+
maxUnstableStaleTime,
|
|
48
|
+
crvUSDDataFeed,
|
|
49
|
+
ethDataFeed,
|
|
50
|
+
curveOracle,
|
|
51
|
+
K,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
throw (0, rpcError_1.toRpcError)("crvUSDToUSDOracle.getState", error, { chainId, address });
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.default = getState;
|
|
@@ -6,6 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.getCurvePools = exports.CURVE_POOL_READ_ABI = void 0;
|
|
7
7
|
exports.resolveCurvePool = resolveCurvePool;
|
|
8
8
|
exports.getCurvePoolContract = getCurvePoolContract;
|
|
9
|
+
exports.getCurvePoolFlavourContract = getCurvePoolFlavourContract;
|
|
10
|
+
exports.assertCoinCount = assertCoinCount;
|
|
11
|
+
exports.assertCoinIndex = assertCoinIndex;
|
|
9
12
|
const ethers_1 = require("ethers");
|
|
10
13
|
const chains_1 = __importDefault(require("../../../configs/chains"));
|
|
11
14
|
/**
|
|
@@ -37,3 +40,57 @@ function getCurvePoolContract(chainId, poolAddressOrId, provider) {
|
|
|
37
40
|
const entry = resolveCurvePool(chainId, poolAddressOrId);
|
|
38
41
|
return { entry, contract: new ethers_1.ethers.Contract(entry.contract, exports.CURVE_POOL_READ_ABI, provider), provider };
|
|
39
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Swap and liquidity methods per flavour. twocrypto-ng and tricrypto-ng index coins with uint256 and take fixed
|
|
45
|
+
* uint256[2] / uint256[3] arrays; stableswap-ng indexes with int128 and takes a dynamic uint256[]. Encoding one
|
|
46
|
+
* against another reverts, so the pool's configured flavour picks the ABI.
|
|
47
|
+
*/
|
|
48
|
+
const CURVE_POOL_WRITE_ABI = {
|
|
49
|
+
twocrypto: [
|
|
50
|
+
"function get_dy(uint256 i, uint256 j, uint256 dx) view returns (uint256)",
|
|
51
|
+
"function calc_withdraw_one_coin(uint256 token_amount, uint256 i) view returns (uint256)",
|
|
52
|
+
"function calc_token_amount(uint256[2] amounts, bool deposit) view returns (uint256)",
|
|
53
|
+
"function exchange(uint256 i, uint256 j, uint256 dx, uint256 min_dy, address receiver) returns (uint256)",
|
|
54
|
+
"function add_liquidity(uint256[2] amounts, uint256 min_mint_amount, address receiver) returns (uint256)",
|
|
55
|
+
"function remove_liquidity(uint256 _amount, uint256[2] min_amounts, address receiver) returns (uint256[2])",
|
|
56
|
+
"function remove_liquidity_one_coin(uint256 token_amount, uint256 i, uint256 min_amount, address receiver) returns (uint256)",
|
|
57
|
+
],
|
|
58
|
+
tricrypto: [
|
|
59
|
+
"function get_dy(uint256 i, uint256 j, uint256 dx) view returns (uint256)",
|
|
60
|
+
"function calc_withdraw_one_coin(uint256 token_amount, uint256 i) view returns (uint256)",
|
|
61
|
+
"function calc_token_amount(uint256[3] amounts, bool deposit) view returns (uint256)",
|
|
62
|
+
"function exchange(uint256 i, uint256 j, uint256 dx, uint256 min_dy, address receiver) returns (uint256)",
|
|
63
|
+
"function add_liquidity(uint256[3] amounts, uint256 min_mint_amount, address receiver) returns (uint256)",
|
|
64
|
+
"function remove_liquidity(uint256 _amount, uint256[3] min_amounts, address receiver) returns (uint256[3])",
|
|
65
|
+
"function remove_liquidity_one_coin(uint256 token_amount, uint256 i, uint256 min_amount, address receiver) returns (uint256)",
|
|
66
|
+
],
|
|
67
|
+
stableswap: [
|
|
68
|
+
"function get_dy(int128 i, int128 j, uint256 dx) view returns (uint256)",
|
|
69
|
+
"function calc_withdraw_one_coin(uint256 token_amount, int128 i) view returns (uint256)",
|
|
70
|
+
"function calc_token_amount(uint256[] amounts, bool is_deposit) view returns (uint256)",
|
|
71
|
+
"function exchange(int128 i, int128 j, uint256 dx, uint256 min_dy, address receiver) returns (uint256)",
|
|
72
|
+
"function add_liquidity(uint256[] amounts, uint256 min_mint_amount, address receiver) returns (uint256)",
|
|
73
|
+
"function remove_liquidity(uint256 _amount, uint256[] min_amounts, address receiver) returns (uint256[])",
|
|
74
|
+
"function remove_liquidity_one_coin(uint256 token_amount, int128 i, uint256 min_amount, address receiver) returns (uint256)",
|
|
75
|
+
],
|
|
76
|
+
};
|
|
77
|
+
/** The pool contract with its flavour's swap and liquidity ABI, bound to a signer or provider. */
|
|
78
|
+
function getCurvePoolFlavourContract(chainId, poolAddressOrId, runner) {
|
|
79
|
+
const entry = resolveCurvePool(chainId, poolAddressOrId);
|
|
80
|
+
if (!runner) {
|
|
81
|
+
runner = new ethers_1.ethers.JsonRpcProvider(chains_1.default[chainId].rpcs[0]);
|
|
82
|
+
}
|
|
83
|
+
return { entry, contract: new ethers_1.ethers.Contract(entry.contract, CURVE_POOL_WRITE_ABI[entry.flavour], runner) };
|
|
84
|
+
}
|
|
85
|
+
/** Checks an amounts array matches the pool's coin count before it reaches the encoder. */
|
|
86
|
+
function assertCoinCount(entry, amounts, what) {
|
|
87
|
+
if (amounts.length !== entry.coins.length) {
|
|
88
|
+
throw new Error(`${what} needs ${entry.coins.length} amounts for ${entry.id}, got ${amounts.length}`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/** Checks a coin index is inside the pool. */
|
|
92
|
+
function assertCoinIndex(entry, index) {
|
|
93
|
+
if (!Number.isInteger(index) || index < 0 || index >= entry.coins.length) {
|
|
94
|
+
throw new Error(`Coin index ${index} is out of range for ${entry.id} (${entry.coins.length} coins)`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addLiquidity = void 0;
|
|
4
|
+
const rpcError_1 = require("../../../utils/rpcError");
|
|
5
|
+
const _helpers_1 = require("./_helpers");
|
|
6
|
+
/**
|
|
7
|
+
* Deposits coins into a Curve pool for LP tokens. The caller approves each non-zero coin to the pool first.
|
|
8
|
+
*
|
|
9
|
+
* @param chainId - The chain/network to use.
|
|
10
|
+
* @param poolAddressOrId - The pool's key in the chain config's `curve` section, or its address.
|
|
11
|
+
* @param amounts - One amount per coin, in pool order and each coin's base units; 0 for a coin not deposited.
|
|
12
|
+
* @param minMintAmount - The least LP to accept (18 decimals); the deposit reverts below it. See `calcTokenAmount`.
|
|
13
|
+
* @param receiver - Who receives the LP tokens.
|
|
14
|
+
* @param signer - The signer sending the transaction.
|
|
15
|
+
* @returns The mined transaction receipt.
|
|
16
|
+
*/
|
|
17
|
+
const addLiquidity = async (chainId, poolAddressOrId, amounts, minMintAmount, receiver, signer) => {
|
|
18
|
+
if (!signer)
|
|
19
|
+
throw new Error("Signer is required");
|
|
20
|
+
const { entry, contract } = (0, _helpers_1.getCurvePoolFlavourContract)(chainId, poolAddressOrId, signer);
|
|
21
|
+
(0, _helpers_1.assertCoinCount)(entry, amounts, "addLiquidity");
|
|
22
|
+
try {
|
|
23
|
+
const tx = await contract.add_liquidity(amounts, minMintAmount, receiver);
|
|
24
|
+
return await tx.wait();
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
throw (0, rpcError_1.toRpcError)("curve.addLiquidity", error, { chainId, address: entry.contract });
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
exports.addLiquidity = addLiquidity;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.calcTokenAmount = void 0;
|
|
4
|
+
const rpcError_1 = require("../../../utils/rpcError");
|
|
5
|
+
const _helpers_1 = require("./_helpers");
|
|
6
|
+
/**
|
|
7
|
+
* LP tokens a deposit (or, with `isDeposit` false, a proportional withdrawal) of `amounts` mints or burns at the
|
|
8
|
+
* pool's current state. Fees are not included, so apply a slippage margin before using it as a minimum.
|
|
9
|
+
*
|
|
10
|
+
* @param amounts - One amount per coin, in pool order and each coin's base units.
|
|
11
|
+
* @returns LP tokens (18 decimals).
|
|
12
|
+
*/
|
|
13
|
+
const calcTokenAmount = async (chainId, poolAddressOrId, amounts, isDeposit, provider) => {
|
|
14
|
+
const { entry, contract } = (0, _helpers_1.getCurvePoolFlavourContract)(chainId, poolAddressOrId, provider);
|
|
15
|
+
(0, _helpers_1.assertCoinCount)(entry, amounts, "calcTokenAmount");
|
|
16
|
+
try {
|
|
17
|
+
return await contract.calc_token_amount(amounts, isDeposit);
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
throw (0, rpcError_1.toRpcError)("curve.calcTokenAmount", error, { chainId, address: entry.contract });
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
exports.calcTokenAmount = calcTokenAmount;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.calcWithdrawOneCoin = void 0;
|
|
4
|
+
const rpcError_1 = require("../../../utils/rpcError");
|
|
5
|
+
const _helpers_1 = require("./_helpers");
|
|
6
|
+
/**
|
|
7
|
+
* How much of coin `i` burning `lpAmount` LP tokens returns at the pool's current state.
|
|
8
|
+
*
|
|
9
|
+
* @returns The output amount in coin `i`'s base units.
|
|
10
|
+
*/
|
|
11
|
+
const calcWithdrawOneCoin = async (chainId, poolAddressOrId, lpAmount, i, provider) => {
|
|
12
|
+
const { entry, contract } = (0, _helpers_1.getCurvePoolFlavourContract)(chainId, poolAddressOrId, provider);
|
|
13
|
+
(0, _helpers_1.assertCoinIndex)(entry, i);
|
|
14
|
+
try {
|
|
15
|
+
return await contract.calc_withdraw_one_coin(lpAmount, i);
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
throw (0, rpcError_1.toRpcError)("curve.calcWithdrawOneCoin", error, { chainId, address: entry.contract });
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
exports.calcWithdrawOneCoin = calcWithdrawOneCoin;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.exchange = void 0;
|
|
4
|
+
const rpcError_1 = require("../../../utils/rpcError");
|
|
5
|
+
const _helpers_1 = require("./_helpers");
|
|
6
|
+
/**
|
|
7
|
+
* Swaps `amountIn` of coin `i` for coin `j` in a Curve pool. The caller approves coin `i` to the pool first.
|
|
8
|
+
*
|
|
9
|
+
* @param chainId - The chain/network to use.
|
|
10
|
+
* @param poolAddressOrId - The pool's key in the chain config's `curve` section, or its address.
|
|
11
|
+
* @param i - Index of the coin sold, in pool order.
|
|
12
|
+
* @param j - Index of the coin bought, in pool order.
|
|
13
|
+
* @param amountIn - Amount of coin `i`, in its base units.
|
|
14
|
+
* @param minAmountOut - The least of coin `j` to accept, in its base units; the swap reverts below it.
|
|
15
|
+
* @param receiver - Who receives coin `j`.
|
|
16
|
+
* @param signer - The signer sending the transaction.
|
|
17
|
+
* @returns The mined transaction receipt.
|
|
18
|
+
*/
|
|
19
|
+
const exchange = async (chainId, poolAddressOrId, i, j, amountIn, minAmountOut, receiver, signer) => {
|
|
20
|
+
if (!signer)
|
|
21
|
+
throw new Error("Signer is required");
|
|
22
|
+
const { entry, contract } = (0, _helpers_1.getCurvePoolFlavourContract)(chainId, poolAddressOrId, signer);
|
|
23
|
+
(0, _helpers_1.assertCoinIndex)(entry, i);
|
|
24
|
+
(0, _helpers_1.assertCoinIndex)(entry, j);
|
|
25
|
+
try {
|
|
26
|
+
const tx = await contract.exchange(i, j, amountIn, minAmountOut, receiver);
|
|
27
|
+
return await tx.wait();
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
throw (0, rpcError_1.toRpcError)("curve.exchange", error, { chainId, address: entry.contract });
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
exports.exchange = exchange;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDy = void 0;
|
|
4
|
+
const rpcError_1 = require("../../../utils/rpcError");
|
|
5
|
+
const _helpers_1 = require("./_helpers");
|
|
6
|
+
/**
|
|
7
|
+
* How much of coin `j` a swap of `amountIn` of coin `i` returns at the pool's current state, before slippage.
|
|
8
|
+
*
|
|
9
|
+
* @returns The output amount in coin `j`'s base units.
|
|
10
|
+
*/
|
|
11
|
+
const getDy = async (chainId, poolAddressOrId, i, j, amountIn, provider) => {
|
|
12
|
+
const { entry, contract } = (0, _helpers_1.getCurvePoolFlavourContract)(chainId, poolAddressOrId, provider);
|
|
13
|
+
(0, _helpers_1.assertCoinIndex)(entry, i);
|
|
14
|
+
(0, _helpers_1.assertCoinIndex)(entry, j);
|
|
15
|
+
try {
|
|
16
|
+
return await contract.get_dy(i, j, amountIn);
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
throw (0, rpcError_1.toRpcError)("curve.getDy", error, { chainId, address: entry.contract });
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
exports.getDy = getDy;
|
|
@@ -14,5 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./addLiquidity"), exports);
|
|
18
|
+
__exportStar(require("./calcTokenAmount"), exports);
|
|
19
|
+
__exportStar(require("./calcWithdrawOneCoin"), exports);
|
|
20
|
+
__exportStar(require("./exchange"), exports);
|
|
21
|
+
__exportStar(require("./getDy"), exports);
|
|
17
22
|
__exportStar(require("./getPools"), exports);
|
|
18
23
|
__exportStar(require("./getVirtualPrice"), exports);
|
|
24
|
+
__exportStar(require("./removeLiquidity"), exports);
|
|
25
|
+
__exportStar(require("./removeLiquidityOneCoin"), exports);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeLiquidity = void 0;
|
|
4
|
+
const rpcError_1 = require("../../../utils/rpcError");
|
|
5
|
+
const _helpers_1 = require("./_helpers");
|
|
6
|
+
/**
|
|
7
|
+
* Burns LP tokens for every coin of a Curve pool in proportion to its balances.
|
|
8
|
+
*
|
|
9
|
+
* @param chainId - The chain/network to use.
|
|
10
|
+
* @param poolAddressOrId - The pool's key in the chain config's `curve` section, or its address.
|
|
11
|
+
* @param lpAmount - LP tokens to burn (18 decimals).
|
|
12
|
+
* @param minAmounts - The least of each coin to accept, in pool order and each coin's base units.
|
|
13
|
+
* @param receiver - Who receives the coins.
|
|
14
|
+
* @param signer - The signer sending the transaction.
|
|
15
|
+
* @returns The mined transaction receipt.
|
|
16
|
+
*/
|
|
17
|
+
const removeLiquidity = async (chainId, poolAddressOrId, lpAmount, minAmounts, receiver, signer) => {
|
|
18
|
+
if (!signer)
|
|
19
|
+
throw new Error("Signer is required");
|
|
20
|
+
const { entry, contract } = (0, _helpers_1.getCurvePoolFlavourContract)(chainId, poolAddressOrId, signer);
|
|
21
|
+
(0, _helpers_1.assertCoinCount)(entry, minAmounts, "removeLiquidity");
|
|
22
|
+
try {
|
|
23
|
+
const tx = await contract.remove_liquidity(lpAmount, minAmounts, receiver);
|
|
24
|
+
return await tx.wait();
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
throw (0, rpcError_1.toRpcError)("curve.removeLiquidity", error, { chainId, address: entry.contract });
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
exports.removeLiquidity = removeLiquidity;
|