@defisaver/sdk 1.0.61 → 1.0.63-dev-1

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 (130) hide show
  1. package/esm/src/Action.d.ts +2 -2
  2. package/esm/src/actions/aave/AaveBorrowAction.js +8 -0
  3. package/esm/src/actions/basic/ApproveTokenAction.js +5 -0
  4. package/esm/src/actions/basic/ExecuteSafeTxAction.d.ts +23 -0
  5. package/esm/src/actions/basic/ExecuteSafeTxAction.js +60 -0
  6. package/esm/src/actions/basic/LSVSellAction.d.ts +23 -0
  7. package/esm/src/actions/basic/LSVSellAction.js +61 -0
  8. package/esm/src/actions/basic/LimitSellAction.d.ts +24 -0
  9. package/esm/src/actions/basic/LimitSellAction.js +63 -0
  10. package/esm/src/actions/basic/RemoveTokenApprovalAction.d.ts +15 -0
  11. package/esm/src/actions/basic/RemoveTokenApprovalAction.js +42 -0
  12. package/esm/src/actions/basic/index.d.ts +5 -1
  13. package/esm/src/actions/basic/index.js +5 -1
  14. package/esm/src/actions/checkers/AaveV2RatioCheckAction.d.ts +14 -0
  15. package/esm/src/actions/checkers/AaveV2RatioCheckAction.js +20 -0
  16. package/esm/src/actions/checkers/CompoundV2RatioCheckAction.d.ts +14 -0
  17. package/esm/src/actions/checkers/CompoundV2RatioCheckAction.js +20 -0
  18. package/esm/src/actions/checkers/CurveUsdCollRatioCheck.d.ts +15 -0
  19. package/esm/src/actions/checkers/CurveUsdCollRatioCheck.js +22 -0
  20. package/esm/src/actions/checkers/index.d.ts +4 -1
  21. package/esm/src/actions/checkers/index.js +4 -1
  22. package/esm/src/actions/curveusd/CurveUsdGetDebtAction.d.ts +8 -0
  23. package/esm/src/actions/curveusd/CurveUsdGetDebtAction.js +13 -0
  24. package/esm/src/actions/curveusd/index.d.ts +1 -0
  25. package/esm/src/actions/curveusd/index.js +1 -0
  26. package/esm/src/actions/flashloan/AaveV3FlashLoanCarryDebtAction.d.ts +18 -0
  27. package/esm/src/actions/flashloan/AaveV3FlashLoanCarryDebtAction.js +28 -0
  28. package/esm/src/actions/flashloan/FLAction.js +3 -0
  29. package/esm/src/actions/flashloan/MorphoBlueFlashLoanAction.d.ts +16 -0
  30. package/esm/src/actions/flashloan/MorphoBlueFlashLoanAction.js +18 -0
  31. package/esm/src/actions/flashloan/MorphoBlueFlashLoanPaybackAction.d.ts +14 -0
  32. package/esm/src/actions/flashloan/MorphoBlueFlashLoanPaybackAction.js +16 -0
  33. package/esm/src/actions/flashloan/index.d.ts +3 -0
  34. package/esm/src/actions/flashloan/index.js +3 -0
  35. package/esm/src/actions/index.d.ts +3 -1
  36. package/esm/src/actions/index.js +3 -1
  37. package/esm/src/actions/lsv/LSVBorrowAction.d.ts +14 -0
  38. package/esm/src/actions/lsv/LSVBorrowAction.js +19 -0
  39. package/esm/src/actions/lsv/LSVPaybackAction.d.ts +13 -0
  40. package/esm/src/actions/lsv/LSVPaybackAction.js +18 -0
  41. package/esm/src/actions/lsv/LSVSupplyAction.d.ts +15 -0
  42. package/esm/src/actions/lsv/LSVSupplyAction.js +21 -0
  43. package/esm/src/actions/lsv/LSVWithdrawAction.d.ts +15 -0
  44. package/esm/src/actions/lsv/LSVWithdrawAction.js +21 -0
  45. package/esm/src/actions/lsv/index.d.ts +4 -0
  46. package/esm/src/actions/lsv/index.js +4 -0
  47. package/esm/src/actions/maker/MakerGiveAction.d.ts +1 -2
  48. package/esm/src/actions/maker/MakerGiveAction.js +2 -3
  49. package/esm/src/actions/morpho/aaveV3/MorphoAaveV3SetManagerAction.d.ts +14 -0
  50. package/esm/src/actions/morpho/aaveV3/MorphoAaveV3SetManagerAction.js +24 -0
  51. package/esm/src/actions/morpho/index.d.ts +1 -0
  52. package/esm/src/actions/morpho/index.js +1 -0
  53. package/esm/src/actions/morpho-blue/MorphoBlueBorrowAction.d.ts +21 -0
  54. package/esm/src/actions/morpho-blue/MorphoBlueBorrowAction.js +46 -0
  55. package/esm/src/actions/morpho-blue/MorphoBluePaybackAction.d.ts +24 -0
  56. package/esm/src/actions/morpho-blue/MorphoBluePaybackAction.js +46 -0
  57. package/esm/src/actions/morpho-blue/MorphoBlueSetAuthAction.d.ts +12 -0
  58. package/esm/src/actions/morpho-blue/MorphoBlueSetAuthAction.js +18 -0
  59. package/esm/src/actions/morpho-blue/MorphoBlueSetAuthWithSigAction.d.ts +12 -0
  60. package/esm/src/actions/morpho-blue/MorphoBlueSetAuthWithSigAction.js +21 -0
  61. package/esm/src/actions/morpho-blue/MorphoBlueSupplyAction.d.ts +24 -0
  62. package/esm/src/actions/morpho-blue/MorphoBlueSupplyAction.js +46 -0
  63. package/esm/src/actions/morpho-blue/MorphoBlueSupplyCollateralAction.d.ts +24 -0
  64. package/esm/src/actions/morpho-blue/MorphoBlueSupplyCollateralAction.js +46 -0
  65. package/esm/src/actions/morpho-blue/MorphoBlueWithdrawAction.d.ts +21 -0
  66. package/esm/src/actions/morpho-blue/MorphoBlueWithdrawAction.js +46 -0
  67. package/esm/src/actions/morpho-blue/MorphoBlueWithdrawCollateralAction.d.ts +21 -0
  68. package/esm/src/actions/morpho-blue/MorphoBlueWithdrawCollateralAction.js +46 -0
  69. package/esm/src/actions/morpho-blue/index.d.ts +8 -0
  70. package/esm/src/actions/morpho-blue/index.js +8 -0
  71. package/esm/src/addresses.d.ts +79 -3
  72. package/esm/src/addresses.js +24 -3
  73. package/esm/src/index.d.ts +316 -12
  74. package/esm/src/triggers/AaveV2RatioTrigger.d.ts +10 -0
  75. package/esm/src/triggers/AaveV2RatioTrigger.js +12 -0
  76. package/esm/src/triggers/CurveUsdCollRatioTrigger.d.ts +10 -0
  77. package/esm/src/triggers/CurveUsdCollRatioTrigger.js +12 -0
  78. package/esm/src/triggers/OffchainPriceTrigger.d.ts +10 -0
  79. package/esm/src/triggers/OffchainPriceTrigger.js +12 -0
  80. package/esm/src/triggers/index.d.ts +3 -0
  81. package/esm/src/triggers/index.js +3 -0
  82. package/esm/src/types.d.ts +20 -20
  83. package/esm/src/utils/curveusd-utils.d.ts +10 -0
  84. package/esm/src/utils/curveusd-utils.js +7 -3
  85. package/package.json +1 -1
  86. package/src/actions/aave/AaveBorrowAction.ts +9 -0
  87. package/src/actions/basic/ApproveTokenAction.ts +5 -0
  88. package/src/actions/basic/ExecuteSafeTxAction.ts +85 -0
  89. package/src/actions/basic/LSVSellAction.ts +61 -0
  90. package/src/actions/basic/LimitSellAction.ts +63 -0
  91. package/src/actions/basic/RemoveTokenApprovalAction.ts +39 -0
  92. package/src/actions/basic/index.ts +5 -1
  93. package/src/actions/checkers/AaveV2RatioCheckAction.ts +23 -0
  94. package/src/actions/checkers/CompoundV2RatioCheckAction.ts +23 -0
  95. package/src/actions/checkers/CurveUsdCollRatioCheck.ts +25 -0
  96. package/src/actions/checkers/index.ts +4 -1
  97. package/src/actions/curveusd/CurveUsdGetDebtAction.ts +21 -0
  98. package/src/actions/curveusd/index.ts +2 -1
  99. package/src/actions/flashloan/AaveV3FlashLoanCarryDebtAction.ts +35 -0
  100. package/src/actions/flashloan/FLAction.ts +3 -0
  101. package/src/actions/flashloan/MorphoBlueFlashLoanAction.ts +25 -0
  102. package/src/actions/flashloan/MorphoBlueFlashLoanPaybackAction.ts +18 -0
  103. package/src/actions/flashloan/index.ts +4 -1
  104. package/src/actions/index.ts +4 -0
  105. package/src/actions/lsv/LSVBorrowAction.ts +21 -0
  106. package/src/actions/lsv/LSVPaybackAction.ts +20 -0
  107. package/src/actions/lsv/LSVSupplyAction.ts +23 -0
  108. package/src/actions/lsv/LSVWithdrawAction.ts +23 -0
  109. package/src/actions/lsv/index.ts +4 -0
  110. package/src/actions/maker/MakerGiveAction.ts +2 -3
  111. package/src/actions/morpho/aaveV3/MorphoAaveV3SetManagerAction.ts +32 -0
  112. package/src/actions/morpho/index.ts +1 -0
  113. package/src/actions/morpho-blue/MorphoBlueBorrowAction.ts +54 -0
  114. package/src/actions/morpho-blue/MorphoBluePaybackAction.ts +54 -0
  115. package/src/actions/morpho-blue/MorphoBlueSetAuthAction.ts +25 -0
  116. package/src/actions/morpho-blue/MorphoBlueSetAuthWithSigAction.ts +39 -0
  117. package/src/actions/morpho-blue/MorphoBlueSupplyAction.ts +54 -0
  118. package/src/actions/morpho-blue/MorphoBlueSupplyCollateralAction.ts +54 -0
  119. package/src/actions/morpho-blue/MorphoBlueWithdrawAction.ts +54 -0
  120. package/src/actions/morpho-blue/MorphoBlueWithdrawCollateralAction.ts +54 -0
  121. package/src/actions/morpho-blue/index.ts +8 -0
  122. package/src/addresses.ts +26 -3
  123. package/src/triggers/AaveV2RatioTrigger.ts +14 -0
  124. package/src/triggers/CurveUsdCollRatioTrigger.ts +14 -0
  125. package/src/triggers/OffchainPriceTrigger.ts +14 -0
  126. package/src/triggers/index.ts +4 -0
  127. package/src/utils/basic-utils.ts +1 -1
  128. package/src/utils/curveusd-utils.ts +7 -3
  129. package/umd/index.js +1627 -584
  130. package/yarn-error.log +0 -3976
