@defisaver/sdk 1.0.0 → 1.0.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/.babelrc +3 -0
- package/.eslintrc.js +100 -0
- package/esm/AccessLists/AaveAccessLists.d.ts +2 -0
- package/esm/AccessLists/AaveAccessLists.js +19 -0
- package/esm/AccessLists/BalancerAccessLists.d.ts +2 -0
- package/esm/AccessLists/BalancerAccessLists.js +14 -0
- package/esm/AccessLists/CompoundAccessLists.d.ts +2 -0
- package/esm/AccessLists/CompoundAccessLists.js +23 -0
- package/esm/AccessLists/DyDxAccessLists.d.ts +2 -0
- package/esm/AccessLists/DyDxAccessLists.js +6 -0
- package/esm/AccessLists/FlashLoanAccessLists.d.ts +2 -0
- package/esm/AccessLists/FlashLoanAccessLists.js +20 -0
- package/esm/AccessLists/GuniAccessLists.d.ts +2 -0
- package/esm/AccessLists/GuniAccessLists.js +10 -0
- package/esm/AccessLists/InstaAccessLists.d.ts +2 -0
- package/esm/AccessLists/InstaAccessLists.js +5 -0
- package/esm/AccessLists/LidoAccessLists.d.ts +2 -0
- package/esm/AccessLists/LidoAccessLists.js +15 -0
- package/esm/AccessLists/LiquityAccessLists.d.ts +2 -0
- package/esm/AccessLists/LiquityAccessLists.js +65 -0
- package/esm/AccessLists/MStableAccessLists.d.ts +2 -0
- package/esm/AccessLists/MStableAccessLists.js +12 -0
- package/esm/AccessLists/MakerAccessLists.d.ts +2 -0
- package/esm/AccessLists/MakerAccessLists.js +34 -0
- package/esm/AccessLists/RariAccessLists.d.ts +2 -0
- package/esm/AccessLists/RariAccessLists.js +8 -0
- package/esm/AccessLists/ReflexerAccessLists.d.ts +2 -0
- package/esm/AccessLists/ReflexerAccessLists.js +42 -0
- package/esm/AccessLists/UniswapAccessLists.d.ts +2 -0
- package/esm/AccessLists/UniswapAccessLists.js +31 -0
- package/esm/AccessLists/UtilsAccessLists.d.ts +2 -0
- package/esm/AccessLists/UtilsAccessLists.js +23 -0
- package/esm/AccessLists/YearnAccessLists.d.ts +2 -0
- package/esm/AccessLists/YearnAccessLists.js +9 -0
- package/esm/AccessLists/index.d.ts +3 -0
- package/esm/AccessLists/index.js +17 -0
- package/esm/src/Action.d.ts +77 -0
- package/esm/src/Action.js +193 -0
- package/esm/src/ActionWithL2.d.ts +20 -0
- package/esm/src/ActionWithL2.js +49 -0
- package/esm/src/DfsWeb3.d.ts +31 -0
- package/esm/src/DfsWeb3.js +124 -0
- package/esm/src/Recipe.d.ts +49 -0
- package/esm/src/Recipe.js +135 -0
- package/esm/src/Strategy.d.ts +19 -0
- package/esm/src/Strategy.js +47 -0
- package/esm/src/abis/Action.json +247 -0
- package/esm/src/abis/DFSProxyRegistry.json +193 -0
- package/esm/src/abis/DsProxy.json +218 -0
- package/esm/src/abis/Erc20.json +222 -0
- package/esm/src/abis/ProxyRegistry.json +65 -0
- package/esm/src/abis/Recipe.json +254 -0
- package/esm/src/actions/aave/AaveBorrowAction.d.ts +18 -0
- package/esm/src/actions/aave/AaveBorrowAction.js +22 -0
- package/esm/src/actions/aave/AaveClaimStkAaveAction.d.ts +15 -0
- package/esm/src/actions/aave/AaveClaimStkAaveAction.js +23 -0
- package/esm/src/actions/aave/AaveCollateralSwitchAction.d.ts +15 -0
- package/esm/src/actions/aave/AaveCollateralSwitchAction.js +18 -0
- package/esm/src/actions/aave/AavePaybackAction.d.ts +22 -0
- package/esm/src/actions/aave/AavePaybackAction.js +38 -0
- package/esm/src/actions/aave/AaveSupplyAction.d.ts +22 -0
- package/esm/src/actions/aave/AaveSupplyAction.js +45 -0
- package/esm/src/actions/aave/AaveWithdrawAction.d.ts +16 -0
- package/esm/src/actions/aave/AaveWithdrawAction.js +20 -0
- package/esm/src/actions/aave/index.d.ts +6 -0
- package/esm/src/actions/aave/index.js +6 -0
- package/esm/src/actions/aaveV3/AaveV3ATokenPaybackAction.d.ts +25 -0
- package/esm/src/actions/aaveV3/AaveV3ATokenPaybackAction.js +64 -0
- package/esm/src/actions/aaveV3/AaveV3BorrowAction.d.ts +21 -0
- package/esm/src/actions/aaveV3/AaveV3BorrowAction.js +59 -0
- package/esm/src/actions/aaveV3/AaveV3ClaimRewardsAction.d.ts +18 -0
- package/esm/src/actions/aaveV3/AaveV3ClaimRewardsAction.js +40 -0
- package/esm/src/actions/aaveV3/AaveV3CollateralSwitchAction.d.ts +18 -0
- package/esm/src/actions/aaveV3/AaveV3CollateralSwitchAction.js +39 -0
- package/esm/src/actions/aaveV3/AaveV3PaybackAction.d.ts +27 -0
- package/esm/src/actions/aaveV3/AaveV3PaybackAction.js +77 -0
- package/esm/src/actions/aaveV3/AaveV3SetEModeAction.d.ts +16 -0
- package/esm/src/actions/aaveV3/AaveV3SetEModeAction.js +33 -0
- package/esm/src/actions/aaveV3/AaveV3SupplyAction.d.ts +27 -0
- package/esm/src/actions/aaveV3/AaveV3SupplyAction.js +77 -0
- package/esm/src/actions/aaveV3/AaveV3SwapBorrowRateModeAction.d.ts +18 -0
- package/esm/src/actions/aaveV3/AaveV3SwapBorrowRateModeAction.js +38 -0
- package/esm/src/actions/aaveV3/AaveV3WithdrawAction.d.ts +18 -0
- package/esm/src/actions/aaveV3/AaveV3WithdrawAction.js +45 -0
- package/esm/src/actions/aaveV3/index.d.ts +9 -0
- package/esm/src/actions/aaveV3/index.js +9 -0
- package/esm/src/actions/balancer/BalancerV2ClaimAction.d.ts +20 -0
- package/esm/src/actions/balancer/BalancerV2ClaimAction.js +49 -0
- package/esm/src/actions/balancer/BalancerV2SupplyAction.d.ts +22 -0
- package/esm/src/actions/balancer/BalancerV2SupplyAction.js +52 -0
- package/esm/src/actions/balancer/BalancerV2WithdrawAction.d.ts +24 -0
- package/esm/src/actions/balancer/BalancerV2WithdrawAction.js +56 -0
- package/esm/src/actions/balancer/index.d.ts +3 -0
- package/esm/src/actions/balancer/index.js +3 -0
- package/esm/src/actions/basic/AutomationV2Unsub.d.ts +9 -0
- package/esm/src/actions/basic/AutomationV2Unsub.js +11 -0
- package/esm/src/actions/basic/ChangeProxyOwnerAction.d.ts +13 -0
- package/esm/src/actions/basic/ChangeProxyOwnerAction.js +15 -0
- package/esm/src/actions/basic/GasFeeAction.d.ts +14 -0
- package/esm/src/actions/basic/GasFeeAction.js +21 -0
- package/esm/src/actions/basic/GasFeeActionL2.d.ts +15 -0
- package/esm/src/actions/basic/GasFeeActionL2.js +22 -0
- package/esm/src/actions/basic/PullTokenAction.d.ts +19 -0
- package/esm/src/actions/basic/PullTokenAction.js +41 -0
- package/esm/src/actions/basic/SellAction.d.ts +23 -0
- package/esm/src/actions/basic/SellAction.js +61 -0
- package/esm/src/actions/basic/SendTokenAction.d.ts +15 -0
- package/esm/src/actions/basic/SendTokenAction.js +23 -0
- package/esm/src/actions/basic/SendTokenAndUnwrapAction.d.ts +15 -0
- package/esm/src/actions/basic/SendTokenAndUnwrapAction.js +23 -0
- package/esm/src/actions/basic/SubInputsAction.d.ts +10 -0
- package/esm/src/actions/basic/SubInputsAction.js +15 -0
- package/esm/src/actions/basic/SumInputsAction.d.ts +10 -0
- package/esm/src/actions/basic/SumInputsAction.js +15 -0
- package/esm/src/actions/basic/ToggleSubAction.d.ts +14 -0
- package/esm/src/actions/basic/ToggleSubAction.js +16 -0
- package/esm/src/actions/basic/TokenBalanceAction.d.ts +8 -0
- package/esm/src/actions/basic/TokenBalanceAction.js +13 -0
- package/esm/src/actions/basic/TransferNFTAction.d.ts +8 -0
- package/esm/src/actions/basic/TransferNFTAction.js +17 -0
- package/esm/src/actions/basic/UnwrapEthAction.d.ts +15 -0
- package/esm/src/actions/basic/UnwrapEthAction.js +30 -0
- package/esm/src/actions/basic/UpdateSubAction.d.ts +14 -0
- package/esm/src/actions/basic/UpdateSubAction.js +16 -0
- package/esm/src/actions/basic/WrapEthAction.d.ts +15 -0
- package/esm/src/actions/basic/WrapEthAction.js +36 -0
- package/esm/src/actions/basic/index.d.ts +16 -0
- package/esm/src/actions/basic/index.js +16 -0
- package/esm/src/actions/checkers/AaveV3RatioCheckAction.d.ts +14 -0
- package/esm/src/actions/checkers/AaveV3RatioCheckAction.js +20 -0
- package/esm/src/actions/checkers/CompoundV3RatioCheckAction.d.ts +16 -0
- package/esm/src/actions/checkers/CompoundV3RatioCheckAction.js +24 -0
- package/esm/src/actions/checkers/MakerRatioCheckAction.d.ts +17 -0
- package/esm/src/actions/checkers/MakerRatioCheckAction.js +25 -0
- package/esm/src/actions/checkers/index.d.ts +3 -0
- package/esm/src/actions/checkers/index.js +3 -0
- package/esm/src/actions/chickenBonds/CBChickenInAction.d.ts +14 -0
- package/esm/src/actions/chickenBonds/CBChickenInAction.js +18 -0
- package/esm/src/actions/chickenBonds/CBChickenOutAction.d.ts +15 -0
- package/esm/src/actions/chickenBonds/CBChickenOutAction.js +19 -0
- package/esm/src/actions/chickenBonds/CBCreateAction.d.ts +18 -0
- package/esm/src/actions/chickenBonds/CBCreateAction.js +32 -0
- package/esm/src/actions/chickenBonds/CBRedeemAction.d.ts +20 -0
- package/esm/src/actions/chickenBonds/CBRedeemAction.js +35 -0
- package/esm/src/actions/chickenBonds/index.d.ts +4 -0
- package/esm/src/actions/chickenBonds/index.js +4 -0
- package/esm/src/actions/compound/CompoundBorrowAction.d.ts +15 -0
- package/esm/src/actions/compound/CompoundBorrowAction.js +19 -0
- package/esm/src/actions/compound/CompoundClaimAction.d.ts +16 -0
- package/esm/src/actions/compound/CompoundClaimAction.js +24 -0
- package/esm/src/actions/compound/CompoundCollateralSwitchAction.d.ts +10 -0
- package/esm/src/actions/compound/CompoundCollateralSwitchAction.js +12 -0
- package/esm/src/actions/compound/CompoundGetDebtAction.d.ts +8 -0
- package/esm/src/actions/compound/CompoundGetDebtAction.js +13 -0
- package/esm/src/actions/compound/CompoundPaybackAction.d.ts +20 -0
- package/esm/src/actions/compound/CompoundPaybackAction.js +38 -0
- package/esm/src/actions/compound/CompoundSupplyAction.d.ts +20 -0
- package/esm/src/actions/compound/CompoundSupplyAction.js +43 -0
- package/esm/src/actions/compound/CompoundWithdrawAction.d.ts +15 -0
- package/esm/src/actions/compound/CompoundWithdrawAction.js +19 -0
- package/esm/src/actions/compound/index.d.ts +7 -0
- package/esm/src/actions/compound/index.js +7 -0
- package/esm/src/actions/compoundV3/CompoundV3AllowAction.d.ts +15 -0
- package/esm/src/actions/compoundV3/CompoundV3AllowAction.js +24 -0
- package/esm/src/actions/compoundV3/CompoundV3BorrowAction.d.ts +16 -0
- package/esm/src/actions/compoundV3/CompoundV3BorrowAction.js +26 -0
- package/esm/src/actions/compoundV3/CompoundV3ClaimAction.d.ts +16 -0
- package/esm/src/actions/compoundV3/CompoundV3ClaimAction.js +27 -0
- package/esm/src/actions/compoundV3/CompoundV3PaybackAction.d.ts +22 -0
- package/esm/src/actions/compoundV3/CompoundV3PaybackAction.js +48 -0
- package/esm/src/actions/compoundV3/CompoundV3SupplyAction.d.ts +22 -0
- package/esm/src/actions/compoundV3/CompoundV3SupplyAction.js +45 -0
- package/esm/src/actions/compoundV3/CompoundV3TransferAction.d.ts +17 -0
- package/esm/src/actions/compoundV3/CompoundV3TransferAction.js +30 -0
- package/esm/src/actions/compoundV3/CompoundV3WithdrawAction.d.ts +17 -0
- package/esm/src/actions/compoundV3/CompoundV3WithdrawAction.js +29 -0
- package/esm/src/actions/compoundV3/index.d.ts +7 -0
- package/esm/src/actions/compoundV3/index.js +7 -0
- package/esm/src/actions/convex/ConvexClaimAction.d.ts +17 -0
- package/esm/src/actions/convex/ConvexClaimAction.js +59 -0
- package/esm/src/actions/convex/ConvexDepositAction.d.ts +22 -0
- package/esm/src/actions/convex/ConvexDepositAction.js +66 -0
- package/esm/src/actions/convex/ConvexWithdrawAction.d.ts +22 -0
- package/esm/src/actions/convex/ConvexWithdrawAction.js +63 -0
- package/esm/src/actions/convex/index.d.ts +3 -0
- package/esm/src/actions/convex/index.js +3 -0
- package/esm/src/actions/curve/CurveClaimFeesAction.d.ts +13 -0
- package/esm/src/actions/curve/CurveClaimFeesAction.js +22 -0
- package/esm/src/actions/curve/CurveDepositAction.d.ts +18 -0
- package/esm/src/actions/curve/CurveDepositAction.js +78 -0
- package/esm/src/actions/curve/CurveGaugeDepositAction.d.ts +20 -0
- package/esm/src/actions/curve/CurveGaugeDepositAction.js +40 -0
- package/esm/src/actions/curve/CurveGaugeWithdrawAction.d.ts +14 -0
- package/esm/src/actions/curve/CurveGaugeWithdrawAction.js +22 -0
- package/esm/src/actions/curve/CurveMintCrvAction.d.ts +12 -0
- package/esm/src/actions/curve/CurveMintCrvAction.js +19 -0
- package/esm/src/actions/curve/CurveStethPoolDepositAction.d.ts +16 -0
- package/esm/src/actions/curve/CurveStethPoolDepositAction.js +27 -0
- package/esm/src/actions/curve/CurveStethPoolWithdrawAction.d.ts +17 -0
- package/esm/src/actions/curve/CurveStethPoolWithdrawAction.js +28 -0
- package/esm/src/actions/curve/CurveSwapAction.d.ts +22 -0
- package/esm/src/actions/curve/CurveSwapAction.js +43 -0
- package/esm/src/actions/curve/CurveWithdrawAction.d.ts +22 -0
- package/esm/src/actions/curve/CurveWithdrawAction.js +72 -0
- package/esm/src/actions/curve/index.d.ts +9 -0
- package/esm/src/actions/curve/index.js +9 -0
- package/esm/src/actions/dydx/DyDxWithdrawAction.d.ts +15 -0
- package/esm/src/actions/dydx/DyDxWithdrawAction.js +19 -0
- package/esm/src/actions/dydx/index.d.ts +1 -0
- package/esm/src/actions/dydx/index.js +1 -0
- package/esm/src/actions/flashloan/AaveV2FlashLoanAction.d.ts +18 -0
- package/esm/src/actions/flashloan/AaveV2FlashLoanAction.js +20 -0
- package/esm/src/actions/flashloan/AaveV2FlashLoanPaybackAction.d.ts +14 -0
- package/esm/src/actions/flashloan/AaveV2FlashLoanPaybackAction.js +16 -0
- package/esm/src/actions/flashloan/AaveV3FlashLoanAction.d.ts +18 -0
- package/esm/src/actions/flashloan/AaveV3FlashLoanAction.js +20 -0
- package/esm/src/actions/flashloan/AaveV3FlashLoanPaybackAction.d.ts +14 -0
- package/esm/src/actions/flashloan/AaveV3FlashLoanPaybackAction.js +16 -0
- package/esm/src/actions/flashloan/BalancerFlashLoanAction.d.ts +16 -0
- package/esm/src/actions/flashloan/BalancerFlashLoanAction.js +18 -0
- package/esm/src/actions/flashloan/BalancerFlashLoanPaybackAction.d.ts +14 -0
- package/esm/src/actions/flashloan/BalancerFlashLoanPaybackAction.js +16 -0
- package/esm/src/actions/flashloan/DyDxFlashLoanAction.d.ts +16 -0
- package/esm/src/actions/flashloan/DyDxFlashLoanAction.js +18 -0
- package/esm/src/actions/flashloan/DyDxFlashLoanPaybackAction.d.ts +14 -0
- package/esm/src/actions/flashloan/DyDxFlashLoanPaybackAction.js +16 -0
- package/esm/src/actions/flashloan/EulerFlashLoanAction.d.ts +16 -0
- package/esm/src/actions/flashloan/EulerFlashLoanAction.js +18 -0
- package/esm/src/actions/flashloan/EulerFlashLoanPaybackAction.d.ts +13 -0
- package/esm/src/actions/flashloan/EulerFlashLoanPaybackAction.js +15 -0
- package/esm/src/actions/flashloan/MakerFlashLoanAction.d.ts +15 -0
- package/esm/src/actions/flashloan/MakerFlashLoanAction.js +17 -0
- package/esm/src/actions/flashloan/MakerFlashLoanPaybackAction.d.ts +13 -0
- package/esm/src/actions/flashloan/MakerFlashLoanPaybackAction.js +15 -0
- package/esm/src/actions/flashloan/index.d.ts +12 -0
- package/esm/src/actions/flashloan/index.js +12 -0
- package/esm/src/actions/guni/GUniDeposit.d.ts +24 -0
- package/esm/src/actions/guni/GUniDeposit.js +47 -0
- package/esm/src/actions/guni/GUniWithdraw.d.ts +22 -0
- package/esm/src/actions/guni/GUniWithdraw.js +39 -0
- package/esm/src/actions/guni/index.d.ts +2 -0
- package/esm/src/actions/guni/index.js +2 -0
- package/esm/src/actions/index.d.ts +24 -0
- package/esm/src/actions/index.js +24 -0
- package/esm/src/actions/insta/InstPullTokensAction.d.ts +18 -0
- package/esm/src/actions/insta/InstPullTokensAction.js +36 -0
- package/esm/src/actions/insta/index.d.ts +1 -0
- package/esm/src/actions/insta/index.js +1 -0
- package/esm/src/actions/lido/LidoStakeAction.d.ts +19 -0
- package/esm/src/actions/lido/LidoStakeAction.js +34 -0
- package/esm/src/actions/lido/LidoUnwrapAction.d.ts +19 -0
- package/esm/src/actions/lido/LidoUnwrapAction.js +33 -0
- package/esm/src/actions/lido/LidoWrapAction.d.ts +20 -0
- package/esm/src/actions/lido/LidoWrapAction.js +45 -0
- package/esm/src/actions/lido/index.d.ts +3 -0
- package/esm/src/actions/lido/index.js +3 -0
- package/esm/src/actions/liquity/LiquityBorrowAction.d.ts +15 -0
- package/esm/src/actions/liquity/LiquityBorrowAction.js +24 -0
- package/esm/src/actions/liquity/LiquityClaimAction.d.ts +13 -0
- package/esm/src/actions/liquity/LiquityClaimAction.js +20 -0
- package/esm/src/actions/liquity/LiquityClaimSPRewardsAction.d.ts +14 -0
- package/esm/src/actions/liquity/LiquityClaimSPRewardsAction.js +18 -0
- package/esm/src/actions/liquity/LiquityClaimStakingRewardsAction.d.ts +14 -0
- package/esm/src/actions/liquity/LiquityClaimStakingRewardsAction.js +18 -0
- package/esm/src/actions/liquity/LiquityCloseAction.d.ts +18 -0
- package/esm/src/actions/liquity/LiquityCloseAction.js +38 -0
- package/esm/src/actions/liquity/LiquityEthGainToTroveAction.d.ts +13 -0
- package/esm/src/actions/liquity/LiquityEthGainToTroveAction.js +20 -0
- package/esm/src/actions/liquity/LiquityOpenAction.d.ts +21 -0
- package/esm/src/actions/liquity/LiquityOpenAction.js +44 -0
- package/esm/src/actions/liquity/LiquityPaybackAction.d.ts +18 -0
- package/esm/src/actions/liquity/LiquityPaybackAction.js +37 -0
- package/esm/src/actions/liquity/LiquityRedeemAction.d.ts +20 -0
- package/esm/src/actions/liquity/LiquityRedeemAction.js +42 -0
- package/esm/src/actions/liquity/LiquitySPDepositAction.d.ts +20 -0
- package/esm/src/actions/liquity/LiquitySPDepositAction.js +43 -0
- package/esm/src/actions/liquity/LiquitySPWithdrawAction.d.ts +16 -0
- package/esm/src/actions/liquity/LiquitySPWithdrawAction.js +28 -0
- package/esm/src/actions/liquity/LiquityStakeAction.d.ts +20 -0
- package/esm/src/actions/liquity/LiquityStakeAction.js +43 -0
- package/esm/src/actions/liquity/LiquitySupplyAction.d.ts +18 -0
- package/esm/src/actions/liquity/LiquitySupplyAction.js +37 -0
- package/esm/src/actions/liquity/LiquityUnstakeAction.d.ts +16 -0
- package/esm/src/actions/liquity/LiquityUnstakeAction.js +28 -0
- package/esm/src/actions/liquity/LiquityWithdrawAction.d.ts +14 -0
- package/esm/src/actions/liquity/LiquityWithdrawAction.js +22 -0
- package/esm/src/actions/liquity/index.d.ts +15 -0
- package/esm/src/actions/liquity/index.js +15 -0
- package/esm/src/actions/maker/MakerClaimAction.d.ts +15 -0
- package/esm/src/actions/maker/MakerClaimAction.js +24 -0
- package/esm/src/actions/maker/MakerGenerateAction.d.ts +16 -0
- package/esm/src/actions/maker/MakerGenerateAction.js +20 -0
- package/esm/src/actions/maker/MakerGiveAction.d.ts +16 -0
- package/esm/src/actions/maker/MakerGiveAction.js +25 -0
- package/esm/src/actions/maker/MakerMergeAction.d.ts +15 -0
- package/esm/src/actions/maker/MakerMergeAction.js +17 -0
- package/esm/src/actions/maker/MakerOpenVaultAction.d.ts +14 -0
- package/esm/src/actions/maker/MakerOpenVaultAction.js +16 -0
- package/esm/src/actions/maker/MakerPaybackAction.d.ts +20 -0
- package/esm/src/actions/maker/MakerPaybackAction.js +33 -0
- package/esm/src/actions/maker/MakerRatioAction.d.ts +13 -0
- package/esm/src/actions/maker/MakerRatioAction.js +15 -0
- package/esm/src/actions/maker/MakerSupplyAction.d.ts +21 -0
- package/esm/src/actions/maker/MakerSupplyAction.js +37 -0
- package/esm/src/actions/maker/MakerWithdrawAction.d.ts +17 -0
- package/esm/src/actions/maker/MakerWithdrawAction.js +21 -0
- package/esm/src/actions/maker/index.d.ts +9 -0
- package/esm/src/actions/maker/index.js +9 -0
- package/esm/src/actions/mstable/MStableClaimAction.d.ts +16 -0
- package/esm/src/actions/mstable/MStableClaimAction.js +25 -0
- package/esm/src/actions/mstable/MStableDepositAction.d.ts +25 -0
- package/esm/src/actions/mstable/MStableDepositAction.js +75 -0
- package/esm/src/actions/mstable/MStableWithdrawAction.d.ts +25 -0
- package/esm/src/actions/mstable/MStableWithdrawAction.js +74 -0
- package/esm/src/actions/mstable/index.d.ts +3 -0
- package/esm/src/actions/mstable/index.js +3 -0
- package/esm/src/actions/rari/RariDepositAction.d.ts +22 -0
- package/esm/src/actions/rari/RariDepositAction.js +41 -0
- package/esm/src/actions/rari/RariWithdrawAction.d.ts +23 -0
- package/esm/src/actions/rari/RariWithdrawAction.js +43 -0
- package/esm/src/actions/rari/index.d.ts +2 -0
- package/esm/src/actions/rari/index.js +2 -0
- package/esm/src/actions/reflexer/ReflexerGenerateAction.d.ts +15 -0
- package/esm/src/actions/reflexer/ReflexerGenerateAction.js +19 -0
- package/esm/src/actions/reflexer/ReflexerNativeUniV2SaviourDepositAction.d.ts +19 -0
- package/esm/src/actions/reflexer/ReflexerNativeUniV2SaviourDepositAction.js +37 -0
- package/esm/src/actions/reflexer/ReflexerNativeUniV2SaviourGetReservesAction.d.ts +14 -0
- package/esm/src/actions/reflexer/ReflexerNativeUniV2SaviourGetReservesAction.js +21 -0
- package/esm/src/actions/reflexer/ReflexerNativeUniV2SaviourWithdrawAction.d.ts +15 -0
- package/esm/src/actions/reflexer/ReflexerNativeUniV2SaviourWithdrawAction.js +23 -0
- package/esm/src/actions/reflexer/ReflexerOpenSafeAction.d.ts +13 -0
- package/esm/src/actions/reflexer/ReflexerOpenSafeAction.js +15 -0
- package/esm/src/actions/reflexer/ReflexerPaybackAction.d.ts +19 -0
- package/esm/src/actions/reflexer/ReflexerPaybackAction.js +32 -0
- package/esm/src/actions/reflexer/ReflexerSupplyAction.d.ts +21 -0
- package/esm/src/actions/reflexer/ReflexerSupplyAction.js +44 -0
- package/esm/src/actions/reflexer/ReflexerWithdrawAction.d.ts +16 -0
- package/esm/src/actions/reflexer/ReflexerWithdrawAction.js +20 -0
- package/esm/src/actions/reflexer/index.d.ts +8 -0
- package/esm/src/actions/reflexer/index.js +8 -0
- package/esm/src/actions/uniswap/UniswapSupplyAction.d.ts +26 -0
- package/esm/src/actions/uniswap/UniswapSupplyAction.js +65 -0
- package/esm/src/actions/uniswap/UniswapWithdrawAction.d.ts +25 -0
- package/esm/src/actions/uniswap/UniswapWithdrawAction.js +56 -0
- package/esm/src/actions/uniswap/index.d.ts +2 -0
- package/esm/src/actions/uniswap/index.js +2 -0
- package/esm/src/actions/uniswapV3/UniswapV3CollectAction.d.ts +24 -0
- package/esm/src/actions/uniswapV3/UniswapV3CollectAction.js +47 -0
- package/esm/src/actions/uniswapV3/UniswapV3CreatePoolAction.d.ts +30 -0
- package/esm/src/actions/uniswapV3/UniswapV3CreatePoolAction.js +69 -0
- package/esm/src/actions/uniswapV3/UniswapV3MintAction.d.ts +29 -0
- package/esm/src/actions/uniswapV3/UniswapV3MintAction.js +67 -0
- package/esm/src/actions/uniswapV3/UniswapV3SupplyAction.d.ts +26 -0
- package/esm/src/actions/uniswapV3/UniswapV3SupplyAction.js +60 -0
- package/esm/src/actions/uniswapV3/UniswapV3WithdrawAction.d.ts +28 -0
- package/esm/src/actions/uniswapV3/UniswapV3WithdrawAction.js +58 -0
- package/esm/src/actions/uniswapV3/index.d.ts +5 -0
- package/esm/src/actions/uniswapV3/index.js +5 -0
- package/esm/src/actions/yearn/YearnSupplyAction.d.ts +21 -0
- package/esm/src/actions/yearn/YearnSupplyAction.js +43 -0
- package/esm/src/actions/yearn/YearnWithdrawAction.d.ts +21 -0
- package/esm/src/actions/yearn/YearnWithdrawAction.js +43 -0
- package/esm/src/actions/yearn/index.d.ts +2 -0
- package/esm/src/actions/yearn/index.js +2 -0
- package/esm/src/addresses.d.ts +410 -0
- package/esm/src/addresses.js +257 -0
- package/esm/src/config.d.ts +20 -0
- package/esm/src/config.js +69 -0
- package/esm/src/index.d.ts +1549 -0
- package/esm/src/index.js +22 -0
- package/esm/src/triggers/AaveV3RatioTrigger.d.ts +10 -0
- package/esm/src/triggers/AaveV3RatioTrigger.js +12 -0
- package/esm/src/triggers/ChainLinkPriceTrigger.d.ts +10 -0
- package/esm/src/triggers/ChainLinkPriceTrigger.js +12 -0
- package/esm/src/triggers/CompV3RatioTrigger.d.ts +10 -0
- package/esm/src/triggers/CompV3RatioTrigger.js +12 -0
- package/esm/src/triggers/CompoundRatioTrigger.d.ts +10 -0
- package/esm/src/triggers/CompoundRatioTrigger.js +12 -0
- package/esm/src/triggers/GasPriceTrigger.d.ts +10 -0
- package/esm/src/triggers/GasPriceTrigger.js +12 -0
- package/esm/src/triggers/LiquityRatioTrigger.d.ts +10 -0
- package/esm/src/triggers/LiquityRatioTrigger.js +12 -0
- package/esm/src/triggers/MakerRatioTrigger.d.ts +10 -0
- package/esm/src/triggers/MakerRatioTrigger.js +12 -0
- package/esm/src/triggers/ReflexerRatioTrigger.d.ts +10 -0
- package/esm/src/triggers/ReflexerRatioTrigger.js +12 -0
- package/esm/src/triggers/TimestampTrigger.d.ts +10 -0
- package/esm/src/triggers/TimestampTrigger.js +12 -0
- package/esm/src/triggers/TrailingStopTrigger.d.ts +10 -0
- package/esm/src/triggers/TrailingStopTrigger.js +12 -0
- package/esm/src/triggers/UniV3CurrentTickTrigger.d.ts +10 -0
- package/esm/src/triggers/UniV3CurrentTickTrigger.js +12 -0
- package/esm/src/triggers/index.d.ts +11 -0
- package/esm/src/triggers/index.js +11 -0
- package/esm/src/types.d.ts +43 -0
- package/esm/src/types.js +1 -0
- package/esm/src/utils/convex-utils.d.ts +42 -0
- package/esm/src/utils/convex-utils.js +16 -0
- package/esm/src/utils/convexPoolInfo.json +1039 -0
- package/esm/src/utils/curve-utils.d.ts +4 -0
- package/esm/src/utils/curve-utils.js +6 -0
- package/esm/src/utils/curvePoolInfo.json +203 -0
- package/esm/src/utils/general.d.ts +17 -0
- package/esm/src/utils/general.js +39 -0
- package/esm/src/utils/index.d.ts +5 -0
- package/esm/src/utils/index.js +5 -0
- package/esm/src/utils/mstableAssetPairs.d.ts +9 -0
- package/esm/src/utils/mstableAssetPairs.js +8 -0
- package/esm/src/utils/uniswapLP.d.ts +19 -0
- package/esm/src/utils/uniswapLP.js +33 -0
- package/esm/src/utils/zeroExExchange.d.ts +39 -0
- package/esm/src/utils/zeroExExchange.js +169 -0
- package/package.json +10 -5
- package/src/Action.ts +47 -42
- package/src/ActionWithL2.ts +6 -6
- package/src/DfsWeb3.ts +20 -25
- package/src/Recipe.ts +18 -16
- package/src/Strategy.ts +10 -8
- package/src/actions/aave/AaveBorrowAction.ts +4 -4
- package/src/actions/aave/AaveClaimStkAaveAction.ts +5 -5
- package/src/actions/aave/AaveCollateralSwitchAction.ts +7 -7
- package/src/actions/aave/AavePaybackAction.ts +6 -6
- package/src/actions/aave/AaveSupplyAction.ts +7 -7
- package/src/actions/aave/AaveWithdrawAction.ts +6 -6
- package/src/actions/aaveV3/AaveV3ATokenPaybackAction.ts +13 -11
- package/src/actions/aaveV3/AaveV3BorrowAction.ts +11 -9
- package/src/actions/aaveV3/AaveV3ClaimRewardsAction.ts +7 -6
- package/src/actions/aaveV3/AaveV3CollateralSwitchAction.ts +8 -7
- package/src/actions/aaveV3/AaveV3PaybackAction.ts +20 -19
- package/src/actions/aaveV3/AaveV3SetEModeAction.ts +6 -6
- package/src/actions/aaveV3/AaveV3SupplyAction.ts +17 -18
- package/src/actions/aaveV3/AaveV3SwapBorrowRateModeAction.ts +10 -9
- package/src/actions/aaveV3/AaveV3WithdrawAction.ts +14 -13
- package/src/actions/balancer/BalancerV2ClaimAction.ts +14 -15
- package/src/actions/balancer/BalancerV2SupplyAction.ts +16 -14
- package/src/actions/balancer/BalancerV2WithdrawAction.ts +16 -14
- package/src/actions/balancer/index.ts +3 -3
- package/src/actions/basic/AutomationV2Unsub.ts +6 -6
- package/src/actions/basic/ChangeProxyOwnerAction.ts +5 -5
- package/src/actions/basic/GasFeeAction.ts +6 -7
- package/src/actions/basic/GasFeeActionL2.ts +6 -6
- package/src/actions/basic/PullTokenAction.ts +11 -11
- package/src/actions/basic/SellAction.ts +11 -12
- package/src/actions/basic/SendTokenAction.ts +8 -8
- package/src/actions/basic/SendTokenAndUnwrapAction.ts +8 -8
- package/src/actions/basic/SubInputsAction.ts +6 -6
- package/src/actions/basic/SumInputsAction.ts +6 -6
- package/src/actions/basic/ToggleSubAction.ts +5 -7
- package/src/actions/basic/TokenBalanceAction.ts +5 -5
- package/src/actions/basic/TransferNFTAction.ts +8 -8
- package/src/actions/basic/UnwrapEthAction.ts +11 -10
- package/src/actions/basic/UpdateSubAction.ts +8 -8
- package/src/actions/basic/WrapEthAction.ts +6 -6
- package/src/actions/checkers/AaveV3RatioCheckAction.ts +5 -5
- package/src/actions/checkers/CompoundV3RatioCheckAction.ts +6 -6
- package/src/actions/checkers/MakerRatioCheckAction.ts +5 -5
- package/src/actions/chickenBonds/CBChickenInAction.ts +6 -6
- package/src/actions/chickenBonds/CBChickenOutAction.ts +7 -7
- package/src/actions/chickenBonds/CBCreateAction.ts +6 -6
- package/src/actions/chickenBonds/CBRedeemAction.ts +6 -7
- package/src/actions/compound/CompoundBorrowAction.ts +5 -5
- package/src/actions/compound/CompoundClaimAction.ts +6 -6
- package/src/actions/compound/CompoundCollateralSwitchAction.ts +4 -4
- package/src/actions/compound/CompoundGetDebtAction.ts +5 -5
- package/src/actions/compound/CompoundPaybackAction.ts +8 -9
- package/src/actions/compound/CompoundSupplyAction.ts +8 -9
- package/src/actions/compound/CompoundWithdrawAction.ts +5 -5
- package/src/actions/compoundV3/CompoundV3AllowAction.ts +16 -16
- package/src/actions/compoundV3/CompoundV3BorrowAction.ts +17 -17
- package/src/actions/compoundV3/CompoundV3ClaimAction.ts +9 -9
- package/src/actions/compoundV3/CompoundV3PaybackAction.ts +32 -33
- package/src/actions/compoundV3/CompoundV3SupplyAction.ts +24 -25
- package/src/actions/compoundV3/CompoundV3TransferAction.ts +25 -25
- package/src/actions/compoundV3/CompoundV3WithdrawAction.ts +9 -9
- package/src/actions/compoundV3/index.ts +1 -1
- package/src/actions/convex/ConvexClaimAction.ts +51 -52
- package/src/actions/convex/ConvexDepositAction.ts +58 -59
- package/src/actions/convex/ConvexWithdrawAction.ts +55 -56
- package/src/actions/curve/CurveClaimFeesAction.ts +18 -19
- package/src/actions/curve/CurveDepositAction.ts +61 -62
- package/src/actions/curve/CurveGaugeDepositAction.ts +20 -21
- package/src/actions/curve/CurveGaugeWithdrawAction.ts +15 -16
- package/src/actions/curve/CurveMintCrvAction.ts +14 -15
- package/src/actions/curve/CurveStethPoolDepositAction.ts +27 -27
- package/src/actions/curve/CurveStethPoolWithdrawAction.ts +26 -26
- package/src/actions/curve/CurveSwapAction.ts +20 -21
- package/src/actions/curve/CurveWithdrawAction.ts +56 -57
- package/src/actions/dydx/DyDxWithdrawAction.ts +6 -6
- package/src/actions/flashloan/AaveV2FlashLoanAction.ts +6 -6
- package/src/actions/flashloan/AaveV2FlashLoanPaybackAction.ts +5 -5
- package/src/actions/flashloan/AaveV3FlashLoanAction.ts +6 -6
- package/src/actions/flashloan/AaveV3FlashLoanPaybackAction.ts +5 -5
- package/src/actions/flashloan/BalancerFlashLoanAction.ts +6 -6
- package/src/actions/flashloan/BalancerFlashLoanPaybackAction.ts +8 -8
- package/src/actions/flashloan/DyDxFlashLoanAction.ts +7 -7
- package/src/actions/flashloan/DyDxFlashLoanPaybackAction.ts +5 -5
- package/src/actions/flashloan/EulerFlashLoanAction.ts +6 -6
- package/src/actions/flashloan/EulerFlashLoanPaybackAction.ts +6 -5
- package/src/actions/flashloan/FLAction.ts +51 -0
- package/src/actions/flashloan/MakerFlashLoanAction.ts +6 -6
- package/src/actions/flashloan/MakerFlashLoanPaybackAction.ts +4 -4
- package/src/actions/flashloan/index.ts +3 -2
- package/src/actions/guni/GUniDeposit.ts +15 -15
- package/src/actions/guni/GUniWithdraw.ts +11 -11
- package/src/actions/index.ts +24 -24
- package/src/actions/insta/InstPullTokensAction.ts +9 -9
- package/src/actions/lido/LidoStakeAction.ts +7 -7
- package/src/actions/lido/LidoUnwrapAction.ts +6 -6
- package/src/actions/lido/LidoWrapAction.ts +9 -10
- package/src/actions/liquity/LiquityBorrowAction.ts +19 -17
- package/src/actions/liquity/LiquityClaimAction.ts +14 -14
- package/src/actions/liquity/LiquityClaimSPRewardsAction.ts +9 -9
- package/src/actions/liquity/LiquityClaimStakingRewardsAction.ts +9 -9
- package/src/actions/liquity/LiquityCloseAction.ts +19 -19
- package/src/actions/liquity/LiquityEthGainToTroveAction.ts +19 -17
- package/src/actions/liquity/LiquityOpenAction.ts +25 -23
- package/src/actions/liquity/LiquityPaybackAction.ts +21 -19
- package/src/actions/liquity/LiquityRedeemAction.ts +42 -37
- package/src/actions/liquity/LiquitySPDepositAction.ts +22 -22
- package/src/actions/liquity/LiquitySPWithdrawAction.ts +19 -19
- package/src/actions/liquity/LiquityStakeAction.ts +22 -22
- package/src/actions/liquity/LiquitySupplyAction.ts +21 -19
- package/src/actions/liquity/LiquityUnstakeAction.ts +19 -19
- package/src/actions/liquity/LiquityWithdrawAction.ts +18 -16
- package/src/actions/maker/MakerClaimAction.ts +8 -8
- package/src/actions/maker/MakerGenerateAction.ts +5 -5
- package/src/actions/maker/MakerGiveAction.ts +6 -6
- package/src/actions/maker/MakerMergeAction.ts +4 -4
- package/src/actions/maker/MakerOpenVaultAction.ts +4 -4
- package/src/actions/maker/MakerPaybackAction.ts +6 -6
- package/src/actions/maker/MakerRatioAction.ts +3 -3
- package/src/actions/maker/MakerSupplyAction.ts +6 -6
- package/src/actions/maker/MakerWithdrawAction.ts +5 -5
- package/src/actions/mstable/MStableClaimAction.ts +23 -23
- package/src/actions/mstable/MStableDepositAction.ts +60 -60
- package/src/actions/mstable/MStableWithdrawAction.ts +59 -59
- package/src/actions/rari/RariDepositAction.ts +4 -4
- package/src/actions/rari/RariWithdrawAction.ts +4 -4
- package/src/actions/reflexer/ReflexerGenerateAction.ts +6 -6
- package/src/actions/reflexer/ReflexerNativeUniV2SaviourDepositAction.ts +10 -11
- package/src/actions/reflexer/ReflexerNativeUniV2SaviourGetReservesAction.ts +7 -7
- package/src/actions/reflexer/ReflexerNativeUniV2SaviourWithdrawAction.ts +8 -8
- package/src/actions/reflexer/ReflexerOpenSafeAction.ts +3 -3
- package/src/actions/reflexer/ReflexerPaybackAction.ts +6 -6
- package/src/actions/reflexer/ReflexerSupplyAction.ts +6 -6
- package/src/actions/reflexer/ReflexerWithdrawAction.ts +5 -5
- package/src/actions/uniswap/UniswapSupplyAction.ts +18 -18
- package/src/actions/uniswap/UniswapWithdrawAction.ts +16 -16
- package/src/actions/uniswapV3/UniswapV3CollectAction.ts +9 -10
- package/src/actions/uniswapV3/UniswapV3CreatePoolAction.ts +22 -20
- package/src/actions/uniswapV3/UniswapV3MintAction.ts +21 -19
- package/src/actions/uniswapV3/UniswapV3SupplyAction.ts +15 -15
- package/src/actions/uniswapV3/UniswapV3WithdrawAction.ts +14 -15
- package/src/actions/yearn/YearnSupplyAction.ts +7 -7
- package/src/actions/yearn/YearnWithdrawAction.ts +7 -7
- package/src/addresses.ts +10 -7
- package/src/config.ts +6 -6
- package/{index.ts → src/index.ts} +36 -21
- package/src/triggers/AaveV3RatioTrigger.ts +6 -7
- package/src/triggers/ChainLinkPriceTrigger.ts +6 -8
- package/src/triggers/CompV3RatioTrigger.ts +6 -7
- package/src/triggers/CompoundRatioTrigger.ts +6 -7
- package/src/triggers/GasPriceTrigger.ts +6 -7
- package/src/triggers/LiquityRatioTrigger.ts +9 -10
- package/src/triggers/MakerRatioTrigger.ts +6 -7
- package/src/triggers/ReflexerRatioTrigger.ts +6 -7
- package/src/triggers/TimestampTrigger.ts +6 -7
- package/src/triggers/TrailingStopTrigger.ts +6 -7
- package/src/triggers/UniV3CurrentTickTrigger.ts +6 -6
- package/src/types.ts +9 -7
- package/src/utils/convex-utils.ts +9 -9
- package/src/utils/curve-utils.ts +11 -8
- package/src/utils/general.ts +4 -5
- package/src/utils/index.ts +7 -5
- package/src/utils/mstableAssetPairs.ts +6 -6
- package/src/utils/uniswapLP.ts +14 -16
- package/src/utils/uniswapV3LP.ts +5 -4
- package/src/utils/zeroExExchange.ts +9 -8
- package/tsconfig.json +1 -2
- package/umd/index.js +8639 -0
- package/webpack.umd.js +1 -1
- package/.eslintrc +0 -14
- package/src/triggers/CompV3Trigger.ts +0 -15
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { Action } from "../../Action";
|
|
11
|
+
import { requireAddress } from "../../utils/general";
|
|
12
|
+
import { getAddr } from '../../addresses';
|
|
13
|
+
import { getAssetInfoByAddress } from "@defisaver/tokens";
|
|
14
|
+
/**
|
|
15
|
+
* CompoundV3PaybackAction - Repays specified amount of base token
|
|
16
|
+
*
|
|
17
|
+
* @category CompundV3
|
|
18
|
+
*/
|
|
19
|
+
export class CompoundV3PaybackAction extends Action {
|
|
20
|
+
/**
|
|
21
|
+
* @param market Comet proxy address of the market
|
|
22
|
+
* @param amount amount of base token to be paid back
|
|
23
|
+
* @param from address from which funds are paid
|
|
24
|
+
* @param onBehalf address for which the funds are paid back
|
|
25
|
+
* @param asset address for which the funds are paid back
|
|
26
|
+
*/
|
|
27
|
+
constructor(market, amount, from, onBehalf, asset) {
|
|
28
|
+
requireAddress(from);
|
|
29
|
+
requireAddress(onBehalf);
|
|
30
|
+
requireAddress(asset);
|
|
31
|
+
super('CompV3Payback', getAddr('CompV3Payback'), ['address', 'uint256', 'address', 'address'], [market, amount, from, onBehalf, asset].slice(0, 4));
|
|
32
|
+
this.mappableArgs = [
|
|
33
|
+
this.args[0],
|
|
34
|
+
this.args[1],
|
|
35
|
+
this.args[2],
|
|
36
|
+
this.args[3],
|
|
37
|
+
];
|
|
38
|
+
this.tokenForApproval = asset;
|
|
39
|
+
}
|
|
40
|
+
getAssetsToApprove() {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
const asset = getAssetInfoByAddress(this.tokenForApproval);
|
|
43
|
+
if (asset.symbol !== 'ETH')
|
|
44
|
+
return [{ asset: this.tokenForApproval, owner: this.args[2] }];
|
|
45
|
+
return [];
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Action } from "../../Action";
|
|
2
|
+
import { EthAddress, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* CompoundV3SupplyAction - Supply specified amount of token (base or collateral)
|
|
5
|
+
*
|
|
6
|
+
* @category CompundV3
|
|
7
|
+
*/
|
|
8
|
+
export declare class CompoundV3SupplyAction extends Action {
|
|
9
|
+
tokenForApproval: EthAddress;
|
|
10
|
+
/**
|
|
11
|
+
* @param market Comet proxy address of the market
|
|
12
|
+
* @param tokenAddr
|
|
13
|
+
* @param amount wei amount of asset to supply
|
|
14
|
+
* @param from Address from where we're pulling the tokens
|
|
15
|
+
* @param onBehalf Address of the account we are supplying the tokens
|
|
16
|
+
*/
|
|
17
|
+
constructor(market: EthAddress, tokenAddr: EthAddress, amount: uint256, from: EthAddress, onBehalf: EthAddress);
|
|
18
|
+
getAssetsToApprove(): Promise<{
|
|
19
|
+
asset: string;
|
|
20
|
+
owner: any;
|
|
21
|
+
}[]>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { Action } from "../../Action";
|
|
11
|
+
import { getAddr } from '../../addresses';
|
|
12
|
+
import { getAssetInfoByAddress } from "@defisaver/tokens";
|
|
13
|
+
/**
|
|
14
|
+
* CompoundV3SupplyAction - Supply specified amount of token (base or collateral)
|
|
15
|
+
*
|
|
16
|
+
* @category CompundV3
|
|
17
|
+
*/
|
|
18
|
+
export class CompoundV3SupplyAction extends Action {
|
|
19
|
+
/**
|
|
20
|
+
* @param market Comet proxy address of the market
|
|
21
|
+
* @param tokenAddr
|
|
22
|
+
* @param amount wei amount of asset to supply
|
|
23
|
+
* @param from Address from where we're pulling the tokens
|
|
24
|
+
* @param onBehalf Address of the account we are supplying the tokens
|
|
25
|
+
*/
|
|
26
|
+
constructor(market, tokenAddr, amount, from, onBehalf) {
|
|
27
|
+
super('CompV3Supply', getAddr('CompV3Supply'), ['address', 'address', 'uint256', 'address', 'address'], [market, tokenAddr, amount, from, onBehalf]);
|
|
28
|
+
this.mappableArgs = [
|
|
29
|
+
this.args[0],
|
|
30
|
+
this.args[1],
|
|
31
|
+
this.args[2],
|
|
32
|
+
this.args[3],
|
|
33
|
+
this.args[4]
|
|
34
|
+
];
|
|
35
|
+
this.tokenForApproval = tokenAddr;
|
|
36
|
+
}
|
|
37
|
+
getAssetsToApprove() {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const asset = getAssetInfoByAddress(this.tokenForApproval);
|
|
40
|
+
if (asset.symbol !== 'ETH')
|
|
41
|
+
return [{ asset: this.tokenForApproval, owner: this.args[1] }];
|
|
42
|
+
return [];
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Action } from "../../Action";
|
|
2
|
+
import { EthAddress, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* CompoundV3TransferAction - Transfer specified amount of assets from src address to dst
|
|
5
|
+
*
|
|
6
|
+
* @category CompundV3
|
|
7
|
+
*/
|
|
8
|
+
export declare class CompoundV3TransferAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param market Comet proxy address of the market
|
|
11
|
+
* @param from address of src
|
|
12
|
+
* @param to address of dst
|
|
13
|
+
* @param asset address of ERC20 token
|
|
14
|
+
* @param amount amount of assets to be transferred
|
|
15
|
+
*/
|
|
16
|
+
constructor(market: EthAddress, from: EthAddress, to: EthAddress, asset: EthAddress, amount: uint256);
|
|
17
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Action } from "../../Action";
|
|
2
|
+
import { requireAddress } from "../../utils/general";
|
|
3
|
+
import { getAddr } from '../../addresses';
|
|
4
|
+
/**
|
|
5
|
+
* CompoundV3TransferAction - Transfer specified amount of assets from src address to dst
|
|
6
|
+
*
|
|
7
|
+
* @category CompundV3
|
|
8
|
+
*/
|
|
9
|
+
export class CompoundV3TransferAction extends Action {
|
|
10
|
+
/**
|
|
11
|
+
* @param market Comet proxy address of the market
|
|
12
|
+
* @param from address of src
|
|
13
|
+
* @param to address of dst
|
|
14
|
+
* @param asset address of ERC20 token
|
|
15
|
+
* @param amount amount of assets to be transferred
|
|
16
|
+
*/
|
|
17
|
+
constructor(market, from, to, asset, amount) {
|
|
18
|
+
requireAddress(from);
|
|
19
|
+
requireAddress(to);
|
|
20
|
+
requireAddress(asset);
|
|
21
|
+
super('CompV3Transfer', getAddr('CompV3Transfer'), ['address', 'address', 'address', 'address', 'uint256'], [market, from, to, asset, amount]);
|
|
22
|
+
this.mappableArgs = [
|
|
23
|
+
this.args[0],
|
|
24
|
+
this.args[1],
|
|
25
|
+
this.args[2],
|
|
26
|
+
this.args[3],
|
|
27
|
+
this.args[4],
|
|
28
|
+
];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Action } from "../../Action";
|
|
2
|
+
import { EthAddress, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* CompoundV3WithdrawAction - Withdraw token from an Compound position
|
|
5
|
+
*
|
|
6
|
+
* @category CompundV3
|
|
7
|
+
*/
|
|
8
|
+
export declare class CompoundV3WithdrawAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param market Comet proxy address of the market
|
|
11
|
+
* @param to Address where we are sending the tokens
|
|
12
|
+
* @param asset Address of asset to withdraw
|
|
13
|
+
* @param amount Wei amount in specified asset
|
|
14
|
+
* @param onBehalf Address from where we are withdrawing the tokens
|
|
15
|
+
*/
|
|
16
|
+
constructor(market: EthAddress, to: EthAddress, asset: EthAddress, amount: uint256, onBehalf: EthAddress);
|
|
17
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Action } from "../../Action";
|
|
2
|
+
import { requireAddress } from "../../utils/general";
|
|
3
|
+
import { getAddr } from "../../addresses";
|
|
4
|
+
/**
|
|
5
|
+
* CompoundV3WithdrawAction - Withdraw token from an Compound position
|
|
6
|
+
*
|
|
7
|
+
* @category CompundV3
|
|
8
|
+
*/
|
|
9
|
+
export class CompoundV3WithdrawAction extends Action {
|
|
10
|
+
/**
|
|
11
|
+
* @param market Comet proxy address of the market
|
|
12
|
+
* @param to Address where we are sending the tokens
|
|
13
|
+
* @param asset Address of asset to withdraw
|
|
14
|
+
* @param amount Wei amount in specified asset
|
|
15
|
+
* @param onBehalf Address from where we are withdrawing the tokens
|
|
16
|
+
*/
|
|
17
|
+
constructor(market, to, asset, amount, onBehalf) {
|
|
18
|
+
requireAddress(to);
|
|
19
|
+
requireAddress(asset);
|
|
20
|
+
super("CompV3Withdraw", getAddr("CompV3Withdraw"), ["address", "address", "address", "uint256", "address"], [market, to, asset, amount, onBehalf]);
|
|
21
|
+
this.mappableArgs = [
|
|
22
|
+
this.args[0],
|
|
23
|
+
this.args[1],
|
|
24
|
+
this.args[2],
|
|
25
|
+
this.args[3],
|
|
26
|
+
this.args[4],
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './CompoundV3SupplyAction';
|
|
2
|
+
export * from './CompoundV3BorrowAction';
|
|
3
|
+
export * from './CompoundV3PaybackAction';
|
|
4
|
+
export * from './CompoundV3WithdrawAction';
|
|
5
|
+
export * from './CompoundV3ClaimAction';
|
|
6
|
+
export * from './CompoundV3AllowAction';
|
|
7
|
+
export * from './CompoundV3TransferAction';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './CompoundV3SupplyAction';
|
|
2
|
+
export * from './CompoundV3BorrowAction';
|
|
3
|
+
export * from './CompoundV3PaybackAction';
|
|
4
|
+
export * from './CompoundV3WithdrawAction';
|
|
5
|
+
export * from './CompoundV3ClaimAction';
|
|
6
|
+
export * from './CompoundV3AllowAction';
|
|
7
|
+
export * from './CompoundV3TransferAction';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* ConvexClaimAction - Claims convex rewards
|
|
5
|
+
*
|
|
6
|
+
* @category Convex
|
|
7
|
+
*/
|
|
8
|
+
export declare class ConvexClaimAction extends Action {
|
|
9
|
+
curveLp: EthAddress;
|
|
10
|
+
/**
|
|
11
|
+
* @param from
|
|
12
|
+
* @param to
|
|
13
|
+
* @param curveLp
|
|
14
|
+
*/
|
|
15
|
+
constructor(from: EthAddress, to: EthAddress, curveLp: EthAddress);
|
|
16
|
+
getAssetsToApprove(): Promise<any>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { Action } from '../../Action';
|
|
11
|
+
import { getAddr } from '../../addresses';
|
|
12
|
+
import { getConvexPool } from '../../utils/convex-utils';
|
|
13
|
+
import { requireAddress } from '../../utils/general';
|
|
14
|
+
/**
|
|
15
|
+
* ConvexClaimAction - Claims convex rewards
|
|
16
|
+
*
|
|
17
|
+
* @category Convex
|
|
18
|
+
*/
|
|
19
|
+
export class ConvexClaimAction extends Action {
|
|
20
|
+
/**
|
|
21
|
+
* @param from
|
|
22
|
+
* @param to
|
|
23
|
+
* @param curveLp
|
|
24
|
+
*/
|
|
25
|
+
constructor(from, to, curveLp) {
|
|
26
|
+
requireAddress(to);
|
|
27
|
+
const convexPool = getConvexPool(curveLp);
|
|
28
|
+
const crvRewards = convexPool.crvRewards;
|
|
29
|
+
super('ConvexClaim', getAddr('ConvexClaim'), [
|
|
30
|
+
'address',
|
|
31
|
+
'address',
|
|
32
|
+
'address',
|
|
33
|
+
], [
|
|
34
|
+
from,
|
|
35
|
+
to,
|
|
36
|
+
crvRewards,
|
|
37
|
+
]);
|
|
38
|
+
this.curveLp = curveLp;
|
|
39
|
+
this.mappableArgs = [
|
|
40
|
+
this.args[0],
|
|
41
|
+
this.args[1],
|
|
42
|
+
this.args[2],
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
getAssetsToApprove() {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
const pool = getConvexPool(this.curveLp);
|
|
48
|
+
const owner = this.args[0];
|
|
49
|
+
return [
|
|
50
|
+
getAddr('CrvToken'),
|
|
51
|
+
getAddr('CvxToken'),
|
|
52
|
+
].concat(pool.extraRewards.map((e) => e.token)).reduce((acc, e) => {
|
|
53
|
+
if (!acc.includes(e.toLowerCase()))
|
|
54
|
+
acc.push(e.toLowerCase());
|
|
55
|
+
return acc;
|
|
56
|
+
}, []).map((e) => Object({ asset: e, owner }));
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256, uint8 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* ConvexDepositAction - Deposits (wraps) Curve LP into convex, stakes wrapped LP, or does both
|
|
5
|
+
*
|
|
6
|
+
* @category Convex
|
|
7
|
+
*/
|
|
8
|
+
export declare class ConvexDepositAction extends Action {
|
|
9
|
+
curveLp: EthAddress;
|
|
10
|
+
/**
|
|
11
|
+
* @param from
|
|
12
|
+
* @param to
|
|
13
|
+
* @param curveLp
|
|
14
|
+
* @param amount
|
|
15
|
+
* @param option
|
|
16
|
+
*/
|
|
17
|
+
constructor(from: EthAddress, to: EthAddress, curveLp: EthAddress, amount: uint256, option: uint8);
|
|
18
|
+
getAssetsToApprove(): Promise<{
|
|
19
|
+
asset: string;
|
|
20
|
+
owner: any;
|
|
21
|
+
}[]>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { Action } from '../../Action';
|
|
11
|
+
import { getAddr } from '../../addresses';
|
|
12
|
+
import { DepositOption, getConvexPool } from '../../utils/convex-utils';
|
|
13
|
+
import { requireAddress } from '../../utils/general';
|
|
14
|
+
/**
|
|
15
|
+
* ConvexDepositAction - Deposits (wraps) Curve LP into convex, stakes wrapped LP, or does both
|
|
16
|
+
*
|
|
17
|
+
* @category Convex
|
|
18
|
+
*/
|
|
19
|
+
export class ConvexDepositAction extends Action {
|
|
20
|
+
/**
|
|
21
|
+
* @param from
|
|
22
|
+
* @param to
|
|
23
|
+
* @param curveLp
|
|
24
|
+
* @param amount
|
|
25
|
+
* @param option
|
|
26
|
+
*/
|
|
27
|
+
constructor(from, to, curveLp, amount, option) {
|
|
28
|
+
requireAddress(to);
|
|
29
|
+
const convexPool = getConvexPool(curveLp);
|
|
30
|
+
const pid = convexPool.pid;
|
|
31
|
+
super('ConvexDeposit', getAddr('ConvexDeposit'), [
|
|
32
|
+
'address',
|
|
33
|
+
'address',
|
|
34
|
+
'uint256',
|
|
35
|
+
'uint256',
|
|
36
|
+
'uint8',
|
|
37
|
+
], [
|
|
38
|
+
from,
|
|
39
|
+
to,
|
|
40
|
+
pid,
|
|
41
|
+
amount,
|
|
42
|
+
option,
|
|
43
|
+
]);
|
|
44
|
+
this.curveLp = curveLp;
|
|
45
|
+
this.mappableArgs = [
|
|
46
|
+
this.args[0],
|
|
47
|
+
this.args[1],
|
|
48
|
+
this.args[2],
|
|
49
|
+
this.args[3],
|
|
50
|
+
this.args[4],
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
getAssetsToApprove() {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
const pool = getConvexPool(this.curveLp);
|
|
56
|
+
const assetToPull = {
|
|
57
|
+
[DepositOption.WRAP]: pool.lpToken,
|
|
58
|
+
[DepositOption.STAKE]: pool.token,
|
|
59
|
+
[DepositOption.WRAP_AND_STAKE]: pool.lpToken,
|
|
60
|
+
};
|
|
61
|
+
return [{
|
|
62
|
+
asset: assetToPull[this.args[4]], owner: this.args[0],
|
|
63
|
+
}];
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256, uint8 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* ConvexWithdrawAction - Withdraws (unwraps) Curve LP from convex, unstakes wrapped LP, or does both
|
|
5
|
+
*
|
|
6
|
+
* @category Convex
|
|
7
|
+
*/
|
|
8
|
+
export declare class ConvexWithdrawAction extends Action {
|
|
9
|
+
curveLp: EthAddress;
|
|
10
|
+
/**
|
|
11
|
+
* @param from
|
|
12
|
+
* @param to
|
|
13
|
+
* @param curveLp
|
|
14
|
+
* @param amount
|
|
15
|
+
* @param option
|
|
16
|
+
*/
|
|
17
|
+
constructor(from: EthAddress, to: EthAddress, curveLp: EthAddress, amount: uint256, option: uint8);
|
|
18
|
+
getAssetsToApprove(): Promise<{
|
|
19
|
+
asset: string;
|
|
20
|
+
owner: any;
|
|
21
|
+
}[]>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { Action } from '../../Action';
|
|
11
|
+
import { getAddr } from '../../addresses';
|
|
12
|
+
import { getConvexPool, WithdrawOption } from '../../utils/convex-utils';
|
|
13
|
+
import { requireAddress } from '../../utils/general';
|
|
14
|
+
/**
|
|
15
|
+
* ConvexWithdrawAction - Withdraws (unwraps) Curve LP from convex, unstakes wrapped LP, or does both
|
|
16
|
+
*
|
|
17
|
+
* @category Convex
|
|
18
|
+
*/
|
|
19
|
+
export class ConvexWithdrawAction extends Action {
|
|
20
|
+
/**
|
|
21
|
+
* @param from
|
|
22
|
+
* @param to
|
|
23
|
+
* @param curveLp
|
|
24
|
+
* @param amount
|
|
25
|
+
* @param option
|
|
26
|
+
*/
|
|
27
|
+
constructor(from, to, curveLp, amount, option) {
|
|
28
|
+
requireAddress(to);
|
|
29
|
+
const convexPool = getConvexPool(curveLp);
|
|
30
|
+
const pid = convexPool.pid;
|
|
31
|
+
super('ConvexWithdraw', getAddr('ConvexWithdraw'), [
|
|
32
|
+
'address',
|
|
33
|
+
'address',
|
|
34
|
+
'uint256',
|
|
35
|
+
'uint256',
|
|
36
|
+
'uint8',
|
|
37
|
+
], [
|
|
38
|
+
from,
|
|
39
|
+
to,
|
|
40
|
+
pid,
|
|
41
|
+
amount,
|
|
42
|
+
option,
|
|
43
|
+
]);
|
|
44
|
+
this.curveLp = curveLp;
|
|
45
|
+
this.mappableArgs = [
|
|
46
|
+
this.args[0],
|
|
47
|
+
this.args[1],
|
|
48
|
+
this.args[2],
|
|
49
|
+
this.args[3],
|
|
50
|
+
this.args[4],
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
getAssetsToApprove() {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
const pool = getConvexPool(this.curveLp);
|
|
56
|
+
const owner = this.args[0];
|
|
57
|
+
if (this.args[4] === WithdrawOption.UNWRAP) {
|
|
58
|
+
return [{ asset: pool.token, owner }];
|
|
59
|
+
}
|
|
60
|
+
return [];
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* @category Curve
|
|
5
|
+
*/
|
|
6
|
+
export declare class CurveClaimFeesAction extends Action {
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param claimFor
|
|
10
|
+
* @param receiver
|
|
11
|
+
*/
|
|
12
|
+
constructor(claimFor: EthAddress, receiver: EthAddress);
|
|
13
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { requireAddress } from '../../utils/general';
|
|
3
|
+
import { getAddr } from '../../addresses';
|
|
4
|
+
/**
|
|
5
|
+
* @category Curve
|
|
6
|
+
*/
|
|
7
|
+
export class CurveClaimFeesAction extends Action {
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param claimFor
|
|
11
|
+
* @param receiver
|
|
12
|
+
*/
|
|
13
|
+
constructor(claimFor, receiver) {
|
|
14
|
+
requireAddress(claimFor);
|
|
15
|
+
requireAddress(receiver);
|
|
16
|
+
super('CurveClaimFeesAction', getAddr('CurveClaimFeesAction'), ['address', 'address'], [claimFor, receiver]);
|
|
17
|
+
this.mappableArgs = [
|
|
18
|
+
this.args[0],
|
|
19
|
+
this.args[1],
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* @category Curve
|
|
5
|
+
*/
|
|
6
|
+
export declare class CurveDepositAction extends Action {
|
|
7
|
+
tokensForApproval: Array<EthAddress>;
|
|
8
|
+
/**
|
|
9
|
+
* @param sender
|
|
10
|
+
* @param receiver
|
|
11
|
+
* @param poolAddr
|
|
12
|
+
* @param minMintAmount
|
|
13
|
+
* @param useUnderlying
|
|
14
|
+
* @param amounts
|
|
15
|
+
*/
|
|
16
|
+
constructor(sender: EthAddress, receiver: EthAddress, poolAddr: EthAddress, minMintAmount: uint256, useUnderlying: boolean, amounts?: Array<uint256>);
|
|
17
|
+
getAssetsToApprove(): Promise<any[]>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { getAssetInfo } from '@defisaver/tokens';
|
|
11
|
+
import { Action } from '../../Action';
|
|
12
|
+
import { requireAddress } from '../../utils/general';
|
|
13
|
+
import { getAddr } from '../../addresses';
|
|
14
|
+
import { poolInfo, makeFlags } from '../../utils/curve-utils';
|
|
15
|
+
/**
|
|
16
|
+
* @category Curve
|
|
17
|
+
*/
|
|
18
|
+
export class CurveDepositAction extends Action {
|
|
19
|
+
/**
|
|
20
|
+
* @param sender
|
|
21
|
+
* @param receiver
|
|
22
|
+
* @param poolAddr
|
|
23
|
+
* @param minMintAmount
|
|
24
|
+
* @param useUnderlying
|
|
25
|
+
* @param amounts
|
|
26
|
+
*/
|
|
27
|
+
constructor(sender, receiver, poolAddr, minMintAmount, useUnderlying, amounts = []) {
|
|
28
|
+
requireAddress(sender);
|
|
29
|
+
requireAddress(receiver);
|
|
30
|
+
let depositTarget;
|
|
31
|
+
let depositTargetType = 0;
|
|
32
|
+
let explicitUnderlying = false;
|
|
33
|
+
let tokensForApproval;
|
|
34
|
+
const pool = poolInfo.find((e) => e.swapAddr.toLowerCase() === poolAddr.toLowerCase());
|
|
35
|
+
if (useUnderlying) {
|
|
36
|
+
if (pool.depositContract) {
|
|
37
|
+
depositTarget = pool.depositContract;
|
|
38
|
+
depositTargetType = pool.zapType + 1;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
depositTarget = pool.swapAddr;
|
|
42
|
+
explicitUnderlying = pool.underlyingFlag;
|
|
43
|
+
if (!explicitUnderlying)
|
|
44
|
+
throw Error('pool has no underlying deposit mechanism');
|
|
45
|
+
}
|
|
46
|
+
tokensForApproval = pool.underlyingCoins;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
depositTarget = pool.swapAddr;
|
|
50
|
+
tokensForApproval = pool.coins;
|
|
51
|
+
}
|
|
52
|
+
super('CurveDeposit', getAddr('CurveDeposit'), ['address', 'address', 'address', 'uint256', 'uint8', 'uint256[]'], [
|
|
53
|
+
sender,
|
|
54
|
+
receiver,
|
|
55
|
+
depositTarget,
|
|
56
|
+
minMintAmount,
|
|
57
|
+
makeFlags(depositTargetType, explicitUnderlying, 0),
|
|
58
|
+
amounts,
|
|
59
|
+
]);
|
|
60
|
+
this.tokensForApproval = tokensForApproval;
|
|
61
|
+
this.mappableArgs = [
|
|
62
|
+
this.args[0],
|
|
63
|
+
this.args[1],
|
|
64
|
+
this.args[2],
|
|
65
|
+
this.args[3],
|
|
66
|
+
this.args[4],
|
|
67
|
+
...this.args[5],
|
|
68
|
+
];
|
|
69
|
+
}
|
|
70
|
+
getAssetsToApprove() {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
return this.tokensForApproval.map((e) => Object({
|
|
73
|
+
asset: e.toLowerCase() !== getAssetInfo('ETH').address.toLowerCase() ? e : getAssetInfo('WETH').address,
|
|
74
|
+
owner: this.args[0],
|
|
75
|
+
}));
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* @category Curve
|
|
5
|
+
*/
|
|
6
|
+
export declare class CurveGaugeDepositAction extends Action {
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param gaugeAddr
|
|
10
|
+
* @param lpToken
|
|
11
|
+
* @param sender
|
|
12
|
+
* @param onBehalfOf
|
|
13
|
+
* @param amount
|
|
14
|
+
*/
|
|
15
|
+
constructor(gaugeAddr: EthAddress, lpToken: EthAddress, sender: EthAddress, onBehalfOf: EthAddress, amount: uint256);
|
|
16
|
+
getAssetsToApprove(): Promise<{
|
|
17
|
+
asset: any;
|
|
18
|
+
owner: any;
|
|
19
|
+
}[]>;
|
|
20
|
+
}
|