@defisaver/sdk 1.0.35 → 1.0.37

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 (112) hide show
  1. package/esm/src/actions/basic/SDaiUnwrapAction.d.ts +15 -0
  2. package/esm/src/actions/basic/SDaiUnwrapAction.js +24 -0
  3. package/esm/src/actions/basic/SDaiWrapAction.d.ts +15 -0
  4. package/esm/src/actions/basic/SDaiWrapAction.js +24 -0
  5. package/esm/src/actions/basic/index.d.ts +2 -0
  6. package/esm/src/actions/basic/index.js +2 -0
  7. package/esm/src/actions/checkers/SparkRatioCheckAction.d.ts +14 -0
  8. package/esm/src/actions/checkers/SparkRatioCheckAction.js +20 -0
  9. package/esm/src/actions/checkers/index.d.ts +1 -0
  10. package/esm/src/actions/checkers/index.js +1 -0
  11. package/esm/src/actions/curveusd/CurveUsdBorrowAction.d.ts +15 -0
  12. package/esm/src/actions/curveusd/CurveUsdBorrowAction.js +22 -0
  13. package/esm/src/actions/curveusd/CurveUsdCreateAction.d.ts +22 -0
  14. package/esm/src/actions/curveusd/CurveUsdCreateAction.js +44 -0
  15. package/esm/src/actions/curveusd/CurveUsdLevCreateAction.d.ts +9 -0
  16. package/esm/src/actions/curveusd/CurveUsdLevCreateAction.js +16 -0
  17. package/esm/src/actions/curveusd/CurveUsdPaybackAction.d.ts +22 -0
  18. package/esm/src/actions/curveusd/CurveUsdPaybackAction.js +43 -0
  19. package/esm/src/actions/curveusd/CurveUsdRepayAction.d.ts +9 -0
  20. package/esm/src/actions/curveusd/CurveUsdRepayAction.js +14 -0
  21. package/esm/src/actions/curveusd/CurveUsdSelfLiquidateAction.d.ts +19 -0
  22. package/esm/src/actions/curveusd/CurveUsdSelfLiquidateAction.js +38 -0
  23. package/esm/src/actions/curveusd/CurveUsdSelfLiquidateWithCollAction.d.ts +9 -0
  24. package/esm/src/actions/curveusd/CurveUsdSelfLiquidateWithCollAction.js +16 -0
  25. package/esm/src/actions/curveusd/CurveUsdSupplyAction.d.ts +20 -0
  26. package/esm/src/actions/curveusd/CurveUsdSupplyAction.js +40 -0
  27. package/esm/src/actions/curveusd/CurveUsdWithdrawAction.d.ts +15 -0
  28. package/esm/src/actions/curveusd/CurveUsdWithdrawAction.js +22 -0
  29. package/esm/src/actions/curveusd/index.d.ts +9 -0
  30. package/esm/src/actions/curveusd/index.js +9 -0
  31. package/esm/src/actions/flashloan/FLAction.js +8 -2
  32. package/esm/src/actions/flashloan/SparkFlashLoanAction.d.ts +18 -0
  33. package/esm/src/actions/flashloan/SparkFlashLoanAction.js +20 -0
  34. package/esm/src/actions/flashloan/SparkFlashLoanPaybackAction.d.ts +14 -0
  35. package/esm/src/actions/flashloan/SparkFlashLoanPaybackAction.js +16 -0
  36. package/esm/src/actions/flashloan/index.d.ts +2 -0
  37. package/esm/src/actions/flashloan/index.js +2 -0
  38. package/esm/src/actions/index.d.ts +3 -1
  39. package/esm/src/actions/index.js +3 -1
  40. package/esm/src/actions/spark/SparkBorrowAction.d.ts +21 -0
  41. package/esm/src/actions/spark/SparkBorrowAction.js +59 -0
  42. package/esm/src/actions/spark/SparkClaimRewardsAction.d.ts +18 -0
  43. package/esm/src/actions/spark/SparkClaimRewardsAction.js +40 -0
  44. package/esm/src/actions/spark/SparkCollateralSwitchAction.d.ts +18 -0
  45. package/esm/src/actions/spark/SparkCollateralSwitchAction.js +39 -0
  46. package/esm/src/actions/spark/SparkPaybackAction.d.ts +27 -0
  47. package/esm/src/actions/spark/SparkPaybackAction.js +77 -0
  48. package/esm/src/actions/spark/SparkSetEModeAction.d.ts +16 -0
  49. package/esm/src/actions/spark/SparkSetEModeAction.js +33 -0
  50. package/esm/src/actions/spark/SparkSpTokenPaybackAction.d.ts +25 -0
  51. package/esm/src/actions/spark/SparkSpTokenPaybackAction.js +64 -0
  52. package/esm/src/actions/spark/SparkSupplyAction.d.ts +27 -0
  53. package/esm/src/actions/spark/SparkSupplyAction.js +77 -0
  54. package/esm/src/actions/spark/SparkSwapBorrowRateModeAction.d.ts +18 -0
  55. package/esm/src/actions/spark/SparkSwapBorrowRateModeAction.js +38 -0
  56. package/esm/src/actions/spark/SparkWithdrawAction.d.ts +18 -0
  57. package/esm/src/actions/spark/SparkWithdrawAction.js +45 -0
  58. package/esm/src/actions/spark/index.d.ts +9 -0
  59. package/esm/src/actions/spark/index.js +9 -0
  60. package/esm/src/addresses.d.ts +66 -0
  61. package/esm/src/addresses.js +24 -0
  62. package/esm/src/index.d.ts +264 -0
  63. package/esm/src/triggers/SparkQuotePriceTrigger.d.ts +10 -0
  64. package/esm/src/triggers/SparkQuotePriceTrigger.js +12 -0
  65. package/esm/src/triggers/SparkRatioTrigger.d.ts +10 -0
  66. package/esm/src/triggers/SparkRatioTrigger.js +12 -0
  67. package/esm/src/triggers/index.d.ts +2 -0
  68. package/esm/src/triggers/index.js +2 -0
  69. package/esm/src/types.d.ts +3 -1
  70. package/esm/src/utils/curveusd-utils.d.ts +20 -0
  71. package/esm/src/utils/curveusd-utils.js +12 -0
  72. package/esm/src/utils/index.d.ts +2 -1
  73. package/esm/src/utils/index.js +2 -1
  74. package/package.json +1 -1
  75. package/src/actions/basic/SDaiUnwrapAction.ts +32 -0
  76. package/src/actions/basic/SDaiWrapAction.ts +32 -0
  77. package/src/actions/basic/index.ts +2 -0
  78. package/src/actions/checkers/SparkRatioCheckAction.ts +23 -0
  79. package/src/actions/checkers/index.ts +2 -1
  80. package/src/actions/curveusd/CurveUsdBorrowAction.ts +34 -0
  81. package/src/actions/curveusd/CurveUsdCreateAction.ts +49 -0
  82. package/src/actions/curveusd/CurveUsdLevCreateAction.ts +40 -0
  83. package/src/actions/curveusd/CurveUsdPaybackAction.ts +48 -0
  84. package/src/actions/curveusd/CurveUsdRepayAction.ts +36 -0
  85. package/src/actions/curveusd/CurveUsdSelfLiquidateAction.ts +41 -0
  86. package/src/actions/curveusd/CurveUsdSelfLiquidateWithCollAction.ts +40 -0
  87. package/src/actions/curveusd/CurveUsdSupplyAction.ts +44 -0
  88. package/src/actions/curveusd/CurveUsdWithdrawAction.ts +34 -0
  89. package/src/actions/curveusd/index.ts +10 -0
  90. package/src/actions/flashloan/FLAction.ts +8 -2
  91. package/src/actions/flashloan/SparkFlashLoanAction.ts +27 -0
  92. package/src/actions/flashloan/SparkFlashLoanPaybackAction.ts +18 -0
  93. package/src/actions/flashloan/index.ts +2 -0
  94. package/src/actions/index.ts +4 -0
  95. package/src/actions/spark/SparkBorrowAction.ts +68 -0
  96. package/src/actions/spark/SparkClaimRewardsAction.ts +50 -0
  97. package/src/actions/spark/SparkCollateralSwitchAction.ts +47 -0
  98. package/src/actions/spark/SparkPaybackAction.ts +77 -0
  99. package/src/actions/spark/SparkSetEModeAction.ts +40 -0
  100. package/src/actions/spark/SparkSpTokenPaybackAction.ts +64 -0
  101. package/src/actions/spark/SparkSupplyAction.ts +75 -0
  102. package/src/actions/spark/SparkSwapBorrowRateModeAction.ts +46 -0
  103. package/src/actions/spark/SparkWithdrawAction.ts +53 -0
  104. package/src/actions/spark/index.ts +9 -0
  105. package/src/addresses.ts +27 -0
  106. package/src/triggers/SparkQuotePriceTrigger.ts +14 -0
  107. package/src/triggers/SparkRatioTrigger.ts +14 -0
  108. package/src/triggers/index.ts +2 -0
  109. package/src/types.ts +3 -1
  110. package/src/utils/curveusd-utils.ts +15 -0
  111. package/src/utils/index.ts +2 -0
  112. package/umd/index.js +1625 -392
