@defisaver/sdk 1.2.7 → 1.2.9

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.
Files changed (167) hide show
  1. package/.mocharc.json +4 -0
  2. package/.nvmrc +1 -0
  3. package/README.md +6 -0
  4. package/esm/src/actions/checkers/AaveV3OpenRatioCheckAction.d.ts +16 -0
  5. package/esm/src/actions/checkers/AaveV3OpenRatioCheckAction.js +22 -0
  6. package/esm/src/actions/checkers/index.d.ts +1 -0
  7. package/esm/src/actions/checkers/index.js +1 -0
  8. package/esm/src/actions/eulerV2/EulerV2BorrowAction.d.ts +16 -0
  9. package/esm/src/actions/eulerV2/EulerV2BorrowAction.js +24 -0
  10. package/esm/src/actions/eulerV2/EulerV2CollateralSwitchAction.d.ts +15 -0
  11. package/esm/src/actions/eulerV2/EulerV2CollateralSwitchAction.js +22 -0
  12. package/esm/src/actions/eulerV2/EulerV2PaybackAction.d.ts +22 -0
  13. package/esm/src/actions/eulerV2/EulerV2PaybackAction.js +40 -0
  14. package/esm/src/actions/eulerV2/EulerV2PaybackWithSharesAction.d.ts +16 -0
  15. package/esm/src/actions/eulerV2/EulerV2PaybackWithSharesAction.js +24 -0
  16. package/esm/src/actions/eulerV2/EulerV2PullDebtAction.d.ts +16 -0
  17. package/esm/src/actions/eulerV2/EulerV2PullDebtAction.js +24 -0
  18. package/esm/src/actions/eulerV2/EulerV2ReorderCollateralsAction.d.ts +14 -0
  19. package/esm/src/actions/eulerV2/EulerV2ReorderCollateralsAction.js +20 -0
  20. package/esm/src/actions/eulerV2/EulerV2SupplyAction.d.ts +23 -0
  21. package/esm/src/actions/eulerV2/EulerV2SupplyAction.js +42 -0
  22. package/esm/src/actions/eulerV2/EulerV2WithdrawAction.d.ts +16 -0
  23. package/esm/src/actions/eulerV2/EulerV2WithdrawAction.js +24 -0
  24. package/esm/src/actions/eulerV2/index.d.ts +8 -0
  25. package/esm/src/actions/eulerV2/index.js +8 -0
  26. package/esm/src/actions/index.d.ts +2 -1
  27. package/esm/src/actions/index.js +2 -1
  28. package/esm/src/addresses.d.ts +24 -0
  29. package/esm/src/addresses.js +11 -7
  30. package/esm/src/index.d.ts +96 -0
  31. package/esm/src/triggers/AaveV2RatioTrigger.js +1 -1
  32. package/esm/src/triggers/AaveV3QuotePriceTrigger.js +1 -1
  33. package/esm/src/triggers/AaveV3RatioTrigger.js +1 -1
  34. package/esm/src/triggers/CBRebondTrigger.js +1 -1
  35. package/esm/src/triggers/ChainLinkPriceTrigger.js +1 -1
  36. package/esm/src/triggers/CompV3RatioTrigger.js +1 -1
  37. package/esm/src/triggers/CompoundRatioTrigger.js +1 -1
  38. package/esm/src/triggers/CurveUsdCollRatioTrigger.js +1 -1
  39. package/esm/src/triggers/CurveUsdHealthRatioTrigger.js +1 -1
  40. package/esm/src/triggers/GasPriceTrigger.js +1 -1
  41. package/esm/src/triggers/LiquityDebtInFrontWithLimitTrigger.js +1 -1
  42. package/esm/src/triggers/LiquityRatioTrigger.js +1 -1
  43. package/esm/src/triggers/MakerRatioTrigger.js +1 -1
  44. package/esm/src/triggers/MorphoAaveV2RatioTrigger.js +1 -1
  45. package/esm/src/triggers/MorphoBlueRatioTrigger.js +1 -1
  46. package/esm/src/triggers/OffchainPriceTrigger.js +1 -1
  47. package/esm/src/triggers/ReflexerRatioTrigger.js +1 -1
  48. package/esm/src/triggers/SparkQuotePriceTrigger.js +1 -1
  49. package/esm/src/triggers/SparkRatioTrigger.js +1 -1
  50. package/esm/src/triggers/TimestampTrigger.js +1 -1
  51. package/esm/src/triggers/TrailingStopTrigger.js +1 -1
  52. package/esm/src/triggers/UniV3CurrentTickTrigger.js +1 -1
  53. package/package.json +8 -5
  54. package/src/actions/checkers/AaveV3OpenRatioCheckAction.ts +30 -0
  55. package/src/actions/checkers/index.ts +2 -1
  56. package/src/actions/eulerV2/EulerV2BorrowAction.ts +37 -0
  57. package/src/actions/eulerV2/EulerV2CollateralSwitchAction.ts +34 -0
  58. package/src/actions/eulerV2/EulerV2PaybackAction.ts +47 -0
  59. package/src/actions/eulerV2/EulerV2PaybackWithSharesAction.ts +37 -0
  60. package/src/actions/eulerV2/EulerV2PullDebtAction.ts +37 -0
  61. package/src/actions/eulerV2/EulerV2ReorderCollateralsAction.ts +31 -0
  62. package/src/actions/eulerV2/EulerV2SupplyAction.ts +49 -0
  63. package/src/actions/eulerV2/EulerV2WithdrawAction.ts +37 -0
  64. package/src/actions/eulerV2/index.ts +8 -0
  65. package/src/actions/index.ts +2 -0
  66. package/src/addresses.ts +10 -5
  67. package/src/triggers/AaveV2RatioTrigger.ts +2 -2
  68. package/src/triggers/AaveV3QuotePriceTrigger.ts +2 -2
  69. package/src/triggers/AaveV3RatioTrigger.ts +2 -2
  70. package/src/triggers/CBRebondTrigger.ts +2 -2
  71. package/src/triggers/ChainLinkPriceTrigger.ts +2 -2
  72. package/src/triggers/CompV3RatioTrigger.ts +2 -2
  73. package/src/triggers/CompoundRatioTrigger.ts +2 -2
  74. package/src/triggers/CurveUsdCollRatioTrigger.ts +2 -2
  75. package/src/triggers/CurveUsdHealthRatioTrigger.ts +1 -1
  76. package/src/triggers/GasPriceTrigger.ts +2 -2
  77. package/src/triggers/LiquityDebtInFrontWithLimitTrigger.ts +2 -2
  78. package/src/triggers/LiquityRatioTrigger.ts +2 -2
  79. package/src/triggers/MakerRatioTrigger.ts +2 -2
  80. package/src/triggers/MorphoAaveV2RatioTrigger.ts +2 -2
  81. package/src/triggers/MorphoBlueRatioTrigger.ts +2 -2
  82. package/src/triggers/OffchainPriceTrigger.ts +2 -2
  83. package/src/triggers/ReflexerRatioTrigger.ts +2 -2
  84. package/src/triggers/SparkQuotePriceTrigger.ts +2 -2
  85. package/src/triggers/SparkRatioTrigger.ts +2 -2
  86. package/src/triggers/TimestampTrigger.ts +2 -2
  87. package/src/triggers/TrailingStopTrigger.ts +2 -2
  88. package/src/triggers/UniV3CurrentTickTrigger.ts +2 -2
  89. package/test/Action.js +1 -1
  90. package/test/ActionWithL2.js +1 -1
  91. package/test/DfsWeb3.js +1 -1
  92. package/test/Recipe.js +1 -1
  93. package/test/Strategy.js +1 -1
  94. package/test/accessLists/Recipe.js +1 -1
  95. package/test/accessLists/access-lists.js +1 -1
  96. package/test/actions/aave/AaveBorrowAction.js +1 -1
  97. package/test/actions/aave/AaveClaimStkAaveAction.js +1 -1
  98. package/test/actions/aave/AaveCollateralSwitchAction.js +1 -1
  99. package/test/actions/aave/AavePaybackAction.js +1 -1
  100. package/test/actions/aave/AaveSupplyAction.js +1 -1
  101. package/test/actions/aave/AaveWithdrawAction.js +1 -1
  102. package/test/actions/balancer/BalancerV2ClaimAction.js +1 -1
  103. package/test/actions/balancer/BalancerV2SupplyAction.js +1 -1
  104. package/test/actions/balancer/BalancerV2WithdrawAction.js +1 -1
  105. package/test/actions/basic/ChangeProxyOwnerAction.js +1 -1
  106. package/test/actions/basic/CreateSubAction.js +1 -2
  107. package/test/actions/basic/SellAction.js +1 -1
  108. package/test/actions/basic/SendTokenAction.js +1 -1
  109. package/test/actions/basic/TokenBalanceAction.js +1 -1
  110. package/test/actions/checkers/AaveV3OpenRatioCheckAction.js +22 -0
  111. package/test/actions/compound/CompoundBorrowAction.js +1 -1
  112. package/test/actions/compound/CompoundCollateralSwitchAction.js +1 -1
  113. package/test/actions/compound/CompoundGetDebtAction.js +1 -1
  114. package/test/actions/compound/CompoundPaybackAction.js +1 -1
  115. package/test/actions/compound/CompoundSupplyAction.js +1 -1
  116. package/test/actions/compound/CompoundWithdrawAction.js +1 -1
  117. package/test/actions/dydx/DyDxWithdrawAction.js +1 -1
  118. package/test/actions/eulerV2/EulerV2BorrowAction.js +31 -0
  119. package/test/actions/eulerV2/EulerV2CollateralSwitchAction.js +28 -0
  120. package/test/actions/eulerV2/EulerV2PaybackAction.js +39 -0
  121. package/test/actions/eulerV2/EulerV2SupplyAction.js +42 -0
  122. package/test/actions/eulerV2/EulerV2WithdrawAction.js +31 -0
  123. package/test/actions/flashloan/DyDxFlashLoanAction.js +1 -1
  124. package/test/actions/insta/InstPullTokensAction.js +1 -1
  125. package/test/actions/lido/LidoStakeAction.js +1 -1
  126. package/test/actions/liquity/LiquityBorrowAction.js +1 -1
  127. package/test/actions/liquity/LiquityClaimAction.js +1 -1
  128. package/test/actions/liquity/LiquityClaimSPRewardsAction.js +1 -1
  129. package/test/actions/liquity/LiquityClaimStakingRewardsAction.js +1 -1
  130. package/test/actions/liquity/LiquityCloseAction.js +1 -1
  131. package/test/actions/liquity/LiquityEthGainToTroveAction.js +1 -1
  132. package/test/actions/liquity/LiquityOpenAction.js +1 -1
  133. package/test/actions/liquity/LiquityPaybackAction.js +1 -1
  134. package/test/actions/liquity/LiquityRedeemAction.js +1 -1
  135. package/test/actions/liquity/LiquitySPDepositAction.js +1 -1
  136. package/test/actions/liquity/LiquitySPWithdrawAction.js +1 -1
  137. package/test/actions/liquity/LiquityStakeAction.js +1 -1
  138. package/test/actions/liquity/LiquitySupplyAction.js +1 -1
  139. package/test/actions/liquity/LiquityUnstakeAction.js +1 -1
  140. package/test/actions/liquity/LiquityWithdrawAction.js +1 -1
  141. package/test/actions/maker/MakerGenerateAction.js +1 -1
  142. package/test/actions/maker/MakerGiveAction.js +1 -1
  143. package/test/actions/maker/MakerMergeAction.js +1 -1
  144. package/test/actions/maker/MakerOpenVaultAction.js +1 -1
  145. package/test/actions/maker/MakerPaybackAction.js +1 -1
  146. package/test/actions/maker/MakerSupplyAction.js +1 -1
  147. package/test/actions/maker/MakerWithdrawAction.js +1 -1
  148. package/test/actions/reflexer/ReflexerNativeUniV2SaviourDepositAction.js +1 -1
  149. package/test/actions/reflexer/ReflexerNativeUniV2SaviourGetReservesAction.js +1 -1
  150. package/test/actions/reflexer/ReflexerNativeUniV2SaviourWithdrawAction.js +1 -1
  151. package/test/actions/uniswap/UniswapSupplyAction.js +1 -1
  152. package/test/actions/uniswap/UniswapWithdrawAction.js +1 -1
  153. package/test/actions/uniswapV3/UniswapV3CollectAction.js +1 -1
  154. package/test/actions/uniswapV3/UniswapV3CreatePoolAction.js +1 -1
  155. package/test/actions/uniswapV3/UniswapV3MintAction.js +1 -1
  156. package/test/actions/uniswapV3/UniswapV3SupplyAction.js +1 -1
  157. package/test/actions/uniswapV3/UniswapV3WithdrawAction.js +1 -1
  158. package/test/actions/yearn/YearnSupplyAction.js +1 -1
  159. package/test/actions/yearn/YearnWithdrawAction.js +1 -1
  160. package/test/index.js +1 -1
  161. package/test/utils/uniswapLP.js +1 -1
  162. package/test/utils/zeroExExchange.js +3 -2
  163. package/tsconfig.esm.json +11 -0
  164. package/tsconfig.json +2 -2
  165. package/umd/index.js +757 -414
  166. package/yarn-error.log +3976 -0
  167. package/.env.example +0 -1
