@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
@@ -41,6 +41,9 @@ export class FLAction extends Action {
41
41
  if (specificFLAction.constructor.name === 'SparkFlashLoanAction') {
42
42
  argsToReturn[5] = [7];
43
43
  }
44
+ if (specificFLAction.constructor.name === 'MorphoBlueFlashLoanAction') {
45
+ argsToReturn[5] = [8];
46
+ }
44
47
  return argsToReturn;
45
48
  }
46
49
 
@@ -0,0 +1,25 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ import { EthAddress, uint256, bytes } from '../../types';
4
+
5
+ /**
6
+ * Gets a flashloan from MorphoBlue
7
+ *
8
+ * @category Flashloans
9
+ */
10
+ export class MorphoBlueFlashLoanAction extends Action {
11
+ /**
12
+ * @param token
13
+ * @param amount
14
+ * @param flParamGetterAddr
15
+ * @param flParamGetterData
16
+ */
17
+ constructor(token:EthAddress, amount:uint256, flParamGetterAddr:EthAddress = getAddr('Empty'), flParamGetterData:bytes = []) {
18
+ super(
19
+ 'FLMorphoBlue',
20
+ getAddr('FLMorphoBlue'),
21
+ ['address[]', 'uint256[]', 'uint256[]', 'address', 'address', 'bytes', 'bytes'],
22
+ [[token], [amount], [], getAddr('Empty'), flParamGetterAddr, flParamGetterData, []],
23
+ );
24
+ }
25
+ }
@@ -0,0 +1,18 @@
1
+ import { SendTokenAction } from '../basic';
2
+ import { getAddr } from '../../addresses';
3
+ import { EthAddress, uint256 } from '../../types';
4
+
5
+ /**
6
+ * Pays back a flashloan from MorphoBlue
7
+ *
8
+ * @category Flashloans
9
+ */
10
+ export class MorphoBlueFlashLoanPaybackAction extends SendTokenAction {
11
+ /**
12
+ * @param loanAmount
13
+ * @param tokenAddr
14
+ */
15
+ constructor(loanAmount: uint256, tokenAddr: EthAddress) {
16
+ super(tokenAddr, getAddr('FLMorphoBlue'), loanAmount);
17
+ }
18
+ }
@@ -6,6 +6,7 @@ export * from './AaveV3FlashLoanAction';
6
6
  export * from './AaveV3FlashLoanPaybackAction';
7
7
  export * from './AaveV3FlashLoanNoFeeAction';
8
8
  export * from './AaveV3FlashLoanNoFeePaybackAction';
9
+ export * from './AaveV3FlashLoanCarryDebtAction';
9
10
  export * from './SparkFlashLoanAction';
10
11
  export * from './SparkFlashLoanPaybackAction';
11
12
  export * from './MakerFlashLoanAction';
@@ -18,4 +19,6 @@ export * from './FLAction';
18
19
  export * from './UniV3FlashLoanAction';
19
20
  export * from './UniV3FlashLoanPaybackAction';
20
21
  export * from './GhoFlashLoanAction';
21
- export * from './GhoFlashLoanPaybackAction';
22
+ export * from './GhoFlashLoanPaybackAction';
23
+ export * from './MorphoBlueFlashLoanAction';
24
+ export * from './MorphoBlueFlashLoanPaybackAction';
@@ -23,8 +23,10 @@ import * as chickenBonds from './chickenBonds';
23
23
  import * as compoundV3 from './compoundV3';
24
24
  import * as morpho from './morpho';
25
25
  import * as bprotocol from './bprotocol';
26
+ import * as lsv from './lsv';
26
27
  import * as curveusd from './curveusd';
27
28
  import * as spark from './spark';
29
+ import * as morphoblue from './morpho-blue';
28
30
 
