@defisaver/sdk 0.2.12 → 0.2.13
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 +379 -21
- package/DEV.md +0 -298
- package/package.json +2 -2
- package/src/Action.js +3 -6
- package/src/actions/aave/AaveBorrowAction.js +2 -11
- package/src/actions/aave/AaveClaimStkAaveAction.js +5 -5
- package/src/actions/aave/AaveCollateralSwitchAction.js +4 -5
- package/src/actions/aave/AavePaybackAction.js +2 -11
- package/src/actions/aave/AaveSupplyAction.js +6 -6
- package/src/actions/aave/AaveWithdrawAction.js +1 -8
- package/src/actions/aaveV3/AaveV3ATokenPaybackAction.js +13 -13
- package/src/actions/aaveV3/AaveV3BorrowAction.js +16 -16
- package/src/actions/aaveV3/AaveV3ClaimRewardsAction.js +8 -8
- package/src/actions/aaveV3/AaveV3CollateralSwitchAction.js +9 -9
- package/src/actions/aaveV3/AaveV3PaybackAction.js +16 -16
- package/src/actions/aaveV3/AaveV3SetEModeAction.js +7 -7
- package/src/actions/aaveV3/AaveV3SupplyAction.js +17 -17
- package/src/actions/aaveV3/AaveV3SwapBorrowRateModeAction.js +8 -8
- package/src/actions/aaveV3/AaveV3WithdrawAction.js +11 -11
- package/src/actions/balancer/BalancerV2ClaimAction.js +10 -12
- package/src/actions/balancer/BalancerV2SupplyAction.js +14 -16
- package/src/actions/balancer/BalancerV2WithdrawAction.js +15 -17
- package/src/actions/basic/AutomationV2Unsub.js +3 -3
- package/src/actions/basic/ChangeProxyOwnerAction.js +2 -4
- package/src/actions/basic/GasFeeAction.js +6 -6
- package/src/actions/basic/PullTokenAction.js +3 -9
- package/src/actions/basic/SellAction.js +5 -6
- package/src/actions/basic/SendTokenAction.js +3 -9
- package/src/actions/basic/SendTokenAndUnwrapAction.js +30 -0
- package/src/actions/basic/SubInputsAction.js +3 -8
- package/src/actions/basic/SumInputsAction.js +3 -8
- package/src/actions/basic/ToggleSubAction.js +19 -0
- package/src/actions/basic/TokenBalanceAction.js +3 -3
- package/src/actions/basic/UnwrapEthAction.js +3 -8
- package/src/actions/basic/UpdateSubAction.js +19 -0
- package/src/actions/basic/WrapEthAction.js +5 -8
- package/src/actions/basic/index.js +6 -0
- package/src/actions/checkers/MakerRatioCheckAction.js +5 -5
- package/src/actions/compound/CompoundBorrowAction.js +1 -7
- package/src/actions/compound/CompoundClaimAction.js +3 -3
- package/src/actions/compound/CompoundCollateralSwitchAction.js +2 -4
- package/src/actions/compound/CompoundGetDebtAction.js +3 -3
- package/src/actions/compound/CompoundPaybackAction.js +1 -7
- package/src/actions/compound/CompoundSupplyAction.js +4 -4
- package/src/actions/compound/CompoundWithdrawAction.js +1 -7
- package/src/actions/convex/ConvexClaimAction.js +60 -0
- package/src/actions/convex/ConvexDepositAction.js +67 -0
- package/src/actions/convex/ConvexWithdrawAction.js +65 -0
- package/src/actions/convex/index.js +9 -0
- 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 +9 -9
- package/src/actions/curve/CurveStethPoolWithdrawAction.js +11 -9
- package/src/actions/curve/CurveSwapAction.js +15 -15
- package/src/actions/curve/CurveWithdrawAction.js +7 -7
- package/src/actions/dydx/DyDxWithdrawAction.js +1 -7
- package/src/actions/flashloan/AaveV2FlashLoanAction.js +2 -2
- package/src/actions/flashloan/AaveV3FlashLoanAction.js +2 -2
- package/src/actions/flashloan/BalancerFlashLoanAction.js +2 -2
- package/src/actions/flashloan/DyDxFlashLoanAction.js +5 -1
- package/src/actions/flashloan/MakerFlashLoanAction.js +2 -2
- 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 +2 -7
- package/src/actions/lido/LidoUnwrapAction.js +2 -7
- 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 +1 -8
- package/src/actions/maker/MakerGiveAction.js +4 -4
- package/src/actions/maker/MakerMergeAction.js +1 -7
- package/src/actions/maker/MakerOpenVaultAction.js +1 -6
- package/src/actions/maker/MakerPaybackAction.js +2 -9
- package/src/actions/maker/MakerRatioAction.js +1 -5
- package/src/actions/maker/MakerSupplyAction.js +1 -9
- package/src/actions/maker/MakerWithdrawAction.js +1 -9
- 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 +1 -7
- package/src/actions/reflexer/ReflexerNativeUniV2SaviourDepositAction.js +5 -5
- package/src/actions/reflexer/ReflexerNativeUniV2SaviourGetReservesAction.js +3 -8
- package/src/actions/reflexer/ReflexerNativeUniV2SaviourWithdrawAction.js +4 -9
- package/src/actions/reflexer/ReflexerOpenSafeAction.js +1 -5
- package/src/actions/reflexer/ReflexerPaybackAction.js +1 -7
- package/src/actions/reflexer/ReflexerSupplyAction.js +1 -8
- package/src/actions/reflexer/ReflexerWithdrawAction.js +1 -8
- package/src/actions/uniswap/UniswapSupplyAction.js +20 -22
- package/src/actions/uniswap/UniswapWithdrawAction.js +16 -18
- package/src/actions/uniswapV3/UniswapV3CollectAction.js +7 -9
- package/src/actions/uniswapV3/UniswapV3CreatePoolAction.js +20 -22
- package/src/actions/uniswapV3/UniswapV3MintAction.js +19 -21
- package/src/actions/uniswapV3/UniswapV3SupplyAction.js +17 -19
- package/src/actions/uniswapV3/UniswapV3WithdrawAction.js +12 -14
- package/src/actions/yearn/YearnSupplyAction.js +6 -6
- package/src/actions/yearn/YearnWithdrawAction.js +6 -6
- package/src/addresses.js +19 -12
- 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 +1 -5
- package/src/triggers/ReflexerRatioTrigger.js +1 -1
- package/src/triggers/TimestampTrigger.js +1 -1
- package/src/triggers/UniV3CurrentTickTrigger.js +1 -1
- package/src/utils/convex-utils.js +20 -0
- package/src/utils/convexPoolInfo.json +1039 -0
- package/src/utils/index.js +2 -0
- package/test/Action.js +2 -1
- package/test/Strategy.js +44 -0
- package/test/accessLists/access-lists.js +1 -2
- package/test/actions/maker/MakerPaybackAction.js +2 -2
|
@@ -9,21 +9,18 @@ class WrapEthAction extends ActionWithL2 {
|
|
|
9
9
|
* @param amount {string} Transfer amount
|
|
10
10
|
*/
|
|
11
11
|
constructor(amount) {
|
|
12
|
-
super("WrapEth", getAddr("WrapEth"), [
|
|
13
|
-
|
|
14
|
-
this.mappableArgs = [
|
|
15
|
-
this.args[0][0],
|
|
16
|
-
];
|
|
12
|
+
super("WrapEth", getAddr("WrapEth"), ["uint256"], [...arguments]);
|
|
17
13
|
}
|
|
18
14
|
|
|
19
15
|
async getEthValue() {
|
|
20
|
-
return this.args[0]
|
|
16
|
+
return this.args[0];
|
|
21
17
|
}
|
|
22
|
-
|
|
18
|
+
|
|
19
|
+
encodeInputs() {
|
|
23
20
|
// executeActionDirectL2
|
|
24
21
|
let encodedInput = "0x2895f3aa";
|
|
25
22
|
// amount
|
|
26
|
-
encodedInput = encodedInput.concat(this.numberToBytes32(this.args[0]
|
|
23
|
+
encodedInput = encodedInput.concat(this.numberToBytes32(this.args[0]));
|
|
27
24
|
}
|
|
28
25
|
}
|
|
29
26
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const SellAction = require('./SellAction');
|
|
2
2
|
const SendTokenAction = require('./SendTokenAction');
|
|
3
|
+
const SendTokenAndUnwrapAction = require('./SendTokenAndUnwrapAction');
|
|
3
4
|
const PullTokenAction = require('./PullTokenAction');
|
|
4
5
|
const WrapEthAction = require('./WrapEthAction');
|
|
5
6
|
const UnwrapEthAction = require('./UnwrapEthAction');
|
|
@@ -9,6 +10,8 @@ const ChangeProxyOwnerAction = require('./ChangeProxyOwnerAction');
|
|
|
9
10
|
const TokenBalanceAction = require('./TokenBalanceAction');
|
|
10
11
|
const AutomationV2Unsub = require('./AutomationV2Unsub');
|
|
11
12
|
const GasFeeAction = require('./GasFeeAction');
|
|
13
|
+
const UpdateSubAction = require('./UpdateSubAction');
|
|
14
|
+
const ToggleSubAction = require('./ToggleSubAction');
|
|
12
15
|
|
|
13
16
|
module.exports = {
|
|
14
17
|
SellAction,
|
|
@@ -22,4 +25,7 @@ module.exports = {
|
|
|
22
25
|
TokenBalanceAction,
|
|
23
26
|
AutomationV2Unsub,
|
|
24
27
|
GasFeeAction,
|
|
28
|
+
UpdateSubAction,
|
|
29
|
+
SendTokenAndUnwrapAction,
|
|
30
|
+
ToggleSubAction,
|
|
25
31
|
};
|
|
@@ -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"), [
|
|
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[
|
|
21
|
-
this.args[
|
|
22
|
-
this.args[
|
|
19
|
+
this.args[0],
|
|
20
|
+
this.args[2],
|
|
21
|
+
this.args[3],
|
|
22
|
+
this.args[4],
|
|
23
23
|
];
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -13,13 +13,7 @@ class CompoundBorrowAction extends Action {
|
|
|
13
13
|
*/
|
|
14
14
|
constructor(cTokenAddr, amount, to) {
|
|
15
15
|
requireAddress(to);
|
|
16
|
-
super('CompBorrow', getAddr('CompBorrow'), [
|
|
17
|
-
|
|
18
|
-
this.mappableArgs = [
|
|
19
|
-
this.args[0][0],
|
|
20
|
-
this.args[0][1],
|
|
21
|
-
this.args[0][2],
|
|
22
|
-
];
|
|
16
|
+
super('CompBorrow', getAddr('CompBorrow'), ['address','uint256','address'], [...arguments]);
|
|
23
17
|
}
|
|
24
18
|
}
|
|
25
19
|
|
|
@@ -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'), [
|
|
17
|
+
super('CompClaim', getAddr('CompClaim'), ["address[]", "address[]", "address", "address"], [...arguments]);
|
|
18
18
|
|
|
19
19
|
this.mappableArgs = [
|
|
20
|
-
this.args[
|
|
21
|
-
this.args[
|
|
20
|
+
this.args[2],
|
|
21
|
+
this.args[3],
|
|
22
22
|
];
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -10,11 +10,9 @@ class CompoundCollateralSwitchAction extends Action {
|
|
|
10
10
|
super(
|
|
11
11
|
'CompCollateralSwitch',
|
|
12
12
|
getAddr('CompCollateralSwitch'),
|
|
13
|
-
[
|
|
14
|
-
[
|
|
13
|
+
['address[]', 'bool[]'],
|
|
14
|
+
[...arguments],
|
|
15
15
|
);
|
|
16
|
-
this.mappableArgs = [
|
|
17
|
-
];
|
|
18
16
|
}
|
|
19
17
|
}
|
|
20
18
|
|
|
@@ -13,13 +13,7 @@ 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'), [
|
|
17
|
-
this.mappableArgs = [
|
|
18
|
-
this.args[0][0],
|
|
19
|
-
this.args[0][1],
|
|
20
|
-
this.args[0][2],
|
|
21
|
-
this.args[0][3],
|
|
22
|
-
];
|
|
16
|
+
super('CompPayback', getAddr('CompPayback'), ['address', 'uint256', 'address', 'address'], [cTokenAddr, amount, from, onBehalf]);
|
|
23
17
|
}
|
|
24
18
|
|
|
25
19
|
async getAssetsToApprove() {
|
|
@@ -13,12 +13,12 @@ class CompoundSupplyAction extends Action {
|
|
|
13
13
|
* @param enableAsColl {boolean} If we need to enable asset as collateral
|
|
14
14
|
*/
|
|
15
15
|
constructor(cTokenAddr, amount, from, enableAsColl = true) {
|
|
16
|
-
super('CompSupply', getAddr('CompSupply'), [
|
|
16
|
+
super('CompSupply', getAddr('CompSupply'), ['address','uint256','address','bool'], [cTokenAddr, amount, from, enableAsColl]);
|
|
17
17
|
|
|
18
18
|
this.mappableArgs = [
|
|
19
|
-
this.args[0]
|
|
20
|
-
this.args[
|
|
21
|
-
this.args[
|
|
19
|
+
this.args[0],
|
|
20
|
+
this.args[1],
|
|
21
|
+
this.args[2],
|
|
22
22
|
];
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -13,13 +13,7 @@ class CompoundWithdrawAction extends Action {
|
|
|
13
13
|
*/
|
|
14
14
|
constructor(cTokenAddr, amount, to) {
|
|
15
15
|
requireAddress(to);
|
|
16
|
-
super('CompWithdraw', getAddr('CompWithdraw'), [
|
|
17
|
-
|
|
18
|
-
this.mappableArgs = [
|
|
19
|
-
this.args[0][0],
|
|
20
|
-
this.args[0][1],
|
|
21
|
-
this.args[0][2],
|
|
22
|
-
];
|
|
16
|
+
super('CompWithdraw', getAddr('CompWithdraw'), ['address','uint256','address'], [...arguments]);
|
|
23
17
|
}
|
|
24
18
|
}
|
|
25
19
|
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const Action = require('../../Action');
|
|
2
|
+
const { getAddr } = require('../../addresses');
|
|
3
|
+
const { getConvexPool } = require('../../utils/convex-utils');
|
|
4
|
+
const { requireAddress } = require('../../utils/general');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* ConvexClaimAction - Claims convex rewards
|
|
8
|
+
*/
|
|
9
|
+
class ConvexClaimAction extends Action {
|
|
10
|
+
/**
|
|
11
|
+
* @param {address} from
|
|
12
|
+
* @param {address} to
|
|
13
|
+
* @param {address} curveLp
|
|
14
|
+
*/
|
|
15
|
+
constructor(
|
|
16
|
+
from,
|
|
17
|
+
to,
|
|
18
|
+
curveLp,
|
|
19
|
+
) {
|
|
20
|
+
requireAddress(to);
|
|
21
|
+
const { crvRewards } = getConvexPool(curveLp);
|
|
22
|
+
super(
|
|
23
|
+
'ConvexClaim',
|
|
24
|
+
getAddr('ConvexClaim'),
|
|
25
|
+
[
|
|
26
|
+
'address',
|
|
27
|
+
'address',
|
|
28
|
+
'address',
|
|
29
|
+
],
|
|
30
|
+
[
|
|
31
|
+
from,
|
|
32
|
+
to,
|
|
33
|
+
crvRewards,
|
|
34
|
+
],
|
|
35
|
+
).curveLp = curveLp;
|
|
36
|
+
|
|
37
|
+
this.mappableArgs = [
|
|
38
|
+
this.args[0],
|
|
39
|
+
this.args[1],
|
|
40
|
+
this.args[2],
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async getAssetsToApprove() {
|
|
45
|
+
const pool = getConvexPool(this.curveLp);
|
|
46
|
+
const owner = this.args[0];
|
|
47
|
+
|
|
48
|
+
return [
|
|
49
|
+
getAddr('CrvToken'),
|
|
50
|
+
getAddr('CvxToken'),
|
|
51
|
+
].concat(
|
|
52
|
+
pool.extraRewards.map((e) => e.token),
|
|
53
|
+
).reduce((acc, e) => {
|
|
54
|
+
if (!acc.includes(e.toLowerCase())) acc.push(e.toLowerCase());
|
|
55
|
+
return acc;
|
|
56
|
+
}, []).map((e) => Object({asset: e, owner}));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
module.exports = ConvexClaimAction;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
const Action = require('../../Action');
|
|
2
|
+
const { getAddr } = require('../../addresses');
|
|
3
|
+
const { DepositOption, getConvexPool } = require('../../utils/convex-utils');
|
|
4
|
+
const { requireAddress } = require('../../utils/general');
|
|
5
|
+
/**
|
|
6
|
+
* ConvexDepositAction - Deposits (wraps) Curve LP into convex, stakes wrapped LP, or does both
|
|
7
|
+
*/
|
|
8
|
+
class ConvexDepositAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param {address} from
|
|
11
|
+
* @param {address} to
|
|
12
|
+
* @param {address} curveLp
|
|
13
|
+
* @param {uint256} amount
|
|
14
|
+
* @param {uint8} option
|
|
15
|
+
*/
|
|
16
|
+
constructor(
|
|
17
|
+
from,
|
|
18
|
+
to,
|
|
19
|
+
curveLp,
|
|
20
|
+
amount,
|
|
21
|
+
option,
|
|
22
|
+
) {
|
|
23
|
+
requireAddress(to);
|
|
24
|
+
const { pid } = getConvexPool(curveLp);
|
|
25
|
+
super(
|
|
26
|
+
'ConvexDeposit',
|
|
27
|
+
getAddr('ConvexDeposit'),
|
|
28
|
+
[
|
|
29
|
+
'address',
|
|
30
|
+
'address',
|
|
31
|
+
'uint256',
|
|
32
|
+
'uint256',
|
|
33
|
+
'uint8',
|
|
34
|
+
],
|
|
35
|
+
[
|
|
36
|
+
from,
|
|
37
|
+
to,
|
|
38
|
+
pid,
|
|
39
|
+
amount,
|
|
40
|
+
option,
|
|
41
|
+
],
|
|
42
|
+
).curveLp = curveLp;
|
|
43
|
+
|
|
44
|
+
this.mappableArgs = [
|
|
45
|
+
this.args[0],
|
|
46
|
+
this.args[1],
|
|
47
|
+
this.args[2],
|
|
48
|
+
this.args[3],
|
|
49
|
+
this.args[4],
|
|
50
|
+
];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async getAssetsToApprove() {
|
|
54
|
+
const pool = getConvexPool(this.curveLp);
|
|
55
|
+
const assetToPull = {
|
|
56
|
+
[DepositOption.WRAP]: pool.lpToken,
|
|
57
|
+
[DepositOption.STAKE]: pool.token,
|
|
58
|
+
[DepositOption.WRAP_AND_STAKE]: pool.lpToken,
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return [{
|
|
62
|
+
asset: assetToPull[this.args[4]], owner: this.args[0],
|
|
63
|
+
}];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
module.exports = ConvexDepositAction;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
const Action = require('../../Action');
|
|
2
|
+
const { getAddr } = require('../../addresses');
|
|
3
|
+
const { getConvexPool, WithdrawOption } = require('../../utils/convex-utils');
|
|
4
|
+
const { requireAddress } = require('../../utils/general');
|
|
5
|
+
/**
|
|
6
|
+
* ConvexWithdrawAction - Withdraws (unwraps) Curve LP from convex, unstakes wrapped LP, or does both
|
|
7
|
+
*/
|
|
8
|
+
class ConvexWithdrawAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param {address} from
|
|
11
|
+
* @param {address} to
|
|
12
|
+
* @param {address} curveLp
|
|
13
|
+
* @param {uint256} amount
|
|
14
|
+
* @param {uint8} option
|
|
15
|
+
*/
|
|
16
|
+
constructor(
|
|
17
|
+
from,
|
|
18
|
+
to,
|
|
19
|
+
curveLp,
|
|
20
|
+
amount,
|
|
21
|
+
option,
|
|
22
|
+
) {
|
|
23
|
+
requireAddress(to);
|
|
24
|
+
const { pid } = getConvexPool(curveLp);
|
|
25
|
+
super(
|
|
26
|
+
'ConvexWithdraw',
|
|
27
|
+
getAddr('ConvexWithdraw'),
|
|
28
|
+
[
|
|
29
|
+
'address',
|
|
30
|
+
'address',
|
|
31
|
+
'uint256',
|
|
32
|
+
'uint256',
|
|
33
|
+
'uint8',
|
|
34
|
+
],
|
|
35
|
+
[
|
|
36
|
+
from,
|
|
37
|
+
to,
|
|
38
|
+
pid,
|
|
39
|
+
amount,
|
|
40
|
+
option,
|
|
41
|
+
],
|
|
42
|
+
).curveLp = curveLp;
|
|
43
|
+
|
|
44
|
+
this.mappableArgs = [
|
|
45
|
+
this.args[0],
|
|
46
|
+
this.args[1],
|
|
47
|
+
this.args[2],
|
|
48
|
+
this.args[3],
|
|
49
|
+
this.args[4],
|
|
50
|
+
];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async getAssetsToApprove() {
|
|
54
|
+
const pool = getConvexPool(this.curveLp);
|
|
55
|
+
const owner = this.args[0];
|
|
56
|
+
|
|
57
|
+
if (this.args[4] === WithdrawOption.UNWRAP) {
|
|
58
|
+
return [{asset: pool.token, owner}];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
module.exports = ConvexWithdrawAction;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const ConvexDepositAction = require('./ConvexDepositAction');
|
|
2
|
+
const ConvexWithdrawAction = require('./ConvexWithdrawAction');
|
|
3
|
+
const ConvexClaimAction = require('./ConvexClaimAction');
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
ConvexDepositAction,
|
|
7
|
+
ConvexWithdrawAction,
|
|
8
|
+
ConvexClaimAction,
|
|
9
|
+
}
|
|
@@ -18,12 +18,12 @@ class CurveClaimFeesAction extends Action {
|
|
|
18
18
|
requireAddress(receiver);
|
|
19
19
|
super('CurveClaimFeesAction',
|
|
20
20
|
getAddr('CurveClaimFeesAction'),
|
|
21
|
-
[
|
|
22
|
-
[
|
|
21
|
+
['address', 'address'],
|
|
22
|
+
[...arguments]);
|
|
23
23
|
|
|
24
24
|
this.mappableArgs = [
|
|
25
|
-
this.args[0]
|
|
26
|
-
this.args[
|
|
25
|
+
this.args[0],
|
|
26
|
+
this.args[1],
|
|
27
27
|
];
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -31,19 +31,19 @@ class CurveDepositAction extends Action {
|
|
|
31
31
|
requireAddress(receiver);
|
|
32
32
|
super('CurveDeposit',
|
|
33
33
|
getAddr('CurveDeposit'),
|
|
34
|
-
[
|
|
35
|
-
[
|
|
34
|
+
['address', 'address', 'address', 'address', 'bytes4', 'uint256', 'uint256[]', 'address[]', 'bool'],
|
|
35
|
+
[...arguments]);
|
|
36
36
|
|
|
37
37
|
this.mappableArgs = [
|
|
38
|
-
this.args[0]
|
|
39
|
-
this.args[
|
|
40
|
-
this.args[
|
|
41
|
-
...this.args[
|
|
38
|
+
this.args[0],
|
|
39
|
+
this.args[1],
|
|
40
|
+
this.args[5],
|
|
41
|
+
...this.args[6],
|
|
42
42
|
];
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
async getAssetsToApprove() {
|
|
46
|
-
return this.args[
|
|
46
|
+
return this.args[7].map(_asset => Object({ asset: _asset, owner: this.args[0] }));
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -17,19 +17,19 @@ class CurveGaugeDepositAction extends Action {
|
|
|
17
17
|
requireAddress(onBehalfOf);
|
|
18
18
|
super('CurveGaugeDeposit',
|
|
19
19
|
getAddr('CurveGaugeDeposit'),
|
|
20
|
-
[
|
|
21
|
-
[
|
|
20
|
+
['address', 'address', 'address', 'address', 'uint256'],
|
|
21
|
+
[...arguments],
|
|
22
22
|
);
|
|
23
23
|
|
|
24
24
|
this.mappableArgs = [
|
|
25
|
-
this.args[
|
|
26
|
-
this.args[
|
|
27
|
-
this.args[
|
|
25
|
+
this.args[2],
|
|
26
|
+
this.args[3],
|
|
27
|
+
this.args[4],
|
|
28
28
|
];
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
async getAssetsToApprove() {
|
|
32
|
-
return { asset: this.args[
|
|
32
|
+
return { asset: this.args[1], owner: this.args[2] };
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -14,13 +14,13 @@ class CurveGaugeWithdrawAction extends Action {
|
|
|
14
14
|
requireAddress(receiver);
|
|
15
15
|
super('CurveGaugeWithdraw',
|
|
16
16
|
getAddr('CurveGaugeWithdraw'),
|
|
17
|
-
[
|
|
18
|
-
[
|
|
17
|
+
['address', 'address', 'address', 'uint256'],
|
|
18
|
+
[...arguments],
|
|
19
19
|
);
|
|
20
20
|
|
|
21
21
|
this.mappableArgs = [
|
|
22
|
-
this.args[
|
|
23
|
-
this.args[
|
|
22
|
+
this.args[2],
|
|
23
|
+
this.args[3],
|
|
24
24
|
];
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -12,12 +12,12 @@ class CurveMintCrvAction extends Action {
|
|
|
12
12
|
requireAddress(receiver);
|
|
13
13
|
super('CurveMintCrv',
|
|
14
14
|
getAddr('CurveMintCrv'),
|
|
15
|
-
[
|
|
16
|
-
[
|
|
15
|
+
['address[8]', 'address'],
|
|
16
|
+
[...arguments],
|
|
17
17
|
);
|
|
18
18
|
|
|
19
19
|
this.mappableArgs = [
|
|
20
|
-
this.args[
|
|
20
|
+
this.args[8],
|
|
21
21
|
];
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -9,8 +9,8 @@ class CurveStethPoolDepositAction extends Action {
|
|
|
9
9
|
/**
|
|
10
10
|
* @param from {address}
|
|
11
11
|
* @param to {address}
|
|
12
|
-
* @param amounts {
|
|
13
|
-
* @param minMintAmount {
|
|
12
|
+
* @param amounts {string[]}
|
|
13
|
+
* @param minMintAmount {string}
|
|
14
14
|
*/
|
|
15
15
|
constructor(
|
|
16
16
|
from,
|
|
@@ -23,16 +23,16 @@ class CurveStethPoolDepositAction extends Action {
|
|
|
23
23
|
super(
|
|
24
24
|
'CurveStethPoolDeposit',
|
|
25
25
|
getAddr('CurveStethPoolDeposit'),
|
|
26
|
-
[
|
|
27
|
-
[
|
|
26
|
+
['address', 'address', 'uint256[2]', 'uint256'],
|
|
27
|
+
[...arguments],
|
|
28
28
|
);
|
|
29
29
|
|
|
30
30
|
this.mappableArgs = [
|
|
31
|
-
this.args[0]
|
|
32
|
-
this.args[
|
|
33
|
-
this.args[
|
|
34
|
-
this.args[
|
|
35
|
-
this.args[
|
|
31
|
+
this.args[0],
|
|
32
|
+
this.args[1],
|
|
33
|
+
this.args[2][0],
|
|
34
|
+
this.args[2][1],
|
|
35
|
+
this.args[3],
|
|
36
36
|
];
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -9,30 +9,32 @@ class CurveStethPoolWithdrawAction extends Action {
|
|
|
9
9
|
/**
|
|
10
10
|
* @param from {address}
|
|
11
11
|
* @param to {address}
|
|
12
|
-
* @param amounts {
|
|
13
|
-
* @param maxBurnAmount {
|
|
12
|
+
* @param amounts {string[]}
|
|
13
|
+
* @param maxBurnAmount {string}
|
|
14
|
+
* @param returnValue {string}
|
|
14
15
|
*/
|
|
15
16
|
constructor(
|
|
16
17
|
from,
|
|
17
18
|
to,
|
|
18
19
|
amounts,
|
|
19
20
|
maxBurnAmount,
|
|
21
|
+
returnValue,
|
|
20
22
|
) {
|
|
21
23
|
requireAddress(to);
|
|
22
24
|
|
|
23
25
|
super(
|
|
24
26
|
'CurveStethPoolWithdraw',
|
|
25
27
|
getAddr('CurveStethPoolWithdraw'),
|
|
26
|
-
[
|
|
27
|
-
[
|
|
28
|
+
['address', 'address', 'uint256[2]', 'uint256', 'uint256'],
|
|
29
|
+
[...arguments],
|
|
28
30
|
);
|
|
29
31
|
|
|
30
32
|
this.mappableArgs = [
|
|
31
|
-
this.args[0]
|
|
32
|
-
this.args[
|
|
33
|
-
this.args[
|
|
34
|
-
this.args[
|
|
35
|
-
this.args[
|
|
33
|
+
this.args[0],
|
|
34
|
+
this.args[1],
|
|
35
|
+
this.args[2][0],
|
|
36
|
+
this.args[2][1],
|
|
37
|
+
this.args[3],
|
|
36
38
|
];
|
|
37
39
|
}
|
|
38
40
|
}
|
|
@@ -6,33 +6,33 @@ const { getAddr } = require('../../addresses');
|
|
|
6
6
|
class CurveSwapAction extends Action {
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
* @param {EthAddress} sender
|
|
11
|
-
* @param {EthAddress} receiver
|
|
12
|
-
* @param {EthAddress} pool
|
|
13
|
-
* @param {EthAddress} tokenA
|
|
14
|
-
* @param {EthAddress} tokenB
|
|
15
|
-
* @param {string} amount
|
|
16
|
-
* @param {string} expected
|
|
9
|
+
*
|
|
10
|
+
* @param {EthAddress} sender
|
|
11
|
+
* @param {EthAddress} receiver
|
|
12
|
+
* @param {EthAddress} pool
|
|
13
|
+
* @param {EthAddress} tokenA
|
|
14
|
+
* @param {EthAddress} tokenB
|
|
15
|
+
* @param {string} amount
|
|
16
|
+
* @param {string} expected
|
|
17
17
|
*/
|
|
18
18
|
constructor(sender, receiver, pool, tokenA, tokenB, amount, expected) {
|
|
19
19
|
requireAddress(sender);
|
|
20
20
|
requireAddress(receiver);
|
|
21
21
|
super('CurveSwap',
|
|
22
22
|
getAddr('CurveSwap'),
|
|
23
|
-
[
|
|
24
|
-
[
|
|
23
|
+
['address', 'address', 'address', 'address', 'address', 'uint256', 'uint256'],
|
|
24
|
+
[...arguments]);
|
|
25
25
|
|
|
26
26
|
this.mappableArgs = [
|
|
27
|
-
this.args[0]
|
|
28
|
-
this.args[
|
|
29
|
-
this.args[
|
|
30
|
-
this.args[
|
|
27
|
+
this.args[0],
|
|
28
|
+
this.args[1],
|
|
29
|
+
this.args[5],
|
|
30
|
+
this.args[6],
|
|
31
31
|
];
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
async getAssetsToApprove() {
|
|
35
|
-
return [{ asset: this.args[
|
|
35
|
+
return [{ asset: this.args[3], owner: this.args[0] }];
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -34,19 +34,19 @@ class CurveWithdrawAction extends Action {
|
|
|
34
34
|
requireAddress(receiver);
|
|
35
35
|
super('CurveWithdrawAction',
|
|
36
36
|
getAddr('CurveWithdrawAction'),
|
|
37
|
-
[
|
|
38
|
-
[
|
|
37
|
+
['address', 'address', 'address', 'address', 'bytes4', 'uint256', 'uint256[]', 'address[]', 'bool', 'bool'],
|
|
38
|
+
[...arguments]);
|
|
39
39
|
|
|
40
40
|
this.mappableArgs = [
|
|
41
|
-
this.args[0]
|
|
42
|
-
this.args[
|
|
43
|
-
this.args[
|
|
44
|
-
...this.args[
|
|
41
|
+
this.args[0],
|
|
42
|
+
this.args[1],
|
|
43
|
+
this.args[5],
|
|
44
|
+
...this.args[6],
|
|
45
45
|
];
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
async getAssetsToApprove() {
|
|
49
|
-
return { asset: this.args[
|
|
49
|
+
return { asset: this.args[3], owner: this.args[0] };
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -13,13 +13,7 @@ class DyDxWithdrawAction extends Action {
|
|
|
13
13
|
*/
|
|
14
14
|
constructor(tokenAddr, amount, to) {
|
|
15
15
|
requireAddress(to);
|
|
16
|
-
super('DyDxWithdraw', getAddr('DyDxWithdraw'), [
|
|
17
|
-
|
|
18
|
-
this.mappableArgs = [
|
|
19
|
-
this.args[0][0],
|
|
20
|
-
this.args[0][1],
|
|
21
|
-
this.args[0][2],
|
|
22
|
-
];
|
|
16
|
+
super('DyDxWithdraw', getAddr('DyDxWithdraw'), ['address','uint256','address'], [...arguments]);
|
|
23
17
|
}
|
|
24
18
|
}
|
|
25
19
|
|