@defisaver/sdk 1.0.24 → 1.0.26

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 (51) hide show
  1. package/esm/src/Action.js +2 -1
  2. package/esm/src/actions/curveusd/CurveUsdCreateAction.js +2 -4
  3. package/esm/src/actions/curveusd/CurveUsdLevCreateAction.d.ts +9 -0
  4. package/esm/src/actions/curveusd/CurveUsdLevCreateAction.js +16 -0
  5. package/esm/src/actions/curveusd/CurveUsdPaybackAction.js +1 -1
  6. package/esm/src/actions/curveusd/CurveUsdRepayAction.d.ts +9 -0
  7. package/esm/src/actions/curveusd/CurveUsdRepayAction.js +14 -0
  8. package/esm/src/actions/curveusd/CurveUsdSelfLiquidateAction.d.ts +19 -0
  9. package/esm/src/actions/curveusd/CurveUsdSelfLiquidateAction.js +38 -0
  10. package/esm/src/actions/curveusd/CurveUsdSelfLiquidateWithCollAction.d.ts +9 -0
  11. package/esm/src/actions/curveusd/CurveUsdSelfLiquidateWithCollAction.js +16 -0
  12. package/esm/src/actions/curveusd/CurveUsdSupplyAction.js +2 -4
  13. package/esm/src/actions/curveusd/CurveUsdWithdrawAction.js +1 -1
  14. package/esm/src/actions/curveusd/index.d.ts +4 -0
  15. package/esm/src/actions/curveusd/index.js +4 -0
  16. package/esm/src/actions/flashloan/FLAction.js +1 -1
  17. package/esm/src/actions/morpho/aaveV3/MorphoAaveV3BorrowAction.d.ts +18 -0
  18. package/esm/src/actions/morpho/aaveV3/MorphoAaveV3BorrowAction.js +27 -0
  19. package/esm/src/actions/morpho/aaveV3/MorphoAaveV3PaybackAction.d.ts +21 -0
  20. package/esm/src/actions/morpho/aaveV3/MorphoAaveV3PaybackAction.js +44 -0
  21. package/esm/src/actions/morpho/aaveV3/MorphoAaveV3SupplyAction.d.ts +23 -0
  22. package/esm/src/actions/morpho/aaveV3/MorphoAaveV3SupplyAction.js +47 -0
  23. package/esm/src/actions/morpho/aaveV3/MorphoAaveV3WithdrawAction.d.ts +19 -0
  24. package/esm/src/actions/morpho/aaveV3/MorphoAaveV3WithdrawAction.js +29 -0
  25. package/esm/src/actions/morpho/index.d.ts +4 -0
  26. package/esm/src/actions/morpho/index.js +4 -0
  27. package/esm/src/addresses.d.ts +30 -0
  28. package/esm/src/addresses.js +12 -0
  29. package/esm/src/index.d.ts +120 -0
  30. package/esm/src/utils/curveusd-utils.d.ts +15 -0
  31. package/esm/src/utils/curveusd-utils.js +9 -1
  32. package/package.json +1 -1
  33. package/src/Action.ts +2 -1
  34. package/src/actions/curveusd/CurveUsdCreateAction.ts +2 -6
  35. package/src/actions/curveusd/CurveUsdLevCreateAction.ts +32 -0
  36. package/src/actions/curveusd/CurveUsdPaybackAction.ts +3 -3
  37. package/src/actions/curveusd/CurveUsdRepayAction.ts +30 -0
  38. package/src/actions/curveusd/CurveUsdSelfLiquidateAction.ts +41 -0
  39. package/src/actions/curveusd/CurveUsdSelfLiquidateWithCollAction.ts +32 -0
  40. package/src/actions/curveusd/CurveUsdSupplyAction.ts +2 -6
  41. package/src/actions/curveusd/CurveUsdWithdrawAction.ts +3 -3
  42. package/src/actions/curveusd/index.ts +5 -0
  43. package/src/actions/flashloan/FLAction.ts +1 -1
  44. package/src/actions/morpho/aaveV3/MorphoAaveV3BorrowAction.ts +42 -0
  45. package/src/actions/morpho/aaveV3/MorphoAaveV3PaybackAction.ts +47 -0
  46. package/src/actions/morpho/aaveV3/MorphoAaveV3SupplyAction.ts +52 -0
  47. package/src/actions/morpho/aaveV3/MorphoAaveV3WithdrawAction.ts +45 -0
  48. package/src/actions/morpho/index.ts +4 -0
  49. package/src/addresses.ts +14 -0
  50. package/src/utils/curveusd-utils.ts +10 -1
  51. package/umd/index.js +429 -137
