@gearbox-protocol/sdk 3.0.0-next.6 → 3.0.0-next.60
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/contracts/IAirdropDistributor.sol +55 -0
- package/contracts/IDegenDistributor.sol +28 -0
- package/contracts/IOffchainOracle.sol +17 -0
- package/contracts/IWETHGateway.sol +33 -0
- package/contracts/IwstETHGateway.sol +24 -0
- package/contracts/index.sol +26 -3
- package/lib/apy/curveAPY.js +2 -1
- package/lib/apy/index.d.ts +2 -2
- package/lib/apy/yearnAPY.js +1 -1
- package/lib/config.d.ts +0 -1
- package/lib/config.js +1 -2
- package/lib/core/assets.d.ts +4 -4
- package/lib/core/assets.js +28 -17
- package/lib/core/creditAccount.d.ts +32 -8
- package/lib/core/creditAccount.js +101 -44
- package/lib/core/creditAccount.spec.js +693 -10
- package/lib/core/creditManager.d.ts +24 -9
- package/lib/core/creditManager.js +93 -31
- package/lib/core/events.js +14 -14
- package/lib/core/gauge.d.ts +26 -0
- package/lib/core/gauge.js +63 -0
- package/lib/core/gaugeMath.d.ts +40 -0
- package/lib/core/gaugeMath.js +108 -0
- package/lib/core/gaugeMath.spec.d.ts +1 -0
- package/lib/core/gaugeMath.spec.js +388 -0
- package/lib/core/{pool/data.d.ts → pool.d.ts} +18 -10
- package/lib/core/{pool/data.js → pool.js} +69 -24
- package/lib/core/rewardClaimer.d.ts +2 -2
- package/lib/core/strategy.js +2 -2
- package/lib/core/trade.d.ts +14 -32
- package/lib/core/trade.js +33 -82
- package/lib/core/transactions.d.ts +65 -3
- package/lib/core/transactions.js +162 -105
- package/lib/index.d.ts +3 -0
- package/lib/index.js +3 -0
- package/lib/parsers/abstractParser.js +1 -2
- package/lib/parsers/convexBaseRewardPoolAdapterParser.js +10 -8
- package/lib/parsers/convexBaseRewardPoolAdapterParser.spec.js +9 -6
- package/lib/parsers/convexBoosterAdapterParser.js +6 -6
- package/lib/parsers/convexBoosterAdapterParser.spec.js +4 -4
- package/lib/parsers/creditFacadeParser.d.ts +2 -1
- package/lib/parsers/creditFacadeParser.js +25 -5
- package/lib/parsers/creditFacadeParser.spec.js +2 -3
- package/lib/parsers/curveAdapterParser.js +10 -11
- package/lib/parsers/curveAdapterParser.spec.js +6 -2
- package/lib/parsers/lidoAdapterParser.js +3 -2
- package/lib/parsers/lidoAdapterParser.spec.js +2 -2
- package/lib/parsers/txParser.d.ts +4 -4
- package/lib/parsers/txParser.js +9 -3
- package/lib/parsers/uniV2AdapterParser.js +5 -4
- package/lib/parsers/uniV2AdapterParser.spec.js +3 -2
- package/lib/parsers/uniV3AdapterParser.js +9 -7
- package/lib/parsers/uniV3AdapterParser.spec.js +3 -2
- package/lib/parsers/wstETHAdapterParser.js +6 -4
- package/lib/parsers/wstETHAdapterParser.spec.js +4 -4
- package/lib/parsers/yearnAdapterParser.spec.js +4 -4
- package/lib/parsers/yearnV2AdapterParser.js +13 -3
- package/lib/pathfinder/core.d.ts +11 -9
- package/lib/pathfinder/pathOptions.d.ts +2 -1
- package/lib/pathfinder/pathOptions.js +20 -1
- package/lib/pathfinder/pathOptions.spec.js +2 -2
- package/lib/pathfinder/pathfinder.d.ts +37 -10
- package/lib/pathfinder/pathfinder.js +46 -33
- package/lib/pathfinder/pathfinder.spec.js +7 -3
- package/lib/payload/creditAccount.d.ts +3 -4
- package/lib/payload/gauge.d.ts +12 -0
- package/lib/payload/pool.d.ts +6 -1
- package/lib/types/IAaveV2_LendingPoolAdapter.d.ts +171 -0
- package/lib/types/IAaveV2_WrappedATokenAdapter.d.ts +290 -0
- package/lib/types/IAirdropDistributor.sol/IAirdropDistributor.d.ts +124 -0
- package/lib/types/IAirdropDistributor.sol/IAirdropDistributorEvents.d.ts +73 -0
- package/lib/types/IAirdropDistributor.sol/index.d.ts +2 -0
- package/lib/types/IBalancerV2Vault.sol/IBalancerV2Vault.d.ts +308 -0
- package/lib/types/IBalancerV2Vault.sol/IBalancerV2VaultGetters.d.ts +112 -0
- package/lib/types/IBalancerV2Vault.sol/index.d.ts +2 -0
- package/lib/types/IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapter.d.ts +466 -0
- package/lib/types/IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapterEvents.d.ts +43 -0
- package/lib/types/{ILidoV1Adapter.sol/ILidoV1AdapterEvents.d.ts → IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapterExceptions.d.ts} +6 -18
- package/lib/types/IBalancerV2VaultAdapter.sol/index.d.ts +3 -0
- package/lib/types/ICompoundV2_CTokenAdapter.sol/ICompoundV2_CTokenAdapter.d.ts +216 -0
- package/lib/types/ICompoundV2_CTokenAdapter.sol/ICompoundV2_Exceptions.d.ts +27 -0
- package/lib/types/ICompoundV2_CTokenAdapter.sol/index.d.ts +2 -0
- package/lib/types/IContractsRegister.sol/IContractsRegister.d.ts +128 -0
- package/lib/types/IContractsRegister.sol/IContractsRegisterEvents.d.ts +50 -0
- package/lib/types/IContractsRegister.sol/index.d.ts +2 -0
- package/lib/types/IConvexToken.d.ts +9 -1
- package/lib/types/IConvexV1BaseRewardPoolAdapter.d.ts +46 -30
- package/lib/types/{IConvexV1BoosterAdapter.d.ts → IConvexV1BoosterAdapter.sol/IConvexV1BoosterAdapter.d.ts} +40 -21
- package/lib/types/IConvexV1BoosterAdapter.sol/IConvexV1BoosterAdapterEvents.d.ts +43 -0
- package/lib/types/IConvexV1BoosterAdapter.sol/index.d.ts +2 -0
- package/lib/types/ICreditConfiguratorV3.sol/ICreditConfiguratorV3.d.ts +716 -0
- package/lib/types/ICreditConfiguratorV3.sol/ICreditConfiguratorV3.js +2 -0
- package/lib/types/ICreditConfiguratorV3.sol/ICreditConfiguratorV3Events.d.ts +275 -0
- package/lib/types/ICreditConfiguratorV3.sol/ICreditConfiguratorV3Events.js +2 -0
- package/lib/types/ICreditConfiguratorV3.sol/index.d.ts +2 -0
- package/lib/types/ICreditConfiguratorV3.sol/index.js +2 -0
- package/lib/types/ICreditFacadeV2.sol/ICreditFacadeV2Extended.d.ts +7 -11
- package/lib/types/ICreditFacadeV3.sol/ICreditFacadeV3.d.ts +199 -94
- package/lib/types/ICreditFacadeV3.sol/ICreditFacadeV3Events.d.ts +29 -33
- package/lib/types/ICreditFacadeV3Multicall.d.ts +66 -51
- package/lib/types/ICreditManagerV3.sol/ICreditManagerV3.d.ts +360 -98
- package/lib/types/ICurveV1Adapter.d.ts +41 -105
- package/lib/types/ICurveV1_2AssetsAdapter.d.ts +41 -105
- package/lib/types/ICurveV1_3AssetsAdapter.d.ts +41 -105
- package/lib/types/ICurveV1_4AssetsAdapter.d.ts +41 -105
- package/lib/types/IDataCompressorV2_10.d.ts +44 -36
- package/lib/types/IDataCompressorV3_00.d.ts +141 -37
- package/lib/types/IDegenDistributor.sol/IDegenDistributor.d.ts +96 -0
- package/lib/types/IDegenDistributor.sol/IDegenDistributor.js +2 -0
- package/lib/types/IDegenDistributor.sol/IDegenDistributorEvents.d.ts +53 -0
- package/lib/types/IDegenDistributor.sol/IDegenDistributorEvents.js +2 -0
- package/lib/types/IDegenDistributor.sol/index.d.ts +2 -0
- package/lib/types/IDegenDistributor.sol/index.js +2 -0
- package/lib/types/IDegenNFTV2.sol/IDegenNFTV2.d.ts +339 -0
- package/lib/types/IDegenNFTV2.sol/IDegenNFTV2.js +2 -0
- package/lib/types/IDegenNFTV2.sol/IDegenNFTV2Events.d.ts +61 -0
- package/lib/types/IDegenNFTV2.sol/IDegenNFTV2Events.js +2 -0
- package/lib/types/IDegenNFTV2.sol/IDegenNFTV2Exceptions.d.ts +27 -0
- package/lib/types/IDegenNFTV2.sol/IDegenNFTV2Exceptions.js +2 -0
- package/lib/types/IDegenNFTV2.sol/index.d.ts +3 -0
- package/lib/types/IDegenNFTV2.sol/index.js +2 -0
- package/lib/types/IERC165.d.ts +42 -0
- package/lib/types/IERC165.js +2 -0
- package/lib/types/{draft-IERC20Permit.sol/IERC20Permit.d.ts → IERC20Permit.d.ts} +1 -1
- package/lib/types/IERC20Permit.js +2 -0
- package/lib/types/IERC20ZapperDeposits.d.ts +117 -0
- package/lib/types/IERC20ZapperDeposits.js +2 -0
- package/lib/types/IERC4626Adapter.d.ts +238 -0
- package/lib/types/IERC4626Adapter.js +2 -0
- package/lib/types/IERC721.d.ts +220 -0
- package/lib/types/IERC721.js +2 -0
- package/lib/types/IERC721Metadata.d.ts +244 -0
- package/lib/types/IERC721Metadata.js +2 -0
- package/lib/types/IETHZapperDeposits.d.ts +66 -0
- package/lib/types/IETHZapperDeposits.js +2 -0
- package/lib/types/IGasPricer.d.ts +44 -0
- package/lib/types/IGasPricer.js +2 -0
- package/lib/types/IGaugeV3.sol/IGaugeV3.d.ts +366 -0
- package/lib/types/IGaugeV3.sol/IGaugeV3.js +2 -0
- package/lib/types/IGaugeV3.sol/IGaugeV3Events.d.ts +114 -0
- package/lib/types/IGaugeV3.sol/IGaugeV3Events.js +2 -0
- package/lib/types/IGaugeV3.sol/index.d.ts +2 -0
- package/lib/types/IGaugeV3.sol/index.js +2 -0
- package/lib/types/IGearStakingV3.sol/IGearStakingV3.d.ts +408 -0
- package/lib/types/IGearStakingV3.sol/IGearStakingV3.js +2 -0
- package/lib/types/IGearStakingV3.sol/IGearStakingV3Events.d.ts +117 -0
- package/lib/types/IGearStakingV3.sol/IGearStakingV3Events.js +2 -0
- package/lib/types/IGearStakingV3.sol/index.d.ts +2 -0
- package/lib/types/IGearStakingV3.sol/index.js +2 -0
- package/lib/types/{ILidoV1Adapter.sol/ILidoV1Adapter.d.ts → ILidoV1Adapter.d.ts} +13 -48
- package/lib/types/ILidoV1Adapter.js +2 -0
- package/lib/types/ILinearInterestRateModelV3.d.ts +120 -0
- package/lib/types/ILinearInterestRateModelV3.js +2 -0
- package/lib/types/IOffchainOracle.d.ts +58 -0
- package/lib/types/IOffchainOracle.js +2 -0
- package/lib/types/IPoolQuotaKeeperV3.sol/IPoolQuotaKeeperV3.d.ts +473 -0
- package/lib/types/IPoolQuotaKeeperV3.sol/IPoolQuotaKeeperV3.js +2 -0
- package/lib/types/IPoolQuotaKeeperV3.sol/IPoolQuotaKeeperV3Events.d.ts +113 -0
- package/lib/types/IPoolQuotaKeeperV3.sol/IPoolQuotaKeeperV3Events.js +2 -0
- package/lib/types/IPoolQuotaKeeperV3.sol/index.d.ts +2 -0
- package/lib/types/IPoolQuotaKeeperV3.sol/index.js +2 -0
- package/lib/types/IPoolV3.sol/IPoolV3.d.ts +43 -11
- package/lib/types/IPoolV3.sol/index.d.ts +0 -1
- package/lib/types/IPriceFeed.sol/IPriceFeed.d.ts +109 -0
- package/lib/types/IPriceFeed.sol/IPriceFeed.js +2 -0
- package/lib/types/IPriceFeed.sol/IUpdatablePriceFeed.d.ts +133 -0
- package/lib/types/IPriceFeed.sol/IUpdatablePriceFeed.js +2 -0
- package/lib/types/IPriceFeed.sol/index.d.ts +2 -0
- package/lib/types/IPriceFeed.sol/index.js +2 -0
- package/lib/types/IPriceOracle.sol/IPriceOracleV2.d.ts +166 -0
- package/lib/types/IPriceOracle.sol/IPriceOracleV2.js +2 -0
- package/lib/types/IPriceOracle.sol/IPriceOracleV2Events.d.ts +43 -0
- package/lib/types/IPriceOracle.sol/IPriceOracleV2Events.js +2 -0
- package/lib/types/{ILidoV1Adapter.sol/ILidoV1AdapterExceptions.d.ts → IPriceOracle.sol/IPriceOracleV2Exceptions.d.ts} +3 -3
- package/lib/types/IPriceOracle.sol/IPriceOracleV2Exceptions.js +2 -0
- package/lib/types/IPriceOracle.sol/IPriceOracleV2Ext.d.ts +182 -0
- package/lib/types/IPriceOracle.sol/IPriceOracleV2Ext.js +2 -0
- package/lib/types/IPriceOracle.sol/index.d.ts +4 -0
- package/lib/types/IPriceOracle.sol/index.js +2 -0
- package/lib/types/IPriceOracleV3.sol/IPriceOracleV3.d.ts +272 -0
- package/lib/types/IPriceOracleV3.sol/IPriceOracleV3.js +2 -0
- package/lib/types/IPriceOracleV3.sol/IPriceOracleV3Events.d.ts +79 -0
- package/lib/types/IPriceOracleV3.sol/IPriceOracleV3Events.js +2 -0
- package/lib/types/IPriceOracleV3.sol/index.d.ts +2 -0
- package/lib/types/IPriceOracleV3.sol/index.js +2 -0
- package/lib/types/IRouter.d.ts +47 -34
- package/lib/types/IUniswapV2Adapter.sol/IUniswapV2Adapter.d.ts +10 -9
- package/lib/types/IUniswapV3Adapter.sol/IUniswapV3Adapter.d.ts +27 -21
- package/lib/types/IVotingContractV3.d.ts +74 -0
- package/lib/types/IVotingContractV3.js +2 -0
- package/lib/types/IWETHGateway.d.ts +90 -0
- package/lib/types/IWETHGateway.js +2 -0
- package/lib/types/IYearnV2Adapter.d.ts +22 -22
- package/lib/types/IZapper.d.ts +130 -0
- package/lib/types/IZapper.js +2 -0
- package/lib/types/IwstETHGateway.sol/IwstETHGateWay.d.ts +70 -0
- package/lib/types/IwstETHGateway.sol/IwstETHGateWay.js +2 -0
- package/lib/types/IwstETHGateway.sol/index.d.ts +1 -0
- package/lib/types/IwstETHGateway.sol/index.js +2 -0
- package/lib/types/IwstETHV1Adapter.d.ts +17 -17
- package/lib/types/factories/AddressProvider__factory.d.ts +1 -1
- package/lib/types/factories/AddressProvider__factory.js +1 -1
- package/lib/types/factories/Balances.sol/BalanceOps__factory.d.ts +1 -1
- package/lib/types/factories/Balances.sol/BalanceOps__factory.js +1 -1
- package/lib/types/factories/Claimable__factory.d.ts +1 -1
- package/lib/types/factories/Claimable__factory.js +1 -1
- package/lib/types/factories/Errors__factory.d.ts +1 -1
- package/lib/types/factories/Errors__factory.js +1 -1
- package/lib/types/factories/IAaveV2_LendingPoolAdapter__factory.d.ts +158 -0
- package/lib/types/factories/IAaveV2_LendingPoolAdapter__factory.js +215 -0
- package/lib/types/factories/IAaveV2_WrappedATokenAdapter__factory.d.ts +252 -0
- package/lib/types/factories/IAaveV2_WrappedATokenAdapter__factory.js +341 -0
- package/lib/types/factories/IAirdropDistributor.sol/IAirdropDistributorEvents__factory.d.ts +63 -0
- package/lib/types/factories/IAirdropDistributor.sol/IAirdropDistributorEvents__factory.js +88 -0
- package/lib/types/factories/IAirdropDistributor.sol/IAirdropDistributor__factory.d.ts +119 -0
- package/lib/types/factories/IAirdropDistributor.sol/IAirdropDistributor__factory.js +161 -0
- package/lib/types/factories/IAirdropDistributor.sol/index.d.ts +2 -0
- package/lib/types/factories/IAirdropDistributor.sol/index.js +10 -0
- package/lib/types/factories/IBalancerV2Vault.sol/IBalancerV2VaultGetters__factory.d.ts +78 -0
- package/lib/types/factories/IBalancerV2Vault.sol/IBalancerV2VaultGetters__factory.js +111 -0
- package/lib/types/factories/IBalancerV2Vault.sol/IBalancerV2Vault__factory.d.ts +360 -0
- package/lib/types/factories/IBalancerV2Vault.sol/IBalancerV2Vault__factory.js +475 -0
- package/lib/types/factories/IBalancerV2Vault.sol/index.d.ts +2 -0
- package/lib/types/factories/IBalancerV2Vault.sol/index.js +10 -0
- package/lib/types/factories/IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapterEvents__factory.d.ts +23 -0
- package/lib/types/factories/IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapterEvents__factory.js +38 -0
- package/lib/types/factories/IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapterExceptions__factory.d.ts +12 -0
- package/lib/types/factories/{ILidoV1Adapter.sol/ILidoV1AdapterExceptions__factory.js → IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapterExceptions__factory.js} +4 -4
- package/lib/types/factories/IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapter__factory.d.ts +514 -0
- package/lib/types/factories/IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapter__factory.js +675 -0
- package/lib/types/factories/IBalancerV2VaultAdapter.sol/index.d.ts +3 -0
- package/lib/types/factories/IBalancerV2VaultAdapter.sol/index.js +12 -0
- package/lib/types/factories/ICompoundV2_CTokenAdapter.sol/ICompoundV2_CTokenAdapter__factory.d.ts +196 -0
- package/lib/types/factories/ICompoundV2_CTokenAdapter.sol/ICompoundV2_CTokenAdapter__factory.js +267 -0
- package/lib/types/factories/ICompoundV2_CTokenAdapter.sol/ICompoundV2_Exceptions__factory.d.ts +16 -0
- package/lib/types/factories/{ILidoV1Adapter.sol/ILidoV1AdapterEvents__factory.js → ICompoundV2_CTokenAdapter.sol/ICompoundV2_Exceptions__factory.js} +6 -8
- package/lib/types/factories/ICompoundV2_CTokenAdapter.sol/index.d.ts +2 -0
- package/lib/types/factories/ICompoundV2_CTokenAdapter.sol/index.js +10 -0
- package/lib/types/factories/IContractsRegister.sol/IContractsRegisterEvents__factory.d.ts +28 -0
- package/lib/types/factories/IContractsRegister.sol/IContractsRegisterEvents__factory.js +45 -0
- package/lib/types/factories/IContractsRegister.sol/IContractsRegister__factory.d.ts +134 -0
- package/lib/types/factories/IContractsRegister.sol/IContractsRegister__factory.js +186 -0
- package/lib/types/factories/IContractsRegister.sol/index.d.ts +2 -0
- package/lib/types/factories/IContractsRegister.sol/index.js +10 -0
- package/lib/types/factories/IConvexToken__factory.d.ts +10 -0
- package/lib/types/factories/IConvexToken__factory.js +13 -0
- package/lib/types/factories/IConvexV1BaseRewardPoolAdapter__factory.d.ts +38 -6
- package/lib/types/factories/IConvexV1BaseRewardPoolAdapter__factory.js +48 -6
- package/lib/types/factories/IConvexV1BoosterAdapter.sol/IConvexV1BoosterAdapterEvents__factory.d.ts +23 -0
- package/lib/types/factories/IConvexV1BoosterAdapter.sol/IConvexV1BoosterAdapterEvents__factory.js +38 -0
- package/lib/types/factories/{IConvexV1BoosterAdapter__factory.d.ts → IConvexV1BoosterAdapter.sol/IConvexV1BoosterAdapter__factory.d.ts} +26 -3
- package/lib/types/factories/{IConvexV1BoosterAdapter__factory.js → IConvexV1BoosterAdapter.sol/IConvexV1BoosterAdapter__factory.js} +31 -2
- package/lib/types/factories/IConvexV1BoosterAdapter.sol/index.d.ts +2 -0
- package/lib/types/factories/IConvexV1BoosterAdapter.sol/index.js +10 -0
- package/lib/types/factories/ICreditConfiguratorV3.sol/ICreditConfiguratorV3Events__factory.d.ts +273 -0
- package/lib/types/factories/ICreditConfiguratorV3.sol/ICreditConfiguratorV3Events__factory.js +357 -0
- package/lib/types/factories/ICreditConfiguratorV3.sol/ICreditConfiguratorV3__factory.d.ts +605 -0
- package/lib/types/factories/ICreditConfiguratorV3.sol/ICreditConfiguratorV3__factory.js +785 -0
- package/lib/types/factories/ICreditConfiguratorV3.sol/index.d.ts +2 -0
- package/lib/types/factories/ICreditConfiguratorV3.sol/index.js +10 -0
- package/lib/types/factories/ICreditFacadeV2.sol/ICreditFacadeV2Extended__factory.d.ts +0 -4
- package/lib/types/factories/ICreditFacadeV2.sol/ICreditFacadeV2Extended__factory.js +0 -5
- package/lib/types/factories/ICreditFacadeV3.sol/ICreditFacadeV3Events__factory.d.ts +14 -24
- package/lib/types/factories/ICreditFacadeV3.sol/ICreditFacadeV3Events__factory.js +15 -27
- package/lib/types/factories/ICreditFacadeV3.sol/ICreditFacadeV3__factory.d.ts +146 -72
- package/lib/types/factories/ICreditFacadeV3.sol/ICreditFacadeV3__factory.js +183 -85
- package/lib/types/factories/ICreditFacadeV3Multicall__factory.d.ts +57 -29
- package/lib/types/factories/ICreditFacadeV3Multicall__factory.js +71 -36
- package/lib/types/factories/ICreditManagerV3.sol/ICreditManagerV3__factory.d.ts +339 -147
- package/lib/types/factories/ICreditManagerV3.sol/ICreditManagerV3__factory.js +427 -180
- package/lib/types/factories/ICurveV1Adapter__factory.d.ts +13 -71
- package/lib/types/factories/ICurveV1Adapter__factory.js +14 -91
- package/lib/types/factories/ICurveV1_2AssetsAdapter__factory.d.ts +13 -71
- package/lib/types/factories/ICurveV1_2AssetsAdapter__factory.js +14 -91
- package/lib/types/factories/ICurveV1_3AssetsAdapter__factory.d.ts +13 -71
- package/lib/types/factories/ICurveV1_3AssetsAdapter__factory.js +14 -91
- package/lib/types/factories/ICurveV1_4AssetsAdapter__factory.d.ts +13 -71
- package/lib/types/factories/ICurveV1_4AssetsAdapter__factory.js +14 -91
- package/lib/types/factories/IDataCompressorV2_10__factory.d.ts +110 -54
- package/lib/types/factories/IDataCompressorV2_10__factory.js +138 -68
- package/lib/types/factories/IDataCompressorV3_00__factory.d.ts +379 -79
- package/lib/types/factories/IDataCompressorV3_00__factory.js +481 -100
- package/lib/types/factories/IDegenDistributor.sol/IDegenDistributorEvents__factory.d.ts +38 -0
- package/lib/types/factories/{AaveV2_WrappedAToken.sol/IWrappedATokenEvents__factory.js → IDegenDistributor.sol/IDegenDistributorEvents__factory.js} +13 -25
- package/lib/types/factories/IDegenDistributor.sol/IDegenDistributor__factory.d.ts +84 -0
- package/lib/types/factories/IDegenDistributor.sol/IDegenDistributor__factory.js +117 -0
- package/lib/types/factories/IDegenDistributor.sol/index.d.ts +2 -0
- package/lib/types/factories/IDegenDistributor.sol/index.js +10 -0
- package/lib/types/factories/IDegenNFTV2.sol/IDegenNFTV2Events__factory.d.ts +38 -0
- package/lib/types/factories/IDegenNFTV2.sol/IDegenNFTV2Events__factory.js +58 -0
- package/lib/types/factories/IDegenNFTV2.sol/IDegenNFTV2Exceptions__factory.d.ts +24 -0
- package/lib/types/factories/IDegenNFTV2.sol/IDegenNFTV2Exceptions__factory.js +39 -0
- package/lib/types/factories/{IWithdrawalManagerV3.sol/IWithdrawalManagerV3__factory.d.ts → IDegenNFTV2.sol/IDegenNFTV2__factory.d.ts} +190 -180
- package/lib/types/factories/{IWithdrawalManagerV3.sol/IWithdrawalManagerV3__factory.js → IDegenNFTV2.sol/IDegenNFTV2__factory.js} +212 -195
- package/lib/types/factories/IDegenNFTV2.sol/index.d.ts +3 -0
- package/lib/types/factories/IDegenNFTV2.sol/index.js +12 -0
- package/lib/types/factories/IERC165__factory.d.ts +22 -0
- package/lib/types/factories/IERC165__factory.js +38 -0
- package/lib/types/factories/{draft-IERC20Permit.sol/IERC20Permit__factory.d.ts → IERC20Permit__factory.d.ts} +1 -1
- package/lib/types/factories/IERC20ZapperDeposits__factory.d.ts +120 -0
- package/lib/types/factories/IERC20ZapperDeposits__factory.js +165 -0
- package/lib/types/factories/IERC4626Adapter__factory.d.ts +220 -0
- package/lib/types/factories/IERC4626Adapter__factory.js +297 -0
- package/lib/types/factories/IERC721Metadata__factory.d.ts +262 -0
- package/lib/types/factories/IERC721Metadata__factory.js +349 -0
- package/lib/types/factories/IERC721__factory.d.ts +228 -0
- package/lib/types/factories/IERC721__factory.js +304 -0
- package/lib/types/factories/IETHZapperDeposits__factory.d.ts +40 -0
- package/lib/types/factories/IETHZapperDeposits__factory.js +62 -0
- package/lib/types/factories/IGasPricer__factory.d.ts +22 -0
- package/lib/types/factories/IGasPricer__factory.js +38 -0
- package/lib/types/factories/IGaugeV3.sol/IGaugeV3Events__factory.d.ts +118 -0
- package/lib/types/factories/IGaugeV3.sol/IGaugeV3Events__factory.js +157 -0
- package/lib/types/factories/IGaugeV3.sol/IGaugeV3__factory.d.ts +342 -0
- package/lib/types/factories/IGaugeV3.sol/IGaugeV3__factory.js +448 -0
- package/lib/types/factories/IGaugeV3.sol/index.d.ts +2 -0
- package/lib/types/factories/IGaugeV3.sol/index.js +10 -0
- package/lib/types/factories/{IWithdrawalManagerV3.sol/IWithdrawalManagerV3Events__factory.d.ts → IGearStakingV3.sol/IGearStakingV3Events__factory.d.ts} +33 -63
- package/lib/types/factories/{IWithdrawalManagerV3.sol/IWithdrawalManagerV3Events__factory.js → IGearStakingV3.sol/IGearStakingV3Events__factory.js} +34 -70
- package/lib/types/factories/IGearStakingV3.sol/IGearStakingV3__factory.d.ts +504 -0
- package/lib/types/factories/IGearStakingV3.sol/IGearStakingV3__factory.js +660 -0
- package/lib/types/factories/IGearStakingV3.sol/index.d.ts +2 -0
- package/lib/types/factories/IGearStakingV3.sol/index.js +10 -0
- package/lib/types/factories/{ILidoV1Adapter.sol/ILidoV1Adapter__factory.d.ts → ILidoV1Adapter__factory.d.ts} +7 -37
- package/lib/types/factories/{ILidoV1Adapter.sol/ILidoV1Adapter__factory.js → ILidoV1Adapter__factory.js} +8 -46
- package/lib/types/factories/ILinearInterestRateModelV3__factory.d.ts +98 -0
- package/lib/types/factories/ILinearInterestRateModelV3__factory.js +136 -0
- package/lib/types/factories/IOffchainOracle__factory.d.ts +48 -0
- package/lib/types/factories/IOffchainOracle__factory.js +72 -0
- package/lib/types/factories/IPoolQuotaKeeperV3.sol/IPoolQuotaKeeperV3Events__factory.d.ts +103 -0
- package/lib/types/factories/IPoolQuotaKeeperV3.sol/IPoolQuotaKeeperV3Events__factory.js +140 -0
- package/lib/types/factories/IPoolQuotaKeeperV3.sol/IPoolQuotaKeeperV3__factory.d.ts +441 -0
- package/lib/types/factories/IPoolQuotaKeeperV3.sol/IPoolQuotaKeeperV3__factory.js +580 -0
- package/lib/types/factories/IPoolQuotaKeeperV3.sol/index.d.ts +2 -0
- package/lib/types/factories/IPoolQuotaKeeperV3.sol/index.js +10 -0
- package/lib/types/factories/IPoolV3.sol/IPoolV3__factory.d.ts +62 -14
- package/lib/types/factories/IPoolV3.sol/IPoolV3__factory.js +79 -17
- package/lib/types/factories/IPoolV3.sol/index.d.ts +0 -1
- package/lib/types/factories/IPoolV3.sol/index.js +1 -3
- package/lib/types/factories/{IPoolV3.sol/IPoolBase__factory.d.ts → IPriceFeed.sol/IPriceFeed__factory.d.ts} +39 -35
- package/lib/types/factories/{IPoolV3.sol/IPoolBase__factory.js → IPriceFeed.sol/IPriceFeed__factory.js} +40 -35
- package/lib/types/factories/IPriceFeed.sol/IUpdatablePriceFeed__factory.d.ts +104 -0
- package/lib/types/factories/IPriceFeed.sol/IUpdatablePriceFeed__factory.js +143 -0
- package/lib/types/factories/IPriceFeed.sol/index.d.ts +2 -0
- package/lib/types/factories/IPriceFeed.sol/index.js +10 -0
- package/lib/types/factories/IPriceOracle.sol/IPriceOracleV2Events__factory.d.ts +23 -0
- package/lib/types/factories/IPriceOracle.sol/IPriceOracleV2Events__factory.js +38 -0
- package/lib/types/factories/IPriceOracle.sol/IPriceOracleV2Exceptions__factory.d.ts +20 -0
- package/lib/types/factories/IPriceOracle.sol/IPriceOracleV2Exceptions__factory.js +34 -0
- package/lib/types/factories/{IAToken__factory.d.ts → IPriceOracle.sol/IPriceOracleV2Ext__factory.d.ts} +98 -99
- package/lib/types/factories/IPriceOracle.sol/IPriceOracleV2Ext__factory.js +267 -0
- package/lib/types/factories/IPriceOracle.sol/IPriceOracleV2__factory.d.ts +183 -0
- package/lib/types/factories/{IAToken__factory.js → IPriceOracle.sol/IPriceOracleV2__factory.js} +94 -112
- package/lib/types/factories/IPriceOracle.sol/index.d.ts +4 -0
- package/lib/types/factories/IPriceOracle.sol/index.js +14 -0
- package/lib/types/factories/IPriceOracleV3.sol/IPriceOracleV3Events__factory.d.ts +78 -0
- package/lib/types/factories/IPriceOracleV3.sol/IPriceOracleV3Events__factory.js +106 -0
- package/lib/types/factories/IPriceOracleV3.sol/IPriceOracleV3__factory.d.ts +326 -0
- package/lib/types/factories/IPriceOracleV3.sol/IPriceOracleV3__factory.js +433 -0
- package/lib/types/factories/IPriceOracleV3.sol/index.d.ts +2 -0
- package/lib/types/factories/IPriceOracleV3.sol/index.js +10 -0
- package/lib/types/factories/IRouter__factory.d.ts +74 -5
- package/lib/types/factories/IRouter__factory.js +96 -6
- package/lib/types/factories/IUniswapV2Adapter.sol/IUniswapV2Adapter__factory.d.ts +5 -1
- package/lib/types/factories/IUniswapV2Adapter.sol/IUniswapV2Adapter__factory.js +6 -1
- package/lib/types/factories/IUniswapV3Adapter.sol/IUniswapV3Adapter__factory.d.ts +12 -4
- package/lib/types/factories/IUniswapV3Adapter.sol/IUniswapV3Adapter__factory.js +14 -4
- package/lib/types/factories/IVotingContractV3__factory.d.ts +44 -0
- package/lib/types/factories/IVotingContractV3__factory.js +65 -0
- package/lib/types/factories/IWETHGateway__factory.d.ts +58 -0
- package/lib/types/factories/IWETHGateway__factory.js +83 -0
- package/lib/types/factories/IYearnV2Adapter__factory.d.ts +21 -13
- package/lib/types/factories/IYearnV2Adapter__factory.js +27 -15
- package/lib/types/factories/{WERC20ZapperBase__factory.d.ts → IZapper__factory.d.ts} +57 -61
- package/lib/types/factories/{WERC20ZapperBase__factory.js → IZapper__factory.js} +65 -71
- package/lib/types/factories/{ZapperBase__factory.d.ts → IwstETHGateway.sol/IwstETHGateWay__factory.d.ts} +22 -34
- package/lib/types/factories/{ZapperBase__factory.js → IwstETHGateway.sol/IwstETHGateWay__factory.js} +22 -39
- package/lib/types/factories/IwstETHGateway.sol/index.d.ts +1 -0
- package/lib/types/factories/IwstETHGateway.sol/index.js +8 -0
- package/lib/types/factories/IwstETHV1Adapter__factory.d.ts +12 -4
- package/lib/types/factories/IwstETHV1Adapter__factory.js +16 -4
- package/lib/types/factories/SafeERC20__factory.d.ts +1 -1
- package/lib/types/factories/SafeERC20__factory.js +1 -1
- package/lib/types/factories/index.d.ts +32 -13
- package/lib/types/factories/index.js +50 -24
- package/lib/types/index.d.ts +134 -44
- package/lib/types/index.js +103 -36
- package/lib/utils/formatter.d.ts +0 -3
- package/lib/utils/formatter.js +1 -67
- package/lib/utils/math.d.ts +2 -0
- package/lib/utils/math.js +2 -0
- package/lib/utils/types.d.ts +1 -0
- package/lib/watchers/creditAccountWatcher.d.ts +3 -2
- package/lib/watchers/creditAccountWatcher.js +19 -13
- package/lib/watchers/creditAccountWatcher.spec.js +18 -18
- package/lib/watchers/creditManagerWatcher.d.ts +5 -3
- package/lib/watchers/creditManagerWatcher.js +32 -10
- package/lib/watchers/creditManagerWatcher.spec.js +12 -4
- package/package.json +10 -9
- package/contracts/IRouter.sol +0 -100
- package/lib/core/pool/index.d.ts +0 -1
- package/lib/core/pool/index.js +0 -17
- package/lib/types/AaveV2_WrappedAToken.sol/IWrappedATokenEvents.d.ts +0 -60
- package/lib/types/AaveV2_WrappedAToken.sol/WrappedAToken.d.ts +0 -332
- package/lib/types/AaveV2_WrappedAToken.sol/index.d.ts +0 -2
- package/lib/types/ERC20.d.ts +0 -198
- package/lib/types/IAToken.d.ts +0 -182
- package/lib/types/ILendingPool.d.ts +0 -140
- package/lib/types/ILidoV1Adapter.sol/index.d.ts +0 -3
- package/lib/types/IPoolV3.sol/IPoolBase.d.ts +0 -102
- package/lib/types/IWithdrawalManagerV3.sol/IWithdrawalManagerV3.d.ts +0 -370
- package/lib/types/IWithdrawalManagerV3.sol/IWithdrawalManagerV3Events.d.ts +0 -133
- package/lib/types/IWithdrawalManagerV3.sol/index.d.ts +0 -2
- package/lib/types/WATokenZapper.d.ts +0 -134
- package/lib/types/WERC20ZapperBase.d.ts +0 -134
- package/lib/types/WETHZapper.d.ts +0 -122
- package/lib/types/WstETHZapper.d.ts +0 -134
- package/lib/types/ZapperBase.d.ts +0 -70
- package/lib/types/draft-IERC20Permit.sol/index.d.ts +0 -1
- package/lib/types/factories/AaveV2_WrappedAToken.sol/IWrappedATokenEvents__factory.d.ts +0 -48
- package/lib/types/factories/AaveV2_WrappedAToken.sol/WrappedAToken__factory.d.ts +0 -397
- package/lib/types/factories/AaveV2_WrappedAToken.sol/WrappedAToken__factory.js +0 -535
- package/lib/types/factories/AaveV2_WrappedAToken.sol/index.d.ts +0 -2
- package/lib/types/factories/AaveV2_WrappedAToken.sol/index.js +0 -10
- package/lib/types/factories/ERC20__factory.d.ts +0 -239
- package/lib/types/factories/ERC20__factory.js +0 -328
- package/lib/types/factories/ILendingPool__factory.d.ts +0 -134
- package/lib/types/factories/ILendingPool__factory.js +0 -183
- package/lib/types/factories/ILidoV1Adapter.sol/ILidoV1AdapterEvents__factory.d.ts +0 -18
- package/lib/types/factories/ILidoV1Adapter.sol/ILidoV1AdapterExceptions__factory.d.ts +0 -12
- package/lib/types/factories/ILidoV1Adapter.sol/index.d.ts +0 -3
- package/lib/types/factories/ILidoV1Adapter.sol/index.js +0 -12
- package/lib/types/factories/IWithdrawalManagerV3.sol/index.d.ts +0 -2
- package/lib/types/factories/IWithdrawalManagerV3.sol/index.js +0 -10
- package/lib/types/factories/WATokenZapper__factory.d.ts +0 -161
- package/lib/types/factories/WATokenZapper__factory.js +0 -227
- package/lib/types/factories/WETHZapper__factory.d.ts +0 -138
- package/lib/types/factories/WETHZapper__factory.js +0 -198
- package/lib/types/factories/WstETHZapper__factory.d.ts +0 -161
- package/lib/types/factories/WstETHZapper__factory.js +0 -227
- package/lib/types/factories/draft-IERC20Permit.sol/index.d.ts +0 -1
- package/lib/types/factories/draft-IERC20Permit.sol/index.js +0 -8
- /package/lib/{types/AaveV2_WrappedAToken.sol/IWrappedATokenEvents.js → payload/gauge.js} +0 -0
- /package/lib/types/{AaveV2_WrappedAToken.sol/WrappedAToken.js → IAaveV2_LendingPoolAdapter.js} +0 -0
- /package/lib/types/{AaveV2_WrappedAToken.sol/index.js → IAaveV2_WrappedATokenAdapter.js} +0 -0
- /package/lib/types/{ERC20.js → IAirdropDistributor.sol/IAirdropDistributor.js} +0 -0
- /package/lib/types/{IAToken.js → IAirdropDistributor.sol/IAirdropDistributorEvents.js} +0 -0
- /package/lib/types/{ILidoV1Adapter.sol → IAirdropDistributor.sol}/index.js +0 -0
- /package/lib/types/{IConvexV1BoosterAdapter.js → IBalancerV2Vault.sol/IBalancerV2Vault.js} +0 -0
- /package/lib/types/{ILendingPool.js → IBalancerV2Vault.sol/IBalancerV2VaultGetters.js} +0 -0
- /package/lib/types/{IWithdrawalManagerV3.sol → IBalancerV2Vault.sol}/index.js +0 -0
- /package/lib/types/{ILidoV1Adapter.sol/ILidoV1Adapter.js → IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapter.js} +0 -0
- /package/lib/types/{ILidoV1Adapter.sol/ILidoV1AdapterEvents.js → IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapterEvents.js} +0 -0
- /package/lib/types/{ILidoV1Adapter.sol/ILidoV1AdapterExceptions.js → IBalancerV2VaultAdapter.sol/IBalancerV2VaultAdapterExceptions.js} +0 -0
- /package/lib/types/{draft-IERC20Permit.sol → IBalancerV2VaultAdapter.sol}/index.js +0 -0
- /package/lib/types/{IPoolV3.sol/IPoolBase.js → ICompoundV2_CTokenAdapter.sol/ICompoundV2_CTokenAdapter.js} +0 -0
- /package/lib/types/{IWithdrawalManagerV3.sol/IWithdrawalManagerV3.js → ICompoundV2_CTokenAdapter.sol/ICompoundV2_Exceptions.js} +0 -0
- /package/lib/types/{IWithdrawalManagerV3.sol/IWithdrawalManagerV3Events.js → ICompoundV2_CTokenAdapter.sol/index.js} +0 -0
- /package/lib/types/{WATokenZapper.js → IContractsRegister.sol/IContractsRegister.js} +0 -0
- /package/lib/types/{WERC20ZapperBase.js → IContractsRegister.sol/IContractsRegisterEvents.js} +0 -0
- /package/lib/types/{WETHZapper.js → IContractsRegister.sol/index.js} +0 -0
- /package/lib/types/{WstETHZapper.js → IConvexV1BoosterAdapter.sol/IConvexV1BoosterAdapter.js} +0 -0
- /package/lib/types/{ZapperBase.js → IConvexV1BoosterAdapter.sol/IConvexV1BoosterAdapterEvents.js} +0 -0
- /package/lib/types/{draft-IERC20Permit.sol/IERC20Permit.js → IConvexV1BoosterAdapter.sol/index.js} +0 -0
- /package/lib/types/factories/{draft-IERC20Permit.sol/IERC20Permit__factory.js → IERC20Permit__factory.js} +0 -0
package/lib/core/transactions.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TxEnableTokens = exports.TxApprove = exports.TxCloseAccount = exports.TxRepayAccount = exports.TxClaimGearRewards = exports.TxClaimNFT = exports.TxClaimReward = exports.TxOpenMultitokenAccount = exports.TxOpenAccount = exports.TxDecreaseBorrowAmount = exports.TxIncreaseBorrowAmount = exports.TxAddCollateral = exports.TXSwap = exports.TxRemoveLiquidity = exports.TxAddLiquidity = exports.TxSerializer = void 0;
|
|
3
|
+
exports.TxWithdrawCollateral = exports.TxGaugeVote = exports.TxGaugeClaim = exports.TxGaugeUnstake = exports.TxGaugeStake = exports.TxUpdateQuota = exports.TxEnableTokens = exports.TxApprove = exports.TxCloseAccount = exports.TxRepayAccount = exports.TxClaimGearRewards = exports.TxClaimNFT = exports.TxClaimReward = exports.TxOpenMultitokenAccount = exports.TxOpenAccount = exports.TxDecreaseBorrowAmount = exports.TxIncreaseBorrowAmount = exports.TxAddCollateral = exports.TXSwap = exports.TxRemoveLiquidity = exports.TxAddLiquidity = exports.TxSerializer = void 0;
|
|
4
4
|
const sdk_gov_1 = require("@gearbox-protocol/sdk-gov");
|
|
5
5
|
const contractsRegister_1 = require("../contracts/contractsRegister");
|
|
6
|
-
const
|
|
6
|
+
const math_1 = require("../utils/math");
|
|
7
7
|
const eventOrTx_1 = require("./eventOrTx");
|
|
8
8
|
class TxSerializer {
|
|
9
9
|
static serialize(items) {
|
|
@@ -43,6 +43,18 @@ class TxSerializer {
|
|
|
43
43
|
return new TxClaimGearRewards(params);
|
|
44
44
|
case "TxEnableTokens":
|
|
45
45
|
return new TxEnableTokens(params);
|
|
46
|
+
case "TxUpdateQuota":
|
|
47
|
+
return new TxUpdateQuota(params);
|
|
48
|
+
case "TxGaugeStake":
|
|
49
|
+
return new TxGaugeStake(params);
|
|
50
|
+
case "TxGaugeUnstake":
|
|
51
|
+
return new TxGaugeUnstake(params);
|
|
52
|
+
case "TxGaugeClaim":
|
|
53
|
+
return new TxGaugeClaim(params);
|
|
54
|
+
case "TxGaugeVote":
|
|
55
|
+
return new TxGaugeVote(params);
|
|
56
|
+
case "TxWithdrawCollateral":
|
|
57
|
+
return new TxWithdrawCollateral(params);
|
|
46
58
|
default:
|
|
47
59
|
throw new Error(`Unknown transaction for parsing: ${e.type}`);
|
|
48
60
|
}
|
|
@@ -55,19 +67,14 @@ class TxAddLiquidity extends eventOrTx_1.EVMTx {
|
|
|
55
67
|
underlyingToken;
|
|
56
68
|
pool;
|
|
57
69
|
constructor(opts) {
|
|
58
|
-
super(
|
|
59
|
-
block: opts.block,
|
|
60
|
-
txHash: opts.txHash,
|
|
61
|
-
txStatus: opts.txStatus,
|
|
62
|
-
timestamp: opts.timestamp,
|
|
63
|
-
});
|
|
70
|
+
super(opts);
|
|
64
71
|
this.amount = opts.amount;
|
|
65
72
|
this.underlyingToken = opts.underlyingToken;
|
|
66
73
|
this.pool = opts.pool;
|
|
67
74
|
}
|
|
68
75
|
toString() {
|
|
69
76
|
const [underlyingSymbol, underlyingDecimals] = (0, sdk_gov_1.extractTokenData)(this.underlyingToken);
|
|
70
|
-
return `${(0, contractsRegister_1.getContractName)(this.pool)}: Deposit ${(0,
|
|
77
|
+
return `${(0, contractsRegister_1.getContractName)(this.pool)}: Deposit ${(0, sdk_gov_1.formatBN)(this.amount, underlyingDecimals || 18)} ${underlyingSymbol}`;
|
|
71
78
|
}
|
|
72
79
|
serialize() {
|
|
73
80
|
return {
|
|
@@ -82,19 +89,14 @@ class TxRemoveLiquidity extends eventOrTx_1.EVMTx {
|
|
|
82
89
|
dieselToken;
|
|
83
90
|
pool;
|
|
84
91
|
constructor(opts) {
|
|
85
|
-
super(
|
|
86
|
-
block: opts.block,
|
|
87
|
-
txHash: opts.txHash,
|
|
88
|
-
txStatus: opts.txStatus,
|
|
89
|
-
timestamp: opts.timestamp,
|
|
90
|
-
});
|
|
92
|
+
super(opts);
|
|
91
93
|
this.amount = opts.amount;
|
|
92
94
|
this.dieselToken = opts.dieselToken;
|
|
93
95
|
this.pool = opts.pool;
|
|
94
96
|
}
|
|
95
97
|
toString() {
|
|
96
98
|
const [dSymbol, dDecimals] = (0, sdk_gov_1.extractTokenData)(this.dieselToken);
|
|
97
|
-
return `${(0, contractsRegister_1.getContractName)(this.pool)}: Withdraw ${(0,
|
|
99
|
+
return `${(0, contractsRegister_1.getContractName)(this.pool)}: Withdraw ${(0, sdk_gov_1.formatBN)(this.amount, dDecimals || 18)} ${dSymbol}`;
|
|
98
100
|
}
|
|
99
101
|
serialize() {
|
|
100
102
|
return {
|
|
@@ -113,12 +115,7 @@ class TXSwap extends eventOrTx_1.EVMTx {
|
|
|
113
115
|
tokenTo;
|
|
114
116
|
creditManager;
|
|
115
117
|
constructor(opts) {
|
|
116
|
-
super(
|
|
117
|
-
block: opts.block,
|
|
118
|
-
txHash: opts.txHash,
|
|
119
|
-
txStatus: opts.txStatus,
|
|
120
|
-
timestamp: opts.timestamp,
|
|
121
|
-
});
|
|
118
|
+
super(opts);
|
|
122
119
|
this.protocol = opts.protocol;
|
|
123
120
|
this.operation = opts.operation;
|
|
124
121
|
this.amountFrom = opts.amountFrom;
|
|
@@ -131,10 +128,10 @@ class TXSwap extends eventOrTx_1.EVMTx {
|
|
|
131
128
|
let toPart = "";
|
|
132
129
|
if (this.tokenTo && this.amountTo) {
|
|
133
130
|
const [toSymbol, toDecimals] = (0, sdk_gov_1.extractTokenData)(this.tokenTo);
|
|
134
|
-
toPart = ` ⇒ ${(0,
|
|
131
|
+
toPart = ` ⇒ ${(0, sdk_gov_1.formatBN)(this.amountTo, toDecimals || 18)} ${toSymbol}`;
|
|
135
132
|
}
|
|
136
133
|
const [fromSymbol, fromDecimals] = (0, sdk_gov_1.extractTokenData)(this.tokenFrom);
|
|
137
|
-
return `Credit account ${(0, contractsRegister_1.getContractName)(this.creditManager)}: ${this.operation} ${(0,
|
|
134
|
+
return `Credit account ${(0, contractsRegister_1.getContractName)(this.creditManager)}: ${this.operation} ${(0, sdk_gov_1.formatBN)(this.amountFrom, fromDecimals || 18)} ${fromSymbol} ${toPart} on ${(0, contractsRegister_1.getContractName)(this.protocol)}`;
|
|
138
135
|
}
|
|
139
136
|
serialize() {
|
|
140
137
|
return {
|
|
@@ -149,19 +146,14 @@ class TxAddCollateral extends eventOrTx_1.EVMTx {
|
|
|
149
146
|
addedToken;
|
|
150
147
|
creditManager;
|
|
151
148
|
constructor(opts) {
|
|
152
|
-
super(
|
|
153
|
-
block: opts.block,
|
|
154
|
-
txHash: opts.txHash,
|
|
155
|
-
txStatus: opts.txStatus,
|
|
156
|
-
timestamp: opts.timestamp,
|
|
157
|
-
});
|
|
149
|
+
super(opts);
|
|
158
150
|
this.amount = opts.amount;
|
|
159
151
|
this.addedToken = opts.addedToken;
|
|
160
152
|
this.creditManager = opts.creditManager;
|
|
161
153
|
}
|
|
162
154
|
toString() {
|
|
163
155
|
const [addedSymbol, addedDecimals] = (0, sdk_gov_1.extractTokenData)(this.addedToken);
|
|
164
|
-
return `Credit account ${(0, contractsRegister_1.getContractName)(this.creditManager)}: Added ${(0,
|
|
156
|
+
return `Credit account ${(0, contractsRegister_1.getContractName)(this.creditManager)}: Added ${(0, sdk_gov_1.formatBN)(this.amount, addedDecimals || 18)} ${addedSymbol} as collateral`;
|
|
165
157
|
}
|
|
166
158
|
serialize() {
|
|
167
159
|
return {
|
|
@@ -176,19 +168,14 @@ class TxIncreaseBorrowAmount extends eventOrTx_1.EVMTx {
|
|
|
176
168
|
underlyingToken;
|
|
177
169
|
creditManager;
|
|
178
170
|
constructor(opts) {
|
|
179
|
-
super(
|
|
180
|
-
block: opts.block,
|
|
181
|
-
txHash: opts.txHash,
|
|
182
|
-
txStatus: opts.txStatus,
|
|
183
|
-
timestamp: opts.timestamp,
|
|
184
|
-
});
|
|
171
|
+
super(opts);
|
|
185
172
|
this.amount = opts.amount;
|
|
186
173
|
this.underlyingToken = opts.underlyingToken;
|
|
187
174
|
this.creditManager = opts.creditManager;
|
|
188
175
|
}
|
|
189
176
|
toString() {
|
|
190
177
|
const [tokenSymbol, tokenDecimals] = (0, sdk_gov_1.extractTokenData)(this.underlyingToken);
|
|
191
|
-
return `Credit account ${(0, contractsRegister_1.getContractName)(this.creditManager)}: Borrowed amount was increased for ${(0,
|
|
178
|
+
return `Credit account ${(0, contractsRegister_1.getContractName)(this.creditManager)}: Borrowed amount was increased for ${(0, sdk_gov_1.formatBN)(this.amount, tokenDecimals || 18)} ${tokenSymbol}`;
|
|
192
179
|
}
|
|
193
180
|
serialize() {
|
|
194
181
|
return {
|
|
@@ -203,19 +190,14 @@ class TxDecreaseBorrowAmount extends eventOrTx_1.EVMTx {
|
|
|
203
190
|
underlyingToken;
|
|
204
191
|
creditManager;
|
|
205
192
|
constructor(opts) {
|
|
206
|
-
super(
|
|
207
|
-
block: opts.block,
|
|
208
|
-
txHash: opts.txHash,
|
|
209
|
-
txStatus: opts.txStatus,
|
|
210
|
-
timestamp: opts.timestamp,
|
|
211
|
-
});
|
|
193
|
+
super(opts);
|
|
212
194
|
this.amount = opts.amount;
|
|
213
195
|
this.underlyingToken = opts.underlyingToken;
|
|
214
196
|
this.creditManager = opts.creditManager;
|
|
215
197
|
}
|
|
216
198
|
toString() {
|
|
217
199
|
const [tokenSymbol, tokenDecimals] = (0, sdk_gov_1.extractTokenData)(this.underlyingToken);
|
|
218
|
-
return `Credit account ${(0, contractsRegister_1.getContractName)(this.creditManager)}: Borrowed amount was decreased for ${(0,
|
|
200
|
+
return `Credit account ${(0, contractsRegister_1.getContractName)(this.creditManager)}: Borrowed amount was decreased for ${(0, sdk_gov_1.formatBN)(this.amount, tokenDecimals || 18)} ${tokenSymbol}`;
|
|
219
201
|
}
|
|
220
202
|
serialize() {
|
|
221
203
|
return {
|
|
@@ -231,12 +213,7 @@ class TxOpenAccount extends eventOrTx_1.EVMTx {
|
|
|
231
213
|
leverage;
|
|
232
214
|
creditManager;
|
|
233
215
|
constructor(opts) {
|
|
234
|
-
super(
|
|
235
|
-
block: opts.block,
|
|
236
|
-
txHash: opts.txHash,
|
|
237
|
-
txStatus: opts.txStatus,
|
|
238
|
-
timestamp: opts.timestamp,
|
|
239
|
-
});
|
|
216
|
+
super(opts);
|
|
240
217
|
this.amount = opts.amount;
|
|
241
218
|
this.underlyingToken = opts.underlyingToken;
|
|
242
219
|
this.leverage = opts.leverage;
|
|
@@ -244,8 +221,8 @@ class TxOpenAccount extends eventOrTx_1.EVMTx {
|
|
|
244
221
|
}
|
|
245
222
|
toString() {
|
|
246
223
|
const [tokenSymbol, tokenDecimals] = (0, sdk_gov_1.extractTokenData)(this.underlyingToken);
|
|
247
|
-
return `Credit account ${(0, contractsRegister_1.getContractName)(this.creditManager)}: opening ${(0,
|
|
248
|
-
${(0,
|
|
224
|
+
return `Credit account ${(0, contractsRegister_1.getContractName)(this.creditManager)}: opening ${(0, sdk_gov_1.formatBN)(this.amount, tokenDecimals || 18)} ${tokenSymbol} x ${this.leverage.toFixed(2)} ⇒
|
|
225
|
+
${(0, sdk_gov_1.formatBN)((this.amount *
|
|
249
226
|
BigInt(Math.floor(this.leverage * Number(sdk_gov_1.LEVERAGE_DECIMALS)))) /
|
|
250
227
|
sdk_gov_1.LEVERAGE_DECIMALS, tokenDecimals || 18)} ${tokenSymbol}`;
|
|
251
228
|
}
|
|
@@ -263,12 +240,7 @@ class TxOpenMultitokenAccount extends eventOrTx_1.EVMTx {
|
|
|
263
240
|
underlyingToken;
|
|
264
241
|
assets;
|
|
265
242
|
constructor(opts) {
|
|
266
|
-
super(
|
|
267
|
-
block: opts.block,
|
|
268
|
-
txHash: opts.txHash,
|
|
269
|
-
txStatus: opts.txStatus,
|
|
270
|
-
timestamp: opts.timestamp,
|
|
271
|
-
});
|
|
243
|
+
super(opts);
|
|
272
244
|
this.borrowedAmount = opts.borrowedAmount;
|
|
273
245
|
this.underlyingToken = opts.underlyingToken;
|
|
274
246
|
this.creditManager = opts.creditManager;
|
|
@@ -282,7 +254,7 @@ class TxOpenMultitokenAccount extends eventOrTx_1.EVMTx {
|
|
|
282
254
|
return acc;
|
|
283
255
|
}, []);
|
|
284
256
|
const [symbol, underlyingDecimals] = (0, sdk_gov_1.extractTokenData)(this.underlyingToken);
|
|
285
|
-
return `Credit account ${(0, contractsRegister_1.getContractName)(this.creditManager)}: opening. Borrowed amount: ${(0,
|
|
257
|
+
return `Credit account ${(0, contractsRegister_1.getContractName)(this.creditManager)}: opening. Borrowed amount: ${(0, sdk_gov_1.formatBN)(this.borrowedAmount, underlyingDecimals || 18)} ${symbol}; assets: ${assetSymbols.join(", ")}`;
|
|
286
258
|
}
|
|
287
259
|
serialize() {
|
|
288
260
|
return {
|
|
@@ -295,12 +267,7 @@ exports.TxOpenMultitokenAccount = TxOpenMultitokenAccount;
|
|
|
295
267
|
class TxClaimReward extends eventOrTx_1.EVMTx {
|
|
296
268
|
contracts;
|
|
297
269
|
constructor(opts) {
|
|
298
|
-
super(
|
|
299
|
-
block: opts.block,
|
|
300
|
-
txHash: opts.txHash,
|
|
301
|
-
txStatus: opts.txStatus,
|
|
302
|
-
timestamp: opts.timestamp,
|
|
303
|
-
});
|
|
270
|
+
super(opts);
|
|
304
271
|
this.contracts = opts.contracts;
|
|
305
272
|
}
|
|
306
273
|
toString() {
|
|
@@ -319,14 +286,6 @@ class TxClaimReward extends eventOrTx_1.EVMTx {
|
|
|
319
286
|
}
|
|
320
287
|
exports.TxClaimReward = TxClaimReward;
|
|
321
288
|
class TxClaimNFT extends eventOrTx_1.EVMTx {
|
|
322
|
-
constructor(opts) {
|
|
323
|
-
super({
|
|
324
|
-
block: opts.block,
|
|
325
|
-
txHash: opts.txHash,
|
|
326
|
-
txStatus: opts.txStatus,
|
|
327
|
-
timestamp: opts.timestamp,
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
289
|
toString() {
|
|
331
290
|
return `NFT claimed`;
|
|
332
291
|
}
|
|
@@ -342,18 +301,13 @@ class TxClaimGearRewards extends eventOrTx_1.EVMTx {
|
|
|
342
301
|
token;
|
|
343
302
|
amount;
|
|
344
303
|
constructor(opts) {
|
|
345
|
-
super(
|
|
346
|
-
block: opts.block,
|
|
347
|
-
txHash: opts.txHash,
|
|
348
|
-
txStatus: opts.txStatus,
|
|
349
|
-
timestamp: opts.timestamp,
|
|
350
|
-
});
|
|
304
|
+
super(opts);
|
|
351
305
|
this.amount = opts.amount;
|
|
352
306
|
this.token = opts.token;
|
|
353
307
|
}
|
|
354
308
|
toString() {
|
|
355
309
|
const [symbol, decimals] = (0, sdk_gov_1.extractTokenData)(this.token);
|
|
356
|
-
return `GEAR Rewards claimed: ${(0,
|
|
310
|
+
return `GEAR Rewards claimed: ${(0, sdk_gov_1.formatBN)(this.amount, decimals || 18)} ${symbol} `;
|
|
357
311
|
}
|
|
358
312
|
serialize() {
|
|
359
313
|
return {
|
|
@@ -366,12 +320,7 @@ exports.TxClaimGearRewards = TxClaimGearRewards;
|
|
|
366
320
|
class TxRepayAccount extends eventOrTx_1.EVMTx {
|
|
367
321
|
creditManager;
|
|
368
322
|
constructor(opts) {
|
|
369
|
-
super(
|
|
370
|
-
block: opts.block,
|
|
371
|
-
txHash: opts.txHash,
|
|
372
|
-
txStatus: opts.txStatus,
|
|
373
|
-
timestamp: opts.timestamp,
|
|
374
|
-
});
|
|
323
|
+
super(opts);
|
|
375
324
|
this.creditManager = opts.creditManager;
|
|
376
325
|
}
|
|
377
326
|
toString() {
|
|
@@ -388,12 +337,7 @@ exports.TxRepayAccount = TxRepayAccount;
|
|
|
388
337
|
class TxCloseAccount extends eventOrTx_1.EVMTx {
|
|
389
338
|
creditManager;
|
|
390
339
|
constructor(opts) {
|
|
391
|
-
super(
|
|
392
|
-
block: opts.block,
|
|
393
|
-
txHash: opts.txHash,
|
|
394
|
-
txStatus: opts.txStatus,
|
|
395
|
-
timestamp: opts.timestamp,
|
|
396
|
-
});
|
|
340
|
+
super(opts);
|
|
397
341
|
this.creditManager = opts.creditManager;
|
|
398
342
|
}
|
|
399
343
|
toString() {
|
|
@@ -410,12 +354,7 @@ exports.TxCloseAccount = TxCloseAccount;
|
|
|
410
354
|
class TxApprove extends eventOrTx_1.EVMTx {
|
|
411
355
|
token;
|
|
412
356
|
constructor(opts) {
|
|
413
|
-
super(
|
|
414
|
-
block: opts.block,
|
|
415
|
-
txHash: opts.txHash,
|
|
416
|
-
txStatus: opts.txStatus,
|
|
417
|
-
timestamp: opts.timestamp,
|
|
418
|
-
});
|
|
357
|
+
super(opts);
|
|
419
358
|
this.token = opts.token;
|
|
420
359
|
}
|
|
421
360
|
toString() {
|
|
@@ -435,12 +374,7 @@ class TxEnableTokens extends eventOrTx_1.EVMTx {
|
|
|
435
374
|
disabledTokens;
|
|
436
375
|
creditManager;
|
|
437
376
|
constructor(opts) {
|
|
438
|
-
super(
|
|
439
|
-
block: opts.block,
|
|
440
|
-
txHash: opts.txHash,
|
|
441
|
-
txStatus: opts.txStatus,
|
|
442
|
-
timestamp: opts.timestamp,
|
|
443
|
-
});
|
|
377
|
+
super(opts);
|
|
444
378
|
this.enabledTokens = opts.enabledTokens;
|
|
445
379
|
this.disabledTokens = opts.disabledTokens;
|
|
446
380
|
this.creditManager = opts.creditManager;
|
|
@@ -470,3 +404,126 @@ class TxEnableTokens extends eventOrTx_1.EVMTx {
|
|
|
470
404
|
}
|
|
471
405
|
}
|
|
472
406
|
exports.TxEnableTokens = TxEnableTokens;
|
|
407
|
+
class TxUpdateQuota extends eventOrTx_1.EVMTx {
|
|
408
|
+
updatedQuotas;
|
|
409
|
+
underlyingToken;
|
|
410
|
+
creditManager;
|
|
411
|
+
constructor(opts) {
|
|
412
|
+
super(opts);
|
|
413
|
+
this.updatedQuotas = opts.updatedQuotas;
|
|
414
|
+
this.creditManager = opts.creditManager;
|
|
415
|
+
this.underlyingToken = opts.underlyingToken;
|
|
416
|
+
}
|
|
417
|
+
toString() {
|
|
418
|
+
const [, underlyingDecimals] = (0, sdk_gov_1.extractTokenData)(this.underlyingToken);
|
|
419
|
+
const quota = this.updatedQuotas.map(({ token, balance }) => {
|
|
420
|
+
const [tokenSymbol] = (0, sdk_gov_1.extractTokenData)(token);
|
|
421
|
+
const sign = balance < 0 ? "-" : "";
|
|
422
|
+
const amountString = (0, sdk_gov_1.formatBN)(math_1.BigIntMath.abs(balance), underlyingDecimals || 18);
|
|
423
|
+
return `${tokenSymbol} by ${sign}${amountString}`;
|
|
424
|
+
});
|
|
425
|
+
return `Credit account ${(0, contractsRegister_1.getContractName)(this.creditManager)} quota updated: ${quota.join("; ")}`;
|
|
426
|
+
}
|
|
427
|
+
serialize() {
|
|
428
|
+
return {
|
|
429
|
+
type: "TxUpdateQuota",
|
|
430
|
+
content: JSON.stringify(this),
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
exports.TxUpdateQuota = TxUpdateQuota;
|
|
435
|
+
class TxGaugeStake extends eventOrTx_1.EVMTx {
|
|
436
|
+
amount;
|
|
437
|
+
constructor(opts) {
|
|
438
|
+
super(opts);
|
|
439
|
+
this.amount = opts.amount;
|
|
440
|
+
}
|
|
441
|
+
toString() {
|
|
442
|
+
const tokenDecimals = sdk_gov_1.decimals.GEAR;
|
|
443
|
+
const amountString = (0, sdk_gov_1.formatBN)(math_1.BigIntMath.abs(this.amount), tokenDecimals);
|
|
444
|
+
return `Gauge: staked ${amountString} GEAR`;
|
|
445
|
+
}
|
|
446
|
+
serialize() {
|
|
447
|
+
return {
|
|
448
|
+
type: "TxGaugeStake",
|
|
449
|
+
content: JSON.stringify(this),
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
exports.TxGaugeStake = TxGaugeStake;
|
|
454
|
+
class TxGaugeUnstake extends eventOrTx_1.EVMTx {
|
|
455
|
+
amount;
|
|
456
|
+
constructor(opts) {
|
|
457
|
+
super(opts);
|
|
458
|
+
this.amount = opts.amount;
|
|
459
|
+
}
|
|
460
|
+
toString() {
|
|
461
|
+
const tokenDecimals = sdk_gov_1.decimals.GEAR;
|
|
462
|
+
const amountString = (0, sdk_gov_1.formatBN)(math_1.BigIntMath.abs(this.amount), tokenDecimals);
|
|
463
|
+
return `Gauge: unstaked ${amountString} GEAR`;
|
|
464
|
+
}
|
|
465
|
+
serialize() {
|
|
466
|
+
return {
|
|
467
|
+
type: "TxGaugeUnstake",
|
|
468
|
+
content: JSON.stringify(this),
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
exports.TxGaugeUnstake = TxGaugeUnstake;
|
|
473
|
+
class TxGaugeClaim extends eventOrTx_1.EVMTx {
|
|
474
|
+
toString() {
|
|
475
|
+
return `Gauge: withdrawals claimed`;
|
|
476
|
+
}
|
|
477
|
+
serialize() {
|
|
478
|
+
return {
|
|
479
|
+
type: "TxGaugeClaim",
|
|
480
|
+
content: JSON.stringify(this),
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
exports.TxGaugeClaim = TxGaugeClaim;
|
|
485
|
+
class TxGaugeVote extends eventOrTx_1.EVMTx {
|
|
486
|
+
tokens;
|
|
487
|
+
constructor(opts) {
|
|
488
|
+
super(opts);
|
|
489
|
+
this.tokens = opts.tokens;
|
|
490
|
+
}
|
|
491
|
+
toString() {
|
|
492
|
+
const votes = this.tokens.map(({ token }) => {
|
|
493
|
+
const [tokenSymbol] = (0, sdk_gov_1.extractTokenData)(token);
|
|
494
|
+
return tokenSymbol;
|
|
495
|
+
});
|
|
496
|
+
return `Gauge: voted for ${votes.join(", ")}`;
|
|
497
|
+
}
|
|
498
|
+
serialize() {
|
|
499
|
+
return {
|
|
500
|
+
type: "TxGaugeVote",
|
|
501
|
+
content: JSON.stringify(this),
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
exports.TxGaugeVote = TxGaugeVote;
|
|
506
|
+
class TxWithdrawCollateral extends eventOrTx_1.EVMTx {
|
|
507
|
+
amount;
|
|
508
|
+
token;
|
|
509
|
+
to;
|
|
510
|
+
creditManager;
|
|
511
|
+
constructor(opts) {
|
|
512
|
+
super(opts);
|
|
513
|
+
this.amount = opts.amount;
|
|
514
|
+
this.token = opts.token;
|
|
515
|
+
this.to = opts.to;
|
|
516
|
+
this.creditManager = opts.creditManager;
|
|
517
|
+
}
|
|
518
|
+
toString() {
|
|
519
|
+
const [symbol, decimals] = (0, sdk_gov_1.extractTokenData)(this.token);
|
|
520
|
+
return `Credit account ${(0, contractsRegister_1.getContractName)(this.creditManager)}: withdrawn ${(0, sdk_gov_1.formatBN)(this.amount, decimals || 18)} ${symbol}`;
|
|
521
|
+
}
|
|
522
|
+
serialize() {
|
|
523
|
+
return {
|
|
524
|
+
type: "TxWithdrawCollateral",
|
|
525
|
+
content: JSON.stringify(this),
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
exports.TxWithdrawCollateral = TxWithdrawCollateral;
|
package/lib/index.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export * from "./core/creditSession";
|
|
|
7
7
|
export * from "./core/errors";
|
|
8
8
|
export * from "./core/eventOrTx";
|
|
9
9
|
export * from "./core/events";
|
|
10
|
+
export * from "./core/gauge";
|
|
11
|
+
export * from "./core/gaugeMath";
|
|
10
12
|
export * from "./core/pool";
|
|
11
13
|
export * from "./core/rewardClaimer";
|
|
12
14
|
export * from "./core/strategy";
|
|
@@ -19,6 +21,7 @@ export * from "./pathfinder/pathfinder";
|
|
|
19
21
|
export * from "./payload/creditAccount";
|
|
20
22
|
export * from "./payload/creditManager";
|
|
21
23
|
export * from "./payload/creditSession";
|
|
24
|
+
export * from "./payload/gauge";
|
|
22
25
|
export * from "./payload/graphPayload";
|
|
23
26
|
export * from "./payload/pool";
|
|
24
27
|
export * from "./payload/token";
|
package/lib/index.js
CHANGED
|
@@ -24,6 +24,8 @@ __exportStar(require("./core/creditSession"), exports);
|
|
|
24
24
|
__exportStar(require("./core/errors"), exports);
|
|
25
25
|
__exportStar(require("./core/eventOrTx"), exports);
|
|
26
26
|
__exportStar(require("./core/events"), exports);
|
|
27
|
+
__exportStar(require("./core/gauge"), exports);
|
|
28
|
+
__exportStar(require("./core/gaugeMath"), exports);
|
|
27
29
|
__exportStar(require("./core/pool"), exports);
|
|
28
30
|
__exportStar(require("./core/rewardClaimer"), exports);
|
|
29
31
|
__exportStar(require("./core/strategy"), exports);
|
|
@@ -36,6 +38,7 @@ __exportStar(require("./pathfinder/pathfinder"), exports);
|
|
|
36
38
|
__exportStar(require("./payload/creditAccount"), exports);
|
|
37
39
|
__exportStar(require("./payload/creditManager"), exports);
|
|
38
40
|
__exportStar(require("./payload/creditSession"), exports);
|
|
41
|
+
__exportStar(require("./payload/gauge"), exports);
|
|
39
42
|
__exportStar(require("./payload/graphPayload"), exports);
|
|
40
43
|
__exportStar(require("./payload/pool"), exports);
|
|
41
44
|
__exportStar(require("./payload/token"), exports);
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AbstractParser = void 0;
|
|
4
4
|
const sdk_gov_1 = require("@gearbox-protocol/sdk-gov");
|
|
5
5
|
const ethers_1 = require("ethers");
|
|
6
|
-
const formatter_1 = require("../utils/formatter");
|
|
7
6
|
class AbstractParser {
|
|
8
7
|
contract;
|
|
9
8
|
ifc;
|
|
@@ -30,7 +29,7 @@ class AbstractParser {
|
|
|
30
29
|
return symbol;
|
|
31
30
|
}
|
|
32
31
|
formatBN(amount, token) {
|
|
33
|
-
return `${(0,
|
|
32
|
+
return `${(0, sdk_gov_1.formatBN)(amount, sdk_gov_1.decimals[token])} [${(0, sdk_gov_1.toBigInt)(amount).toString()}]`;
|
|
34
33
|
}
|
|
35
34
|
parseToObject(address, calldata) {
|
|
36
35
|
const { functionFragment } = this.parseSelector(calldata);
|
|
@@ -14,21 +14,23 @@ class ConvexBaseRewardPoolAdapterParser extends abstractParser_1.AbstractParser
|
|
|
14
14
|
parse(calldata) {
|
|
15
15
|
const { functionFragment, functionName } = this.parseSelector(calldata);
|
|
16
16
|
switch (functionFragment.name) {
|
|
17
|
-
case "stake":
|
|
18
|
-
case "stakeAll": {
|
|
17
|
+
case "stake": {
|
|
19
18
|
const [amount] = this.decodeFunctionData(functionFragment, calldata);
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
return `${functionName}(amount: ${this.formatAmount(amount)})`;
|
|
20
|
+
}
|
|
21
|
+
case "stakeDiff": {
|
|
22
|
+
const [leftoverAmount] = this.decodeFunctionData(functionFragment, calldata);
|
|
23
|
+
return `${functionName}(leftoverAmount: ${this.formatAmount(leftoverAmount)})`;
|
|
22
24
|
}
|
|
23
25
|
case "withdraw":
|
|
24
26
|
case "withdrawAndUnwrap": {
|
|
25
27
|
const [amount, claim] = this.decodeFunctionData(functionFragment, calldata);
|
|
26
28
|
return `${functionName}(amount: ${this.formatAmount(amount)}, claim: ${claim})`;
|
|
27
29
|
}
|
|
28
|
-
case "
|
|
29
|
-
case "
|
|
30
|
-
const [claim] = this.decodeFunctionData(functionFragment, calldata);
|
|
31
|
-
return `${functionName}(claim: ${claim})`;
|
|
30
|
+
case "withdrawDiff":
|
|
31
|
+
case "withdrawDiffAndUnwrap": {
|
|
32
|
+
const [leftoverAmount, claim] = this.decodeFunctionData(functionFragment, calldata);
|
|
33
|
+
return `${functionName}(leftoverAmount: ${this.formatAmount(leftoverAmount)}, claim: ${claim})`;
|
|
32
34
|
}
|
|
33
35
|
case "rewardRate":
|
|
34
36
|
return `${functionName}()`;
|
|
@@ -10,15 +10,18 @@ describe("ConvexV1BaseRewardPoolAdapterParser test", () => {
|
|
|
10
10
|
const ifc = types_1.IConvexV1BaseRewardPoolAdapter__factory.createInterface();
|
|
11
11
|
let parsed = parser.parse(ifc.encodeFunctionData("stake", [(sdk_gov_1.WAD * 199n) / 10n]));
|
|
12
12
|
(0, chai_1.expect)(parsed).to.be.eq("ConvexV1BaseRewardPoolAdapter[CONVEX_FRAX3CRV_POOL].stake(amount: 19.90 [19900000000000000000])", "Incorrect parse stake");
|
|
13
|
-
parsed = parser.parse(ifc.encodeFunctionData("
|
|
14
|
-
(0, chai_1.expect)(parsed).to.be.eq("ConvexV1BaseRewardPoolAdapter[CONVEX_FRAX3CRV_POOL].
|
|
13
|
+
parsed = parser.parse(ifc.encodeFunctionData("stakeDiff", [(sdk_gov_1.WAD * 199n) / 10n]));
|
|
14
|
+
(0, chai_1.expect)(parsed).to.be.eq("ConvexV1BaseRewardPoolAdapter[CONVEX_FRAX3CRV_POOL].stakeDiff(leftoverAmount: 19.90 [19900000000000000000])", "Incorrect parse stakeDiff");
|
|
15
15
|
parsed = parser.parse(ifc.encodeFunctionData("withdraw", [(sdk_gov_1.WAD * 199n) / 1000n, false]));
|
|
16
16
|
(0, chai_1.expect)(parsed).to.be.eq("ConvexV1BaseRewardPoolAdapter[CONVEX_FRAX3CRV_POOL].withdraw(amount: 0.19 [199000000000000000], claim: false)", "Incorrect parse withdraw");
|
|
17
17
|
parsed = parser.parse(ifc.encodeFunctionData("withdrawAndUnwrap", [(sdk_gov_1.WAD * 2n) / 1000n, true]));
|
|
18
18
|
(0, chai_1.expect)(parsed).to.be.eq("ConvexV1BaseRewardPoolAdapter[CONVEX_FRAX3CRV_POOL].withdrawAndUnwrap(amount: 0.002 [2000000000000000], claim: true)", "Incorrect parse withdrawAndUnwrap");
|
|
19
|
-
parsed = parser.parse(ifc.encodeFunctionData("
|
|
20
|
-
(0, chai_1.expect)(parsed).to.be.eq("ConvexV1BaseRewardPoolAdapter[CONVEX_FRAX3CRV_POOL].
|
|
21
|
-
parsed = parser.parse(ifc.encodeFunctionData("
|
|
22
|
-
|
|
19
|
+
parsed = parser.parse(ifc.encodeFunctionData("withdrawDiff", [(sdk_gov_1.WAD * 2n) / 1000n, false]));
|
|
20
|
+
(0, chai_1.expect)(parsed).to.be.eq("ConvexV1BaseRewardPoolAdapter[CONVEX_FRAX3CRV_POOL].withdrawDiff(leftoverAmount: 0.002 [2000000000000000], claim: false)", "Incorrect parse withdrawDiff");
|
|
21
|
+
parsed = parser.parse(ifc.encodeFunctionData("withdrawDiffAndUnwrap", [
|
|
22
|
+
(sdk_gov_1.WAD * 2n) / 1000n,
|
|
23
|
+
true,
|
|
24
|
+
]));
|
|
25
|
+
(0, chai_1.expect)(parsed).to.be.eq("ConvexV1BaseRewardPoolAdapter[CONVEX_FRAX3CRV_POOL].withdrawDiffAndUnwrap(leftoverAmount: 0.002 [2000000000000000], claim: true)", "Incorrect parse withdrawDiffAndUnwrap");
|
|
23
26
|
});
|
|
24
27
|
});
|
|
@@ -18,17 +18,17 @@ class ConvexBoosterAdapterParser extends abstractParser_1.AbstractParser {
|
|
|
18
18
|
const [pid, amount, stake] = this.decodeFunctionData(functionFragment, calldata);
|
|
19
19
|
return `${functionName}(pid: ${this.formatPid(pid)}, amount: ${this.formatAmount(amount, pid)}, stake: ${stake})`;
|
|
20
20
|
}
|
|
21
|
-
case "
|
|
22
|
-
const [pid, stake] = this.decodeFunctionData(functionFragment, calldata);
|
|
23
|
-
return `${functionName}(pid: ${this.formatPid(pid)}, stake: ${stake})`;
|
|
21
|
+
case "depositDiff": {
|
|
22
|
+
const [pid, leftoverAmount, stake] = this.decodeFunctionData(functionFragment, calldata);
|
|
23
|
+
return `${functionName}(pid: ${this.formatPid(pid)}, leftoverAmount: ${this.formatAmount(leftoverAmount, pid)}, stake: ${stake})`;
|
|
24
24
|
}
|
|
25
25
|
case "withdraw": {
|
|
26
26
|
const [pid, amount] = this.decodeFunctionData(functionFragment, calldata);
|
|
27
27
|
return `${functionName}(pid: ${this.formatPid(pid)}, amount: ${this.formatAmount(amount, pid)})`;
|
|
28
28
|
}
|
|
29
|
-
case "
|
|
30
|
-
const [pid] = this.decodeFunctionData(functionFragment, calldata);
|
|
31
|
-
return `${functionName}(pid: ${this.formatPid(pid)})`;
|
|
29
|
+
case "withdrawDiff": {
|
|
30
|
+
const [pid, leftoverAmount] = this.decodeFunctionData(functionFragment, calldata);
|
|
31
|
+
return `${functionName}(pid: ${this.formatPid(pid)}, leftoverAmount: ${this.formatAmount(leftoverAmount, pid)})`;
|
|
32
32
|
}
|
|
33
33
|
default:
|
|
34
34
|
return `${functionName}: Unknown operation ${functionFragment.name} with calldata ${calldata}`;
|
|
@@ -10,11 +10,11 @@ describe("ConvexV1BaseRewardPoolAdapterParser test", () => {
|
|
|
10
10
|
const ifc = types_1.IConvexV1BoosterAdapter__factory.createInterface();
|
|
11
11
|
let parsed = parser.parse(ifc.encodeFunctionData("deposit", [9, sdk_gov_1.WAD * 19999n, false]));
|
|
12
12
|
(0, chai_1.expect)(parsed).to.be.eq("ConvexV1BoosterAdapter[CONVEX_BOOSTER].deposit(pid: 9 [CONVEX_3CRV_POOL], amount: 19.99K [19999000000000000000000], stake: false)", "Incorrect parse deposit");
|
|
13
|
-
parsed = parser.parse(ifc.encodeFunctionData("
|
|
14
|
-
(0, chai_1.expect)(parsed).to.be.eq("ConvexV1BoosterAdapter[CONVEX_BOOSTER].
|
|
13
|
+
parsed = parser.parse(ifc.encodeFunctionData("depositDiff", [32, sdk_gov_1.WAD * 19999n, true]));
|
|
14
|
+
(0, chai_1.expect)(parsed).to.be.eq("ConvexV1BoosterAdapter[CONVEX_BOOSTER].depositDiff(pid: 32 [CONVEX_FRAX3CRV_POOL], leftoverAmount: 19.99K [19999000000000000000000], stake: true)", "Incorrect parse depositDiff");
|
|
15
15
|
parsed = parser.parse(ifc.encodeFunctionData("withdraw", [9, (sdk_gov_1.WAD * 555n) / 10n]));
|
|
16
16
|
(0, chai_1.expect)(parsed).to.be.eq("ConvexV1BoosterAdapter[CONVEX_BOOSTER].withdraw(pid: 9 [CONVEX_3CRV_POOL], amount: 55.50 [55500000000000000000])", "Incorrect parse withdraw");
|
|
17
|
-
parsed = parser.parse(ifc.encodeFunctionData("
|
|
18
|
-
(0, chai_1.expect)(parsed).to.be.eq("ConvexV1BoosterAdapter[CONVEX_BOOSTER].
|
|
17
|
+
parsed = parser.parse(ifc.encodeFunctionData("withdrawDiff", [32, (sdk_gov_1.WAD * 555n) / 10n]));
|
|
18
|
+
(0, chai_1.expect)(parsed).to.be.eq("ConvexV1BoosterAdapter[CONVEX_BOOSTER].withdrawDiff(pid: 32 [CONVEX_FRAX3CRV_POOL], leftoverAmount: 55.50 [55500000000000000000])", "Incorrect parse withdrawDiff");
|
|
19
19
|
});
|
|
20
20
|
});
|
|
@@ -3,7 +3,8 @@ import { BigNumberish } from "ethers";
|
|
|
3
3
|
import { AbstractParser } from "./abstractParser";
|
|
4
4
|
import { IParser } from "./iParser";
|
|
5
5
|
export declare class CreditFacadeParser extends AbstractParser implements IParser {
|
|
6
|
-
|
|
6
|
+
version: number;
|
|
7
|
+
constructor(token: SupportedToken, version: number);
|
|
7
8
|
parse(calldata: string): string;
|
|
8
9
|
formatAmount(amount: BigNumberish): string;
|
|
9
10
|
}
|