@@ -0,0 +1,10 @@
1
+ import { Action } from '../Action';
2
+ import { EthAddress, uint256, uint8 } from '../types';
3
+ /**
4
+ *
5
+ *
6
+ * @category Triggers
7
+ */
8
+ export declare class AaveV2RatioTrigger extends Action {
9
+ constructor(user: EthAddress, market: EthAddress, ratio: uint256, state: uint8);
10
+ }
@@ -0,0 +1,12 @@
1
+ import { Action } from '../Action';
2
+ import { getAddr } from '../addresses';
3
+ /**
4
+ *
5
+ *
6
+ * @category Triggers
7
+ */
8
+ export class AaveV2RatioTrigger extends Action {
9
+ constructor(user, market, ratio, state) {
10
+ super('AaveV2RatioTrigger', getAddr('AaveV2RatioTrigger'), [['address', 'address', 'uint256', 'uint8']], [[user, market, ratio, state]]);
11
+ }
12
+ }
@@ -0,0 +1,10 @@
1
+ import { Action } from '../Action';
2
+ import { EthAddress, uint256, uint8 } from '../types';
3
+ /**
4
+ *
5
+ *
6
+ * @category Triggers
7
+ */
8
+ export declare class CurveUsdCollRatioTrigger extends Action {
9
+ constructor(user: EthAddress, controller: EthAddress, ratio: uint256, state: uint8);
10
+ }
@@ -0,0 +1,12 @@
1
+ import { Action } from '../Action';
2
+ import { getAddr } from '../addresses';
3
+ /**
4
+ *
5
+ *
6
+ * @category Triggers
7
+ */
8
+ export class CurveUsdCollRatioTrigger extends Action {
9
+ constructor(user, controller, ratio, state) {
10
+ super('CurveUsdCollRatioTrigger', getAddr('CurveUsdCollRatioTrigger'), [['address', 'address', 'uint256', 'uint8']], [[user, controller, ratio, state]]);
11
+ }
12
+ }
@@ -0,0 +1,10 @@
1
+ import { Action } from '../Action';
2
+ import { uint256, uint8 } from '../types';
3
+ /**
4
+ *
5
+ *
6
+ * @category Triggers
7
+ */
8
+ export declare class OffchainPriceTrigger extends Action {
9
+ constructor(limitPrice: uint256, limitType: uint8);
10
+ }
@@ -0,0 +1,12 @@
1
+ import { Action } from '../Action';
2
+ import { getAddr } from '../addresses';
3
+ /**
4
+ *
5
+ *
6
+ * @category Triggers
7
+ */
8
+ export class OffchainPriceTrigger extends Action {
9
+ constructor(limitPrice, limitType) {
10
+ super('OffchainPriceTrigger', getAddr('OffchainPriceTrigger'), ['uint256', 'uint8'], [limitPrice, limitType]);
11
+ }
12
+ }
@@ -11,7 +11,10 @@ export * from './CompV3RatioTrigger';
11
11
  export * from './TrailingStopTrigger';