package/esm/src/Action.js CHANGED
@@ -108,7 +108,8 @@ export class Action {
108
108
  return [AbiCoder.encodeParameter(_paramType, _arg)];
109
109
  }
110
110
  encodeForL2DsProxyCall() {
111
- return this._encodeForCall()[0];
111
+ const executeActionDirectAbi = (ActionAbi.find(({ name }) => name === 'executeActionDirect'));
112
+ return AbiCoder.encodeFunctionCall(executeActionDirectAbi, this._encodeForCall());
112
113
  }
113
114
  encodeForL2Recipe() {
114
115
  return this._encodeForCall()[0];
@@ -7,12 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { compare } from '@defisaver/tokens/esm/utils';
11
- import { getAssetInfo } from '@defisaver/tokens';
12
10
  import { Action } from '../../Action';
13
11
  import { requireAddress } from '../../utils/general';
14
12
  import { getAddr } from '../../addresses';
15
- import { curveusdMarkets } from '../../utils/curveusd-utils';
13
+ import { controllerToAssetMap } from '../../utils/curveusd-utils';
16
14
  /**
17
15
  * CurveUsdCreateAction - Action that creates a curveusd position on behalf of proxy
18
16
  *
@@ -39,7 +37,7 @@ export class CurveUsdCreateAction extends Action {
39
37
  return __awaiter(this, void 0, void 0, function* () {
40
38
  return [{
41
39
  owner: this.args[1],
42
- asset: getAssetInfo(Object.entries(curveusdMarkets).filter(([, { controllerAddress }]) => compare(controllerAddress, this.args[0]))[0][0]).address,
40
+ asset: controllerToAssetMap[this.args[0]],
43
41
  }];
44
42
  });
45
43
  }
@@ -0,0 +1,9 @@
1
+ import { Action } from '../../Action';
2
+ import { EthAddress, uint256, bytes } from '../../types';
3
+ /**
4
+ *
5
+ * @category CurveUsd
6
+ */
7
+ export declare class CurveUsdLevCreateAction extends Action {
8
+ constructor(controllerAddress: EthAddress, collateralAmount: uint256, debtAmount: uint256, minAmount: uint256, nBands: uint256, from: EthAddress, additionData: bytes);
9
+ }
@@ -0,0 +1,16 @@
1
+ import { Action } from '../../Action';
2
+ import { requireAddress } from '../../utils/general';
3
+ import { getAddr } from '../../addresses';
4
+ /**
5
+ *
6
+ * @category CurveUsd
7
+ */
8
+ export class CurveUsdLevCreateAction extends Action {
9
+ constructor(controllerAddress, collateralAmount, debtAmount, minAmount, nBands, from, additionData) {
10
+ requireAddress(from);
11
+ super('CurveUsdLevCreate', getAddr('CurveUsdLevCreate'), ['address', 'uint256', 'uint256', 'uint256', 'uint256', 'address', 'bytes'], [controllerAddress, collateralAmount, debtAmount, minAmount, nBands, from, additionData]);
12
+ this.mappableArgs = [
13
+ ...this.args,
14
+ ];
15
+ }
16
+ }
@@ -27,7 +27,7 @@ export class CurveUsdPaybackAction extends Action {
27
27
  /// @dev debtAmount must be non-zero
28
28
  /// @dev if debtAmount >= debt will repay whole debt and close the position, transfering collateral
29
29
  constructor(controllerAddress, from, onBehalfOf, to, debtAmount, maxActiveBand) {
30
- super('CurveUsdBorrow', getAddr('CurveUsdBorrow'), ['address', 'address', 'address', 'address', 'uint256', 'int256'], [controllerAddress, from, onBehalfOf, to, debtAmount, maxActiveBand]);
30
+ super('CurveUsdPayback', getAddr('CurveUsdPayback'), ['address', 'address', 'address', 'address', 'uint256', 'int256'], [controllerAddress, from, onBehalfOf, to, debtAmount, maxActiveBand]);
31
31
  this.mappableArgs = [
32
32
  ...this.args,
33
33
  ];
@@ -0,0 +1,9 @@
1
+ import { Action } from '../../Action';
2
+ import { EthAddress, uint256, bytes } from '../../types';
3
+ /**
4
+ *
5
+ * @category CurveUsd
6
+ */
7
+ export declare class CurveUsdRepayAction extends Action {
8
+ constructor(controllerAddress: EthAddress, collAmount: uint256, to: EthAddress, minAmount: uint256, additionData: bytes);
9
+ }
@@ -0,0 +1,14 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ /**
4
+ *
5
+ * @category CurveUsd
6
+ */
7
+ export class CurveUsdRepayAction extends Action {
8
+ constructor(controllerAddress, collAmount, to, minAmount, additionData) {
9
+ super('CurveUsdRepay', getAddr('CurveUsdRepay'), ['address', 'uint256', 'address', 'uint256', 'bytes'], [controllerAddress, collAmount, to, minAmount, additionData]);
10
+ this.mappableArgs = [
11
+ ...this.args,
12
+ ];
13
+ }
14
+ }
@@ -0,0 +1,19 @@
1
+ import { Action } from '../../Action';
2
+ import { EthAddress, uint256 } from '../../types';
3
+ /**
4
+ *
5
+ * @category CurveUsd
6
+ */
7
+ export declare class CurveUsdSelfLiquidateAction extends Action {
8
+ /**
9
+ @param controllerAddress Address of the curveusd market controller
10
+ @param minCrvUsdExpected Minimum amount of crvUsd as collateral for the user to have
11
+ @param from Address from which to pull crvUSD if needed
12
+ @param to Address that will receive the crvUSD and collateral asset
13
+ */
14
+ constructor(controllerAddress: EthAddress, minCrvUsdExpected: uint256, from: EthAddress, to: EthAddress);
15
+ getAssetsToApprove(): Promise<{
16
+ owner: any;
17
+ asset: string;
18
+ }[]>;
19
+ }
@@ -0,0 +1,38 @@
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 { getAssetInfo } from '@defisaver/tokens';
11
+ import { Action } from '../../Action';
12
+ import { getAddr } from '../../addresses';
13
+ /**
14
+ *
15
+ * @category CurveUsd
16
+ */
17
+ export class CurveUsdSelfLiquidateAction extends Action {
18
+ /**
19
+ @param controllerAddress Address of the curveusd market controller
20
+ @param minCrvUsdExpected Minimum amount of crvUsd as collateral for the user to have
21
+ @param from Address from which to pull crvUSD if needed
22
+ @param to Address that will receive the crvUSD and collateral asset
23
+ */
24
+ constructor(controllerAddress, minCrvUsdExpected, from, to) {
25
+ super('CurveUsdSelfLiquidate', getAddr('CurveUsdSelfLiquidate'), ['address', 'uint256', 'address', 'address'], [controllerAddress, minCrvUsdExpected, from, to]);
26
+ this.mappableArgs = [
27
+ ...this.args,
28
+ ];
29
+ }
30
+ getAssetsToApprove() {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ return [{
33
+ owner: this.args[1],
34
+ asset: getAssetInfo('crvUSD').address,
35
+ }];
36
+ });
37
+ }
38
+ }
@@ -0,0 +1,9 @@
1
+ import { Action } from '../../Action';
2
+ import { EthAddress, uint256, bytes } from '../../types';
3
+ /**
4
+ *
5
+ * @category CurveUsd
6
+ */
7
+ export declare class CurveUsdSelfLiquidateWithCollAction extends Action {
8
+ constructor(controllerAddress: EthAddress, percentage: uint256, minCrvUsdExpected: uint256, swapAmount: uint256, minAmount: uint256, to: EthAddress, additionData: bytes);
9
+ }
@@ -0,0 +1,16 @@
1
+ import { Action } from '../../Action';
2
+ import { requireAddress } from '../../utils/general';
3
+ import { getAddr } from '../../addresses';
4
+ /**
5
+ *
6
+ * @category CurveUsd
7
+ */
8
+ export class CurveUsdSelfLiquidateWithCollAction extends Action {
9
+ constructor(controllerAddress, percentage, minCrvUsdExpected, swapAmount, minAmount, to, additionData) {
10
+ requireAddress(to);
11
+ super('CurveUsdSelfLiquidateWithColl', getAddr('CurveUsdSelfLiquidateWithColl'), ['address', 'uint256', 'uint256', 'uint256', 'uint256', 'address', 'bytes'], [controllerAddress, percentage, minCrvUsdExpected, swapAmount, minAmount, to, additionData]);
12
+ this.mappableArgs = [
13
+ ...this.args,
14
+ ];
15
+ }
16
+ }
@@ -7,11 +7,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { compare } from '@defisaver/tokens/esm/utils';
11
- import { getAssetInfo } from '@defisaver/tokens';
12
10
  import { Action } from '../../Action';
13
11
  import { getAddr } from '../../addresses';
14
- import { curveusdMarkets } from '../../utils/curveusd-utils';
12
+ import { controllerToAssetMap } from '../../utils/curveusd-utils';
15
13
  /**
16
14
  * CurveUsdSupplyAction - Action that supplies collateral to a curveusd position
17
15
  *
@@ -35,7 +33,7 @@ export class CurveUsdSupplyAction extends Action {
35
33
  return __awaiter(this, void 0, void 0, function* () {
36
34
  return [{
37
35
  owner: this.args[1],
38
- asset: getAssetInfo(Object.entries(curveusdMarkets).filter(([, { controllerAddress }]) => compare(controllerAddress, this.args[0]))[0][0]).address,
36
+ asset: controllerToAssetMap[this.args[0]],
39
37
  }];
40
38
  });
41
39
  }
@@ -14,7 +14,7 @@ export class CurveUsdWithdrawAction extends Action {
14
14
  /// @dev collateralAmount must be non-zero
15
15
  /// @dev if collateralAmount == uintMax will withdraw as much as the debt will allow
16
16
  constructor(controllerAddress, to, collateralAmount) {
17
- super('CurveUsdSupply', getAddr('CurveUsdSupply'), ['address', 'address', 'uint256'], [controllerAddress, to, collateralAmount]);
17
+ super('CurveUsdWithdraw', getAddr('CurveUsdWithdraw'), ['address', 'address', 'uint256'], [controllerAddress, to, collateralAmount]);
18
18
  this.mappableArgs = [
19
19
  ...this.args,
20
20
  ];
@@ -3,3 +3,7 @@ export * from './CurveUsdSupplyAction';
3
3
  export * from './CurveUsdWithdrawAction';
4
4
  export * from './CurveUsdBorrowAction';
5
5
  export * from './CurveUsdPaybackAction';
6
+ export * from './CurveUsdRepayAction';
7
+ export * from './CurveUsdSelfLiquidateAction';
8
+ export * from './CurveUsdLevCreateAction';
9
+ export * from './CurveUsdSelfLiquidateWithCollAction';
@@ -3,3 +3,7 @@ export * from './CurveUsdSupplyAction';
3
3
  export * from './CurveUsdWithdrawAction';
4
4
  export * from './CurveUsdBorrowAction';
5
5
  export * from './CurveUsdPaybackAction';
6
+ export * from './CurveUsdRepayAction';
7
+ export * from './CurveUsdSelfLiquidateAction';
8
+ export * from './CurveUsdLevCreateAction';
9
+ export * from './CurveUsdSelfLiquidateWithCollAction';
@@ -41,7 +41,7 @@ _FLAction_instances = new WeakSet(), _FLAction_handleArgs = function _FLAction_h
41
41
  if (specificFLAction.constructor.name === 'MakerFlashLoanAction') {
42
42
  argsToReturn[5] = [4];
43
43
  }
44
- if (specificFLAction.constructor.name === 'AaveV3FlashLoanNoFeeAction') {
44
+ if (specificFLAction.constructor.name === 'AaveV3FlashLoanAction') {
45
45
  argsToReturn[5] = [5];
46
46
  }
47
47
  return argsToReturn;
@@ -0,0 +1,18 @@
1
+ import { Action } from '../../../Action';
2
+ import { EthAddress, uint256 } from '../../../types';
3
+ /**
4
+ * MorphoAaveV3BorrowAction - Borrow token from Morpho AaveV3
5
+ *
6
+ * @category Morpho
7
+ */
8
+ export declare class MorphoAaveV3BorrowAction extends Action {
9
+ /**
10
+ * @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
11
+ * @param tokenAddr - Address of tokenAddr (underlying)
12
+ * @param amount - Token amount
13
+ * @param to - The address we are sending the borrowed tokens to
14
+ * @param onBehalf - For what user we are borrowing the tokens, defaults to proxy
15
+ * @param maxIterations - Max number of iterations for p2p matching, 0 will use default num of iterations
16
+ */
17
+ constructor(emodeId: uint256, tokenAddr: EthAddress, amount: uint256, to: EthAddress, onBehalf?: EthAddress, maxIterations?: uint256);
18
+ }
@@ -0,0 +1,27 @@
1
+ import { Action } from '../../../Action';
2
+ import { getAddr } from '../../../addresses';
3
+ /**
4
+ * MorphoAaveV3BorrowAction - Borrow token from Morpho AaveV3
5
+ *
6
+ * @category Morpho
7
+ */
8
+ export class MorphoAaveV3BorrowAction extends Action {
9
+ /**
10
+ * @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
11
+ * @param tokenAddr - Address of tokenAddr (underlying)
12
+ * @param amount - Token amount
13
+ * @param to - The address we are sending the borrowed tokens to
14
+ * @param onBehalf - For what user we are borrowing the tokens, defaults to proxy
15
+ * @param maxIterations - Max number of iterations for p2p matching, 0 will use default num of iterations
16
+ */
17
+ constructor(emodeId, tokenAddr, amount, to, onBehalf = getAddr('Empty'), maxIterations = '4') {
18
+ super('MorphoAaveV3Borrow', getAddr('MorphoAaveV3Borrow'), ['uint256', 'address', 'uint256', 'address', 'address', 'uint256'], [emodeId, tokenAddr, amount, to, onBehalf, maxIterations]);
19
+ this.mappableArgs = [
20
+ this.args[0],
21
+ this.args[1],
22
+ this.args[2],
23
+ this.args[3],
24
+ this.args[4],
25
+ ];
26
+ }
27
+ }
@@ -0,0 +1,21 @@
1
+ import { Action } from '../../../Action';
2
+ import { EthAddress, uint256 } from '../../../types';
3
+ /**
4
+ * MorphoAaveV3PaybackAction - Payback token to Morpho AaveV3
5
+ *
6
+ * @category Morpho
7
+ */
8
+ export declare class MorphoAaveV3PaybackAction extends Action {
9
+ /**
10
+ * @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
11
+ * @param tokenAddr - Address of tokenAddr (underlying)
12
+ * @param amount - Token amount
13
+ * @param from - Tokens will be sent from this address
14
+ * @param onBehalf - For what user we are paying back the debt, defaults to proxy
15
+ */
16
+ constructor(emodeId: uint256, tokenAddr: EthAddress, amount: uint256, from: EthAddress, onBehalf?: EthAddress);
17
+ getAssetsToApprove(): Promise<{
18
+ asset: any;
19
+ owner: any;
20
+ }[]>;
21
+ }
@@ -0,0 +1,44 @@
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 { Action } from '../../../Action';
12
+ import { getAddr } from '../../../addresses';
13
+ /**
14
+ * MorphoAaveV3PaybackAction - Payback token to Morpho AaveV3
15
+ *
16
+ * @category Morpho
17
+ */
18
+ export class MorphoAaveV3PaybackAction extends Action {
19
+ /**
20
+ * @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
21
+ * @param tokenAddr - Address of tokenAddr (underlying)
22
+ * @param amount - Token amount
23
+ * @param from - Tokens will be sent from this address
24
+ * @param onBehalf - For what user we are paying back the debt, defaults to proxy
25
+ */
26
+ constructor(emodeId, tokenAddr, amount, from, onBehalf = getAddr('Empty')) {
27
+ super('MorphoAaveV3Payback', getAddr('MorphoAaveV3Payback'), ['uint256', 'address', 'uint256', 'address', 'address'], [emodeId, tokenAddr, amount, from, onBehalf]);
28
+ this.mappableArgs = [
29
+ this.args[0],
30
+ this.args[1],
31
+ this.args[2],
32
+ this.args[3],
33
+ this.args[4],
34
+ ];
35
+ }
36
+ getAssetsToApprove() {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ const asset = getAssetInfoByAddress(this.args[1]);
39
+ if (asset.symbol !== 'ETH')
40
+ return [{ asset: this.args[1], owner: this.args[3] }];
41
+ return [];
42
+ });
43
+ }
44
+ }
@@ -0,0 +1,23 @@
1
+ import { Action } from '../../../Action';
2
+ import { EthAddress, uint256 } from '../../../types';
3
+ /**
4
+ * MorphoAaveV3SupplyAction - Supply token to morpho aaveV3
5
+ *
6
+ * @category Morpho
7
+ */
8
+ export declare class MorphoAaveV3SupplyAction extends Action {
9
+ /**
10
+ * @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
11
+ * @param tokenAddr - Address of tokenAddr (underlying)
12
+ * @param amount - Token amount
13
+ * @param from - Tokens will be sent from this address
14
+ * @param onBehalf - For what user we are paying back the debt, defaults to proxy
15
+ * @param supplyAsColl Whether to supplyAsCollateral or regular supply
16
+ * @param maxIterations Max number of iterations for p2p matching, 0 will use default num of iterations
17
+ */
18
+ constructor(emodeId: uint256, tokenAddr: EthAddress, amount: uint256, from: EthAddress, onBehalf?: EthAddress, supplyAsColl?: boolean, maxIterations?: uint256);
19
+ getAssetsToApprove(): Promise<{
20
+ asset: any;
21
+ owner: any;
22
+ }[]>;
23
+ }
@@ -0,0 +1,47 @@
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 { Action } from '../../../Action';
12
+ import { getAddr } from '../../../addresses';
13
+ /**
14
+ * MorphoAaveV3SupplyAction - Supply token to morpho aaveV3
15
+ *
16
+ * @category Morpho
17
+ */
18
+ export class MorphoAaveV3SupplyAction extends Action {
19
+ /**
20
+ * @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
21
+ * @param tokenAddr - Address of tokenAddr (underlying)
22
+ * @param amount - Token amount
23
+ * @param from - Tokens will be sent from this address
24
+ * @param onBehalf - For what user we are paying back the debt, defaults to proxy
25
+ * @param supplyAsColl Whether to supplyAsCollateral or regular supply
26
+ * @param maxIterations Max number of iterations for p2p matching, 0 will use default num of iterations
27
+ */
28
+ constructor(emodeId, tokenAddr, amount, from, onBehalf = getAddr('Empty'), supplyAsColl = true, maxIterations = '4') {
29
+ super('MorphoAaveV3Supply', getAddr('MorphoAaveV3Supply'), ['uint256', 'address', 'uint256', 'address', 'address', 'bool', 'uint256'], [emodeId, tokenAddr, amount, from, onBehalf, supplyAsColl, maxIterations]);
30
+ this.mappableArgs = [
31
+ this.args[0],
32
+ this.args[1],
33
+ this.args[2],
34
+ this.args[3],
35
+ this.args[4],
36
+ this.args[5],
37
+ ];
38
+ }
39
+ getAssetsToApprove() {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ const asset = getAssetInfoByAddress(this.args[1]);
42
+ if (asset.symbol !== 'ETH')
43
+ return [{ asset: this.args[1], owner: this.args[3] }];
44
+ return [];
45
+ });
46
+ }
47
+ }
@@ -0,0 +1,19 @@
1
+ import { Action } from '../../../Action';
2
+ import { EthAddress, uint256 } from '../../../types';
3
+ /**
4
+ * MorphoAaveV3WithdrawAction - Withdraw token from Morpho AaveV3
5
+ *
6
+ * @category Morpho
7
+ */
8
+ export declare class MorphoAaveV3WithdrawAction extends Action {
9
+ /**
10
+ * @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
11
+ * @param tokenAddr - Address of tokenAddr (underlying)
12
+ * @param amount - Token amount
13
+ * @param to - Tokens will be sent to this address
14
+ * @param onBehalf - For what user we are withdrawing the tokens, defaults to proxy
15
+ * @param withdrawAsColl - If we want to withdraw from collateral or from pure supply
16
+ * @param maxIterations - Max number of iterations for p2p matching, 0 will use default num of iterations
17
+ */
18
+ constructor(emodeId: uint256, tokenAddr: EthAddress, amount: uint256, to: EthAddress, onBehalf?: EthAddress, withdrawAsColl?: boolean, maxIterations?: uint256);
19
+ }
@@ -0,0 +1,29 @@
1
+ import { Action } from '../../../Action';
2
+ import { getAddr } from '../../../addresses';
3
+ /**
4
+ * MorphoAaveV3WithdrawAction - Withdraw token from Morpho AaveV3
5
+ *
6
+ * @category Morpho
7
+ */
8
+ export class MorphoAaveV3WithdrawAction extends Action {
9
+ /**
10
+ * @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
11
+ * @param tokenAddr - Address of tokenAddr (underlying)
12
+ * @param amount - Token amount
13
+ * @param to - Tokens will be sent to this address
14
+ * @param onBehalf - For what user we are withdrawing the tokens, defaults to proxy
15
+ * @param withdrawAsColl - If we want to withdraw from collateral or from pure supply
16
+ * @param maxIterations - Max number of iterations for p2p matching, 0 will use default num of iterations
17
+ */
18
+ constructor(emodeId, tokenAddr, amount, to, onBehalf = getAddr('Empty'), withdrawAsColl = true, maxIterations = '4') {
19
+ super('MorphoAaveV3Withdraw', getAddr('MorphoAaveV3Withdraw'), ['uint256', 'address', 'uint256', 'address', 'address', 'bool', 'uint256'], [emodeId, tokenAddr, amount, to, onBehalf, withdrawAsColl, maxIterations]);
20
+ this.mappableArgs = [
21
+ this.args[0],
22
+ this.args[1],
23
+ this.args[2],
24
+ this.args[3],
25
+ this.args[4],
26
+ this.args[5],
27
+ ];
28
+ }
29
+ }
@@ -3,3 +3,7 @@ export * from './MorphoAaveV2WithdrawAction';
3
3
  export * from './MorphoAaveV2BorrowAction';
