@defisaver/sdk 1.3.21 → 1.3.22
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/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/AaveV4DelegateBorrowWithSigAction.d.ts +14 -0
- package/esm/src/actions/aavev4/AaveV4DelegateBorrowWithSigAction.js +19 -0
- package/esm/src/actions/aavev4/AaveV4DelegateSetUsingAsCollateralWithSigAction.d.ts +14 -0
- package/esm/src/actions/aavev4/AaveV4DelegateSetUsingAsCollateralWithSigAction.js +19 -0
- package/esm/src/actions/aavev4/AaveV4DelegateWithdrawWithSigAction.d.ts +14 -0
- package/esm/src/actions/aavev4/AaveV4DelegateWithdrawWithSigAction.js +19 -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/AaveV4SetUserManagersWithSigAction.d.ts +18 -0
- package/esm/src/actions/aavev4/AaveV4SetUserManagersWithSigAction.js +20 -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 +11 -0
- package/esm/src/actions/aavev4/index.js +11 -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 +60 -0
- package/esm/src/addresses.js +11 -0
- package/esm/src/index.d.ts +240 -0
- 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/Strategy.ts +4 -0
- package/src/actions/aavev4/AaveV4BorrowAction.ts +39 -0
- package/src/actions/aavev4/AaveV4CollateralSwitchAction.ts +36 -0
- package/src/actions/aavev4/AaveV4DelegateBorrowWithSigAction.ts +29 -0
- package/src/actions/aavev4/AaveV4DelegateSetUsingAsCollateralWithSigAction.ts +29 -0
- package/src/actions/aavev4/AaveV4DelegateWithdrawWithSigAction.ts +29 -0
- package/src/actions/aavev4/AaveV4PaybackAction.ts +51 -0
- package/src/actions/aavev4/AaveV4RefreshPremiumAction.ts +33 -0
- package/src/actions/aavev4/AaveV4SetUserManagersWithSigAction.ts +34 -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 +11 -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 +12 -0
- 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 +1121 -581
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, uint256 } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* AaveV4CollateralSwitchAction
|
|
7
|
+
*
|
|
8
|
+
* @category AaveV4
|
|
9
|
+
*/
|
|
10
|
+
export class AaveV4CollateralSwitchAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param spoke Address of the spoke.
|
|
13
|
+
* @param onBehalf Address to switch collateral on behalf of. Defaults to the user's wallet if not provided.
|
|
14
|
+
* @param reserveId Reserve id.
|
|
15
|
+
* @param useAsCollateral Whether to use the tokens as collateral.
|
|
16
|
+
*/
|
|
17
|
+
constructor(
|
|
18
|
+
spoke: EthAddress,
|
|
19
|
+
onBehalf: EthAddress,
|
|
20
|
+
reserveId: uint256,
|
|
21
|
+
useAsCollateral: boolean,
|
|
22
|
+
) {
|
|
23
|
+
super(
|
|
24
|
+
'AaveV4CollateralSwitch',
|
|
25
|
+
getAddr('AaveV4CollateralSwitch'),
|
|
26
|
+
['address', 'address', 'uint256', 'bool'],
|
|
27
|
+
[spoke, onBehalf, reserveId, useAsCollateral],
|
|
28
|
+
);
|
|
29
|
+
this.mappableArgs = [
|
|
30
|
+
this.args[0],
|
|
31
|
+
this.args[1],
|
|
32
|
+
this.args[2],
|
|
33
|
+
this.args[3],
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { bytes } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* AaveV4DelegateBorrowWithSigAction -Approves a spender to borrow from the specified reserve using an EIP712-typed intent.
|
|
7
|
+
*
|
|
8
|
+
* @category AaveV4
|
|
9
|
+
*/
|
|
10
|
+
export class AaveV4DelegateBorrowWithSigAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param permit EIP712-typed intent.
|
|
13
|
+
* @param signature The EIP712-compliant signature bytes.
|
|
14
|
+
*/
|
|
15
|
+
constructor(
|
|
16
|
+
permit: Array<any>,
|
|
17
|
+
signature: bytes,
|
|
18
|
+
) {
|
|
19
|
+
super(
|
|
20
|
+
'AaveV4DelegateBorrowWithSig',
|
|
21
|
+
getAddr('AaveV4DelegateBorrowWithSig'),
|
|
22
|
+
[
|
|
23
|
+
['address', 'uint256', 'address', 'address', 'uint256', 'uint256', 'uint256'],
|
|
24
|
+
'bytes',
|
|
25
|
+
],
|
|
26
|
+
[permit, signature],
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { bytes } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* AaveV4DelegateSetUsingAsCollateralWithSigAction - Approves a delegatee to set using as collateral on behalf of delegator using an EIP712-typed intent.
|
|
7
|
+
*
|
|
8
|
+
* @category AaveV4
|
|
9
|
+
*/
|
|
10
|
+
export class AaveV4DelegateSetUsingAsCollateralWithSigAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param permit EIP712-typed intent.
|
|
13
|
+
* @param signature The EIP712-compliant signature bytes.
|
|
14
|
+
*/
|
|
15
|
+
constructor(
|
|
16
|
+
permit: Array<any>,
|
|
17
|
+
signature: bytes,
|
|
18
|
+
) {
|
|
19
|
+
super(
|
|
20
|
+
'AaveV4DelegateSetUsingAsCollateralWithSig',
|
|
21
|
+
getAddr('AaveV4DelegateSetUsingAsCollateralWithSig'),
|
|
22
|
+
[
|
|
23
|
+
['address', 'address', 'address', 'bool', 'uint256', 'uint256'],
|
|
24
|
+
'bytes',
|
|
25
|
+
],
|
|
26
|
+
[permit, signature],
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { bytes } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* AaveV4DelegateWithdrawWithSigAction - Approves a spender to withdraw from the specified reserve using an EIP712-typed intent.
|
|
7
|
+
*
|
|
8
|
+
* @category AaveV4
|
|
9
|
+
*/
|
|
10
|
+
export class AaveV4DelegateWithdrawWithSigAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param permit EIP712-typed intent.
|
|
13
|
+
* @param signature The EIP712-compliant signature bytes.
|
|
14
|
+
*/
|
|
15
|
+
constructor(
|
|
16
|
+
permit: Array<any>,
|
|
17
|
+
signature: bytes,
|
|
18
|
+
) {
|
|
19
|
+
super(
|
|
20
|
+
'AaveV4DelegateWithdrawWithSig',
|
|
21
|
+
getAddr('AaveV4DelegateWithdrawWithSig'),
|
|
22
|
+
[
|
|
23
|
+
['address', 'uint256', 'address', 'address', 'uint256', 'uint256', 'uint256'],
|
|
24
|
+
'bytes',
|
|
25
|
+
],
|
|
26
|
+
[permit, signature],
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { getAssetInfoByAddress } from '@defisaver/tokens';
|
|
2
|
+
import { Action } from '../../Action';
|
|
3
|
+
import { getAddr } from '../../addresses';
|
|
4
|
+
import { EthAddress, uint256 } from '../../types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* AaveV4PaybackAction
|
|
8
|
+
*
|
|
9
|
+
* @category AaveV4
|
|
10
|
+
*/
|
|
11
|
+
export class AaveV4PaybackAction extends Action {
|
|
12
|
+
tokenForApproval: EthAddress;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param spoke Address of the spoke.
|
|
16
|
+
* @param onBehalf Address to payback tokens on behalf of. Defaults to the user's wallet if not provided.
|
|
17
|
+
* @param from Address from which to pull the payback tokens.
|
|
18
|
+
* @param reserveId Reserve id.
|
|
19
|
+
* @param amount Amount of tokens to payback. Send type(uint).max to payback whole amount.
|
|
20
|
+
* @param tokenAddress Address of the token to approve. Optional, as it is only used for token approval, not part of encoding.
|
|
21
|
+
*/
|
|
22
|
+
constructor(
|
|
23
|
+
spoke: EthAddress,
|
|
24
|
+
onBehalf: EthAddress,
|
|
25
|
+
from: EthAddress,
|
|
26
|
+
reserveId: uint256,
|
|
27
|
+
amount: uint256,
|
|
28
|
+
tokenAddress: EthAddress = getAddr('Empty'),
|
|
29
|
+
) {
|
|
30
|
+
super(
|
|
31
|
+
'AaveV4Payback',
|
|
32
|
+
getAddr('AaveV4Payback'),
|
|
33
|
+
['address', 'address', 'address', 'uint256', 'uint256'],
|
|
34
|
+
[spoke, onBehalf, from, reserveId, amount],
|
|
35
|
+
);
|
|
36
|
+
this.mappableArgs = [
|
|
37
|
+
this.args[0],
|
|
38
|
+
this.args[1],
|
|
39
|
+
this.args[2],
|
|
40
|
+
this.args[3],
|
|
41
|
+
this.args[4],
|
|
42
|
+
];
|
|
43
|
+
this.tokenForApproval = tokenAddress;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async getAssetsToApprove() {
|
|
47
|
+
const asset = getAssetInfoByAddress(this.tokenForApproval);
|
|
48
|
+
if (asset.symbol !== 'ETH') return [{ asset: this.tokenForApproval, owner: this.args[2] }];
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* AaveV4RefreshPremiumAction - Refresh the risk premium for user's position
|
|
7
|
+
*
|
|
8
|
+
* @category AaveV4RefreshPremium
|
|
9
|
+
*/
|
|
10
|
+
export class AaveV4RefreshPremiumAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param spoke Address of the spoke.
|
|
13
|
+
* @param onBehalf Address to refresh the config on behalf of. Defaults to the user's wallet if not provided.
|
|
14
|
+
* @param refreshDynamicReserveConfig Whether to also refresh the dynamic reserve config for all collateral reserves.
|
|
15
|
+
*/
|
|
16
|
+
constructor(
|
|
17
|
+
spoke: EthAddress,
|
|
18
|
+
onBehalf: EthAddress,
|
|
19
|
+
refreshDynamicReserveConfig: boolean,
|
|
20
|
+
) {
|
|
21
|
+
super(
|
|
22
|
+
'AaveV4RefreshPremium',
|
|
23
|
+
getAddr('AaveV4RefreshPremium'),
|
|
24
|
+
['address', 'address', 'bool'],
|
|
25
|
+
[spoke, onBehalf, refreshDynamicReserveConfig],
|
|
26
|
+
);
|
|
27
|
+
this.mappableArgs = [
|
|
28
|
+
this.args[0],
|
|
29
|
+
this.args[1],
|
|
30
|
+
this.args[2],
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, bytes, uint256 } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* AaveV4SetUserManagersWithSigAction - Sets user position managers with EIP712-typed signature.
|
|
7
|
+
*
|
|
8
|
+
* @category AaveV4
|
|
9
|
+
*/
|
|
10
|
+
export class AaveV4SetUserManagersWithSigAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param spoke Address of the spoke.
|
|
13
|
+
* @param onBehalf The address of the user on whose behalf position manager can act.
|
|
14
|
+
* @param nonce The nonce for the signature.
|
|
15
|
+
* @param deadline The deadline for the signature.
|
|
16
|
+
* @param signature The signature bytes.
|
|
17
|
+
* @param updates The array of position manager updates.
|
|
18
|
+
*/
|
|
19
|
+
constructor(
|
|
20
|
+
spoke: EthAddress,
|
|
21
|
+
onBehalf: EthAddress,
|
|
22
|
+
nonce: uint256,
|
|
23
|
+
deadline: uint256,
|
|
24
|
+
signature: bytes,
|
|
25
|
+
updates: Array<[EthAddress, boolean]>,
|
|
26
|
+
) {
|
|
27
|
+
super(
|
|
28
|
+
'AaveV4SetUserManagersWithSig',
|
|
29
|
+
getAddr('AaveV4SetUserManagersWithSig'),
|
|
30
|
+
['address', 'address', 'uint256', 'uint256', 'bytes', 'tuple(address,bool)[]'],
|
|
31
|
+
[spoke, onBehalf, nonce, deadline, signature, updates],
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* AaveV4StoreRatioAction - Stores the ratio for a user in transient storage so it can be checked later after strategy execution.
|
|
7
|
+
*
|
|
8
|
+
* @category AaveV4
|
|
9
|
+
*/
|
|
10
|
+
export class AaveV4StoreRatioAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param spoke Address of the spoke.
|
|
13
|
+
* @param user Address of the user to store the ratio for.
|
|
14
|
+
*/
|
|
15
|
+
constructor(
|
|
16
|
+
spoke: EthAddress,
|
|
17
|
+
user: EthAddress,
|
|
18
|
+
) {
|
|
19
|
+
super(
|
|
20
|
+
'AaveV4StoreRatio',
|
|
21
|
+
getAddr('Empty'),
|
|
22
|
+
['address', 'address'],
|
|
23
|
+
[spoke, user],
|
|
24
|
+
);
|
|
25
|
+
this.mappableArgs = [
|
|
26
|
+
this.args[0],
|
|
27
|
+
this.args[1],
|
|
28
|
+
];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { getAssetInfoByAddress } from '@defisaver/tokens';
|
|
2
|
+
import { Action } from '../../Action';
|
|
3
|
+
import { getAddr } from '../../addresses';
|
|
4
|
+
import { EthAddress, uint256 } from '../../types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* AaveV4SupplyAction
|
|
8
|
+
*
|
|
9
|
+
* @category AaveV4
|
|
10
|
+
*/
|
|
11
|
+
export class AaveV4SupplyAction extends Action {
|
|
12
|
+
tokenForApproval: EthAddress;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param spoke Address of the spoke.
|
|
16
|
+
* @param onBehalf Address to supply tokens on behalf of. Defaults to the user's wallet if not provided.
|
|
17
|
+
* @param from Address from which to pull collateral asset.
|
|
18
|
+
* @param reserveId Reserve id.
|
|
19
|
+
* @param amount Amount of tokens to supply.
|
|
20
|
+
* @param useAsCollateral Whether to use the tokens as collateral.
|
|
21
|
+
* @param tokenAddress Address of the token to approve. Optional, as it is only used for token approval, not part of encoding.
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
constructor(
|
|
25
|
+
spoke: EthAddress,
|
|
26
|
+
onBehalf: EthAddress,
|
|
27
|
+
from: EthAddress,
|
|
28
|
+
reserveId: uint256,
|
|
29
|
+
amount: uint256,
|
|
30
|
+
useAsCollateral: boolean,
|
|
31
|
+
tokenAddress: EthAddress = getAddr('Empty'),
|
|
32
|
+
) {
|
|
33
|
+
super(
|
|
34
|
+
'AaveV4Supply',
|
|
35
|
+
getAddr('AaveV4Supply'),
|
|
36
|
+
['address', 'address', 'address', 'uint256', 'uint256', 'bool'],
|
|
37
|
+
[spoke, onBehalf, from, reserveId, amount, useAsCollateral],
|
|
38
|
+
);
|
|
39
|
+
this.mappableArgs = [
|
|
40
|
+
this.args[0],
|
|
41
|
+
this.args[1],
|
|
42
|
+
this.args[2],
|
|
43
|
+
this.args[3],
|
|
44
|
+
this.args[4],
|
|
45
|
+
this.args[5],
|
|
46
|
+
];
|
|
47
|
+
this.tokenForApproval = tokenAddress;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async getAssetsToApprove() {
|
|
51
|
+
const asset = getAssetInfoByAddress(this.tokenForApproval);
|
|
52
|
+
if (asset.symbol !== 'ETH') return [{ asset: this.tokenForApproval, owner: this.args[2] }];
|
|
53
|
+
return [];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, uint256 } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* AaveV4WithdrawAction
|
|
7
|
+
*
|
|
8
|
+
* @category AaveV4
|
|
9
|
+
*/
|
|
10
|
+
export class AaveV4WithdrawAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param spoke Address of the spoke.
|
|
13
|
+
* @param onBehalf Address to withdraw tokens on behalf of. Defaults to the user's wallet if not provided.
|
|
14
|
+
* @param to Address that will receive the withdrawn tokens.
|
|
15
|
+
* @param reserveId Reserve id.
|
|
16
|
+
* @param amount Amount of tokens to withdraw. Send type(uint).max to withdraw whole amount.
|
|
17
|
+
*/
|
|
18
|
+
constructor(
|
|
19
|
+
spoke: EthAddress,
|
|
20
|
+
onBehalf: EthAddress,
|
|
21
|
+
to: EthAddress,
|
|
22
|
+
reserveId: uint256,
|
|
23
|
+
amount: uint256,
|
|
24
|
+
) {
|
|
25
|
+
super(
|
|
26
|
+
'AaveV4Withdraw',
|
|
27
|
+
getAddr('AaveV4Withdraw'),
|
|
28
|
+
['address', 'address', 'address', 'uint256', 'uint256'],
|
|
29
|
+
[spoke, onBehalf, to, reserveId, amount],
|
|
30
|
+
);
|
|
31
|
+
this.mappableArgs = [
|
|
32
|
+
this.args[0],
|
|
33
|
+
this.args[1],
|
|
34
|
+
this.args[2],
|
|
35
|
+
this.args[3],
|
|
36
|
+
this.args[4],
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -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,36 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, uint256, uint8 } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* AaveV4RatioCheckAction - Checks aave V4 ratio for user position
|
|
7
|
+
*
|
|
8
|
+
* @category AaveV4RatioCheck
|
|
9
|
+
*/
|
|
10
|
+
export class AaveV4RatioCheckAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param ratioState State of the ratio (IN_BOOST or IN_REPAY)
|
|
13
|
+
* @param targetRatio Target ratio.
|
|
14
|
+
* @param spoke Aave V4 spoke address.
|
|
15
|
+
* @param user User address.
|
|
16
|
+
*/
|
|
17
|
+
constructor(
|
|
18
|
+
ratioState: uint8,
|
|
19
|
+
targetRatio: uint256,
|
|
20
|
+
spoke: EthAddress,
|
|
21
|
+
user: EthAddress,
|
|
22
|
+
) {
|
|
23
|
+
super(
|
|
24
|
+
'AaveV4RatioCheck',
|
|
25
|
+
getAddr('Empty'),
|
|
26
|
+
['uint8', 'uint256', 'address', 'address'],
|
|
27
|
+
[ratioState, targetRatio, spoke, user],
|
|
28
|
+
);
|
|
29
|
+
this.mappableArgs = [
|
|
30
|
+
this.args[0],
|
|
31
|
+
this.args[1],
|
|
32
|
+
this.args[2],
|
|
33
|
+
this.args[3],
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -15,4 +15,5 @@ export * from './LiquityV2RatioCheckAction';
|
|
|
15
15
|
export * from './LiquityV2TargetRatioCheckAction';
|
|
16
16
|
export * from './LiquityV2NewInterestRateCheckerAction';
|
|
17
17
|
export * from './FluidRatioCheckAction';
|
|
18
|
-
export * from './SparkTargetRatioCheck';
|
|
18
|
+
export * from './SparkTargetRatioCheck';
|
|
19
|
+
export * from './AaveV4RatioCheckAction';
|
package/src/actions/index.ts
CHANGED
|
@@ -39,6 +39,7 @@ 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
|
+
import * as aaveV4 from './aavev4';
|
|
42
43
|
|
|
43
44
|
export {
|
|
44
45
|
aave,
|
|
@@ -82,4 +83,5 @@ export {
|
|
|
82
83
|
fluid,
|
|
83
84
|
pendle,
|
|
84
85
|
umbrella,
|
|
86
|
+
aaveV4,
|
|
85
87
|
};
|
package/src/addresses.ts
CHANGED
|
@@ -389,6 +389,18 @@ export const actionAddresses = {
|
|
|
389
389
|
SFApproveTokens: '0x0aC29D44eeC8e8f3b010c2e8FC960957db0c8298',
|
|
390
390
|
SummerfiUnsub: '0x926405D69b77A514ED974901095AcFf9e5131366',
|
|
391
391
|
SummerfiUnsubV2: '0x5E805eD9B7581a9f1398F75833f9663a459F5E30',
|
|
392
|
+
|
|
393
|
+
// AaveV4
|
|
394
|
+
AaveV4Supply: '0x089c2b1DB0f68D94E67e8d969509D45B26fD0ceC',
|
|
395
|
+
AaveV4Withdraw: '0x563EC9e76b335A8218c04Ac4Ae9A58ae464CaAD6',
|
|
396
|
+
AaveV4Borrow: '0x2a560B72Fb88b9Bb90dd997CD94D7611740961B9',
|
|
397
|
+
AaveV4Payback: '0xEBafec920888E735e61353A8792cBd452B8406a0',
|
|
398
|
+
AaveV4CollateralSwitch: '0x742c8676E90958C8b8e264b70Ca0685c365Eec5f',
|
|
399
|
+
AaveV4RefreshPremium: '0xca7Cec8D88Bf495166CAeC045F0d467Aa4ceBE4E',
|
|
400
|
+
AaveV4SetUserManagersWithSig: '0x70CB26167153298aF397dF58200799A24B060b0d',
|
|
401
|
+
AaveV4DelegateWithdrawWithSig: '0x81864dBd69c46B19463eC7BEC6cE0B271126531a',
|
|
402
|
+
AaveV4DelegateBorrowWithSig: '0x9D68b41BB9f9e9Ac1E1ee49d3566CAd4624886BA',
|
|
403
|
+
AaveV4DelegateSetUsingAsCollateralWithSig: '0xF3D7C7e8F5154c669EAA0dE996cdE0575D7d3A00',
|
|
392
404
|
},
|
|
393
405
|
[NETWORKS.optimism.chainId]: {
|
|
394
406
|
DFSSell: '0x9f234af5c10c136863a20865ba00b26951ab8269',
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Action } from '../Action';
|
|
2
|
+
import { getAddr } from '../addresses';
|
|
3
|
+
import { EthAddress, uint256 } from '../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* AaveV4QuotePriceRangeTrigger - Verifies if current token price ratio for aaveV4 spoke is within a subbed price range.
|
|
7
|
+
*
|
|
8
|
+
* @category Triggers
|
|
9
|
+
*/
|
|
10
|
+
export class AaveV4QuotePriceRangeTrigger extends Action {
|
|
11
|
+
constructor(
|
|
12
|
+
spoke:EthAddress,
|
|
13
|
+
baseTokenId:uint256,
|
|
14
|
+
quoteTokenId:uint256,
|
|
15
|
+
lowerPrice:uint256,
|
|
16
|
+
upperPrice:uint256,
|
|
17
|
+
) {
|
|
18
|
+
super(
|
|
19
|
+
'AaveV4QuotePriceRangeTrigger',
|
|
20
|
+
getAddr('Empty'),
|
|
21
|
+
[['address', 'uint256', 'uint256', 'uint256', 'uint256']],
|
|
22
|
+
[[spoke, baseTokenId, quoteTokenId, lowerPrice, upperPrice]],
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Action } from '../Action';
|
|
2
|
+
import { getAddr } from '../addresses';
|
|
3
|
+
import { EthAddress, uint256, uint8 } from '../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* AaveV4QuotePriceTrigger - Verifies if current token price ratio for aaveV4 spoke is over/under a subbed price ratio.
|
|
7
|
+
*
|
|
8
|
+
* @category Triggers
|
|
9
|
+
*/
|
|
10
|
+
export class AaveV4QuotePriceTrigger extends Action {
|
|
11
|
+
constructor(
|
|
12
|
+
spoke:EthAddress,
|
|
13
|
+
baseTokenId:uint256,
|
|
14
|
+
quoteTokenId:uint256,
|
|
15
|
+
price:uint256,
|
|
16
|
+
state:uint8,
|
|
17
|
+
) {
|
|
18
|
+
super(
|
|
19
|
+
'AaveV4QuotePriceTrigger',
|
|
20
|
+
getAddr('Empty'),
|
|
21
|
+
[['address', 'uint256', 'uint256', 'uint256', 'uint8']],
|
|
22
|
+
[[spoke, baseTokenId, quoteTokenId, price, state]],
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Action } from '../Action';
|
|
2
|
+
import { getAddr } from '../addresses';
|
|
3
|
+
import { EthAddress, uint256, uint8 } from '../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* AaveV4RatioTrigger - Triggers when the user's ratio is over/under a subbed ratio.
|
|
7
|
+
*
|
|
8
|
+
* @category Triggers
|
|
9
|
+
*/
|
|
10
|
+
export class AaveV4RatioTrigger extends Action {
|
|
11
|
+
constructor(
|
|
12
|
+
user:EthAddress,
|
|
13
|
+
spoke:EthAddress,
|
|
14
|
+
ratio:uint256,
|
|
15
|
+
state:uint8,
|
|
16
|
+
) {
|
|
17
|
+
super(
|
|
18
|
+
'AaveV4RatioTrigger',
|
|
19
|
+
getAddr('Empty'),
|
|
20
|
+
[['address', 'address', 'uint256', 'uint8']],
|
|
21
|
+
[[user, spoke, ratio, state]],
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
}
|
package/src/triggers/index.ts
CHANGED
|
@@ -30,4 +30,7 @@ export * from './CompV3PriceRangeTrigger';
|
|
|
30
30
|
export * from './LiquityV2AdjustRateDebtInFrontTrigger';
|
|
31
31
|
export * from './AaveV3QuotePriceRangeTrigger';
|
|
32
32
|
export * from './SparkQuotePriceRangeTrigger';
|
|
33
|
-
export * from './MorphoBluePriceRangeTrigger';
|
|
33
|
+
export * from './MorphoBluePriceRangeTrigger';
|
|
34
|
+
export * from './AaveV4QuotePriceTrigger';
|
|
35
|
+
export * from './AaveV4QuotePriceRangeTrigger';
|
|
36
|
+
export * from './AaveV4RatioTrigger';
|