@@ -0,0 +1,20 @@
1
+ import { ActionWithL2 } from '../../ActionWithL2';
2
+ import { getAddr } from '../../addresses';
3
+ /**
4
+ * Gets a flashloan from Spark with fee enabled
5
+ *
6
+ * @category Flashloans
7
+ */
8
+ export class SparkFlashLoanAction extends ActionWithL2 {
9
+ /**
10
+ * @param loanAmounts
11
+ * @param tokens
12
+ * @param modes
13
+ * @param loanPayer
14
+ * @param flParamGetterAddr
15
+ * @param flParamGetterData
16
+ */
17
+ constructor(tokens, loanAmounts, modes, loanPayer, flParamGetterAddr = getAddr('Empty'), flParamGetterData = []) {
18
+ super('FLSpark', getAddr('FLSpark'), ['address[]', 'uint256[]', 'uint256[]', 'address', 'address', 'bytes', 'bytes'], [tokens, loanAmounts, modes, loanPayer, flParamGetterAddr, flParamGetterData, []]);
19
+ }
20
+ }
@@ -0,0 +1,14 @@
1
+ import { SendTokenAction } from '../basic';
2
+ import { EthAddress, uint256 } from '../../types';
3
+ /**
4
+ * Pays back a single flashloan from Spark with fee enabled
5
+ *
6
+ * @category Flashloans
7
+ */
8
+ export declare class SparkFlashLoanPaybackAction extends SendTokenAction {
9
+ /**
10
+ * @param loanAmount
11
+ * @param tokenAddr
12
+ */
13
+ constructor(loanAmount: uint256, tokenAddr: EthAddress);
14
+ }
@@ -0,0 +1,16 @@
1
+ import { SendTokenAction } from '../basic';
2
+ import { getAddr } from '../../addresses';
3
+ /**
4
+ * Pays back a single flashloan from Spark with fee enabled
5
+ *
6
+ * @category Flashloans
7
+ */
8
+ export class SparkFlashLoanPaybackAction extends SendTokenAction {
9
+ /**
10
+ * @param loanAmount
11
+ * @param tokenAddr
12
+ */
13
+ constructor(loanAmount, tokenAddr) {
14
+ super(tokenAddr, getAddr('FLSpark'), loanAmount);
15
+ }
16
+ }
@@ -6,6 +6,8 @@ export * from './AaveV3FlashLoanAction';
6
6
  export * from './AaveV3FlashLoanPaybackAction';
