@gearbox-protocol/sdk 12.8.1 → 12.9.0-txparser.2
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/providers.js +0 -12
- package/dist/cjs/history/assembleOperations.js +110 -0
- package/dist/cjs/history/classifyMulticallOperations.js +157 -0
- package/dist/cjs/history/enrichTokens.js +80 -0
- package/dist/cjs/history/errors.js +91 -0
- package/dist/cjs/history/extractProtocolCalls.js +53 -0
- package/dist/cjs/history/extractTransfers.js +166 -0
- package/dist/cjs/history/findFacadeCalls.js +84 -0
- package/dist/cjs/history/index.js +38 -0
- package/dist/cjs/history/inner-operations.js +16 -0
- package/dist/cjs/history/internal-types.js +16 -0
- package/dist/cjs/history/package.json +1 -0
- package/dist/cjs/history/parseCreditAccountTransaction.js +83 -0
- package/dist/cjs/history/populateContractsRegister.js +68 -0
- package/dist/cjs/history/toLegacyOperation.js +120 -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/base/BaseContract.js +51 -0
- package/dist/cjs/sdk/base/ChainContractsRegister.js +33 -0
- package/dist/cjs/sdk/base/PlaceholderContract.js +2 -2
- package/dist/cjs/sdk/base/TokensMeta.js +1 -2
- package/dist/cjs/sdk/base/errors.js +35 -0
- package/dist/cjs/sdk/base/index.js +2 -0
- 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/utils/abi-decode.js +43 -2
- package/dist/esm/dev/providers.js +0 -12
- package/dist/esm/history/assembleOperations.js +86 -0
- package/dist/esm/history/classifyMulticallOperations.js +137 -0
- package/dist/esm/history/enrichTokens.js +56 -0
- package/dist/esm/history/errors.js +62 -0
- package/dist/esm/history/extractProtocolCalls.js +32 -0
- package/dist/esm/history/extractTransfers.js +146 -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/package.json +1 -0
- package/dist/esm/history/parseCreditAccountTransaction.js +59 -0
- package/dist/esm/history/populateContractsRegister.js +52 -0
- package/dist/esm/history/toLegacyOperation.js +96 -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/base/BaseContract.js +53 -0
- package/dist/esm/sdk/base/ChainContractsRegister.js +33 -0
- package/dist/esm/sdk/base/PlaceholderContract.js +2 -2
- package/dist/esm/sdk/base/TokensMeta.js +6 -2
- package/dist/esm/sdk/base/errors.js +11 -0
- package/dist/esm/sdk/base/index.js +1 -0
- 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/utils/abi-decode.js +43 -2
- package/dist/types/dev/providers.d.ts +5 -5
- package/dist/types/history/assembleOperations.d.ts +24 -0
- package/dist/types/history/classifyMulticallOperations.d.ts +35 -0
- package/dist/types/history/enrichTokens.d.ts +5 -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/parseCreditAccountTransaction.d.ts +29 -0
- package/dist/types/history/populateContractsRegister.d.ts +19 -0
- package/dist/types/history/toLegacyOperation.d.ts +35 -0
- package/dist/types/history/trace-utils.d.ts +12 -0
- package/dist/types/history/types.d.ts +65 -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 +64 -1
- package/dist/types/sdk/base/BaseContract.d.ts +14 -1
- package/dist/types/sdk/base/ChainContractsRegister.d.ts +11 -1
- package/dist/types/sdk/base/PlaceholderContract.d.ts +2 -2
- package/dist/types/sdk/base/TokensMeta.d.ts +1 -1
- 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/types.d.ts +31 -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/utils/abi-decode.d.ts +14 -1
- package/package.json +7 -2
- 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/esm/sdk/market/adapters/{factory.js → createAdapter.js} +0 -0
- /package/dist/types/sdk/market/adapters/{factory.d.ts → createAdapter.d.ts} +0 -0
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import { decodeAbiParameters } from "viem";
|
|
2
|
+
import {
|
|
3
|
+
MissingSerializedParamsError
|
|
4
|
+
} from "../../../../sdk/index.js";
|
|
5
|
+
import { AbstractAdapterContract } from "../AbstractAdapter.js";
|
|
6
|
+
const iYearnV2AdapterAbi = [
|
|
7
|
+
{
|
|
8
|
+
type: "function",
|
|
9
|
+
name: "contractType",
|
|
10
|
+
inputs: [],
|
|
11
|
+
outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
|
|
12
|
+
stateMutability: "view"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
type: "function",
|
|
16
|
+
name: "creditManager",
|
|
17
|
+
inputs: [],
|
|
18
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
19
|
+
stateMutability: "view"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
type: "function",
|
|
23
|
+
name: "deposit",
|
|
24
|
+
inputs: [
|
|
25
|
+
{ name: "amount", type: "uint256", internalType: "uint256" },
|
|
26
|
+
{ name: "", type: "address", internalType: "address" }
|
|
27
|
+
],
|
|
28
|
+
outputs: [{ name: "useSafePrices", type: "bool", internalType: "bool" }],
|
|
29
|
+
stateMutability: "nonpayable"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
type: "function",
|
|
33
|
+
name: "deposit",
|
|
34
|
+
inputs: [{ name: "amount", type: "uint256", internalType: "uint256" }],
|
|
35
|
+
outputs: [{ name: "useSafePrices", type: "bool", internalType: "bool" }],
|
|
36
|
+
stateMutability: "nonpayable"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
type: "function",
|
|
40
|
+
name: "depositDiff",
|
|
41
|
+
inputs: [
|
|
42
|
+
{ name: "leftoverAmount", type: "uint256", internalType: "uint256" }
|
|
43
|
+
],
|
|
44
|
+
outputs: [{ name: "useSafePrices", type: "bool", internalType: "bool" }],
|
|
45
|
+
stateMutability: "nonpayable"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: "function",
|
|
49
|
+
name: "serialize",
|
|
50
|
+
inputs: [],
|
|
51
|
+
outputs: [{ name: "serializedData", type: "bytes", internalType: "bytes" }],
|
|
52
|
+
stateMutability: "view"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
type: "function",
|
|
56
|
+
name: "targetContract",
|
|
57
|
+
inputs: [],
|
|
58
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
59
|
+
stateMutability: "view"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
type: "function",
|
|
63
|
+
name: "token",
|
|
64
|
+
inputs: [],
|
|
65
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
66
|
+
stateMutability: "view"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
type: "function",
|
|
70
|
+
name: "version",
|
|
71
|
+
inputs: [],
|
|
72
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
73
|
+
stateMutability: "view"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
type: "function",
|
|
77
|
+
name: "withdraw",
|
|
78
|
+
inputs: [
|
|
79
|
+
{ name: "maxShares", type: "uint256", internalType: "uint256" },
|
|
80
|
+
{ name: "", type: "address", internalType: "address" }
|
|
81
|
+
],
|
|
82
|
+
outputs: [{ name: "useSafePrices", type: "bool", internalType: "bool" }],
|
|
83
|
+
stateMutability: "nonpayable"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
type: "function",
|
|
87
|
+
name: "withdraw",
|
|
88
|
+
inputs: [{ name: "maxShares", type: "uint256", internalType: "uint256" }],
|
|
89
|
+
outputs: [{ name: "useSafePrices", type: "bool", internalType: "bool" }],
|
|
90
|
+
stateMutability: "nonpayable"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
type: "function",
|
|
94
|
+
name: "withdraw",
|
|
95
|
+
inputs: [
|
|
96
|
+
{ name: "maxShares", type: "uint256", internalType: "uint256" },
|
|
97
|
+
{ name: "", type: "address", internalType: "address" },
|
|
98
|
+
{ name: "maxLoss", type: "uint256", internalType: "uint256" }
|
|
99
|
+
],
|
|
100
|
+
outputs: [{ name: "useSafePrices", type: "bool", internalType: "bool" }],
|
|
101
|
+
stateMutability: "nonpayable"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
type: "function",
|
|
105
|
+
name: "withdrawDiff",
|
|
106
|
+
inputs: [
|
|
107
|
+
{ name: "leftoverAmount", type: "uint256", internalType: "uint256" }
|
|
108
|
+
],
|
|
109
|
+
outputs: [{ name: "useSafePrices", type: "bool", internalType: "bool" }],
|
|
110
|
+
stateMutability: "nonpayable"
|
|
111
|
+
}
|
|
112
|
+
];
|
|
113
|
+
const iYVaultAbi = [
|
|
114
|
+
{
|
|
115
|
+
type: "function",
|
|
116
|
+
name: "allowance",
|
|
117
|
+
inputs: [
|
|
118
|
+
{ name: "owner", type: "address", internalType: "address" },
|
|
119
|
+
{ name: "spender", type: "address", internalType: "address" }
|
|
120
|
+
],
|
|
121
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
122
|
+
stateMutability: "view"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
type: "function",
|
|
126
|
+
name: "approve",
|
|
127
|
+
inputs: [
|
|
128
|
+
{ name: "spender", type: "address", internalType: "address" },
|
|
129
|
+
{ name: "amount", type: "uint256", internalType: "uint256" }
|
|
130
|
+
],
|
|
131
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
132
|
+
stateMutability: "nonpayable"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
type: "function",
|
|
136
|
+
name: "balanceOf",
|
|
137
|
+
inputs: [{ name: "account", type: "address", internalType: "address" }],
|
|
138
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
139
|
+
stateMutability: "view"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
type: "function",
|
|
143
|
+
name: "decimals",
|
|
144
|
+
inputs: [],
|
|
145
|
+
outputs: [{ name: "", type: "uint8", internalType: "uint8" }],
|
|
146
|
+
stateMutability: "view"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
type: "function",
|
|
150
|
+
name: "deposit",
|
|
151
|
+
inputs: [
|
|
152
|
+
{ name: "_amount", type: "uint256", internalType: "uint256" },
|
|
153
|
+
{ name: "recipient", type: "address", internalType: "address" }
|
|
154
|
+
],
|
|
155
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
156
|
+
stateMutability: "nonpayable"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
type: "function",
|
|
160
|
+
name: "deposit",
|
|
161
|
+
inputs: [{ name: "_amount", type: "uint256", internalType: "uint256" }],
|
|
162
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
163
|
+
stateMutability: "nonpayable"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
type: "function",
|
|
167
|
+
name: "deposit",
|
|
168
|
+
inputs: [],
|
|
169
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
170
|
+
stateMutability: "nonpayable"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
type: "function",
|
|
174
|
+
name: "name",
|
|
175
|
+
inputs: [],
|
|
176
|
+
outputs: [{ name: "", type: "string", internalType: "string" }],
|
|
177
|
+
stateMutability: "view"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
type: "function",
|
|
181
|
+
name: "pricePerShare",
|
|
182
|
+
inputs: [],
|
|
183
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
184
|
+
stateMutability: "view"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
type: "function",
|
|
188
|
+
name: "symbol",
|
|
189
|
+
inputs: [],
|
|
190
|
+
outputs: [{ name: "", type: "string", internalType: "string" }],
|
|
191
|
+
stateMutability: "view"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
type: "function",
|
|
195
|
+
name: "token",
|
|
196
|
+
inputs: [],
|
|
197
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
198
|
+
stateMutability: "view"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
type: "function",
|
|
202
|
+
name: "totalSupply",
|
|
203
|
+
inputs: [],
|
|
204
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
205
|
+
stateMutability: "view"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
type: "function",
|
|
209
|
+
name: "transfer",
|
|
210
|
+
inputs: [
|
|
211
|
+
{ name: "to", type: "address", internalType: "address" },
|
|
212
|
+
{ name: "amount", type: "uint256", internalType: "uint256" }
|
|
213
|
+
],
|
|
214
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
215
|
+
stateMutability: "nonpayable"
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
type: "function",
|
|
219
|
+
name: "transferFrom",
|
|
220
|
+
inputs: [
|
|
221
|
+
{ name: "from", type: "address", internalType: "address" },
|
|
222
|
+
{ name: "to", type: "address", internalType: "address" },
|
|
223
|
+
{ name: "amount", type: "uint256", internalType: "uint256" }
|
|
224
|
+
],
|
|
225
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
226
|
+
stateMutability: "nonpayable"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
type: "function",
|
|
230
|
+
name: "withdraw",
|
|
231
|
+
inputs: [
|
|
232
|
+
{ name: "maxShares", type: "uint256", internalType: "uint256" },
|
|
233
|
+
{ name: "recipient", type: "address", internalType: "address" }
|
|
234
|
+
],
|
|
235
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
236
|
+
stateMutability: "nonpayable"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
type: "function",
|
|
240
|
+
name: "withdraw",
|
|
241
|
+
inputs: [{ name: "maxShares", type: "uint256", internalType: "uint256" }],
|
|
242
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
243
|
+
stateMutability: "nonpayable"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
type: "function",
|
|
247
|
+
name: "withdraw",
|
|
248
|
+
inputs: [],
|
|
249
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
250
|
+
stateMutability: "nonpayable"
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
type: "function",
|
|
254
|
+
name: "withdraw",
|
|
255
|
+
inputs: [
|
|
256
|
+
{ name: "maxShares", type: "uint256", internalType: "uint256" },
|
|
257
|
+
{ name: "recipient", type: "address", internalType: "address" },
|
|
258
|
+
{ name: "maxLoss", type: "uint256", internalType: "uint256" }
|
|
259
|
+
],
|
|
260
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
261
|
+
stateMutability: "nonpayable"
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
type: "event",
|
|
265
|
+
name: "Approval",
|
|
266
|
+
inputs: [
|
|
267
|
+
{
|
|
268
|
+
name: "owner",
|
|
269
|
+
type: "address",
|
|
270
|
+
indexed: true,
|
|
271
|
+
internalType: "address"
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
name: "spender",
|
|
275
|
+
type: "address",
|
|
276
|
+
indexed: true,
|
|
277
|
+
internalType: "address"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
name: "value",
|
|
281
|
+
type: "uint256",
|
|
282
|
+
indexed: false,
|
|
283
|
+
internalType: "uint256"
|
|
284
|
+
}
|
|
285
|
+
],
|
|
286
|
+
anonymous: false
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
type: "event",
|
|
290
|
+
name: "Transfer",
|
|
291
|
+
inputs: [
|
|
292
|
+
{ name: "from", type: "address", indexed: true, internalType: "address" },
|
|
293
|
+
{ name: "to", type: "address", indexed: true, internalType: "address" },
|
|
294
|
+
{
|
|
295
|
+
name: "value",
|
|
296
|
+
type: "uint256",
|
|
297
|
+
indexed: false,
|
|
298
|
+
internalType: "uint256"
|
|
299
|
+
}
|
|
300
|
+
],
|
|
301
|
+
anonymous: false
|
|
302
|
+
}
|
|
303
|
+
];
|
|
304
|
+
const abi = iYearnV2AdapterAbi;
|
|
305
|
+
const protocolAbi = iYVaultAbi;
|
|
306
|
+
class YearnV2RouterAdapterContract extends AbstractAdapterContract {
|
|
307
|
+
#token;
|
|
308
|
+
constructor(options, args) {
|
|
309
|
+
super(options, { ...args, abi, protocolAbi });
|
|
310
|
+
if (args.baseParams.serializedParams) {
|
|
311
|
+
const decoded = decodeAbiParameters(
|
|
312
|
+
[
|
|
313
|
+
{ type: "address", name: "creditManager" },
|
|
314
|
+
{ type: "address", name: "targetContract" },
|
|
315
|
+
{ type: "address", name: "token" }
|
|
316
|
+
],
|
|
317
|
+
args.baseParams.serializedParams
|
|
318
|
+
);
|
|
319
|
+
this.#token = decoded[2];
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
get token() {
|
|
323
|
+
if (!this.#token) throw new MissingSerializedParamsError("token");
|
|
324
|
+
return this.#token;
|
|
325
|
+
}
|
|
326
|
+
/** Legacy adapter not present in integrations-v3. Go: YearnDeposit/YearnWithDrawn via operation_type.go L105-L124 */
|
|
327
|
+
classifyLegacyOperation(_parsed, _transfers) {
|
|
328
|
+
throw new Error(
|
|
329
|
+
`classifyLegacyOperation is not supported for legacy adapter: ${this.contractType}`
|
|
330
|
+
);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
export {
|
|
334
|
+
YearnV2RouterAdapterContract,
|
|
335
|
+
iYearnV2AdapterAbi
|
|
336
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./BalancerV2VaultAdapterContract.js";
|
|
2
|
+
export * from "./EqualizerRouterAdapterContract.js";
|
|
3
|
+
export * from "./InfraredVaultAdapterContract.js";
|
|
4
|
+
export * from "./KodiakIslandGatewayAdapterContract.js";
|
|
5
|
+
export * from "./MellowDepositQueueAdapterContract.js";
|
|
6
|
+
export * from "./MellowRedeemQueueAdapterContract.js";
|
|
7
|
+
export * from "./MellowVaultAdapterContract.js";
|
|
8
|
+
export * from "./YearnV2AdapterContract.js";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export * from "./AbstractAdapter.js";
|
|
2
|
-
export * from "./BalancerV2VaultAdapterContract.js";
|
|
3
2
|
export * from "./BalancerV3RouterAdapterContract.js";
|
|
4
3
|
export * from "./BalancerV3WrapperAdapterContract.js";
|
|
5
4
|
export * from "./CamelotV3AdapterContract.js";
|
|
@@ -12,23 +11,18 @@ export * from "./CurveV1AdapterDeposit.js";
|
|
|
12
11
|
export * from "./CurveV1AdapterStETHContract.js";
|
|
13
12
|
export * from "./CurveV1StableNGAdapterContract.js";
|
|
14
13
|
export * from "./DaiUsdsAdapterContract.js";
|
|
15
|
-
export * from "./
|
|
14
|
+
export * from "./deprecated/index.js";
|
|
16
15
|
export * from "./ERC4626AdapterContract.js";
|
|
17
16
|
export * from "./ERC4626ReferralAdapterContract.js";
|
|
18
17
|
export * from "./FluidDexAdapterContract.js";
|
|
19
18
|
export * from "./InfinifiGatewayAdapterContract.js";
|
|
20
19
|
export * from "./InfinifiUnwindingGatewayAdapterContract.js";
|
|
21
|
-
export * from "./InfraredVaultAdapterContract.js";
|
|
22
20
|
export * from "./KelpLRTDepositPoolAdapterContract.js";
|
|
23
21
|
export * from "./KelpLRTWithdrawalManagerAdapterContract.js";
|
|
24
|
-
export * from "./KodiakIslandGatewayAdapterContract.js";
|
|
25
22
|
export * from "./LidoV1AdapterContract.js";
|
|
26
23
|
export * from "./MellowClaimerAdapterContract.js";
|
|
27
|
-
export * from "./MellowDepositQueueAdapterContract.js";
|
|
28
24
|
export * from "./MellowDVVAdapterContract.js";
|
|
29
25
|
export * from "./MellowERC4626VaultAdapterContract.js";
|
|
30
|
-
export * from "./MellowRedeemQueueAdapterContract.js";
|
|
31
|
-
export * from "./MellowVaultAdapterContract.js";
|
|
32
26
|
export * from "./MellowWrapperAdapterContract.js";
|
|
33
27
|
export * from "./MidasIssuanceVaultAdapterContract.js";
|
|
34
28
|
export * from "./MidasRedemptionVaultAdapterContract.js";
|
|
@@ -42,4 +36,3 @@ export * from "./UniswapV4AdapterContract.js";
|
|
|
42
36
|
export * from "./UpshiftVaultAdapterContract.js";
|
|
43
37
|
export * from "./VelodromeV2AdapterContract.js";
|
|
44
38
|
export * from "./WstETHV1AdapterContract.js";
|
|
45
|
-
export * from "./YearnV2AdapterContract.js";
|
|
@@ -5,13 +5,6 @@ var BalancerV2PoolStatus = /* @__PURE__ */ ((BalancerV2PoolStatus2) => {
|
|
|
5
5
|
BalancerV2PoolStatus2[BalancerV2PoolStatus2["WITHDRAWAL_ONLY"] = 3] = "WITHDRAWAL_ONLY";
|
|
6
6
|
return BalancerV2PoolStatus2;
|
|
7
7
|
})(BalancerV2PoolStatus || {});
|
|
8
|
-
var KodiakIslandStatus = /* @__PURE__ */ ((KodiakIslandStatus2) => {
|
|
9
|
-
KodiakIslandStatus2[KodiakIslandStatus2["NOT_ALLOWED"] = 0] = "NOT_ALLOWED";
|
|
10
|
-
KodiakIslandStatus2[KodiakIslandStatus2["ALLOWED"] = 1] = "ALLOWED";
|
|
11
|
-
KodiakIslandStatus2[KodiakIslandStatus2["SWAP_AND_EXIT_ONLY"] = 2] = "SWAP_AND_EXIT_ONLY";
|
|
12
|
-
KodiakIslandStatus2[KodiakIslandStatus2["EXIT_ONLY"] = 3] = "EXIT_ONLY";
|
|
13
|
-
return KodiakIslandStatus2;
|
|
14
|
-
})(KodiakIslandStatus || {});
|
|
15
8
|
var PendleTokenType = /* @__PURE__ */ ((PendleTokenType2) => {
|
|
16
9
|
PendleTokenType2[PendleTokenType2["PT"] = 0] = "PT";
|
|
17
10
|
PendleTokenType2[PendleTokenType2["LP"] = 1] = "LP";
|
|
@@ -41,7 +34,6 @@ var BalancerV3PoolStatus = /* @__PURE__ */ ((BalancerV3PoolStatus2) => {
|
|
|
41
34
|
export {
|
|
42
35
|
BalancerV2PoolStatus,
|
|
43
36
|
BalancerV3PoolStatus,
|
|
44
|
-
KodiakIslandStatus,
|
|
45
37
|
PendlePairStatus,
|
|
46
38
|
PendleTokenType,
|
|
47
39
|
TraderJoePoolVersion
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { isHex } from "viem";
|
|
2
|
+
import { bytes32ToString } from "../../sdk/index.js";
|
|
3
|
+
import { AccountMigratorAdapterContract } from "./contracts/AccountMigratorAdapterContract.js";
|
|
4
|
+
import { InfinifiGatewayAdapterContract } from "./contracts/InfinifiGatewayAdapterContract.js";
|
|
5
|
+
import { InfinifiUnwindingGatewayAdapterContract } from "./contracts/InfinifiUnwindingGatewayAdapterContract.js";
|
|
6
|
+
import {
|
|
7
|
+
AbstractAdapterContract,
|
|
8
|
+
BalancerV2VaultAdapterContract,
|
|
9
|
+
BalancerV3RouterAdapterContract,
|
|
10
|
+
BalancerV3WrapperAdapterContract,
|
|
11
|
+
CamelotV3AdapterContract,
|
|
12
|
+
ConvexV1BaseRewardPoolAdapterContract,
|
|
13
|
+
ConvexV1BoosterAdapterContract,
|
|
14
|
+
Curve2AssetsAdapterContract,
|
|
15
|
+
Curve3AssetsAdapterContract,
|
|
16
|
+
Curve4AssetsAdapterContract,
|
|
17
|
+
CurveV1AdapterDeposit,
|
|
18
|
+
CurveV1AdapterStETHContract,
|
|
19
|
+
CurveV1StableNGAdapterContract,
|
|
20
|
+
DaiUsdsAdapterContract,
|
|
21
|
+
EqualizerRouterAdapterContract,
|
|
22
|
+
ERC4626AdapterContract,
|
|
23
|
+
ERC4626ReferralAdapterContract,
|
|
24
|
+
FluidDexAdapterContract,
|
|
25
|
+
InfraredVaultAdapterContract,
|
|
26
|
+
KelpLRTDepositPoolAdapterContract,
|
|
27
|
+
KelpLRTWithdrawalManagerAdapterContract,
|
|
28
|
+
KodiakIslandGatewayAdapterContract,
|
|
29
|
+
LidoV1AdapterContract,
|
|
30
|
+
MellowClaimerAdapterContract,
|
|
31
|
+
MellowDepositQueueAdapterContract,
|
|
32
|
+
MellowDVVAdapterContract,
|
|
33
|
+
MellowERC4626VaultAdapterContract,
|
|
34
|
+
MellowRedeemQueueAdapterContract,
|
|
35
|
+
MellowVaultAdapterContract,
|
|
36
|
+
MellowWrapperAdapterContract,
|
|
37
|
+
MidasIssuanceVaultAdapterContract,
|
|
38
|
+
MidasRedemptionVaultAdapterContract,
|
|
39
|
+
PendleRouterAdapterContract,
|
|
40
|
+
StakingRewardsAdapterContract,
|
|
41
|
+
TraderJoeRouterAdapterContract,
|
|
42
|
+
UniswapV2AdapterContract,
|
|
43
|
+
UniswapV3AdapterContract,
|
|
44
|
+
UpshiftVaultAdapterContract,
|
|
45
|
+
VelodromeV2RouterAdapterContract,
|
|
46
|
+
WstETHV1AdapterContract,
|
|
47
|
+
YearnV2RouterAdapterContract
|
|
48
|
+
} from "./contracts/index.js";
|
|
49
|
+
import { UniswapV4AdapterContract } from "./contracts/UniswapV4AdapterContract.js";
|
|
50
|
+
function createAdapter(options, data, strict) {
|
|
51
|
+
const contractType = data.baseParams.contractType;
|
|
52
|
+
const adapterType = isHex(contractType) ? bytes32ToString(contractType) : contractType;
|
|
53
|
+
switch (adapterType) {
|
|
54
|
+
case "ADAPTER::ACCOUNT_MIGRATOR":
|
|
55
|
+
return new AccountMigratorAdapterContract(options, data);
|
|
56
|
+
case "ADAPTER::BALANCER_V3_ROUTER":
|
|
57
|
+
return new BalancerV3RouterAdapterContract(options, data);
|
|
58
|
+
case "ADAPTER::BALANCER_V3_WRAPPER":
|
|
59
|
+
return new BalancerV3WrapperAdapterContract(options, data);
|
|
60
|
+
case "ADAPTER::BALANCER_VAULT":
|
|
61
|
+
return new BalancerV2VaultAdapterContract(options, data);
|
|
62
|
+
case "ADAPTER::CAMELOT_V3_ROUTER":
|
|
63
|
+
return new CamelotV3AdapterContract(options, data);
|
|
64
|
+
case "ADAPTER::CURVE_STABLE_NG":
|
|
65
|
+
return new CurveV1StableNGAdapterContract(options, data);
|
|
66
|
+
case "ADAPTER::CURVE_V1_2ASSETS":
|
|
67
|
+
return new Curve2AssetsAdapterContract(options, data);
|
|
68
|
+
case "ADAPTER::CURVE_V1_3ASSETS":
|
|
69
|
+
return new Curve3AssetsAdapterContract(options, data);
|
|
70
|
+
case "ADAPTER::CURVE_V1_4ASSETS":
|
|
71
|
+
return new Curve4AssetsAdapterContract(options, data);
|
|
72
|
+
case "ADAPTER::CURVE_V1_STECRV_POOL":
|
|
73
|
+
return new CurveV1AdapterStETHContract(options, data);
|
|
74
|
+
case "ADAPTER::CURVE_V1_WRAPPER":
|
|
75
|
+
return new CurveV1AdapterDeposit(options, data);
|
|
76
|
+
case "ADAPTER::CVX_V1_BASE_REWARD_POOL":
|
|
77
|
+
return new ConvexV1BaseRewardPoolAdapterContract(options, data);
|
|
78
|
+
case "ADAPTER::CVX_V1_BOOSTER":
|
|
79
|
+
return new ConvexV1BoosterAdapterContract(options, data);
|
|
80
|
+
case "ADAPTER::DAI_USDS_EXCHANGE":
|
|
81
|
+
return new DaiUsdsAdapterContract(options, data);
|
|
82
|
+
case "ADAPTER::EQUALIZER_ROUTER":
|
|
83
|
+
return new EqualizerRouterAdapterContract(options, data);
|
|
84
|
+
case "ADAPTER::ERC4626_VAULT":
|
|
85
|
+
return new ERC4626AdapterContract(options, data);
|
|
86
|
+
case "ADAPTER::ERC4626_VAULT_REFERRAL":
|
|
87
|
+
return new ERC4626ReferralAdapterContract(options, data);
|
|
88
|
+
case "ADAPTER::FLUID_DEX":
|
|
89
|
+
return new FluidDexAdapterContract(options, data);
|
|
90
|
+
case "ADAPTER::INFINIFI_GATEWAY":
|
|
91
|
+
return new InfinifiGatewayAdapterContract(options, data);
|
|
92
|
+
case "ADAPTER::INFINIFI_UNWINDING":
|
|
93
|
+
return new InfinifiUnwindingGatewayAdapterContract(options, data);
|
|
94
|
+
case "ADAPTER::INFRARED_VAULT":
|
|
95
|
+
return new InfraredVaultAdapterContract(options, data);
|
|
96
|
+
case "ADAPTER::KELP_DEPOSIT_POOL":
|
|
97
|
+
return new KelpLRTDepositPoolAdapterContract(options, data);
|
|
98
|
+
case "ADAPTER::KELP_WITHDRAWAL":
|
|
99
|
+
return new KelpLRTWithdrawalManagerAdapterContract(options, data);
|
|
100
|
+
case "ADAPTER::KODIAK_ISLAND_GATEWAY":
|
|
101
|
+
return new KodiakIslandGatewayAdapterContract(options, data);
|
|
102
|
+
case "ADAPTER::LIDO_V1":
|
|
103
|
+
return new LidoV1AdapterContract(options, data);
|
|
104
|
+
case "ADAPTER::LIDO_WSTETH_V1":
|
|
105
|
+
return new WstETHV1AdapterContract(options, data);
|
|
106
|
+
case "ADAPTER::MELLOW_CLAIMER":
|
|
107
|
+
return new MellowClaimerAdapterContract(options, data);
|
|
108
|
+
case "ADAPTER::MELLOW_DVV":
|
|
109
|
+
return new MellowDVVAdapterContract(options, data);
|
|
110
|
+
case "ADAPTER::MELLOW_ERC4626_VAULT":
|
|
111
|
+
return new MellowERC4626VaultAdapterContract(options, data);
|
|
112
|
+
case "ADAPTER::MELLOW_LRT_VAULT":
|
|
113
|
+
return new MellowVaultAdapterContract(options, data);
|
|
114
|
+
case "ADAPTER::MELLOW_WRAPPER":
|
|
115
|
+
return new MellowWrapperAdapterContract(options, data);
|
|
116
|
+
case "ADAPTER::MELLOW_DEPOSIT_QUEUE_QUEUE":
|
|
117
|
+
return new MellowDepositQueueAdapterContract(options, data);
|
|
118
|
+
case "ADAPTER::MELLOW_REDEEM_QUEUE_QUEUE":
|
|
119
|
+
return new MellowRedeemQueueAdapterContract(options, data);
|
|
120
|
+
case "ADAPTER::MIDAS_ISSUANCE_VAULT":
|
|
121
|
+
return new MidasIssuanceVaultAdapterContract(options, data);
|
|
122
|
+
case "ADAPTER::MIDAS_REDEMPTION_VAULT":
|
|
123
|
+
return new MidasRedemptionVaultAdapterContract(options, data);
|
|
124
|
+
case "ADAPTER::PENDLE_ROUTER":
|
|
125
|
+
return new PendleRouterAdapterContract(options, data);
|
|
126
|
+
case "ADAPTER::STAKING_REWARDS":
|
|
127
|
+
return new StakingRewardsAdapterContract(options, data);
|
|
128
|
+
case "ADAPTER::TRADERJOE_ROUTER":
|
|
129
|
+
return new TraderJoeRouterAdapterContract(options, data);
|
|
130
|
+
case "ADAPTER::UNISWAP_V2_ROUTER":
|
|
131
|
+
return new UniswapV2AdapterContract(options, data);
|
|
132
|
+
case "ADAPTER::UNISWAP_V3_ROUTER":
|
|
133
|
+
return new UniswapV3AdapterContract(options, data);
|
|
134
|
+
case "ADAPTER::UNISWAP_V4_GATEWAY":
|
|
135
|
+
return new UniswapV4AdapterContract(options, data);
|
|
136
|
+
case "ADAPTER::UPSHIFT_VAULT":
|
|
137
|
+
return new UpshiftVaultAdapterContract(options, data);
|
|
138
|
+
case "ADAPTER::VELODROME_V2_ROUTER":
|
|
139
|
+
return new VelodromeV2RouterAdapterContract(options, data);
|
|
140
|
+
case "ADAPTER::YEARN_V2":
|
|
141
|
+
return new YearnV2RouterAdapterContract(options, data);
|
|
142
|
+
default: {
|
|
143
|
+
if (strict) {
|
|
144
|
+
throw new Error(
|
|
145
|
+
`Adapter type ${adapterType} not supported for adapter at ${data.baseParams.addr}`
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
return new AbstractAdapterContract(options, {
|
|
149
|
+
...data,
|
|
150
|
+
abi: [],
|
|
151
|
+
protocolAbi: []
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
export {
|
|
157
|
+
createAdapter
|
|
158
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { isAddressEqual, zeroAddress } from "viem";
|
|
2
|
+
function toNetTransfers(transfers, creditAccount) {
|
|
3
|
+
const result = {};
|
|
4
|
+
for (const { token, amount, from, to } of transfers) {
|
|
5
|
+
if (isAddressEqual(from, creditAccount)) {
|
|
6
|
+
result[token] = (result[token] ?? 0n) - amount;
|
|
7
|
+
}
|
|
8
|
+
if (isAddressEqual(to, creditAccount)) {
|
|
9
|
+
result[token] = (result[token] ?? 0n) + amount;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return result;
|
|
13
|
+
}
|
|
14
|
+
function fnSigToName(signature) {
|
|
15
|
+
const i = signature.indexOf("(");
|
|
16
|
+
return i >= 0 ? signature.slice(0, i) : signature;
|
|
17
|
+
}
|
|
18
|
+
function parsePosNegAmount(transfers) {
|
|
19
|
+
const pos = [];
|
|
20
|
+
const neg = [];
|
|
21
|
+
for (const [token, amount] of Object.entries(transfers)) {
|
|
22
|
+
if (amount < 0n) {
|
|
23
|
+
neg.push({ token, amount: (-amount).toString() });
|
|
24
|
+
} else if (amount > 0n) {
|
|
25
|
+
pos.push({ token, amount: amount.toString() });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return { pos, neg };
|
|
29
|
+
}
|
|
30
|
+
function swapFromTransfers(transfers) {
|
|
31
|
+
const { pos, neg } = parsePosNegAmount(transfers);
|
|
32
|
+
return {
|
|
33
|
+
from: neg[0]?.token ?? zeroAddress,
|
|
34
|
+
fromAmount: neg[0]?.amount ?? "0",
|
|
35
|
+
to: pos[0]?.token ?? zeroAddress,
|
|
36
|
+
toAmount: pos[0]?.amount ?? "0"
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function rewardsFromTransfers(transfers) {
|
|
40
|
+
return parsePosNegAmount(transfers).pos;
|
|
41
|
+
}
|
|
42
|
+
function allTransfersAsTokenAmounts(transfers) {
|
|
43
|
+
return Object.entries(transfers).map(([token, amount]) => ({
|
|
44
|
+
token,
|
|
45
|
+
amount: (amount < 0n ? -amount : amount).toString()
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
function curveAddLiquidityFromTransfers(transfers) {
|
|
49
|
+
const { pos, neg } = parsePosNegAmount(transfers);
|
|
50
|
+
return {
|
|
51
|
+
operation: "CurveAddLiquidity",
|
|
52
|
+
addedLiquidity: neg,
|
|
53
|
+
lpToken: pos[0]?.token ?? zeroAddress,
|
|
54
|
+
lpAmount: pos[0]?.amount ?? "0"
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function curveRemoveLiquidityFromTransfers(transfers) {
|
|
58
|
+
const { pos, neg } = parsePosNegAmount(transfers);
|
|
59
|
+
return {
|
|
60
|
+
operation: "CurveRemoveLiquidity",
|
|
61
|
+
tokenReceived: pos,
|
|
62
|
+
lpToken: neg[0]?.token ?? zeroAddress,
|
|
63
|
+
lpAmount: neg[0]?.amount ?? "0"
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function classifyCurveOperation(functionName, transfers) {
|
|
67
|
+
const fn = fnSigToName(functionName);
|
|
68
|
+
if (fn.startsWith("exchange")) {
|
|
69
|
+
return { operation: "CurveExchange", ...swapFromTransfers(transfers) };
|
|
70
|
+
}
|
|
71
|
+
if (fn.includes("remove") && fn.includes("liquidity_one_coin")) {
|
|
72
|
+
return {
|
|
73
|
+
operation: "CurveRemoveLiquidityOneCoin",
|
|
74
|
+
...swapFromTransfers(transfers)
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
if (fn === "add_liquidity" || fn === "add_liquidity_one_coin") {
|
|
78
|
+
return curveAddLiquidityFromTransfers(transfers);
|
|
79
|
+
}
|
|
80
|
+
if (fn.includes("remove") && fn.includes("liquidity")) {
|
|
81
|
+
return curveRemoveLiquidityFromTransfers(transfers);
|
|
82
|
+
}
|
|
83
|
+
return void 0;
|
|
84
|
+
}
|
|
85
|
+
export {
|
|
86
|
+
allTransfersAsTokenAmounts,
|
|
87
|
+
classifyCurveOperation,
|
|
88
|
+
curveAddLiquidityFromTransfers,
|
|
89
|
+
curveRemoveLiquidityFromTransfers,
|
|
90
|
+
fnSigToName,
|
|
91
|
+
parsePosNegAmount,
|
|
92
|
+
rewardsFromTransfers,
|
|
93
|
+
swapFromTransfers,
|
|
94
|
+
toNetTransfers
|
|
95
|
+
};
|