@defisaver/sdk 1.0.32 → 1.0.34

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 (67) hide show
  1. package/esm/src/actions/aave/AaveFinalizeUnstakeAction.d.ts +14 -0
  2. package/esm/src/actions/aave/AaveFinalizeUnstakeAction.js +22 -0
  3. package/esm/src/actions/aave/AaveStartUnstakeAction.d.ts +9 -0
  4. package/esm/src/actions/aave/AaveStartUnstakeAction.js +12 -0
  5. package/esm/src/actions/aave/index.d.ts +2 -0
  6. package/esm/src/actions/aave/index.js +2 -0
  7. package/esm/src/actions/flashloan/FLAction.js +1 -1
  8. package/esm/src/actions/flashloan/UniV3FlashLoanAction.d.ts +19 -0
  9. package/esm/src/actions/flashloan/UniV3FlashLoanAction.js +21 -0
  10. package/esm/src/actions/flashloan/UniV3FlashLoanPaybackAction.d.ts +16 -0
  11. package/esm/src/actions/flashloan/UniV3FlashLoanPaybackAction.js +18 -0
  12. package/esm/src/actions/flashloan/index.d.ts +2 -0
  13. package/esm/src/actions/flashloan/index.js +2 -0
  14. package/esm/src/actions/index.d.ts +1 -2
  15. package/esm/src/actions/index.js +1 -2
  16. package/esm/src/addresses.d.ts +6 -30
  17. package/esm/src/addresses.js +2 -11
  18. package/esm/src/index.d.ts +24 -120
  19. package/esm/src/types.d.ts +1 -3
  20. package/esm/src/utils/index.d.ts +1 -2
  21. package/esm/src/utils/index.js +1 -2
  22. package/package.json +1 -1
  23. package/src/actions/aave/AaveFinalizeUnstakeAction.ts +29 -0
  24. package/src/actions/aave/AaveStartUnstakeAction.ts +18 -0
  25. package/src/actions/aave/index.ts +3 -1
  26. package/src/actions/flashloan/FLAction.ts +1 -1
  27. package/src/actions/flashloan/UniV3FlashLoanAction.ts +28 -0
  28. package/src/actions/flashloan/UniV3FlashLoanPaybackAction.ts +20 -0
  29. package/src/actions/flashloan/index.ts +2 -0
  30. package/src/actions/index.ts +0 -2
  31. package/src/addresses.ts +2 -12
  32. package/src/types.ts +1 -3
  33. package/src/utils/index.ts +0 -2
  34. package/umd/index.js +532 -806
  35. package/esm/src/actions/curveusd/CurveUsdBorrowAction.d.ts +0 -15
  36. package/esm/src/actions/curveusd/CurveUsdBorrowAction.js +0 -22
  37. package/esm/src/actions/curveusd/CurveUsdCreateAction.d.ts +0 -22
  38. package/esm/src/actions/curveusd/CurveUsdCreateAction.js +0 -44
  39. package/esm/src/actions/curveusd/CurveUsdLevCreateAction.d.ts +0 -9
  40. package/esm/src/actions/curveusd/CurveUsdLevCreateAction.js +0 -16
  41. package/esm/src/actions/curveusd/CurveUsdPaybackAction.d.ts +0 -22
  42. package/esm/src/actions/curveusd/CurveUsdPaybackAction.js +0 -43
  43. package/esm/src/actions/curveusd/CurveUsdRepayAction.d.ts +0 -9
  44. package/esm/src/actions/curveusd/CurveUsdRepayAction.js +0 -14
  45. package/esm/src/actions/curveusd/CurveUsdSelfLiquidateAction.d.ts +0 -19
  46. package/esm/src/actions/curveusd/CurveUsdSelfLiquidateAction.js +0 -38
  47. package/esm/src/actions/curveusd/CurveUsdSelfLiquidateWithCollAction.d.ts +0 -9
  48. package/esm/src/actions/curveusd/CurveUsdSelfLiquidateWithCollAction.js +0 -16
  49. package/esm/src/actions/curveusd/CurveUsdSupplyAction.d.ts +0 -20
  50. package/esm/src/actions/curveusd/CurveUsdSupplyAction.js +0 -40
  51. package/esm/src/actions/curveusd/CurveUsdWithdrawAction.d.ts +0 -15
  52. package/esm/src/actions/curveusd/CurveUsdWithdrawAction.js +0 -22
  53. package/esm/src/actions/curveusd/index.d.ts +0 -9
  54. package/esm/src/actions/curveusd/index.js +0 -9
  55. package/esm/src/utils/curveusd-utils.d.ts +0 -20
  56. package/esm/src/utils/curveusd-utils.js +0 -12
  57. package/src/actions/curveusd/CurveUsdBorrowAction.ts +0 -34
  58. package/src/actions/curveusd/CurveUsdCreateAction.ts +0 -49
  59. package/src/actions/curveusd/CurveUsdLevCreateAction.ts +0 -40
  60. package/src/actions/curveusd/CurveUsdPaybackAction.ts +0 -48
  61. package/src/actions/curveusd/CurveUsdRepayAction.ts +0 -36
  62. package/src/actions/curveusd/CurveUsdSelfLiquidateAction.ts +0 -41
  63. package/src/actions/curveusd/CurveUsdSelfLiquidateWithCollAction.ts +0 -40
  64. package/src/actions/curveusd/CurveUsdSupplyAction.ts +0 -44
  65. package/src/actions/curveusd/CurveUsdWithdrawAction.ts +0 -34
  66. package/src/actions/curveusd/index.ts +0 -10
  67. package/src/utils/curveusd-utils.ts +0 -15