@@ -223,6 +223,12 @@ declare const actionAddressesAllChains: {
223
223
  LlamaLendRepay: string;
224
224
  LlamaLendLevCreate: string;
225
225
  LlamaLendSelfLiquidateWithColl: string;
226
+ EulerV2Supply: string;
227
+ EulerV2Withdraw: string;
228
+ EulerV2Borrow: string;
229
+ EulerV2Payback: string;
230
+ EulerV2CollateralSwitch: string;
231
+ EulerV2View: string;
226
232
  MerklClaim: string;
227
233
  AaveV3DelegateCredit?: undefined;
228
234
  AaveV3RatioTrigger?: undefined;
@@ -445,6 +451,12 @@ declare const actionAddressesAllChains: {
445
451
  LlamaLendRepay?: undefined;
446
452
  LlamaLendLevCreate?: undefined;
447
453
  LlamaLendSelfLiquidateWithColl?: undefined;
454
+ EulerV2Supply?: undefined;
455
+ EulerV2Withdraw?: undefined;
456
+ EulerV2Borrow?: undefined;
457
+ EulerV2Payback?: undefined;
458
+ EulerV2CollateralSwitch?: undefined;
459
+ EulerV2View?: undefined;
448
460
  MerklClaim?: undefined;
449
461
  MorphoBlueView?: undefined;
450
462
  } | {
@@ -661,6 +673,12 @@ declare const actionAddressesAllChains: {
661
673
  MorphoBluePayback?: undefined;
662
674
  MorphoBlueSetAuth?: undefined;
663
675
  MorphoBlueSetAuthWithSig?: undefined;
676
+ EulerV2Supply?: undefined;
677
+ EulerV2Withdraw?: undefined;
678
+ EulerV2Borrow?: undefined;
679
+ EulerV2Payback?: undefined;
680
+ EulerV2CollateralSwitch?: undefined;
681
+ EulerV2View?: undefined;
664
682
  MerklClaim?: undefined;
665
683
  AaveV3DelegateCredit?: undefined;
666
684
  AaveV3RatioTrigger?: undefined;
@@ -878,6 +896,12 @@ declare const actionAddressesAllChains: {
878
896
  LlamaLendRepay?: undefined;
879
897
  LlamaLendLevCreate?: undefined;
880
898
  LlamaLendSelfLiquidateWithColl?: undefined;
899
+ EulerV2Supply?: undefined;
900
+ EulerV2Withdraw?: undefined;
901
+ EulerV2Borrow?: undefined;
902
+ EulerV2Payback?: undefined;
903
+ EulerV2CollateralSwitch?: undefined;
904
+ EulerV2View?: undefined;
881
905
  MerklClaim?: undefined;
882
906
  AaveV3DelegateCredit?: undefined;
883
907
  AaveV3RatioTrigger?: undefined;
@@ -1097,6 +1121,12 @@ declare const actionAddresses: (chainId?: null) => {
1097
1121
  LlamaLendRepay: string;
1098
1122
  LlamaLendLevCreate: string;
1099
1123
  LlamaLendSelfLiquidateWithColl: string;
1124
+ EulerV2Supply: string;
1125
+ EulerV2Withdraw: string;
1126
+ EulerV2Borrow: string;
1127
+ EulerV2Payback: string;
1128
+ EulerV2CollateralSwitch: string;
1129
+ EulerV2View: string;
1100
1130
  MerklClaim: string;
1101
1131
  AaveV3DelegateCredit?: undefined;
1102
1132
  AaveV3RatioTrigger?: undefined;
@@ -1319,6 +1349,12 @@ declare const actionAddresses: (chainId?: null) => {
1319
1349
  LlamaLendRepay?: undefined;
1320
1350
  LlamaLendLevCreate?: undefined;
1321
1351
  LlamaLendSelfLiquidateWithColl?: undefined;
1352
+ EulerV2Supply?: undefined;
1353
+ EulerV2Withdraw?: undefined;
1354
+ EulerV2Borrow?: undefined;
1355
+ EulerV2Payback?: undefined;
1356
+ EulerV2CollateralSwitch?: undefined;
1357
+ EulerV2View?: undefined;
1322
1358
  MerklClaim?: undefined;
1323
1359
  MorphoBlueView?: undefined;
1324
1360
  } | {
@@ -1535,6 +1571,12 @@ declare const actionAddresses: (chainId?: null) => {
1535
1571
  MorphoBluePayback?: undefined;
1536
1572
  MorphoBlueSetAuth?: undefined;
1537
1573
  MorphoBlueSetAuthWithSig?: undefined;
1574
+ EulerV2Supply?: undefined;
1575
+ EulerV2Withdraw?: undefined;
1576
+ EulerV2Borrow?: undefined;
1577
+ EulerV2Payback?: undefined;
1578
+ EulerV2CollateralSwitch?: undefined;
1579
+ EulerV2View?: undefined;
1538
1580
  MerklClaim?: undefined;
1539
1581
  AaveV3DelegateCredit?: undefined;
1540
1582
  AaveV3RatioTrigger?: undefined;
@@ -1752,6 +1794,12 @@ declare const actionAddresses: (chainId?: null) => {
1752
1794
  LlamaLendRepay?: undefined;
1753
1795
  LlamaLendLevCreate?: undefined;
1754
1796
  LlamaLendSelfLiquidateWithColl?: undefined;
1797
+ EulerV2Supply?: undefined;
1798
+ EulerV2Withdraw?: undefined;
1799
+ EulerV2Borrow?: undefined;
1800
+ EulerV2Payback?: undefined;
1801
+ EulerV2CollateralSwitch?: undefined;
1802
+ EulerV2View?: undefined;
1755
1803
  MerklClaim?: undefined;
1756
1804
  AaveV3DelegateCredit?: undefined;
1757
1805
  AaveV3RatioTrigger?: undefined;
@@ -2114,6 +2162,12 @@ declare const _default: {
2114
2162
  LlamaLendRepay: string;
2115
2163
  LlamaLendLevCreate: string;
2116
2164
  LlamaLendSelfLiquidateWithColl: string;
2165
+ EulerV2Supply: string;
2166
+ EulerV2Withdraw: string;
2167
+ EulerV2Borrow: string;
2168
+ EulerV2Payback: string;
2169
+ EulerV2CollateralSwitch: string;
2170
+ EulerV2View: string;
2117
2171
  MerklClaim: string;
2118
2172
  AaveV3DelegateCredit?: undefined;
2119
2173
  AaveV3RatioTrigger?: undefined;
@@ -2336,6 +2390,12 @@ declare const _default: {
2336
2390
  LlamaLendRepay?: undefined;
2337
2391
  LlamaLendLevCreate?: undefined;
2338
2392
  LlamaLendSelfLiquidateWithColl?: undefined;
2393
+ EulerV2Supply?: undefined;
2394
+ EulerV2Withdraw?: undefined;
2395
+ EulerV2Borrow?: undefined;
2396
+ EulerV2Payback?: undefined;
2397
+ EulerV2CollateralSwitch?: undefined;
2398
+ EulerV2View?: undefined;
2339
2399
  MerklClaim?: undefined;
2340
2400
  MorphoBlueView?: undefined;
2341
2401
  } | {
@@ -2552,6 +2612,12 @@ declare const _default: {
2552
2612
  MorphoBluePayback?: undefined;
2553
2613
  MorphoBlueSetAuth?: undefined;
2554
2614
  MorphoBlueSetAuthWithSig?: undefined;
2615
+ EulerV2Supply?: undefined;
2616
+ EulerV2Withdraw?: undefined;
2617
+ EulerV2Borrow?: undefined;
2618
+ EulerV2Payback?: undefined;
2619
+ EulerV2CollateralSwitch?: undefined;
2620
+ EulerV2View?: undefined;
2555
2621
  MerklClaim?: undefined;
2556
2622
  AaveV3DelegateCredit?: undefined;
2557
2623
  AaveV3RatioTrigger?: undefined;
@@ -2769,6 +2835,12 @@ declare const _default: {
2769
2835
  LlamaLendRepay?: undefined;
2770
2836
  LlamaLendLevCreate?: undefined;
2771
2837
  LlamaLendSelfLiquidateWithColl?: undefined;
2838
+ EulerV2Supply?: undefined;
2839
+ EulerV2Withdraw?: undefined;
2840
+ EulerV2Borrow?: undefined;
2841
+ EulerV2Payback?: undefined;
2842
+ EulerV2CollateralSwitch?: undefined;
2843
+ EulerV2View?: undefined;
2772
2844
  MerklClaim?: undefined;
2773
2845
  AaveV3DelegateCredit?: undefined;
2774
2846
  AaveV3RatioTrigger?: undefined;
@@ -2988,6 +3060,12 @@ declare const _default: {
2988
3060
  LlamaLendRepay: string;
2989
3061
  LlamaLendLevCreate: string;
2990
3062
  LlamaLendSelfLiquidateWithColl: string;
3063
+ EulerV2Supply: string;
3064
+ EulerV2Withdraw: string;
3065
+ EulerV2Borrow: string;
3066
+ EulerV2Payback: string;
3067
+ EulerV2CollateralSwitch: string;
3068
+ EulerV2View: string;
2991
3069
  MerklClaim: string;
2992
3070
  AaveV3DelegateCredit?: undefined;
2993
3071
  AaveV3RatioTrigger?: undefined;
@@ -3210,6 +3288,12 @@ declare const _default: {
3210
3288
  LlamaLendRepay?: undefined;
3211
3289
  LlamaLendLevCreate?: undefined;
3212
3290
  LlamaLendSelfLiquidateWithColl?: undefined;
3291
+ EulerV2Supply?: undefined;
3292
+ EulerV2Withdraw?: undefined;
3293
+ EulerV2Borrow?: undefined;
3294
+ EulerV2Payback?: undefined;
3295
+ EulerV2CollateralSwitch?: undefined;
3296
+ EulerV2View?: undefined;
3213
3297
  MerklClaim?: undefined;
3214
3298
  MorphoBlueView?: undefined;
3215
3299
  } | {
@@ -3426,6 +3510,12 @@ declare const _default: {
3426
3510
  MorphoBluePayback?: undefined;
3427
3511
  MorphoBlueSetAuth?: undefined;
3428
3512
  MorphoBlueSetAuthWithSig?: undefined;
3513
+ EulerV2Supply?: undefined;
3514
+ EulerV2Withdraw?: undefined;
3515
+ EulerV2Borrow?: undefined;
3516
+ EulerV2Payback?: undefined;
3517
+ EulerV2CollateralSwitch?: undefined;
3518
+ EulerV2View?: undefined;
3429
3519
  MerklClaim?: undefined;
3430
3520
  AaveV3DelegateCredit?: undefined;
3431
3521
  AaveV3RatioTrigger?: undefined;
@@ -3643,6 +3733,12 @@ declare const _default: {
3643
3733
  LlamaLendRepay?: undefined;
3644
3734
  LlamaLendLevCreate?: undefined;
3645
3735
  LlamaLendSelfLiquidateWithColl?: undefined;
3736
+ EulerV2Supply?: undefined;
3737
+ EulerV2Withdraw?: undefined;
3738
+ EulerV2Borrow?: undefined;
3739
+ EulerV2Payback?: undefined;
3740
+ EulerV2CollateralSwitch?: undefined;
3741
+ EulerV2View?: undefined;
3646
3742
  MerklClaim?: undefined;
3647
3743
  AaveV3DelegateCredit?: undefined;
3648
3744
  AaveV3RatioTrigger?: undefined;
@@ -7,6 +7,6 @@ import { getAddr } from '../addresses';
7
7
  */
8
8
  export class AaveV2RatioTrigger extends Action {
9
9
  constructor(user, market, ratio, state) {
10
- super('AaveV2RatioTrigger', getAddr('AaveV2RatioTrigger'), [['address', 'address', 'uint256', 'uint8']], [[user, market, ratio, state]]);
10
+ super('AaveV2RatioTrigger', getAddr('Empty'), [['address', 'address', 'uint256', 'uint8']], [[user, market, ratio, state]]);
11
11
  }
12
12
  }
@@ -7,6 +7,6 @@ import { getAddr } from '../addresses';
7
7
  */
8
8
  export class AaveV3QuotePriceTrigger extends Action {
9
9
  constructor(baseTokenAddr, quoteTokenAddr, price, state) {
10
- super('AaveV3QuotePriceTrigger', getAddr('AaveV3QuotePriceTrigger'), [['address', 'address', 'uint256', 'uint8']], [[baseTokenAddr, quoteTokenAddr, price, state]]);
10
+ super('AaveV3QuotePriceTrigger', getAddr('Empty'), [['address', 'address', 'uint256', 'uint8']], [[baseTokenAddr, quoteTokenAddr, price, state]]);
11
11
  }
12
12
  }
@@ -7,6 +7,6 @@ import { getAddr } from '../addresses';
7
7
  */
8
8
  export class AaveV3RatioTrigger extends Action {
9
9
  constructor(user, market, ratio, state) {
10
- super('AaveV3RatioTrigger', getAddr('AaveV3RatioTrigger'), [['address', 'address', 'uint256', 'uint8']], [[user, market, ratio, state]]);
10
+ super('AaveV3RatioTrigger', getAddr('Empty'), [['address', 'address', 'uint256', 'uint8']], [[user, market, ratio, state]]);
11
11
  }
12
12
  }
@@ -7,6 +7,6 @@ import { getAddr } from '../addresses';
7
7
  */
8
8
  export class CBRebondTrigger extends Action {
9
9
  constructor(bondID) {
10
- super('CBRebondTrigger', getAddr('CBRebondTrigger'), ['uint256'], [bondID]);
10
+ super('CBRebondTrigger', getAddr('Empty'), ['uint256'], [bondID]);
11
11
  }
12
12
  }
@@ -7,6 +7,6 @@ import { getAddr } from '../addresses';
7
7
  */
8
8
  export class ChainLinkPriceTrigger extends Action {
9
9
  constructor(tokenAddr, price, state) {
10
- super('ChainLinkPriceTrigger', getAddr('ChainLinkPriceTrigger'), ['address', 'uint256', 'uint8'], [tokenAddr, price, state]);
10
+ super('ChainLinkPriceTrigger', getAddr('Empty'), ['address', 'uint256', 'uint8'], [tokenAddr, price, state]);
11
11
  }
12
12
  }
@@ -7,6 +7,6 @@ import { getAddr } from '../addresses';
7
7
  */
8
8
  export class CompV3RatioTrigger extends Action {
9
9
  constructor(user, market, ratio, state) {
10
- super('CompV3RatioTrigger', getAddr('CompV3RatioTrigger'), [['address', 'address', 'uint256', 'uint8']], [[user, market, ratio, state]]);
10
+ super('CompV3RatioTrigger', getAddr('Empty'), [['address', 'address', 'uint256', 'uint8']], [[user, market, ratio, state]]);
11
11
  }
12
12
  }
@@ -7,6 +7,6 @@ import { getAddr } from '../addresses';
7
7
  */
8
8
  export class CompoundRatioTrigger extends Action {
9
9
  constructor(user, ratio, state) {
10
- super('CompoundRatioTrigger', getAddr('CompoundRatioTrigger'), ['address', 'uint256', 'uint8'], [user, ratio, state]);
10
+ super('CompoundRatioTrigger', getAddr('Empty'), ['address', 'uint256', 'uint8'], [user, ratio, state]);
11
11
  }
12
12
  }
@@ -7,6 +7,6 @@ import { getAddr } from '../addresses';
7
7
  */
8
8
  export class CurveUsdCollRatioTrigger extends Action {
9
9
  constructor(user, controller, ratio, state) {
10
- super('CurveUsdCollRatioTrigger', getAddr('CurveUsdCollRatioTrigger'), [['address', 'address', 'uint256', 'uint8']], [[user, controller, ratio, state]]);
10
+ super('CurveUsdCollRatioTrigger', getAddr('Empty'), [['address', 'address', 'uint256', 'uint8']], [[user, controller, ratio, state]]);
11
11
  }
12
12
  }
@@ -7,6 +7,6 @@ import { getAddr } from '../addresses';
7
7
  */
8
8
  export class CurveUsdHealthRatioTrigger extends Action {
9
9
  constructor(user, controller, ratio) {
10
- super('CurveUsdHealthRatioTrigger', getAddr('CurveUsdHealthRatioTrigger'), [['address', 'address', 'uint256']], [[user, controller, ratio]]);
10
+ super('CurveUsdHealthRatioTrigger', getAddr('Empty'), [['address', 'address', 'uint256']], [[user, controller, ratio]]);
11
11
  }
12
12
  }
@@ -7,6 +7,6 @@ import { getAddr } from '../addresses';
7
7
  */
8
8
  export class GasPriceTrigger extends Action {
9
9
  constructor(maxGasPrice) {
10
- super('GasPriceTrigger', getAddr('GasPriceTrigger'), ['uint256'], [maxGasPrice]);
10
+ super('GasPriceTrigger', getAddr('Empty'), ['uint256'], [maxGasPrice]);
11
11
  }
12
12
  }
@@ -7,6 +7,6 @@ import { getAddr } from '../addresses';
7
7
  */
8
8
  export class LiquityDebtInFrontWithLimitTrigger extends Action {
9
9
  constructor(troveOwner, debtInFront) {
10
- super('LiquityDebtInFrontWithLimitTrigger', getAddr('LiquityDebtInFrontWithLimitTrigger'), ['address', 'uint256'], [troveOwner, debtInFront]);
10
+ super('LiquityDebtInFrontWithLimitTrigger', getAddr('Empty'), ['address', 'uint256'], [troveOwner, debtInFront]);
11
11
  }
12
12
  }
@@ -7,6 +7,6 @@ import { getAddr } from '../addresses';
7
7
  */
8
8
  export class LiquityRatioTrigger extends Action {
9
9
  constructor(troveOwner, ratio, state) {
10
- super('LiquityRatioTrigger', getAddr('LiquityRatioTrigger'), ['addresss', 'uint256', 'uint8'], [troveOwner, ratio, state]);
10
+ super('LiquityRatioTrigger', getAddr('Empty'), ['addresss', 'uint256', 'uint8'], [troveOwner, ratio, state]);
11
11
  }
12
12
  }
@@ -7,6 +7,6 @@ import { getAddr } from '../addresses';
7
7
  */
8
8
  export class MakerRatioTrigger extends Action {
9
9
  constructor(vaultId, ratio, state) {
10
- super('McdRatioTrigger', getAddr('McdRatioTrigger'), ['uint256', 'uint256', 'uint8'], [vaultId, ratio, state]);
10
+ super('McdRatioTrigger', getAddr('Empty'), ['uint256', 'uint256', 'uint8'], [vaultId, ratio, state]);
11
11
  }
12
12
  }
@@ -7,6 +7,6 @@ import { getAddr } from '../addresses';
7
7
  */
8
8
  export class MorphoAaveV2RatioTrigger extends Action {
9
9
  constructor(user, ratio, state) {
10
- super('MorphoAaveV2RatioTrigger', getAddr('MorphoAaveV2RatioTrigger'), ['address', 'uint256', 'uint8'], [user, ratio, state]);
10
+ super('MorphoAaveV2RatioTrigger', getAddr('Empty'), ['address', 'uint256', 'uint8'], [user, ratio, state]);
11
11
  }
12
12
  }
@@ -7,6 +7,6 @@ import { getAddr } from '../addresses';
7
7
  */
8
8
  export class MorphoBlueRatioTrigger extends Action {
9
9
  constructor(marketId, user, ratio, state) {
10
- super('MorphoBlueRatioTrigger', getAddr('MorphoBlueRatioTrigger'), [['bytes32', 'address', 'uint256', 'uint8']], [[marketId, user, ratio, state]]);
10
+ super('MorphoBlueRatioTrigger', getAddr('Empty'), [['bytes32', 'address', 'uint256', 'uint8']], [[marketId, user, ratio, state]]);
11
11
  }
12
12
  }
@@ -7,6 +7,6 @@ import { getAddr } from '../addresses';
7
7
  */
8
8
  export class OffchainPriceTrigger extends Action {
9
9
  constructor(limitPrice, limitType) {
10
- super('OffchainPriceTrigger', getAddr('OffchainPriceTrigger'), ['uint256', 'uint8'], [limitPrice, limitType]);
10
+ super('OffchainPriceTrigger', getAddr('Empty'), ['uint256', 'uint8'], [limitPrice, limitType]);
11
11
  }
12
12
  }
@@ -7,6 +7,6 @@ import { getAddr } from '../addresses';
7
7
  */
8
8
  export class ReflexerRatioTrigger extends Action {
9
9
  constructor(vaultId, ratio, state) {
10
- super('ReflexerRatioTrigger', getAddr('ReflexerRatioTrigger'), ['uint256', 'uint256', 'uint8'], [vaultId, ratio, state]);
10
+ super('ReflexerRatioTrigger', getAddr('Empty'), ['uint256', 'uint256', 'uint8'], [vaultId, ratio, state]);
11
11
  }
12
12
  }
@@ -7,6 +7,6 @@ import { getAddr } from '../addresses';
7
7
  */
8
8
  export class SparkQuotePriceTrigger extends Action {
9
9
  constructor(baseTokenAddr, quoteTokenAddr, price, state) {
10
- super('SparkQuotePriceTrigger', getAddr('SparkQuotePriceTrigger'), [['address', 'address', 'uint256', 'uint8']], [[baseTokenAddr, quoteTokenAddr, price, state]]);
10
+ super('SparkQuotePriceTrigger', getAddr('Empty'), [['address', 'address', 'uint256', 'uint8']], [[baseTokenAddr, quoteTokenAddr, price, state]]);
11
11
  }
12
12
  }
@@ -7,6 +7,6 @@ import { getAddr } from '../addresses';
7
7
  */
8
8
  export class SparkRatioTrigger extends Action {
9
9
  constructor(user, market, ratio, state) {
10
- super('SparkRatioTrigger', getAddr('SparkRatioTrigger'), [['address', 'address', 'uint256', 'uint8']], [[user, market, ratio, state]]);
10
+ super('SparkRatioTrigger', getAddr('Empty'), [['address', 'address', 'uint256', 'uint8']], [[user, market, ratio, state]]);
11
11
  }
12
12
  }
@@ -7,6 +7,6 @@ import { getAddr } from '../addresses';
7
7
  */
8
8
  export class TimestampTrigger extends Action {
9
9
  constructor(nextTimestamp) {
10
- super('TimestampTrigger', getAddr('TimestampTrigger'), ['uint256'], [nextTimestamp]);
10
+ super('TimestampTrigger', getAddr('Empty'), ['uint256'], [nextTimestamp]);
11
11
  }
12
12
  }
@@ -7,6 +7,6 @@ import { getAddr } from '../addresses';
7
7
  */
8
8
  export class TrailingStopTrigger extends Action {
9
9
  constructor(tokenAddr, percentage, roundId) {
10
- super('TrailingStopTrigger', getAddr('TrailingStopTrigger'), ['address', 'uint256', 'uint80'], [tokenAddr, percentage, roundId]);
10
+ super('TrailingStopTrigger', getAddr('Empty'), ['address', 'uint256', 'uint80'], [tokenAddr, percentage, roundId]);
11
11
  }
12
12
  }
@@ -7,6 +7,6 @@ import { getAddr } from '../addresses';
7
7
  */
8
8
  export class UniV3CurrentTickTrigger extends Action {
9
9
  constructor(tokenId, state) {
10
- super('UniV3CurrentTickTrigger', getAddr('UniV3CurrentTickTrigger'), ['uint256', 'uint8'], [tokenId, state]);
10
+ super('UniV3CurrentTickTrigger', getAddr('Empty'), ['uint256', 'uint8'], [tokenId, state]);
11
11
  }
12
12
  }
package/package.json CHANGED
@@ -1,26 +1,29 @@
1
1
  {
2
2
  "name": "@defisaver/sdk",
3
- "version": "1.2.7",
3
+ "version": "1.2.9",
4
4
  "description": "",
5
5
  "main": "./umd/index.js",
6
6
  "module": "./esm/src/index.js",
7
7
  "types": "./esm/src/index.d.ts",
8
8
  "scripts": {
9
- "test": "mocha --recursive",
9
+ "test": "mocha 'test/**'",
10
+ "test-single": "mocha ./test/$npm_config_name.js",
10
11
  "version-bump": "git commit -am \"Version bump to $(npm version patch | cut -c 2-)\"",
11
- "build:esm": "rm -rf esm && tsc -b",
12
+ "build:esm": "rm -rf esm && tsc -p tsconfig.esm.json",
12
13
  "build:umd": "rm -rf umd && webpack --config=webpack.umd.js",
13
14
  "build": "npm run lint && npm run build:umd && npm run build:esm",
14
15
  "documentMD": "npx typedoc --plugin typedoc-plugin-markdown --out docs/md",
15
16
  "document": "npx typedoc --out docs/default",
16
- "lint": "eslint . --ext .ts"
17
+ "lint": "eslint . --ext .ts --fix",
18
+ "lint-check": "eslint .",
19
+ "build-test": "npm run build && npm run test"
17
20
  },
18
21
  "author": "DeFi Saver",
19
22
  "repository": "https://github.com/DecenterApps/defisaver-sdk",
20
23
  "license": "ISC",
21
24
  "dependencies": {
22
25
  "@defisaver/eslint-config": "^1.0.0",
23
- "@defisaver/tokens": "^1.5.34",
26
+ "@defisaver/tokens": "^1.5.46",
24
27
  "@ethersproject/address": "^5.0.10",
25
28
  "@ethersproject/solidity": "^5.0.9",
26
29
  "@types/web3-eth-abi": "^1.2.2",
@@ -0,0 +1,30 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ import { EthAddress, uint256 } from '../../types';
4
+
5
+ /**
6
+ * AaveV3OpenRatioCheckAction - Checks aave V3 ratio for users proxy position and reverts if faulty.
7
+ *
8
+ * @dev This checker action is different from AaveV3RatioCheckAction in that it checks current ratio without checking previous ratio.
9
+ *
10
+ * @category Checkers
11
+ */
12
+ export class AaveV3OpenRatioCheckAction extends Action {
13
+ /**
14
+ * @param targetRatio The ratio user want to be at
15
+ * @param market Address provider for specific market
16
+ */
17
+ constructor(targetRatio:uint256, market:EthAddress) {
18
+ super(
19
+ 'AaveV3OpenRatioCheck',
20
+ getAddr('Empty'),
21
+ ['uint256', 'address'],
22
+ [targetRatio, market],
23
+ );
24
+
25
+ this.mappableArgs = [
26
+ this.args[0],
27
+ this.args[1],
28
+ ];
29
+ }
30
+ }
@@ -8,4 +8,5 @@ export * from './MorphoAaveV2RatioCheckAction';
8
8
  export * from './SparkRatioCheckAction';
9
9
  export * from './LiquityRatioIncreaseCheckAction';
10
10
  export * from './CurveUsdCollRatioCheck';
11
- export * from './MorphoBlueRatioCheckAction';
11
+ export * from './MorphoBlueRatioCheckAction';
12
+ export * from './AaveV3OpenRatioCheckAction';
@@ -0,0 +1,37 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ import { EthAddress, uint256 } from '../../types';
4
+
5
+ /**
6
+ * EulerV2BorrowAction - Borrow assets from an Euler vault
7
+ *
8
+ * @category EulerV2
9
+ */
10
+ export class EulerV2BorrowAction extends Action {
11
+ /**
12
+ * @param vault The address of the Euler vault
13
+ * @param account The address of the Euler account, defaults to user's wallet
14
+ * @param receiver The address to receive the borrowed assets
15
+ * @param amount The amount of assets to borrow
16
+ */
17
+ constructor(
18
+ vault: EthAddress,
19
+ account: EthAddress,
20
+ receiver: EthAddress,
21
+ amount: uint256,
22
+ ) {
23
+ super(
24
+ 'EulerV2Borrow',
25
+ getAddr('EulerV2Borrow'),
26
+ ['address', 'address', 'address', 'uint256'],
27
+ [vault, account, receiver, amount],
28
+ );
29
+
30
+ this.mappableArgs = [
31
+ this.args[0],
32
+ this.args[1],
33
+ this.args[2],
34
+ this.args[3],
35
+ ];
36
+ }
37
+ }
@@ -0,0 +1,34 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ import { EthAddress } from '../../types';
4
+
5
+ /**
6
+ * EulerV2CollateralSwitchAction - Switch if vault will be used as collateral or not
7
+ *
8
+ * @category EulerV2
9
+ */
10
+ export class EulerV2CollateralSwitchAction extends Action {
11
+ /**
12
+ * @param vault The address of the vault
13
+ * @param account The address of the Euler account, defaults to user's wallet
14
+ * @param enableAsColl Whether to enable or disable the vault as collateral
15
+ */
16
+ constructor(
17
+ vault: EthAddress,
18
+ account: EthAddress,
19
+ enableAsColl: boolean,
20
+ ) {
21
+ super(
22
+ 'EulerV2CollateralSwitch',
23
+ getAddr('EulerV2CollateralSwitch'),
24
+ ['address', 'address', 'bool'],
25
+ [vault, account, enableAsColl],
26
+ );
27
+
28
+ this.mappableArgs = [
29
+ this.args[0],
30
+ this.args[1],
31
+ this.args[2],
32
+ ];
33
+ }
34
+ }
@@ -0,0 +1,47 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ import { EthAddress, uint256 } from '../../types';
4
+
5
+ /**
6
+ * EulerV2PaybackAction - Payback debt assets to a Euler vault
7
+ *
8
+ * @category EulerV2
9
+ */
10
+ export class EulerV2PaybackAction extends Action {
11
+ tokenForApproval: EthAddress;
12
+
13
+ /**
14
+ * @param vault The address of the vault
15
+ * @param tokenAddress Underlying token address
16
+ * @param account The address of the Euler account, defaults to user's wallet
17
+ * @param from The address from which to pull tokens to be paid back
18
+ * @param amount The amount of assets to pay back (uint256.max for full debt repayment)
19
+ */
20
+ constructor(
21
+ vault: EthAddress,
22
+ tokenAddress: EthAddress,
23
+ account: EthAddress,
24
+ from: EthAddress,
25
+ amount: uint256,
26
+ ) {
27
+ super(
28
+ 'EulerV2Payback',
29
+ getAddr('EulerV2Payback'),
30
+ ['address', 'address', 'address', 'uint256'],
31
+ [vault, account, from, amount],
32
+ );
33
+
34
+ this.mappableArgs = [
35
+ this.args[0],
36
+ this.args[1],
37
+ this.args[2],
38
+ this.args[3],
39
+ ];
40
+
41
+ this.tokenForApproval = tokenAddress;
42
+ }
43
+
44
+ async getAssetsToApprove() {
45
+ return [{ asset: this.tokenForApproval, owner: this.args[2] }];
46
+ }
47
+ }
@@ -0,0 +1,37 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ import { EthAddress, uint256 } from '../../types';
4
+
5
+ /**
6
+ * EulerV2PaybackWithSharesAction - Payback debt asset to a Euler vault using share tokens
7
+ *
8
+ * @category EulerV2
9
+ */
10
+ export class EulerV2PaybackWithSharesAction extends Action {
11
+ /**
12
+ * @param vault The address of the vault
13
+ * @param account The address of the Euler account for which debt is paid back, defaults to user's wallet
14
+ * @param from The address of the Euler account for which shares are burned to pay back debt for 'account', defaults to user's wallet
15
+ * @param amount The amount of asset tokens to be paid back (uint256.max for full debt repayment or up to the available deposit shares in 'from' account)
16
+ */
17
+ constructor(
18
+ vault: EthAddress,
19
+ account: EthAddress,
20
+ from: EthAddress,
21
+ amount: uint256,
22
+ ) {
23
+ super(
24
+ 'EulerV2PaybackWithShares',
25
+ getAddr('Empty'),
26
+ ['address', 'address', 'address', 'uint256'],
27
+ [vault, account, from, amount],
28
+ );
29
+
30
+ this.mappableArgs = [
31
+ this.args[0],
32
+ this.args[1],
33
+ this.args[2],
34
+ this.args[3],
35
+ ];
36
+ }
37
+ }