12
12
  export * from './CBRebondTrigger';
13
13
  export * from './AaveV3QuotePriceTrigger';
14
+ export * from './AaveV2RatioTrigger';
14
15
  export * from './MorphoAaveV2RatioTrigger';
15
16
  export * from './SparkRatioTrigger';
16
17
  export * from './SparkQuotePriceTrigger';
17
18
  export * from './LiquityDebtInFrontWithLimitTrigger';
19
+ export * from './CurveUsdCollRatioTrigger';
20
+ export * from './OffchainPriceTrigger';
@@ -11,7 +11,10 @@ export * from './CompV3RatioTrigger';
11
11
  export * from './TrailingStopTrigger';
12
12
  export * from './CBRebondTrigger';
13
13
  export * from './AaveV3QuotePriceTrigger';
14
+ export * from './AaveV2RatioTrigger';
14
15
  export * from './MorphoAaveV2RatioTrigger';
15
16
  export * from './SparkRatioTrigger';
16
17
  export * from './SparkQuotePriceTrigger';
17
18
  export * from './LiquityDebtInFrontWithLimitTrigger';
19
+ export * from './CurveUsdCollRatioTrigger';
20
+ export * from './OffchainPriceTrigger';
@@ -1,17 +1,17 @@
1
- type AccessListItem = {
1
+ declare type AccessListItem = {
2
2
  address: EthAddress;
3
3
  storageKeys: Array<any>;
4
4
  };
5
- type AccessList = Array<Array<any>>;
6
- type AccessLists = {
5
+ declare type AccessList = Array<Array<any>>;
6
+ declare type AccessLists = {
7
7
  [key: string]: AccessList;
8
8
  };
9
- type Config = {
9
+ declare type Config = {
10
10
  chainId: number;
11
11
  testingMode: boolean;
12
12
  [key: string]: any;
13
13
  };
14
- type Network = {
14
+ declare type Network = {
15
15
  chainId: number;
16
16
  chainName: string;
17
17
  blockExplorerUrls: Array<string>;
@@ -23,24 +23,24 @@ type Network = {
23
23
  symbol: string;
24
24
  };
25
25
  };
26
- type Networks = {
26
+ declare type Networks = {
27
27
  ethereum: Network;
28
28
  optimism: Network;
29
29
  arbitrum: Network;
30
30
  base: Network;
31
31
  };
32
- type EthAddress = string;
33
- type bytes32 = string;
34
- type bytes = string | Array<any>;
35
- type uint256 = string;
36
- type uint32 = string;
37
- type uint160 = string;
38
- type uint128 = string;
39
- type uint80 = string;
40
- type uint64 = string;
41
- type uint24 = string;
42
- type uint16 = string;
43
- type uint8 = string;
44
- type int256 = string;
45
- type int24 = string;
32
+ declare type EthAddress = string;
33
+ declare type bytes32 = string;
34
+ declare type bytes = string | Array<any>;
35
+ declare type uint256 = string;
36
+ declare type uint32 = string;
37
+ declare type uint160 = string;
38
+ declare type uint128 = string;
39
+ declare type uint80 = string;
40
+ declare type uint64 = string;
41
+ declare type uint24 = string;
42
+ declare type uint16 = string;
43
+ declare type uint8 = string;
44
+ declare type int256 = string;
45
+ declare type int24 = string;
46
46
  export { AccessList, AccessListItem, AccessLists, Config, Network, Networks, EthAddress, bytes32, bytes, uint256, uint160, uint32, uint128, uint80, uint64, uint24, uint16, uint8, int256, int24, };
@@ -11,10 +11,20 @@ export declare const curveusdMarkets: {
11
11
  controllerAddress: string;
12
12
  debtAvailableBlock: number;
13
13
  };
14
+ sfrxETH: {
15
+ controllerAddress: string;
16
+ debtAvailableBlock: number;
17
+ };
18
+ tBTC: {
19
+ controllerAddress: string;
20
+ debtAvailableBlock: number;
21
+ };
14
22
  };
15
23
  export declare const controllerToAssetMap: {
16
24
  '0x100daa78fc509db39ef7d04de0c1abd299f4c6ce': string;
17
25
  '0x4e59541306910ad6dc1dac0ac9dfb29bd9f15c67': string;
18
26
  '0xa920de414ea4ab66b97da1bfe9e6eca7d4219635': string;
27
+ '0xec0820efafc41d8943ee8de495fc9ba8495b15cf': string;
28
+ '0x1c91da0223c763d2e0173243eadaa0a2ea47e704': string;
19
29
  };
20
30
  export declare const controllerFactoryAddress = "0xC9332fdCB1C491Dcc683bAe86Fe3cb70360738BC";
@@ -1,12 +1,16 @@
1
1
  /// @dev debtAvailableBlock is only used in v3-contracts repo
2
2
  export const curveusdMarkets = {
3
- wstETH: { controllerAddress: '0x100daa78fc509db39ef7d04de0c1abd299f4c6ce', debtAvailableBlock: 17487165 },
4
- WBTC: { controllerAddress: '0x4e59541306910ad6dc1dac0ac9dfb29bd9f15c67', debtAvailableBlock: 17563176 },
5
- WETH: { controllerAddress: '0xa920de414ea4ab66b97da1bfe9e6eca7d4219635', debtAvailableBlock: 17563176 },
3
+ wstETH: { controllerAddress: '0x100daa78fc509db39ef7d04de0c1abd299f4c6ce', debtAvailableBlock: 18664636 },
4
+ WBTC: { controllerAddress: '0x4e59541306910ad6dc1dac0ac9dfb29bd9f15c67', debtAvailableBlock: 18664636 },
5
+ WETH: { controllerAddress: '0xa920de414ea4ab66b97da1bfe9e6eca7d4219635', debtAvailableBlock: 18664636 },
6
+ sfrxETH: { controllerAddress: '0xec0820efafc41d8943ee8de495fc9ba8495b15cf', debtAvailableBlock: 18664636 },
7
+ tBTC: { controllerAddress: '0x1c91da0223c763d2e0173243eadaa0a2ea47e704', debtAvailableBlock: 18664636 },
6
8
  };
7
9
  export const controllerToAssetMap = {
8
10
  '0x100daa78fc509db39ef7d04de0c1abd299f4c6ce': '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0',
9
11
  '0x4e59541306910ad6dc1dac0ac9dfb29bd9f15c67': '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
10
12
  '0xa920de414ea4ab66b97da1bfe9e6eca7d4219635': '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
13
+ '0xec0820efafc41d8943ee8de495fc9ba8495b15cf': '0xac3E018457B222d93114458476f3E3416Abbe38F',
14
+ '0x1c91da0223c763d2e0173243eadaa0a2ea47e704': '0x18084fbA666a33d37592fA2633fD49a74DD93a88',
11
15
  };
12
16
  export const controllerFactoryAddress = '0xC9332fdCB1C491Dcc683bAe86Fe3cb70360738BC';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defisaver/sdk",
3
- "version": "1.0.61",
3
+ "version": "1.0.63-dev-1",
4
4
  "description": "",
5
5
  "main": "./umd/index.js",
6
6
  "module": "./esm/src/index.js",
@@ -25,5 +25,14 @@ export class AaveBorrowAction extends Action {
25
25
  ['address', 'address', 'uint256', 'uint256', 'address', 'address'],
26
26
  [market, tokenAddr, amount, rateMode, to, onBehalf],
27
27
  );
28
+
29
+ this.mappableArgs = [
30
+ this.args[0],
31
+ this.args[1],
32
+ this.args[2],
33
+ this.args[3],
34
+ this.args[4],
35
+ this.args[5],
36
+ ];
28
37
  }
29
38
  }
@@ -26,6 +26,11 @@ export class ApproveTokenAction extends Action {
26
26
  ],
27
27
  [token, spender, amount],
28
28
  );
29
+ this.mappableArgs = [
30
+ this.args[0],
31
+ this.args[1],
32
+ this.args[2],
33
+ ];
29
34
  }
