@defisaver/sdk 1.0.56 → 1.0.58
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/DEV.md +43 -0
- package/esm/src/actions/checkers/LiquityRatioIncreaseCheckAction.d.ts +13 -0
- package/esm/src/actions/checkers/LiquityRatioIncreaseCheckAction.js +18 -0
- package/esm/src/actions/checkers/MorphoAaveV2RatioCheckAction.d.ts +15 -0
- package/esm/src/actions/checkers/MorphoAaveV2RatioCheckAction.js +22 -0
- package/esm/src/actions/checkers/index.d.ts +2 -0
- package/esm/src/actions/checkers/index.js +2 -0
- package/esm/src/addresses.d.ts +11 -7
- package/esm/src/addresses.js +11 -2
- package/esm/src/index.d.ts +44 -28
- package/esm/src/triggers/LiquityDebtInFrontWithLimitTrigger.d.ts +10 -0
- package/esm/src/triggers/LiquityDebtInFrontWithLimitTrigger.js +12 -0
- package/esm/src/triggers/MorphoAaveV2RatioTrigger.d.ts +10 -0
- package/esm/src/triggers/MorphoAaveV2RatioTrigger.js +12 -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/checkers/LiquityRatioIncreaseCheckAction.ts +21 -0
- package/src/actions/checkers/MorphoAaveV2RatioCheckAction.ts +25 -0
- package/src/actions/checkers/index.ts +2 -0
- package/src/addresses.ts +12 -2
- package/src/triggers/LiquityDebtInFrontWithLimitTrigger.ts +19 -0
- package/src/triggers/MorphoAaveV2RatioTrigger.ts +15 -0
- package/src/triggers/index.ts +2 -0
- package/umd/index.js +432 -309
- package/yarn-error.log +0 -3976
package/DEV.md
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# DeFi Saver SDK
|
|
2
|
+
|
|
3
|
+
Every specific action is a class that has to extend base class [Action](https://github.com/defisaver/defisaver-sdk/blob/master/src/Action.ts) or [ActionWithL2](https://github.com/defisaver/defisaver-sdk/blob/master/src/ActionWithL2.ts)
|
|
4
|
+
|
|
5
|
+
When using an action in a recipe, you can pipe an output of an action used before it by putting $ and then the number of action which output you want to use (starting from 1, not 0)
|
|
6
|
+
e.g.
|
|
7
|
+
|
|
8
|
+
```js
|
|
9
|
+
const recipe = new Recipe('exampleLiquitySupply', [
|
|
10
|
+
// pull 1 WETH from user address
|
|
11
|
+
new dfs.actions.basic.PullToken('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', '0x123..', 1000000000000000000),
|
|
12
|
+
// $1 will use the output of the first action as that argument - in this case, it will be 1 WETH
|
|
13
|
+
new dfs.actions.liquity.LiquitySupplyAction('$1', '0xProxy', 'upperHint', 'lowerHint'),
|
|
14
|
+
]);
|
|
15
|
+
```
|
|
16
|
+
## Action
|
|
17
|
+
|
|
18
|
+
- ```constructor``` - here you should sanity check arguments, and call ```super(actionName, addressOfAction, types, args)``` where types are used for encoding args
|
|
19
|
+
- ```mappableArgs``` - if needed, have to be defined in ```constructor```
|
|
20
|
+
- ```getAssetsToApprove``` - if action pulls tokens from the address, this should return an array of tokens that need to be approved (erc20 and/or nfts). [Return type object](https://github.com/defisaver/defisaver-sdk/blob/29aa14835240b977ceb053dfc947faae5d19ff9d/src/Action.ts#L195) is defined here.
|
|
21
|
+
- ```getEthValue``` - needed if action is using pure ETH, then value is required when sending a tx
|
|
22
|
+
- ```encodeInputs``` - if Action extends ActionWithL2, it can have custom function for gas savings e.g. pack address as 20 bytes instead od 32
|
|
23
|
+
- ```encodeForDsProxyCall```
|
|
24
|
+
- ```encodeForL2DsProxyCall```
|
|
25
|
+
- ```encodeForRecipe```
|
|
26
|
+
- ```encodeForL2Recipe```
|
|
27
|
+
- ```encodeForStrategy```
|
|
28
|
+
|
|
29
|
+
## Recipe
|
|
30
|
+
|
|
31
|
+
- ```constructor(name, actions)``` - name of the recipe is required, actions are optional
|
|
32
|
+
- ```addAction``` - add Action to Recipe
|
|
33
|
+
- ```getAssetsToApprove``` - returns an array of all unique token approvals from all actions from the recipe
|
|
34
|
+
- ```getEthValue``` - sum of values from all actions
|
|
35
|
+
- ```encodeForDsProxyCall```
|
|
36
|
+
|
|
37
|
+
## Addresses
|
|
38
|
+
|
|
39
|
+
All contract addresses can be found [here](https://github.com/defisaver/defisaver-sdk/blob/master/src/addresses.ts)
|
|
40
|
+
|
|
41
|
+
## Examples
|
|
42
|
+
|
|
43
|
+
Examples and tests can be found [here](https://github.com/defisaver/defisaver-sdk/tree/master/test)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* LiquityRatioCheckAction - Checks liquity ratio increase for user position and reverts if faulty
|
|
5
|
+
*
|
|
6
|
+
* @category Checkers
|
|
7
|
+
*/
|
|
8
|
+
export declare class LiquityRatioIncreaseCheckAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param targetRatio The ratio user want to be at
|
|
11
|
+
*/
|
|
12
|
+
constructor(targetRatioIncrease: uint256);
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* LiquityRatioCheckAction - Checks liquity ratio increase for user position and reverts if faulty
|
|
5
|
+
*
|
|
6
|
+
* @category Checkers
|
|
7
|
+
*/
|
|
8
|
+
export class LiquityRatioIncreaseCheckAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param targetRatio The ratio user want to be at
|
|
11
|
+
*/
|
|
12
|
+
constructor(targetRatioIncrease) {
|
|
13
|
+
super('LiquityRatioIncreaseCheck', getAddr('LiquityRatioIncreaseCheck'), ['uint256'], [targetRatioIncrease]);
|
|
14
|
+
this.mappableArgs = [
|
|
15
|
+
this.args[0],
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { uint8, uint256, EthAddress } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* MorphoAaveV2RatioCheckAction - Checks Morpho-AaveV2 ratio for user position and reverts if faulty
|
|
5
|
+
*
|
|
6
|
+
* @category Checkers
|
|
7
|
+
*/
|
|
8
|
+
export declare class MorphoAaveV2RatioCheckAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param ratioState If it should lower/higher
|
|
11
|
+
* @param targetRatio The ratio user want to be at
|
|
12
|
+
* @param user Address of the user we are checking the ratio for (default to proxy)
|
|
13
|
+
*/
|
|
14
|
+
constructor(ratioState: uint8, targetRatio: uint256, user: EthAddress);
|
|
15
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* MorphoAaveV2RatioCheckAction - Checks Morpho-AaveV2 ratio for user position and reverts if faulty
|
|
5
|
+
*
|
|
6
|
+
* @category Checkers
|
|
7
|
+
*/
|
|
8
|
+
export class MorphoAaveV2RatioCheckAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param ratioState If it should lower/higher
|
|
11
|
+
* @param targetRatio The ratio user want to be at
|
|
12
|
+
* @param user Address of the user we are checking the ratio for (default to proxy)
|
|
13
|
+
*/
|
|
14
|
+
constructor(ratioState, targetRatio, user) {
|
|
15
|
+
super('MorphoAaveV2RatioCheck', getAddr('MorphoAaveV2RatioCheck'), ['uint8', 'uint256', 'address'], [ratioState, targetRatio, user]);
|
|
16
|
+
this.mappableArgs = [
|
|
17
|
+
this.args[0],
|
|
18
|
+
this.args[1],
|
|
19
|
+
this.args[2],
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from './MakerRatioCheckAction';
|
|
2
2
|
export * from './AaveV3RatioCheckAction';
|
|
3
3
|
export * from './CompoundV3RatioCheckAction';
|
|
4
|
+
export * from './MorphoAaveV2RatioCheckAction';
|
|
4
5
|
export * from './LiquityRatioCheckAction';
|
|
5
6
|
export * from './SparkRatioCheckAction';
|
|
7
|
+
export * from './LiquityRatioIncreaseCheckAction';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from './MakerRatioCheckAction';
|
|
2
2
|
export * from './AaveV3RatioCheckAction';
|
|
3
3
|
export * from './CompoundV3RatioCheckAction';
|
|
4
|
+
export * from './MorphoAaveV2RatioCheckAction';
|
|
4
5
|
export * from './LiquityRatioCheckAction';
|
|
5
6
|
export * from './SparkRatioCheckAction';
|
|
7
|
+
export * from './LiquityRatioIncreaseCheckAction';
|
package/esm/src/addresses.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ export declare const actionAddresses: {
|
|
|
44
44
|
AaveCollateralSwitch: string;
|
|
45
45
|
AaveUnstake: string;
|
|
46
46
|
AaveClaimAAVE: string;
|
|
47
|
+
AaveClaimStkAave: string;
|
|
47
48
|
AaveV3Withdraw: string;
|
|
48
49
|
AaveV3SwapBorrowRateMode: string;
|
|
49
50
|
AaveV3Supply: string;
|
|
@@ -242,6 +243,7 @@ export declare const actionAddresses: {
|
|
|
242
243
|
AaveCollateralSwitch?: undefined;
|
|
243
244
|
AaveUnstake?: undefined;
|
|
244
245
|
AaveClaimAAVE?: undefined;
|
|
246
|
+
AaveClaimStkAave?: undefined;
|
|
245
247
|
AaveV3View?: undefined;
|
|
246
248
|
MorphoAaveV2Borrow?: undefined;
|
|
247
249
|
MorphoAaveV2Payback?: undefined;
|
|
@@ -368,6 +370,13 @@ export declare const actionAddresses: {
|
|
|
368
370
|
AaveV3Supply: string;
|
|
369
371
|
AaveV3SwapBorrowRateMode: string;
|
|
370
372
|
AaveV3Withdraw: string;
|
|
373
|
+
CompV3Allow: string;
|
|
374
|
+
CompV3Borrow: string;
|
|
375
|
+
CompV3Claim: string;
|
|
376
|
+
CompV3Payback: string;
|
|
377
|
+
CompV3Supply: string;
|
|
378
|
+
CompV3Transfer: string;
|
|
379
|
+
CompV3Withdraw: string;
|
|
371
380
|
FLAaveV3NoFee: string;
|
|
372
381
|
FLAaveV3: string;
|
|
373
382
|
FLBalancer: string;
|
|
@@ -413,6 +422,7 @@ export declare const actionAddresses: {
|
|
|
413
422
|
AaveCollateralSwitch?: undefined;
|
|
414
423
|
AaveUnstake?: undefined;
|
|
415
424
|
AaveClaimAAVE?: undefined;
|
|
425
|
+
AaveClaimStkAave?: undefined;
|
|
416
426
|
AaveV3ClaimRewards?: undefined;
|
|
417
427
|
AaveV3View?: undefined;
|
|
418
428
|
MorphoAaveV2Borrow?: undefined;
|
|
@@ -504,13 +514,6 @@ export declare const actionAddresses: {
|
|
|
504
514
|
CBChickenOut?: undefined;
|
|
505
515
|
CBCreateRebondSub?: undefined;
|
|
506
516
|
FetchBondId?: undefined;
|
|
507
|
-
CompV3Allow?: undefined;
|
|
508
|
-
CompV3Borrow?: undefined;
|
|
509
|
-
CompV3Claim?: undefined;
|
|
510
|
-
CompV3Payback?: undefined;
|
|
511
|
-
CompV3Supply?: undefined;
|
|
512
|
-
CompV3Transfer?: undefined;
|
|
513
|
-
CompV3Withdraw?: undefined;
|
|
514
517
|
CurveUsdBorrow?: undefined;
|
|
515
518
|
CurveUsdCreate?: undefined;
|
|
516
519
|
CurveUsdPayback?: undefined;
|
|
@@ -589,6 +592,7 @@ export declare const actionAddresses: {
|
|
|
589
592
|
AaveCollateralSwitch?: undefined;
|
|
590
593
|
AaveUnstake?: undefined;
|
|
591
594
|
AaveClaimAAVE?: undefined;
|
|
595
|
+
AaveClaimStkAave?: undefined;
|
|
592
596
|
MorphoAaveV2Borrow?: undefined;
|
|
593
597
|
MorphoAaveV2Payback?: undefined;
|
|
594
598
|
MorphoAaveV2Supply?: undefined;
|
package/esm/src/addresses.js
CHANGED
|
@@ -50,6 +50,7 @@ export const actionAddresses = {
|
|
|
50
50
|
AaveCollateralSwitch: '0xFf5dfF1B90bd5Aa6E12768AB497dB90cc9DE6F5d',
|
|
51
51
|
AaveUnstake: '0x2FE4024e350cD2c64D2fd0Db5d16F5cE54Ca0E09',
|
|
52
52
|
AaveClaimAAVE: '0xd52855bD011F3D87565f9040DdE2A59fB1b27b15',
|
|
53
|
+
AaveClaimStkAave: '0x5Dcd9Dc0185a6Ab07a31e5284D16Ce9f0A79Ce99',
|
|
53
54
|
// aave v3
|
|
54
55
|
AaveV3Withdraw: '0x9D4e4b26A5E2e6Dad30C5d95F5cE78A8310F04C2',
|
|
55
56
|
AaveV3SwapBorrowRateMode: '0x630F530Ac523C935cf2528E62D0A06F8900C5b1B',
|
|
@@ -157,9 +158,9 @@ export const actionAddresses = {
|
|
|
157
158
|
McdRatioCheck: '0x3f09773e5e945C6Aa1bc8a8B3492f507620DE1e1',
|
|
158
159
|
GasFeeTaker: '0x431F1E1A9859EF99953801dbdeB31d2846ADcc0d',
|
|
159
160
|
CurveStethPoolDeposit: '0x5Ae5870dC0C780e9eb68bE7a223eCd7F3BDad12B',
|
|
160
|
-
CurveStethPoolWithdraw: '
|
|
161
|
+
CurveStethPoolWithdraw: '0x41313695a4829a80c8019Ec8bCC529Fec08F9099',
|
|
161
162
|
CurveDeposit: '0xf46aCCE6d2559971bF5Aea03A10B3679709CE43d',
|
|
162
|
-
CurveWithdraw: '
|
|
163
|
+
CurveWithdraw: '0x7127A1Cd69eC2A1F91661bc0ED40aD5B73898A54',
|
|
163
164
|
McdBoostComposite: '0x0000000000000000000000000000000000000000',
|
|
164
165
|
McdRepayComposite: '0x0000000000000000000000000000000000000000',
|
|
165
166
|
// Euler
|
|
@@ -258,6 +259,14 @@ export const actionAddresses = {
|
|
|
258
259
|
AaveV3Supply: '0xF159c79077001E2a2C1a178BE68DB7F69a6Da486',
|
|
259
260
|
AaveV3SwapBorrowRateMode: '0x738042389A8d6B0F6D6ab009c42dfF84ebB737C0',
|
|
260
261
|
AaveV3Withdraw: '0xbf492F869DdB1A18BB4F41b6c3059D9f882Fe7ff',
|
|
262
|
+
// CompV3
|
|
263
|
+
CompV3Allow: '0x0380E8e13CdE0499c720999930CaA07A5744887c',
|
|
264
|
+
CompV3Borrow: '0x1C0eCc794fDA7c29aBd19E0b2F7dA166C237d616',
|
|
265
|
+
CompV3Claim: '0xDa135F74a24FE2B23ECc35De227f5d3b000c5AdA',
|
|
266
|
+
CompV3Payback: '0xeA8b80944a70e6C290eb00Ae0298d2953aD3aA0C',
|
|
267
|
+
CompV3Supply: '0x82bf73d2083e69344747fff0d51816059db0113c',
|
|
268
|
+
CompV3Transfer: '0x9EB98fA05E89a598288B0386e66052Ba0d0B9911',
|
|
269
|
+
CompV3Withdraw: '0xb6c2dC95201630cAF7568cBdF434d787CD84dB79',
|
|
261
270
|
// flashloan
|
|
262
271
|
FLAaveV3NoFee: '0x219ac6dA971dE6d943cffD1BD62abde71525d382',
|
|
263
272
|
FLAaveV3: '0x53953aCEe438c083e4299F7976f03Ff3cb862161',
|
package/esm/src/index.d.ts
CHANGED
|
@@ -55,6 +55,7 @@ declare const actionAddressesAllChains: {
|
|
|
55
55
|
AaveCollateralSwitch: string;
|
|
56
56
|
AaveUnstake: string;
|
|
57
57
|
AaveClaimAAVE: string;
|
|
58
|
+
AaveClaimStkAave: string;
|
|
58
59
|
AaveV3Withdraw: string;
|
|
59
60
|
AaveV3SwapBorrowRateMode: string;
|
|
60
61
|
AaveV3Supply: string;
|
|
@@ -253,6 +254,7 @@ declare const actionAddressesAllChains: {
|
|
|
253
254
|
AaveCollateralSwitch?: undefined;
|
|
254
255
|
AaveUnstake?: undefined;
|
|
255
256
|
AaveClaimAAVE?: undefined;
|
|
257
|
+
AaveClaimStkAave?: undefined;
|
|
256
258
|
AaveV3View?: undefined;
|
|
257
259
|
MorphoAaveV2Borrow?: undefined;
|
|
258
260
|
MorphoAaveV2Payback?: undefined;
|
|
@@ -379,6 +381,13 @@ declare const actionAddressesAllChains: {
|
|
|
379
381
|
AaveV3Supply: string;
|
|
380
382
|
AaveV3SwapBorrowRateMode: string;
|
|
381
383
|
AaveV3Withdraw: string;
|
|
384
|
+
CompV3Allow: string;
|
|
385
|
+
CompV3Borrow: string;
|
|
386
|
+
CompV3Claim: string;
|
|
387
|
+
CompV3Payback: string;
|
|
388
|
+
CompV3Supply: string;
|
|
389
|
+
CompV3Transfer: string;
|
|
390
|
+
CompV3Withdraw: string;
|
|
382
391
|
FLAaveV3NoFee: string;
|
|
383
392
|
FLAaveV3: string;
|
|
384
393
|
FLBalancer: string;
|
|
@@ -424,6 +433,7 @@ declare const actionAddressesAllChains: {
|
|
|
424
433
|
AaveCollateralSwitch?: undefined;
|
|
425
434
|
AaveUnstake?: undefined;
|
|
426
435
|
AaveClaimAAVE?: undefined;
|
|
436
|
+
AaveClaimStkAave?: undefined;
|
|
427
437
|
AaveV3ClaimRewards?: undefined;
|
|
428
438
|
AaveV3View?: undefined;
|
|
429
439
|
MorphoAaveV2Borrow?: undefined;
|
|
@@ -515,13 +525,6 @@ declare const actionAddressesAllChains: {
|
|
|
515
525
|
CBChickenOut?: undefined;
|
|
516
526
|
CBCreateRebondSub?: undefined;
|
|
517
527
|
FetchBondId?: undefined;
|
|
518
|
-
CompV3Allow?: undefined;
|
|
519
|
-
CompV3Borrow?: undefined;
|
|
520
|
-
CompV3Claim?: undefined;
|
|
521
|
-
CompV3Payback?: undefined;
|
|
522
|
-
CompV3Supply?: undefined;
|
|
523
|
-
CompV3Transfer?: undefined;
|
|
524
|
-
CompV3Withdraw?: undefined;
|
|
525
528
|
CurveUsdBorrow?: undefined;
|
|
526
529
|
CurveUsdCreate?: undefined;
|
|
527
530
|
CurveUsdPayback?: undefined;
|
|
@@ -600,6 +603,7 @@ declare const actionAddressesAllChains: {
|
|
|
600
603
|
AaveCollateralSwitch?: undefined;
|
|
601
604
|
AaveUnstake?: undefined;
|
|
602
605
|
AaveClaimAAVE?: undefined;
|
|
606
|
+
AaveClaimStkAave?: undefined;
|
|
603
607
|
MorphoAaveV2Borrow?: undefined;
|
|
604
608
|
MorphoAaveV2Payback?: undefined;
|
|
605
609
|
MorphoAaveV2Supply?: undefined;
|
|
@@ -757,6 +761,7 @@ declare const actionAddresses: (chainId?: null) => {
|
|
|
757
761
|
AaveCollateralSwitch: string;
|
|
758
762
|
AaveUnstake: string;
|
|
759
763
|
AaveClaimAAVE: string;
|
|
764
|
+
AaveClaimStkAave: string;
|
|
760
765
|
AaveV3Withdraw: string;
|
|
761
766
|
AaveV3SwapBorrowRateMode: string;
|
|
762
767
|
AaveV3Supply: string;
|
|
@@ -955,6 +960,7 @@ declare const actionAddresses: (chainId?: null) => {
|
|
|
955
960
|
AaveCollateralSwitch?: undefined;
|
|
956
961
|
AaveUnstake?: undefined;
|
|
957
962
|
AaveClaimAAVE?: undefined;
|
|
963
|
+
AaveClaimStkAave?: undefined;
|
|
958
964
|
AaveV3View?: undefined;
|
|
959
965
|
MorphoAaveV2Borrow?: undefined;
|
|
960
966
|
MorphoAaveV2Payback?: undefined;
|
|
@@ -1081,6 +1087,13 @@ declare const actionAddresses: (chainId?: null) => {
|
|
|
1081
1087
|
AaveV3Supply: string;
|
|
1082
1088
|
AaveV3SwapBorrowRateMode: string;
|
|
1083
1089
|
AaveV3Withdraw: string;
|
|
1090
|
+
CompV3Allow: string;
|
|
1091
|
+
CompV3Borrow: string;
|
|
1092
|
+
CompV3Claim: string;
|
|
1093
|
+
CompV3Payback: string;
|
|
1094
|
+
CompV3Supply: string;
|
|
1095
|
+
CompV3Transfer: string;
|
|
1096
|
+
CompV3Withdraw: string;
|
|
1084
1097
|
FLAaveV3NoFee: string;
|
|
1085
1098
|
FLAaveV3: string;
|
|
1086
1099
|
FLBalancer: string;
|
|
@@ -1126,6 +1139,7 @@ declare const actionAddresses: (chainId?: null) => {
|
|
|
1126
1139
|
AaveCollateralSwitch?: undefined;
|
|
1127
1140
|
AaveUnstake?: undefined;
|
|
1128
1141
|
AaveClaimAAVE?: undefined;
|
|
1142
|
+
AaveClaimStkAave?: undefined;
|
|
1129
1143
|
AaveV3ClaimRewards?: undefined;
|
|
1130
1144
|
AaveV3View?: undefined;
|
|
1131
1145
|
MorphoAaveV2Borrow?: undefined;
|
|
@@ -1217,13 +1231,6 @@ declare const actionAddresses: (chainId?: null) => {
|
|
|
1217
1231
|
CBChickenOut?: undefined;
|
|
1218
1232
|
CBCreateRebondSub?: undefined;
|
|
1219
1233
|
FetchBondId?: undefined;
|
|
1220
|
-
CompV3Allow?: undefined;
|
|
1221
|
-
CompV3Borrow?: undefined;
|
|
1222
|
-
CompV3Claim?: undefined;
|
|
1223
|
-
CompV3Payback?: undefined;
|
|
1224
|
-
CompV3Supply?: undefined;
|
|
1225
|
-
CompV3Transfer?: undefined;
|
|
1226
|
-
CompV3Withdraw?: undefined;
|
|
1227
1234
|
CurveUsdBorrow?: undefined;
|
|
1228
1235
|
CurveUsdCreate?: undefined;
|
|
1229
1236
|
CurveUsdPayback?: undefined;
|
|
@@ -1302,6 +1309,7 @@ declare const actionAddresses: (chainId?: null) => {
|
|
|
1302
1309
|
AaveCollateralSwitch?: undefined;
|
|
1303
1310
|
AaveUnstake?: undefined;
|
|
1304
1311
|
AaveClaimAAVE?: undefined;
|
|
1312
|
+
AaveClaimStkAave?: undefined;
|
|
1305
1313
|
MorphoAaveV2Borrow?: undefined;
|
|
1306
1314
|
MorphoAaveV2Payback?: undefined;
|
|
1307
1315
|
MorphoAaveV2Supply?: undefined;
|
|
@@ -1602,6 +1610,7 @@ declare const _default: {
|
|
|
1602
1610
|
AaveCollateralSwitch: string;
|
|
1603
1611
|
AaveUnstake: string;
|
|
1604
1612
|
AaveClaimAAVE: string;
|
|
1613
|
+
AaveClaimStkAave: string;
|
|
1605
1614
|
AaveV3Withdraw: string;
|
|
1606
1615
|
AaveV3SwapBorrowRateMode: string;
|
|
1607
1616
|
AaveV3Supply: string;
|
|
@@ -1800,6 +1809,7 @@ declare const _default: {
|
|
|
1800
1809
|
AaveCollateralSwitch?: undefined;
|
|
1801
1810
|
AaveUnstake?: undefined;
|
|
1802
1811
|
AaveClaimAAVE?: undefined;
|
|
1812
|
+
AaveClaimStkAave?: undefined;
|
|
1803
1813
|
AaveV3View?: undefined;
|
|
1804
1814
|
MorphoAaveV2Borrow?: undefined;
|
|
1805
1815
|
MorphoAaveV2Payback?: undefined;
|
|
@@ -1926,6 +1936,13 @@ declare const _default: {
|
|
|
1926
1936
|
AaveV3Supply: string;
|
|
1927
1937
|
AaveV3SwapBorrowRateMode: string;
|
|
1928
1938
|
AaveV3Withdraw: string;
|
|
1939
|
+
CompV3Allow: string;
|
|
1940
|
+
CompV3Borrow: string;
|
|
1941
|
+
CompV3Claim: string;
|
|
1942
|
+
CompV3Payback: string;
|
|
1943
|
+
CompV3Supply: string;
|
|
1944
|
+
CompV3Transfer: string;
|
|
1945
|
+
CompV3Withdraw: string;
|
|
1929
1946
|
FLAaveV3NoFee: string;
|
|
1930
1947
|
FLAaveV3: string;
|
|
1931
1948
|
FLBalancer: string;
|
|
@@ -1971,6 +1988,7 @@ declare const _default: {
|
|
|
1971
1988
|
AaveCollateralSwitch?: undefined;
|
|
1972
1989
|
AaveUnstake?: undefined;
|
|
1973
1990
|
AaveClaimAAVE?: undefined;
|
|
1991
|
+
AaveClaimStkAave?: undefined;
|
|
1974
1992
|
AaveV3ClaimRewards?: undefined;
|
|
1975
1993
|
AaveV3View?: undefined;
|
|
1976
1994
|
MorphoAaveV2Borrow?: undefined;
|
|
@@ -2062,13 +2080,6 @@ declare const _default: {
|
|
|
2062
2080
|
CBChickenOut?: undefined;
|
|
2063
2081
|
CBCreateRebondSub?: undefined;
|
|
2064
2082
|
FetchBondId?: undefined;
|
|
2065
|
-
CompV3Allow?: undefined;
|
|
2066
|
-
CompV3Borrow?: undefined;
|
|
2067
|
-
CompV3Claim?: undefined;
|
|
2068
|
-
CompV3Payback?: undefined;
|
|
2069
|
-
CompV3Supply?: undefined;
|
|
2070
|
-
CompV3Transfer?: undefined;
|
|
2071
|
-
CompV3Withdraw?: undefined;
|
|
2072
2083
|
CurveUsdBorrow?: undefined;
|
|
2073
2084
|
CurveUsdCreate?: undefined;
|
|
2074
2085
|
CurveUsdPayback?: undefined;
|
|
@@ -2147,6 +2158,7 @@ declare const _default: {
|
|
|
2147
2158
|
AaveCollateralSwitch?: undefined;
|
|
2148
2159
|
AaveUnstake?: undefined;
|
|
2149
2160
|
AaveClaimAAVE?: undefined;
|
|
2161
|
+
AaveClaimStkAave?: undefined;
|
|
2150
2162
|
MorphoAaveV2Borrow?: undefined;
|
|
2151
2163
|
MorphoAaveV2Payback?: undefined;
|
|
2152
2164
|
MorphoAaveV2Supply?: undefined;
|
|
@@ -2304,6 +2316,7 @@ declare const _default: {
|
|
|
2304
2316
|
AaveCollateralSwitch: string;
|
|
2305
2317
|
AaveUnstake: string;
|
|
2306
2318
|
AaveClaimAAVE: string;
|
|
2319
|
+
AaveClaimStkAave: string;
|
|
2307
2320
|
AaveV3Withdraw: string;
|
|
2308
2321
|
AaveV3SwapBorrowRateMode: string;
|
|
2309
2322
|
AaveV3Supply: string;
|
|
@@ -2502,6 +2515,7 @@ declare const _default: {
|
|
|
2502
2515
|
AaveCollateralSwitch?: undefined;
|
|
2503
2516
|
AaveUnstake?: undefined;
|
|
2504
2517
|
AaveClaimAAVE?: undefined;
|
|
2518
|
+
AaveClaimStkAave?: undefined;
|
|
2505
2519
|
AaveV3View?: undefined;
|
|
2506
2520
|
MorphoAaveV2Borrow?: undefined;
|
|
2507
2521
|
MorphoAaveV2Payback?: undefined;
|
|
@@ -2628,6 +2642,13 @@ declare const _default: {
|
|
|
2628
2642
|
AaveV3Supply: string;
|
|
2629
2643
|
AaveV3SwapBorrowRateMode: string;
|
|
2630
2644
|
AaveV3Withdraw: string;
|
|
2645
|
+
CompV3Allow: string;
|
|
2646
|
+
CompV3Borrow: string;
|
|
2647
|
+
CompV3Claim: string;
|
|
2648
|
+
CompV3Payback: string;
|
|
2649
|
+
CompV3Supply: string;
|
|
2650
|
+
CompV3Transfer: string;
|
|
2651
|
+
CompV3Withdraw: string;
|
|
2631
2652
|
FLAaveV3NoFee: string;
|
|
2632
2653
|
FLAaveV3: string;
|
|
2633
2654
|
FLBalancer: string;
|
|
@@ -2673,6 +2694,7 @@ declare const _default: {
|
|
|
2673
2694
|
AaveCollateralSwitch?: undefined;
|
|
2674
2695
|
AaveUnstake?: undefined;
|
|
2675
2696
|
AaveClaimAAVE?: undefined;
|
|
2697
|
+
AaveClaimStkAave?: undefined;
|
|
2676
2698
|
AaveV3ClaimRewards?: undefined;
|
|
2677
2699
|
AaveV3View?: undefined;
|
|
2678
2700
|
MorphoAaveV2Borrow?: undefined;
|
|
@@ -2764,13 +2786,6 @@ declare const _default: {
|
|
|
2764
2786
|
CBChickenOut?: undefined;
|
|
2765
2787
|
CBCreateRebondSub?: undefined;
|
|
2766
2788
|
FetchBondId?: undefined;
|
|
2767
|
-
CompV3Allow?: undefined;
|
|
2768
|
-
CompV3Borrow?: undefined;
|
|
2769
|
-
CompV3Claim?: undefined;
|
|
2770
|
-
CompV3Payback?: undefined;
|
|
2771
|
-
CompV3Supply?: undefined;
|
|
2772
|
-
CompV3Transfer?: undefined;
|
|
2773
|
-
CompV3Withdraw?: undefined;
|
|
2774
2789
|
CurveUsdBorrow?: undefined;
|
|
2775
2790
|
CurveUsdCreate?: undefined;
|
|
2776
2791
|
CurveUsdPayback?: undefined;
|
|
@@ -2849,6 +2864,7 @@ declare const _default: {
|
|
|
2849
2864
|
AaveCollateralSwitch?: undefined;
|
|
2850
2865
|
AaveUnstake?: undefined;
|
|
2851
2866
|
AaveClaimAAVE?: undefined;
|
|
2867
|
+
AaveClaimStkAave?: undefined;
|
|
2852
2868
|
MorphoAaveV2Borrow?: undefined;
|
|
2853
2869
|
MorphoAaveV2Payback?: undefined;
|
|
2854
2870
|
MorphoAaveV2Supply?: undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Action } from '../Action';
|
|
2
|
+
import { EthAddress, uint256 } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* @category Triggers
|
|
7
|
+
*/
|
|
8
|
+
export declare class LiquityDebtInFrontWithLimitTrigger extends Action {
|
|
9
|
+
constructor(troveOwner: EthAddress, debtInFront: uint256);
|
|
10
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Action } from '../Action';
|
|
2
|
+
import { getAddr } from '../addresses';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* @category Triggers
|
|
7
|
+
*/
|
|
8
|
+
export class LiquityDebtInFrontWithLimitTrigger extends Action {
|
|
9
|
+
constructor(troveOwner, debtInFront) {
|
|
10
|
+
super('LiquityDebtInFrontWithLimitTrigger', getAddr('LiquityDebtInFrontWithLimitTrigger'), ['address', 'uint256'], [troveOwner, debtInFront]);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Action } from '../Action';
|
|
2
|
+
import { EthAddress, uint256, uint8 } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* @category Triggers
|
|
7
|
+
*/
|
|
8
|
+
export declare class MorphoAaveV2RatioTrigger extends Action {
|
|
9
|
+
constructor(user: EthAddress, ratio: uint256, state: uint8);
|
|
10
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Action } from '../Action';
|
|
2
|
+
import { getAddr } from '../addresses';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* @category Triggers
|
|
7
|
+
*/
|
|
8
|
+
export class MorphoAaveV2RatioTrigger extends Action {
|
|
9
|
+
constructor(user, ratio, state) {
|
|
10
|
+
super('MorphoAaveV2RatioTrigger', getAddr('MorphoAaveV2RatioTrigger'), ['address', 'uint256', 'uint8'], [user, ratio, state]);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -11,5 +11,7 @@ export * from './CompV3RatioTrigger';
|
|
|
11
11
|
export * from './TrailingStopTrigger';
|
|
12
12
|
export * from './CBRebondTrigger';
|
|
13
13
|
export * from './AaveV3QuotePriceTrigger';
|
|
14
|
+
export * from './MorphoAaveV2RatioTrigger';
|
|
14
15
|
export * from './SparkRatioTrigger';
|
|
15
16
|
export * from './SparkQuotePriceTrigger';
|
|
17
|
+
export * from './LiquityDebtInFrontWithLimitTrigger';
|
|
@@ -11,5 +11,7 @@ export * from './CompV3RatioTrigger';
|
|
|
11
11
|
export * from './TrailingStopTrigger';
|
|
12
12
|
export * from './CBRebondTrigger';
|
|
13
13
|
export * from './AaveV3QuotePriceTrigger';
|
|
14
|
+
export * from './MorphoAaveV2RatioTrigger';
|
|
14
15
|
export * from './SparkRatioTrigger';
|
|
15
16
|
export * from './SparkQuotePriceTrigger';
|
|
17
|
+
export * from './LiquityDebtInFrontWithLimitTrigger';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defisaver/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.58",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./umd/index.js",
|
|
6
6
|
"module": "./esm/src/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"license": "ISC",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@defisaver/eslint-config": "^1.0.0",
|
|
23
|
-
"@defisaver/tokens": "^1.5.
|
|
23
|
+
"@defisaver/tokens": "^1.5.2",
|
|
24
24
|
"@ethersproject/address": "^5.0.10",
|
|
25
25
|
"@ethersproject/solidity": "^5.0.9",
|
|
26
26
|
"@types/web3-eth-abi": "^1.2.2",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { uint8, uint256 } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* LiquityRatioCheckAction - Checks liquity ratio increase for user position and reverts if faulty
|
|
7
|
+
*
|
|
8
|
+
* @category Checkers
|
|
9
|
+
*/
|
|
10
|
+
export class LiquityRatioIncreaseCheckAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param targetRatio The ratio user want to be at
|
|
13
|
+
*/
|
|
14
|
+
constructor(targetRatioIncrease:uint256) {
|
|
15
|
+
super('LiquityRatioIncreaseCheck', getAddr('LiquityRatioIncreaseCheck'), ['uint256'], [targetRatioIncrease]);
|
|
16
|
+
|
|
17
|
+
this.mappableArgs = [
|
|
18
|
+
this.args[0],
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { uint8, uint256, EthAddress } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* MorphoAaveV2RatioCheckAction - Checks Morpho-AaveV2 ratio for user position and reverts if faulty
|
|
7
|
+
*
|
|
8
|
+
* @category Checkers
|
|
9
|
+
*/
|
|
10
|
+
export class MorphoAaveV2RatioCheckAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param ratioState If it should lower/higher
|
|
13
|
+
* @param targetRatio The ratio user want to be at
|
|
14
|
+
* @param user Address of the user we are checking the ratio for (default to proxy)
|
|
15
|
+
*/
|
|
16
|
+
constructor(ratioState:uint8, targetRatio:uint256, user:EthAddress) {
|
|
17
|
+
super('MorphoAaveV2RatioCheck', getAddr('MorphoAaveV2RatioCheck'), ['uint8', 'uint256', 'address'], [ratioState, targetRatio, user]);
|
|
18
|
+
|
|
19
|
+
this.mappableArgs = [
|
|
20
|
+
this.args[0],
|
|
21
|
+
this.args[1],
|
|
22
|
+
this.args[2],
|
|
23
|
+
];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from './MakerRatioCheckAction';
|
|
2
2
|
export * from './AaveV3RatioCheckAction';
|
|
3
3
|
export * from './CompoundV3RatioCheckAction';
|
|
4
|
+
export * from './MorphoAaveV2RatioCheckAction';
|
|
4
5
|
export * from './LiquityRatioCheckAction';
|
|
5
6
|
export * from './SparkRatioCheckAction';
|
|
7
|
+
export * from './LiquityRatioIncreaseCheckAction';
|
package/src/addresses.ts
CHANGED
|
@@ -57,6 +57,7 @@ export const actionAddresses = {
|
|
|
57
57
|
AaveCollateralSwitch: '0xFf5dfF1B90bd5Aa6E12768AB497dB90cc9DE6F5d',
|
|
58
58
|
AaveUnstake: '0x2FE4024e350cD2c64D2fd0Db5d16F5cE54Ca0E09',
|
|
59
59
|
AaveClaimAAVE: '0xd52855bD011F3D87565f9040DdE2A59fB1b27b15',
|
|
60
|
+
AaveClaimStkAave: '0x5Dcd9Dc0185a6Ab07a31e5284D16Ce9f0A79Ce99',
|
|
60
61
|
// aave v3
|
|
61
62
|
AaveV3Withdraw: '0x9D4e4b26A5E2e6Dad30C5d95F5cE78A8310F04C2',
|
|
62
63
|
AaveV3SwapBorrowRateMode: '0x630F530Ac523C935cf2528E62D0A06F8900C5b1B',
|
|
@@ -184,10 +185,10 @@ export const actionAddresses = {
|
|
|
184
185
|
GasFeeTaker: '0x431F1E1A9859EF99953801dbdeB31d2846ADcc0d',
|
|
185
186
|
|
|
186
187
|
CurveStethPoolDeposit: '0x5Ae5870dC0C780e9eb68bE7a223eCd7F3BDad12B',
|
|
187
|
-
CurveStethPoolWithdraw: '
|
|
188
|
+
CurveStethPoolWithdraw: '0x41313695a4829a80c8019Ec8bCC529Fec08F9099',
|
|
188
189
|
|
|
189
190
|
CurveDeposit: '0xf46aCCE6d2559971bF5Aea03A10B3679709CE43d',
|
|
190
|
-
CurveWithdraw: '
|
|
191
|
+
CurveWithdraw: '0x7127A1Cd69eC2A1F91661bc0ED40aD5B73898A54',
|
|
191
192
|
|
|
192
193
|
McdBoostComposite: '0x0000000000000000000000000000000000000000',
|
|
193
194
|
McdRepayComposite: '0x0000000000000000000000000000000000000000',
|
|
@@ -301,6 +302,15 @@ export const actionAddresses = {
|
|
|
301
302
|
AaveV3SwapBorrowRateMode: '0x738042389A8d6B0F6D6ab009c42dfF84ebB737C0',
|
|
302
303
|
AaveV3Withdraw: '0xbf492F869DdB1A18BB4F41b6c3059D9f882Fe7ff',
|
|
303
304
|
|
|
305
|
+
// CompV3
|
|
306
|
+
CompV3Allow: '0x0380E8e13CdE0499c720999930CaA07A5744887c',
|
|
307
|
+
CompV3Borrow: '0x1C0eCc794fDA7c29aBd19E0b2F7dA166C237d616',
|
|
308
|
+
CompV3Claim: '0xDa135F74a24FE2B23ECc35De227f5d3b000c5AdA',
|
|
309
|
+
CompV3Payback: '0xeA8b80944a70e6C290eb00Ae0298d2953aD3aA0C',
|
|
310
|
+
CompV3Supply: '0x82bf73d2083e69344747fff0d51816059db0113c',
|
|
311
|
+
CompV3Transfer: '0x9EB98fA05E89a598288B0386e66052Ba0d0B9911',
|
|
312
|
+
CompV3Withdraw: '0xb6c2dC95201630cAF7568cBdF434d787CD84dB79',
|
|
313
|
+
|
|
304
314
|
// flashloan
|
|
305
315
|
FLAaveV3NoFee: '0x219ac6dA971dE6d943cffD1BD62abde71525d382',
|
|
306
316
|
FLAaveV3: '0x53953aCEe438c083e4299F7976f03Ff3cb862161',
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Action } from '../Action';
|
|
2
|
+
import { getAddr } from '../addresses';
|
|
3
|
+
import { EthAddress, uint256, uint8 } from '../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* @category Triggers
|
|
9
|
+
*/
|
|
10
|
+
export class LiquityDebtInFrontWithLimitTrigger extends Action {
|
|
11
|
+
constructor(troveOwner:EthAddress, debtInFront:uint256) {
|
|
12
|
+
super(
|
|
13
|
+
'LiquityDebtInFrontWithLimitTrigger',
|
|
14
|
+
getAddr('LiquityDebtInFrontWithLimitTrigger'),
|
|
15
|
+
['address', 'uint256'],
|
|
16
|
+
[troveOwner, debtInFront],
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
}
|