@defisaver/sdk 1.3.18 → 1.3.21-aave-v4-dev

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 (71) hide show
  1. package/esm/src/Strategy.d.ts +1 -0
  2. package/esm/src/Strategy.js +3 -0
  3. package/esm/src/actions/aavev4/AaveV4BorrowAction.d.ts +17 -0
  4. package/esm/src/actions/aavev4/AaveV4BorrowAction.js +26 -0
  5. package/esm/src/actions/aavev4/AaveV4CollateralSwitchAction.d.ts +16 -0
  6. package/esm/src/actions/aavev4/AaveV4CollateralSwitchAction.js +24 -0
  7. package/esm/src/actions/aavev4/AaveV4DelegateBorrowWithSigAction.d.ts +14 -0
  8. package/esm/src/actions/aavev4/AaveV4DelegateBorrowWithSigAction.js +19 -0
  9. package/esm/src/actions/aavev4/AaveV4DelegateSetUsingAsCollateralWithSigAction.d.ts +14 -0
  10. package/esm/src/actions/aavev4/AaveV4DelegateSetUsingAsCollateralWithSigAction.js +19 -0
  11. package/esm/src/actions/aavev4/AaveV4DelegateWithdrawWithSigAction.d.ts +14 -0
  12. package/esm/src/actions/aavev4/AaveV4DelegateWithdrawWithSigAction.js +19 -0
  13. package/esm/src/actions/aavev4/AaveV4PaybackAction.d.ts +23 -0
  14. package/esm/src/actions/aavev4/AaveV4PaybackAction.js +46 -0
  15. package/esm/src/actions/aavev4/AaveV4RefreshPremiumAction.d.ts +15 -0
  16. package/esm/src/actions/aavev4/AaveV4RefreshPremiumAction.js +22 -0
  17. package/esm/src/actions/aavev4/AaveV4SetUserManagersWithSigAction.d.ts +18 -0
  18. package/esm/src/actions/aavev4/AaveV4SetUserManagersWithSigAction.js +20 -0
  19. package/esm/src/actions/aavev4/AaveV4StoreRatioAction.d.ts +14 -0
  20. package/esm/src/actions/aavev4/AaveV4StoreRatioAction.js +20 -0
  21. package/esm/src/actions/aavev4/AaveV4SupplyAction.d.ts +25 -0
  22. package/esm/src/actions/aavev4/AaveV4SupplyAction.js +49 -0
  23. package/esm/src/actions/aavev4/AaveV4WithdrawAction.d.ts +17 -0
  24. package/esm/src/actions/aavev4/AaveV4WithdrawAction.js +26 -0
  25. package/esm/src/actions/aavev4/index.d.ts +11 -0
  26. package/esm/src/actions/aavev4/index.js +11 -0
  27. package/esm/src/actions/checkers/AaveV4RatioCheckAction.d.ts +16 -0
  28. package/esm/src/actions/checkers/AaveV4RatioCheckAction.js +24 -0
  29. package/esm/src/actions/checkers/SparkRatioCheckAction.js +1 -1
  30. package/esm/src/actions/checkers/SparkTargetRatioCheck.d.ts +14 -0
  31. package/esm/src/actions/checkers/SparkTargetRatioCheck.js +20 -0
  32. package/esm/src/actions/checkers/index.d.ts +2 -0
  33. package/esm/src/actions/checkers/index.js +2 -0
  34. package/esm/src/actions/index.d.ts +2 -1
  35. package/esm/src/actions/index.js +2 -1
  36. package/esm/src/addresses.d.ts +60 -0
  37. package/esm/src/addresses.js +11 -0
  38. package/esm/src/index.d.ts +240 -0
  39. package/esm/src/triggers/AaveV4QuotePriceRangeTrigger.d.ts +10 -0
  40. package/esm/src/triggers/AaveV4QuotePriceRangeTrigger.js +12 -0
  41. package/esm/src/triggers/AaveV4QuotePriceTrigger.d.ts +10 -0
  42. package/esm/src/triggers/AaveV4QuotePriceTrigger.js +12 -0
  43. package/esm/src/triggers/AaveV4RatioTrigger.d.ts +10 -0
  44. package/esm/src/triggers/AaveV4RatioTrigger.js +12 -0
  45. package/esm/src/triggers/index.d.ts +3 -0
  46. package/esm/src/triggers/index.js +3 -0
  47. package/package.json +1 -1
  48. package/src/Strategy.ts +4 -0
  49. package/src/actions/aavev4/AaveV4BorrowAction.ts +39 -0
  50. package/src/actions/aavev4/AaveV4CollateralSwitchAction.ts +36 -0
  51. package/src/actions/aavev4/AaveV4DelegateBorrowWithSigAction.ts +29 -0
  52. package/src/actions/aavev4/AaveV4DelegateSetUsingAsCollateralWithSigAction.ts +29 -0
  53. package/src/actions/aavev4/AaveV4DelegateWithdrawWithSigAction.ts +29 -0
  54. package/src/actions/aavev4/AaveV4PaybackAction.ts +51 -0
  55. package/src/actions/aavev4/AaveV4RefreshPremiumAction.ts +33 -0
  56. package/src/actions/aavev4/AaveV4SetUserManagersWithSigAction.ts +34 -0
  57. package/src/actions/aavev4/AaveV4StoreRatioAction.ts +30 -0
  58. package/src/actions/aavev4/AaveV4SupplyAction.ts +55 -0
  59. package/src/actions/aavev4/AaveV4WithdrawAction.ts +39 -0
  60. package/src/actions/aavev4/index.ts +11 -0
  61. package/src/actions/checkers/AaveV4RatioCheckAction.ts +36 -0
  62. package/src/actions/checkers/SparkRatioCheckAction.ts +1 -1
  63. package/src/actions/checkers/SparkTargetRatioCheck.ts +23 -0
  64. package/src/actions/checkers/index.ts +3 -1
  65. package/src/actions/index.ts +2 -0
  66. package/src/addresses.ts +12 -0
  67. package/src/triggers/AaveV4QuotePriceRangeTrigger.ts +25 -0
  68. package/src/triggers/AaveV4QuotePriceTrigger.ts +25 -0
  69. package/src/triggers/AaveV4RatioTrigger.ts +24 -0
  70. package/src/triggers/index.ts +4 -1
  71. package/umd/index.js +1133 -562
