@defisaver/sdk 1.2.15-dev-allocator-2 → 1.2.16-dev-liquity-v2-1
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/actions/basic/SendTokensAction.d.ts +1 -1
- package/esm/src/actions/basic/SendTokensAction.js +1 -1
- package/esm/src/actions/basic/SendTokensAndUnwrapAction.d.ts +15 -0
- package/esm/src/actions/basic/SendTokensAndUnwrapAction.js +31 -0
- package/esm/src/actions/basic/index.d.ts +1 -0
- package/esm/src/actions/basic/index.js +1 -0
- package/esm/src/actions/checkers/LiquityV2RatioCheckAction.d.ts +16 -0
- package/esm/src/actions/checkers/LiquityV2RatioCheckAction.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/actions/liquityV2/LiquityV2AdjustAction.d.ts +21 -0
- package/esm/src/actions/liquityV2/LiquityV2AdjustAction.js +54 -0
- package/esm/src/actions/liquityV2/LiquityV2AdjustInterestRateAction.d.ts +18 -0
- package/esm/src/actions/liquityV2/LiquityV2AdjustInterestRateAction.js +42 -0
- package/esm/src/actions/liquityV2/LiquityV2AdjustZombieTroveAction.d.ts +23 -0
- package/esm/src/actions/liquityV2/LiquityV2AdjustZombieTroveAction.js +62 -0
- package/esm/src/actions/liquityV2/LiquityV2BorrowAction.d.ts +17 -0
- package/esm/src/actions/liquityV2/LiquityV2BorrowAction.js +38 -0
- package/esm/src/actions/liquityV2/LiquityV2ClaimAction.d.ts +14 -0
- package/esm/src/actions/liquityV2/LiquityV2ClaimAction.js +26 -0
- package/esm/src/actions/liquityV2/LiquityV2CloseAction.d.ts +20 -0
- package/esm/src/actions/liquityV2/LiquityV2CloseAction.js +49 -0
- package/esm/src/actions/liquityV2/LiquityV2OpenAction.d.ts +29 -0
- package/esm/src/actions/liquityV2/LiquityV2OpenAction.js +86 -0
- package/esm/src/actions/liquityV2/LiquityV2PaybackAction.d.ts +20 -0
- package/esm/src/actions/liquityV2/LiquityV2PaybackAction.js +49 -0
- package/esm/src/actions/liquityV2/LiquityV2SPClaimCollAction.d.ts +14 -0
- package/esm/src/actions/liquityV2/LiquityV2SPClaimCollAction.js +26 -0
- package/esm/src/actions/liquityV2/LiquityV2SPDepositAction.d.ts +22 -0
- package/esm/src/actions/liquityV2/LiquityV2SPDepositAction.js +57 -0
- package/esm/src/actions/liquityV2/LiquityV2SPWithdrawAction.d.ts +17 -0
- package/esm/src/actions/liquityV2/LiquityV2SPWithdrawAction.js +38 -0
- package/esm/src/actions/liquityV2/LiquityV2SupplyAction.d.ts +22 -0
- package/esm/src/actions/liquityV2/LiquityV2SupplyAction.js +50 -0
- package/esm/src/actions/liquityV2/LiquityV2WithdrawAction.d.ts +16 -0
- package/esm/src/actions/liquityV2/LiquityV2WithdrawAction.js +34 -0
- package/esm/src/actions/liquityV2/index.d.ts +13 -0
- package/esm/src/actions/liquityV2/index.js +13 -0
- package/esm/src/actions/morpho-blue/MorphoBlueReallocateLiquidityAction.js +1 -1
- package/esm/src/addresses.d.ts +54 -2
- package/esm/src/addresses.js +16 -0
- package/esm/src/index.d.ts +216 -8
- package/esm/src/triggers/ClosePriceTrigger.d.ts +10 -0
- package/esm/src/triggers/ClosePriceTrigger.js +12 -0
- package/esm/src/triggers/LiquityRatioTrigger.js +1 -1
- package/esm/src/triggers/LiquityV2RatioTrigger.d.ts +8 -0
- package/esm/src/triggers/LiquityV2RatioTrigger.js +10 -0
- package/esm/src/triggers/index.d.ts +2 -0
- package/esm/src/triggers/index.js +2 -0
- package/package.json +2 -2
- package/src/actions/basic/SendTokensAction.ts +1 -1
- package/src/actions/basic/SendTokensAndUnwrapAction.ts +38 -0
- package/src/actions/basic/index.ts +2 -1
- package/src/actions/checkers/LiquityV2RatioCheckAction.ts +32 -0
- package/src/actions/checkers/index.ts +2 -1
- package/src/actions/index.ts +2 -0
- package/src/actions/liquityV2/LiquityV2AdjustAction.ts +73 -0
- package/src/actions/liquityV2/LiquityV2AdjustInterestRateAction.ts +57 -0
- package/src/actions/liquityV2/LiquityV2AdjustZombieTroveAction.ts +82 -0
- package/src/actions/liquityV2/LiquityV2BorrowAction.ts +52 -0
- package/src/actions/liquityV2/LiquityV2ClaimAction.ts +37 -0
- package/src/actions/liquityV2/LiquityV2CloseAction.ts +53 -0
- package/src/actions/liquityV2/LiquityV2OpenAction.ts +101 -0
- package/src/actions/liquityV2/LiquityV2PaybackAction.ts +52 -0
- package/src/actions/liquityV2/LiquityV2SPClaimCollAction.ts +37 -0
- package/src/actions/liquityV2/LiquityV2SPDepositAction.ts +62 -0
- package/src/actions/liquityV2/LiquityV2SPWithdrawAction.ts +52 -0
- package/src/actions/liquityV2/LiquityV2SupplyAction.ts +57 -0
- package/src/actions/liquityV2/LiquityV2WithdrawAction.ts +47 -0
- package/src/actions/liquityV2/index.ts +13 -0
- package/src/actions/morpho-blue/MorphoBlueReallocateLiquidityAction.ts +1 -1
- package/src/addresses.ts +18 -0
- package/src/triggers/ClosePriceTrigger.ts +19 -0
- package/src/triggers/LiquityRatioTrigger.ts +1 -1
- package/src/triggers/LiquityV2RatioTrigger.ts +17 -0
- package/src/triggers/index.ts +2 -0
- package/test/actions/basic/SendTokensAndUnwrapAction.js +73 -0
- package/umd/index.js +1261 -571
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { getAssetInfo } from '@defisaver/tokens';
|
|
2
|
+
import { Action } from '../../Action';
|
|
3
|
+
import { getAddr } from '../../addresses';
|
|
4
|
+
import { EthAddress, uint256, uint8 } from '../../types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* LiquityV2AdjustAction - Adjusts a trove's collateral and/or debt
|
|
8
|
+
*
|
|
9
|
+
* @category LiquityV2
|
|
10
|
+
*/
|
|
11
|
+
export class LiquityV2AdjustAction extends Action {
|
|
12
|
+
/**
|
|
13
|
+
* @param market liquity address registry for the market
|
|
14
|
+
* @param from address from which to take the collateral or pay debt
|
|
15
|
+
* @param to address to which to send the collateral or borrowed debt
|
|
16
|
+
* @param troveId id of the trove being adjusted
|
|
17
|
+
* @param collAmount collateral amount to supply/withdraw
|
|
18
|
+
* @param debtAmount debt amount to borrow/payback
|
|
19
|
+
* @param maxUpfrontFee maximum upfront fee user is willing to pay
|
|
20
|
+
* @param collAction specify if collateral is supplied or withdrawn
|
|
21
|
+
* @param debtAction specify if debt is borrowed or paid back
|
|
22
|
+
*/
|
|
23
|
+
constructor(
|
|
24
|
+
market: EthAddress,
|
|
25
|
+
from: EthAddress,
|
|
26
|
+
to: EthAddress,
|
|
27
|
+
troveId: uint256,
|
|
28
|
+
collAmount: uint256,
|
|
29
|
+
debtAmount: uint256,
|
|
30
|
+
maxUpfrontFee: uint256,
|
|
31
|
+
collAction: uint8,
|
|
32
|
+
debtAction: uint8,
|
|
33
|
+
) {
|
|
34
|
+
super(
|
|
35
|
+
'LiquityV2Adjust',
|
|
36
|
+
getAddr('LiquityV2Adjust'),
|
|
37
|
+
[
|
|
38
|
+
'address',
|
|
39
|
+
'address',
|
|
40
|
+
'address',
|
|
41
|
+
'uint256',
|
|
42
|
+
'uint256',
|
|
43
|
+
'uint256',
|
|
44
|
+
'uint256',
|
|
45
|
+
'uint8',
|
|
46
|
+
'uint8',
|
|
47
|
+
],
|
|
48
|
+
[
|
|
49
|
+
market,
|
|
50
|
+
from,
|
|
51
|
+
to,
|
|
52
|
+
troveId,
|
|
53
|
+
collAmount,
|
|
54
|
+
debtAmount,
|
|
55
|
+
maxUpfrontFee,
|
|
56
|
+
collAction,
|
|
57
|
+
debtAction,
|
|
58
|
+
],
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
this.mappableArgs = [
|
|
62
|
+
this.args[0],
|
|
63
|
+
this.args[1],
|
|
64
|
+
this.args[2],
|
|
65
|
+
this.args[3],
|
|
66
|
+
this.args[4],
|
|
67
|
+
this.args[5],
|
|
68
|
+
this.args[6],
|
|
69
|
+
this.args[7],
|
|
70
|
+
this.args[8],
|
|
71
|
+
];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, uint256 } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* LiquityV2AdjustInterestRateAction - Adjusts the interest rate for a specific trove
|
|
7
|
+
*
|
|
8
|
+
* @category LiquityV2
|
|
9
|
+
*/
|
|
10
|
+
export class LiquityV2AdjustInterestRateAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param market liquity address registry for the market
|
|
13
|
+
* @param troveId id of the trove to adjust the interest rate for
|
|
14
|
+
* @param newAnnualInterestRate the new annual interest rate
|
|
15
|
+
* @param upperHint upper hint for trove positioning
|
|
16
|
+
* @param lowerHint lower hint for trove positioning
|
|
17
|
+
* @param maxUpfrontFee maximum upfront fee the user is willing to pay
|
|
18
|
+
*/
|
|
19
|
+
constructor(
|
|
20
|
+
market: EthAddress,
|
|
21
|
+
troveId: uint256,
|
|
22
|
+
newAnnualInterestRate: uint256,
|
|
23
|
+
upperHint: uint256,
|
|
24
|
+
lowerHint: uint256,
|
|
25
|
+
maxUpfrontFee: uint256,
|
|
26
|
+
) {
|
|
27
|
+
super(
|
|
28
|
+
'LiquityV2AdjustInterestRate',
|
|
29
|
+
getAddr('LiquityV2AdjustInterestRate'),
|
|
30
|
+
[
|
|
31
|
+
'address',
|
|
32
|
+
'uint256',
|
|
33
|
+
'uint256',
|
|
34
|
+
'uint256',
|
|
35
|
+
'uint256',
|
|
36
|
+
'uint256',
|
|
37
|
+
],
|
|
38
|
+
[
|
|
39
|
+
market,
|
|
40
|
+
troveId,
|
|
41
|
+
newAnnualInterestRate,
|
|
42
|
+
upperHint,
|
|
43
|
+
lowerHint,
|
|
44
|
+
maxUpfrontFee,
|
|
45
|
+
],
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
this.mappableArgs = [
|
|
49
|
+
this.args[0],
|
|
50
|
+
this.args[1],
|
|
51
|
+
this.args[2],
|
|
52
|
+
this.args[3],
|
|
53
|
+
this.args[4],
|
|
54
|
+
this.args[5],
|
|
55
|
+
];
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, uint256, uint8 } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* LiquityV2AdjustZombieTroveAction - Adjusts a trove's collateral and/or debt for a zombie trove
|
|
7
|
+
*
|
|
8
|
+
* @category LiquityV2
|
|
9
|
+
*/
|
|
10
|
+
export class LiquityV2AdjustZombieTroveAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param market liquity address registry for the market
|
|
13
|
+
* @param from address from which to take the collateral or pay debt
|
|
14
|
+
* @param to address to which to send the collateral or borrowed debt
|
|
15
|
+
* @param troveId id of the trove being adjusted
|
|
16
|
+
* @param collAmount collateral amount to supply/withdraw
|
|
17
|
+
* @param debtAmount debt amount to borrow/payback
|
|
18
|
+
* @param upperHint upper hint for the trove insertion
|
|
19
|
+
* @param lowerHint lower hint for the trove insertion
|
|
20
|
+
* @param maxUpfrontFee maximum upfront fee user is willing to pay
|
|
21
|
+
* @param collAction specify if collateral is supplied or withdrawn
|
|
22
|
+
* @param debtAction specify if debt is borrowed or paid back
|
|
23
|
+
*/
|
|
24
|
+
constructor(
|
|
25
|
+
market: EthAddress,
|
|
26
|
+
from: EthAddress,
|
|
27
|
+
to: EthAddress,
|
|
28
|
+
troveId: uint256,
|
|
29
|
+
collAmount: uint256,
|
|
30
|
+
debtAmount: uint256,
|
|
31
|
+
upperHint: uint256,
|
|
32
|
+
lowerHint: uint256,
|
|
33
|
+
maxUpfrontFee: uint256,
|
|
34
|
+
collAction: uint8,
|
|
35
|
+
debtAction: uint8,
|
|
36
|
+
) {
|
|
37
|
+
super(
|
|
38
|
+
'LiquityV2AdjustZombieTrove',
|
|
39
|
+
getAddr('LiquityV2AdjustZombieTrove'),
|
|
40
|
+
[
|
|
41
|
+
'address',
|
|
42
|
+
'address',
|
|
43
|
+
'address',
|
|
44
|
+
'uint256',
|
|
45
|
+
'uint256',
|
|
46
|
+
'uint256',
|
|
47
|
+
'uint256',
|
|
48
|
+
'uint256',
|
|
49
|
+
'uint256',
|
|
50
|
+
'uint8',
|
|
51
|
+
'uint8',
|
|
52
|
+
],
|
|
53
|
+
[
|
|
54
|
+
market,
|
|
55
|
+
from,
|
|
56
|
+
to,
|
|
57
|
+
troveId,
|
|
58
|
+
collAmount,
|
|
59
|
+
debtAmount,
|
|
60
|
+
upperHint,
|
|
61
|
+
lowerHint,
|
|
62
|
+
maxUpfrontFee,
|
|
63
|
+
collAction,
|
|
64
|
+
debtAction,
|
|
65
|
+
],
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
this.mappableArgs = [
|
|
69
|
+
this.args[0],
|
|
70
|
+
this.args[1],
|
|
71
|
+
this.args[2],
|
|
72
|
+
this.args[3],
|
|
73
|
+
this.args[4],
|
|
74
|
+
this.args[5],
|
|
75
|
+
this.args[6],
|
|
76
|
+
this.args[7],
|
|
77
|
+
this.args[8],
|
|
78
|
+
this.args[9],
|
|
79
|
+
this.args[10],
|
|
80
|
+
];
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, uint256 } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* LiquityV2BorrowAction - Borrows BOLD from a trove
|
|
7
|
+
*
|
|
8
|
+
* @category LiquityV2
|
|
9
|
+
*/
|
|
10
|
+
export class LiquityV2BorrowAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param market liquity address registry for the market
|
|
13
|
+
* @param to address to which to send the borrowed BOLD
|
|
14
|
+
* @param troveId id of the trove to borrow from
|
|
15
|
+
* @param amount BOLD amount to borrow
|
|
16
|
+
* @param maxUpfrontFee maximum upfront fee user is willing to pay
|
|
17
|
+
*/
|
|
18
|
+
constructor(
|
|
19
|
+
market: EthAddress,
|
|
20
|
+
to: EthAddress,
|
|
21
|
+
troveId: uint256,
|
|
22
|
+
amount: uint256,
|
|
23
|
+
maxUpfrontFee: uint256,
|
|
24
|
+
) {
|
|
25
|
+
super(
|
|
26
|
+
'LiquityV2Borrow',
|
|
27
|
+
getAddr('LiquityV2Borrow'),
|
|
28
|
+
[
|
|
29
|
+
'address',
|
|
30
|
+
'address',
|
|
31
|
+
'uint256',
|
|
32
|
+
'uint256',
|
|
33
|
+
'uint256',
|
|
34
|
+
],
|
|
35
|
+
[
|
|
36
|
+
market,
|
|
37
|
+
to,
|
|
38
|
+
troveId,
|
|
39
|
+
amount,
|
|
40
|
+
maxUpfrontFee,
|
|
41
|
+
],
|
|
42
|
+
);
|
|
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
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* LiquityV2ClaimAction - Claims collateral left from liquidation from a trove
|
|
7
|
+
*
|
|
8
|
+
* @category LiquityV2
|
|
9
|
+
*/
|
|
10
|
+
export class LiquityV2ClaimAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param market liquity address registry for the market
|
|
13
|
+
* @param to address to which to send the claimed collateral
|
|
14
|
+
*/
|
|
15
|
+
constructor(
|
|
16
|
+
market: EthAddress,
|
|
17
|
+
to: EthAddress,
|
|
18
|
+
) {
|
|
19
|
+
super(
|
|
20
|
+
'LiquityV2Claim',
|
|
21
|
+
getAddr('LiquityV2Claim'),
|
|
22
|
+
[
|
|
23
|
+
'address',
|
|
24
|
+
'address',
|
|
25
|
+
],
|
|
26
|
+
[
|
|
27
|
+
market,
|
|
28
|
+
to,
|
|
29
|
+
],
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
this.mappableArgs = [
|
|
33
|
+
this.args[0],
|
|
34
|
+
this.args[1],
|
|
35
|
+
];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { getAssetInfo } from '@defisaver/tokens';
|
|
2
|
+
import { Action } from '../../Action';
|
|
3
|
+
import { requireAddress } from '../../utils/general';
|
|
4
|
+
import { getAddr } from '../../addresses';
|
|
5
|
+
import { EthAddress } from '../../types';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* LiquityV2CloseAction - Closes trove
|
|
9
|
+
*
|
|
10
|
+
* @category LiquityV2
|
|
11
|
+
*/
|
|
12
|
+
export class LiquityV2CloseAction extends Action {
|
|
13
|
+
/**
|
|
14
|
+
* @param market liquity address registry for the market
|
|
15
|
+
* @param from address from which to take the BOLD
|
|
16
|
+
* @param to address to which to send the collateralToken and WETH gas compensation
|
|
17
|
+
* @param troveId id of the trove to close
|
|
18
|
+
*/
|
|
19
|
+
constructor(
|
|
20
|
+
market: EthAddress,
|
|
21
|
+
from: EthAddress,
|
|
22
|
+
to: EthAddress,
|
|
23
|
+
troveId: string,
|
|
24
|
+
) {
|
|
25
|
+
super(
|
|
26
|
+
'LiquityV2Close',
|
|
27
|
+
getAddr('LiquityV2Close'),
|
|
28
|
+
[
|
|
29
|
+
'address',
|
|
30
|
+
'address',
|
|
31
|
+
'address',
|
|
32
|
+
'uint256',
|
|
33
|
+
],
|
|
34
|
+
[
|
|
35
|
+
market,
|
|
36
|
+
from,
|
|
37
|
+
to,
|
|
38
|
+
troveId,
|
|
39
|
+
],
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
this.mappableArgs = [
|
|
43
|
+
this.args[0],
|
|
44
|
+
this.args[1],
|
|
45
|
+
this.args[2],
|
|
46
|
+
this.args[3],
|
|
47
|
+
];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async getAssetsToApprove() {
|
|
51
|
+
return [{ asset: getAssetInfo('BOLD').address, owner: this.args[1] }];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { getAssetInfo } from '@defisaver/tokens';
|
|
2
|
+
import { Action } from '../../Action';
|
|
3
|
+
import { getAddr } from '../../addresses';
|
|
4
|
+
import { EthAddress, uint256 } from '../../types';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* LiquityV2OpenAction - Opens up a trove
|
|
9
|
+
*
|
|
10
|
+
* @category LiquityV2
|
|
11
|
+
*/
|
|
12
|
+
export class LiquityV2OpenAction extends Action {
|
|
13
|
+
tokenForApproval: EthAddress;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param market liquity address registry for the market
|
|
17
|
+
* @param from address from which to take the collateralToken and WETH gas compensation
|
|
18
|
+
* @param to address to which to send the borrowed BOLD
|
|
19
|
+
* @param collToken address of the collateral token
|
|
20
|
+
* @param interestBatchManager address of the interest batch manager, or address(0) if this trove will not be part of a batch
|
|
21
|
+
* @param ownerIndex owner index of the trove
|
|
22
|
+
* @param collAmount collateral amount
|
|
23
|
+
* @param boldAmount borrowed BOLD amount
|
|
24
|
+
* @param upperHint upper hint for the trove insertion
|
|
25
|
+
* @param lowerHint lower hint for the trove insertion
|
|
26
|
+
* @param annualInterestRate annual interest rate for the trove or 0 if trove will be part of a batch
|
|
27
|
+
* @param maxUpfrontFee maximum upfront fee user is willing to pay
|
|
28
|
+
*/
|
|
29
|
+
constructor(
|
|
30
|
+
market: EthAddress,
|
|
31
|
+
from: EthAddress,
|
|
32
|
+
to: EthAddress,
|
|
33
|
+
collToken: EthAddress,
|
|
34
|
+
interestBatchManager: EthAddress,
|
|
35
|
+
ownerIndex: uint256,
|
|
36
|
+
collAmount: uint256,
|
|
37
|
+
boldAmount: uint256,
|
|
38
|
+
upperHint: uint256,
|
|
39
|
+
lowerHint: uint256,
|
|
40
|
+
annualInterestRate: uint256,
|
|
41
|
+
maxUpfrontFee: uint256,
|
|
42
|
+
) {
|
|
43
|
+
super(
|
|
44
|
+
'LiquityV2Open',
|
|
45
|
+
getAddr('LiquityV2Open'),
|
|
46
|
+
[
|
|
47
|
+
'address',
|
|
48
|
+
'address',
|
|
49
|
+
'address',
|
|
50
|
+
'address',
|
|
51
|
+
'uint256',
|
|
52
|
+
'uint256',
|
|
53
|
+
'uint256',
|
|
54
|
+
'uint256',
|
|
55
|
+
'uint256',
|
|
56
|
+
'uint256',
|
|
57
|
+
'uint256',
|
|
58
|
+
],
|
|
59
|
+
[
|
|
60
|
+
market,
|
|
61
|
+
from,
|
|
62
|
+
to,
|
|
63
|
+
interestBatchManager,
|
|
64
|
+
ownerIndex,
|
|
65
|
+
collAmount,
|
|
66
|
+
boldAmount,
|
|
67
|
+
upperHint,
|
|
68
|
+
lowerHint,
|
|
69
|
+
annualInterestRate,
|
|
70
|
+
maxUpfrontFee,
|
|
71
|
+
],
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
this.mappableArgs = [
|
|
75
|
+
this.args[0],
|
|
76
|
+
this.args[1],
|
|
77
|
+
this.args[2],
|
|
78
|
+
this.args[3],
|
|
79
|
+
this.args[4],
|
|
80
|
+
this.args[5],
|
|
81
|
+
this.args[6],
|
|
82
|
+
this.args[7],
|
|
83
|
+
this.args[8],
|
|
84
|
+
this.args[9],
|
|
85
|
+
this.args[10],
|
|
86
|
+
];
|
|
87
|
+
|
|
88
|
+
this.tokenForApproval = collToken;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async getAssetsToApprove() {
|
|
92
|
+
const wethToken = getAssetInfo('WETH').address;
|
|
93
|
+
if (this.tokenForApproval.toLocaleLowerCase() === wethToken.toLocaleLowerCase()) {
|
|
94
|
+
return [{ asset: wethToken, owner: this.args[1] }];
|
|
95
|
+
}
|
|
96
|
+
return [
|
|
97
|
+
{ asset: wethToken, owner: this.args[1] },
|
|
98
|
+
{ asset: this.tokenForApproval, owner: this.args[1] },
|
|
99
|
+
];
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { getAssetInfo } from '@defisaver/tokens';
|
|
2
|
+
import { Action } from '../../Action';
|
|
3
|
+
import { getAddr } from '../../addresses';
|
|
4
|
+
import { EthAddress, uint256 } from '../../types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* LiquityV2PaybackAction - Pays back BOLD to a trove
|
|
8
|
+
*
|
|
9
|
+
* @category LiquityV2
|
|
10
|
+
*/
|
|
11
|
+
export class LiquityV2PaybackAction extends Action {
|
|
12
|
+
/**
|
|
13
|
+
* @param market liquity address registry for the market
|
|
14
|
+
* @param from address from which to take the BOLD for payback
|
|
15
|
+
* @param troveId id of the trove to pay back to
|
|
16
|
+
* @param amount BOLD amount to pay back
|
|
17
|
+
*/
|
|
18
|
+
constructor(
|
|
19
|
+
market: EthAddress,
|
|
20
|
+
from: EthAddress,
|
|
21
|
+
troveId: uint256,
|
|
22
|
+
amount: uint256,
|
|
23
|
+
) {
|
|
24
|
+
super(
|
|
25
|
+
'LiquityV2Payback',
|
|
26
|
+
getAddr('LiquityV2Payback'),
|
|
27
|
+
[
|
|
28
|
+
'address',
|
|
29
|
+
'address',
|
|
30
|
+
'uint256',
|
|
31
|
+
'uint256',
|
|
32
|
+
],
|
|
33
|
+
[
|
|
34
|
+
market,
|
|
35
|
+
from,
|
|
36
|
+
troveId,
|
|
37
|
+
amount,
|
|
38
|
+
],
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
this.mappableArgs = [
|
|
42
|
+
this.args[0],
|
|
43
|
+
this.args[1],
|
|
44
|
+
this.args[2],
|
|
45
|
+
this.args[3],
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async getAssetsToApprove() {
|
|
50
|
+
return [{ asset: getAssetInfo('BOLD').address, owner: this.args[1] }];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* LiquityV2SPClaimCollAction - Claims remaining collateral gains for a user with no deposit
|
|
7
|
+
*
|
|
8
|
+
* @category LiquityV2
|
|
9
|
+
*/
|
|
10
|
+
export class LiquityV2SPClaimCollAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param market liquity address registry for the market
|
|
13
|
+
* @param to address to which to send the claimed collateral gains
|
|
14
|
+
*/
|
|
15
|
+
constructor(
|
|
16
|
+
market: EthAddress,
|
|
17
|
+
to: EthAddress,
|
|
18
|
+
) {
|
|
19
|
+
super(
|
|
20
|
+
'LiquityV2SPClaimColl',
|
|
21
|
+
getAddr('LiquityV2SPClaimColl'),
|
|
22
|
+
[
|
|
23
|
+
'address',
|
|
24
|
+
'address',
|
|
25
|
+
],
|
|
26
|
+
[
|
|
27
|
+
market,
|
|
28
|
+
to,
|
|
29
|
+
],
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
this.mappableArgs = [
|
|
33
|
+
this.args[0],
|
|
34
|
+
this.args[1],
|
|
35
|
+
];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { getAssetInfo } from '@defisaver/tokens';
|
|
2
|
+
import { Action } from '../../Action';
|
|
3
|
+
import { getAddr } from '../../addresses';
|
|
4
|
+
import { EthAddress, uint256 } from '../../types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* LiquityV2SPDepositAction - Deposits into the Stability Pool (SP) and optionally claims gains
|
|
8
|
+
*
|
|
9
|
+
* @category LiquityV2
|
|
10
|
+
*/
|
|
11
|
+
export class LiquityV2SPDepositAction extends Action {
|
|
12
|
+
/**
|
|
13
|
+
* @param market liquity address registry for the market
|
|
14
|
+
* @param from address from which to take the deposited BOLD
|
|
15
|
+
* @param boldGainTo address to send any claimed BOLD gains
|
|
16
|
+
* @param collGainTo address to send any claimed collateral gains
|
|
17
|
+
* @param amount BOLD amount to deposit into the Stability Pool
|
|
18
|
+
* @param doClaim whether to claim BOLD and collateral gains before depositing
|
|
19
|
+
*/
|
|
20
|
+
constructor(
|
|
21
|
+
market: EthAddress,
|
|
22
|
+
from: EthAddress,
|
|
23
|
+
boldGainTo: EthAddress,
|
|
24
|
+
collGainTo: EthAddress,
|
|
25
|
+
amount: uint256,
|
|
26
|
+
doClaim: boolean,
|
|
27
|
+
) {
|
|
28
|
+
super(
|
|
29
|
+
'LiquityV2SPDeposit',
|
|
30
|
+
getAddr('LiquityV2SPDeposit'),
|
|
31
|
+
[
|
|
32
|
+
'address',
|
|
33
|
+
'address',
|
|
34
|
+
'address',
|
|
35
|
+
'address',
|
|
36
|
+
'uint256',
|
|
37
|
+
'bool',
|
|
38
|
+
],
|
|
39
|
+
[
|
|
40
|
+
market,
|
|
41
|
+
from,
|
|
42
|
+
boldGainTo,
|
|
43
|
+
collGainTo,
|
|
44
|
+
amount,
|
|
45
|
+
doClaim,
|
|
46
|
+
],
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
this.mappableArgs = [
|
|
50
|
+
this.args[0],
|
|
51
|
+
this.args[1],
|
|
52
|
+
this.args[2],
|
|
53
|
+
this.args[3],
|
|
54
|
+
this.args[4],
|
|
55
|
+
this.args[5],
|
|
56
|
+
];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async getAssetsToApprove() {
|
|
60
|
+
return [{ asset: getAssetInfo('BOLD').address, owner: this.args[1] }];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, uint256 } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* LiquityV2SPWithdrawAction - Withdraws from the Stability Pool (SP) and optionally claims gains
|
|
7
|
+
*
|
|
8
|
+
* @category LiquityV2
|
|
9
|
+
*/
|
|
10
|
+
export class LiquityV2SPWithdrawAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param market liquity address registry for the market
|
|
13
|
+
* @param boldTo address to send any withdrawn BOLD
|
|
14
|
+
* @param collGainTo address to send any claimed collateral gains
|
|
15
|
+
* @param amount BOLD amount to withdraw from the Stability Pool
|
|
16
|
+
* @param doClaim whether to claim BOLD and collateral gains before withdrawing
|
|
17
|
+
*/
|
|
18
|
+
constructor(
|
|
19
|
+
market: EthAddress,
|
|
20
|
+
boldTo: EthAddress,
|
|
21
|
+
collGainTo: EthAddress,
|
|
22
|
+
amount: uint256,
|
|
23
|
+
doClaim: boolean,
|
|
24
|
+
) {
|
|
25
|
+
super(
|
|
26
|
+
'LiquityV2SPWithdraw',
|
|
27
|
+
getAddr('LiquityV2SPWithdraw'),
|
|
28
|
+
[
|
|
29
|
+
'address',
|
|
30
|
+
'address',
|
|
31
|
+
'address',
|
|
32
|
+
'uint256',
|
|
33
|
+
'bool',
|
|
34
|
+
],
|
|
35
|
+
[
|
|
36
|
+
market,
|
|
37
|
+
boldTo,
|
|
38
|
+
collGainTo,
|
|
39
|
+
amount,
|
|
40
|
+
doClaim,
|
|
41
|
+
],
|
|
42
|
+
);
|
|
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
|
+
}
|