@gearbox-protocol/sdk 13.0.0-next.3 → 13.0.0-next.31
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/abi/310/iSecuritizeDegenNFT.js +263 -0
- package/dist/cjs/abi/310/iSecuritizeKYCFactory.js +278 -0
- package/dist/cjs/dev/AccountOpener.js +45 -5
- package/dist/cjs/dev/providers.js +12 -0
- package/dist/cjs/history/assembleOperations.js +103 -0
- package/dist/cjs/history/classifyMulticallOperations.js +157 -0
- package/dist/cjs/history/errors.js +91 -0
- package/dist/cjs/history/extractProtocolCalls.js +53 -0
- package/dist/cjs/history/extractTransfers.js +168 -0
- package/dist/cjs/history/findFacadeCalls.js +84 -0
- package/dist/cjs/history/index.js +39 -0
- package/dist/cjs/history/inner-operations.js +16 -0
- package/dist/cjs/history/internal-types.js +16 -0
- package/dist/cjs/history/mapOperations.js +79 -0
- package/dist/cjs/history/package.json +1 -0
- package/dist/cjs/history/parseCreditAccountTransaction.js +86 -0
- package/dist/cjs/history/populateContractsRegister.js +68 -0
- package/dist/cjs/history/toLegacyOperation.js +182 -0
- package/dist/cjs/{plugins/adapters/contracts/YearnV2AdapterContract.js → history/trace-utils.js} +36 -21
- package/dist/cjs/history/types.js +16 -0
- package/dist/cjs/plugins/adapters/AdaptersPlugin.js +13 -106
- package/dist/cjs/plugins/adapters/abi/index.js +2 -0
- package/dist/cjs/plugins/adapters/abi/targetContractAbi.js +5168 -0
- package/dist/cjs/plugins/adapters/contracts/AbstractAdapter.js +102 -3
- package/dist/cjs/plugins/adapters/contracts/AccountMigratorAdapterContract.js +8 -1
- package/dist/cjs/plugins/adapters/contracts/BalancerV3RouterAdapterContract.js +40 -30
- package/dist/cjs/plugins/adapters/contracts/BalancerV3WrapperAdapterContract.js +21 -11
- package/dist/cjs/plugins/adapters/contracts/CamelotV3AdapterContract.js +31 -21
- package/dist/cjs/plugins/adapters/contracts/ConvexV1BaseRewardPoolAdapterContract.js +91 -25
- package/dist/cjs/plugins/adapters/contracts/ConvexV1BoosterAdapterContract.js +63 -25
- package/dist/cjs/plugins/adapters/contracts/Curve2AssetsAdapterContract.js +68 -31
- package/dist/cjs/plugins/adapters/contracts/Curve3AssetsAdapterContract.js +68 -31
- package/dist/cjs/plugins/adapters/contracts/Curve4AssetsAdapterContract.js +73 -31
- package/dist/cjs/plugins/adapters/contracts/CurveV1AdapterDeposit.js +80 -33
- package/dist/cjs/plugins/adapters/contracts/CurveV1AdapterStETHContract.js +62 -26
- package/dist/cjs/plugins/adapters/contracts/CurveV1StableNGAdapterContract.js +80 -34
- package/dist/cjs/plugins/adapters/contracts/DaiUsdsAdapterContract.js +39 -14
- package/dist/cjs/plugins/adapters/contracts/ERC4626AdapterContract.js +55 -27
- package/dist/cjs/plugins/adapters/contracts/ERC4626ReferralAdapterContract.js +39 -14
- package/dist/cjs/plugins/adapters/contracts/FluidDexAdapterContract.js +27 -14
- package/dist/cjs/plugins/adapters/contracts/InfinifiGatewayAdapterContract.js +45 -23
- package/dist/cjs/plugins/adapters/contracts/InfinifiUnwindingGatewayAdapterContract.js +23 -14
- package/dist/cjs/plugins/adapters/contracts/KelpLRTDepositPoolAdapterContract.js +22 -12
- package/dist/cjs/plugins/adapters/contracts/KelpLRTWithdrawalManagerAdapterContract.js +26 -16
- package/dist/cjs/plugins/adapters/contracts/LidoV1AdapterContract.js +39 -17
- package/dist/cjs/plugins/adapters/contracts/MellowClaimerAdapterContract.js +21 -11
- package/dist/cjs/plugins/adapters/contracts/MellowDVVAdapterContract.js +38 -14
- package/dist/cjs/plugins/adapters/contracts/MellowERC4626VaultAdapterContract.js +71 -42
- package/dist/cjs/plugins/adapters/contracts/MellowWrapperAdapterContract.js +21 -11
- package/dist/cjs/plugins/adapters/contracts/MidasIssuanceVaultAdapterContract.js +36 -17
- package/dist/cjs/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.js +38 -21
- package/dist/cjs/plugins/adapters/contracts/PendleRouterAdapterContract.js +63 -53
- package/dist/cjs/plugins/adapters/contracts/StakingRewardsAdapterContract.js +62 -37
- package/dist/cjs/plugins/adapters/contracts/TraderJoeRouterAdapterContract.js +35 -25
- package/dist/cjs/plugins/adapters/contracts/UniswapV2AdapterContract.js +35 -21
- package/dist/cjs/plugins/adapters/contracts/UniswapV3AdapterContract.js +32 -23
- package/dist/cjs/plugins/adapters/contracts/UniswapV4AdapterContract.js +41 -27
- package/dist/cjs/plugins/adapters/contracts/UpshiftVaultAdapterContract.js +34 -17
- package/dist/cjs/plugins/adapters/contracts/VelodromeV2AdapterContract.js +35 -25
- package/dist/cjs/plugins/adapters/contracts/WstETHV1AdapterContract.js +31 -11
- package/dist/cjs/plugins/adapters/contracts/deprecated/BalancerV2VaultAdapterContract.js +585 -0
- package/dist/cjs/plugins/adapters/contracts/deprecated/EqualizerRouterAdapterContract.js +262 -0
- package/dist/cjs/plugins/adapters/contracts/deprecated/InfraredVaultAdapterContract.js +296 -0
- package/dist/cjs/plugins/adapters/contracts/deprecated/KodiakIslandGatewayAdapterContract.js +415 -0
- package/dist/cjs/plugins/adapters/contracts/deprecated/MellowDepositQueueAdapterContract.js +74 -0
- package/dist/cjs/plugins/adapters/contracts/{MellowRedeemQueueAdapterContract.js → deprecated/MellowRedeemQueueAdapterContract.js} +33 -14
- package/dist/cjs/plugins/adapters/contracts/deprecated/MellowVaultAdapterContract.js +233 -0
- package/dist/cjs/plugins/adapters/contracts/deprecated/YearnV2AdapterContract.js +359 -0
- package/dist/cjs/plugins/adapters/contracts/deprecated/index.js +36 -0
- package/dist/cjs/plugins/adapters/contracts/index.js +3 -17
- package/dist/cjs/plugins/adapters/contracts/types.js +0 -9
- package/dist/cjs/plugins/adapters/createAdapter.js +140 -0
- package/dist/cjs/plugins/adapters/index.js +6 -0
- package/dist/cjs/plugins/adapters/legacyAdapterOperations.js +16 -0
- package/dist/cjs/plugins/adapters/transferHelpers.js +127 -0
- package/dist/cjs/sdk/accounts/AbstractCreditAccountsService.js +464 -105
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV300.js +9 -4
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +16 -5
- package/dist/cjs/sdk/base/BaseContract.js +54 -3
- package/dist/cjs/sdk/base/ChainContractsRegister.js +34 -1
- package/dist/cjs/sdk/base/Construct.js +11 -3
- package/dist/cjs/sdk/base/PlaceholderContract.js +2 -2
- package/dist/cjs/sdk/base/TokensMeta.js +161 -22
- package/dist/cjs/sdk/base/errors.js +35 -0
- package/dist/cjs/sdk/base/index.js +2 -0
- package/dist/cjs/sdk/chain/chains.js +2 -1
- package/dist/cjs/sdk/market/MarketRegister.js +2 -2
- package/dist/cjs/sdk/market/MarketSuite.js +3 -0
- package/dist/cjs/sdk/{pools/extraZappers.js → market/ZapperRegister.js} +110 -6
- package/dist/cjs/sdk/market/adapters/PlaceholderAdapterContracts.js +10 -4
- package/dist/cjs/sdk/market/adapters/{factory.js → createAdapter.js} +3 -3
- package/dist/cjs/sdk/market/adapters/index.js +2 -2
- package/dist/cjs/sdk/market/credit/CreditFacadeV310BaseContract.js +108 -0
- package/dist/cjs/sdk/market/credit/CreditFacadeV310Contract.js +3 -40
- package/dist/cjs/sdk/market/credit/index.js +2 -0
- package/dist/cjs/sdk/market/index.js +3 -1
- package/dist/cjs/sdk/market/pool/PoolSuite.js +3 -0
- package/dist/cjs/sdk/market/pool/PoolV300Contract.js +3 -0
- package/dist/cjs/sdk/market/pool/PoolV310Contract.js +17 -2
- package/dist/cjs/sdk/market/pool/SecuritizeKYCFactory.js +97 -0
- package/dist/cjs/sdk/market/pool/index.js +2 -0
- package/dist/cjs/sdk/market/pricefeeds/PythPriceFeed.js +20 -0
- package/dist/cjs/sdk/market/types.js +16 -0
- package/dist/cjs/sdk/pools/PoolService.js +181 -91
- package/dist/cjs/sdk/sdk-legacy/core/creditAccount.js +2 -0
- package/dist/cjs/sdk/utils/AddressMap.js +1 -1
- package/dist/cjs/sdk/utils/abi-decode.js +43 -2
- package/dist/cjs/sdk/utils/viem/sendRawTx.js +16 -0
- package/dist/esm/abi/310/iSecuritizeDegenNFT.js +239 -0
- package/dist/esm/abi/310/iSecuritizeKYCFactory.js +254 -0
- package/dist/esm/dev/AccountOpener.js +47 -6
- package/dist/esm/dev/providers.js +12 -0
- package/dist/esm/history/assembleOperations.js +79 -0
- package/dist/esm/history/classifyMulticallOperations.js +137 -0
- package/dist/esm/history/errors.js +62 -0
- package/dist/esm/history/extractProtocolCalls.js +32 -0
- package/dist/esm/history/extractTransfers.js +148 -0
- package/dist/esm/history/findFacadeCalls.js +63 -0
- package/dist/esm/history/index.js +9 -0
- package/dist/esm/history/inner-operations.js +0 -0
- package/dist/esm/history/internal-types.js +0 -0
- package/dist/esm/history/mapOperations.js +55 -0
- package/dist/esm/history/package.json +1 -0
- package/dist/esm/history/parseCreditAccountTransaction.js +62 -0
- package/dist/esm/history/populateContractsRegister.js +52 -0
- package/dist/esm/history/toLegacyOperation.js +157 -0
- package/dist/esm/history/trace-utils.js +36 -0
- package/dist/esm/history/types.js +0 -0
- package/dist/esm/plugins/adapters/AdaptersPlugin.js +14 -148
- package/dist/esm/plugins/adapters/abi/index.js +1 -0
- package/dist/esm/plugins/adapters/abi/targetContractAbi.js +5113 -0
- package/dist/esm/plugins/adapters/contracts/AbstractAdapter.js +111 -4
- package/dist/esm/plugins/adapters/contracts/AccountMigratorAdapterContract.js +8 -1
- package/dist/esm/plugins/adapters/contracts/BalancerV3RouterAdapterContract.js +40 -30
- package/dist/esm/plugins/adapters/contracts/BalancerV3WrapperAdapterContract.js +21 -11
- package/dist/esm/plugins/adapters/contracts/CamelotV3AdapterContract.js +31 -21
- package/dist/esm/plugins/adapters/contracts/ConvexV1BaseRewardPoolAdapterContract.js +100 -26
- package/dist/esm/plugins/adapters/contracts/ConvexV1BoosterAdapterContract.js +65 -25
- package/dist/esm/plugins/adapters/contracts/Curve2AssetsAdapterContract.js +70 -31
- package/dist/esm/plugins/adapters/contracts/Curve3AssetsAdapterContract.js +70 -31
- package/dist/esm/plugins/adapters/contracts/Curve4AssetsAdapterContract.js +75 -31
- package/dist/esm/plugins/adapters/contracts/CurveV1AdapterDeposit.js +82 -33
- package/dist/esm/plugins/adapters/contracts/CurveV1AdapterStETHContract.js +64 -26
- package/dist/esm/plugins/adapters/contracts/CurveV1StableNGAdapterContract.js +85 -34
- package/dist/esm/plugins/adapters/contracts/DaiUsdsAdapterContract.js +41 -14
- package/dist/esm/plugins/adapters/contracts/ERC4626AdapterContract.js +57 -27
- package/dist/esm/plugins/adapters/contracts/ERC4626ReferralAdapterContract.js +41 -14
- package/dist/esm/plugins/adapters/contracts/FluidDexAdapterContract.js +29 -14
- package/dist/esm/plugins/adapters/contracts/InfinifiGatewayAdapterContract.js +47 -23
- package/dist/esm/plugins/adapters/contracts/InfinifiUnwindingGatewayAdapterContract.js +29 -15
- package/dist/esm/plugins/adapters/contracts/KelpLRTDepositPoolAdapterContract.js +27 -12
- package/dist/esm/plugins/adapters/contracts/KelpLRTWithdrawalManagerAdapterContract.js +31 -16
- package/dist/esm/plugins/adapters/contracts/LidoV1AdapterContract.js +41 -17
- package/dist/esm/plugins/adapters/contracts/MellowClaimerAdapterContract.js +23 -11
- package/dist/esm/plugins/adapters/contracts/MellowDVVAdapterContract.js +40 -14
- package/dist/esm/plugins/adapters/contracts/MellowERC4626VaultAdapterContract.js +74 -43
- package/dist/esm/plugins/adapters/contracts/MellowWrapperAdapterContract.js +23 -11
- package/dist/esm/plugins/adapters/contracts/MidasIssuanceVaultAdapterContract.js +38 -17
- package/dist/esm/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.js +44 -22
- package/dist/esm/plugins/adapters/contracts/PendleRouterAdapterContract.js +65 -53
- package/dist/esm/plugins/adapters/contracts/StakingRewardsAdapterContract.js +64 -37
- package/dist/esm/plugins/adapters/contracts/TraderJoeRouterAdapterContract.js +35 -25
- package/dist/esm/plugins/adapters/contracts/UniswapV2AdapterContract.js +36 -22
- package/dist/esm/plugins/adapters/contracts/UniswapV3AdapterContract.js +33 -24
- package/dist/esm/plugins/adapters/contracts/UniswapV4AdapterContract.js +45 -28
- package/dist/esm/plugins/adapters/contracts/UpshiftVaultAdapterContract.js +40 -18
- package/dist/esm/plugins/adapters/contracts/VelodromeV2AdapterContract.js +35 -25
- package/dist/esm/plugins/adapters/contracts/WstETHV1AdapterContract.js +33 -11
- package/dist/esm/plugins/adapters/contracts/deprecated/BalancerV2VaultAdapterContract.js +559 -0
- package/dist/esm/plugins/adapters/contracts/deprecated/EqualizerRouterAdapterContract.js +236 -0
- package/dist/esm/plugins/adapters/contracts/deprecated/InfraredVaultAdapterContract.js +272 -0
- package/dist/esm/plugins/adapters/contracts/deprecated/KodiakIslandGatewayAdapterContract.js +390 -0
- package/dist/esm/plugins/adapters/contracts/deprecated/MellowDepositQueueAdapterContract.js +52 -0
- package/dist/esm/plugins/adapters/contracts/deprecated/MellowRedeemQueueAdapterContract.js +45 -0
- package/dist/esm/plugins/adapters/contracts/deprecated/MellowVaultAdapterContract.js +209 -0
- package/dist/esm/plugins/adapters/contracts/deprecated/YearnV2AdapterContract.js +336 -0
- package/dist/esm/plugins/adapters/contracts/deprecated/index.js +8 -0
- package/dist/esm/plugins/adapters/contracts/index.js +1 -8
- package/dist/esm/plugins/adapters/contracts/types.js +0 -8
- package/dist/esm/plugins/adapters/createAdapter.js +158 -0
- package/dist/esm/plugins/adapters/index.js +3 -0
- package/dist/esm/plugins/adapters/legacyAdapterOperations.js +0 -0
- package/dist/esm/plugins/adapters/transferHelpers.js +95 -0
- package/dist/esm/sdk/accounts/AbstractCreditAccountsService.js +464 -105
- package/dist/esm/sdk/accounts/CreditAccountsServiceV300.js +9 -4
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +16 -5
- package/dist/esm/sdk/base/BaseContract.js +56 -3
- package/dist/esm/sdk/base/ChainContractsRegister.js +34 -1
- package/dist/esm/sdk/base/Construct.js +11 -3
- package/dist/esm/sdk/base/PlaceholderContract.js +2 -2
- package/dist/esm/sdk/base/TokensMeta.js +165 -21
- package/dist/esm/sdk/base/errors.js +11 -0
- package/dist/esm/sdk/base/index.js +1 -0
- package/dist/esm/sdk/chain/chains.js +2 -1
- package/dist/esm/sdk/market/MarketRegister.js +2 -2
- package/dist/esm/sdk/market/MarketSuite.js +3 -0
- package/dist/esm/sdk/{pools/extraZappers.js → market/ZapperRegister.js} +109 -2
- package/dist/esm/sdk/market/adapters/PlaceholderAdapterContracts.js +14 -5
- package/dist/esm/sdk/market/adapters/index.js +1 -1
- package/dist/esm/sdk/market/credit/CreditFacadeV310BaseContract.js +86 -0
- package/dist/esm/sdk/market/credit/CreditFacadeV310Contract.js +3 -43
- package/dist/esm/sdk/market/credit/index.js +1 -0
- package/dist/esm/sdk/market/index.js +1 -0
- package/dist/esm/sdk/market/pool/PoolSuite.js +3 -0
- package/dist/esm/sdk/market/pool/PoolV300Contract.js +3 -0
- package/dist/esm/sdk/market/pool/PoolV310Contract.js +17 -2
- package/dist/esm/sdk/market/pool/SecuritizeKYCFactory.js +73 -0
- package/dist/esm/sdk/market/pool/index.js +1 -0
- package/dist/esm/sdk/market/pricefeeds/PythPriceFeed.js +21 -1
- package/dist/esm/sdk/market/types.js +0 -0
- package/dist/esm/sdk/pools/PoolService.js +182 -98
- package/dist/esm/sdk/sdk-legacy/core/creditAccount.js +2 -0
- package/dist/esm/sdk/utils/AddressMap.js +1 -1
- package/dist/esm/sdk/utils/abi-decode.js +43 -2
- package/dist/esm/sdk/utils/viem/sendRawTx.js +19 -1
- package/dist/types/abi/310/iSecuritizeDegenNFT.d.ts +324 -0
- package/dist/types/abi/310/iSecuritizeKYCFactory.d.ts +322 -0
- package/dist/types/dev/providers.d.ts +5 -5
- package/dist/types/history/assembleOperations.d.ts +22 -0
- package/dist/types/history/classifyMulticallOperations.d.ts +35 -0
- package/dist/types/history/errors.d.ts +30 -0
- package/dist/types/history/extractProtocolCalls.d.ts +8 -0
- package/dist/types/history/extractTransfers.d.ts +22 -0
- package/dist/types/history/findFacadeCalls.d.ts +9 -0
- package/dist/types/history/index.d.ts +6 -0
- package/dist/types/history/inner-operations.d.ts +57 -0
- package/dist/types/history/internal-types.d.ts +47 -0
- package/dist/types/history/mapOperations.d.ts +27 -0
- package/dist/types/history/parseCreditAccountTransaction.d.ts +27 -0
- package/dist/types/history/populateContractsRegister.d.ts +19 -0
- package/dist/types/history/toLegacyOperation.d.ts +18 -0
- package/dist/types/history/trace-utils.d.ts +12 -0
- package/dist/types/history/types.d.ts +71 -0
- package/dist/types/plugins/adapters/abi/index.d.ts +1 -0
- package/dist/types/plugins/adapters/abi/targetContractAbi.d.ts +8262 -0
- package/dist/types/plugins/adapters/contracts/AbstractAdapter.d.ts +50 -8
- package/dist/types/plugins/adapters/contracts/AccountMigratorAdapterContract.d.ts +238 -4
- package/dist/types/plugins/adapters/contracts/BalancerV3RouterAdapterContract.d.ts +113 -4
- package/dist/types/plugins/adapters/contracts/BalancerV3WrapperAdapterContract.d.ts +37 -4
- package/dist/types/plugins/adapters/contracts/CamelotV3AdapterContract.d.ts +210 -4
- package/dist/types/plugins/adapters/contracts/ConvexV1BaseRewardPoolAdapterContract.d.ts +407 -8
- package/dist/types/plugins/adapters/contracts/ConvexV1BoosterAdapterContract.d.ts +208 -5
- package/dist/types/plugins/adapters/contracts/Curve2AssetsAdapterContract.d.ts +1244 -10
- package/dist/types/plugins/adapters/contracts/Curve3AssetsAdapterContract.d.ts +1244 -10
- package/dist/types/plugins/adapters/contracts/Curve4AssetsAdapterContract.d.ts +1244 -10
- package/dist/types/plugins/adapters/contracts/CurveV1AdapterDeposit.d.ts +575 -11
- package/dist/types/plugins/adapters/contracts/CurveV1AdapterStETHContract.d.ts +1244 -10
- package/dist/types/plugins/adapters/contracts/CurveV1StableNGAdapterContract.d.ts +1213 -11
- package/dist/types/plugins/adapters/contracts/DaiUsdsAdapterContract.d.ts +60 -6
- package/dist/types/plugins/adapters/contracts/ERC4626AdapterContract.d.ts +483 -6
- package/dist/types/plugins/adapters/contracts/ERC4626ReferralAdapterContract.d.ts +58 -6
- package/dist/types/plugins/adapters/contracts/FluidDexAdapterContract.d.ts +123 -6
- package/dist/types/plugins/adapters/contracts/InfinifiGatewayAdapterContract.d.ts +133 -8
- package/dist/types/plugins/adapters/contracts/InfinifiUnwindingGatewayAdapterContract.d.ts +155 -5
- package/dist/types/plugins/adapters/contracts/KelpLRTDepositPoolAdapterContract.d.ts +240 -6
- package/dist/types/plugins/adapters/contracts/KelpLRTWithdrawalManagerAdapterContract.d.ts +356 -6
- package/dist/types/plugins/adapters/contracts/LidoV1AdapterContract.d.ts +94 -7
- package/dist/types/plugins/adapters/contracts/MellowClaimerAdapterContract.d.ts +38 -5
- package/dist/types/plugins/adapters/contracts/MellowDVVAdapterContract.d.ts +479 -6
- package/dist/types/plugins/adapters/contracts/MellowERC4626VaultAdapterContract.d.ts +483 -7
- package/dist/types/plugins/adapters/contracts/MellowWrapperAdapterContract.d.ts +48 -5
- package/dist/types/plugins/adapters/contracts/MidasIssuanceVaultAdapterContract.d.ts +42 -7
- package/dist/types/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.d.ts +186 -7
- package/dist/types/plugins/adapters/contracts/PendleRouterAdapterContract.d.ts +1010 -5
- package/dist/types/plugins/adapters/contracts/StakingRewardsAdapterContract.d.ts +71 -8
- package/dist/types/plugins/adapters/contracts/TraderJoeRouterAdapterContract.d.ts +123 -4
- package/dist/types/plugins/adapters/contracts/UniswapV2AdapterContract.d.ts +747 -5
- package/dist/types/plugins/adapters/contracts/UniswapV3AdapterContract.d.ts +171 -4
- package/dist/types/plugins/adapters/contracts/UniswapV4AdapterContract.d.ts +96 -5
- package/dist/types/plugins/adapters/contracts/UpshiftVaultAdapterContract.d.ts +74 -7
- package/dist/types/plugins/adapters/contracts/VelodromeV2AdapterContract.d.ts +109 -4
- package/dist/types/plugins/adapters/contracts/WstETHV1AdapterContract.d.ts +267 -5
- package/dist/types/plugins/adapters/contracts/deprecated/BalancerV2VaultAdapterContract.d.ts +1664 -0
- package/dist/types/plugins/adapters/contracts/deprecated/EqualizerRouterAdapterContract.d.ts +611 -0
- package/dist/types/plugins/adapters/contracts/deprecated/InfraredVaultAdapterContract.d.ts +686 -0
- package/dist/types/plugins/adapters/contracts/deprecated/KodiakIslandGatewayAdapterContract.d.ts +1270 -0
- package/dist/types/plugins/adapters/contracts/deprecated/MellowDepositQueueAdapterContract.d.ts +19 -0
- package/dist/types/plugins/adapters/contracts/deprecated/MellowRedeemQueueAdapterContract.d.ts +18 -0
- package/dist/types/plugins/adapters/contracts/deprecated/MellowVaultAdapterContract.d.ts +531 -0
- package/dist/types/plugins/adapters/contracts/deprecated/YearnV2AdapterContract.d.ts +662 -0
- package/dist/types/plugins/adapters/contracts/deprecated/index.d.ts +8 -0
- package/dist/types/plugins/adapters/contracts/index.d.ts +1 -8
- package/dist/types/plugins/adapters/contracts/types.d.ts +0 -6
- package/dist/types/plugins/adapters/createAdapter.d.ts +7 -0
- package/dist/types/plugins/adapters/index.d.ts +3 -0
- package/dist/types/plugins/adapters/legacyAdapterOperations.d.ts +200 -0
- package/dist/types/plugins/adapters/transferHelpers.d.ts +60 -0
- package/dist/types/plugins/adapters/types.d.ts +59 -1
- package/dist/types/sdk/accounts/AbstractCreditAccountsService.d.ts +123 -27
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +1 -1
- package/dist/types/sdk/accounts/types.d.ts +108 -8
- package/dist/types/sdk/base/BaseContract.d.ts +15 -2
- package/dist/types/sdk/base/ChainContractsRegister.d.ts +11 -1
- package/dist/types/sdk/base/Construct.d.ts +6 -3
- package/dist/types/sdk/base/PlaceholderContract.d.ts +2 -2
- package/dist/types/sdk/base/TokensMeta.d.ts +30 -5
- package/dist/types/sdk/base/errors.d.ts +3 -0
- package/dist/types/sdk/base/index.d.ts +1 -0
- package/dist/types/sdk/base/token-types.d.ts +10 -2
- package/dist/types/sdk/base/types.d.ts +31 -0
- package/dist/types/sdk/chain/chains.d.ts +1 -1
- package/dist/types/sdk/market/MarketRegister.d.ts +2 -2
- package/dist/types/sdk/market/MarketSuite.d.ts +2 -0
- package/dist/types/sdk/market/ZapperRegister.d.ts +17 -0
- package/dist/types/sdk/market/adapters/PlaceholderAdapterContracts.d.ts +9 -4
- package/dist/types/sdk/market/adapters/index.d.ts +1 -1
- package/dist/types/sdk/market/credit/CreditFacadeV310BaseContract.d.ts +856 -0
- package/dist/types/sdk/market/credit/CreditFacadeV310Contract.d.ts +6 -848
- package/dist/types/sdk/market/credit/index.d.ts +1 -0
- package/dist/types/sdk/market/index.d.ts +1 -0
- package/dist/types/sdk/market/pool/PoolSuite.d.ts +2 -0
- package/dist/types/sdk/market/pool/PoolV300Contract.d.ts +2 -0
- package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +6 -2
- package/dist/types/sdk/market/pool/SecuritizeKYCFactory.d.ts +345 -0
- package/dist/types/sdk/market/pool/index.d.ts +1 -0
- package/dist/types/sdk/market/pricefeeds/PythPriceFeed.d.ts +21 -1
- package/dist/types/sdk/market/types.d.ts +10 -0
- package/dist/types/sdk/pools/PoolService.d.ts +4 -4
- package/dist/types/sdk/pools/types.d.ts +25 -16
- package/dist/types/sdk/sdk-legacy/core/creditAccount.d.ts +1 -0
- package/dist/types/sdk/sdk-legacy/payload/creditAccount.d.ts +1 -0
- package/dist/types/sdk/utils/AddressMap.d.ts +1 -1
- package/dist/types/sdk/utils/abi-decode.d.ts +14 -1
- package/dist/types/sdk/utils/viem/sendRawTx.d.ts +5 -1
- package/package.json +16 -11
- package/dist/cjs/plugins/adapters/contracts/BalancerV2VaultAdapterContract.js +0 -51
- package/dist/cjs/plugins/adapters/contracts/EqualizerRouterAdapterContract.js +0 -58
- package/dist/cjs/plugins/adapters/contracts/InfraredVaultAdapterContract.js +0 -49
- package/dist/cjs/plugins/adapters/contracts/KodiakIslandGatewayAdapterContract.js +0 -56
- package/dist/cjs/plugins/adapters/contracts/MellowDepositQueueAdapterContract.js +0 -51
- package/dist/cjs/plugins/adapters/contracts/MellowVaultAdapterContract.js +0 -46
- package/dist/esm/plugins/adapters/contracts/BalancerV2VaultAdapterContract.js +0 -27
- package/dist/esm/plugins/adapters/contracts/EqualizerRouterAdapterContract.js +0 -34
- package/dist/esm/plugins/adapters/contracts/InfraredVaultAdapterContract.js +0 -25
- package/dist/esm/plugins/adapters/contracts/KodiakIslandGatewayAdapterContract.js +0 -32
- package/dist/esm/plugins/adapters/contracts/MellowDepositQueueAdapterContract.js +0 -27
- package/dist/esm/plugins/adapters/contracts/MellowRedeemQueueAdapterContract.js +0 -24
- package/dist/esm/plugins/adapters/contracts/MellowVaultAdapterContract.js +0 -22
- package/dist/esm/plugins/adapters/contracts/YearnV2AdapterContract.js +0 -22
- package/dist/types/plugins/adapters/contracts/BalancerV2VaultAdapterContract.d.ts +0 -482
- package/dist/types/plugins/adapters/contracts/EqualizerRouterAdapterContract.d.ts +0 -225
- package/dist/types/plugins/adapters/contracts/InfraredVaultAdapterContract.d.ts +0 -198
- package/dist/types/plugins/adapters/contracts/KodiakIslandGatewayAdapterContract.d.ts +0 -396
- package/dist/types/plugins/adapters/contracts/MellowDepositQueueAdapterContract.d.ts +0 -13
- package/dist/types/plugins/adapters/contracts/MellowRedeemQueueAdapterContract.d.ts +0 -12
- package/dist/types/plugins/adapters/contracts/MellowVaultAdapterContract.d.ts +0 -203
- package/dist/types/plugins/adapters/contracts/YearnV2AdapterContract.d.ts +0 -185
- package/dist/types/sdk/pools/extraZappers.d.ts +0 -9
- /package/dist/esm/sdk/market/adapters/{factory.js → createAdapter.js} +0 -0
- /package/dist/types/sdk/market/adapters/{factory.d.ts → createAdapter.d.ts} +0 -0
|
@@ -65,7 +65,7 @@ class CreditAccountServiceV300 extends AbstractCreditAccountService {
|
|
|
65
65
|
averageQuota
|
|
66
66
|
})
|
|
67
67
|
];
|
|
68
|
-
const tx =
|
|
68
|
+
const tx = await this.multicallTx(cm, creditAccount.creditAccount, calls);
|
|
69
69
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
@@ -102,7 +102,12 @@ class CreditAccountServiceV300 extends AbstractCreditAccountService {
|
|
|
102
102
|
(t) => this.prepareWithdrawToken(ca.creditFacade, t.token, MAX_UINT256, to)
|
|
103
103
|
)
|
|
104
104
|
];
|
|
105
|
-
const tx =
|
|
105
|
+
const tx = await this.closeCreditAccountTx(
|
|
106
|
+
cm,
|
|
107
|
+
ca.creditAccount,
|
|
108
|
+
calls,
|
|
109
|
+
operation
|
|
110
|
+
);
|
|
106
111
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
107
112
|
}
|
|
108
113
|
/**
|
|
@@ -166,7 +171,7 @@ class CreditAccountServiceV300 extends AbstractCreditAccountService {
|
|
|
166
171
|
),
|
|
167
172
|
...this.prepareUpdateQuotas(ca.creditFacade, { minQuota, averageQuota })
|
|
168
173
|
];
|
|
169
|
-
const tx =
|
|
174
|
+
const tx = await this.multicallTx(cm, ca.creditAccount, calls);
|
|
170
175
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
171
176
|
}
|
|
172
177
|
async previewWithdrawLlamathenaProportionally({
|
|
@@ -258,7 +263,7 @@ class CreditAccountServiceV300 extends AbstractCreditAccountService {
|
|
|
258
263
|
averageQuota
|
|
259
264
|
})
|
|
260
265
|
];
|
|
261
|
-
const tx =
|
|
266
|
+
const tx = await this.multicallTx(cm, ca.creditAccount, calls);
|
|
262
267
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
263
268
|
}
|
|
264
269
|
/**
|
|
@@ -42,7 +42,7 @@ class CreditAccountServiceV310 extends AbstractCreditAccountService {
|
|
|
42
42
|
})
|
|
43
43
|
};
|
|
44
44
|
const calls = [...priceUpdatesCalls, addBotCall];
|
|
45
|
-
const tx = targetContract.type === "creditAccount" ?
|
|
45
|
+
const tx = targetContract.type === "creditAccount" ? await this.multicallTx(cm, targetContract.creditAccount, calls) : void 0;
|
|
46
46
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
@@ -77,7 +77,7 @@ class CreditAccountServiceV310 extends AbstractCreditAccountService {
|
|
|
77
77
|
averageQuota
|
|
78
78
|
})
|
|
79
79
|
];
|
|
80
|
-
const tx =
|
|
80
|
+
const tx = await this.multicallTx(cm, creditAccount.creditAccount, calls);
|
|
81
81
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
@@ -90,11 +90,13 @@ class CreditAccountServiceV310 extends AbstractCreditAccountService {
|
|
|
90
90
|
creditAccount: ca,
|
|
91
91
|
permits,
|
|
92
92
|
to,
|
|
93
|
-
tokensToClaim
|
|
93
|
+
tokensToClaim,
|
|
94
|
+
calls: wrapCalls = []
|
|
94
95
|
}) {
|
|
95
96
|
const cm = this.sdk.marketRegister.findCreditManager(ca.creditManager);
|
|
96
97
|
const addCollateral = collateralAssets.filter((a) => a.balance > 0);
|
|
97
98
|
const router = this.sdk.routerFor(ca);
|
|
99
|
+
const unwrapCalls = await this.getRedeemDiffCalls(1n, ca.creditManager) ?? [];
|
|
98
100
|
const claimPath = await router.findClaimAllRewards({
|
|
99
101
|
calls: [],
|
|
100
102
|
tokensToClaim,
|
|
@@ -107,15 +109,22 @@ class CreditAccountServiceV310 extends AbstractCreditAccountService {
|
|
|
107
109
|
const calls = [
|
|
108
110
|
...operation === "close" ? [] : priceUpdates,
|
|
109
111
|
...this.prepareAddCollateral(ca.creditFacade, addCollateral, permits),
|
|
112
|
+
...wrapCalls,
|
|
110
113
|
...this.prepareDisableQuotas(ca),
|
|
111
114
|
...this.prepareDecreaseDebt(ca),
|
|
115
|
+
...unwrapCalls,
|
|
112
116
|
...claimPath.calls,
|
|
113
117
|
...this.prepareDisableTokens(ca),
|
|
114
118
|
...assetsToWithdraw.map(
|
|
115
119
|
(t) => this.prepareWithdrawToken(ca.creditFacade, t.token, MAX_UINT256, to)
|
|
116
120
|
)
|
|
117
121
|
];
|
|
118
|
-
const tx =
|
|
122
|
+
const tx = await this.closeCreditAccountTx(
|
|
123
|
+
cm,
|
|
124
|
+
ca.creditAccount,
|
|
125
|
+
calls,
|
|
126
|
+
operation
|
|
127
|
+
);
|
|
119
128
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
120
129
|
}
|
|
121
130
|
/**
|
|
@@ -140,11 +149,13 @@ class CreditAccountServiceV310 extends AbstractCreditAccountService {
|
|
|
140
149
|
creditManager: ca.creditManager,
|
|
141
150
|
creditAccount: ca
|
|
142
151
|
});
|
|
152
|
+
const wrapCalls = await this.getDepositDiffCalls(1n, ca.creditManager) ?? [];
|
|
143
153
|
const addCollateral = collateralAssets.filter((a) => a.balance > 0);
|
|
144
154
|
const calls = [
|
|
145
155
|
...priceUpdates,
|
|
146
156
|
...this.prepareAddCollateral(ca.creditFacade, addCollateral, permits),
|
|
147
157
|
...claimPath.calls,
|
|
158
|
+
...wrapCalls,
|
|
148
159
|
...assetsToWithdraw.map(
|
|
149
160
|
(t) => this.prepareWithdrawToken(ca.creditFacade, t.token, MAX_UINT256, to)
|
|
150
161
|
)
|
|
@@ -186,7 +197,7 @@ class CreditAccountServiceV310 extends AbstractCreditAccountService {
|
|
|
186
197
|
...claimPath.calls,
|
|
187
198
|
...this.prepareUpdateQuotas(ca.creditFacade, { minQuota, averageQuota })
|
|
188
199
|
];
|
|
189
|
-
const tx =
|
|
200
|
+
const tx = await this.multicallTx(cm, ca.creditAccount, calls);
|
|
190
201
|
return { tx, calls, creditFacade: cm.creditFacade };
|
|
191
202
|
}
|
|
192
203
|
async previewWithdrawLlamathenaProportionally(_) {
|
|
@@ -11,6 +11,8 @@ import {
|
|
|
11
11
|
bytes32ToString,
|
|
12
12
|
createRawTx,
|
|
13
13
|
functionArgsToMap,
|
|
14
|
+
functionArgsToRecord,
|
|
15
|
+
getFunctionSignature,
|
|
14
16
|
json_stringify
|
|
15
17
|
} from "../utils/index.js";
|
|
16
18
|
import { Construct } from "./Construct.js";
|
|
@@ -39,15 +41,15 @@ class BaseContract extends Construct {
|
|
|
39
41
|
version;
|
|
40
42
|
address;
|
|
41
43
|
name;
|
|
42
|
-
constructor(
|
|
43
|
-
super(
|
|
44
|
+
constructor(options, args) {
|
|
45
|
+
super(options);
|
|
44
46
|
this.abi = args.abi;
|
|
45
47
|
this.address = getAddress(args.addr);
|
|
46
48
|
this.contract = getContract({
|
|
47
49
|
address: this.address,
|
|
48
50
|
// add exceptions for better error decoding
|
|
49
51
|
abi: [...this.abi, ...errorAbis],
|
|
50
|
-
client
|
|
52
|
+
client: this.client
|
|
51
53
|
});
|
|
52
54
|
this.version = Number(args.version || 0);
|
|
53
55
|
this.contractType = args.contractType ?? "";
|
|
@@ -195,6 +197,57 @@ class BaseContract extends Construct {
|
|
|
195
197
|
args
|
|
196
198
|
};
|
|
197
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* Parses calldata into structured result with preserved original types.
|
|
202
|
+
* When strict is true, throws {@link ContractParseError} on unknown selectors;
|
|
203
|
+
* otherwise returns a fallback with the raw calldata.
|
|
204
|
+
*/
|
|
205
|
+
parseFunctionDataV2(calldata, strict) {
|
|
206
|
+
try {
|
|
207
|
+
const decoded = decodeFunctionData({
|
|
208
|
+
abi: this.abi,
|
|
209
|
+
data: calldata
|
|
210
|
+
});
|
|
211
|
+
const functionName = getFunctionSignature(this.abi, calldata);
|
|
212
|
+
return this.wrapParseCallV2(
|
|
213
|
+
functionName,
|
|
214
|
+
this.parseFunctionParamsV2(decoded, strict)
|
|
215
|
+
);
|
|
216
|
+
} catch (e) {
|
|
217
|
+
if (strict) {
|
|
218
|
+
throw new ContractParseError(e, {
|
|
219
|
+
address: this.address,
|
|
220
|
+
callData: calldata,
|
|
221
|
+
contractName: this.name
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
this.logger?.warn(e);
|
|
225
|
+
const selector = calldata.slice(0, 10);
|
|
226
|
+
const data = `0x${calldata.slice(10)}`;
|
|
227
|
+
return this.wrapParseCallV2(`unknown function ${selector}`, {
|
|
228
|
+
_data: data
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Converts viem-decoded function arguments to a record preserving original types.
|
|
234
|
+
* Override in subclasses to handle nesting (e.g., multicall inner calls).
|
|
235
|
+
* @param strict - propagated from parseFunctionDataV2 for recursive parsing
|
|
236
|
+
*/
|
|
237
|
+
parseFunctionParamsV2(params, _strict) {
|
|
238
|
+
return functionArgsToRecord(this.abi, params.functionName, params.args);
|
|
239
|
+
}
|
|
240
|
+
wrapParseCallV2(functionName, rawArgs) {
|
|
241
|
+
return {
|
|
242
|
+
chainId: this.chainId,
|
|
243
|
+
target: this.address,
|
|
244
|
+
contractType: this.contractType,
|
|
245
|
+
label: this.register.labelAddress(this.address, true),
|
|
246
|
+
version: this.version,
|
|
247
|
+
functionName,
|
|
248
|
+
rawArgs
|
|
249
|
+
};
|
|
250
|
+
}
|
|
198
251
|
/**
|
|
199
252
|
* Creates a raw transaction for a function in this contract
|
|
200
253
|
* @param parameters
|
|
@@ -25,7 +25,7 @@ class ChainContractsRegister {
|
|
|
25
25
|
logger;
|
|
26
26
|
constructor(client, logger) {
|
|
27
27
|
this.client = client;
|
|
28
|
-
this.tokensMeta = new TokensMeta(client);
|
|
28
|
+
this.tokensMeta = new TokensMeta(client, logger);
|
|
29
29
|
this.logger = logger;
|
|
30
30
|
}
|
|
31
31
|
resetContracts() {
|
|
@@ -113,6 +113,39 @@ class ChainContractsRegister {
|
|
|
113
113
|
(call) => this.parseFunctionData(call.target, call.callData)
|
|
114
114
|
);
|
|
115
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Parses calldata for a contract at the given address, preserving original types.
|
|
118
|
+
* When strict is true, throws on unknown address or selector; otherwise returns a fallback.
|
|
119
|
+
*/
|
|
120
|
+
parseFunctionDataV2(address, calldata, strict) {
|
|
121
|
+
const contract = this.contracts.get(address);
|
|
122
|
+
if (contract) {
|
|
123
|
+
return contract.parseFunctionDataV2(calldata, strict);
|
|
124
|
+
}
|
|
125
|
+
if (strict) {
|
|
126
|
+
throw new Error(`contract ${address} not found on chain ${this.chainId}`);
|
|
127
|
+
}
|
|
128
|
+
const selector = calldata.slice(0, 10);
|
|
129
|
+
const data = `0x${calldata.slice(10)}`;
|
|
130
|
+
return {
|
|
131
|
+
chainId: this.chainId,
|
|
132
|
+
target: address,
|
|
133
|
+
contractType: "",
|
|
134
|
+
label: this.labelAddress(address, true),
|
|
135
|
+
version: 0,
|
|
136
|
+
functionName: `unknown function ${selector}`,
|
|
137
|
+
rawArgs: { _data: data }
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Parses multicalls preserving original types.
|
|
142
|
+
* When strict is true, throws on unknown targets or selectors.
|
|
143
|
+
*/
|
|
144
|
+
parseMultiCallV2(calls, strict) {
|
|
145
|
+
return calls.map(
|
|
146
|
+
(call) => this.parseFunctionDataV2(call.target, call.callData, strict)
|
|
147
|
+
);
|
|
148
|
+
}
|
|
116
149
|
}
|
|
117
150
|
export {
|
|
118
151
|
ChainContractsRegister
|
|
@@ -8,9 +8,17 @@ class Construct {
|
|
|
8
8
|
* Indicates that contract state needs to be updated
|
|
9
9
|
*/
|
|
10
10
|
#dirty = false;
|
|
11
|
-
constructor(
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
constructor(options) {
|
|
12
|
+
const { logger } = options;
|
|
13
|
+
if ("client" in options) {
|
|
14
|
+
const { client } = options;
|
|
15
|
+
this.client = client;
|
|
16
|
+
this.register = ChainContractsRegister.for(client, logger);
|
|
17
|
+
} else {
|
|
18
|
+
const { register } = options;
|
|
19
|
+
this.register = register;
|
|
20
|
+
this.client = register.client;
|
|
21
|
+
}
|
|
14
22
|
this.logger = childLogger(
|
|
15
23
|
this.constructor.name,
|
|
16
24
|
this.register.logger ?? logger
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BaseContract } from "./BaseContract.js";
|
|
2
2
|
const abi = [];
|
|
3
3
|
class PlaceholderContract extends BaseContract {
|
|
4
|
-
constructor(
|
|
5
|
-
super(
|
|
4
|
+
constructor(options, args) {
|
|
5
|
+
super(options, { ...args, abi });
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
export {
|
|
@@ -1,24 +1,43 @@
|
|
|
1
1
|
import {
|
|
2
|
-
decodeAbiParameters
|
|
2
|
+
decodeAbiParameters,
|
|
3
|
+
erc20Abi
|
|
3
4
|
} from "viem";
|
|
5
|
+
import { iSecuritizeKYCFactoryAbi } from "../../abi/310/iSecuritizeKYCFactory.js";
|
|
4
6
|
import { iStateSerializerAbi } from "../../abi/iStateSerializer.js";
|
|
5
7
|
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
6
8
|
import {
|
|
9
|
+
AddressMap,
|
|
10
|
+
AddressSet,
|
|
7
11
|
bytes32ToString,
|
|
12
|
+
formatBN
|
|
13
|
+
} from "../utils/index.js";
|
|
14
|
+
import {
|
|
8
15
|
KYC_UNDERLYING_DEFAULT,
|
|
9
16
|
KYC_UNDERLYING_ON_DEMAND
|
|
10
|
-
} from "
|
|
11
|
-
import { AddressMap, formatBN } from "../utils/index.js";
|
|
17
|
+
} from "./token-types.js";
|
|
12
18
|
class TokensMeta extends AddressMap {
|
|
13
19
|
#client;
|
|
14
|
-
#tokenDataLoaded =
|
|
15
|
-
|
|
20
|
+
#tokenDataLoaded = new AddressSet();
|
|
21
|
+
#logger;
|
|
22
|
+
constructor(client, logger) {
|
|
16
23
|
super(void 0, "tokensMeta");
|
|
17
24
|
this.#client = client;
|
|
25
|
+
this.#logger = logger?.child?.({ name: "TokensMeta" }) ?? logger;
|
|
18
26
|
}
|
|
19
27
|
reset() {
|
|
20
28
|
this.clear();
|
|
21
|
-
this.#tokenDataLoaded
|
|
29
|
+
this.#tokenDataLoaded.clear();
|
|
30
|
+
}
|
|
31
|
+
upsert(address, value) {
|
|
32
|
+
let v = value;
|
|
33
|
+
const existing = this.get(address);
|
|
34
|
+
if (existing && v) {
|
|
35
|
+
v = {
|
|
36
|
+
...existing,
|
|
37
|
+
...v
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
super.upsert(address, v);
|
|
22
41
|
}
|
|
23
42
|
symbol(token) {
|
|
24
43
|
return this.mustGet(token).symbol;
|
|
@@ -26,21 +45,48 @@ class TokensMeta extends AddressMap {
|
|
|
26
45
|
decimals(token) {
|
|
27
46
|
return this.mustGet(token).decimals;
|
|
28
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Returns true if the token is a phantom token, throws if the token data is not loaded
|
|
50
|
+
* @param t
|
|
51
|
+
* @returns
|
|
52
|
+
*/
|
|
29
53
|
isPhantomToken(t) {
|
|
30
|
-
if (!this.#tokenDataLoaded) {
|
|
31
|
-
throw new Error(
|
|
54
|
+
if (!this.#tokenDataLoaded.has(t.addr)) {
|
|
55
|
+
throw new Error(
|
|
56
|
+
`extended token data not loaded for ${t.symbol} (${t.addr})`
|
|
57
|
+
);
|
|
32
58
|
}
|
|
33
|
-
return
|
|
59
|
+
return !!t.contractType?.startsWith("PHANTOM_TOKEN::");
|
|
34
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Returns true if the token is a KYC underlying token, throws if the token data is not loaded
|
|
63
|
+
* @param t
|
|
64
|
+
* @returns
|
|
65
|
+
*/
|
|
35
66
|
isKYCUnderlying(t) {
|
|
36
|
-
if (!this.#tokenDataLoaded) {
|
|
37
|
-
throw new Error(
|
|
67
|
+
if (!this.#tokenDataLoaded.has(t.addr)) {
|
|
68
|
+
throw new Error(
|
|
69
|
+
`extended token data not loaded for ${t.symbol} (${t.addr})`
|
|
70
|
+
);
|
|
38
71
|
}
|
|
39
|
-
return
|
|
72
|
+
return !!t.contractType?.startsWith("KYC_UNDERLYING::");
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Returns true if the token is a DSToken, throws if the token data is not loaded
|
|
76
|
+
* @param t
|
|
77
|
+
* @returns
|
|
78
|
+
*/
|
|
79
|
+
isDSToken(t) {
|
|
80
|
+
if (!this.#tokenDataLoaded.has(t.addr)) {
|
|
81
|
+
throw new Error(
|
|
82
|
+
`extended token data not loaded for ${t.symbol} (${t.addr})`
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
return !!t.isDSToken;
|
|
40
86
|
}
|
|
41
87
|
/**
|
|
42
88
|
* Returns a map of all phantom tokens
|
|
43
|
-
* Throws if
|
|
89
|
+
* Throws if token data is not loaded
|
|
44
90
|
*/
|
|
45
91
|
get phantomTokens() {
|
|
46
92
|
const result = new AddressMap();
|
|
@@ -51,6 +97,10 @@ class TokensMeta extends AddressMap {
|
|
|
51
97
|
}
|
|
52
98
|
return result;
|
|
53
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Returns a map of all KYC underlying tokens
|
|
102
|
+
* Throws if token data is not loaded
|
|
103
|
+
*/
|
|
54
104
|
get kycUnderlyings() {
|
|
55
105
|
const result = new AddressMap();
|
|
56
106
|
for (const [token, meta] of this.entries()) {
|
|
@@ -60,6 +110,15 @@ class TokensMeta extends AddressMap {
|
|
|
60
110
|
}
|
|
61
111
|
return result;
|
|
62
112
|
}
|
|
113
|
+
get dsTokens() {
|
|
114
|
+
const result = new AddressMap();
|
|
115
|
+
for (const [token, meta] of this.entries()) {
|
|
116
|
+
if (this.isDSToken(meta)) {
|
|
117
|
+
result.upsert(token, meta);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return result;
|
|
121
|
+
}
|
|
63
122
|
formatBN(arg0, arg1, arg2) {
|
|
64
123
|
const token = typeof arg0 === "object" ? arg0.token : arg0;
|
|
65
124
|
const amount = typeof arg0 === "object" ? arg0.balance : arg1;
|
|
@@ -79,12 +138,18 @@ class TokensMeta extends AddressMap {
|
|
|
79
138
|
return meta;
|
|
80
139
|
}
|
|
81
140
|
/**
|
|
82
|
-
* Loads token information about phantom
|
|
141
|
+
* Loads token information about phantom tokens, KYC underlying tokens and DSTokens
|
|
142
|
+
*
|
|
143
|
+
* @param tokens - tokens to load data for, defaults to all tokens
|
|
83
144
|
*/
|
|
84
|
-
async loadTokenData() {
|
|
85
|
-
const
|
|
145
|
+
async loadTokenData(...tokens) {
|
|
146
|
+
const tokenz = new AddressSet(tokens.length > 0 ? tokens : this.keys());
|
|
147
|
+
const tokensToLoad = Array.from(tokenz.difference(this.#tokenDataLoaded));
|
|
148
|
+
if (tokensToLoad.length === 0) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
86
151
|
const resp = await this.#client.multicall({
|
|
87
|
-
contracts:
|
|
152
|
+
contracts: tokensToLoad.flatMap(
|
|
88
153
|
(t) => [
|
|
89
154
|
{
|
|
90
155
|
address: t,
|
|
@@ -101,10 +166,21 @@ class TokensMeta extends AddressMap {
|
|
|
101
166
|
allowFailure: true,
|
|
102
167
|
batchSize: 0
|
|
103
168
|
});
|
|
104
|
-
|
|
105
|
-
|
|
169
|
+
this.#logger?.debug(`loaded ${resp.length} contract types`);
|
|
170
|
+
const kycFactories = new AddressSet();
|
|
171
|
+
for (let i = 0; i < tokensToLoad.length; i++) {
|
|
172
|
+
const meta = this.#overrideTokenMeta(
|
|
173
|
+
tokensToLoad[i],
|
|
174
|
+
resp[2 * i],
|
|
175
|
+
resp[2 * i + 1]
|
|
176
|
+
);
|
|
177
|
+
this.#tokenDataLoaded.add(tokensToLoad[i]);
|
|
178
|
+
if (this.isKYCUnderlying(meta)) {
|
|
179
|
+
kycFactories.add(meta.kycFactory);
|
|
180
|
+
}
|
|
106
181
|
}
|
|
107
|
-
this.#
|
|
182
|
+
this.#logger?.debug(`found ${kycFactories.size} KYC factories`);
|
|
183
|
+
await this.#loadDSTokens(kycFactories);
|
|
108
184
|
}
|
|
109
185
|
#overrideTokenMeta(token, contractTypeResp, serializeResp) {
|
|
110
186
|
const meta = this.mustGet(token);
|
|
@@ -118,13 +194,15 @@ class TokensMeta extends AddressMap {
|
|
|
118
194
|
`token ${meta.symbol} (${token}) is ${contractType} but serialize failed: ${serializeResp.error}`
|
|
119
195
|
);
|
|
120
196
|
}
|
|
121
|
-
} else
|
|
197
|
+
} else {
|
|
122
198
|
this.upsert(token, {
|
|
123
199
|
...meta,
|
|
124
200
|
contractType
|
|
125
201
|
});
|
|
126
202
|
}
|
|
203
|
+
this.#logger?.debug(`token ${meta.symbol} is ${contractType}`);
|
|
127
204
|
}
|
|
205
|
+
return this.mustGet(token);
|
|
128
206
|
}
|
|
129
207
|
#overrideKYCUnderlying(meta, contractType, serialized) {
|
|
130
208
|
if (contractType === KYC_UNDERLYING_DEFAULT) {
|
|
@@ -161,6 +239,72 @@ class TokensMeta extends AddressMap {
|
|
|
161
239
|
});
|
|
162
240
|
}
|
|
163
241
|
}
|
|
242
|
+
async #loadDSTokens(kycFactories) {
|
|
243
|
+
const resp = await this.#client.multicall({
|
|
244
|
+
contracts: kycFactories.map((address) => ({
|
|
245
|
+
address,
|
|
246
|
+
abi: iSecuritizeKYCFactoryAbi,
|
|
247
|
+
functionName: "getDSTokens"
|
|
248
|
+
})),
|
|
249
|
+
allowFailure: false,
|
|
250
|
+
batchSize: 0
|
|
251
|
+
});
|
|
252
|
+
const dsToken = new AddressSet(resp.flat());
|
|
253
|
+
const tokensToLoad = dsToken.difference(new Set(this.keys()));
|
|
254
|
+
this.#logger?.debug(
|
|
255
|
+
`found ${dsToken.size} DSTokens in KYC factories, need to load ${tokensToLoad.size} basic metadata`
|
|
256
|
+
);
|
|
257
|
+
await this.#loadWithoutCompressor(tokensToLoad);
|
|
258
|
+
for (const token of dsToken) {
|
|
259
|
+
const meta = this.mustGet(token);
|
|
260
|
+
this.upsert(token, {
|
|
261
|
+
...meta,
|
|
262
|
+
isDSToken: true
|
|
263
|
+
});
|
|
264
|
+
this.#tokenDataLoaded.add(token);
|
|
265
|
+
this.#logger?.debug(`token ${meta.symbol} (${token}) is a DSToken`);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
async #loadWithoutCompressor(tokens_) {
|
|
269
|
+
if (tokens_.size === 0) {
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
const tokens = Array.from(tokens_);
|
|
273
|
+
const resp = await this.#client.multicall({
|
|
274
|
+
contracts: tokens.flatMap(
|
|
275
|
+
(t) => [
|
|
276
|
+
{
|
|
277
|
+
address: t,
|
|
278
|
+
abi: erc20Abi,
|
|
279
|
+
functionName: "symbol"
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
address: t,
|
|
283
|
+
abi: erc20Abi,
|
|
284
|
+
functionName: "name"
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
address: t,
|
|
288
|
+
abi: erc20Abi,
|
|
289
|
+
functionName: "decimals"
|
|
290
|
+
}
|
|
291
|
+
]
|
|
292
|
+
),
|
|
293
|
+
allowFailure: false,
|
|
294
|
+
batchSize: 0
|
|
295
|
+
});
|
|
296
|
+
this.#logger?.debug(
|
|
297
|
+
`loaded ${resp.length} basic metadata without compressor`
|
|
298
|
+
);
|
|
299
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
300
|
+
this.upsert(tokens[i], {
|
|
301
|
+
addr: tokens[i],
|
|
302
|
+
symbol: resp[3 * i],
|
|
303
|
+
name: resp[3 * i + 1],
|
|
304
|
+
decimals: resp[3 * i + 2]
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
}
|
|
164
308
|
}
|
|
165
309
|
export {
|
|
166
310
|
TokensMeta
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
class MissingSerializedParamsError extends Error {
|
|
2
|
+
constructor(propertyName) {
|
|
3
|
+
super(
|
|
4
|
+
`Cannot access '${propertyName}': serializedParams were not provided`
|
|
5
|
+
);
|
|
6
|
+
this.name = "MissingSerializedParamsError";
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
MissingSerializedParamsError
|
|
11
|
+
};
|
|
@@ -66,7 +66,8 @@ const chains = {
|
|
|
66
66
|
"0x601067eba24bb5b558a184fc082525637e96a42d": "Gami Labs"
|
|
67
67
|
},
|
|
68
68
|
testMarketConfigurators: {
|
|
69
|
-
"0x99df7330bf42d596af2e9d9836d4fc2077c574aa": "M11 Credit"
|
|
69
|
+
"0x99df7330bf42d596af2e9d9836d4fc2077c574aa": "M11 Credit",
|
|
70
|
+
"0xE0527dE5908B3fc2e054B7eEE0DeF6c9965AbF24": "Securitize"
|
|
70
71
|
},
|
|
71
72
|
isPublic: true,
|
|
72
73
|
wellKnownToken: {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { marketCompressorAbi } from "../../abi/compressors/marketCompressor.js";
|
|
2
|
-
import { SDKConstruct } from "../base/index.js";
|
|
3
2
|
import {
|
|
4
3
|
ADDRESS_0X0,
|
|
5
4
|
AP_MARKET_COMPRESSOR,
|
|
@@ -9,7 +8,8 @@ import { AddressMap } from "../utils/index.js";
|
|
|
9
8
|
import { simulateWithPriceUpdates } from "../utils/viem/index.js";
|
|
10
9
|
import { MarketConfiguratorContract } from "./MarketConfiguratorContract.js";
|
|
11
10
|
import { MarketSuite } from "./MarketSuite.js";
|
|
12
|
-
|
|
11
|
+
import { ZapperRegister } from "./ZapperRegister.js";
|
|
12
|
+
class MarketRegister extends ZapperRegister {
|
|
13
13
|
/**
|
|
14
14
|
* Mapping pool.address -> MarketSuite
|
|
15
15
|
*/
|
|
@@ -44,6 +44,9 @@ class MarketSuite extends SDKConstruct {
|
|
|
44
44
|
get underlying() {
|
|
45
45
|
return this.pool.underlying;
|
|
46
46
|
}
|
|
47
|
+
async getKYCFactory() {
|
|
48
|
+
return this.pool.getKYCFactory();
|
|
49
|
+
}
|
|
47
50
|
get dirty() {
|
|
48
51
|
return this.configurator.dirty || this.pool.dirty || this.priceOracle.dirty || this.creditManagers.some((cm) => cm.dirty);
|
|
49
52
|
}
|