@defisaver/sdk 1.3.17 → 1.3.18-aave-v4-1-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.
- package/esm/src/Recipe.js +1 -1
- package/esm/src/Strategy.d.ts +1 -0
- package/esm/src/Strategy.js +3 -0
- package/esm/src/actions/aavev4/AaveV4BorrowAction.d.ts +17 -0
- package/esm/src/actions/aavev4/AaveV4BorrowAction.js +26 -0
- package/esm/src/actions/aavev4/AaveV4CollateralSwitchAction.d.ts +16 -0
- package/esm/src/actions/aavev4/AaveV4CollateralSwitchAction.js +24 -0
- package/esm/src/actions/aavev4/AaveV4PaybackAction.d.ts +23 -0
- package/esm/src/actions/aavev4/AaveV4PaybackAction.js +46 -0
- package/esm/src/actions/aavev4/AaveV4RefreshPremiumAction.d.ts +15 -0
- package/esm/src/actions/aavev4/AaveV4RefreshPremiumAction.js +22 -0
- package/esm/src/actions/aavev4/AaveV4StoreRatioAction.d.ts +14 -0
- package/esm/src/actions/aavev4/AaveV4StoreRatioAction.js +20 -0
- package/esm/src/actions/aavev4/AaveV4SupplyAction.d.ts +25 -0
- package/esm/src/actions/aavev4/AaveV4SupplyAction.js +49 -0
- package/esm/src/actions/aavev4/AaveV4WithdrawAction.d.ts +17 -0
- package/esm/src/actions/aavev4/AaveV4WithdrawAction.js +26 -0
- package/esm/src/actions/aavev4/index.d.ts +7 -0
- package/esm/src/actions/aavev4/index.js +7 -0
- package/esm/src/actions/checkers/AaveV4RatioCheckAction.d.ts +16 -0
- package/esm/src/actions/checkers/AaveV4RatioCheckAction.js +24 -0
- package/esm/src/actions/checkers/index.d.ts +1 -0
- package/esm/src/actions/checkers/index.js +1 -0
- package/esm/src/actions/index.d.ts +2 -1
- package/esm/src/actions/index.js +2 -1
- package/esm/src/addresses.d.ts +36 -5
- package/esm/src/addresses.js +7 -4
- package/esm/src/index.d.ts +144 -20
- package/esm/src/triggers/AaveV4QuotePriceRangeTrigger.d.ts +10 -0
- package/esm/src/triggers/AaveV4QuotePriceRangeTrigger.js +12 -0
- package/esm/src/triggers/AaveV4QuotePriceTrigger.d.ts +10 -0
- package/esm/src/triggers/AaveV4QuotePriceTrigger.js +12 -0
- package/esm/src/triggers/AaveV4RatioTrigger.d.ts +10 -0
- package/esm/src/triggers/AaveV4RatioTrigger.js +12 -0
- package/esm/src/triggers/index.d.ts +3 -0
- package/esm/src/triggers/index.js +3 -0
- package/package.json +1 -1
- package/src/Recipe.ts +1 -1
- package/src/Strategy.ts +4 -0
- package/src/actions/aavev4/AaveV4BorrowAction.ts +39 -0
- package/src/actions/aavev4/AaveV4CollateralSwitchAction.ts +36 -0
- package/src/actions/aavev4/AaveV4PaybackAction.ts +51 -0
- package/src/actions/aavev4/AaveV4RefreshPremiumAction.ts +33 -0
- package/src/actions/aavev4/AaveV4StoreRatioAction.ts +30 -0
- package/src/actions/aavev4/AaveV4SupplyAction.ts +55 -0
- package/src/actions/aavev4/AaveV4WithdrawAction.ts +39 -0
- package/src/actions/aavev4/index.ts +7 -0
- package/src/actions/checkers/AaveV4RatioCheckAction.ts +36 -0
- package/src/actions/checkers/index.ts +2 -1
- package/src/actions/index.ts +2 -0
- package/src/addresses.ts +8 -5
- package/src/triggers/AaveV4QuotePriceRangeTrigger.ts +25 -0
- package/src/triggers/AaveV4QuotePriceTrigger.ts +25 -0
- package/src/triggers/AaveV4RatioTrigger.ts +24 -0
- package/src/triggers/index.ts +4 -1
- package/umd/index.js +993 -585
package/esm/src/Recipe.js
CHANGED
|
@@ -119,7 +119,7 @@ export class Recipe {
|
|
|
119
119
|
data.shouldTakeFeeFromPosition,
|
|
120
120
|
];
|
|
121
121
|
return [
|
|
122
|
-
|
|
122
|
+
this.recipeExecutorAddress,
|
|
123
123
|
// @ts-expect-error Interface of AbiCoder is wrong :(
|
|
124
124
|
AbiCoder.encodeFunctionCall(executeTaskAbi, [encodedRecipe, encodedTxSaverData]),
|
|
125
125
|
];
|
package/esm/src/Strategy.d.ts
CHANGED
|
@@ -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[][])[];
|
package/esm/src/Strategy.js
CHANGED
|
@@ -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,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,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,7 @@
|
|
|
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';
|
|
@@ -0,0 +1,7 @@
|
|
|
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';
|
|
@@ -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
|
+
}
|
|
@@ -39,4 +39,5 @@ import * as etherfi from './etherfi';
|
|
|
39
39
|
import * as fluid from './fluid';
|
|
40
40
|
import * as pendle from './pendle';
|
|
41
41
|
import * as umbrella from './umbrella';
|
|
42
|
-
|
|
42
|
+
import * as aaveV4 from './aavev4';
|
|
43
|
+
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, lsv, spark, curveusd, morphoblue, summerfi, llamalend, merkl, eulerV2, sky, liquityV2, stkgho, renzo, etherfi, fluid, pendle, umbrella, aaveV4, };
|
package/esm/src/actions/index.js
CHANGED
|
@@ -39,4 +39,5 @@ import * as etherfi from './etherfi';
|
|
|
39
39
|
import * as fluid from './fluid';
|
|
40
40
|
import * as pendle from './pendle';
|
|
41
41
|
import * as umbrella from './umbrella';
|
|
42
|
-
|
|
42
|
+
import * as aaveV4 from './aavev4';
|
|
43
|
+
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, lsv, spark, curveusd, morphoblue, summerfi, llamalend, merkl, eulerV2, sky, liquityV2, stkgho, renzo, etherfi, fluid, pendle, umbrella, aaveV4, };
|
package/esm/src/addresses.d.ts
CHANGED
|
@@ -277,6 +277,12 @@ export declare const actionAddresses: {
|
|
|
277
277
|
SFApproveTokens: string;
|
|
278
278
|
SummerfiUnsub: string;
|
|
279
279
|
SummerfiUnsubV2: string;
|
|
280
|
+
AaveV4Supply: string;
|
|
281
|
+
AaveV4Withdraw: string;
|
|
282
|
+
AaveV4Borrow: string;
|
|
283
|
+
AaveV4Payback: string;
|
|
284
|
+
AaveV4CollateralSwitch: string;
|
|
285
|
+
AaveV4RefreshPremium: string;
|
|
280
286
|
AaveV3DelegateCredit?: undefined;
|
|
281
287
|
AaveV3RatioTrigger?: undefined;
|
|
282
288
|
GasFeeTakerL2?: undefined;
|
|
@@ -563,6 +569,12 @@ export declare const actionAddresses: {
|
|
|
563
569
|
UmbrellaClaimRewards?: undefined;
|
|
564
570
|
UmbrellaStake?: undefined;
|
|
565
571
|
UmbrellaUnstake?: undefined;
|
|
572
|
+
AaveV4Supply?: undefined;
|
|
573
|
+
AaveV4Withdraw?: undefined;
|
|
574
|
+
AaveV4Borrow?: undefined;
|
|
575
|
+
AaveV4Payback?: undefined;
|
|
576
|
+
AaveV4CollateralSwitch?: undefined;
|
|
577
|
+
AaveV4RefreshPremium?: undefined;
|
|
566
578
|
MorphoBlueView?: undefined;
|
|
567
579
|
} | {
|
|
568
580
|
DFSSell: string;
|
|
@@ -844,6 +856,12 @@ export declare const actionAddresses: {
|
|
|
844
856
|
UmbrellaClaimRewards?: undefined;
|
|
845
857
|
UmbrellaStake?: undefined;
|
|
846
858
|
UmbrellaUnstake?: undefined;
|
|
859
|
+
AaveV4Supply?: undefined;
|
|
860
|
+
AaveV4Withdraw?: undefined;
|
|
861
|
+
AaveV4Borrow?: undefined;
|
|
862
|
+
AaveV4Payback?: undefined;
|
|
863
|
+
AaveV4CollateralSwitch?: undefined;
|
|
864
|
+
AaveV4RefreshPremium?: undefined;
|
|
847
865
|
AaveV3DelegateCredit?: undefined;
|
|
848
866
|
AaveV3RatioTrigger?: undefined;
|
|
849
867
|
} | {
|
|
@@ -1125,6 +1143,12 @@ export declare const actionAddresses: {
|
|
|
1125
1143
|
UmbrellaClaimRewards?: undefined;
|
|
1126
1144
|
UmbrellaStake?: undefined;
|
|
1127
1145
|
UmbrellaUnstake?: undefined;
|
|
1146
|
+
AaveV4Supply?: undefined;
|
|
1147
|
+
AaveV4Withdraw?: undefined;
|
|
1148
|
+
AaveV4Borrow?: undefined;
|
|
1149
|
+
AaveV4Payback?: undefined;
|
|
1150
|
+
AaveV4CollateralSwitch?: undefined;
|
|
1151
|
+
AaveV4RefreshPremium?: undefined;
|
|
1128
1152
|
AaveV3DelegateCredit?: undefined;
|
|
1129
1153
|
AaveV3RatioTrigger?: undefined;
|
|
1130
1154
|
AaveV3RatioCheck?: undefined;
|
|
@@ -1406,6 +1430,12 @@ export declare const actionAddresses: {
|
|
|
1406
1430
|
SFApproveTokens?: undefined;
|
|
1407
1431
|
SummerfiUnsub?: undefined;
|
|
1408
1432
|
SummerfiUnsubV2?: undefined;
|
|
1433
|
+
AaveV4Supply?: undefined;
|
|
1434
|
+
AaveV4Withdraw?: undefined;
|
|
1435
|
+
AaveV4Borrow?: undefined;
|
|
1436
|
+
AaveV4Payback?: undefined;
|
|
1437
|
+
AaveV4CollateralSwitch?: undefined;
|
|
1438
|
+
AaveV4RefreshPremium?: undefined;
|
|
1409
1439
|
AaveV3RatioTrigger?: undefined;
|
|
1410
1440
|
GasFeeTakerL2?: undefined;
|
|
1411
1441
|
AaveV3RatioCheck?: undefined;
|
|
@@ -1688,6 +1718,12 @@ export declare const actionAddresses: {
|
|
|
1688
1718
|
SFApproveTokens?: undefined;
|
|
1689
1719
|
SummerfiUnsub?: undefined;
|
|
1690
1720
|
SummerfiUnsubV2?: undefined;
|
|
1721
|
+
AaveV4Supply?: undefined;
|
|
1722
|
+
AaveV4Withdraw?: undefined;
|
|
1723
|
+
AaveV4Borrow?: undefined;
|
|
1724
|
+
AaveV4Payback?: undefined;
|
|
1725
|
+
AaveV4CollateralSwitch?: undefined;
|
|
1726
|
+
AaveV4RefreshPremium?: undefined;
|
|
1691
1727
|
AaveV3RatioTrigger?: undefined;
|
|
1692
1728
|
GasFeeTakerL2?: undefined;
|
|
1693
1729
|
AaveV3RatioCheck?: undefined;
|
|
@@ -1697,7 +1733,6 @@ export declare const actionAddresses: {
|
|
|
1697
1733
|
export declare const otherAddresses: {
|
|
1698
1734
|
[x: number]: {
|
|
1699
1735
|
RecipeExecutor: string;
|
|
1700
|
-
RecipeExecutorForTxSaver: string;
|
|
1701
1736
|
DFSRegistry: string;
|
|
1702
1737
|
DFSProxyRegistry: string;
|
|
1703
1738
|
ProxyRegistry: string;
|
|
@@ -1720,7 +1755,6 @@ export declare const otherAddresses: {
|
|
|
1720
1755
|
DefisaverLogger?: undefined;
|
|
1721
1756
|
} | {
|
|
1722
1757
|
RecipeExecutor: string;
|
|
1723
|
-
RecipeExecutorForTxSaver: string;
|
|
1724
1758
|
DFSRegistry: string;
|
|
1725
1759
|
ProxyRegistry: string;
|
|
1726
1760
|
SFProxyEntryPoint: string;
|
|
@@ -1743,7 +1777,6 @@ export declare const otherAddresses: {
|
|
|
1743
1777
|
BLUSD?: undefined;
|
|
1744
1778
|
} | {
|
|
1745
1779
|
RecipeExecutor: string;
|
|
1746
|
-
RecipeExecutorForTxSaver: string;
|
|
1747
1780
|
DFSRegistry: string;
|
|
1748
1781
|
ProxyRegistry: string;
|
|
1749
1782
|
SFProxyEntryPoint: string;
|
|
@@ -1771,7 +1804,6 @@ export declare const otherAddresses: {
|
|
|
1771
1804
|
AdminVault: string;
|
|
1772
1805
|
DefisaverLogger: string;
|
|
1773
1806
|
Empty: string;
|
|
1774
|
-
RecipeExecutorForTxSaver?: undefined;
|
|
1775
1807
|
DFSProxyRegistry?: undefined;
|
|
1776
1808
|
ProxyRegistry?: undefined;
|
|
1777
1809
|
SFProxyEntryPoint?: undefined;
|
|
@@ -1793,7 +1825,6 @@ export declare const otherAddresses: {
|
|
|
1793
1825
|
AdminVault: string;
|
|
1794
1826
|
DefisaverLogger: string;
|
|
1795
1827
|
Empty: string;
|
|
1796
|
-
RecipeExecutorForTxSaver?: undefined;
|
|
1797
1828
|
DFSProxyRegistry?: undefined;
|
|
1798
1829
|
ProxyRegistry?: undefined;
|
|
1799
1830
|
SFProxyEntryPoint?: undefined;
|
package/esm/src/addresses.js
CHANGED
|
@@ -318,6 +318,13 @@ export const actionAddresses = {
|
|
|
318
318
|
SFApproveTokens: '0x0aC29D44eeC8e8f3b010c2e8FC960957db0c8298',
|
|
319
319
|
SummerfiUnsub: '0x926405D69b77A514ED974901095AcFf9e5131366',
|
|
320
320
|
SummerfiUnsubV2: '0x5E805eD9B7581a9f1398F75833f9663a459F5E30',
|
|
321
|
+
// AaveV4
|
|
322
|
+
AaveV4Supply: '0x270A0C7eBd1C0a98FdA613782b51419300AB6322',
|
|
323
|
+
AaveV4Withdraw: '0x561013c605A17f5dC5b738C8a3fF9c5F33DbC3d8',
|
|
324
|
+
AaveV4Borrow: '0xC6C627c63389D8bB7913b55CD62fa451703AD1E1',
|
|
325
|
+
AaveV4Payback: '0x6e31Dd331571209043c8CF997f86b4291F648537',
|
|
326
|
+
AaveV4CollateralSwitch: '0x26C39FE05466dBA72A98d095d019dC5e067F6b28',
|
|
327
|
+
AaveV4RefreshPremium: '0xb080DC160415Ffe1a4b80d75b0Be92EE38a0b426',
|
|
321
328
|
},
|
|
322
329
|
[NETWORKS.optimism.chainId]: {
|
|
323
330
|
DFSSell: '0x9f234af5c10c136863a20865ba00b26951ab8269',
|
|
@@ -645,7 +652,6 @@ export const actionAddresses = {
|
|
|
645
652
|
export const otherAddresses = {
|
|
646
653
|
[NETWORKS.ethereum.chainId]: {
|
|
647
654
|
RecipeExecutor: '0xbc3Fc959FeF3F12a41738f406c02198cdeE7481F',
|
|
648
|
-
RecipeExecutorForTxSaver: '0x2ee96cf53ae5fbd5309284704f978d0ca66cb963',
|
|
649
655
|
DFSRegistry: '0x287778F121F134C66212FB16c9b53eC991D32f5b',
|
|
650
656
|
DFSProxyRegistry: '0x29474FdaC7142f9aB7773B8e38264FA15E3805ed',
|
|
651
657
|
ProxyRegistry: '0x4678f0a6958e4D2Bc4F1BAF7Bc52E8F3564f3fE4',
|
|
@@ -666,7 +672,6 @@ export const otherAddresses = {
|
|
|
666
672
|
},
|
|
667
673
|
[NETWORKS.optimism.chainId]: {
|
|
668
674
|
RecipeExecutor: '0xEC891E6b5A93F5f29241De6B234a4e77A5456A1C',
|
|
669
|
-
RecipeExecutorForTxSaver: '0x993A8c81142044E1CB0Cf0c3d84BEa235d842Fb0',
|
|
670
675
|
DFSRegistry: '0xAf707Ee480204Ed6e2640B53cE86F680D28Afcbd',
|
|
671
676
|
ProxyRegistry: '0x283Cc5C26e53D66ed2Ea252D986F094B37E6e895',
|
|
672
677
|
SFProxyEntryPoint: '0x06299D4A07E8C6D7C1aEc14Ab2F46DF05Dd9588E',
|
|
@@ -678,7 +683,6 @@ export const otherAddresses = {
|
|
|
678
683
|
},
|
|
679
684
|
[NETWORKS.arbitrum.chainId]: {
|
|
680
685
|
RecipeExecutor: '0x667609f05DdC5E9Fb939eC376F07953403745cf3',
|
|
681
|
-
RecipeExecutorForTxSaver: '0x7a25174229ea402d8ccd35fc6d55af079c399884',
|
|
682
686
|
DFSRegistry: '0xBF1CaC12DB60819Bfa71A328282ecbc1D40443aA',
|
|
683
687
|
ProxyRegistry: '0x283Cc5C26e53D66ed2Ea252D986F094B37E6e895',
|
|
684
688
|
SFProxyEntryPoint: '0x15D776C062bF292f8F70A81533E49adC7C06Cb69',
|
|
@@ -690,7 +694,6 @@ export const otherAddresses = {
|
|
|
690
694
|
},
|
|
691
695
|
[NETWORKS.base.chainId]: {
|
|
692
696
|
RecipeExecutor: '0xc91305DdE651c899EF8eE1D0C33E7dab1B5ABF0D',
|
|
693
|
-
RecipeExecutorForTxSaver: '0x7a87565b77dd65bbc153fe20e97743842f1a6e0c',
|
|
694
697
|
DFSRegistry: '0x347FB634271F666353F23A3362f3935D96F97476',
|
|
695
698
|
ProxyRegistry: '0x425fA97285965E01Cc5F951B62A51F6CDEA5cc0d',
|
|
696
699
|
SFProxyEntryPoint: '0xab6e5cde983fF98Cdb0F61f5F99cb58D40D0c837',
|