@defisaver/sdk 0.2.2 → 0.2.5
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/index.js +11 -2
- package/package.json +1 -1
- package/src/Action.js +21 -9
- package/src/ActionWithL2.js +36 -0
- package/src/actions/aave/AaveBorrowAction.js +11 -2
- package/src/actions/aave/AaveClaimStkAaveAction.js +5 -5
- package/src/actions/aave/AaveCollateralSwitchAction.js +5 -4
- package/src/actions/aave/AavePaybackAction.js +11 -2
- package/src/actions/aave/AaveSupplyAction.js +6 -6
- package/src/actions/aave/AaveWithdrawAction.js +8 -1
- package/src/actions/aaveV3/AaveV3ATokenPaybackAction.js +58 -0
- package/src/actions/aaveV3/AaveV3BorrowAction.js +59 -0
- package/src/actions/aaveV3/AaveV3ClaimRewardsAction.js +45 -0
- package/src/actions/aaveV3/AaveV3CollateralSwitchAction.js +45 -0
- package/src/actions/aaveV3/AaveV3PaybackAction.js +68 -0
- package/src/actions/aaveV3/AaveV3SetEModeAction.js +40 -0
- package/src/actions/aaveV3/AaveV3SupplyAction.js +69 -0
- package/src/actions/aaveV3/AaveV3SwapBorrowRateModeAction.js +43 -0
- package/src/actions/aaveV3/AaveV3WithdrawAction.js +46 -0
- package/src/actions/aaveV3/index.js +21 -0
- package/src/actions/balancer/BalancerV2ClaimAction.js +12 -10
- package/src/actions/balancer/BalancerV2SupplyAction.js +16 -14
- package/src/actions/balancer/BalancerV2WithdrawAction.js +17 -15
- package/src/actions/basic/AutomationV2Unsub.js +3 -3
- package/src/actions/basic/ChangeProxyOwnerAction.js +4 -2
- package/src/actions/basic/GasFeeAction.js +6 -6
- package/src/actions/basic/PullTokenAction.js +9 -3
- package/src/actions/basic/SellAction.js +6 -5
- package/src/actions/basic/SendTokenAction.js +9 -4
- package/src/actions/basic/SubInputsAction.js +8 -3
- package/src/actions/basic/SumInputsAction.js +8 -3
- package/src/actions/basic/TokenBalanceAction.js +3 -3
- package/src/actions/basic/UnwrapEthAction.js +18 -5
- package/src/actions/basic/WrapEthAction.js +15 -5
- package/src/actions/basic/index.js +0 -4
- package/src/actions/checkers/MakerRatioCheckAction.js +5 -5
- package/src/actions/compound/CompoundBorrowAction.js +7 -1
- package/src/actions/compound/CompoundClaimAction.js +3 -3
- package/src/actions/compound/CompoundCollateralSwitchAction.js +4 -2
- package/src/actions/compound/CompoundGetDebtAction.js +3 -3
- package/src/actions/compound/CompoundPaybackAction.js +7 -1
- package/src/actions/compound/CompoundSupplyAction.js +4 -4
- package/src/actions/compound/CompoundWithdrawAction.js +7 -1
- package/src/actions/curve/CurveClaimFeesAction.js +4 -4
- package/src/actions/curve/CurveDepositAction.js +7 -7
- package/src/actions/curve/CurveGaugeDepositAction.js +6 -6
- package/src/actions/curve/CurveGaugeWithdrawAction.js +4 -4
- package/src/actions/curve/CurveMintCrvAction.js +3 -3
- package/src/actions/curve/CurveStethPoolDepositAction.js +7 -7
- package/src/actions/curve/CurveStethPoolWithdrawAction.js +7 -7
- package/src/actions/curve/CurveSwapAction.js +15 -15
- package/src/actions/curve/CurveWithdrawAction.js +7 -7
- package/src/actions/dydx/DyDxWithdrawAction.js +7 -1
- package/src/actions/flashloan/AaveV2FlashLoanAction.js +2 -2
- package/src/actions/flashloan/AaveV3FlashLoanAction.js +26 -0
- package/src/actions/flashloan/AaveV3FlashLoanPaybackAction.js +17 -0
- package/src/actions/flashloan/BalancerFlashLoanAction.js +2 -2
- package/src/actions/flashloan/DyDxFlashLoanAction.js +1 -5
- package/src/actions/flashloan/MakerFlashLoanAction.js +2 -2
- package/src/actions/flashloan/index.js +4 -0
- package/src/actions/guni/GUniDeposit.js +9 -9
- package/src/actions/guni/GUniWithdraw.js +5 -5
- package/src/actions/index.js +2 -0
- package/src/actions/insta/InstPullTokensAction.js +4 -4
- package/src/actions/lido/LidoStakeAction.js +7 -2
- package/src/actions/lido/LidoUnwrapAction.js +7 -2
- package/src/actions/lido/LidoWrapAction.js +7 -7
- package/src/actions/liquity/LiquityBorrowAction.js +5 -5
- package/src/actions/liquity/LiquityClaimAction.js +3 -3
- package/src/actions/liquity/LiquityCloseAction.js +4 -4
- package/src/actions/liquity/LiquityEthGainToTroveAction.js +3 -3
- package/src/actions/liquity/LiquityOpenAction.js +8 -8
- package/src/actions/liquity/LiquityPaybackAction.js +5 -5
- package/src/actions/liquity/LiquityRedeemAction.js +7 -7
- package/src/actions/liquity/LiquitySPDepositAction.js +7 -7
- package/src/actions/liquity/LiquitySPWithdrawAction.js +6 -6
- package/src/actions/liquity/LiquityStakeAction.js +7 -7
- package/src/actions/liquity/LiquitySupplyAction.js +5 -5
- package/src/actions/liquity/LiquityUnstakeAction.js +6 -6
- package/src/actions/liquity/LiquityWithdrawAction.js +4 -4
- package/src/actions/maker/MakerClaimAction.js +4 -4
- package/src/actions/maker/MakerGenerateAction.js +8 -1
- package/src/actions/maker/MakerGiveAction.js +4 -4
- package/src/actions/maker/MakerMergeAction.js +7 -1
- package/src/actions/maker/MakerOpenVaultAction.js +6 -1
- package/src/actions/maker/MakerPaybackAction.js +9 -2
- package/src/actions/maker/MakerRatioAction.js +5 -1
- package/src/actions/maker/MakerSupplyAction.js +9 -1
- package/src/actions/maker/MakerWithdrawAction.js +9 -1
- package/src/actions/mstable/MStableClaimAction.js +4 -4
- package/src/actions/mstable/MStableDepositAction.js +16 -16
- package/src/actions/mstable/MStableWithdrawAction.js +15 -15
- package/src/actions/rari/RariDepositAction.js +5 -5
- package/src/actions/rari/RariWithdrawAction.js +6 -6
- package/src/actions/reflexer/ReflexerGenerateAction.js +7 -1
- package/src/actions/reflexer/ReflexerNativeUniV2SaviourDepositAction.js +5 -5
- package/src/actions/reflexer/ReflexerNativeUniV2SaviourGetReservesAction.js +8 -3
- package/src/actions/reflexer/ReflexerNativeUniV2SaviourWithdrawAction.js +9 -4
- 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/actions/uniswap/UniswapSupplyAction.js +22 -20
- package/src/actions/uniswap/UniswapWithdrawAction.js +18 -16
- package/src/actions/uniswapV3/UniswapV3CollectAction.js +9 -7
- package/src/actions/uniswapV3/UniswapV3CreatePoolAction.js +22 -20
- package/src/actions/uniswapV3/UniswapV3MintAction.js +21 -19
- package/src/actions/uniswapV3/UniswapV3SupplyAction.js +19 -17
- package/src/actions/uniswapV3/UniswapV3WithdrawAction.js +14 -12
- package/src/actions/yearn/YearnSupplyAction.js +6 -6
- package/src/actions/yearn/YearnWithdrawAction.js +6 -6
- package/src/addresses.js +187 -143
- package/src/config.js +83 -0
- package/src/triggers/ChainLinkPriceTrigger.js +2 -2
- package/src/triggers/CompoundRatioTrigger.js +1 -1
- package/src/triggers/GasPriceTrigger.js +1 -1
- package/src/triggers/LiquityRatioTrigger.js +2 -2
- package/src/triggers/MakerRatioTrigger.js +5 -1
- package/src/triggers/ReflexerRatioTrigger.js +1 -1
- package/src/triggers/TimestampTrigger.js +1 -1
- package/src/triggers/UniV3CurrentTickTrigger.js +1 -1
- package/src/types.js +33 -0
- package/test/Action.js +1 -2
- package/test/accessLists/access-lists.js +2 -1
- package/test/actions/maker/MakerPaybackAction.js +2 -2
- package/test/index.js +4 -1
- package/src/actions/basic/SendTokenAndUnwrapAction.js +0 -30
- package/src/actions/basic/UpdateSubAction.js +0 -19
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const ActionWithL2 = require("../../ActionWithL2");
|
|
2
|
+
const { getAddr } = require('../../addresses.js');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* AaveV3SwapBorrowRateModeAction - Swaps proxy positions borrow rate mode between stable and variable.
|
|
6
|
+
*/
|
|
7
|
+
class AaveV3SwapBorrowRateModeAction extends ActionWithL2 {
|
|
8
|
+
/**
|
|
9
|
+
* @param asset {EthAddress} address of the underlying asset
|
|
10
|
+
* @param rateMode {string} rate mode the user is swapping from.[Stable: 1, Variable: 2]
|
|
11
|
+
* @param useDefaultMarket {boolean} If this is true it defaults to the hardcoded market in contract
|
|
12
|
+
* @param market {EthAddress} Address provider for specific market
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
constructor(asset, rateMode, useDefaultMarket, market) {
|
|
16
|
+
super('AaveV3SwapBorrowRateMode', getAddr('AaveV3SwapBorrowRateMode'),
|
|
17
|
+
[['address','uint256','bool','address']],
|
|
18
|
+
[[asset, rateMode, useDefaultMarket, market]]
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
this.mappableArgs = [
|
|
22
|
+
this.args[0][0],
|
|
23
|
+
this.args[0][3],
|
|
24
|
+
];
|
|
25
|
+
}
|
|
26
|
+
encodeInputs() {
|
|
27
|
+
// executeActionDirectL2
|
|
28
|
+
let encodedInput = "0x2895f3aa";
|
|
29
|
+
// asset
|
|
30
|
+
encodedInput = encodedInput.concat(this.addressToBytes20(this.args[0][0]));
|
|
31
|
+
// rateMode
|
|
32
|
+
encodedInput = encodedInput.concat(this.numberToBytes32(this.args[0][1]));
|
|
33
|
+
// useOnDefaultMarket
|
|
34
|
+
encodedInput = encodedInput.concat(this.boolToBytes1(this.args[0][2]))
|
|
35
|
+
if (!this.args[0][2]){
|
|
36
|
+
// market
|
|
37
|
+
encodedInput = encodedInput.concat(this.addressToBytes20(this.args[0][3]));
|
|
38
|
+
}
|
|
39
|
+
return encodedInput;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
module.exports = AaveV3SwapBorrowRateModeAction;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const ActionWithL2 = require("../../ActionWithL2");
|
|
2
|
+
const { getAddr } = require('../../addresses.js');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* AaveV3WithdrawAction - Withdraw a previously supplied token from a position in AaveV3
|
|
6
|
+
*/
|
|
7
|
+
class AaveV3WithdrawAction extends ActionWithL2 {
|
|
8
|
+
/**
|
|
9
|
+
* @param assetId {number} The id of the token to be deposited
|
|
10
|
+
* @param useDefaultMarket {boolean} If this is true it defaults to the hardcoded market in contract
|
|
11
|
+
* @param amount {string} Amount of tokens to be withdrawn -> send type(uint).max for whole amount
|
|
12
|
+
* @param to {EthAddress} Where the withdrawn tokens will be sent
|
|
13
|
+
* @param market {EthAddress} Address provider for specific market
|
|
14
|
+
*/
|
|
15
|
+
constructor(assetId, useDefaultMarket, amount, to, market) {
|
|
16
|
+
super('AaveV3Withdraw', getAddr('AaveV3Withdraw'),
|
|
17
|
+
[['uint16','bool','uint256','address','address']],
|
|
18
|
+
[[assetId, useDefaultMarket, amount, to, market]]
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
this.mappableArgs = [
|
|
22
|
+
this.args[0][2],
|
|
23
|
+
this.args[0][3],
|
|
24
|
+
this.args[0][4],
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
encodeInputs() {
|
|
28
|
+
// executeActionDirectL2
|
|
29
|
+
let encodedInput = "0x2895f3aa";
|
|
30
|
+
// assetId
|
|
31
|
+
encodedInput = encodedInput.concat(this.numberToBytes2(this.args[0][0]));
|
|
32
|
+
// useOnDefaultMarket
|
|
33
|
+
encodedInput = encodedInput.concat(this.boolToBytes1(this.args[0][1]))
|
|
34
|
+
// amount
|
|
35
|
+
encodedInput = encodedInput.concat(this.numberToBytes32(this.args[0][2]));
|
|
36
|
+
// from
|
|
37
|
+
encodedInput = encodedInput.concat(this.addressToBytes20(this.args[0][3]));
|
|
38
|
+
if (!this.args[0][1]){
|
|
39
|
+
// market
|
|
40
|
+
encodedInput = encodedInput.concat(this.addressToBytes20(this.args[0][4]));
|
|
41
|
+
}
|
|
42
|
+
return encodedInput;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
module.exports = AaveV3WithdrawAction;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const AaveV3SupplyAction = require('./AaveV3SupplyAction');
|
|
2
|
+
const AaveV3BorrowAction = require('./AaveV3BorrowAction');
|
|
3
|
+
const AaveV3PaybackAction = require('./AaveV3PaybackAction');
|
|
4
|
+
const AaveV3WithdrawAction = require('./AaveV3WithdrawAction');
|
|
5
|
+
const AaveV3SetEModeAction = require('./AaveV3SetEModeAction');
|
|
6
|
+
const AaveV3ATokenPaybackAction = require('./AaveV3ATokenPaybackAction');
|
|
7
|
+
const AaveV3CollateralSwitchAction = require('./AaveV3CollateralSwitchAction');
|
|
8
|
+
const AaveV3ClaimRewardsAction = require('./AaveV3ClaimRewardsAction');
|
|
9
|
+
const AaveV3SwapBorrowRateModeAction = require('./AaveV3SwapBorrowRateModeAction');
|
|
10
|
+
|
|
11
|
+
module.exports = {
|
|
12
|
+
AaveV3SupplyAction,
|
|
13
|
+
AaveV3BorrowAction,
|
|
14
|
+
AaveV3PaybackAction,
|
|
15
|
+
AaveV3WithdrawAction,
|
|
16
|
+
AaveV3SetEModeAction,
|
|
17
|
+
AaveV3ATokenPaybackAction,
|
|
18
|
+
AaveV3CollateralSwitchAction,
|
|
19
|
+
AaveV3ClaimRewardsAction,
|
|
20
|
+
AaveV3SwapBorrowRateModeAction,
|
|
21
|
+
}
|
|
@@ -17,27 +17,29 @@ class BalancerV2ClaimAction extends Action {
|
|
|
17
17
|
'BalancerV2Claim',
|
|
18
18
|
getAddr('BalancerV2Claim'),
|
|
19
19
|
[
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
[
|
|
21
|
+
"address",
|
|
22
|
+
"address",
|
|
23
|
+
"uint256[]",
|
|
24
|
+
"uint256[]",
|
|
25
|
+
"bytes32[][]",
|
|
26
|
+
],
|
|
25
27
|
],
|
|
26
|
-
[liquidityProvider, to, weeks, balances, merkleProofs]
|
|
28
|
+
[[liquidityProvider, to, weeks, balances, merkleProofs]]
|
|
27
29
|
);
|
|
28
30
|
|
|
29
31
|
this.mappableArgs = [
|
|
30
|
-
this.args[0],
|
|
31
|
-
this.args[1],
|
|
32
|
+
this.args[0][0],
|
|
33
|
+
this.args[0][1],
|
|
32
34
|
];
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
async getAssetsToApprove() {
|
|
36
38
|
|
|
37
39
|
const approveArr = [];
|
|
38
|
-
if (this.args[0] !== this.args[1]){
|
|
40
|
+
if (this.args[0][0] !== this.args[0][1]){
|
|
39
41
|
const tokenAddress = getAddr('BalancerToken');
|
|
40
|
-
approveArr.push({asset: tokenAddress, owner: this.args[0]});
|
|
42
|
+
approveArr.push({asset: tokenAddress, owner: this.args[0][0]});
|
|
41
43
|
}
|
|
42
44
|
return approveArr;
|
|
43
45
|
}
|
|
@@ -18,30 +18,32 @@ class BalancerV2SupplyAction extends Action {
|
|
|
18
18
|
'BalancerV2Supply',
|
|
19
19
|
getAddr('BalancerV2Supply'),
|
|
20
20
|
[
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
[
|
|
22
|
+
"bytes32",
|
|
23
|
+
"address",
|
|
24
|
+
"address",
|
|
25
|
+
"address[]",
|
|
26
|
+
"uint256[]",
|
|
27
|
+
"bytes",
|
|
28
|
+
],
|
|
27
29
|
],
|
|
28
|
-
[poolId, from, to, tokens, maxAmountsIn, userData]
|
|
30
|
+
[[poolId, from, to, tokens, maxAmountsIn, userData]]
|
|
29
31
|
);
|
|
30
32
|
|
|
31
33
|
this.mappableArgs = [
|
|
32
|
-
this.args[1],
|
|
33
|
-
this.args[2],
|
|
34
|
+
this.args[0][1],
|
|
35
|
+
this.args[0][2],
|
|
34
36
|
];
|
|
35
|
-
for (let i = 0; i < this.args[4].length; i++){
|
|
36
|
-
this.mappableArgs.push(this.args[4][i]);
|
|
37
|
+
for (let i = 0; i < this.args[0][4].length; i++){
|
|
38
|
+
this.mappableArgs.push(this.args[0][4][i]);
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
async getAssetsToApprove() {
|
|
41
43
|
const approveArr = [];
|
|
42
|
-
const tokens = this.args[3];
|
|
43
|
-
tokens.forEach(token => approveArr.push({asset: token, owner: this.args[1], specialApproveLabel: 'balancer'}));
|
|
44
|
-
|
|
44
|
+
const tokens = this.args[0][3];
|
|
45
|
+
tokens.forEach(token => approveArr.push({asset: token, owner: this.args[0][1], specialApproveLabel: 'balancer'}));
|
|
46
|
+
|
|
45
47
|
return approveArr;
|
|
46
48
|
}
|
|
47
49
|
}
|
|
@@ -19,34 +19,36 @@ class BalancerV2WithdrawAction extends Action {
|
|
|
19
19
|
'BalancerV2Withdraw',
|
|
20
20
|
getAddr('BalancerV2Withdraw'),
|
|
21
21
|
[
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
[
|
|
23
|
+
"bytes32",
|
|
24
|
+
"address",
|
|
25
|
+
"address",
|
|
26
|
+
"uint256",
|
|
27
|
+
"address[]",
|
|
28
|
+
"uint256[]",
|
|
29
|
+
"bytes",
|
|
30
|
+
],
|
|
29
31
|
],
|
|
30
|
-
[poolId, from, to, lpTokenAmount, tokens, minAmountsOut, userData]
|
|
32
|
+
[[poolId, from, to, lpTokenAmount, tokens, minAmountsOut, userData]]
|
|
31
33
|
);
|
|
32
34
|
|
|
33
35
|
this.from = from;
|
|
34
36
|
|
|
35
37
|
this.mappableArgs = [
|
|
36
|
-
this.args[1],
|
|
37
|
-
this.args[2],
|
|
38
|
-
this.args[3],
|
|
38
|
+
this.args[0][1],
|
|
39
|
+
this.args[0][2],
|
|
40
|
+
this.args[0][3],
|
|
39
41
|
];
|
|
40
42
|
|
|
41
|
-
for (let i = 0; i < this.args[5].length; i++){
|
|
42
|
-
this.mappableArgs.push(this.args[5][i]);
|
|
43
|
+
for (let i = 0; i < this.args[0][5].length; i++){
|
|
44
|
+
this.mappableArgs.push(this.args[0][5][i]);
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
async getAssetsToApprove() {
|
|
47
49
|
const approveArr = [];
|
|
48
|
-
const token = this.args[0].slice(0,42);
|
|
49
|
-
approveArr.push({asset: token, owner: this.args[1], specialApproveLabel: 'balancer'});
|
|
50
|
+
const token = this.args[0][0].slice(0,42);
|
|
51
|
+
approveArr.push({asset: token, owner: this.args[0][1], specialApproveLabel: 'balancer'});
|
|
50
52
|
return approveArr;
|
|
51
53
|
}
|
|
52
54
|
}
|
|
@@ -6,10 +6,10 @@ class AutomationV2Unsub extends Action {
|
|
|
6
6
|
super(
|
|
7
7
|
'AutomationV2Unsub',
|
|
8
8
|
getAddr('AutomationV2Unsub'),
|
|
9
|
-
["uint256", "uint256"],
|
|
10
|
-
[cdpId, protocol]
|
|
9
|
+
[["uint256", "uint256"]],
|
|
10
|
+
[[cdpId, protocol]]
|
|
11
11
|
);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
module.exports = AutomationV2Unsub;
|
|
15
|
+
module.exports = AutomationV2Unsub;
|
|
@@ -9,8 +9,10 @@ class ChangeProxyOwnerAction extends Action {
|
|
|
9
9
|
* @param newOwner {Address} Address of new owner
|
|
10
10
|
*/
|
|
11
11
|
constructor(newOwner) {
|
|
12
|
-
super("ChangeProxyOwner", getAddr("ChangeProxyOwner"), ["address"], [...arguments]);
|
|
13
|
-
|
|
12
|
+
super("ChangeProxyOwner", getAddr("ChangeProxyOwner"), [["address"]], [[...arguments]]);
|
|
13
|
+
|
|
14
|
+
this.mappableArgs = [this.args[0][0]];
|
|
15
|
+
}
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
module.exports = ChangeProxyOwnerAction;
|
|
@@ -11,17 +11,17 @@ class GasFeeAction extends Action {
|
|
|
11
11
|
constructor(gasStart, feeToken, availableAmount, dfsFeeDivider = 2000) {
|
|
12
12
|
super("GasFeeTaker",
|
|
13
13
|
getAddr("GasFeeTaker"),
|
|
14
|
-
["uint256", "address", "uint256", "uint256"],
|
|
15
|
-
[gasStart, feeToken, availableAmount, dfsFeeDivider],
|
|
14
|
+
[["uint256", "address", "uint256", "uint256"]],
|
|
15
|
+
[[gasStart, feeToken, availableAmount, dfsFeeDivider]],
|
|
16
16
|
);
|
|
17
17
|
|
|
18
18
|
this.mappableArgs = [
|
|
19
|
-
this.args[1],
|
|
20
|
-
this.args[2],
|
|
21
|
-
this.args[3],
|
|
19
|
+
this.args[0][1],
|
|
20
|
+
this.args[0][2],
|
|
21
|
+
this.args[0][3],
|
|
22
22
|
];
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
module.exports = GasFeeAction;
|
|
27
|
+
module.exports = GasFeeAction;
|
|
@@ -17,13 +17,19 @@ class PullTokenAction extends Action {
|
|
|
17
17
|
super(
|
|
18
18
|
'PullToken',
|
|
19
19
|
getAddr('PullToken'),
|
|
20
|
-
[
|
|
20
|
+
[[
|
|
21
21
|
"address",
|
|
22
22
|
"address",
|
|
23
23
|
"uint",
|
|
24
|
-
],
|
|
25
|
-
[...arguments]
|
|
24
|
+
]],
|
|
25
|
+
[[...arguments]]
|
|
26
26
|
);
|
|
27
|
+
|
|
28
|
+
this.mappableArgs = [
|
|
29
|
+
this.args[0][0],
|
|
30
|
+
this.args[0][1],
|
|
31
|
+
this.args[0][2],
|
|
32
|
+
];
|
|
27
33
|
}
|
|
28
34
|
|
|
29
35
|
async getAssetsToApprove() {
|
|
@@ -19,22 +19,23 @@ class SellAction extends Action {
|
|
|
19
19
|
super(
|
|
20
20
|
'DFSSell',
|
|
21
21
|
getAddr('DFSSell'),
|
|
22
|
-
[
|
|
22
|
+
[[
|
|
23
23
|
["address","address","uint256","uint256","uint256","uint256","address","address","bytes",["address","address","address","uint256","uint256","bytes"]],
|
|
24
24
|
"address",
|
|
25
25
|
"address",
|
|
26
|
+
]
|
|
26
27
|
],
|
|
27
|
-
[exchangeOrder, from, to]
|
|
28
|
+
[[exchangeOrder, from, to]]
|
|
28
29
|
);
|
|
29
30
|
|
|
30
31
|
this.protocolFee = protocolFee;
|
|
31
32
|
|
|
32
33
|
this.mappableArgs = [
|
|
33
|
-
this.args[0][0],
|
|
34
|
+
this.args[0][0][0],
|
|
35
|
+
this.args[0][0][1],
|
|
36
|
+
this.args[0][0][2],
|
|
34
37
|
this.args[0][1],
|
|
35
38
|
this.args[0][2],
|
|
36
|
-
this.args[1],
|
|
37
|
-
this.args[2],
|
|
38
39
|
];
|
|
39
40
|
}
|
|
40
41
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const Action = require("../../Action");
|
|
2
2
|
const {requireAddress} = require("../../utils/general");
|
|
3
|
-
const {getAssetInfoByAddress} = require("@defisaver/tokens");
|
|
4
3
|
const { getAddr } = require('../../addresses.js');
|
|
5
4
|
|
|
6
5
|
/**
|
|
@@ -17,13 +16,19 @@ class SendTokenAction extends Action {
|
|
|
17
16
|
super(
|
|
18
17
|
'SendToken',
|
|
19
18
|
getAddr('SendToken'),
|
|
20
|
-
[
|
|
19
|
+
[[
|
|
21
20
|
"address",
|
|
22
21
|
"address",
|
|
23
22
|
"uint",
|
|
24
|
-
],
|
|
25
|
-
[...arguments]
|
|
23
|
+
]],
|
|
24
|
+
[[...arguments]]
|
|
26
25
|
);
|
|
26
|
+
|
|
27
|
+
this.mappableArgs = [
|
|
28
|
+
this.args[0][0],
|
|
29
|
+
this.args[0][1],
|
|
30
|
+
this.args[0][2],
|
|
31
|
+
];
|
|
27
32
|
}
|
|
28
33
|
}
|
|
29
34
|
|
|
@@ -9,12 +9,17 @@ class SubInputsAction extends Action {
|
|
|
9
9
|
super(
|
|
10
10
|
'SubInputs',
|
|
11
11
|
getAddr('SubInputs'),
|
|
12
|
-
[
|
|
12
|
+
[[
|
|
13
13
|
"uint",
|
|
14
14
|
"uint",
|
|
15
|
-
],
|
|
16
|
-
[...arguments]
|
|
15
|
+
]],
|
|
16
|
+
[[...arguments]]
|
|
17
17
|
);
|
|
18
|
+
|
|
19
|
+
this.mappableArgs = [
|
|
20
|
+
this.args[0][0],
|
|
21
|
+
this.args[0][1],
|
|
22
|
+
];
|
|
18
23
|
}
|
|
19
24
|
}
|
|
20
25
|
|
|
@@ -9,12 +9,17 @@ class SumInputsAction extends Action {
|
|
|
9
9
|
super(
|
|
10
10
|
'SumInputs',
|
|
11
11
|
getAddr('SumInputs'),
|
|
12
|
-
[
|
|
12
|
+
[[
|
|
13
13
|
"uint",
|
|
14
14
|
"uint",
|
|
15
|
-
],
|
|
16
|
-
[...arguments]
|
|
15
|
+
]],
|
|
16
|
+
[[...arguments]]
|
|
17
17
|
);
|
|
18
|
+
|
|
19
|
+
this.mappableArgs = [
|
|
20
|
+
this.args[0][0],
|
|
21
|
+
this.args[0][1],
|
|
22
|
+
];
|
|
18
23
|
}
|
|
19
24
|
}
|
|
20
25
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const
|
|
1
|
+
const ActionWithL2 = require("../../ActionWithL2");
|
|
2
2
|
const {requireAddress} = require("../../utils/general");
|
|
3
3
|
const {getAddr} = require('../../addresses.js');
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Unwraps a specified amount of WETH from the proxy
|
|
7
7
|
*/
|
|
8
|
-
class UnwrapEthAction extends
|
|
8
|
+
class UnwrapEthAction extends ActionWithL2 {
|
|
9
9
|
/**
|
|
10
10
|
* @param amount {string} Token address
|
|
11
11
|
* @param to {string} Transfer recipient
|
|
@@ -15,12 +15,25 @@ class UnwrapEthAction extends Action {
|
|
|
15
15
|
super(
|
|
16
16
|
'UnwrapEth',
|
|
17
17
|
getAddr('UnwrapEth'),
|
|
18
|
-
[
|
|
18
|
+
[[
|
|
19
19
|
"uint256",
|
|
20
20
|
"address"
|
|
21
|
-
],
|
|
22
|
-
[...arguments]
|
|
21
|
+
]],
|
|
22
|
+
[[...arguments]]
|
|
23
23
|
);
|
|
24
|
+
|
|
25
|
+
this.mappableArgs = [
|
|
26
|
+
this.args[0][0],
|
|
27
|
+
this.args[0][1],
|
|
28
|
+
];
|
|
29
|
+
}
|
|
30
|
+
encodeInputs(){
|
|
31
|
+
// executeActionDirectL2
|
|
32
|
+
let encodedInput = "0x2895f3aa";
|
|
33
|
+
// amount
|
|
34
|
+
encodedInput = encodedInput.concat(this.numberToBytes32(this.args[0][0]));
|
|
35
|
+
// to
|
|
36
|
+
encodedInput = encodedInput.concat(this.addressToBytes20(this.args[0][1]));
|
|
24
37
|
}
|
|
25
38
|
}
|
|
26
39
|
|
|
@@ -1,19 +1,29 @@
|
|
|
1
|
-
const
|
|
2
|
-
const {getAddr} = require("../../addresses.js");
|
|
1
|
+
const ActionWithL2 = require("../../ActionWithL2");
|
|
2
|
+
const { getAddr } = require("../../addresses.js");
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Wraps a specified amount of ETH from the wallet to WETH on the recipe
|
|
6
6
|
*/
|
|
7
|
-
class WrapEthAction extends
|
|
7
|
+
class WrapEthAction extends ActionWithL2 {
|
|
8
8
|
/**
|
|
9
9
|
* @param amount {string} Transfer amount
|
|
10
10
|
*/
|
|
11
11
|
constructor(amount) {
|
|
12
|
-
super("WrapEth", getAddr("WrapEth"), ["uint256"], [...arguments]);
|
|
12
|
+
super("WrapEth", getAddr("WrapEth"), [["uint256"]], [[...arguments]]);
|
|
13
|
+
|
|
14
|
+
this.mappableArgs = [
|
|
15
|
+
this.args[0][0],
|
|
16
|
+
];
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
async getEthValue() {
|
|
16
|
-
return this.args[0];
|
|
20
|
+
return this.args[0][0];
|
|
21
|
+
}
|
|
22
|
+
encodeInputs(){
|
|
23
|
+
// executeActionDirectL2
|
|
24
|
+
let encodedInput = "0x2895f3aa";
|
|
25
|
+
// amount
|
|
26
|
+
encodedInput = encodedInput.concat(this.numberToBytes32(this.args[0][0]));
|
|
17
27
|
}
|
|
18
28
|
}
|
|
19
29
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const SellAction = require('./SellAction');
|
|
2
2
|
const SendTokenAction = require('./SendTokenAction');
|
|
3
|
-
const SendTokenAndUnwrapAction = require('./SendTokenAndUnwrapAction');
|
|
4
3
|
const PullTokenAction = require('./PullTokenAction');
|
|
5
4
|
const WrapEthAction = require('./WrapEthAction');
|
|
6
5
|
const UnwrapEthAction = require('./UnwrapEthAction');
|
|
@@ -10,7 +9,6 @@ const ChangeProxyOwnerAction = require('./ChangeProxyOwnerAction');
|
|
|
10
9
|
const TokenBalanceAction = require('./TokenBalanceAction');
|
|
11
10
|
const AutomationV2Unsub = require('./AutomationV2Unsub');
|
|
12
11
|
const GasFeeAction = require('./GasFeeAction');
|
|
13
|
-
const UpdateSubAction = require('./UpdateSubAction');
|
|
14
12
|
|
|
15
13
|
module.exports = {
|
|
16
14
|
SellAction,
|
|
@@ -24,6 +22,4 @@ module.exports = {
|
|
|
24
22
|
TokenBalanceAction,
|
|
25
23
|
AutomationV2Unsub,
|
|
26
24
|
GasFeeAction,
|
|
27
|
-
UpdateSubAction,
|
|
28
|
-
SendTokenAndUnwrapAction,
|
|
29
25
|
};
|
|
@@ -13,13 +13,13 @@ class MakerRatioCheckAction extends Action {
|
|
|
13
13
|
* @param startRatioIndex {uint256} Index in returnValues where ratio before actions is stored
|
|
14
14
|
*/
|
|
15
15
|
constructor(ratioState, checkTarget, targetRatio, vaultId, startRatioIndex) {
|
|
16
|
-
super("McdRatioCheck", getAddr("McdRatioCheck"), ["uint8","bool","uint256","uint256","uint256"], [ratioState, checkTarget, targetRatio, vaultId, startRatioIndex]);
|
|
16
|
+
super("McdRatioCheck", getAddr("McdRatioCheck"), [["uint8","bool","uint256","uint256","uint256"]], [[ratioState, checkTarget, targetRatio, vaultId, startRatioIndex]]);
|
|
17
17
|
|
|
18
18
|
this.mappableArgs = [
|
|
19
|
-
this.args[0],
|
|
20
|
-
this.args[2],
|
|
21
|
-
this.args[3],
|
|
22
|
-
this.args[4],
|
|
19
|
+
this.args[0][0],
|
|
20
|
+
this.args[0][2],
|
|
21
|
+
this.args[0][3],
|
|
22
|
+
this.args[0][4],
|
|
23
23
|
];
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -13,7 +13,13 @@ class CompoundBorrowAction extends Action {
|
|
|
13
13
|
*/
|
|
14
14
|
constructor(cTokenAddr, amount, to) {
|
|
15
15
|
requireAddress(to);
|
|
16
|
-
super('CompBorrow', getAddr('CompBorrow'), ['address','uint256','address'], [...arguments]);
|
|
16
|
+
super('CompBorrow', getAddr('CompBorrow'), [['address','uint256','address']], [[...arguments]]);
|
|
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
|
|
|
@@ -14,11 +14,11 @@ class CompoundClaimAction extends Action {
|
|
|
14
14
|
*/
|
|
15
15
|
constructor(cSupplyAddresses, cBorrowAddresses, from, to) {
|
|
16
16
|
requireAddress(to);
|
|
17
|
-
super('CompClaim', getAddr('CompClaim'), ["address[]", "address[]", "address", "address"], [...arguments]);
|
|
17
|
+
super('CompClaim', getAddr('CompClaim'), [["address[]", "address[]", "address", "address"]], [[...arguments]]);
|
|
18
18
|
|
|
19
19
|
this.mappableArgs = [
|
|
20
|
-
this.args[2],
|
|
21
|
-
this.args[3],
|
|
20
|
+
this.args[0][2],
|
|
21
|
+
this.args[0][3],
|
|
22
22
|
];
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -10,9 +10,11 @@ class CompoundCollateralSwitchAction extends Action {
|
|
|
10
10
|
super(
|
|
11
11
|
'CompCollateralSwitch',
|
|
12
12
|
getAddr('CompCollateralSwitch'),
|
|
13
|
-
['address[]', 'bool[]'],
|
|
14
|
-
[...arguments],
|
|
13
|
+
[['address[]', 'bool[]']],
|
|
14
|
+
[[...arguments]],
|
|
15
15
|
);
|
|
16
|
+
this.mappableArgs = [
|
|
17
|
+
];
|
|
16
18
|
}
|
|
17
19
|
}
|
|
18
20
|
|
|
@@ -13,7 +13,13 @@ class CompoundPaybackAction extends Action {
|
|
|
13
13
|
* @param onBehalf {EthAddress} Defaults to DsProxy address if 0x0
|
|
14
14
|
*/
|
|
15
15
|
constructor(cTokenAddr, amount, from, onBehalf = getAddr('Empty')) {
|
|
16
|
-
super('CompPayback', getAddr('CompPayback'), ['address', 'uint256', 'address', 'address'], [cTokenAddr, amount, from, onBehalf]);
|
|
16
|
+
super('CompPayback', getAddr('CompPayback'), [['address', 'uint256', 'address', 'address']], [[cTokenAddr, amount, from, onBehalf]]);
|
|
17
|
+
this.mappableArgs = [
|
|
18
|
+
this.args[0][0],
|
|
19
|
+
this.args[0][1],
|
|
20
|
+
this.args[0][2],
|
|
21
|
+
this.args[0][3],
|
|
22
|
+
];
|
|
17
23
|
}
|
|
18
24
|
|
|
19
25
|
async getAssetsToApprove() {
|