29
31
  export {
30
32
  aave,
@@ -52,6 +54,8 @@ export {
52
54
  compoundV3,
53
55
  morpho,
54
56
  bprotocol,
57
+ lsv,
55
58
  spark,
56
59
  curveusd,
60
+ morphoblue,
57
61
  };
@@ -0,0 +1,21 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ import { EthAddress, uint256, uint8 } from '../../types';
4
+
5
+ /**
6
+ *
7
+ *
8
+ * @category LSV
9
+ */
10
+ export class LSVBorrowAction extends Action {
11
+ /**
12
+ * @param protocol
13
+ * @param amount
14
+ */
15
+ constructor(protocol:uint8, amount:uint256) {
16
+ super('LSVBorrow', getAddr('LSVBorrow'), ['uint256', 'uint256'], [protocol, amount]);
17
+ this.mappableArgs = [
18
+ this.args[1],
19
+ ];
20
+ }
21
+ }
@@ -0,0 +1,20 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ import { uint8, uint256 } from '../../types';
4
+
5
+ /**
6
+ *
7
+ * @category LSV
8
+ */
9
+ export class LSVPaybackAction extends Action {
10
+ /**
11
+ * @param protocol
12
+ * @param amount
13
+ */
14
+ constructor(protocol:uint8, amount:uint256) {
15
+ super('LSVPayback', getAddr('LSVPayback'), ['uint256', 'uint256'], [protocol, amount]);
16
+ this.mappableArgs = [
17
+ this.args[1],
18
+ ];
19
+ }
20
+ }
@@ -0,0 +1,23 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ import { EthAddress, uint256, uint8 } from '../../types';
4
+
5
+ /**
6
+ *
7
+ *
8
+ * @category LSV
9
+ */
10
+ export class LSVSupplyAction extends Action {
11
+ /**
12
+ * @param protocol
13
+ * @param token
14
+ * @param amount
15
+ */
16
+ constructor(protocol:uint8, token:EthAddress, amount:uint256) {
17
+ super('LSVSupply', getAddr('LSVSupply'), ['uint256', 'address', 'uint256'], [protocol, token, amount]);
18
+ this.mappableArgs = [
19
+ this.args[1],
20
+ this.args[2],
21
+ ];
22
+ }
23
+ }
@@ -0,0 +1,23 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ import { EthAddress, uint256, uint8 } from '../../types';
4
+
5
+ /**
6
+ *
7
+ * @category LSV
8
+ */
9
+ export class LSVWithdrawAction extends Action {
10
+ /**
11
+ * @param protocol
12
+ * @param token
13
+ * @param amount
14
+ * @param isPositionClosing
15
+ */
16
+ constructor(protocol:uint8, token:EthAddress, amount:uint256, isPositionClosing:boolean) {
17
+ super('LSVWithdraw', getAddr('LSVWithdraw'), ['uint256', 'address', 'uint256', 'bool'], [protocol, token, amount, isPositionClosing]);
18
+ this.mappableArgs = [
19
+ this.args[1],
20
+ this.args[2],
21
+ ];
22
+ }
23
+ }
@@ -0,0 +1,4 @@
1
+ export * from './LSVPaybackAction';
2
+ export * from './LSVWithdrawAction';
3
+ export * from './LSVSupplyAction';
4
+ export * from './LSVBorrowAction';
@@ -12,12 +12,11 @@ export class MakerGiveAction extends Action {
12
12
  /**
13
13
  * @param vaultId
14
14
  * @param newOwner
15
- * @param createProxy
16
15
  * @param mcdManager
17
16
  */
18
- constructor(vaultId:uint256, newOwner:EthAddress, createProxy:boolean, mcdManager:EthAddress = getAddr('McdCdpManager')) {
17
+ constructor(vaultId:uint256, newOwner:EthAddress, mcdManager:EthAddress = getAddr('McdCdpManager')) {
19
18
  requireAddress(newOwner);
20
- super('McdGive', getAddr('McdGive'), ['uint256', 'address', 'bool', 'address'], [vaultId, newOwner, createProxy, mcdManager]);
19
+ super('McdGive', getAddr('McdGive'), ['uint256', 'address', 'address'], [vaultId, newOwner, mcdManager]);
21
20
 
22
21
  this.mappableArgs = [
23
22
  this.args[0],
@@ -0,0 +1,32 @@
1
+ import { Action } from '../../../Action';
2
+ import { getAddr } from '../../../addresses';
3
+ import { EthAddress, uint256 } from '../../../types';
4
+
5
+
6
+ /**
7
+ *
8
+ * @category MorphoAaveV3
9
+ */
10
+ export class MorphoAaveV3SetManagerAction extends Action {
11
+ /**
12
+ * @param emodeId
13
+ * @param manager
14
+ * @param isAllowed
15
+ */
16
+ constructor(emodeId: uint256, manager: EthAddress, isAllowed:boolean) {
17
+ super(
18
+ 'MorphoAaveV3SetManager',
19
+ getAddr('MorphoAaveV3SetManager'),
20
+ [
21
+ 'uint256',
22
+ 'address',
23
+ 'bool',
24
+ ],
25
+ [emodeId, manager, isAllowed],
26
+ );
27
+ this.mappableArgs = [
28
+ this.args[0],
29
+ this.args[1],
30
+ ];
31
+ }
32
+ }
@@ -7,3 +7,4 @@ export * from './aaveV3/MorphoAaveV3SupplyAction';
7
7
  export * from './aaveV3/MorphoAaveV3WithdrawAction';
8
8
  export * from './aaveV3/MorphoAaveV3BorrowAction';
9
9
  export * from './aaveV3/MorphoAaveV3PaybackAction';
10
+ export * from './aaveV3/MorphoAaveV3SetManagerAction';
@@ -0,0 +1,54 @@
1
+ import { getAssetInfoByAddress } from '@defisaver/tokens';
2
+ import { Action } from '../../Action';
3
+ import { getAddr } from '../../addresses';
4
+ import { EthAddress, uint256 } from '../../types';
5
+
6
+ /**
7
+ * MorphoBlueBorrowAction - Borrow a token from MorphoBlue
8
+ *
9
+ * @category MorphoBlue
10
+ */
11
+ export class MorphoBlueBorrowAction extends Action {
12
+ /**
13
+ * @param loanToken - MarketParams loanToken
14
+ * @param collateralToken - MarketParams collateralToken
15
+ * @param oracle - MarketParams oracle
16
+ * @param irm - MarketParams irm
17
+ * @param lltv - MarketParams lltv
18
+ * @param borrowAmount - amount of loanToken to borrow
19
+ * @param onBehalf - onBehalf of whom to borrow
20
+ * @param to - address to receive borrowed tokens
21
+ */
22
+ constructor(
23
+ loanToken:EthAddress,
24
+ collateralToken:EthAddress,
25
+ oracle:EthAddress,
26
+ irm:EthAddress,
27
+ lltv:uint256,
28
+ borrowAmount:uint256,
29
+ onBehalf:EthAddress,
30
+ to:EthAddress,
31
+ ) {
32
+ super(
33
+ 'MorphoBlueBorrow',
34
+ getAddr('MorphoBlueBorrow'),
35
+ [['address', 'address', 'address', 'address', 'uint256'], 'uint256', 'address', 'address'],
36
+ [[loanToken, collateralToken, oracle, irm, lltv], borrowAmount, onBehalf, to],
37
+ );
38
+
39
+ this.mappableArgs = [
40
+ this.args[0][0],
41
+ this.args[0][1],
42
+ this.args[0][2],
43
+ this.args[0][3],
44
+ this.args[0][4],
45
+ this.args[1],
46
+ this.args[2],
47
+ this.args[3],
48
+ ];
49
+ }
50
+
51
+ async getAssetsToApprove() {
52
+ return [];
53
+ }
54
+ }
@@ -0,0 +1,54 @@
1
+ import { getAssetInfoByAddress } from '@defisaver/tokens';
2
+ import { Action } from '../../Action';
3
+ import { getAddr } from '../../addresses';
4
+ import { EthAddress, uint256 } from '../../types';
5
+
6
+ /**
7
+ * MorphoBluePaybackAction - Payback debt on MorphoBlue
8
+ *
9
+ * @category MorphoBlue
10
+ */
11
+ export class MorphoBluePaybackAction extends Action {
12
+ /**
13
+ * @param loanToken - MarketParams loanToken
14
+ * @param collateralToken - MarketParams collateralToken
15
+ * @param oracle - MarketParams oracle
16
+ * @param irm - MarketParams irm
17
+ * @param lltv - MarketParams lltv
18
+ * @param paybackAmount - Amount of debt to repay (uint.max for full debt repayment)
19
+ * @param from - Address from which to pull tokens with which to repay debt
20
+ * @param onBehalf - Position owner whose debt we are paying back
21
+ */
22
+ constructor(
23
+ loanToken:EthAddress,
24
+ collateralToken:EthAddress,
25
+ oracle:EthAddress,
26
+ irm:EthAddress,
27
+ lltv:uint256,
28
+ paybackAmount:uint256,
29
+ from:EthAddress,
30
+ onBehalf:EthAddress,
31
+ ) {
32
+ super(
33
+ 'MorphoBluePayback',
34
+ getAddr('MorphoBluePayback'),
35
+ [['address', 'address', 'address', 'address', 'uint256'], 'uint256', 'address', 'address'],
36
+ [[loanToken, collateralToken, oracle, irm, lltv], paybackAmount, from, onBehalf],
37
+ );
38
+
39
+ this.mappableArgs = [
40
+ this.args[0][0],
41
+ this.args[0][1],
42
+ this.args[0][2],
43
+ this.args[0][3],
44
+ this.args[0][4],
45
+ this.args[1],
46
+ this.args[2],
47
+ this.args[3],
48
+ ];
49
+ }
50
+
51
+ async getAssetsToApprove() {
52
+ return [{ asset: this.args[0][0], owner: this.args[2] }];
53
+ }
54
+ }
@@ -0,0 +1,25 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ import { EthAddress, uint256 } from '../../types';
4
+
5
+ /**
6
+ * @category MorphoBlue
7
+ */
8
+ export class MorphoBlueSetAuthAction extends Action {
9
+ /**
10
+ * @param manager
11
+ * @param newIsAuthorized
12
+ */
13
+ constructor(manager:EthAddress, newIsAuthorized:boolean) {
14
+ super(
15
+ 'MorphoBlueSetAuth',
16
+ getAddr('MorphoBlueSetAuth'),
17
+ [
18
+ 'address',
19
+ 'bool',
20
+ ],
21
+ [manager, newIsAuthorized],
22
+ );
23
+ this.mappableArgs = [this.args[0], this.args[1]];
24
+ }
25
+ }
@@ -0,0 +1,39 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ import {
4
+ EthAddress, bytes32, uint256, uint8,
5
+ } from '../../types';
6
+
7
+ /**
8
+ * @category MorphoBlue
9
+ */
10
+ export class MorphoBlueSetAuthWithSigAction extends Action {
11
+ /**
12
+ * @param manager
13
+ * @param newIsAuthorized
14
+ */
15
+ constructor(
16
+ authorizer:EthAddress,
17
+ authorized:EthAddress,
18
+ isAuthorized:boolean,
19
+ nonce:uint256,
20
+ deadline:uint256,
21
+ v:uint8,
22
+ r:bytes32,
23
+ s:bytes32,
24
+ ) {
25
+ super(
26
+ 'MorphoBlueSetAuthWithSig',
27
+ getAddr('MorphoBlueSetAuthWithSig'),
28
+ [
29
+ ['address', 'address', 'bool', 'uint256', 'uint256'],
30
+ ['uint8', 'bytes32', 'bytes32'],
31
+ ],
32
+ [
33
+ [authorizer, authorized, isAuthorized, nonce, deadline],
34
+ [v, r, s],
35
+ ],
36
+ );
37
+ this.mappableArgs = [];
38
+ }
39
+ }
@@ -0,0 +1,54 @@
1
+ import { getAssetInfoByAddress } from '@defisaver/tokens';
2
+ import { Action } from '../../Action';
3
+ import { getAddr } from '../../addresses';
4
+ import { EthAddress, uint256 } from '../../types';
5
+
6
+ /**
7
+ * MorphoBlueSupplyAction - Supply token as a lender on MorphoBlue to earn interest
8
+ *
9
+ * @category MorphoBlue
10
+ */
11
+ export class MorphoBlueSupplyAction extends Action {
12
+ /**
13
+ * @param loanToken - MarketParams loanToken
14
+ * @param collateralToken - MarketParams collateralToken
15
+ * @param oracle - MarketParams oracle
16
+ * @param irm - MarketParams irm
17
+ * @param lltv - MarketParams lltv
18
+ * @param supplyAmount - Amount of loanToken to supply
19
+ * @param from - Address from which to pull tokens
20
+ * @param onBehalf - on whose behalf to supply the tokens
21
+ */
22
+ constructor(
23
+ loanToken:EthAddress,
24
+ collateralToken:EthAddress,
25
+ oracle:EthAddress,
26
+ irm:EthAddress,
27
+ lltv:uint256,
28
+ supplyAmount:uint256,
29
+ from:EthAddress,
30
+ onBehalf:EthAddress,
31
+ ) {
32
+ super(
33
+ 'MorphoBlueSupply',
34
+ getAddr('MorphoBlueSupply'),
35
+ [['address', 'address', 'address', 'address', 'uint256'], 'uint256', 'address', 'address'],
36
+ [[loanToken, collateralToken, oracle, irm, lltv], supplyAmount, from, onBehalf],
37
+ );
38
+
39
+ this.mappableArgs = [
40
+ this.args[0][0],
41
+ this.args[0][1],
42
+ this.args[0][2],
43
+ this.args[0][3],
44
+ this.args[0][4],
45
+ this.args[1],
46
+ this.args[2],
47
+ this.args[3],
48
+ ];
49
+ }
50
+
51
+ async getAssetsToApprove() {
52
+ return [{ asset: this.args[0][0], owner: this.args[2] }];
53
+ }
54
+ }
@@ -0,0 +1,54 @@
1
+ import { getAssetInfoByAddress } from '@defisaver/tokens';
2
+ import { Action } from '../../Action';
3
+ import { getAddr } from '../../addresses';
4
+ import { EthAddress, uint256 } from '../../types';
5
+
6
+ /**
7
+ * MorphoBlueSupplyCollateralAction - Supply token to use as collateral on MorphoBlue
8
+ *
9
+ * @category MorphoBlue
10
+ */
11
+ export class MorphoBlueSupplyCollateralAction extends Action {
12
+ /**
13
+ * @param loanToken - MarketParams loanToken
14
+ * @param collateralToken - MarketParams collateralToken
15
+ * @param oracle - MarketParams oracle
16
+ * @param irm - MarketParams irm
17
+ * @param lltv - MarketParams lltv
18
+ * @param supplyAmount - Amount of collateral token to supply
19
+ * @param from - Address from which to pull tokens
20
+ * @param onBehalf - On whose behalf to supply tokens as collateral
21
+ */
22
+ constructor(
23
+ loanToken:EthAddress,
24
+ collateralToken:EthAddress,
25
+ oracle:EthAddress,
26
+ irm:EthAddress,
27
+ lltv:uint256,
28
+ supplyAmount:uint256,
29
+ from:EthAddress,
30
+ onBehalf:EthAddress,
31
+ ) {
32
+ super(
33
+ 'MorphoBlueSupplyCollateral',
34
+ getAddr('MorphoBlueSupplyCollateral'),
35
+ [['address', 'address', 'address', 'address', 'uint256'], 'uint256', 'address', 'address'],
36
+ [[loanToken, collateralToken, oracle, irm, lltv], supplyAmount, from, onBehalf],
37
+ );
38
+
39
+ this.mappableArgs = [
40
+ this.args[0][0],
41
+ this.args[0][1],
42
+ this.args[0][2],
43
+ this.args[0][3],
44
+ this.args[0][4],
45
+ this.args[1],
46
+ this.args[2],
47
+ this.args[3],
48
+ ];
49
+ }
50
+
51
+ async getAssetsToApprove() {
52
+ return [{ asset: this.args[0][1], owner: this.args[2] }];
53
+ }
54
+ }
@@ -0,0 +1,54 @@
1
+ import { getAssetInfoByAddress } from '@defisaver/tokens';
2
+ import { Action } from '../../Action';
3
+ import { getAddr } from '../../addresses';
4
+ import { EthAddress, uint256 } from '../../types';
5
+
6
+ /**
7
+ * MorphoBlueWithdrawAction - Withdraw interest earning tokens from MorphoBlue
8
+ *
9
+ * @category MorphoBlue
10
+ */
11
+ export class MorphoBlueWithdrawAction extends Action {
12
+ /**
13
+ * @param loanToken - MarketParams loanToken
14
+ * @param collateralToken - MarketParams collateralToken
15
+ * @param oracle - MarketParams oracle
16
+ * @param irm - MarketParams irm
17
+ * @param lltv - MarketParams lltv
18
+ * @param withdrawAmount - Amount of tokens to withdraw (uint.max for full withdrawal)
19
+ * @param onBehalf - From whose position should we withdraw tokens
20
+ * @param to - address which will receive withdrawn tokens
21
+ */
22
+ constructor(
23
+ loanToken:EthAddress,
24
+ collateralToken:EthAddress,
25
+ oracle:EthAddress,
26
+ irm:EthAddress,
27
+ lltv:uint256,
28
+ withdrawAmount:uint256,
29
+ onBehalf:EthAddress,
30
+ to:EthAddress,
31
+ ) {
32
+ super(
33
+ 'MorphoBlueWithdraw',
34
+ getAddr('MorphoBlueWithdraw'),
35
+ [['address', 'address', 'address', 'address', 'uint256'], 'uint256', 'address', 'address'],
36
+ [[loanToken, collateralToken, oracle, irm, lltv], withdrawAmount, onBehalf, to],
37
+ );
38
+
39
+ this.mappableArgs = [
40
+ this.args[0][0],
41
+ this.args[0][1],
42
+ this.args[0][2],
43
+ this.args[0][3],
44
+ this.args[0][4],
45
+ this.args[1],
46
+ this.args[2],
47
+ this.args[3],
48
+ ];
49
+ }
50
+
51
+ async getAssetsToApprove() {
52
+ return [];
53
+ }
54
+ }
@@ -0,0 +1,54 @@
1
+ import { getAssetInfoByAddress } from '@defisaver/tokens';
2
+ import { Action } from '../../Action';
3
+ import { getAddr } from '../../addresses';
4
+ import { EthAddress, uint256 } from '../../types';
5
+
6
+ /**
7
+ * MorphoBlueWithdrawCollateralAction - Withdraw tokens that are used as collateral on MorphoBlue
8
+ *
9
+ * @category MorphoBlue
10
+ */
11
+ export class MorphoBlueWithdrawCollateralAction extends Action {
12
+ /**
13
+ * @param loanToken - MarketParams loanToken
14
+ * @param collateralToken - MarketParams collateralToken
15
+ * @param oracle - MarketParams oracle
16
+ * @param irm - MarketParams irm
17
+ * @param lltv - MarketParams lltv
18
+ * @param withdrawAmount - Amount of tokens to withdraw
19
+ * @param onBehalf - From whose position should we withdraw tokens
20
+ * @param to - address which will receive withdrawn tokens
21
+ */
22
+ constructor(
23
+ loanToken:EthAddress,
24
+ collateralToken:EthAddress,
25
+ oracle:EthAddress,
26
+ irm:EthAddress,
27
+ lltv:uint256,
28
+ withdrawAmount:uint256,
29
+ onBehalf:EthAddress,
30
+ to:EthAddress,
31
+ ) {
32
+ super(
33
+ 'MorphoBlueWithdrawCollateral',
34
+ getAddr('MorphoBlueWithdrawCollateral'),
35
+ [['address', 'address', 'address', 'address', 'uint256'], 'uint256', 'address', 'address'],
36
+ [[loanToken, collateralToken, oracle, irm, lltv], withdrawAmount, onBehalf, to],
37
+ );
38
+
39
+ this.mappableArgs = [
40
+ this.args[0][0],
41
+ this.args[0][1],
42
+ this.args[0][2],
43
+ this.args[0][3],
44
+ this.args[0][4],
45
+ this.args[1],
46
+ this.args[2],
47
+ this.args[3],
48
+ ];
49
+ }
50
+
51
+ async getAssetsToApprove() {
52
+ return [];
53
+ }
54
+ }
@@ -0,0 +1,8 @@
1
+ export * from './MorphoBlueSupplyAction';
2
+ export * from './MorphoBlueSupplyCollateralAction';
3
+ export * from './MorphoBlueBorrowAction';
4
+ export * from './MorphoBluePaybackAction';
5
+ export * from './MorphoBlueWithdrawCollateralAction';
6
+ export * from './MorphoBlueWithdrawAction';
7
+ export * from './MorphoBlueSetAuthAction';
8
+ export * from './MorphoBlueSetAuthWithSigAction';