@gearbox-protocol/sdk 17.0.0-next.4 → 17.0.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.
- package/dist/cjs/dev/abi.js +14 -15
- package/dist/cjs/dev/claimFromFaucet.js +4 -8
- package/dist/cjs/dev/createAnvilClient.js +35 -17
- package/dist/cjs/dev/index.js +7 -2
- package/dist/cjs/dev/kycUtils.js +66 -58
- package/dist/cjs/dev/midasUtils.js +113 -16
- package/dist/cjs/dev/securitizeUtils.js +82 -42
- package/dist/cjs/dev/withdrawalUtils.js +3 -6
- package/dist/cjs/model/errors/index.js +2 -0
- package/dist/cjs/model/errors/operation-errors.js +19 -1
- package/dist/cjs/model/index.js +4 -2
- package/dist/cjs/model/rwa.js +4 -4
- package/dist/cjs/model/rwa.schema.js +4 -4
- package/dist/cjs/offchain/opportunities/OffchainOpportunities.js +1 -1
- package/dist/cjs/onchain/OnchainSDK.js +3 -3
- package/dist/cjs/onchain/accounts/CreditAccountsServiceV310.js +2 -17
- package/dist/cjs/onchain/accounts/intents/borrow.js +140 -0
- package/dist/cjs/onchain/accounts/intents/collateral-valuation.js +41 -0
- package/dist/cjs/onchain/accounts/intents/guards.js +15 -3
- package/dist/cjs/onchain/accounts/intents/index.js +107 -20
- package/dist/cjs/onchain/accounts/intents/leverage-band.js +2 -12
- package/dist/cjs/onchain/accounts/intents/maxBorrow.js +89 -0
- package/dist/cjs/onchain/accounts/intents/maxWithdrawCollateral.js +15 -41
- package/dist/cjs/onchain/accounts/intents/open-strategy.js +8 -46
- package/dist/cjs/onchain/accounts/intents/operations.js +0 -1
- package/dist/cjs/onchain/accounts/intents/realize.js +61 -4
- package/dist/cjs/onchain/accounts/intents/tail.js +1 -1
- package/dist/cjs/onchain/accounts/intents/testing/sdk-mock.js +1 -0
- package/dist/cjs/onchain/accounts/intents/utils/common.js +19 -0
- package/dist/cjs/onchain/accounts/intents/utils/credit-account-slice.js +21 -0
- package/dist/cjs/onchain/accounts/intents/utils/index.js +2 -0
- package/dist/cjs/onchain/accounts/intents/utils/price-impact.js +12 -9
- package/dist/cjs/onchain/accounts/intents/utils/router-path.js +4 -5
- package/dist/cjs/onchain/accounts/intents/withdraw-limits.js +97 -0
- package/dist/cjs/onchain/accounts/liquidations/LiquidationsService.js +1 -1
- package/dist/cjs/onchain/constants/address-provider.js +0 -2
- package/dist/cjs/onchain/constants/index.js +0 -1
- package/dist/cjs/onchain/core/createAddressProvider.js +2 -5
- package/dist/cjs/onchain/index.js +60 -43
- package/dist/cjs/onchain/market/adapters/abi/conctructorAbi.js +2 -2
- package/dist/cjs/onchain/market/adapters/contracts/AbstractAdapter.js +6 -0
- package/dist/cjs/onchain/market/adapters/contracts/MidasGatewayAdapterContract.js +49 -5
- package/dist/cjs/onchain/market/credit/CreditSuite.js +26 -9
- package/dist/cjs/onchain/market/index.js +50 -38
- package/dist/cjs/onchain/market/oracle/PriceOracleBaseContract.js +3 -3
- package/dist/cjs/onchain/market/pricefeeds/AbstractPriceFeed.js +0 -5
- package/dist/cjs/onchain/market/pricefeeds/PriceFeedRegistry.js +127 -0
- package/dist/cjs/onchain/market/pricefeeds/{BalancerStablePriceFeed.js → feeds/BalancerStablePriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{BalancerWeightedPriceFeed.js → feeds/BalancerWeightedPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{BoundedPriceFeed.js → feeds/BoundedPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{CompositePriceFeed.js → feeds/CompositePriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{ConstantPriceFeed.js → feeds/ConstantPriceFeed.js} +3 -3
- package/dist/cjs/onchain/market/pricefeeds/{CurveCryptoPriceFeed.js → feeds/CurveCryptoPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{CurveStablePriceFeed.js → feeds/CurveStablePriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{CurveUSDPriceFeed.js → feeds/CurveUSDPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{Erc4626PriceFeed.js → feeds/Erc4626PriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{ExternalPriceFeed.js → feeds/ExternalPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{MellowLRTPriceFeed.js → feeds/MellowLRTPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{PendleTWAPPTPriceFeed.js → feeds/PendleTWAPPTPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{PythPriceFeed.js → feeds/PythPriceFeed.js} +3 -3
- package/dist/cjs/onchain/market/pricefeeds/{RedstonePriceFeed.js → feeds/RedstonePriceFeed.js} +6 -6
- package/dist/cjs/onchain/market/pricefeeds/{WstETHPriceFeed.js → feeds/WstETHPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{YearnPriceFeed.js → feeds/YearnPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{ZeroPriceFeed.js → feeds/ZeroPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/feeds/index.js +35 -0
- package/dist/cjs/onchain/market/pricefeeds/index.js +51 -39
- package/dist/cjs/onchain/market/pricefeeds/updates/UpdatablePriceFeedRegistry.js +189 -0
- package/dist/cjs/onchain/market/pricefeeds/{getRawPriceUpdates.js → updates/getRawPriceUpdates.js} +2 -2
- package/dist/cjs/onchain/market/pricefeeds/updates/index.js +8 -0
- package/dist/cjs/onchain/market/pricefeeds/{isUpdatablePriceFeed.js → updates/isUpdatablePriceFeed.js} +1 -1
- package/dist/cjs/onchain/market/pricefeeds/updates/updatableDependencies.js +14 -0
- package/dist/cjs/onchain/market/rwa/RWARegistry.js +4 -7
- package/dist/cjs/onchain/market/rwa/index.js +1 -0
- package/dist/cjs/onchain/market/rwa/midas/MidasDegenNFT.js +45 -5
- package/dist/cjs/onchain/market/rwa/securitize/SecuritizeDegenNFT.js +56 -12
- package/dist/cjs/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +0 -37
- package/dist/cjs/onchain/opportunities/MultichainOpportunitiesService.js +8 -2
- package/dist/cjs/onchain/opportunities/OpportunitiesService.js +16 -4
- package/dist/cjs/onchain/positions/calcHealthFactor.js +3 -3
- package/dist/cjs/onchain/preview/index.js +2 -0
- package/dist/cjs/onchain/preview/parse/parseRWAFactoryOperationCalldata.js +2 -2
- package/dist/cjs/onchain/preview/preview/index.js +2 -0
- package/dist/cjs/onchain/preview/preview/midasGreenlistsAccount.js +17 -0
- package/dist/cjs/onchain/preview/preview/previewOpenStrategyPosition.js +13 -16
- package/dist/cjs/onchain/preview/preview/previewOperation.js +19 -11
- package/dist/cjs/onchain/preview/preview/replayMulticall.js +4 -3
- package/dist/cjs/onchain/validation/bundles/checkCollateralFunding.js +3 -3
- package/dist/cjs/onchain/validation/bundles/checkCreditOperation.js +11 -9
- package/dist/cjs/onchain/validation/bundles/{checkDraw.js → checkIncreaseDebt.js} +10 -10
- package/dist/cjs/onchain/validation/bundles/{checkQuotasAsked.js → checkIncreaseQuota.js} +3 -3
- package/dist/cjs/onchain/validation/bundles/checkMidasAccountGreenlist.js +44 -0
- package/dist/cjs/onchain/validation/bundles/checkRWAOpenRequirements.js +9 -9
- package/dist/cjs/onchain/validation/bundles/checkRWAOpening.js +18 -8
- package/dist/cjs/onchain/validation/bundles/index.js +6 -4
- package/dist/cjs/onchain/validation/checkOperation.js +0 -1
- package/dist/cjs/onchain/validation/checks/checkBorrowLimit.js +1 -1
- package/dist/cjs/onchain/validation/checks/checkPoolLiquidity.js +1 -1
- package/dist/cjs/onchain/validation/checks/checkReservePriceLimited.js +30 -0
- package/dist/cjs/onchain/validation/checks/index.js +2 -0
- package/dist/cjs/onchain/validation/index.js +8 -4
- package/dist/cjs/permissionless/utils/price-update/get-price-update-tx.js +2 -2
- package/dist/cjs/permissionless/utils/price-update/get-updatable-feeds.js +2 -2
- package/dist/cjs/sdk/execute/ExecuteApi.js +67 -7
- package/dist/cjs/sdk/opportunities/OpportunitiesNamespace.js +9 -3
- package/dist/cjs/sdk/prepare/PrepareApi.js +89 -14
- package/dist/esm/dev/abi.js +14 -15
- package/dist/esm/dev/claimFromFaucet.js +4 -8
- package/dist/esm/dev/createAnvilClient.js +36 -19
- package/dist/esm/dev/index.js +4 -4
- package/dist/esm/dev/kycUtils.js +66 -59
- package/dist/esm/dev/midasUtils.js +112 -18
- package/dist/esm/dev/securitizeUtils.js +84 -44
- package/dist/esm/dev/withdrawalUtils.js +3 -6
- package/dist/esm/model/errors/index.js +2 -2
- package/dist/esm/model/errors/operation-errors.js +18 -2
- package/dist/esm/model/index.js +4 -4
- package/dist/esm/model/rwa.js +4 -4
- package/dist/esm/model/rwa.schema.js +5 -5
- package/dist/esm/offchain/opportunities/OffchainOpportunities.js +1 -1
- package/dist/esm/onchain/OnchainSDK.js +3 -3
- package/dist/esm/onchain/accounts/CreditAccountsServiceV310.js +2 -17
- package/dist/esm/onchain/accounts/intents/borrow.js +138 -0
- package/dist/esm/onchain/accounts/intents/collateral-valuation.js +40 -0
- package/dist/esm/onchain/accounts/intents/guards.js +15 -3
- package/dist/esm/onchain/accounts/intents/index.js +107 -20
- package/dist/esm/onchain/accounts/intents/leverage-band.js +2 -12
- package/dist/esm/onchain/accounts/intents/maxBorrow.js +87 -0
- package/dist/esm/onchain/accounts/intents/maxWithdrawCollateral.js +15 -41
- package/dist/esm/onchain/accounts/intents/open-strategy.js +8 -46
- package/dist/esm/onchain/accounts/intents/operations.js +0 -1
- package/dist/esm/onchain/accounts/intents/realize.js +61 -4
- package/dist/esm/onchain/accounts/intents/tail.js +1 -1
- package/dist/esm/onchain/accounts/intents/testing/sdk-mock.js +1 -0
- package/dist/esm/onchain/accounts/intents/utils/common.js +19 -1
- package/dist/esm/onchain/accounts/intents/utils/credit-account-slice.js +21 -1
- package/dist/esm/onchain/accounts/intents/utils/index.js +3 -3
- package/dist/esm/onchain/accounts/intents/utils/price-impact.js +12 -9
- package/dist/esm/onchain/accounts/intents/utils/router-path.js +4 -5
- package/dist/esm/onchain/accounts/intents/withdraw-limits.js +95 -0
- package/dist/esm/onchain/accounts/liquidations/LiquidationsService.js +1 -1
- package/dist/esm/onchain/constants/address-provider.js +1 -2
- package/dist/esm/onchain/constants/index.js +2 -2
- package/dist/esm/onchain/core/createAddressProvider.js +2 -5
- package/dist/esm/onchain/index.js +32 -24
- package/dist/esm/onchain/market/adapters/abi/conctructorAbi.js +2 -2
- package/dist/esm/onchain/market/adapters/contracts/AbstractAdapter.js +6 -0
- package/dist/esm/onchain/market/adapters/contracts/MidasGatewayAdapterContract.js +50 -6
- package/dist/esm/onchain/market/credit/CreditSuite.js +26 -9
- package/dist/esm/onchain/market/index.js +26 -21
- package/dist/esm/onchain/market/oracle/PriceOracleBaseContract.js +1 -1
- package/dist/esm/onchain/market/pricefeeds/AbstractPriceFeed.js +0 -5
- package/dist/esm/onchain/market/pricefeeds/PriceFeedRegistry.js +126 -0
- package/dist/esm/onchain/market/pricefeeds/{BalancerStablePriceFeed.js → feeds/BalancerStablePriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{BalancerWeightedPriceFeed.js → feeds/BalancerWeightedPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{BoundedPriceFeed.js → feeds/BoundedPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{CompositePriceFeed.js → feeds/CompositePriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{ConstantPriceFeed.js → feeds/ConstantPriceFeed.js} +3 -3
- package/dist/esm/onchain/market/pricefeeds/{CurveCryptoPriceFeed.js → feeds/CurveCryptoPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{CurveStablePriceFeed.js → feeds/CurveStablePriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{CurveUSDPriceFeed.js → feeds/CurveUSDPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{Erc4626PriceFeed.js → feeds/Erc4626PriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{ExternalPriceFeed.js → feeds/ExternalPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{MellowLRTPriceFeed.js → feeds/MellowLRTPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{PendleTWAPPTPriceFeed.js → feeds/PendleTWAPPTPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{PythPriceFeed.js → feeds/PythPriceFeed.js} +3 -3
- package/dist/esm/onchain/market/pricefeeds/{RedstonePriceFeed.js → feeds/RedstonePriceFeed.js} +6 -6
- package/dist/esm/onchain/market/pricefeeds/{WstETHPriceFeed.js → feeds/WstETHPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{YearnPriceFeed.js → feeds/YearnPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{ZeroPriceFeed.js → feeds/ZeroPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/feeds/index.js +18 -0
- package/dist/esm/onchain/market/pricefeeds/index.js +27 -21
- package/dist/esm/onchain/market/pricefeeds/updates/UpdatablePriceFeedRegistry.js +188 -0
- package/dist/esm/onchain/market/pricefeeds/{getRawPriceUpdates.js → updates/getRawPriceUpdates.js} +2 -2
- package/dist/esm/onchain/market/pricefeeds/updates/index.js +5 -1
- package/dist/esm/onchain/market/pricefeeds/{isUpdatablePriceFeed.js → updates/isUpdatablePriceFeed.js} +1 -1
- package/dist/esm/onchain/market/pricefeeds/updates/updatableDependencies.js +13 -0
- package/dist/esm/onchain/market/rwa/RWARegistry.js +4 -8
- package/dist/esm/onchain/market/rwa/index.js +2 -2
- package/dist/esm/onchain/market/rwa/midas/MidasDegenNFT.js +45 -5
- package/dist/esm/onchain/market/rwa/securitize/SecuritizeDegenNFT.js +55 -10
- package/dist/esm/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +0 -37
- package/dist/esm/onchain/opportunities/MultichainOpportunitiesService.js +8 -2
- package/dist/esm/onchain/opportunities/OpportunitiesService.js +16 -4
- package/dist/esm/onchain/positions/calcHealthFactor.js +3 -3
- package/dist/esm/onchain/preview/index.js +2 -1
- package/dist/esm/onchain/preview/parse/parseRWAFactoryOperationCalldata.js +2 -2
- package/dist/esm/onchain/preview/preview/index.js +2 -1
- package/dist/esm/onchain/preview/preview/midasGreenlistsAccount.js +16 -0
- package/dist/esm/onchain/preview/preview/previewOpenStrategyPosition.js +14 -17
- package/dist/esm/onchain/preview/preview/previewOperation.js +19 -11
- package/dist/esm/onchain/preview/preview/replayMulticall.js +4 -3
- package/dist/esm/onchain/validation/bundles/checkCollateralFunding.js +3 -3
- package/dist/esm/onchain/validation/bundles/checkCreditOperation.js +11 -9
- package/dist/esm/onchain/validation/bundles/checkIncreaseDebt.js +27 -0
- package/dist/esm/onchain/validation/bundles/{checkQuotasAsked.js → checkIncreaseQuota.js} +3 -3
- package/dist/esm/onchain/validation/bundles/checkMidasAccountGreenlist.js +43 -0
- package/dist/esm/onchain/validation/bundles/checkRWAOpenRequirements.js +9 -9
- package/dist/esm/onchain/validation/bundles/checkRWAOpening.js +18 -8
- package/dist/esm/onchain/validation/bundles/index.js +4 -3
- package/dist/esm/onchain/validation/checkOperation.js +0 -1
- package/dist/esm/onchain/validation/checks/checkBorrowLimit.js +1 -1
- package/dist/esm/onchain/validation/checks/checkPoolLiquidity.js +1 -1
- package/dist/esm/onchain/validation/checks/checkReservePriceLimited.js +29 -0
- package/dist/esm/onchain/validation/checks/index.js +2 -1
- package/dist/esm/onchain/validation/index.js +5 -3
- package/dist/esm/permissionless/utils/price-update/get-price-update-tx.js +1 -1
- package/dist/esm/permissionless/utils/price-update/get-updatable-feeds.js +1 -1
- package/dist/esm/sdk/execute/ExecuteApi.js +67 -7
- package/dist/esm/sdk/opportunities/OpportunitiesNamespace.js +9 -3
- package/dist/esm/sdk/prepare/PrepareApi.js +94 -19
- package/dist/types/dev/abi.d.ts +13 -15
- package/dist/types/dev/claimFromFaucet.d.ts +0 -1
- package/dist/types/dev/createAnvilClient.d.ts +10 -3
- package/dist/types/dev/index.d.ts +4 -4
- package/dist/types/dev/kycUtils.d.ts +15 -24
- package/dist/types/dev/midasUtils.d.ts +35 -4
- package/dist/types/dev/securitizeUtils.d.ts +3 -9
- package/dist/types/model/errors/index.d.ts +2 -2
- package/dist/types/model/errors/operation-errors.d.ts +62 -7
- package/dist/types/model/index.d.ts +5 -5
- package/dist/types/model/opportunities.d.ts +6 -7
- package/dist/types/model/previews.d.ts +25 -19
- package/dist/types/model/rwa.d.ts +47 -27
- package/dist/types/model/rwa.schema.d.ts +3 -3
- package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +1 -2
- package/dist/types/offchain/opportunities/types.d.ts +1 -4
- package/dist/types/onchain/OnchainSDK.d.ts +2 -2
- package/dist/types/onchain/accounts/index.d.ts +5 -4
- package/dist/types/onchain/accounts/intents/borrow.d.ts +141 -0
- package/dist/types/onchain/accounts/intents/collateral-valuation.d.ts +42 -0
- package/dist/types/onchain/accounts/intents/guards.d.ts +18 -2
- package/dist/types/onchain/accounts/intents/index.d.ts +103 -15
- package/dist/types/onchain/accounts/intents/maxBorrow.d.ts +54 -0
- package/dist/types/onchain/accounts/intents/maxWithdrawCollateral.d.ts +3 -8
- package/dist/types/onchain/accounts/intents/open-strategy.d.ts +3 -17
- package/dist/types/onchain/accounts/intents/testing/sdk-mock.d.ts +2 -0
- package/dist/types/onchain/accounts/intents/tests/open-strategy.fixtures.d.ts +2 -2
- package/dist/types/onchain/accounts/intents/types.d.ts +51 -6
- package/dist/types/onchain/accounts/intents/utils/common.d.ts +15 -1
- package/dist/types/onchain/accounts/intents/utils/credit-account-slice.d.ts +14 -1
- package/dist/types/onchain/accounts/intents/utils/index.d.ts +3 -3
- package/dist/types/onchain/accounts/intents/utils/price-impact.d.ts +4 -1
- package/dist/types/onchain/accounts/intents/utils/router-path.d.ts +2 -5
- package/dist/types/onchain/accounts/intents/withdraw-limits.d.ts +80 -0
- package/dist/types/onchain/accounts/types.d.ts +4 -2
- package/dist/types/onchain/constants/address-provider.d.ts +1 -2
- package/dist/types/onchain/constants/index.d.ts +2 -2
- package/dist/types/onchain/index.d.ts +40 -31
- package/dist/types/onchain/market/adapters/contracts/AbstractAdapter.d.ts +6 -0
- package/dist/types/onchain/market/adapters/contracts/MidasGatewayAdapterContract.d.ts +20 -4
- package/dist/types/onchain/market/adapters/types.d.ts +8 -0
- package/dist/types/onchain/market/credit/CreditSuite.d.ts +13 -3
- package/dist/types/onchain/market/index.d.ts +29 -24
- package/dist/types/onchain/market/oracle/PriceOracleBaseContract.d.ts +2 -1
- package/dist/types/onchain/market/oracle/types.d.ts +2 -1
- package/dist/types/onchain/market/pool/types.d.ts +1 -1
- package/dist/types/onchain/market/pricefeeds/AbstractPriceFeed.d.ts +1 -2
- package/dist/types/onchain/market/pricefeeds/PriceFeedRegistry.d.ts +60 -0
- package/dist/types/onchain/market/pricefeeds/feeds/BalancerStablePriceFeed.d.ts +12 -0
- package/dist/types/onchain/market/pricefeeds/{BalancerWeightedPriceFeed.d.ts → feeds/BalancerWeightedPriceFeed.d.ts} +7 -7
- package/dist/types/onchain/market/pricefeeds/feeds/BoundedPriceFeed.d.ts +15 -0
- package/dist/types/onchain/market/pricefeeds/{CompositePriceFeed.d.ts → feeds/CompositePriceFeed.d.ts} +6 -6
- package/dist/types/onchain/market/pricefeeds/{ConstantPriceFeed.d.ts → feeds/ConstantPriceFeed.d.ts} +6 -6
- package/dist/types/onchain/market/pricefeeds/feeds/CurveCryptoPriceFeed.d.ts +12 -0
- package/dist/types/onchain/market/pricefeeds/feeds/CurveStablePriceFeed.d.ts +12 -0
- package/dist/types/onchain/market/pricefeeds/feeds/CurveUSDPriceFeed.d.ts +12 -0
- package/dist/types/onchain/market/pricefeeds/feeds/Erc4626PriceFeed.d.ts +12 -0
- package/dist/types/onchain/market/pricefeeds/feeds/ExternalPriceFeed.d.ts +11 -0
- package/dist/types/onchain/market/pricefeeds/feeds/MellowLRTPriceFeed.d.ts +12 -0
- package/dist/types/onchain/market/pricefeeds/{PendleTWAPPTPriceFeed.d.ts → feeds/PendleTWAPPTPriceFeed.d.ts} +3 -3
- package/dist/types/onchain/market/pricefeeds/{PythPriceFeed.d.ts → feeds/PythPriceFeed.d.ts} +3 -3
- package/dist/types/onchain/market/pricefeeds/{RedstonePriceFeed.d.ts → feeds/RedstonePriceFeed.d.ts} +9 -9
- package/dist/types/onchain/market/pricefeeds/feeds/WstETHPriceFeed.d.ts +12 -0
- package/dist/types/onchain/market/pricefeeds/feeds/YearnPriceFeed.d.ts +12 -0
- package/dist/types/onchain/market/pricefeeds/feeds/ZeroPriceFeed.d.ts +11 -0
- package/dist/types/onchain/market/pricefeeds/feeds/index.d.ts +18 -0
- package/dist/types/onchain/market/pricefeeds/index.d.ts +28 -22
- package/dist/types/onchain/market/pricefeeds/types.d.ts +1 -31
- package/dist/types/onchain/market/pricefeeds/updates/RedstoneUpdater.d.ts +1 -1
- package/dist/types/onchain/market/pricefeeds/updates/UpdatablePriceFeedRegistry.d.ts +106 -0
- package/dist/types/onchain/market/pricefeeds/updates/getRawPriceUpdates.d.ts +6 -0
- package/dist/types/onchain/market/pricefeeds/updates/index.d.ts +7 -3
- package/dist/types/onchain/market/pricefeeds/updates/isUpdatablePriceFeed.d.ts +6 -0
- package/dist/types/onchain/market/pricefeeds/updates/types.d.ts +56 -2
- package/dist/types/onchain/market/pricefeeds/updates/updatableDependencies.d.ts +10 -0
- package/dist/types/onchain/market/rwa/RWARegistry.d.ts +2 -1
- package/dist/types/onchain/market/rwa/index.d.ts +3 -3
- package/dist/types/onchain/market/rwa/midas/MidasDegenNFT.d.ts +19 -4
- package/dist/types/onchain/market/rwa/securitize/SecuritizeDegenNFT.d.ts +24 -4
- package/dist/types/onchain/market/rwa/securitize/SecuritizeRWAFactory.d.ts +2 -14
- package/dist/types/onchain/market/rwa/types.d.ts +39 -37
- package/dist/types/onchain/opportunities/MultichainOpportunitiesService.d.ts +5 -1
- package/dist/types/onchain/opportunities/OpportunitiesService.d.ts +10 -3
- package/dist/types/onchain/opportunities/types.d.ts +6 -1
- package/dist/types/onchain/preview/index.d.ts +2 -1
- package/dist/types/onchain/preview/preview/index.d.ts +2 -1
- package/dist/types/onchain/preview/preview/midasGreenlistsAccount.d.ts +13 -0
- package/dist/types/onchain/preview/preview/previewOpenStrategyPosition.d.ts +5 -3
- package/dist/types/onchain/preview/preview/replayMulticall.d.ts +8 -7
- package/dist/types/onchain/validation/bundles/checkCreditOperation.d.ts +5 -4
- package/dist/types/onchain/validation/bundles/{checkDraw.d.ts → checkIncreaseDebt.d.ts} +7 -7
- package/dist/types/onchain/validation/bundles/{checkQuotasAsked.d.ts → checkIncreaseQuota.d.ts} +3 -3
- package/dist/types/onchain/validation/bundles/checkMidasAccountGreenlist.d.ts +22 -0
- package/dist/types/onchain/validation/bundles/checkRWAOpenRequirements.d.ts +2 -2
- package/dist/types/onchain/validation/bundles/checkRWAOpening.d.ts +9 -7
- package/dist/types/onchain/validation/bundles/index.d.ts +5 -4
- package/dist/types/onchain/validation/checks/checkBorrowLimit.d.ts +1 -1
- package/dist/types/onchain/validation/checks/checkDebtLimits.d.ts +2 -2
- package/dist/types/onchain/validation/checks/checkPoolLiquidity.d.ts +1 -1
- package/dist/types/onchain/validation/checks/checkReservePriceLimited.d.ts +31 -0
- package/dist/types/onchain/validation/checks/index.d.ts +2 -1
- package/dist/types/onchain/validation/index.d.ts +6 -4
- package/dist/types/onchain/validation/raise.d.ts +2 -2
- package/dist/types/sdk/execute/index.d.ts +2 -2
- package/dist/types/sdk/execute/types.d.ts +48 -6
- package/dist/types/sdk/index.d.ts +5 -4
- package/dist/types/sdk/opportunities/OpportunitiesNamespace.d.ts +5 -1
- package/dist/types/sdk/opportunities/types.d.ts +9 -3
- package/dist/types/sdk/prepare/PrepareApi.d.ts +16 -4
- package/dist/types/sdk/prepare/index.d.ts +4 -3
- package/dist/types/sdk/prepare/types.d.ts +200 -66
- package/package.json +1 -1
- package/dist/cjs/onchain/accounts/utils/midasUtils.js +0 -70
- package/dist/cjs/onchain/market/pricefeeds/PriceFeedsRegister.js +0 -301
- package/dist/cjs/plugins/degen-distributors/DegenDistributorsPlugin.js +0 -61
- package/dist/cjs/plugins/degen-distributors/index.js +0 -4
- package/dist/cjs/plugins/degen-distributors/package.json +0 -1
- package/dist/cjs/plugins/degen-distributors/types.js +0 -1
- package/dist/cjs/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.js +0 -114
- package/dist/cjs/plugins/delayed-withdrawal/index.js +0 -4
- package/dist/cjs/plugins/delayed-withdrawal/package.json +0 -1
- package/dist/cjs/plugins/delayed-withdrawal/types.js +0 -1
- package/dist/esm/onchain/accounts/utils/midasUtils.js +0 -69
- package/dist/esm/onchain/market/pricefeeds/PriceFeedsRegister.js +0 -300
- package/dist/esm/onchain/validation/bundles/checkDraw.js +0 -27
- package/dist/esm/plugins/degen-distributors/DegenDistributorsPlugin.js +0 -60
- package/dist/esm/plugins/degen-distributors/index.js +0 -3
- package/dist/esm/plugins/degen-distributors/package.json +0 -1
- package/dist/esm/plugins/degen-distributors/types.js +0 -1
- package/dist/esm/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.js +0 -113
- package/dist/esm/plugins/delayed-withdrawal/index.js +0 -3
- package/dist/esm/plugins/delayed-withdrawal/package.json +0 -1
- package/dist/esm/plugins/delayed-withdrawal/types.js +0 -1
- package/dist/types/onchain/accounts/utils/midasUtils.d.ts +0 -38
- package/dist/types/onchain/market/pricefeeds/BalancerStablePriceFeed.d.ts +0 -12
- package/dist/types/onchain/market/pricefeeds/BoundedPriceFeed.d.ts +0 -15
- package/dist/types/onchain/market/pricefeeds/CurveCryptoPriceFeed.d.ts +0 -12
- package/dist/types/onchain/market/pricefeeds/CurveStablePriceFeed.d.ts +0 -12
- package/dist/types/onchain/market/pricefeeds/CurveUSDPriceFeed.d.ts +0 -12
- package/dist/types/onchain/market/pricefeeds/Erc4626PriceFeed.d.ts +0 -12
- package/dist/types/onchain/market/pricefeeds/ExternalPriceFeed.d.ts +0 -11
- package/dist/types/onchain/market/pricefeeds/MellowLRTPriceFeed.d.ts +0 -12
- package/dist/types/onchain/market/pricefeeds/PriceFeedsRegister.d.ts +0 -180
- package/dist/types/onchain/market/pricefeeds/WstETHPriceFeed.d.ts +0 -12
- package/dist/types/onchain/market/pricefeeds/YearnPriceFeed.d.ts +0 -12
- package/dist/types/onchain/market/pricefeeds/ZeroPriceFeed.d.ts +0 -11
- package/dist/types/onchain/market/pricefeeds/getRawPriceUpdates.d.ts +0 -5
- package/dist/types/onchain/market/pricefeeds/isUpdatablePriceFeed.d.ts +0 -5
- package/dist/types/plugins/degen-distributors/DegenDistributorsPlugin.d.ts +0 -25
- package/dist/types/plugins/degen-distributors/index.d.ts +0 -3
- package/dist/types/plugins/degen-distributors/types.d.ts +0 -8
- package/dist/types/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.d.ts +0 -25
- package/dist/types/plugins/delayed-withdrawal/index.d.ts +0 -3
- package/dist/types/plugins/delayed-withdrawal/types.d.ts +0 -10
package/dist/esm/dev/abi.js
CHANGED
|
@@ -78,11 +78,7 @@ const iFaucetAbi = [
|
|
|
78
78
|
internalType: "uint256"
|
|
79
79
|
}]
|
|
80
80
|
}],
|
|
81
|
-
outputs: [
|
|
82
|
-
name: "",
|
|
83
|
-
type: "bool",
|
|
84
|
-
internalType: "bool"
|
|
85
|
-
}],
|
|
81
|
+
outputs: [],
|
|
86
82
|
stateMutability: "nonpayable"
|
|
87
83
|
},
|
|
88
84
|
{
|
|
@@ -97,11 +93,7 @@ const iFaucetAbi = [
|
|
|
97
93
|
type: "uint256",
|
|
98
94
|
internalType: "uint256"
|
|
99
95
|
}],
|
|
100
|
-
outputs: [
|
|
101
|
-
name: "",
|
|
102
|
-
type: "bool",
|
|
103
|
-
internalType: "bool"
|
|
104
|
-
}],
|
|
96
|
+
outputs: [],
|
|
105
97
|
stateMutability: "nonpayable"
|
|
106
98
|
},
|
|
107
99
|
{
|
|
@@ -112,11 +104,7 @@ const iFaucetAbi = [
|
|
|
112
104
|
type: "address",
|
|
113
105
|
internalType: "address"
|
|
114
106
|
}],
|
|
115
|
-
outputs: [
|
|
116
|
-
name: "",
|
|
117
|
-
type: "bool",
|
|
118
|
-
internalType: "bool"
|
|
119
|
-
}],
|
|
107
|
+
outputs: [],
|
|
120
108
|
stateMutability: "nonpayable"
|
|
121
109
|
},
|
|
122
110
|
{
|
|
@@ -188,6 +176,17 @@ const iFaucetAbi = [
|
|
|
188
176
|
}],
|
|
189
177
|
stateMutability: "view"
|
|
190
178
|
},
|
|
179
|
+
{
|
|
180
|
+
type: "function",
|
|
181
|
+
name: "owner",
|
|
182
|
+
inputs: [],
|
|
183
|
+
outputs: [{
|
|
184
|
+
name: "",
|
|
185
|
+
type: "address",
|
|
186
|
+
internalType: "address"
|
|
187
|
+
}],
|
|
188
|
+
stateMutability: "view"
|
|
189
|
+
},
|
|
191
190
|
{
|
|
192
191
|
type: "function",
|
|
193
192
|
name: "prices",
|
|
@@ -4,7 +4,7 @@ import { iFaucetAbi } from "./abi.js";
|
|
|
4
4
|
import { readContract } from "viem/actions";
|
|
5
5
|
//#region src/dev/claimFromFaucet.ts
|
|
6
6
|
async function claimFromFaucet(opts) {
|
|
7
|
-
const { sdk, publicClient, wallet, faucet, claimer, role, amount, logger, gasMultiplier = 10n
|
|
7
|
+
const { sdk, publicClient, wallet, faucet, claimer, role, amount, logger, gasMultiplier = 10n } = opts;
|
|
8
8
|
let amnt = "default amount";
|
|
9
9
|
let args;
|
|
10
10
|
if (Array.isArray(amount)) {
|
|
@@ -53,13 +53,9 @@ async function claimFromFaucet(opts) {
|
|
|
53
53
|
gas: gas * gasMultiplier
|
|
54
54
|
});
|
|
55
55
|
logger?.debug({ request }, "simulated claim tx request");
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const hash = await wallet.writeContract(request);
|
|
60
|
-
logger?.debug({ hash }, "claim tx hash");
|
|
61
|
-
receipt = await publicClient.waitForTransactionReceipt({ hash });
|
|
62
|
-
}
|
|
56
|
+
const hash = await wallet.writeContract(request);
|
|
57
|
+
logger?.debug({ hash }, "claim tx hash");
|
|
58
|
+
const receipt = await publicClient.waitForTransactionReceipt({ hash });
|
|
63
59
|
if (receipt.status === "reverted") throw new Error(`${usr} failed to claimed ${amnt} from faucet, tx: ${receipt.transactionHash}`);
|
|
64
60
|
logger?.debug(`${usr} claimed ${amnt} from faucet, tx: ${receipt.transactionHash}`);
|
|
65
61
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { createTestClient, publicActions, testActions, toHex, walletActions } from "viem";
|
|
1
|
+
import { BaseError, createTestClient, publicActions, testActions, toHex, walletActions } from "viem";
|
|
2
|
+
import { getAction } from "viem/utils";
|
|
3
|
+
import { waitForTransactionReceipt, writeContract } from "viem/actions";
|
|
2
4
|
//#region src/dev/createAnvilClient.ts
|
|
3
5
|
let dealModulePromise;
|
|
4
6
|
async function loadDeal() {
|
|
@@ -7,23 +9,27 @@ async function loadDeal() {
|
|
|
7
9
|
if (!mod) throw new Error("createAnvilClient: deal action requires the 'viem-deal' package; install it as a dependency");
|
|
8
10
|
return mod.deal;
|
|
9
11
|
}
|
|
12
|
+
function anvilActions(client) {
|
|
13
|
+
return {
|
|
14
|
+
anvilNodeInfo: () => anvilNodeInfo(client),
|
|
15
|
+
isAnvil: () => isAnvil(client),
|
|
16
|
+
evmMineDetailed: (timestamp) => evmMineDetailed(client, timestamp),
|
|
17
|
+
deal: async (params) => {
|
|
18
|
+
await (await loadDeal())(client, params);
|
|
19
|
+
},
|
|
20
|
+
writeContractSync: (parameters) => writeContractSync(client, parameters)
|
|
21
|
+
};
|
|
22
|
+
}
|
|
10
23
|
/**
|
|
11
24
|
* Extends an arbitrary viem `PublicClient` with anvil + wallet actions plus
|
|
12
25
|
* the SDK's bonus actions (`anvilNodeInfo`, `isAnvil`, `evmMineDetailed`,
|
|
13
|
-
* `deal`).
|
|
26
|
+
* `deal`, `writeContractSync`).
|
|
14
27
|
*
|
|
15
28
|
* Used to lift `sdk.client` into an `AnvilClient` shape on the fly when test
|
|
16
29
|
* RPCs (impersonateAccount, setBalance, setStorageAt, ...) are needed.
|
|
17
30
|
*/
|
|
18
31
|
function extendAnvilClient(client) {
|
|
19
|
-
return client.extend(() => ({ mode: "anvil" })).extend(testActions({ mode: "anvil" })).extend(walletActions).extend((c) => (
|
|
20
|
-
anvilNodeInfo: () => anvilNodeInfo(c),
|
|
21
|
-
isAnvil: () => isAnvil(c),
|
|
22
|
-
evmMineDetailed: (timestamp) => evmMineDetailed(c, timestamp),
|
|
23
|
-
deal: async (params) => {
|
|
24
|
-
await (await loadDeal())(c, params);
|
|
25
|
-
}
|
|
26
|
-
}));
|
|
32
|
+
return client.extend(() => ({ mode: "anvil" })).extend(testActions({ mode: "anvil" })).extend(walletActions).extend((c) => anvilActions(c));
|
|
27
33
|
}
|
|
28
34
|
function createAnvilClient({ chain, transport, cacheTime = 0, pollingInterval = 50 }) {
|
|
29
35
|
return createTestClient({
|
|
@@ -32,14 +38,7 @@ function createAnvilClient({ chain, transport, cacheTime = 0, pollingInterval =
|
|
|
32
38
|
transport,
|
|
33
39
|
cacheTime,
|
|
34
40
|
pollingInterval
|
|
35
|
-
}).extend(publicActions).extend(walletActions).extend((c) => (
|
|
36
|
-
anvilNodeInfo: () => anvilNodeInfo(c),
|
|
37
|
-
isAnvil: () => isAnvil(c),
|
|
38
|
-
evmMineDetailed: (timestamp) => evmMineDetailed(c, timestamp),
|
|
39
|
-
deal: async (params) => {
|
|
40
|
-
await (await loadDeal())(c, params);
|
|
41
|
-
}
|
|
42
|
-
}));
|
|
41
|
+
}).extend(publicActions).extend(walletActions).extend((c) => anvilActions(c));
|
|
43
42
|
}
|
|
44
43
|
/**
|
|
45
44
|
* View action to detect if client is an anvil client
|
|
@@ -84,5 +83,23 @@ async function evmMineDetailed(client, timestamp) {
|
|
|
84
83
|
return;
|
|
85
84
|
}
|
|
86
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Anvil-compatible `writeContractSync`: send via `writeContract` (Anvil
|
|
88
|
+
* supports `eth_sendTransaction` / `eth_sendRawTransaction`) then wait for
|
|
89
|
+
* the receipt. Viem's own action uses `eth_sendRawTransactionSync`, which
|
|
90
|
+
* Anvil does not implement.
|
|
91
|
+
*/
|
|
92
|
+
async function writeContractSync(client, parameters) {
|
|
93
|
+
const { throwOnReceiptRevert, pollingInterval, timeout, ...writeParams } = parameters;
|
|
94
|
+
const hash = await getAction(client, writeContract, "writeContract")(writeParams);
|
|
95
|
+
const receipt = await getAction(client, waitForTransactionReceipt, "waitForTransactionReceipt")({
|
|
96
|
+
checkReplacement: false,
|
|
97
|
+
hash,
|
|
98
|
+
pollingInterval,
|
|
99
|
+
timeout
|
|
100
|
+
});
|
|
101
|
+
if (throwOnReceiptRevert && receipt.status === "reverted") throw new BaseError(`Transaction with hash "${receipt.transactionHash}" reverted.`, { name: "TransactionReceiptRevertedError" });
|
|
102
|
+
return receipt;
|
|
103
|
+
}
|
|
87
104
|
//#endregion
|
|
88
|
-
export { anvilNodeInfo, createAnvilClient, evmMineDetailed, extendAnvilClient, isAnvil };
|
|
105
|
+
export { anvilNodeInfo, createAnvilClient, evmMineDetailed, extendAnvilClient, isAnvil, writeContractSync };
|
package/dist/esm/dev/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { iDegenNftv2Abi, iFaucetAbi, iOnchainExecutionIdAbi, iOwnableAbi, iaclTraitAbi } from "./abi.js";
|
|
2
2
|
import { claimFromFaucet } from "./claimFromFaucet.js";
|
|
3
|
-
import { anvilNodeInfo, createAnvilClient, evmMineDetailed, extendAnvilClient, isAnvil } from "./createAnvilClient.js";
|
|
3
|
+
import { anvilNodeInfo, createAnvilClient, evmMineDetailed, extendAnvilClient, isAnvil, writeContractSync } from "./createAnvilClient.js";
|
|
4
4
|
import { createMinter } from "./mint/factory.js";
|
|
5
5
|
import "./mint/index.js";
|
|
6
6
|
import { AccountOpener, OpenTxRevertedError } from "./AccountOpener.js";
|
|
@@ -13,10 +13,10 @@ import { detectChain } from "./detectChain.js";
|
|
|
13
13
|
import { isOutOfSyncError } from "./isOutOfSyncError.js";
|
|
14
14
|
import { isRateLimitError } from "./isRateLimitError.js";
|
|
15
15
|
import { isTransientError } from "./isTransientError.js";
|
|
16
|
-
import {
|
|
16
|
+
import { discoverMidasCreditSuites, discoverMidasGateways, discoverMidasMTokens, unpauseMidasIssuanceVault } from "./midasUtils.js";
|
|
17
|
+
import { DEFAULT_MIDAS_ADMIN, getSecuritizeAdmin, greenlistMidasGateway, registerMidasInvestor, registerRWAInvestor, registerSecuritizeInvestor } from "./kycUtils.js";
|
|
17
18
|
import { isRangeError, logSplitterTransport } from "./logSplitterTransport.js";
|
|
18
19
|
import { setLTZero, setLTs } from "./ltUtils.js";
|
|
19
|
-
import { unpauseMidasIssuanceVault } from "./midasUtils.js";
|
|
20
20
|
import { migrateFaucet } from "./migrateFaucet.js";
|
|
21
21
|
import { SUPPORTED_RPC_PROVIDERS, getAlchemyUrl, getAnkrUrl, getDrpcUrl, getErpcKey, getRpcProviderUrl, getThirdWebUrl, rpcProvidersSchema } from "./providers.js";
|
|
22
22
|
import { replaceStorage } from "./replaceStorage.js";
|
|
@@ -25,4 +25,4 @@ import { claimDSToken, claimDSTokens, enableDSTokenBackDating } from "./securiti
|
|
|
25
25
|
import "./types.js";
|
|
26
26
|
import { ONCHAIN_EXECUTION_ID_ADDRESS, verifyTestnet } from "./verifyTestnet.js";
|
|
27
27
|
import { makePendingWithdrawalsClaimable } from "./withdrawalUtils.js";
|
|
28
|
-
export { AccountOpener, Create2Deployer, DEFAULT_CREATE2_SALT, EthCallSpy, NoAvailableTransportsError, ONCHAIN_EXECUTION_ID_ADDRESS, OpenTxRevertedError, PUBLIC_CREATE2_FACTORY, RevolverTransport, SUPPORTED_RPC_PROVIDERS, SelectionStrategy, anvilNodeInfo, calcLiquidatableLTs, claimDSToken, claimDSTokens, claimFromFaucet, createAnvilClient, createMinter, deployUsingPublicCreate2, detectChain, enableDSTokenBackDating, evmMineDetailed, extendAnvilClient, getAlchemyUrl, getAnkrUrl, getDrpcUrl, getErpcKey, getPublicCreate2Address, getRpcProviderUrl, getThirdWebUrl, greenlistMidasGateway, httpTransportOptionsSchema, iDegenNftv2Abi, iFaucetAbi, iOnchainExecutionIdAbi, iOwnableAbi, iaclTraitAbi, isAnvil, isDeployedUsingPublicCreate2, isOutOfSyncError, isRangeError, isRateLimitError, isTransientError, logSplitterTransport, makePendingWithdrawalsClaimable, migrateFaucet, providerConfigSchema, registerMidasInvestor, registerRWAInvestor, registerSecuritizeInvestor, replaceStorage, resilientTransport, resilientTransportOptionsSchema, revolverTransportConfigBaseSchema, revolverTransportConfigSchema, rpcProvidersSchema, setLTZero, setLTs, unpauseMidasIssuanceVault, verifyTestnet,
|
|
28
|
+
export { AccountOpener, Create2Deployer, DEFAULT_CREATE2_SALT, DEFAULT_MIDAS_ADMIN, EthCallSpy, NoAvailableTransportsError, ONCHAIN_EXECUTION_ID_ADDRESS, OpenTxRevertedError, PUBLIC_CREATE2_FACTORY, RevolverTransport, SUPPORTED_RPC_PROVIDERS, SelectionStrategy, anvilNodeInfo, calcLiquidatableLTs, claimDSToken, claimDSTokens, claimFromFaucet, createAnvilClient, createMinter, deployUsingPublicCreate2, detectChain, discoverMidasCreditSuites, discoverMidasGateways, discoverMidasMTokens, enableDSTokenBackDating, evmMineDetailed, extendAnvilClient, getAlchemyUrl, getAnkrUrl, getDrpcUrl, getErpcKey, getPublicCreate2Address, getRpcProviderUrl, getSecuritizeAdmin, getThirdWebUrl, greenlistMidasGateway, httpTransportOptionsSchema, iDegenNftv2Abi, iFaucetAbi, iOnchainExecutionIdAbi, iOwnableAbi, iaclTraitAbi, isAnvil, isDeployedUsingPublicCreate2, isOutOfSyncError, isRangeError, isRateLimitError, isTransientError, logSplitterTransport, makePendingWithdrawalsClaimable, migrateFaucet, providerConfigSchema, registerMidasInvestor, registerRWAInvestor, registerSecuritizeInvestor, replaceStorage, resilientTransport, resilientTransportOptionsSchema, revolverTransportConfigBaseSchema, revolverTransportConfigSchema, rpcProvidersSchema, setLTZero, setLTs, unpauseMidasIssuanceVault, verifyTestnet, writeContractSync };
|
package/dist/esm/dev/kycUtils.js
CHANGED
|
@@ -4,33 +4,52 @@ import { OnchainSDK } from "../onchain/OnchainSDK.js";
|
|
|
4
4
|
import "../onchain/index.js";
|
|
5
5
|
import { iDSRegistryServiceAbi } from "../abi/rwa/iDSRegistryService.js";
|
|
6
6
|
import { iDSTokenAbi } from "../abi/rwa/iDSToken.js";
|
|
7
|
+
import { discoverMidasCreditSuites, discoverMidasGateways } from "./midasUtils.js";
|
|
7
8
|
import { midasGatewayAbi } from "./withdrawalAbi.js";
|
|
8
|
-
import { isAddressEqual, parseAbi, parseEther, zeroAddress } from "viem";
|
|
9
|
-
import { privateKeyToAccount } from "viem/accounts";
|
|
9
|
+
import { getAddress, isAddressEqual, parseAbi, parseEther, slice, toHex, zeroAddress } from "viem";
|
|
10
10
|
//#region src/dev/kycUtils.ts
|
|
11
|
+
const iMockDSTokenAdminAbi = parseAbi(["function admin() view returns (address)"]);
|
|
11
12
|
/**
|
|
12
|
-
*
|
|
13
|
+
* DS trust-service master of `token`: Ownable owner at storage slot 0 of the
|
|
14
|
+
* trust service, same as periphery-v3 SecuritizeAttachHelper. MockDSToken
|
|
15
|
+
* returns itself as the trust service, so `admin()` is used instead.
|
|
13
16
|
*/
|
|
14
|
-
async function
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
pollingInterval: 100
|
|
17
|
+
async function getSecuritizeAdmin(anvil, token, logger) {
|
|
18
|
+
const trustServiceId = await anvil.readContract({
|
|
19
|
+
address: token,
|
|
20
|
+
abi: iDSTokenAbi,
|
|
21
|
+
functionName: "TRUST_SERVICE"
|
|
20
22
|
});
|
|
21
|
-
|
|
23
|
+
const trustService = await anvil.readContract({
|
|
24
|
+
address: token,
|
|
25
|
+
abi: iDSTokenAbi,
|
|
26
|
+
functionName: "getDSService",
|
|
27
|
+
args: [trustServiceId]
|
|
28
|
+
});
|
|
29
|
+
if (isAddressEqual(trustService, token)) {
|
|
30
|
+
const admin = await anvil.readContract({
|
|
31
|
+
address: token,
|
|
32
|
+
abi: iMockDSTokenAdminAbi,
|
|
33
|
+
functionName: "admin"
|
|
34
|
+
});
|
|
35
|
+
logger?.debug(`securitize: found admin ${admin} for ${token} (token.admin)`);
|
|
36
|
+
return admin;
|
|
37
|
+
}
|
|
38
|
+
const word = await anvil.getStorageAt({
|
|
39
|
+
address: trustService,
|
|
40
|
+
slot: toHex(0, { size: 32 })
|
|
41
|
+
});
|
|
42
|
+
if (!word) throw new Error(`securitize: empty trust-service owner slot on ${trustService}`);
|
|
43
|
+
const admin = getAddress(slice(word, 12));
|
|
44
|
+
logger?.debug(`securitize: found admin ${admin} for ${token} (trust service ${trustService})`);
|
|
45
|
+
return admin;
|
|
22
46
|
}
|
|
23
47
|
/**
|
|
24
|
-
*
|
|
25
|
-
* private key, or the admin address impersonated on the fork
|
|
48
|
+
* Impersonates the DS trust-service admin of `token` on the fork
|
|
26
49
|
*/
|
|
27
50
|
async function useSecuritizeAdmin(props) {
|
|
28
|
-
const { anvil,
|
|
29
|
-
|
|
30
|
-
account: privateKeyToAccount(adminPrivateKey),
|
|
31
|
-
release: async () => {}
|
|
32
|
-
};
|
|
33
|
-
if (!admin) throw new Error("securitize: either adminPrivateKey or admin address is required");
|
|
51
|
+
const { anvil, token, logger } = props;
|
|
52
|
+
const admin = await getSecuritizeAdmin(anvil, token, logger);
|
|
34
53
|
await anvil.impersonateAccount({ address: admin });
|
|
35
54
|
await anvil.setBalance({
|
|
36
55
|
address: admin,
|
|
@@ -98,36 +117,39 @@ async function registerSecuritizeInvestor(props) {
|
|
|
98
117
|
const { account, release } = await useSecuritizeAdmin(props);
|
|
99
118
|
try {
|
|
100
119
|
if (!investorExists) {
|
|
101
|
-
await
|
|
120
|
+
await anvil.writeContractSync({
|
|
102
121
|
account,
|
|
103
122
|
chain: anvil.chain,
|
|
104
123
|
address: registryService,
|
|
105
124
|
abi: iDSRegistryServiceAbi,
|
|
106
125
|
functionName: "registerInvestor",
|
|
107
|
-
args: [investorId, investorId]
|
|
126
|
+
args: [investorId, investorId],
|
|
127
|
+
throwOnReceiptRevert: true
|
|
108
128
|
});
|
|
109
129
|
logger?.debug(`Registered investor "${investorId}"`);
|
|
110
130
|
}
|
|
111
|
-
await
|
|
131
|
+
await anvil.writeContractSync({
|
|
112
132
|
account,
|
|
113
133
|
chain: anvil.chain,
|
|
114
134
|
address: registryService,
|
|
115
135
|
abi: iDSRegistryServiceAbi,
|
|
116
136
|
functionName: "addWallet",
|
|
117
|
-
args: [investor, investorId]
|
|
137
|
+
args: [investor, investorId],
|
|
138
|
+
throwOnReceiptRevert: true
|
|
118
139
|
});
|
|
119
140
|
logger?.debug(`Added wallet ${investor} for investor "${investorId}"`);
|
|
120
141
|
try {
|
|
121
|
-
await
|
|
142
|
+
await anvil.writeContractSync({
|
|
122
143
|
account,
|
|
123
144
|
chain: anvil.chain,
|
|
124
145
|
address: registryService,
|
|
125
146
|
abi: iDSRegistryServiceAbi,
|
|
126
147
|
functionName: "setCountry",
|
|
127
|
-
args: [investorId, "US"]
|
|
148
|
+
args: [investorId, "US"],
|
|
149
|
+
throwOnReceiptRevert: true
|
|
128
150
|
});
|
|
129
151
|
logger?.debug(`Set country for investor "${investorId}" to "US"`);
|
|
130
|
-
await
|
|
152
|
+
await anvil.writeContractSync({
|
|
131
153
|
account,
|
|
132
154
|
chain: anvil.chain,
|
|
133
155
|
address: registryService,
|
|
@@ -139,7 +161,8 @@ async function registerSecuritizeInvestor(props) {
|
|
|
139
161
|
BigInt(APPROVED),
|
|
140
162
|
MAX_UINT256,
|
|
141
163
|
"fake proof"
|
|
142
|
-
]
|
|
164
|
+
],
|
|
165
|
+
throwOnReceiptRevert: true
|
|
143
166
|
});
|
|
144
167
|
logger?.debug(`Set attributes for investor "${investorId}"`);
|
|
145
168
|
} catch (e) {
|
|
@@ -241,13 +264,14 @@ async function greenlistMidasGateway(props) {
|
|
|
241
264
|
logger?.debug(`midas: ${account} already has role ${role}`);
|
|
242
265
|
continue;
|
|
243
266
|
}
|
|
244
|
-
await
|
|
267
|
+
await anvil.writeContractSync({
|
|
245
268
|
account: admin,
|
|
246
269
|
chain: anvil.chain,
|
|
247
270
|
address: accessControl,
|
|
248
271
|
abi: iMidasAccessControlAbi,
|
|
249
272
|
functionName: "grantRole",
|
|
250
|
-
args: [role, account]
|
|
273
|
+
args: [role, account],
|
|
274
|
+
throwOnReceiptRevert: true
|
|
251
275
|
});
|
|
252
276
|
logger?.debug(`midas: granted role ${role} to ${account}`);
|
|
253
277
|
}
|
|
@@ -265,9 +289,7 @@ async function greenlistMidasGateway(props) {
|
|
|
265
289
|
}
|
|
266
290
|
}
|
|
267
291
|
/**
|
|
268
|
-
* Finds the Midas gateway that issues `token`
|
|
269
|
-
* adapters of all loaded credit managers, same as the foundry tests do with
|
|
270
|
-
* `ICreditConfiguratorV3.allowedAdapters`
|
|
292
|
+
* Finds the Midas gateway that issues `token` among the loaded credit managers.
|
|
271
293
|
*/
|
|
272
294
|
async function findMidasGateway(props) {
|
|
273
295
|
const { anvil, token, marketConfigurators, logger } = props;
|
|
@@ -279,30 +301,18 @@ async function findMidasGateway(props) {
|
|
|
279
301
|
});
|
|
280
302
|
await sdk.attach({ marketConfigurators });
|
|
281
303
|
}
|
|
282
|
-
const
|
|
283
|
-
if (
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
abi: midasGatewayAbi,
|
|
289
|
-
functionName: "mToken"
|
|
290
|
-
}))
|
|
291
|
-
})).findIndex((mToken) => isAddressEqual(mToken, token));
|
|
292
|
-
if (index === -1) throw new Error(`no midas gateway found for token ${token}`);
|
|
293
|
-
logger?.debug(`midas: gateway for ${token} is ${candidates[index]}`);
|
|
294
|
-
return candidates[index];
|
|
304
|
+
const suites = await discoverMidasCreditSuites(sdk);
|
|
305
|
+
if (suites.length === 0) throw new Error("no midas gateway adapters or midas degen NFTs found in loaded markets");
|
|
306
|
+
const suite = suites.find(({ mToken }) => isAddressEqual(mToken, token));
|
|
307
|
+
if (!suite) throw new Error(`no midas gateway found for token ${token}`);
|
|
308
|
+
logger?.debug(`midas: gateway for ${token} is ${suite.gateway}`);
|
|
309
|
+
return suite.gateway;
|
|
295
310
|
}
|
|
296
311
|
/**
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
* `ICreditConfiguratorV3.allowedAdapters`
|
|
312
|
+
* Midas access control admin on mainnet. Holds the admin role of the greenlist
|
|
313
|
+
* operator role.
|
|
300
314
|
*/
|
|
301
|
-
|
|
302
|
-
const gateways = new AddressSet();
|
|
303
|
-
for (const cm of sdk.marketRegister.creditManagers) for (const adapter of cm.creditManager.adapters.values()) if (adapter.contractType === "ADAPTER::MIDAS_GATEWAY") gateways.add(adapter.targetContract);
|
|
304
|
-
return gateways.asArray();
|
|
305
|
-
}
|
|
315
|
+
const DEFAULT_MIDAS_ADMIN = "0xd4195CF4df289a4748C1A7B6dDBE770e27bA1227";
|
|
306
316
|
/**
|
|
307
317
|
* Registers a wallet as an investor (fake KYC) in every Securitize DSToken and
|
|
308
318
|
* every Midas gateway of the markets loaded by `sdk`.
|
|
@@ -311,17 +321,15 @@ function collectMidasGateways(sdk) {
|
|
|
311
321
|
* result instead of aborting the whole run.
|
|
312
322
|
*/
|
|
313
323
|
async function registerRWAInvestor(props) {
|
|
314
|
-
const { anvil, sdk, investor,
|
|
324
|
+
const { anvil, sdk, investor, midasAdmin = DEFAULT_MIDAS_ADMIN, logger } = props;
|
|
315
325
|
const securitizeTokens = [];
|
|
316
326
|
const midasGateways = [];
|
|
317
327
|
const failed = [];
|
|
318
328
|
const dsTokens = new AddressSet(sdk.rwa.factories.flatMap((factory) => factory.getTokens()));
|
|
319
|
-
|
|
329
|
+
for (const token of dsTokens) try {
|
|
320
330
|
await registerSecuritizeInvestor({
|
|
321
331
|
anvil,
|
|
322
332
|
investor,
|
|
323
|
-
adminPrivateKey,
|
|
324
|
-
admin: securitizeAdmin,
|
|
325
333
|
token,
|
|
326
334
|
logger
|
|
327
335
|
});
|
|
@@ -334,8 +342,7 @@ async function registerRWAInvestor(props) {
|
|
|
334
342
|
error: e
|
|
335
343
|
});
|
|
336
344
|
}
|
|
337
|
-
|
|
338
|
-
const gateways = collectMidasGateways(sdk);
|
|
345
|
+
const gateways = await discoverMidasGateways(sdk);
|
|
339
346
|
for (const gateway of gateways) try {
|
|
340
347
|
await greenlistMidasGateway({
|
|
341
348
|
anvil,
|
|
@@ -361,4 +368,4 @@ async function registerRWAInvestor(props) {
|
|
|
361
368
|
};
|
|
362
369
|
}
|
|
363
370
|
//#endregion
|
|
364
|
-
export { greenlistMidasGateway, registerMidasInvestor, registerRWAInvestor, registerSecuritizeInvestor
|
|
371
|
+
export { DEFAULT_MIDAS_ADMIN, getSecuritizeAdmin, greenlistMidasGateway, registerMidasInvestor, registerRWAInvestor, registerSecuritizeInvestor };
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { AddressSet } from "../onchain/utils/AddressSet.js";
|
|
2
|
+
import { MidasGatewayAdapterContract } from "../onchain/market/adapters/contracts/MidasGatewayAdapterContract.js";
|
|
3
|
+
import { MidasDegenNFT } from "../onchain/market/rwa/midas/MidasDegenNFT.js";
|
|
4
|
+
import "../onchain/index.js";
|
|
5
|
+
import { parseAbi, parseEther, toFunctionSelector } from "viem";
|
|
3
6
|
//#region src/dev/midasUtils.ts
|
|
4
7
|
/**
|
|
5
8
|
* Midas vaults inherit their own `Pausable`, whose global pause is guarded by
|
|
@@ -9,14 +12,24 @@ const iMidasPausableVaultAbi = parseAbi([
|
|
|
9
12
|
"function paused() external view returns (bool)",
|
|
10
13
|
"function pause() external",
|
|
11
14
|
"function unpause() external",
|
|
15
|
+
"function fnPaused(bytes4 fn) external view returns (bool)",
|
|
16
|
+
"function pauseFn(bytes4 fn) external",
|
|
17
|
+
"function unpauseFn(bytes4 fn) external",
|
|
12
18
|
"function pauseAdminRole() external view returns (bytes32)",
|
|
13
19
|
"function accessControl() external view returns (address)"
|
|
14
20
|
]);
|
|
15
21
|
const iMidasAccessControlAbi = parseAbi(["function hasRole(bytes32 role, address account) external view returns (bool)", "function grantRole(bytes32 role, address account) external"]);
|
|
16
22
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
23
|
+
* Selector for `DepositVault.depositInstant(address,uint256,uint256,bytes32)`,
|
|
24
|
+
* the 4-arg mint Gearbox adapters encode. Distinct from the custom-recipient
|
|
25
|
+
* overload.
|
|
26
|
+
*/
|
|
27
|
+
const DEPOSIT_INSTANT_SELECTOR = toFunctionSelector("depositInstant(address,uint256,uint256,bytes32)");
|
|
28
|
+
/**
|
|
29
|
+
* Unpauses a Midas issuance vault on an anvil fork so that `depositInstant`
|
|
30
|
+
* stops reverting with `Pausable: paused` (global) or `Pausable: fn paused`
|
|
31
|
+
* (per-selector), and returns a callback that restores the original pause
|
|
32
|
+
* state of each layer that was cleared.
|
|
20
33
|
*
|
|
21
34
|
* Impersonates `admin` and grants it `pauseAdminRole()` when missing, same as
|
|
22
35
|
* `greenlistMidasGateway` does with the greenlist roles. The grant is not
|
|
@@ -24,11 +37,20 @@ const iMidasAccessControlAbi = parseAbi(["function hasRole(bytes32 role, address
|
|
|
24
37
|
*/
|
|
25
38
|
async function unpauseMidasIssuanceVault(props) {
|
|
26
39
|
const { anvil, vault, admin, logger } = props;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
40
|
+
const [paused, depositInstantPaused] = await anvil.multicall({
|
|
41
|
+
allowFailure: false,
|
|
42
|
+
contracts: [{
|
|
43
|
+
address: vault,
|
|
44
|
+
abi: iMidasPausableVaultAbi,
|
|
45
|
+
functionName: "paused"
|
|
46
|
+
}, {
|
|
47
|
+
address: vault,
|
|
48
|
+
abi: iMidasPausableVaultAbi,
|
|
49
|
+
functionName: "fnPaused",
|
|
50
|
+
args: [DEPOSIT_INSTANT_SELECTOR]
|
|
51
|
+
}]
|
|
52
|
+
});
|
|
53
|
+
if (!paused && !depositInstantPaused) {
|
|
32
54
|
logger?.debug(`midas: issuance vault ${vault} is not paused`);
|
|
33
55
|
return async () => {};
|
|
34
56
|
}
|
|
@@ -50,7 +72,7 @@ async function unpauseMidasIssuanceVault(props) {
|
|
|
50
72
|
functionName: "hasRole",
|
|
51
73
|
args: [pauseAdminRole, admin]
|
|
52
74
|
});
|
|
53
|
-
logger?.debug(`midas: unpausing issuance vault ${vault} as ${admin}, access control ${accessControl}, pause admin role ${pauseAdminRole}`);
|
|
75
|
+
logger?.debug(`midas: unpausing issuance vault ${vault} as ${admin}, access control ${accessControl}, pause admin role ${pauseAdminRole}` + (paused ? ", global" : "") + (depositInstantPaused ? ", depositInstant" : ""));
|
|
54
76
|
await anvil.impersonateAccount({ address: admin });
|
|
55
77
|
try {
|
|
56
78
|
await anvil.setBalance({
|
|
@@ -58,22 +80,33 @@ async function unpauseMidasIssuanceVault(props) {
|
|
|
58
80
|
value: parseEther("100")
|
|
59
81
|
});
|
|
60
82
|
if (!isPauseAdmin) {
|
|
61
|
-
await
|
|
83
|
+
await anvil.writeContractSync({
|
|
62
84
|
account: admin,
|
|
63
85
|
chain: anvil.chain,
|
|
64
86
|
address: accessControl,
|
|
65
87
|
abi: iMidasAccessControlAbi,
|
|
66
88
|
functionName: "grantRole",
|
|
67
|
-
args: [pauseAdminRole, admin]
|
|
89
|
+
args: [pauseAdminRole, admin],
|
|
90
|
+
throwOnReceiptRevert: true
|
|
68
91
|
});
|
|
69
92
|
logger?.debug(`midas: granted pause admin role to ${admin}`);
|
|
70
93
|
}
|
|
71
|
-
await
|
|
94
|
+
if (paused) await anvil.writeContractSync({
|
|
72
95
|
account: admin,
|
|
73
96
|
chain: anvil.chain,
|
|
74
97
|
address: vault,
|
|
75
98
|
abi: iMidasPausableVaultAbi,
|
|
76
|
-
functionName: "unpause"
|
|
99
|
+
functionName: "unpause",
|
|
100
|
+
throwOnReceiptRevert: true
|
|
101
|
+
});
|
|
102
|
+
if (depositInstantPaused) await anvil.writeContractSync({
|
|
103
|
+
account: admin,
|
|
104
|
+
chain: anvil.chain,
|
|
105
|
+
address: vault,
|
|
106
|
+
abi: iMidasPausableVaultAbi,
|
|
107
|
+
functionName: "unpauseFn",
|
|
108
|
+
args: [DEPOSIT_INSTANT_SELECTOR],
|
|
109
|
+
throwOnReceiptRevert: true
|
|
77
110
|
});
|
|
78
111
|
} finally {
|
|
79
112
|
await anvil.stopImpersonatingAccount({ address: admin });
|
|
@@ -89,12 +122,22 @@ async function unpauseMidasIssuanceVault(props) {
|
|
|
89
122
|
address: admin,
|
|
90
123
|
value: parseEther("100")
|
|
91
124
|
});
|
|
92
|
-
await
|
|
125
|
+
if (paused) await anvil.writeContractSync({
|
|
93
126
|
account: admin,
|
|
94
127
|
chain: anvil.chain,
|
|
95
128
|
address: vault,
|
|
96
129
|
abi: iMidasPausableVaultAbi,
|
|
97
|
-
functionName: "pause"
|
|
130
|
+
functionName: "pause",
|
|
131
|
+
throwOnReceiptRevert: true
|
|
132
|
+
});
|
|
133
|
+
if (depositInstantPaused) await anvil.writeContractSync({
|
|
134
|
+
account: admin,
|
|
135
|
+
chain: anvil.chain,
|
|
136
|
+
address: vault,
|
|
137
|
+
abi: iMidasPausableVaultAbi,
|
|
138
|
+
functionName: "pauseFn",
|
|
139
|
+
args: [DEPOSIT_INSTANT_SELECTOR],
|
|
140
|
+
throwOnReceiptRevert: true
|
|
98
141
|
});
|
|
99
142
|
} catch (e) {
|
|
100
143
|
logger?.warn(`midas: failed to pause issuance vault ${vault} back: ${e}`);
|
|
@@ -103,5 +146,56 @@ async function unpauseMidasIssuanceVault(props) {
|
|
|
103
146
|
}
|
|
104
147
|
};
|
|
105
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Midas credit suites of the loaded credit managers.
|
|
151
|
+
*
|
|
152
|
+
* A manager with a gateway adapter is a suite on its own, so its degen NFT
|
|
153
|
+
* is not consulted. Suites that only have a Midas degen NFT read `mToken`
|
|
154
|
+
* from the gateway.
|
|
155
|
+
*/
|
|
156
|
+
async function discoverMidasCreditSuites(sdk) {
|
|
157
|
+
const suites = [];
|
|
158
|
+
for (const cm of sdk.marketRegister.creditManagers) {
|
|
159
|
+
const creditManager = cm.creditManager.address;
|
|
160
|
+
let hasAdapter = false;
|
|
161
|
+
for (const adapter of cm.creditManager.adapters.values()) if (adapter instanceof MidasGatewayAdapterContract) {
|
|
162
|
+
hasAdapter = true;
|
|
163
|
+
suites.push({
|
|
164
|
+
creditManager,
|
|
165
|
+
gateway: adapter.gateway,
|
|
166
|
+
mToken: adapter.mToken
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
if (hasAdapter) continue;
|
|
170
|
+
const nft = await cm.degenNFT();
|
|
171
|
+
if (nft instanceof MidasDegenNFT) {
|
|
172
|
+
const [mToken] = await nft.getTokens();
|
|
173
|
+
suites.push({
|
|
174
|
+
creditManager,
|
|
175
|
+
gateway: nft.gateway,
|
|
176
|
+
mToken
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return suites;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Gateways of the Midas credit suites of the loaded credit managers.
|
|
184
|
+
*/
|
|
185
|
+
async function discoverMidasGateways(sdk) {
|
|
186
|
+
const suites = await discoverMidasCreditSuites(sdk);
|
|
187
|
+
return new AddressSet(suites.map((suite) => suite.gateway)).asArray();
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* mTokens of the Midas credit suites of the loaded credit managers.
|
|
191
|
+
*
|
|
192
|
+
* A manager with a gateway adapter contributes that adapter's mToken, so its
|
|
193
|
+
* degen NFT is not consulted. Suites that only have a Midas degen NFT
|
|
194
|
+
* contribute the mToken read from the gateway.
|
|
195
|
+
*/
|
|
196
|
+
async function discoverMidasMTokens(sdk) {
|
|
197
|
+
const suites = await discoverMidasCreditSuites(sdk);
|
|
198
|
+
return new AddressSet(suites.map((suite) => suite.mToken)).asArray();
|
|
199
|
+
}
|
|
106
200
|
//#endregion
|
|
107
|
-
export { unpauseMidasIssuanceVault };
|
|
201
|
+
export { discoverMidasCreditSuites, discoverMidasGateways, discoverMidasMTokens, unpauseMidasIssuanceVault };
|