7
7
  export * from './AaveV3FlashLoanNoFeeAction';
8
8
  export * from './AaveV3FlashLoanNoFeePaybackAction';
9
+ export * from './SparkFlashLoanAction';
10
+ export * from './SparkFlashLoanPaybackAction';
9
11
  export * from './MakerFlashLoanAction';
10
12
  export * from './MakerFlashLoanPaybackAction';
11
13
  export * from './BalancerFlashLoanAction';
@@ -6,6 +6,8 @@ export * from './AaveV3FlashLoanAction';
6
6
  export * from './AaveV3FlashLoanPaybackAction';
7
7
  export * from './AaveV3FlashLoanNoFeeAction';
8
8
  export * from './AaveV3FlashLoanNoFeePaybackAction';
9
+ export * from './SparkFlashLoanAction';
10
+ export * from './SparkFlashLoanPaybackAction';
9
11
  export * from './MakerFlashLoanAction';
10
12
  export * from './MakerFlashLoanPaybackAction';
11
13
  export * from './BalancerFlashLoanAction';
@@ -23,4 +23,6 @@ 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
- export { aave, maker, compound, basic, flashloan, uniswap, reflexer, dydx, uniswapV3, checkers, liquity, yearn, lido, insta, balancer, curve, guni, mstable, rari, aaveV3, convex, chickenBonds, compoundV3, morpho, bprotocol, };
26
+ import * as curveusd from './curveusd';
27
+ import * as spark from './spark';
28
+ export { aave, maker, compound, basic, flashloan, uniswap, reflexer, dydx, uniswapV3, checkers, liquity, yearn, lido, insta, balancer, curve, guni, mstable, rari, aaveV3, convex, chickenBonds, compoundV3, morpho, bprotocol, spark, curveusd, };
@@ -23,4 +23,6 @@ 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
- export { aave, maker, compound, basic, flashloan, uniswap, reflexer, dydx, uniswapV3, checkers, liquity, yearn, lido, insta, balancer, curve, guni, mstable, rari, aaveV3, convex, chickenBonds, compoundV3, morpho, bprotocol, };
26
+ import * as curveusd from './curveusd';
27
+ import * as spark from './spark';
28
+ export { aave, maker, compound, basic, flashloan, uniswap, reflexer, dydx, uniswapV3, checkers, liquity, yearn, lido, insta, balancer, curve, guni, mstable, rari, aaveV3, convex, chickenBonds, compoundV3, morpho, bprotocol, spark, curveusd, };
@@ -0,0 +1,21 @@
1
+ import { ActionWithL2 } from '../../ActionWithL2';
2
+ import { EthAddress, uint8, uint16, uint256 } from '../../types';
3
+ /**
4
+ * SparkBorrowAction - Borrow a token from Spark
5
+ *
6
+ * @category Spark
7
+ */
8
+ export declare class SparkBorrowAction extends ActionWithL2 {
9
+ /**
10
+ * @param useDefaultMarket If this is true it defaults to the hardcoded market in contract
11
+ * @param market Address provider for specific market
12
+ * @param amount Amount of tokens to be borrowed
13
+ * @param to The address we are sending the borrowed tokens to
14
+ * @param rateMode Type of borrow debt [Stable: 1, Variable: 2]
15
+ * @param assetId The id of the token to be borrowed
16
+ * @param useOnBehalf use on behalf or default to proxy
17
+ * @param onBehalf On whose behalf we borrow the tokens, defaults to proxy
18
+ */
19
+ constructor(useDefaultMarket: boolean, market: EthAddress, amount: uint256, to: EthAddress, rateMode: uint8, assetId: uint16, useOnBehalf: boolean, onBehalf?: EthAddress);
20
+ encodeInputs(): string;
21
+ }
@@ -0,0 +1,59 @@
1
+ import { ActionWithL2 } from '../../ActionWithL2';
2
+ import { getAddr } from '../../addresses';
3
+ import { requireAddress } from '../../utils/general';
4
+ /**
5
+ * SparkBorrowAction - Borrow a token from Spark
6
+ *
7
+ * @category Spark
8
+ */
9
+ export class SparkBorrowAction extends ActionWithL2 {
10
+ /**
11
+ * @param useDefaultMarket If this is true it defaults to the hardcoded market in contract
12
+ * @param market Address provider for specific market
13
+ * @param amount Amount of tokens to be borrowed
14
+ * @param to The address we are sending the borrowed tokens to
15
+ * @param rateMode Type of borrow debt [Stable: 1, Variable: 2]
16
+ * @param assetId The id of the token to be borrowed
17
+ * @param useOnBehalf use on behalf or default to proxy
18
+ * @param onBehalf On whose behalf we borrow the tokens, defaults to proxy
19
+ */
20
+ constructor(useDefaultMarket, market, amount, to, rateMode, assetId, useOnBehalf, onBehalf = getAddr('Empty')) {
21
+ requireAddress(to);
22
+ super('SparkBorrow', getAddr('SparkBorrow'), ['uint256', 'address', 'uint8', 'uint16', 'bool', 'bool', 'address', 'address'], [amount, to, rateMode, assetId, useDefaultMarket, useOnBehalf, market, onBehalf]);
23
+ this.mappableArgs = [
24
+ this.args[0],
25
+ this.args[1],
26
+ this.args[2],
27
+ this.args[3],
28
+ this.args[4],
29
+ this.args[5],
30
+ this.args[6],
31
+ this.args[7],
32
+ ];
33
+ }
34
+ encodeInputs() {
35
+ // executeActionDirectL2
36
+ let encodedInput = '0x2895f3aa';
37
+ // amount
38
+ encodedInput = encodedInput.concat(this.numberToBytes32(this.args[0]));
39
+ // to
40
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[1]));
41
+ // rateMode
42
+ encodedInput = encodedInput.concat(this.numberToBytes1(this.args[2]));
43
+ // assetId
44
+ encodedInput = encodedInput.concat(this.numberToBytes2(this.args[3]));
45
+ // useDefaultMarket
46
+ encodedInput = encodedInput.concat(this.boolToBytes1(this.args[4]));
47
+ // useOnBehalf
48
+ encodedInput = encodedInput.concat(this.boolToBytes1(this.args[5]));
49
+ if (!this.args[4]) {
50
+ // market
51
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[6]));
52
+ }
53
+ if (this.args[5]) {
54
+ // onBehalf
55
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[7]));
56
+ }
57
+ return encodedInput;
58
+ }
59
+ }
@@ -0,0 +1,18 @@
1
+ import { ActionWithL2 } from '../../ActionWithL2';
2
+ import { EthAddress, uint8, uint256 } from '../../types';
3
+ /**
4
+ * SparkClaimRewardsAction
5
+ *
6
+ * @category Spark
7
+ */
8
+ export declare class SparkClaimRewardsAction extends ActionWithL2 {
9
+ /**
10
+ * @param assetsLength Address provider for specific market
11
+ * @param amount length of two arrays
12
+ * @param to Address where claimed tokens will end up on .
13
+ * @param reward Address of rewarded token
14
+ * @param assets Array of position assets to check earned rewards against
15
+ */
16
+ constructor(assetsLength: uint8, amount: uint256, to: EthAddress, reward: EthAddress, assets: Array<EthAddress>);
17
+ encodeInputs(): string;
18
+ }
@@ -0,0 +1,40 @@
1
+ import { ActionWithL2 } from '../../ActionWithL2';
2
+ import { getAddr } from '../../addresses';
3
+ import { requireAddress } from '../../utils/general';
4
+ /**
5
+ * SparkClaimRewardsAction
6
+ *
7
+ * @category Spark
8
+ */
9
+ export class SparkClaimRewardsAction extends ActionWithL2 {
10
+ /**
11
+ * @param assetsLength Address provider for specific market
12
+ * @param amount length of two arrays
13
+ * @param to Address where claimed tokens will end up on .
14
+ * @param reward Address of rewarded token
15
+ * @param assets Array of position assets to check earned rewards against
16
+ */
17
+ constructor(assetsLength, amount, to, reward, assets) {
18
+ requireAddress(to);
19
+ super('SparkClaimRewards', getAddr('SparkClaimRewards'), ['uint8', 'uint256', 'address', 'address', 'address[]'], [assetsLength, amount, to, reward, assets]);
20
+ }
21
+ encodeInputs() {
22
+ // executeActionDirectL2
23
+ let encodedInput = '0x2895f3aa';
24
+ // assetsLength
25
+ encodedInput = encodedInput.concat(this.numberToBytes1(this.args[0]));
26
+ // amount
27
+ encodedInput = encodedInput.concat(this.numberToBytes32(this.args[1]));
28
+ // to
29
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[2]));
30
+ // reward
31
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[3]));
32
+ // assets
33
+ const arrayLength = this.args[0];
34
+ for (let i = 0; i < arrayLength; i++) {
35
+ // assets[i]
36
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[4][i]));
37
+ }
38
+ return encodedInput;
39
+ }
40
+ }
@@ -0,0 +1,18 @@
1
+ import { ActionWithL2 } from '../../ActionWithL2';
2
+ import { EthAddress, uint8, uint16 } from '../../types';
3
+ /**
4
+ * SparkCollateralSwitchAction - Enable/disable token usage as collateral for Spark position
5
+ *
6
+ * @category Spark
7
+ */
8
+ export declare class SparkCollateralSwitchAction extends ActionWithL2 {
9
+ /**
10
+ * @param useDefaultMarket If this is true it defaults to the hardcoded market in contract
11
+ * @param market Address provider for specific market
12
+ * @param arrayLength length of two arrays
13
+ * @param assetIds Ids of assets to switch
14
+ * @param useAsCollateral Array of booleans representing collateral state
15
+ */
16
+ constructor(useDefaultMarket: boolean, market: EthAddress, arrayLength: uint8, assetIds: Array<uint16>, useAsCollateral: Array<boolean>);
17
+ encodeInputs(): string;
18
+ }
@@ -0,0 +1,39 @@
1
+ import { ActionWithL2 } from '../../ActionWithL2';
2
+ import { getAddr } from '../../addresses';
3
+ /**
4
+ * SparkCollateralSwitchAction - Enable/disable token usage as collateral for Spark position
5
+ *
6
+ * @category Spark
7
+ */
8
+ export class SparkCollateralSwitchAction extends ActionWithL2 {
9
+ /**
10
+ * @param useDefaultMarket If this is true it defaults to the hardcoded market in contract
11
+ * @param market Address provider for specific market
12
+ * @param arrayLength length of two arrays
13
+ * @param assetIds Ids of assets to switch
14
+ * @param useAsCollateral Array of booleans representing collateral state
15
+ */
16
+ constructor(useDefaultMarket, market, arrayLength, assetIds, useAsCollateral) {
17
+ super('SparkCollateralSwitch', getAddr('SparkCollateralSwitch'), ['uint8', 'bool', 'uint16[]', 'bool[]', 'address'], [arrayLength, useDefaultMarket, assetIds, useAsCollateral, market]);
18
+ }
19
+ encodeInputs() {
20
+ // executeActionDirectL2
21
+ let encodedInput = '0x2895f3aa';
22
+ // arrayLength
23
+ encodedInput = encodedInput.concat(this.numberToBytes1(this.args[0]));
24
+ // useDefaultMarket
25
+ encodedInput = encodedInput.concat(this.boolToBytes1(this.args[1]));
26
+ const arrayLength = this.args[0];
27
+ for (let i = 0; i < arrayLength; i++) {
28
+ // assetIds[i]
29
+ encodedInput = encodedInput.concat(this.numberToBytes2(this.args[2][i]));
30
+ // useAsCollateral[i]
31
+ encodedInput = encodedInput.concat(this.boolToBytes1(this.args[3][i]));
32
+ }
33
+ if (!this.args[1]) {
34
+ // market
35
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[4]));
36
+ }
37
+ return encodedInput;
38
+ }
39
+ }
@@ -0,0 +1,27 @@
1
+ import { ActionWithL2 } from '../../ActionWithL2';
2
+ import { EthAddress, uint8, uint16, uint256 } from '../../types';
3
+ /**
4
+ * SparkPaybackAction - Payback debt on Spark using underlying token
5
+ *
6
+ * @category Spark
7
+ */
8
+ export declare class SparkPaybackAction extends ActionWithL2 {
9
+ tokenForApproval: EthAddress;
10
+ /**
11
+ * @param useOnDefaultMarket If this is true it defaults to the hardcoded market in contract
12
+ * @param market Address provider for specific market
13
+ * @param amount Amount of tokens to be payed back
14
+ * @param from Tokens will be supplied from this address
15
+ * @param rateMode Type of borrow debt [Stable: 1, Variable: 2]
16
+ * @param tokenAddress Address of token to pay back.
17
+ * @param assetId The id of the underlying asset to be repaid
18
+ * @param useOnBehalf use on behalf param or default to proxy
19
+ * @param onBehalf For what user we are paying back the debt, defaults to proxy
20
+ */
21
+ constructor(useOnDefaultMarket: boolean, market: EthAddress, amount: uint256, from: EthAddress, rateMode: uint8, tokenAddress: EthAddress, assetId: uint16, useOnBehalf: boolean, onBehalf?: EthAddress);
22
+ getAssetsToApprove(): Promise<{
23
+ asset: string;
24
+ owner: any;
25
+ }[]>;
26
+ encodeInputs(): string;
27
+ }
@@ -0,0 +1,77 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { getAssetInfoByAddress } from '@defisaver/tokens';
11
+ import { ActionWithL2 } from '../../ActionWithL2';
12
+ import { getAddr } from '../../addresses';
13
+ /**
14
+ * SparkPaybackAction - Payback debt on Spark using underlying token
15
+ *
16
+ * @category Spark
17
+ */
18
+ export class SparkPaybackAction extends ActionWithL2 {
19
+ /**
20
+ * @param useOnDefaultMarket If this is true it defaults to the hardcoded market in contract
21
+ * @param market Address provider for specific market
22
+ * @param amount Amount of tokens to be payed back
23
+ * @param from Tokens will be supplied from this address
24
+ * @param rateMode Type of borrow debt [Stable: 1, Variable: 2]
25
+ * @param tokenAddress Address of token to pay back.
26
+ * @param assetId The id of the underlying asset to be repaid
27
+ * @param useOnBehalf use on behalf param or default to proxy
28
+ * @param onBehalf For what user we are paying back the debt, defaults to proxy
29
+ */
30
+ constructor(useOnDefaultMarket, market, amount, from, rateMode, tokenAddress, assetId, useOnBehalf, onBehalf = getAddr('Empty')) {
31
+ super('SparkPayback', getAddr('SparkPayback'), ['uint256', 'address', 'uint8', 'uint16', 'bool', 'bool', 'address', 'address'], [amount, from, rateMode, assetId, useOnDefaultMarket, useOnBehalf, market, onBehalf]);
32
+ this.mappableArgs = [
33
+ this.args[0],
34
+ this.args[1],
35
+ this.args[2],
36
+ this.args[3],
37
+ this.args[4],
38
+ this.args[5],
39
+ this.args[6],
40
+ this.args[7],
41
+ ];
42
+ this.tokenForApproval = tokenAddress;
43
+ }
44
+ getAssetsToApprove() {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ const asset = getAssetInfoByAddress(this.tokenForApproval);
47
+ if (asset.symbol !== 'ETH')
48
+ return [{ asset: this.tokenForApproval, owner: this.args[1] }];
49
+ return [];
50
+ });
51
+ }
52
+ encodeInputs() {
53
+ // executeActionDirectL2
54
+ let encodedInput = '0x2895f3aa';
55
+ // amount
56
+ encodedInput = encodedInput.concat(this.numberToBytes32(this.args[0]));
57
+ // from
58
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[1]));
59
+ // rateMode
60
+ encodedInput = encodedInput.concat(this.numberToBytes1(this.args[2]));
61
+ // assetId
62
+ encodedInput = encodedInput.concat(this.numberToBytes2(this.args[3]));
63
+ // useDefaultMarket
64
+ encodedInput = encodedInput.concat(this.boolToBytes1(this.args[4]));
65
+ // useOnBehalf
66
+ encodedInput = encodedInput.concat(this.boolToBytes1(this.args[5]));
67
+ if (!this.args[4]) {
68
+ // market
69
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[6]));
70
+ }
71
+ if (this.args[5]) {
72
+ // onBehalf
73
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[7]));
74
+ }
75
+ return encodedInput;
76
+ }
77
+ }
@@ -0,0 +1,16 @@
1
+ import { ActionWithL2 } from '../../ActionWithL2';
2
+ import { EthAddress, uint8 } from '../../types';
3
+ /**
4
+ * SparkSetEModeAction - Set EMode for the proxy Spark position
5
+ *
6
+ * @category Spark
7
+ */
8
+ export declare class SparkSetEModeAction extends ActionWithL2 {
9
+ /**
10
+ * @param useOnDefaultMarket If this is true it defaults to the hardcoded market in contract
11
+ * @param market Address provider for specific market
12
+ * @param categoryId ID of the category emode
13
+ */
14
+ constructor(useOnDefaultMarket: boolean, market: EthAddress, categoryId: uint8);
15
+ encodeInputs(): string;
16
+ }
@@ -0,0 +1,33 @@
1
+ import { ActionWithL2 } from '../../ActionWithL2';
2
+ import { getAddr } from '../../addresses';
3
+ /**
4
+ * SparkSetEModeAction - Set EMode for the proxy Spark position
5
+ *
6
+ * @category Spark
7
+ */
8
+ export class SparkSetEModeAction extends ActionWithL2 {
9
+ /**
10
+ * @param useOnDefaultMarket If this is true it defaults to the hardcoded market in contract
11
+ * @param market Address provider for specific market
12
+ * @param categoryId ID of the category emode
13
+ */
14
+ constructor(useOnDefaultMarket, market, categoryId) {
15
+ super('SparkSetEMode', getAddr('SparkSetEMode'), ['uint8', 'bool', 'address'], [categoryId, useOnDefaultMarket, market]);
16
+ this.mappableArgs = [
17
+ this.args[2],
18
+ ];
19
+ }
20
+ encodeInputs() {
21
+ // executeActionDirectL2
22
+ let encodedInput = '0x2895f3aa';
23
+ // categoryId
24
+ encodedInput = encodedInput.concat(this.numberToBytes1(this.args[0]));
25
+ // useOnDefaultMarket
26
+ encodedInput = encodedInput.concat(this.boolToBytes1(this.args[1]));
27
+ if (!this.args[1]) {
28
+ // market
29
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[2]));
30
+ }
31
+ return encodedInput;
32
+ }
33
+ }
@@ -0,0 +1,25 @@
1
+ import { ActionWithL2 } from '../../ActionWithL2';
2
+ import { EthAddress, uint8, uint16, uint256 } from '../../types';
3
+ /**
4
+ * SparkSpTokenPaybackAction - Repay Spark debt using spTokens
5
+ *
6
+ * @category Spark
7
+ */
8
+ export declare class SparkSpTokenPaybackAction extends ActionWithL2 {
9
+ addressForApproval: EthAddress;
10
+ /**
11
+ * @param useDefaultMarket If this is true it defaults to the hardcoded market in contract
12
+ * @param market Address provider for specific market
13
+ * @param amount Amount of tokens to be payed back (uint.max for full debt)
14
+ * @param from Where are we pulling the payback spTokens from
15
+ * @param rateMode Type of borrow debt [Stable: 1, Variable: 2]
16
+ * @param spTokenAddr address of the spToken to be pulled
17
+ * @param assetId The id of the underlying asset to be repaid
18
+ */
19
+ constructor(useDefaultMarket: boolean, market: EthAddress, amount: uint256, from: EthAddress, rateMode: uint8, spTokenAddr: EthAddress, assetId: uint16);
20
+ getAssetsToApprove(): Promise<{
21
+ asset: string;
22
+ owner: any;
23
+ }[]>;
24
+ encodeInputs(): string;
25
+ }
@@ -0,0 +1,64 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { getAssetInfoByAddress } from '@defisaver/tokens';
11
+ import { ActionWithL2 } from '../../ActionWithL2';
12
+ import { getAddr } from '../../addresses';
13
+ /**
14
+ * SparkSpTokenPaybackAction - Repay Spark debt using spTokens
15
+ *
16
+ * @category Spark
17
+ */
18
+ export class SparkSpTokenPaybackAction extends ActionWithL2 {
19
+ /**
20
+ * @param useDefaultMarket If this is true it defaults to the hardcoded market in contract
21
+ * @param market Address provider for specific market
22
+ * @param amount Amount of tokens to be payed back (uint.max for full debt)
23
+ * @param from Where are we pulling the payback spTokens from
24
+ * @param rateMode Type of borrow debt [Stable: 1, Variable: 2]
25
+ * @param spTokenAddr address of the spToken to be pulled
26
+ * @param assetId The id of the underlying asset to be repaid
27
+ */
28
+ constructor(useDefaultMarket, market, amount, from, rateMode, spTokenAddr, assetId) {
29
+ super('SparkSpTokenPayback', getAddr('SparkSpTokenPayback'), ['uint256', 'address', 'uint8', 'uint16', 'bool', 'address'], [amount, from, rateMode, assetId, useDefaultMarket, market]);
30
+ this.mappableArgs = [
31
+ this.args[0],
32
+ this.args[1],
33
+ this.args[5],
34
+ ];
35
+ this.addressForApproval = spTokenAddr;
36
+ }
37
+ getAssetsToApprove() {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ const asset = getAssetInfoByAddress(this.addressForApproval);
40
+ if (asset.symbol !== 'ETH')
41
+ return [{ asset: this.addressForApproval, owner: this.args[1] }];
42
+ return [];
43
+ });
44
+ }
45
+ encodeInputs() {
46
+ // executeActionDirectL2
47
+ let encodedInput = '0x2895f3aa';
48
+ // amount
49
+ encodedInput = encodedInput.concat(this.numberToBytes32(this.args[0]));
50
+ // from
51
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[1]));
52
+ // rateMode
53
+ encodedInput = encodedInput.concat(this.numberToBytes1(this.args[2]));
54
+ // assetId
55
+ encodedInput = encodedInput.concat(this.numberToBytes2(this.args[3]));
56
+ // useDefaultMarket
57
+ encodedInput = encodedInput.concat(this.boolToBytes1(this.args[4]));
58
+ if (!this.args[4]) {
59
+ // market
60
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[5]));
61
+ }
62
+ return encodedInput;
63
+ }
64
+ }
@@ -0,0 +1,27 @@
1
+ import { ActionWithL2 } from '../../ActionWithL2';
2
+ import { EthAddress, uint16, uint256 } from '../../types';
3
+ /**
4
+ * SparkSupplyAction - Supply token to an Spark position
5
+ *
6
+ * @category Spark
7
+ */
8
+ export declare class SparkSupplyAction extends ActionWithL2 {
9
+ tokenForApproval: EthAddress;
10
+ /**
11
+ * @param useDefaultMarket If this is true it defaults to the hardcoded market in contract
12
+ * @param market Address provider for specific market
13
+ * @param amount Amount of tokens to be deposited
14
+ * @param from Tokens will be supplied from this address
15
+ * @param tokenAddress Address of the token
16
+ * @param assetId The id of the token to be deposited
17
+ * @param enableAsColl If we need to enable asset as collateral
18
+ * @param useOnBehalf use on behalf param or default to proxy
19
+ * @param onBehalf For what user we are supplying the tokens, defaults to proxy
20
+ */
21
+ constructor(useDefaultMarket: boolean, market: EthAddress, amount: uint256, from: EthAddress, tokenAddress: EthAddress, assetId: uint16, enableAsColl: boolean, useOnBehalf: boolean, onBehalf?: EthAddress);
22
+ getAssetsToApprove(): Promise<{
23
+ asset: string;
24
+ owner: any;
25
+ }[]>;
26
+ encodeInputs(): string;
27
+ }
@@ -0,0 +1,77 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { getAssetInfoByAddress } from '@defisaver/tokens';
11
+ import { ActionWithL2 } from '../../ActionWithL2';
12
+ import { getAddr } from '../../addresses';
13
+ /**
14
+ * SparkSupplyAction - Supply token to an Spark position
15
+ *
16
+ * @category Spark
17
+ */
18
+ export class SparkSupplyAction extends ActionWithL2 {
19
+ /**
20
+ * @param useDefaultMarket If this is true it defaults to the hardcoded market in contract
21
+ * @param market Address provider for specific market
22
+ * @param amount Amount of tokens to be deposited
23
+ * @param from Tokens will be supplied from this address
24
+ * @param tokenAddress Address of the token
25
+ * @param assetId The id of the token to be deposited
26
+ * @param enableAsColl If we need to enable asset as collateral
27
+ * @param useOnBehalf use on behalf param or default to proxy
28
+ * @param onBehalf For what user we are supplying the tokens, defaults to proxy
29
+ */
30
+ constructor(useDefaultMarket, market, amount, from, tokenAddress, assetId, enableAsColl, useOnBehalf, onBehalf = getAddr('Empty')) {
31
+ super('SparkSupply', getAddr('SparkSupply'), ['uint256', 'address', 'uint16', 'bool', 'bool', 'bool', 'address', 'address'], [amount, from, assetId, enableAsColl, useDefaultMarket, useOnBehalf, market, onBehalf]);
32
+ this.mappableArgs = [
33
+ this.args[0],
34
+ this.args[1],
35
+ this.args[2],
36
+ this.args[3],
37
+ this.args[4],
38
+ this.args[5],
39
+ this.args[6],
40
+ this.args[7],
41
+ ];
42
+ this.tokenForApproval = tokenAddress;
43
+ }
44
+ getAssetsToApprove() {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ const asset = getAssetInfoByAddress(this.tokenForApproval);
47
+ if (asset.symbol !== 'ETH')
48
+ return [{ asset: this.tokenForApproval, owner: this.args[1] }];
49
+ return [];
50
+ });
51
+ }
52
+ encodeInputs() {
53
+ // executeActionDirectL2
54
+ let encodedInput = '0x2895f3aa';
55
+ // amount
56
+ encodedInput = encodedInput.concat(this.numberToBytes32(this.args[0]));
57
+ // from
58
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[1]));
59
+ // assetId
60
+ encodedInput = encodedInput.concat(this.numberToBytes2(this.args[2]));
61
+ // enableAsColl
62
+ encodedInput = encodedInput.concat(this.boolToBytes1(this.args[3]));
63
+ // useDefaultMarket
64
+ encodedInput = encodedInput.concat(this.boolToBytes1(this.args[4]));
65
+ // useOnBehalf
66
+ encodedInput = encodedInput.concat(this.boolToBytes1(this.args[5]));
67
+ if (!this.args[4]) {
68
+ // market
69
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[6]));
70
+ }
71
+ if (this.args[5]) {
72
+ // onBehalf
73
+ encodedInput = encodedInput.concat(this.addressToBytes20(this.args[7]));
74
+ }
75
+ return encodedInput;
76
+ }
77
+ }