@defisaver/sdk 0.1.21 → 0.1.24
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/ACTIONS.md +20 -254
- package/AccessLists/DyDxAccessLists.js +0 -4
- package/AccessLists/InstaAccessLists.js +0 -8
- package/AccessLists/UtilsAccessLists.js +0 -5
- package/DEV.md +0 -7
- package/index.js +15 -2
- package/package.json +1 -1
- package/src/Action.js +52 -12
- package/src/L2Action.js +44 -0
- package/src/Recipe.js +5 -4
- package/src/Strategy.js +63 -0
- package/src/abis/Action.json +157 -11
- package/src/abis/Recipe.json +92 -47
- package/src/actions/aave/AaveBorrowAction.js +11 -2
- package/src/actions/aave/AavePaybackAction.js +11 -2
- package/src/actions/aave/AaveSupplyAction.js +9 -1
- package/src/actions/aave/AaveWithdrawAction.js +8 -1
- package/src/actions/aaveV3/AaveV3ATokenPaybackAction.js +53 -0
- package/src/actions/aaveV3/AaveV3BorrowAction.js +54 -0
- package/src/actions/aaveV3/AaveV3CollateralSwitchAction.js +41 -0
- package/src/actions/aaveV3/AaveV3PaybackAction.js +63 -0
- package/src/actions/aaveV3/AaveV3SetEModeAction.js +35 -0
- package/src/actions/aaveV3/AaveV3SupplyAction.js +64 -0
- package/src/actions/aaveV3/AaveV3WithdrawAction.js +41 -0
- package/src/actions/aaveV3/index.js +17 -0
- package/src/actions/basic/GasFeeAction.js +27 -0
- package/src/actions/basic/PullTokenAction.js +9 -3
- package/src/actions/basic/SellAction.js +6 -5
- package/src/actions/basic/SendTokenAction.js +9 -3
- package/src/actions/basic/SumInputsAction.js +8 -3
- package/src/actions/basic/UnwrapEthAction.js +8 -3
- package/src/actions/basic/WrapEthAction.js +5 -1
- package/src/actions/basic/index.js +2 -2
- package/src/actions/checkers/MakerRatioCheckAction.js +29 -0
- package/src/actions/checkers/index.js +5 -0
- package/src/actions/compound/CompoundBorrowAction.js +7 -1
- package/src/actions/compound/CompoundClaimAction.js +6 -1
- package/src/actions/compound/CompoundPaybackAction.js +7 -1
- package/src/actions/compound/CompoundSupplyAction.js +7 -1
- package/src/actions/compound/CompoundWithdrawAction.js +7 -1
- package/src/actions/dydx/DyDxWithdrawAction.js +7 -1
- package/src/actions/dydx/index.js +0 -2
- package/src/actions/flashloan/AaveV2FlashLoanAction.js +2 -2
- package/src/actions/flashloan/BalancerFlashLoanAction.js +2 -2
- package/src/actions/flashloan/DyDxFlashLoanAction.js +1 -1
- package/src/actions/flashloan/MakerFlashLoanAction.js +2 -2
- package/src/actions/index.js +4 -0
- package/src/actions/insta/index.js +0 -2
- package/src/actions/liquity/LiquityClaimAction.js +6 -2
- package/src/actions/liquity/LiquityCloseAction.js +7 -2
- package/src/actions/maker/MakerGenerateAction.js +8 -1
- package/src/actions/maker/MakerGiveAction.js +7 -1
- package/src/actions/maker/MakerMergeAction.js +7 -1
- package/src/actions/maker/MakerOpenVaultAction.js +6 -1
- package/src/actions/maker/MakerPaybackAction.js +1 -0
- package/src/actions/maker/MakerRatioAction.js +20 -0
- package/src/actions/maker/MakerSupplyAction.js +9 -1
- package/src/actions/maker/MakerWithdrawAction.js +10 -2
- package/src/actions/maker/index.js +2 -0
- package/src/actions/mstable/MStableDepositAction.js +2 -2
- package/src/actions/mstable/MStableWithdrawAction.js +2 -2
- package/src/actions/reflexer/ReflexerGenerateAction.js +7 -1
- package/src/actions/reflexer/ReflexerOpenSafeAction.js +5 -1
- package/src/actions/reflexer/ReflexerPaybackAction.js +7 -1
- package/src/actions/reflexer/ReflexerSupplyAction.js +8 -1
- package/src/actions/reflexer/ReflexerWithdrawAction.js +8 -1
- package/src/addresses.js +179 -143
- package/src/config.js +74 -0
- package/src/triggers/ChainLinkPriceTrigger.js +12 -0
- package/src/triggers/CompoundRatioTrigger.js +11 -0
- package/src/triggers/GasPriceTrigger.js +11 -0
- package/src/triggers/LiquityRatioTrigger.js +16 -0
- package/src/triggers/MakerRatioTrigger.js +15 -0
- package/src/triggers/ReflexerRatioTrigger.js +11 -0
- package/src/triggers/TimestampTrigger.js +11 -0
- package/src/triggers/UniV3CurrentTickTrigger.js +12 -0
- package/src/triggers/index.js +19 -0
- package/src/types.js +33 -0
- package/src/utils/general.js +2 -0
- package/src/utils/zeroExExchange.js +2 -40
- package/test/accessLists/MockAccessLists.json +0 -72
- package/test/accessLists/Recipe.js +3 -3
- package/test/actions/insta/InstPullTokensAction.js +2 -2
- package/test/index.js +4 -1
- package/test/utils/zeroExExchange.js +0 -8
- package/src/actions/basic/BuyAction.js +0 -53
- package/src/actions/dydx/DyDxSupplyAction.js +0 -25
- package/src/actions/insta/ClaimInstMakerAction.js +0 -21
- package/test/actions/basic/BuyAction.js +0 -100
- package/test/actions/dydx/DyDxSupplyAction.js +0 -78
- package/test/actions/insta/ClaimInstMakerAction.js +0 -46
package/src/actions/index.js
CHANGED
|
@@ -7,6 +7,7 @@ const uniswap = require('./uniswap');
|
|
|
7
7
|
const reflexer = require('./reflexer');
|
|
8
8
|
const dydx = require('./dydx');
|
|
9
9
|
const uniswapV3 = require('./uniswapV3');
|
|
10
|
+
const checkers = require('./checkers');
|
|
10
11
|
const liquity = require('./liquity');
|
|
11
12
|
const yearn = require('./yearn');
|
|
12
13
|
const lido = require('./lido');
|
|
@@ -16,6 +17,7 @@ const curve = require('./curve');
|
|
|
16
17
|
const guni = require('./guni');
|
|
17
18
|
const mstable = require('./mstable');
|
|
18
19
|
const rari = require('./rari');
|
|
20
|
+
const aaveV3 = require('./aaveV3');
|
|
19
21
|
|
|
20
22
|
module.exports = {
|
|
21
23
|
maker,
|
|
@@ -27,6 +29,7 @@ module.exports = {
|
|
|
27
29
|
uniswapV3,
|
|
28
30
|
reflexer,
|
|
29
31
|
dydx,
|
|
32
|
+
checkers,
|
|
30
33
|
liquity,
|
|
31
34
|
yearn,
|
|
32
35
|
lido,
|
|
@@ -36,4 +39,5 @@ module.exports = {
|
|
|
36
39
|
guni,
|
|
37
40
|
mstable,
|
|
38
41
|
rari,
|
|
42
|
+
aaveV3,
|
|
39
43
|
};
|
|
@@ -13,8 +13,12 @@ class LiquityClaimAction extends Action {
|
|
|
13
13
|
requireAddress(to);
|
|
14
14
|
super('LiquityClaim',
|
|
15
15
|
getAddr('LiquityClaim'),
|
|
16
|
-
['address'],
|
|
17
|
-
[...arguments]);
|
|
16
|
+
[['address']],
|
|
17
|
+
[[...arguments]]);
|
|
18
|
+
|
|
19
|
+
this.mappableArgs = [
|
|
20
|
+
this.args[0][0],
|
|
21
|
+
];
|
|
18
22
|
}
|
|
19
23
|
}
|
|
20
24
|
|
|
@@ -16,8 +16,13 @@ class LiquityCloseAction extends Action {
|
|
|
16
16
|
requireAddress(to);
|
|
17
17
|
super('LiquityClose',
|
|
18
18
|
getAddr('LiquityClose'),
|
|
19
|
-
['address', 'address'],
|
|
20
|
-
[from, to]);
|
|
19
|
+
[['address', 'address']],
|
|
20
|
+
[[from, to]]);
|
|
21
|
+
|
|
22
|
+
this.mappableArgs = [
|
|
23
|
+
this.args[0][0],
|
|
24
|
+
this.args[0][1],
|
|
25
|
+
];
|
|
21
26
|
}
|
|
22
27
|
|
|
23
28
|
async getAssetsToApprove() {
|
|
@@ -14,7 +14,14 @@ class MakerGenerateAction extends Action {
|
|
|
14
14
|
*/
|
|
15
15
|
constructor(vaultId, amount, to, mcdManager = getAddr('McdCdpManager')) {
|
|
16
16
|
requireAddress(to);
|
|
17
|
-
super('McdGenerate', getAddr('McdGenerate'), ['uint256','uint256','address','address'], [vaultId, amount, to, mcdManager]);
|
|
17
|
+
super('McdGenerate', getAddr('McdGenerate'), [['uint256','uint256','address','address']], [[vaultId, amount, to, mcdManager]]);
|
|
18
|
+
|
|
19
|
+
this.mappableArgs = [
|
|
20
|
+
this.args[0][0],
|
|
21
|
+
this.args[0][1],
|
|
22
|
+
this.args[0][2],
|
|
23
|
+
this.args[0][3],
|
|
24
|
+
];
|
|
18
25
|
}
|
|
19
26
|
}
|
|
20
27
|
|
|
@@ -15,7 +15,13 @@ class MakerGiveAction extends Action {
|
|
|
15
15
|
*/
|
|
16
16
|
constructor(vaultId, newOwner, createProxy, mcdManager= getAddr('McdCdpManager')) {
|
|
17
17
|
requireAddress(newOwner);
|
|
18
|
-
super('McdGive', getAddr('McdGive'), ["uint256", "address", "bool", "address"], [vaultId, newOwner, createProxy, mcdManager]);
|
|
18
|
+
super('McdGive', getAddr('McdGive'), [["uint256", "address", "bool", "address"]], [[vaultId, newOwner, createProxy, mcdManager]]);
|
|
19
|
+
|
|
20
|
+
this.mappableArgs = [
|
|
21
|
+
this.args[0][0],
|
|
22
|
+
this.args[0][1],
|
|
23
|
+
this.args[0][2],
|
|
24
|
+
];
|
|
19
25
|
}
|
|
20
26
|
}
|
|
21
27
|
|
|
@@ -12,7 +12,13 @@ class MakerMergeAction extends Action {
|
|
|
12
12
|
* @param mcdManager {EthAddress}
|
|
13
13
|
*/
|
|
14
14
|
constructor(srcVaultId, destVaultId, mcdManager = getAddr('McdCdpManager')) {
|
|
15
|
-
super('McdMerge', getAddr('McdMerge'), ['uint256','uint256','address'], [srcVaultId, destVaultId, mcdManager]);
|
|
15
|
+
super('McdMerge', getAddr('McdMerge'), [['uint256','uint256','address']], [[srcVaultId, destVaultId, mcdManager]]);
|
|
16
|
+
|
|
17
|
+
this.mappableArgs = [
|
|
18
|
+
this.args[0][0],
|
|
19
|
+
this.args[0][1],
|
|
20
|
+
this.args[0][2],
|
|
21
|
+
];
|
|
16
22
|
}
|
|
17
23
|
}
|
|
18
24
|
|
|
@@ -10,7 +10,12 @@ class MakerOpenVaultAction extends Action {
|
|
|
10
10
|
* @param mcdManager {EthAddress}
|
|
11
11
|
*/
|
|
12
12
|
constructor(joinAddr, mcdManager = getAddr('McdCdpManager')) {
|
|
13
|
-
super('McdOpen', getAddr('McdOpen'), ['address','address'], [joinAddr, mcdManager]);
|
|
13
|
+
super('McdOpen', getAddr('McdOpen'), [['address','address']], [[joinAddr, mcdManager]]);
|
|
14
|
+
|
|
15
|
+
this.mappableArgs = [
|
|
16
|
+
this.args[0][0],
|
|
17
|
+
this.args[0][1],
|
|
18
|
+
];
|
|
14
19
|
}
|
|
15
20
|
}
|
|
16
21
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const Action = require("../../Action");
|
|
2
|
+
const { getAddr } = require('../../addresses.js');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* MakerRatioAction
|
|
6
|
+
*/
|
|
7
|
+
class MakerRatioAction extends Action {
|
|
8
|
+
/**
|
|
9
|
+
* @param vaultId {uint256}
|
|
10
|
+
*/
|
|
11
|
+
constructor(vaultId) {
|
|
12
|
+
super('McdRatio', getAddr('McdRatio'), [['uint256']], [[vaultId]]);
|
|
13
|
+
|
|
14
|
+
this.mappableArgs = [
|
|
15
|
+
this.args[0][0],
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
module.exports = MakerRatioAction;
|
|
@@ -15,7 +15,15 @@ class MakerSupplyAction extends Action {
|
|
|
15
15
|
* @param mcdManager {EthAddress}
|
|
16
16
|
*/
|
|
17
17
|
constructor(vaultId, amount, joinAddr, from, mcdManager = getAddr('McdCdpManager')) {
|
|
18
|
-
super('McdSupply', getAddr('McdSupply'), ['uint256','uint256','address','address','address'], [vaultId, amount, joinAddr, from, mcdManager]);
|
|
18
|
+
super('McdSupply', getAddr('McdSupply'), [['uint256','uint256','address','address','address']], [[vaultId, amount, joinAddr, from, mcdManager]]);
|
|
19
|
+
|
|
20
|
+
this.mappableArgs = [
|
|
21
|
+
this.args[0][0],
|
|
22
|
+
this.args[0][1],
|
|
23
|
+
this.args[0][2],
|
|
24
|
+
this.args[0][3],
|
|
25
|
+
this.args[0][4],
|
|
26
|
+
];
|
|
19
27
|
}
|
|
20
28
|
|
|
21
29
|
async getAssetsToApprove() {
|
|
@@ -11,12 +11,20 @@ class MakerWithdrawAction extends Action {
|
|
|
11
11
|
* @param vaultId {VaultId}
|
|
12
12
|
* @param amount {string}
|
|
13
13
|
* @param joinAddr {EthAddress}
|
|
14
|
-
* @param to {
|
|
14
|
+
* @param to {string}
|
|
15
15
|
* @param mcdManager {EthAddress}
|
|
16
16
|
*/
|
|
17
17
|
constructor(vaultId, amount, joinAddr, to, mcdManager = getAddr('McdCdpManager')) {
|
|
18
18
|
requireAddress(to);
|
|
19
|
-
super('McdWithdraw', getAddr('McdWithdraw'), ['uint256','uint256','address','address','address'], [vaultId, amount, joinAddr, to, mcdManager]);
|
|
19
|
+
super('McdWithdraw', getAddr('McdWithdraw'), [['uint256','uint256','address','address','address']], [[vaultId, amount, joinAddr, to, mcdManager]]);
|
|
20
|
+
|
|
21
|
+
this.mappableArgs = [
|
|
22
|
+
this.args[0][0],
|
|
23
|
+
this.args[0][1],
|
|
24
|
+
this.args[0][2],
|
|
25
|
+
this.args[0][3],
|
|
26
|
+
this.args[0][4],
|
|
27
|
+
];
|
|
20
28
|
}
|
|
21
29
|
}
|
|
22
30
|
|
|
@@ -5,6 +5,7 @@ const MakerPaybackAction = require('./MakerPaybackAction');
|
|
|
5
5
|
const MakerWithdrawAction = require('./MakerWithdrawAction');
|
|
6
6
|
const MakerGiveAction = require('./MakerGiveAction');
|
|
7
7
|
const MakerMergeAction = require('./MakerMergeAction');
|
|
8
|
+
const MakerRatioAction = require('./MakerRatioAction');
|
|
8
9
|
const MakerClaimAction = require('./MakerClaimAction');
|
|
9
10
|
|
|
10
11
|
module.exports = {
|
|
@@ -15,5 +16,6 @@ module.exports = {
|
|
|
15
16
|
MakerWithdrawAction,
|
|
16
17
|
MakerGiveAction,
|
|
17
18
|
MakerMergeAction,
|
|
19
|
+
MakerRatioAction,
|
|
18
20
|
MakerClaimAction,
|
|
19
21
|
};
|
|
@@ -37,8 +37,8 @@ class MStableDepositAction extends Action {
|
|
|
37
37
|
requireAddress(to);
|
|
38
38
|
|
|
39
39
|
super(
|
|
40
|
-
'
|
|
41
|
-
getAddr('
|
|
40
|
+
'MStableDeposit',
|
|
41
|
+
getAddr('MStableDeposit'),
|
|
42
42
|
[['address', 'address', 'address', 'address', 'address', 'address', 'uint256', 'uint256', 'uint256']],
|
|
43
43
|
[[...arguments]],
|
|
44
44
|
);
|
|
@@ -37,8 +37,8 @@ class MStableWithdrawAction extends Action {
|
|
|
37
37
|
requireAddress(to);
|
|
38
38
|
|
|
39
39
|
super(
|
|
40
|
-
'
|
|
41
|
-
getAddr('
|
|
40
|
+
'MStableWithdraw',
|
|
41
|
+
getAddr('MStableWithdraw'),
|
|
42
42
|
[['address', 'address', 'address', 'address', 'address', 'address', 'uint256', 'uint256', 'uint256']],
|
|
43
43
|
[[...arguments]],
|
|
44
44
|
);
|
|
@@ -13,7 +13,13 @@ class ReflexerGenerateAction extends Action {
|
|
|
13
13
|
*/
|
|
14
14
|
constructor(vaultId, amount, to) {
|
|
15
15
|
requireAddress(to);
|
|
16
|
-
super('ReflexerGenerate', getAddr('ReflexerGenerate'), ['uint256','uint256','address'], [vaultId, amount, to]);
|
|
16
|
+
super('ReflexerGenerate', getAddr('ReflexerGenerate'), [['uint256','uint256','address']], [[vaultId, amount, to]]);
|
|
17
|
+
|
|
18
|
+
this.mappableArgs = [
|
|
19
|
+
this.args[0][0],
|
|
20
|
+
this.args[0][1],
|
|
21
|
+
this.args[0][2],
|
|
22
|
+
];
|
|
17
23
|
}
|
|
18
24
|
}
|
|
19
25
|
|
|
@@ -9,7 +9,11 @@ class ReflexerOpenSafeAction extends Action {
|
|
|
9
9
|
* @param adapterAddr {EthAddress}
|
|
10
10
|
*/
|
|
11
11
|
constructor(adapterAddr) {
|
|
12
|
-
super('ReflexerOpen', getAddr('ReflexerOpen'), ['address'], [adapterAddr]);
|
|
12
|
+
super('ReflexerOpen', getAddr('ReflexerOpen'), [['address']], [[adapterAddr]]);
|
|
13
|
+
|
|
14
|
+
this.mappableArgs = [
|
|
15
|
+
this.args[0][0],
|
|
16
|
+
];
|
|
13
17
|
}
|
|
14
18
|
}
|
|
15
19
|
|
|
@@ -13,7 +13,13 @@ class ReflexerPaybackAction extends Action {
|
|
|
13
13
|
* @param from {EthAddress} RAI will be sent from this address
|
|
14
14
|
*/
|
|
15
15
|
constructor(safeId, amount, from) {
|
|
16
|
-
super('ReflexerPayback', getAddr('ReflexerPayback'), ['uint256','uint256','address'], [safeId, amount, from]);
|
|
16
|
+
super('ReflexerPayback', getAddr('ReflexerPayback'), [['uint256','uint256','address']], [[safeId, amount, from]]);
|
|
17
|
+
|
|
18
|
+
this.mappableArgs = [
|
|
19
|
+
this.args[0][0],
|
|
20
|
+
this.args[0][1],
|
|
21
|
+
this.args[0][2],
|
|
22
|
+
];
|
|
17
23
|
}
|
|
18
24
|
|
|
19
25
|
async getAssetsToApprove() {
|
|
@@ -14,7 +14,14 @@ class ReflexerSupplyAction extends Action {
|
|
|
14
14
|
* @param from {EthAddress} Tokens will be supplied from this address
|
|
15
15
|
*/
|
|
16
16
|
constructor(safeId, amount, adapterAddr, from) {
|
|
17
|
-
super('ReflexerSupply', getAddr('ReflexerSupply'), ['uint256','uint256','address','address'], [safeId, amount, adapterAddr, from]);
|
|
17
|
+
super('ReflexerSupply', getAddr('ReflexerSupply'), [['uint256','uint256','address','address']], [[safeId, amount, adapterAddr, from]]);
|
|
18
|
+
|
|
19
|
+
this.mappableArgs = [
|
|
20
|
+
this.args[0][0],
|
|
21
|
+
this.args[0][1],
|
|
22
|
+
this.args[0][2],
|
|
23
|
+
this.args[0][3],
|
|
24
|
+
];
|
|
18
25
|
}
|
|
19
26
|
|
|
20
27
|
async getAssetsToApprove() {
|
|
@@ -15,7 +15,14 @@ class ReflexerWithdrawAction extends Action {
|
|
|
15
15
|
*/
|
|
16
16
|
constructor(safeId, amount, adapterAddr, to) {
|
|
17
17
|
requireAddress(to);
|
|
18
|
-
super('ReflexerWithdraw', getAddr('ReflexerWithdraw'), ['uint256','uint256','address','address'], [safeId, amount, adapterAddr, to]);
|
|
18
|
+
super('ReflexerWithdraw', getAddr('ReflexerWithdraw'), [['uint256','uint256','address','address']], [[safeId, amount, adapterAddr, to]]);
|
|
19
|
+
|
|
20
|
+
this.mappableArgs = [
|
|
21
|
+
this.args[0][0],
|
|
22
|
+
this.args[0][1],
|
|
23
|
+
this.args[0][2],
|
|
24
|
+
this.args[0][3],
|
|
25
|
+
];
|
|
19
26
|
}
|
|
20
27
|
}
|
|
21
28
|
|