@@ -13,6 +13,7 @@ export declare class Strategy {
13
13
  addSubSlot(name: string, type: string): void;
14
14
  addTrigger(newTrigger: Action): void;
15
15
  addAction(newAction: Action): void;
16
+ addActions(newActions: Array<Action>): void;
16
17
  print(): void;
17
18
  getSubSlots(): any;
18
19
  encodeForDsProxyCall(): (string | string[] | number[][])[];
@@ -20,6 +20,9 @@ export class Strategy {
20
20
  addAction(newAction) {
21
21
  this.actions.push(newAction);
22
22
  }
23
+ addActions(newActions) {
24
+ this.actions.push(...newActions);
25
+ }
23
26
  print() {
24
27
  console.log(`Name: ${this.name}`);
25
28
  console.log(`Slots: ${this.subSlots}`);
@@ -0,0 +1,17 @@
1
+ import { Action } from '../../Action';
2
+ import { EthAddress, uint256 } from '../../types';
3
+ /**
4
+ * AaveV4BorrowAction
5
+ *
6
+ * @category AaveV4
7
+ */
8
+ export declare class AaveV4BorrowAction extends Action {
9
+ /**
10
+ * @param spoke Address of the spoke.
11
+ * @param onBehalf Address to borrow tokens on behalf of. Defaults to the user's wallet if not provided.
12
+ * @param to Address that will receive the borrowed tokens.
13
+ * @param reserveId Reserve id.
14
+ * @param amount Amount of tokens to borrow.
15
+ */
16
+ constructor(spoke: EthAddress, onBehalf: EthAddress, to: EthAddress, reserveId: uint256, amount: uint256);
17
+ }
@@ -0,0 +1,26 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ /**
4
+ * AaveV4BorrowAction
5
+ *
6
+ * @category AaveV4
7
+ */
8
+ export class AaveV4BorrowAction extends Action {
9
+ /**
10
+ * @param spoke Address of the spoke.
11
+ * @param onBehalf Address to borrow tokens on behalf of. Defaults to the user's wallet if not provided.
12
+ * @param to Address that will receive the borrowed tokens.
13
+ * @param reserveId Reserve id.
14
+ * @param amount Amount of tokens to borrow.
15
+ */
16
+ constructor(spoke, onBehalf, to, reserveId, amount) {
17
+ super('AaveV4Borrow', getAddr('AaveV4Borrow'), ['address', 'address', 'address', 'uint256', 'uint256'], [spoke, onBehalf, to, reserveId, amount]);
18
+ this.mappableArgs = [
19
+ this.args[0],
20
+ this.args[1],
21
+ this.args[2],
22
+ this.args[3],
23
+ this.args[4],
24
+ ];
25
+ }
26
+ }
@@ -0,0 +1,16 @@
1
+ import { Action } from '../../Action';
2
+ import { EthAddress, uint256 } from '../../types';
3
+ /**
4
+ * AaveV4CollateralSwitchAction
5
+ *
6
+ * @category AaveV4
7
+ */
8
+ export declare class AaveV4CollateralSwitchAction extends Action {
9
+ /**
10
+ * @param spoke Address of the spoke.
11
+ * @param onBehalf Address to switch collateral on behalf of. Defaults to the user's wallet if not provided.
12
+ * @param reserveId Reserve id.
13
+ * @param useAsCollateral Whether to use the tokens as collateral.
14
+ */
15
+ constructor(spoke: EthAddress, onBehalf: EthAddress, reserveId: uint256, useAsCollateral: boolean);
16
+ }
@@ -0,0 +1,24 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ /**
4
+ * AaveV4CollateralSwitchAction
5
+ *
6
+ * @category AaveV4
7
+ */
8
+ export class AaveV4CollateralSwitchAction extends Action {
9
+ /**
10
+ * @param spoke Address of the spoke.
11
+ * @param onBehalf Address to switch collateral on behalf of. Defaults to the user's wallet if not provided.
12
+ * @param reserveId Reserve id.
13
+ * @param useAsCollateral Whether to use the tokens as collateral.
14
+ */
15
+ constructor(spoke, onBehalf, reserveId, useAsCollateral) {
16
+ super('AaveV4CollateralSwitch', getAddr('AaveV4CollateralSwitch'), ['address', 'address', 'uint256', 'bool'], [spoke, onBehalf, reserveId, useAsCollateral]);
17
+ this.mappableArgs = [
18
+ this.args[0],
19
+ this.args[1],
20
+ this.args[2],
21
+ this.args[3],
22
+ ];
23
+ }
24
+ }
@@ -0,0 +1,14 @@
1
+ import { Action } from '../../Action';
2
+ import { bytes } from '../../types';
3
+ /**
4
+ * AaveV4DelegateBorrowWithSigAction -Approves a spender to borrow from the specified reserve using an EIP712-typed intent.
5
+ *
6
+ * @category AaveV4
7
+ */
8
+ export declare class AaveV4DelegateBorrowWithSigAction extends Action {
9
+ /**
10
+ * @param permit EIP712-typed intent.
11
+ * @param signature The EIP712-compliant signature bytes.
12
+ */
13
+ constructor(permit: Array<any>, signature: bytes);
14
+ }
@@ -0,0 +1,19 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ /**
4
+ * AaveV4DelegateBorrowWithSigAction -Approves a spender to borrow from the specified reserve using an EIP712-typed intent.
5
+ *
6
+ * @category AaveV4
7
+ */
8
+ export class AaveV4DelegateBorrowWithSigAction extends Action {
9
+ /**
10
+ * @param permit EIP712-typed intent.
11
+ * @param signature The EIP712-compliant signature bytes.
12
+ */
13
+ constructor(permit, signature) {
14
+ super('AaveV4DelegateBorrowWithSig', getAddr('AaveV4DelegateBorrowWithSig'), [
15
+ ['address', 'uint256', 'address', 'address', 'uint256', 'uint256', 'uint256'],
16
+ 'bytes',
17
+ ], [permit, signature]);
18
+ }
19
+ }
@@ -0,0 +1,14 @@
1
+ import { Action } from '../../Action';
2
+ import { bytes } from '../../types';
3
+ /**
4
+ * AaveV4DelegateSetUsingAsCollateralWithSigAction - Approves a delegatee to set using as collateral on behalf of delegator using an EIP712-typed intent.
5
+ *
6
+ * @category AaveV4
7
+ */
8
+ export declare class AaveV4DelegateSetUsingAsCollateralWithSigAction extends Action {
9
+ /**
10
+ * @param permit EIP712-typed intent.
11
+ * @param signature The EIP712-compliant signature bytes.
12
+ */
13
+ constructor(permit: Array<any>, signature: bytes);
14
+ }
@@ -0,0 +1,19 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ /**
4
+ * AaveV4DelegateSetUsingAsCollateralWithSigAction - Approves a delegatee to set using as collateral on behalf of delegator using an EIP712-typed intent.
5
+ *
6
+ * @category AaveV4
7
+ */
8
+ export class AaveV4DelegateSetUsingAsCollateralWithSigAction extends Action {
9
+ /**
10
+ * @param permit EIP712-typed intent.
11
+ * @param signature The EIP712-compliant signature bytes.
12
+ */
13
+ constructor(permit, signature) {
14
+ super('AaveV4DelegateSetUsingAsCollateralWithSig', getAddr('AaveV4DelegateSetUsingAsCollateralWithSig'), [
15
+ ['address', 'address', 'address', 'bool', 'uint256', 'uint256'],
16
+ 'bytes',
17
+ ], [permit, signature]);
18
+ }
19
+ }
@@ -0,0 +1,14 @@
1
+ import { Action } from '../../Action';
2
+ import { bytes } from '../../types';
3
+ /**
4
+ * AaveV4DelegateWithdrawWithSigAction - Approves a spender to withdraw from the specified reserve using an EIP712-typed intent.
5
+ *
6
+ * @category AaveV4
7
+ */
8
+ export declare class AaveV4DelegateWithdrawWithSigAction extends Action {
9
+ /**
10
+ * @param permit EIP712-typed intent.
11
+ * @param signature The EIP712-compliant signature bytes.
12
+ */
13
+ constructor(permit: Array<any>, signature: bytes);
14
+ }
@@ -0,0 +1,19 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ /**
4
+ * AaveV4DelegateWithdrawWithSigAction - Approves a spender to withdraw from the specified reserve using an EIP712-typed intent.
5
+ *
6
+ * @category AaveV4
7
+ */
8
+ export class AaveV4DelegateWithdrawWithSigAction extends Action {
9
+ /**
10
+ * @param permit EIP712-typed intent.
11
+ * @param signature The EIP712-compliant signature bytes.
12
+ */
13
+ constructor(permit, signature) {
14
+ super('AaveV4DelegateWithdrawWithSig', getAddr('AaveV4DelegateWithdrawWithSig'), [
15
+ ['address', 'uint256', 'address', 'address', 'uint256', 'uint256', 'uint256'],
16
+ 'bytes',
17
+ ], [permit, signature]);
18
+ }
19
+ }
@@ -0,0 +1,23 @@
1
+ import { Action } from '../../Action';
2
+ import { EthAddress, uint256 } from '../../types';
3
+ /**
4
+ * AaveV4PaybackAction
5
+ *
6
+ * @category AaveV4
7
+ */
8
+ export declare class AaveV4PaybackAction extends Action {
9
+ tokenForApproval: EthAddress;
10
+ /**
11
+ * @param spoke Address of the spoke.
12
+ * @param onBehalf Address to payback tokens on behalf of. Defaults to the user's wallet if not provided.
13
+ * @param from Address from which to pull the payback tokens.
14
+ * @param reserveId Reserve id.
15
+ * @param amount Amount of tokens to payback. Send type(uint).max to payback whole amount.
16
+ * @param tokenAddress Address of the token to approve. Optional, as it is only used for token approval, not part of encoding.
17
+ */
18
+ constructor(spoke: EthAddress, onBehalf: EthAddress, from: EthAddress, reserveId: uint256, amount: uint256, tokenAddress?: EthAddress);
19
+ getAssetsToApprove(): Promise<{
20
+ asset: string;
21
+ owner: any;
22
+ }[]>;
23
+ }
@@ -0,0 +1,46 @@
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
+ * AaveV4PaybackAction
15
+ *
16
+ * @category AaveV4
17
+ */
18
+ export class AaveV4PaybackAction extends Action {
19
+ /**
20
+ * @param spoke Address of the spoke.
21
+ * @param onBehalf Address to payback tokens on behalf of. Defaults to the user's wallet if not provided.
22
+ * @param from Address from which to pull the payback tokens.
23
+ * @param reserveId Reserve id.
24
+ * @param amount Amount of tokens to payback. Send type(uint).max to payback whole amount.
25
+ * @param tokenAddress Address of the token to approve. Optional, as it is only used for token approval, not part of encoding.
26
+ */
27
+ constructor(spoke, onBehalf, from, reserveId, amount, tokenAddress = getAddr('Empty')) {
28
+ super('AaveV4Payback', getAddr('AaveV4Payback'), ['address', 'address', 'address', 'uint256', 'uint256'], [spoke, onBehalf, from, reserveId, amount]);
29
+ this.mappableArgs = [
30
+ this.args[0],
31
+ this.args[1],
32
+ this.args[2],
33
+ this.args[3],
34
+ this.args[4],
35
+ ];
36
+ this.tokenForApproval = tokenAddress;
37
+ }
38
+ getAssetsToApprove() {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ const asset = getAssetInfoByAddress(this.tokenForApproval);
41
+ if (asset.symbol !== 'ETH')
42
+ return [{ asset: this.tokenForApproval, owner: this.args[2] }];
43
+ return [];
44
+ });
45
+ }
46
+ }
@@ -0,0 +1,15 @@
1
+ import { Action } from '../../Action';
2
+ import { EthAddress } from '../../types';
3
+ /**
4
+ * AaveV4RefreshPremiumAction - Refresh the risk premium for user's position
5
+ *
6
+ * @category AaveV4RefreshPremium
7
+ */
8
+ export declare class AaveV4RefreshPremiumAction extends Action {
9
+ /**
10
+ * @param spoke Address of the spoke.
11
+ * @param onBehalf Address to refresh the config on behalf of. Defaults to the user's wallet if not provided.
12
+ * @param refreshDynamicReserveConfig Whether to also refresh the dynamic reserve config for all collateral reserves.
13
+ */
14
+ constructor(spoke: EthAddress, onBehalf: EthAddress, refreshDynamicReserveConfig: boolean);
15
+ }
@@ -0,0 +1,22 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ /**
4
+ * AaveV4RefreshPremiumAction - Refresh the risk premium for user's position
5
+ *
6
+ * @category AaveV4RefreshPremium
7
+ */
8
+ export class AaveV4RefreshPremiumAction extends Action {
9
+ /**
10
+ * @param spoke Address of the spoke.
11
+ * @param onBehalf Address to refresh the config on behalf of. Defaults to the user's wallet if not provided.
12
+ * @param refreshDynamicReserveConfig Whether to also refresh the dynamic reserve config for all collateral reserves.
13
+ */
14
+ constructor(spoke, onBehalf, refreshDynamicReserveConfig) {
15
+ super('AaveV4RefreshPremium', getAddr('AaveV4RefreshPremium'), ['address', 'address', 'bool'], [spoke, onBehalf, refreshDynamicReserveConfig]);
16
+ this.mappableArgs = [
17
+ this.args[0],
18
+ this.args[1],
19
+ this.args[2],
20
+ ];
21
+ }
22
+ }
@@ -0,0 +1,18 @@
1
+ import { Action } from '../../Action';
2
+ import { EthAddress, bytes, uint256 } from '../../types';
3
+ /**
4
+ * AaveV4SetUserManagersWithSigAction - Sets user position managers with EIP712-typed signature.
5
+ *
6
+ * @category AaveV4
7
+ */
8
+ export declare class AaveV4SetUserManagersWithSigAction extends Action {
9
+ /**
10
+ * @param spoke Address of the spoke.
11
+ * @param onBehalf The address of the user on whose behalf position manager can act.
12
+ * @param nonce The nonce for the signature.
13
+ * @param deadline The deadline for the signature.
14
+ * @param signature The signature bytes.
15
+ * @param updates The array of position manager updates.
16
+ */
17
+ constructor(spoke: EthAddress, onBehalf: EthAddress, nonce: uint256, deadline: uint256, signature: bytes, updates: Array<[EthAddress, boolean]>);
18
+ }
@@ -0,0 +1,20 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ /**
4
+ * AaveV4SetUserManagersWithSigAction - Sets user position managers with EIP712-typed signature.
5
+ *
6
+ * @category AaveV4
7
+ */
8
+ export class AaveV4SetUserManagersWithSigAction extends Action {
9
+ /**
10
+ * @param spoke Address of the spoke.
11
+ * @param onBehalf The address of the user on whose behalf position manager can act.
12
+ * @param nonce The nonce for the signature.
13
+ * @param deadline The deadline for the signature.
14
+ * @param signature The signature bytes.
15
+ * @param updates The array of position manager updates.
16
+ */
17
+ constructor(spoke, onBehalf, nonce, deadline, signature, updates) {
18
+ super('AaveV4SetUserManagersWithSig', getAddr('AaveV4SetUserManagersWithSig'), ['address', 'address', 'uint256', 'uint256', 'bytes', 'tuple(address,bool)[]'], [spoke, onBehalf, nonce, deadline, signature, updates]);
19
+ }
20
+ }
@@ -0,0 +1,14 @@
1
+ import { Action } from '../../Action';
2
+ import { EthAddress } from '../../types';
3
+ /**
4
+ * AaveV4StoreRatioAction - Stores the ratio for a user in transient storage so it can be checked later after strategy execution.
5
+ *
6
+ * @category AaveV4
7
+ */
8
+ export declare class AaveV4StoreRatioAction extends Action {
9
+ /**
10
+ * @param spoke Address of the spoke.
11
+ * @param user Address of the user to store the ratio for.
12
+ */
13
+ constructor(spoke: EthAddress, user: EthAddress);
14
+ }
@@ -0,0 +1,20 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ /**
4
+ * AaveV4StoreRatioAction - Stores the ratio for a user in transient storage so it can be checked later after strategy execution.
5
+ *
6
+ * @category AaveV4
7
+ */
8
+ export class AaveV4StoreRatioAction extends Action {
9
+ /**
10
+ * @param spoke Address of the spoke.
11
+ * @param user Address of the user to store the ratio for.
12
+ */
13
+ constructor(spoke, user) {
14
+ super('AaveV4StoreRatio', getAddr('Empty'), ['address', 'address'], [spoke, user]);
15
+ this.mappableArgs = [
16
+ this.args[0],
17
+ this.args[1],
18
+ ];
19
+ }
20
+ }
@@ -0,0 +1,25 @@
1
+ import { Action } from '../../Action';
2
+ import { EthAddress, uint256 } from '../../types';
3
+ /**
4
+ * AaveV4SupplyAction
5
+ *
6
+ * @category AaveV4
7
+ */
8
+ export declare class AaveV4SupplyAction extends Action {
9
+ tokenForApproval: EthAddress;
10
+ /**
11
+ * @param spoke Address of the spoke.
12
+ * @param onBehalf Address to supply tokens on behalf of. Defaults to the user's wallet if not provided.
13
+ * @param from Address from which to pull collateral asset.
14
+ * @param reserveId Reserve id.
15
+ * @param amount Amount of tokens to supply.
16
+ * @param useAsCollateral Whether to use the tokens as collateral.
17
+ * @param tokenAddress Address of the token to approve. Optional, as it is only used for token approval, not part of encoding.
18
+ *
19
+ */
20
+ constructor(spoke: EthAddress, onBehalf: EthAddress, from: EthAddress, reserveId: uint256, amount: uint256, useAsCollateral: boolean, tokenAddress?: EthAddress);
21
+ getAssetsToApprove(): Promise<{
22
+ asset: string;
23
+ owner: any;
24
+ }[]>;
25
+ }
@@ -0,0 +1,49 @@
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
+ * AaveV4SupplyAction
15
+ *
16
+ * @category AaveV4
17
+ */
18
+ export class AaveV4SupplyAction extends Action {
19
+ /**
20
+ * @param spoke Address of the spoke.
21
+ * @param onBehalf Address to supply tokens on behalf of. Defaults to the user's wallet if not provided.
22
+ * @param from Address from which to pull collateral asset.
23
+ * @param reserveId Reserve id.
24
+ * @param amount Amount of tokens to supply.
25
+ * @param useAsCollateral Whether to use the tokens as collateral.
26
+ * @param tokenAddress Address of the token to approve. Optional, as it is only used for token approval, not part of encoding.
27
+ *
28
+ */
29
+ constructor(spoke, onBehalf, from, reserveId, amount, useAsCollateral, tokenAddress = getAddr('Empty')) {
30
+ super('AaveV4Supply', getAddr('AaveV4Supply'), ['address', 'address', 'address', 'uint256', 'uint256', 'bool'], [spoke, onBehalf, from, reserveId, amount, useAsCollateral]);
31
+ this.mappableArgs = [
32
+ this.args[0],
33
+ this.args[1],
34
+ this.args[2],
35
+ this.args[3],
36
+ this.args[4],
37
+ this.args[5],
38
+ ];
39
+ this.tokenForApproval = tokenAddress;
40
+ }
41
+ getAssetsToApprove() {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ const asset = getAssetInfoByAddress(this.tokenForApproval);
44
+ if (asset.symbol !== 'ETH')
45
+ return [{ asset: this.tokenForApproval, owner: this.args[2] }];
46
+ return [];
47
+ });
48
+ }
49
+ }
@@ -0,0 +1,17 @@
1
+ import { Action } from '../../Action';
2
+ import { EthAddress, uint256 } from '../../types';
3
+ /**
4
+ * AaveV4WithdrawAction
5
+ *
6
+ * @category AaveV4
7
+ */
8
+ export declare class AaveV4WithdrawAction extends Action {
9
+ /**
10
+ * @param spoke Address of the spoke.
11
+ * @param onBehalf Address to withdraw tokens on behalf of. Defaults to the user's wallet if not provided.
12
+ * @param to Address that will receive the withdrawn tokens.
13
+ * @param reserveId Reserve id.
14
+ * @param amount Amount of tokens to withdraw. Send type(uint).max to withdraw whole amount.
15
+ */
16
+ constructor(spoke: EthAddress, onBehalf: EthAddress, to: EthAddress, reserveId: uint256, amount: uint256);
17
+ }
@@ -0,0 +1,26 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ /**
4
+ * AaveV4WithdrawAction
5
+ *
6
+ * @category AaveV4
7
+ */
8
+ export class AaveV4WithdrawAction extends Action {
9
+ /**
10
+ * @param spoke Address of the spoke.
11
+ * @param onBehalf Address to withdraw tokens on behalf of. Defaults to the user's wallet if not provided.
12
+ * @param to Address that will receive the withdrawn tokens.
13
+ * @param reserveId Reserve id.
14
+ * @param amount Amount of tokens to withdraw. Send type(uint).max to withdraw whole amount.
15
+ */
16
+ constructor(spoke, onBehalf, to, reserveId, amount) {
17
+ super('AaveV4Withdraw', getAddr('AaveV4Withdraw'), ['address', 'address', 'address', 'uint256', 'uint256'], [spoke, onBehalf, to, reserveId, amount]);
18
+ this.mappableArgs = [
19
+ this.args[0],
20
+ this.args[1],
21
+ this.args[2],
22
+ this.args[3],
23
+ this.args[4],
24
+ ];
25
+ }
26
+ }
@@ -0,0 +1,11 @@
1
+ export * from './AaveV4SupplyAction';
2
+ export * from './AaveV4WithdrawAction';
3
+ export * from './AaveV4BorrowAction';
4
+ export * from './AaveV4PaybackAction';
5
+ export * from './AaveV4CollateralSwitchAction';
6
+ export * from './AaveV4StoreRatioAction';
7
+ export * from './AaveV4RefreshPremiumAction';
8
+ export * from './AaveV4DelegateBorrowWithSigAction';
9
+ export * from './AaveV4DelegateWithdrawWithSigAction';
10
+ export * from './AaveV4SetUserManagersWithSigAction';
11
+ export * from './AaveV4DelegateSetUsingAsCollateralWithSigAction';
@@ -0,0 +1,11 @@
1
+ export * from './AaveV4SupplyAction';
2
+ export * from './AaveV4WithdrawAction';
3
+ export * from './AaveV4BorrowAction';
4
+ export * from './AaveV4PaybackAction';
5
+ export * from './AaveV4CollateralSwitchAction';
6
+ export * from './AaveV4StoreRatioAction';
7
+ export * from './AaveV4RefreshPremiumAction';
8
+ export * from './AaveV4DelegateBorrowWithSigAction';
9
+ export * from './AaveV4DelegateWithdrawWithSigAction';
10
+ export * from './AaveV4SetUserManagersWithSigAction';
11
+ export * from './AaveV4DelegateSetUsingAsCollateralWithSigAction';
@@ -0,0 +1,16 @@
1
+ import { Action } from '../../Action';
2
+ import { EthAddress, uint256, uint8 } from '../../types';
3
+ /**
4
+ * AaveV4RatioCheckAction - Checks aave V4 ratio for user position
5
+ *
6
+ * @category AaveV4RatioCheck
7
+ */
8
+ export declare class AaveV4RatioCheckAction extends Action {
9
+ /**
10
+ * @param ratioState State of the ratio (IN_BOOST or IN_REPAY)
11
+ * @param targetRatio Target ratio.
12
+ * @param spoke Aave V4 spoke address.
13
+ * @param user User address.
14
+ */
15
+ constructor(ratioState: uint8, targetRatio: uint256, spoke: EthAddress, user: EthAddress);
16
+ }
@@ -0,0 +1,24 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ /**
4
+ * AaveV4RatioCheckAction - Checks aave V4 ratio for user position
5
+ *
6
+ * @category AaveV4RatioCheck
7
+ */
8
+ export class AaveV4RatioCheckAction extends Action {
9
+ /**
10
+ * @param ratioState State of the ratio (IN_BOOST or IN_REPAY)
11
+ * @param targetRatio Target ratio.
12
+ * @param spoke Aave V4 spoke address.
13
+ * @param user User address.
14
+ */
15
+ constructor(ratioState, targetRatio, spoke, user) {
16
+ super('AaveV4RatioCheck', getAddr('Empty'), ['uint8', 'uint256', 'address', 'address'], [ratioState, targetRatio, spoke, user]);
17
+ this.mappableArgs = [
18
+ this.args[0],
19
+ this.args[1],
20
+ this.args[2],
21
+ this.args[3],
22
+ ];
23
+ }
24
+ }
@@ -11,7 +11,7 @@ export class SparkRatioCheckAction extends Action {
11
11
  * @param targetRatio The ratio user want to be at
12
12
  */
13
13
  constructor(ratioState, targetRatio) {
14
- super('SparkRatioCheck', getAddr('SparkRatioCheck'), ['uint8', 'uint256'], [ratioState, targetRatio]);
14
+ super('SparkRatioCheck', getAddr('Empty'), ['uint8', 'uint256'], [ratioState, targetRatio]);
15
15
  this.mappableArgs = [
16
16
  this.args[0],
17
17
  this.args[1],
@@ -0,0 +1,14 @@
1
+ import { Action } from '../../Action';
2
+ import { EthAddress, uint256 } from '../../types';
3
+ /**
4
+ * SparkTargetRatioCheck - SparkRatioCheckAction - Checks spark ratio for users proxy position and reverts if faulty
5
+ *
6
+ * @category Checkers
7
+ */
8
+ export declare class SparkTargetRatioCheck extends Action {
9
+ /**
10
+ * @param targetRatio The ratio user want to be at
11
+ * @param market Address of the market
12
+ */
13
+ constructor(targetRatio: uint256, market: EthAddress);
14
+ }
@@ -0,0 +1,20 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ /**
4
+ * SparkTargetRatioCheck - SparkRatioCheckAction - Checks spark ratio for users proxy position and reverts if faulty
5
+ *
6
+ * @category Checkers
7
+ */
8
+ export class SparkTargetRatioCheck extends Action {
9
+ /**
10
+ * @param targetRatio The ratio user want to be at
11
+ * @param market Address of the market
12
+ */
13
+ constructor(targetRatio, market) {
14
+ super('SparkTargetRatioCheck', getAddr('Empty'), ['uint256', 'address'], [targetRatio, market]);
15
+ this.mappableArgs = [
16
+ this.args[0],
17
+ this.args[1],
18
+ ];
19
+ }
20
+ }
@@ -15,3 +15,5 @@ export * from './LiquityV2RatioCheckAction';
15
15
  export * from './LiquityV2TargetRatioCheckAction';
16
16
  export * from './LiquityV2NewInterestRateCheckerAction';
17
17
  export * from './FluidRatioCheckAction';
18
+ export * from './SparkTargetRatioCheck';
19
+ export * from './AaveV4RatioCheckAction';