30
35
 
31
36
  async getAssetsToApprove() {
@@ -0,0 +1,85 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ import {
4
+ EthAddress,
5
+ bytes,
6
+ uint256,
7
+ uint8,
8
+ } from '../../types';
9
+
10
+ /**
11
+ * ExecuteSafeTxAction - Execute Safe transaction
12
+ *
13
+ * @category BasicActions
14
+ */
15
+ export class ExecuteSafeTxAction extends Action {
16
+ /**
17
+ * @param safe Address of the Safe wallet
18
+ * @param to Destination address of Safe transaction
19
+ * @param value Ether value of Safe transaction
20
+ * @param data Data payload of Safe transaction
21
+ * @param operation Operation type of Safe transaction. 0 = call, 1 = delegateCall
22
+ * @param safeTxGas Gas that should be used for the Safe transaction
23
+ * @param baseGas Gas costs that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund)
24
+ * @param gasPrice Gas price that should be used for the payment calculation
25
+ * @param gasToken Token address (or 0 if ETH) that is used for the payment
26
+ * @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin
27
+ * @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v})
28
+ */
29
+ constructor(
30
+ safe: EthAddress,
31
+ to: EthAddress,
32
+ value: uint256,
33
+ data: bytes,
34
+ operation: uint8,
35
+ safeTxGas: uint256,
36
+ baseGas: uint256,
37
+ gasPrice: uint256,
38
+ gasToken: EthAddress,
39
+ refundReceiver: EthAddress,
40
+ signatures: bytes,
41
+ ) {
42
+ super(
43
+ 'ExecuteSafeTx',
44
+ getAddr('ExecuteSafeTx'),
45
+ [
46
+ 'address',
47
+ 'address',
48
+ 'uint256',
49
+ 'bytes',
50
+ 'uint8',
51
+ 'uint256',
52
+ 'uint256',
53
+ 'uint256',
54
+ 'address',
55
+ 'address',
56
+ 'bytes',
57
+ ],
58
+ [
59
+ safe,
60
+ to,
61
+ value,
62
+ data,
63
+ operation,
64
+ safeTxGas,
65
+ baseGas,
66
+ gasPrice,
67
+ gasToken,
68
+ refundReceiver,
69
+ signatures,
70
+ ],
71
+ );
72
+
73
+ this.mappableArgs = [
74
+ this.args[0],
75
+ this.args[1],
76
+ this.args[2],
77
+ this.args[4],
78
+ this.args[5],
79
+ this.args[6],
80
+ this.args[7],
81
+ this.args[8],
82
+ this.args[9],
83
+ ];
84
+ }
85
+ }
@@ -0,0 +1,61 @@
1
+ import AbiCoder from 'web3-eth-abi';
2
+ import { getAssetInfoByAddress } from '@defisaver/tokens';
3
+ import ActionAbi from '../../abis/Action.json';
4
+ import { ActionWithL2 } from '../../ActionWithL2';
5
+ import { requireAddress } from '../../utils/general';
6
+ import { getAddr } from '../../addresses';
7
+ import { EthAddress } from '../../types';
8
+
9
+ /**
10
+ * Sells token on DeFi Saver exchange aggregator without fee
11
+ *
12
+ * @category BasicActions
13
+ */
14
+ export class LSVSellAction extends ActionWithL2 {
15
+ protocolFee:string;
16
+
17
+ /**
18
+ * @param exchangeOrder Standard DFS Exchange data
19
+ * @param from Order sender
20
+ * @param to Order recipient
21
+ * @param protocolFee 0x fee (amount of ETH in Wei)
22
+ */
23
+ constructor(exchangeOrder:Array<any>, from:EthAddress, to:EthAddress, protocolFee = '0') {
24
+ requireAddress(to);
25
+ super(
26
+ 'LSVSell',
27
+ getAddr('LSVSell'),
28
+ [
29
+ ['address', 'address', 'uint256', 'uint256', 'uint256', 'uint256', 'address', 'address', 'bytes', ['address', 'address', 'address', 'uint256', 'uint256', 'bytes']],
30
+ 'address',
31
+ 'address',
32
+ ],
33
+ [exchangeOrder, from, to],
34
+ );
35
+
36
+ this.protocolFee = protocolFee;
37
+
38
+ this.mappableArgs = [
39
+ this.args[0][0],
40
+ this.args[0][1],
41
+ this.args[0][2],
42
+ this.args[1],
43
+ this.args[2],
44
+ ];
45
+ }
46
+
47
+ encodeInputs() {
48
+ const executeActionDirectAbi: any = (ActionAbi.find(({ name }) => name === 'executeActionDirect'))!;
49
+ return AbiCoder.encodeFunctionCall(executeActionDirectAbi, this._encodeForCall());
50
+ }
51
+
52
+ async getAssetsToApprove() {
53
+ const asset = getAssetInfoByAddress(this.args[0][0]);
54
+ if (asset.symbol !== 'ETH') return [{ asset: this.args[0][0], owner: this.args[1] }];
55
+ return [];
56
+ }
57
+
58
+ async getEthValue() {
59
+ return this.protocolFee || '0';
60
+ }
61
+ }
@@ -0,0 +1,63 @@
1
+ import AbiCoder from 'web3-eth-abi';
2
+ import { getAssetInfoByAddress } from '@defisaver/tokens';
3
+ import ActionAbi from '../../abis/Action.json';
4
+ import { ActionWithL2 } from '../../ActionWithL2';
5
+ import { requireAddress } from '../../utils/general';
6
+ import { getAddr } from '../../addresses';
7
+ import { EthAddress, uint256 } from '../../types';
8
+
9
+ /**
10
+ * Limit sell action used as part of the LimitSell Strategy
11
+ *
12
+ * @category BasicActions
13
+ */
14
+ export class LimitSellAction extends ActionWithL2 {
15
+ protocolFee:string;
16
+
17
+ /**
18
+ * @param exchangeOrder Standard DFS Exchange data
19
+ * @param from Order sender
20
+ * @param to Order recipient
21
+ * @param gasUsed Amount of gas spent as part of the strategy
22
+ * @param protocolFee 0x fee (amount of ETH in Wei)
23
+ */
24
+ constructor(exchangeOrder:Array<any>, from:EthAddress, to:EthAddress, gasUsed: uint256, protocolFee = '0') {
25
+ requireAddress(to);
26
+ super(
27
+ 'LimitSell',
28
+ getAddr('LimitSell'),
29
+ [
30
+ ['address', 'address', 'uint256', 'uint256', 'uint256', 'uint256', 'address', 'address', 'bytes', ['address', 'address', 'address', 'uint256', 'uint256', 'bytes']],
31
+ 'address',
32
+ 'address',
33
+ 'uint256',
34
+ ],
35
+ [exchangeOrder, from, to, gasUsed],
36
+ );
37
+
38
+ this.protocolFee = protocolFee;
39
+
40
+ this.mappableArgs = [
41
+ this.args[0][0],
42
+ this.args[0][1],
43
+ this.args[0][2],
44
+ this.args[1],
45
+ this.args[2],
46
+ ];
47
+ }
48
+
49
+ encodeInputs() {
50
+ const executeActionDirectAbi: any = (ActionAbi.find(({ name }) => name === 'executeActionDirect'))!;
51
+ return AbiCoder.encodeFunctionCall(executeActionDirectAbi, this._encodeForCall());
52
+ }
53
+
54
+ async getAssetsToApprove() {
55
+ const asset = getAssetInfoByAddress(this.args[0][0]);
56
+ if (asset.symbol !== 'ETH') return [{ asset: this.args[0][0], owner: this.args[1] }];
57
+ return [];
58
+ }
59
+
60
+ async getEthValue() {
61
+ return this.protocolFee || '0';
62
+ }
63
+ }
@@ -0,0 +1,39 @@
1
+ import { requireAddress } from '../../utils/general';
2
+ import { Action } from '../../Action';
3
+ import { getAddr } from '../../addresses';
4
+ import { EthAddress, uint256 } from '../../types';
5
+
6
+ /**
7
+ * Remove approval for a spender to pull tokens from user wallet
8
+ *
9
+ * @category BasicActions
10
+ */
11
+ export class RemoveTokenApprovalAction extends Action {
12
+ /**
13
+ * @param token Token address
14
+ * @param spender Spender address
15
+ */
16
+ constructor(token:EthAddress, spender:EthAddress) {
17
+ requireAddress(spender);
18
+ super(
19
+ 'RemoveTokenApproval',
20
+ getAddr('RemoveTokenApproval'),
21
+ [
22
+ 'address',
23
+ 'address',
24
+ ],
25
+ [
26
+ token,
27
+ spender,
28
+ ],
29
+ );
30
+ this.mappableArgs = [
31
+ this.args[0],
32
+ this.args[1],
33
+ ];
34
+ }
35
+
36
+ async getAssetsToApprove() {
37
+ return [];
38
+ }
39
+ }
@@ -16,10 +16,14 @@ export * from './GasFeeActionL2';
16
16
  export * from './TransferNFTAction';
17
17
  export * from './SendTokensAction';
18
18
  export * from './CreateSubAction';
19
+ export * from './LSVSellAction';
20
+ export * from './ApproveTokenAction';
19
21
  export * from './SDaiWrapAction';
20
22
  export * from './SDaiUnwrapAction';
21
23
  export * from './TokenizedVaultAdapterDepositAction';
22
24
  export * from './TokenizedVaultAdapterMintAction';
23
25
  export * from './TokenizedVaultAdapterRedeemAction';
24
26
  export * from './TokenizedVaultAdapterWithdrawAction';
25
- export * from './ApproveTokenAction';
27
+ export * from './LimitSellAction';
28
+ export * from './ExecuteSafeTxAction';
29
+ export * from './RemoveTokenApprovalAction';
@@ -0,0 +1,23 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ import { uint8, uint256 } from '../../types';
4
+
5
+ /**
6
+ * AaveV2RatioCheckAction - Checks aave 2 ratio for users proxy position and reverts if faulty
7
+ *
8
+ * @category Checkers
9
+ */
10
+ export class AaveV2RatioCheckAction extends Action {
11
+ /**
12
+ * @param ratioState If it should lower/higher
13
+ * @param targetRatio The ratio user want to be at
14
+ */
15
+ constructor(ratioState:uint8, targetRatio:uint256) {
16
+ super('AaveV2RatioCheck', getAddr('AaveV2RatioCheck'), ['uint8', 'uint256'], [ratioState, targetRatio]);
17
+
18
+ this.mappableArgs = [
19
+ this.args[0],
20
+ this.args[1],
21
+ ];
22
+ }
23
+ }
@@ -0,0 +1,23 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ import { uint8, uint256, EthAddress } from '../../types';
4
+
5
+ /**
6
+ * CompoundV2RatioCheckAction - Checks comp V2 ratio for user position and reverts if faulty
7
+ *
8
+ * @category Checkers
9
+ */
10
+ export class CompoundV2RatioCheckAction extends Action {
11
+ /**
12
+ * @param ratioState If it should lower/higher
13
+ * @param targetRatio The ratio user want to be at
14
+ */
15
+ constructor(ratioState:uint8, targetRatio:uint256) {
16
+ super('CompV2RatioCheck', getAddr('CompV2RatioCheck'), ['uint8', 'uint256'], [ratioState, targetRatio]);
17
+
18
+ this.mappableArgs = [
19
+ this.args[0],
20
+ this.args[1],
21
+ ];
22
+ }
23
+ }
@@ -0,0 +1,25 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ import { uint8, uint256, EthAddress } from '../../types';
4
+
5
+ /**
6
+ * CurveUsdCollRatioCheck - Checks curveusd coll ratio for user position and reverts if faulty
7
+ *
8
+ * @category Checkers
9
+ */
10
+ export class CurveUsdCollRatioCheck extends Action {
11
+ /**
12
+ * @param ratioState If it should lower/higher
13
+ * @param targetRatio The ratio user want to be at
14
+ * @param controllerAddr
15
+ */
16
+ constructor(ratioState:uint8, targetRatio:uint256, controllerAddr: EthAddress) {
17
+ super('CurveUsdCollRatioCheck', getAddr('CurveUsdCollRatioCheck'), ['uint8', 'uint256', 'address'], [ratioState, targetRatio, controllerAddr]);
18
+
19
+ this.mappableArgs = [
20
+ this.args[0],
21
+ this.args[1],
22
+ this.args[2],
23
+ ];
24
+ }
25
+ }
@@ -1,7 +1,10 @@
1
1
  export * from './MakerRatioCheckAction';
2
2
  export * from './AaveV3RatioCheckAction';
3
3
  export * from './CompoundV3RatioCheckAction';
4
- export * from './MorphoAaveV2RatioCheckAction';
5
4
  export * from './LiquityRatioCheckAction';
5
+ export * from './AaveV2RatioCheckAction';
6
+ export * from './CompoundV2RatioCheckAction';
7
+ export * from './MorphoAaveV2RatioCheckAction';
6
8
  export * from './SparkRatioCheckAction';
7
9
  export * from './LiquityRatioIncreaseCheckAction';
10
+ export * from './CurveUsdCollRatioCheck';
@@ -0,0 +1,21 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ import { EthAddress } from '../../types';
4
+
5
+
6
+ /**
7
+ * @category CurveUsd
8
+ */
9
+ export class CurveUsdGetDebtAction extends Action {
10
+ constructor(controllerAddr:EthAddress, debtor:EthAddress) {
11
+ super(
12
+ 'CurveUsdGetDebt',
13
+ getAddr('CurveUsdGetDebt'),
14
+ [
15
+ 'address',
16
+ 'address',
17
+ ],
18
+ [controllerAddr, debtor],
19
+ );
20
+ }
21
+ }
@@ -7,4 +7,5 @@ export * from './CurveUsdRepayAction';
7
7
  export * from './CurveUsdSelfLiquidateAction';
8
8
  export * from './CurveUsdLevCreateAction';
9
9
  export * from './CurveUsdSelfLiquidateWithCollAction';
10
- export * from './CurveUsdAdjustAction';
10
+ export * from './CurveUsdAdjustAction';
11
+ export * from './CurveUsdGetDebtAction';
@@ -0,0 +1,35 @@
1
+ import { ActionWithL2 } from '../../ActionWithL2';
2
+ import { getAddr } from '../../addresses';
3
+ import { EthAddress, uint256, bytes } from '../../types';
4
+
5
+ /**
6
+ * Gets a flashloan from Aave v3 and opens a debt position instead of repaying
7
+ *
8
+ * @category Flashloans
9
+ */
10
+ export class AaveV3FlashLoanCarryDebtAction extends ActionWithL2 {
11
+ /**
12
+ * @param loanAmounts
13
+ * @param tokens
14
+ * @param modes
15
+ * @param loanPayer
16
+ * @param flParamGetterAddr
17
+ * @param flParamGetterData
18
+ */
19
+ constructor(tokens:Array<EthAddress>, loanAmounts:Array<uint256>, modes:Array<uint256>, loanPayer:EthAddress, flParamGetterAddr:EthAddress = getAddr('Empty'), flParamGetterData:bytes = []) {
20
+ super(
21
+ 'FLAaveV3CarryDebt',
22
+ getAddr('FLAaveV3CarryDebt'),
23
+ ['address[]', 'uint256[]', 'uint256[]', 'address', 'address', 'bytes', 'bytes'],
24
+ [tokens, loanAmounts, modes, loanPayer, flParamGetterAddr, flParamGetterData, []],
25
+ );
26
+ if (tokens.length !== modes.length || tokens.length !== loanAmounts.length) {
27
+ throw new Error('Arrays must be of the same length');
28
+ }
29
+ modes.forEach((mode) => {
30
+ if (mode.toString() !== '1' && mode.toString() !== '2') {
31
+ throw new Error('Invalid borrow mode set');
32
+ }
33
+ });
34
+ }
35
+ }