@@ -1,36 +0,0 @@
1
- import { Action } from '../../Action';
2
- import { getAddr } from '../../addresses';
3
- import {
4
- EthAddress,
5
- uint256,
6
- uint32,
7
- bytes,
8
- } from '../../types';
9
-
10
- /**
11
- *
12
- * @category CurveUsd
13
- */
14
- export class CurveUsdRepayAction extends Action {
15
- constructor(
16
- controllerAddress: EthAddress,
17
- collAmount: uint256,
18
- to: EthAddress,
19
- minAmount: uint256,
20
- additionData: bytes,
21
- gasUsed: uint32,
22
- dfsFeeDivider: uint32,
23
- useSteth: Boolean,
24
- ) {
25
- super(
26
- 'CurveUsdRepay',
27
- getAddr('CurveUsdRepay'),
28
- ['address', 'uint256', 'address', 'uint256', 'bytes', 'uint32', 'uint32', 'bool'],
29
- [controllerAddress, collAmount, to, minAmount, additionData, gasUsed, dfsFeeDivider, useSteth],
30
- );
31
-
32
- this.mappableArgs = [
33
- ...this.args,
34
- ];
35
- }
36
- }
@@ -1,41 +0,0 @@
1
- import { getAssetInfo } from '@defisaver/tokens';
2
- import { Action } from '../../Action';
3
- import { getAddr } from '../../addresses';
4
- import { EthAddress, uint256, int256 } from '../../types';
5
-
6
- /**
7
- *
8
- * @category CurveUsd
9
- */
10
- export class CurveUsdSelfLiquidateAction extends Action {
11
- /**
12
- @param controllerAddress Address of the curveusd market controller
13
- @param minCrvUsdExpected Minimum amount of crvUsd as collateral for the user to have
14
- @param from Address from which to pull crvUSD if needed
15
- @param to Address that will receive the crvUSD and collateral asset
16
- */
17
- constructor(
18
- controllerAddress: EthAddress,
19
- minCrvUsdExpected: uint256,
20
- from: EthAddress,
21
- to: EthAddress,
22
- ) {
23
- super(
24
- 'CurveUsdSelfLiquidate',
25
- getAddr('CurveUsdSelfLiquidate'),
26
- ['address', 'uint256', 'address', 'address'],
27
- [controllerAddress, minCrvUsdExpected, from, to],
28
- );
29
-
30
- this.mappableArgs = [
31
- ...this.args,
32
- ];
33
- }
34
-
35
- async getAssetsToApprove() {
36
- return [{
37
- owner: this.args[1],
38
- asset: getAssetInfo('crvUSD').address,
39
- }];
40
- }
41
- }
@@ -1,40 +0,0 @@
1
- import { Action } from '../../Action';
2
- import { requireAddress } from '../../utils/general';
3
- import { getAddr } from '../../addresses';
4
- import {
5
- EthAddress,
6
- uint256,
7
- uint32,
8
- bytes,
9
- } from '../../types';
10
-
11
- /**
12
- *
13
- * @category CurveUsd
14
- */
15
- export class CurveUsdSelfLiquidateWithCollAction extends Action {
16
- constructor(
17
- controllerAddress: EthAddress,
18
- percentage: uint256,
19
- minCrvUsdExpected: uint256,
20
- swapAmount: uint256,
21
- minAmount: uint256,
22
- to: EthAddress,
23
- additionData: bytes,
24
- gasUsed: uint32,
25
- dfsFeeDivider: uint32,
26
- useSteth: Boolean,
27
- ) {
28
- requireAddress(to);
29
- super(
30
- 'CurveUsdSelfLiquidateWithColl',
31
- getAddr('CurveUsdSelfLiquidateWithColl'),
32
- ['address', 'uint256', 'uint256', 'uint256', 'uint256', 'address', 'bytes', 'uint32', 'uint32', 'bool'],
33
- [controllerAddress, percentage, minCrvUsdExpected, swapAmount, minAmount, to, additionData, gasUsed, dfsFeeDivider, useSteth],
34
- );
35
-
36
- this.mappableArgs = [
37
- ...this.args,
38
- ];
39
- }
40
- }
@@ -1,44 +0,0 @@
1
- import { Action } from '../../Action';
2
- import { getAddr } from '../../addresses';
3
- import { EthAddress, uint256 } from '../../types';
4
- import { controllerToAssetMap } from '../../utils/curveusd-utils';
5
-
6
-
7
- /**
8
- * CurveUsdSupplyAction - Action that supplies collateral to a curveusd position
9
- *
10
- * @category CurveUsd
11
- */
12
- export class CurveUsdSupplyAction extends Action {
13
- /**
14
- * address controllerAddress - Address of the curveusd market controller
15
- * address from - Address from which to pull collateral asset, will default to proxy
16
- * address onBehalfOf - Address for which we are supplying, will default to proxy
17
- * uint256 collateralAmount - Amount of collateral asset to supply
18
- */
19
- /// @dev collateralAmount must be non-zero, can be maxUint
20
- constructor(
21
- controllerAddress: EthAddress,
22
- from: EthAddress,
23
- onBehalfOf: EthAddress,
24
- collateralAmount: uint256,
25
- ) {
26
- super(
27
- 'CurveUsdSupply',
28
- getAddr('CurveUsdSupply'),
29
- ['address', 'address', 'address', 'uint256'],
30
- [controllerAddress, from, onBehalfOf, collateralAmount],
31
- );
32
-
33
- this.mappableArgs = [
34
- ...this.args,
35
- ];
36
- }
37
-
38
- async getAssetsToApprove() {
39
- return [{
40
- owner: this.args[1],
41
- asset: controllerToAssetMap[this.args[0] as keyof typeof controllerToAssetMap],
42
- }];
43
- }
44
- }
@@ -1,34 +0,0 @@
1
- import { Action } from '../../Action';
2
- import { getAddr } from '../../addresses';
3
- import { EthAddress, uint256 } from '../../types';
4
-
5
- /**
6
- * CurveUsdWithdrawAction - Action that withdraws collateral from proxy curveusd position
7
- *
8
- * @category CurveUsd
9
- */
10
- export class CurveUsdWithdrawAction extends Action {
11
- /**
12
- * address controllerAddress - Address of the curveusd market controller
13
- * address to - Address that will receive the withdrawn collateral, will default to proxy
14
- * uint256 collateralAmount - Amount of collateral to withdraw
15
- */
16
- /// @dev collateralAmount must be non-zero
17
- /// @dev if collateralAmount == uintMax will withdraw as much as the debt will allow
18
- constructor(
19
- controllerAddress: EthAddress,
20
- to: EthAddress,
21
- collateralAmount: uint256,
22
- ) {
23
- super(
24
- 'CurveUsdWithdraw',
25
- getAddr('CurveUsdWithdraw'),
26
- ['address', 'address', 'uint256'],
27
- [controllerAddress, to, collateralAmount],
28
- );
29
-
30
- this.mappableArgs = [
31
- ...this.args,
32
- ];
33
- }
34
- }
@@ -1,10 +0,0 @@
1
- export * from './CurveUsdCreateAction';
2
- export * from './CurveUsdSupplyAction';
3
- export * from './CurveUsdWithdrawAction';
4
- export * from './CurveUsdBorrowAction';
5
- export * from './CurveUsdPaybackAction';
6
- export * from './CurveUsdRepayAction';
7
- export * from './CurveUsdSelfLiquidateAction';
8
- export * from './CurveUsdLevCreateAction';
9
- export * from './CurveUsdSelfLiquidateWithCollAction';
10
-
@@ -1,15 +0,0 @@
1
- /// @dev debtAvailableBlock is only used in v3-contracts repo
2
- export const curveusdMarkets = {
3
- wstETH: { controllerAddress: '0x100dAa78fC509Db39Ef7D04DE0c1ABD299f4C6CE', debtAvailableBlock: 17487165 },
4
- WBTC: { controllerAddress: '0x4e59541306910ad6dc1dac0ac9dfb29bd9f15c67', debtAvailableBlock: 17563176 },
5
- WETH: { controllerAddress: '0xa920de414ea4ab66b97da1bfe9e6eca7d4219635', debtAvailableBlock: 17563176 },
6
- };
7
-
8
- export const controllerToAssetMap = {
9
- '0x100dAa78fC509Db39Ef7D04DE0c1ABD299f4C6CE': '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0',
10
- '0x4e59541306910ad6dc1dac0ac9dfb29bd9f15c67': '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
11
- '0xa920de414ea4ab66b97da1bfe9e6eca7d4219635': '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
12
- };
13
-
14
- export const controllerFactoryAddress = '0xC9332fdCB1C491Dcc683bAe86Fe3cb70360738BC';
15
-