4
4
  export * from './MorphoAaveV2PaybackAction';
5
5
  export * from './MorphoClaimAction';
6
+ export * from './aaveV3/MorphoAaveV3SupplyAction';
7
+ export * from './aaveV3/MorphoAaveV3WithdrawAction';
8
+ export * from './aaveV3/MorphoAaveV3BorrowAction';
9
+ export * from './aaveV3/MorphoAaveV3PaybackAction';
@@ -3,3 +3,7 @@ export * from './MorphoAaveV2WithdrawAction';
3
3
  export * from './MorphoAaveV2BorrowAction';
4
4
  export * from './MorphoAaveV2PaybackAction';
5
5
  export * from './MorphoClaimAction';
6
+ export * from './aaveV3/MorphoAaveV3SupplyAction';
7
+ export * from './aaveV3/MorphoAaveV3WithdrawAction';
8
+ export * from './aaveV3/MorphoAaveV3BorrowAction';
9
+ export * from './aaveV3/MorphoAaveV3PaybackAction';
@@ -54,6 +54,10 @@ export declare const actionAddresses: {
54
54
  MorphoAaveV2Supply: string;
55
55
  MorphoAaveV2Withdraw: string;
56
56
  MorphoClaim: string;
57
+ MorphoAaveV3Borrow: string;
58
+ MorphoAaveV3Payback: string;
59
+ MorphoAaveV3Supply: string;
60
+ MorphoAaveV3Withdraw: string;
57
61
  CompBorrow: string;
58
62
  CompClaim: string;
59
63
  CompPayback: string;
@@ -137,6 +141,12 @@ export declare const actionAddresses: {
137
141
  CompV3Supply: string;
138
142
  CompV3Transfer: string;
139
143
  CompV3Withdraw: string;
144
+ CurveUsdBorrow: string;
145
+ CurveUsdCreate: string;
146
+ CurveUsdPayback: string;
147
+ CurveUsdSupply: string;
148
+ CurveUsdWithdraw: string;
149
+ CurveUsdSelfLiquidate: string;
140
150
  AaveV3RatioTrigger?: undefined;
141
151
  GasFeeTakerL2?: undefined;
142
152
  AaveV3RatioCheck?: undefined;
@@ -206,6 +216,10 @@ export declare const actionAddresses: {
206
216
  MorphoAaveV2Supply?: undefined;
207
217
  MorphoAaveV2Withdraw?: undefined;
208
218
  MorphoClaim?: undefined;
219
+ MorphoAaveV3Borrow?: undefined;
220
+ MorphoAaveV3Payback?: undefined;
221
+ MorphoAaveV3Supply?: undefined;
222
+ MorphoAaveV3Withdraw?: undefined;
209
223
  CompBorrow?: undefined;
210
224
  CompClaim?: undefined;
211
225
  CompPayback?: undefined;
@@ -280,6 +294,12 @@ export declare const actionAddresses: {
280
294
  CompV3Supply?: undefined;
281
295
  CompV3Transfer?: undefined;
282
296
  CompV3Withdraw?: undefined;
297
+ CurveUsdBorrow?: undefined;
298
+ CurveUsdCreate?: undefined;
299
+ CurveUsdPayback?: undefined;
300
+ CurveUsdSupply?: undefined;
301
+ CurveUsdWithdraw?: undefined;
302
+ CurveUsdSelfLiquidate?: undefined;
283
303
  } | {
284
304
  DFSSell: string;
285
305
  WrapEth: string;
@@ -345,6 +365,10 @@ export declare const actionAddresses: {
345
365
  MorphoAaveV2Supply?: undefined;
346
366
  MorphoAaveV2Withdraw?: undefined;
347
367
  MorphoClaim?: undefined;
368
+ MorphoAaveV3Borrow?: undefined;
369
+ MorphoAaveV3Payback?: undefined;
370
+ MorphoAaveV3Supply?: undefined;
371
+ MorphoAaveV3Withdraw?: undefined;
348
372
  CompBorrow?: undefined;
349
373
  CompClaim?: undefined;
350
374
  CompPayback?: undefined;
@@ -419,6 +443,12 @@ export declare const actionAddresses: {
419
443
  CompV3Supply?: undefined;
420
444
  CompV3Transfer?: undefined;
421
445
  CompV3Withdraw?: undefined;
446
+ CurveUsdBorrow?: undefined;
447
+ CurveUsdCreate?: undefined;
448
+ CurveUsdPayback?: undefined;
449
+ CurveUsdSupply?: undefined;
450
+ CurveUsdWithdraw?: undefined;
451
+ CurveUsdSelfLiquidate?: undefined;
422
452
  AaveV3RatioTrigger?: undefined;
423
453
  };
424
454
  };
@@ -62,6 +62,11 @@ export const actionAddresses = {
62
62
  MorphoAaveV2Supply: '0x60ED1Cf5Da785AA4FD4A4fF3f8cFc0682d60E0F3',
63
63
  MorphoAaveV2Withdraw: '0x29a8b5a8889f465c85b778edccf984e44ad70f12',
64
64
  MorphoClaim: '0xa269C841E26EA8Ee1F0350a2E5905F71446998dC',
65
+ // morpho aave v3
66
+ MorphoAaveV3Borrow: '0x487719C57b88477F19423aB0652b3E26b96baA7F',
67
+ MorphoAaveV3Payback: '0x36b8b968c81D97cBfAa642e206b634A6f378d287',
68
+ MorphoAaveV3Supply: '0x51fA8FBc6F0aDEfe2FBA06104FCA39f5beD69291',
69
+ MorphoAaveV3Withdraw: '0xdc3e74C4cD577275296ceFE36A3D082223AfF206',
65
70
  // compound
66
71
  CompBorrow: '0x8495579BF6Ae848f7E59686536F834f1d2CCd79C',
67
72
  CompClaim: '0x81F488cF7A0128A9DB5e7207042cCAB1CB0ac902',
@@ -163,6 +168,13 @@ export const actionAddresses = {
163
168
  CompV3Supply: '0xaF36Eca43bb26468078B8163fe5Bc1fCFc292095',
164
169
  CompV3Transfer: '0xeD7450e9C17146476137b77198DFfB17857906c4',
165
170
  CompV3Withdraw: '0x0b0F21EDE32DE4243D9145a899E97FC2366Aec46',
171
+ // crvUSD
172
+ CurveUsdBorrow: '0x6493Aa22802B97d2a1E0bF0248135258113D7358',
173
+ CurveUsdCreate: '0xE934d90FBACBeb3c13Be90061383b419415d5F9B',
174
+ CurveUsdPayback: '0x667E2Ef4371E3Da4aa3e09Cde18c908B10868C38',
175
+ CurveUsdSupply: '0x08e50Dc1a22282A003Cff9AC6ef1A687acfe18c2',
176
+ CurveUsdWithdraw: '0x5Ed2b787D2f76Ff0Ff5c789c9F48b5a8BaeBf56b',
177
+ CurveUsdSelfLiquidate: '0x47E8235A038BcBD979041E974F02b0A4eAe69fC3',
166
178
  },
167
179
  [NETWORKS.optimism.chainId]: {
168
180
  DFSSell: '0xC6c601fcAa870efd26C624F8c65fbc54cBe533b1',