@defisaver/sdk 1.0.60 → 1.0.62
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/aave/AaveBorrowAction.js +8 -0
- package/esm/src/actions/basic/ApproveTokenAction.js +5 -0
- package/esm/src/actions/basic/CreateSubAction.js +2 -1
- package/esm/src/actions/basic/LSVSellAction.d.ts +23 -0
- package/esm/src/actions/basic/LSVSellAction.js +61 -0
- package/esm/src/actions/basic/UpdateSubAction.js +1 -1
- package/esm/src/actions/basic/index.d.ts +2 -1
- package/esm/src/actions/basic/index.js +2 -1
- package/esm/src/actions/checkers/AaveV2RatioCheckAction.d.ts +14 -0
- package/esm/src/actions/checkers/AaveV2RatioCheckAction.js +20 -0
- package/esm/src/actions/checkers/CompoundV2RatioCheckAction.d.ts +14 -0
- package/esm/src/actions/checkers/CompoundV2RatioCheckAction.js +20 -0
- package/esm/src/actions/checkers/CurveUsdCollRatioCheck.d.ts +15 -0
- package/esm/src/actions/checkers/CurveUsdCollRatioCheck.js +22 -0
- package/esm/src/actions/checkers/index.d.ts +4 -1
- package/esm/src/actions/checkers/index.js +4 -1
- package/esm/src/actions/curveusd/CurveUsdGetDebtAction.d.ts +8 -0
- package/esm/src/actions/curveusd/CurveUsdGetDebtAction.js +13 -0
- package/esm/src/actions/curveusd/index.d.ts +1 -0
- package/esm/src/actions/curveusd/index.js +1 -0
- package/esm/src/actions/flashloan/AaveV3FlashLoanCarryDebtAction.d.ts +18 -0
- package/esm/src/actions/flashloan/AaveV3FlashLoanCarryDebtAction.js +28 -0
- package/esm/src/actions/flashloan/index.d.ts +1 -0
- package/esm/src/actions/flashloan/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/lsv/LSVBorrowAction.d.ts +14 -0
- package/esm/src/actions/lsv/LSVBorrowAction.js +19 -0
- package/esm/src/actions/lsv/LSVPaybackAction.d.ts +13 -0
- package/esm/src/actions/lsv/LSVPaybackAction.js +18 -0
- package/esm/src/actions/lsv/LSVSupplyAction.d.ts +15 -0
- package/esm/src/actions/lsv/LSVSupplyAction.js +21 -0
- package/esm/src/actions/lsv/LSVWithdrawAction.d.ts +15 -0
- package/esm/src/actions/lsv/LSVWithdrawAction.js +21 -0
- package/esm/src/actions/lsv/index.d.ts +4 -0
- package/esm/src/actions/lsv/index.js +4 -0
- package/esm/src/actions/morpho/aaveV3/MorphoAaveV3SetManagerAction.d.ts +14 -0
- package/esm/src/actions/morpho/aaveV3/MorphoAaveV3SetManagerAction.js +24 -0
- package/esm/src/actions/morpho/index.d.ts +1 -0
- package/esm/src/actions/morpho/index.js +1 -0
- package/esm/src/addresses.d.ts +43 -3
- package/esm/src/addresses.js +12 -0
- package/esm/src/index.d.ts +172 -12
- package/esm/src/triggers/AaveV2RatioTrigger.d.ts +10 -0
- package/esm/src/triggers/AaveV2RatioTrigger.js +12 -0
- package/esm/src/triggers/CurveUsdCollRatioTrigger.d.ts +10 -0
- package/esm/src/triggers/CurveUsdCollRatioTrigger.js +12 -0
- package/esm/src/triggers/index.d.ts +2 -0
- package/esm/src/triggers/index.js +2 -0
- package/esm/src/utils/curveusd-utils.d.ts +10 -0
- package/esm/src/utils/curveusd-utils.js +7 -3
- package/package.json +1 -1
- package/src/actions/aave/AaveBorrowAction.ts +9 -0
- package/src/actions/basic/ApproveTokenAction.ts +5 -0
- package/src/actions/basic/CreateSubAction.ts +3 -3
- package/src/actions/basic/LSVSellAction.ts +61 -0
- package/src/actions/basic/UpdateSubAction.ts +1 -1
- package/src/actions/basic/index.ts +2 -1
- package/src/actions/checkers/AaveV2RatioCheckAction.ts +23 -0
- package/src/actions/checkers/CompoundV2RatioCheckAction.ts +23 -0
- package/src/actions/checkers/CurveUsdCollRatioCheck.ts +25 -0
- package/src/actions/checkers/index.ts +4 -1
- package/src/actions/curveusd/CurveUsdGetDebtAction.ts +21 -0
- package/src/actions/curveusd/index.ts +2 -1
- package/src/actions/flashloan/AaveV3FlashLoanCarryDebtAction.ts +35 -0
- package/src/actions/flashloan/index.ts +1 -0
- package/src/actions/index.ts +2 -0
- package/src/actions/lsv/LSVBorrowAction.ts +21 -0
- package/src/actions/lsv/LSVPaybackAction.ts +20 -0
- package/src/actions/lsv/LSVSupplyAction.ts +23 -0
- package/src/actions/lsv/LSVWithdrawAction.ts +23 -0
- package/src/actions/lsv/index.ts +4 -0
- package/src/actions/morpho/aaveV3/MorphoAaveV3SetManagerAction.ts +32 -0
- package/src/actions/morpho/index.ts +1 -0
- package/src/addresses.ts +13 -0
- package/src/triggers/AaveV2RatioTrigger.ts +14 -0
- package/src/triggers/CurveUsdCollRatioTrigger.ts +14 -0
- package/src/triggers/index.ts +2 -0
- package/src/utils/basic-utils.ts +1 -1
- package/src/utils/curveusd-utils.ts +7 -3
- package/test/actions/basic/CreateSubAction.js +29 -0
- package/umd/index.js +1554 -1127
|
@@ -18,5 +18,13 @@ export class AaveBorrowAction extends Action {
|
|
|
18
18
|
constructor(market, tokenAddr, amount, rateMode, to, onBehalf = getAddr('Empty')) {
|
|
19
19
|
requireAddress(to);
|
|
20
20
|
super('AaveBorrow', getAddr('AaveBorrow'), ['address', 'address', 'uint256', 'uint256', 'address', 'address'], [market, tokenAddr, amount, rateMode, to, onBehalf]);
|
|
21
|
+
this.mappableArgs = [
|
|
22
|
+
this.args[0],
|
|
23
|
+
this.args[1],
|
|
24
|
+
this.args[2],
|
|
25
|
+
this.args[3],
|
|
26
|
+
this.args[4],
|
|
27
|
+
this.args[5],
|
|
28
|
+
];
|
|
21
29
|
}
|
|
22
30
|
}
|
|
@@ -28,6 +28,11 @@ export class ApproveTokenAction extends Action {
|
|
|
28
28
|
'address',
|
|
29
29
|
'uint',
|
|
30
30
|
], [token, spender, amount]);
|
|
31
|
+
this.mappableArgs = [
|
|
32
|
+
this.args[0],
|
|
33
|
+
this.args[1],
|
|
34
|
+
this.args[2],
|
|
35
|
+
];
|
|
31
36
|
}
|
|
32
37
|
getAssetsToApprove() {
|
|
33
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -10,7 +10,8 @@ export class CreateSubAction extends Action {
|
|
|
10
10
|
* @param sub object that contains new sub information
|
|
11
11
|
*/
|
|
12
12
|
constructor(sub) {
|
|
13
|
-
super('CreateSub', getAddr('CreateSub'), ['
|
|
13
|
+
super('CreateSub', getAddr('CreateSub'), [['uint64', 'bool', 'bytes[]', 'bytes32[]']], [sub]);
|
|
14
|
+
this.mappableArgs = [];
|
|
14
15
|
for (let i = 0; i < this.args[0][3].length; i++) {
|
|
15
16
|
this.mappableArgs.push(this.args[0][3][i]);
|
|
16
17
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ActionWithL2 } from '../../ActionWithL2';
|
|
2
|
+
import { EthAddress } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Sells token on DeFi Saver exchange aggregator without fee
|
|
5
|
+
*
|
|
6
|
+
* @category BasicActions
|
|
7
|
+
*/
|
|
8
|
+
export declare class LSVSellAction extends ActionWithL2 {
|
|
9
|
+
protocolFee: string;
|
|
10
|
+
/**
|
|
11
|
+
* @param exchangeOrder Standard DFS Exchange data
|
|
12
|
+
* @param from Order sender
|
|
13
|
+
* @param to Order recipient
|
|
14
|
+
* @param protocolFee 0x fee (amount of ETH in Wei)
|
|
15
|
+
*/
|
|
16
|
+
constructor(exchangeOrder: Array<any>, from: EthAddress, to: EthAddress, protocolFee?: string);
|
|
17
|
+
encodeInputs(): string;
|
|
18
|
+
getAssetsToApprove(): Promise<{
|
|
19
|
+
asset: any;
|
|
20
|
+
owner: any;
|
|
21
|
+
}[]>;
|
|
22
|
+
getEthValue(): Promise<string>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import AbiCoder from 'web3-eth-abi';
|
|
11
|
+
import { getAssetInfoByAddress } from '@defisaver/tokens';
|
|
12
|
+
import ActionAbi from '../../abis/Action.json';
|
|
13
|
+
import { ActionWithL2 } from '../../ActionWithL2';
|
|
14
|
+
import { requireAddress } from '../../utils/general';
|
|
15
|
+
import { getAddr } from '../../addresses';
|
|
16
|
+
/**
|
|
17
|
+
* Sells token on DeFi Saver exchange aggregator without fee
|
|
18
|
+
*
|
|
19
|
+
* @category BasicActions
|
|
20
|
+
*/
|
|
21
|
+
export class LSVSellAction extends ActionWithL2 {
|
|
22
|
+
/**
|
|
23
|
+
* @param exchangeOrder Standard DFS Exchange data
|
|
24
|
+
* @param from Order sender
|
|
25
|
+
* @param to Order recipient
|
|
26
|
+
* @param protocolFee 0x fee (amount of ETH in Wei)
|
|
27
|
+
*/
|
|
28
|
+
constructor(exchangeOrder, from, to, protocolFee = '0') {
|
|
29
|
+
requireAddress(to);
|
|
30
|
+
super('LSVSell', getAddr('LSVSell'), [
|
|
31
|
+
['address', 'address', 'uint256', 'uint256', 'uint256', 'uint256', 'address', 'address', 'bytes', ['address', 'address', 'address', 'uint256', 'uint256', 'bytes']],
|
|
32
|
+
'address',
|
|
33
|
+
'address',
|
|
34
|
+
], [exchangeOrder, from, to]);
|
|
35
|
+
this.protocolFee = protocolFee;
|
|
36
|
+
this.mappableArgs = [
|
|
37
|
+
this.args[0][0],
|
|
38
|
+
this.args[0][1],
|
|
39
|
+
this.args[0][2],
|
|
40
|
+
this.args[1],
|
|
41
|
+
this.args[2],
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
encodeInputs() {
|
|
45
|
+
const executeActionDirectAbi = (ActionAbi.find(({ name }) => name === 'executeActionDirect'));
|
|
46
|
+
return AbiCoder.encodeFunctionCall(executeActionDirectAbi, this._encodeForCall());
|
|
47
|
+
}
|
|
48
|
+
getAssetsToApprove() {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const asset = getAssetInfoByAddress(this.args[0][0]);
|
|
51
|
+
if (asset.symbol !== 'ETH')
|
|
52
|
+
return [{ asset: this.args[0][0], owner: this.args[1] }];
|
|
53
|
+
return [];
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
getEthValue() {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
return this.protocolFee || '0';
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -11,7 +11,7 @@ export class UpdateSubAction extends Action {
|
|
|
11
11
|
* @param sub object that contains new sub information
|
|
12
12
|
*/
|
|
13
13
|
constructor(subId, sub) {
|
|
14
|
-
super('UpdateSub', getAddr('UpdateSub'), ['uint256', '
|
|
14
|
+
super('UpdateSub', getAddr('UpdateSub'), ['uint256', ['uint64', 'bool', 'bytes[]', 'bytes32[]']], [subId, sub]);
|
|
15
15
|
this.mappableArgs = [
|
|
16
16
|
this.args[0],
|
|
17
17
|
];
|
|
@@ -16,10 +16,11 @@ export * from './GasFeeActionL2';
|
|
|
16
16
|
export * from './TransferNFTAction';
|
|
17
17
|
export * from './SendTokensAction';
|
|
18
18
|
export * from './CreateSubAction';
|
|
19
|
+
export * from './LSVSellAction';
|
|
20
|
+
export * from './ApproveTokenAction';
|
|
19
21
|
export * from './SDaiWrapAction';
|
|
20
22
|
export * from './SDaiUnwrapAction';
|
|
21
23
|
export * from './TokenizedVaultAdapterDepositAction';
|
|
22
24
|
export * from './TokenizedVaultAdapterMintAction';
|
|
23
25
|
export * from './TokenizedVaultAdapterRedeemAction';
|
|
24
26
|
export * from './TokenizedVaultAdapterWithdrawAction';
|
|
25
|
-
export * from './ApproveTokenAction';
|
|
@@ -16,10 +16,11 @@ export * from './GasFeeActionL2';
|
|
|
16
16
|
export * from './TransferNFTAction';
|
|
17
17
|
export * from './SendTokensAction';
|
|
18
18
|
export * from './CreateSubAction';
|
|
19
|
+
export * from './LSVSellAction';
|
|
20
|
+
export * from './ApproveTokenAction';
|
|
19
21
|
export * from './SDaiWrapAction';
|
|
20
22
|
export * from './SDaiUnwrapAction';
|
|
21
23
|
export * from './TokenizedVaultAdapterDepositAction';
|
|
22
24
|
export * from './TokenizedVaultAdapterMintAction';
|
|
23
25
|
export * from './TokenizedVaultAdapterRedeemAction';
|
|
24
26
|
export * from './TokenizedVaultAdapterWithdrawAction';
|
|
25
|
-
export * from './ApproveTokenAction';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { uint8, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* AaveV2RatioCheckAction - Checks aave 2 ratio for users proxy position and reverts if faulty
|
|
5
|
+
*
|
|
6
|
+
* @category Checkers
|
|
7
|
+
*/
|
|
8
|
+
export declare class AaveV2RatioCheckAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param ratioState If it should lower/higher
|
|
11
|
+
* @param targetRatio The ratio user want to be at
|
|
12
|
+
*/
|
|
13
|
+
constructor(ratioState: uint8, targetRatio: uint256);
|
|
14
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* AaveV2RatioCheckAction - Checks aave 2 ratio for users proxy position and reverts if faulty
|
|
5
|
+
*
|
|
6
|
+
* @category Checkers
|
|
7
|
+
*/
|
|
8
|
+
export class AaveV2RatioCheckAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param ratioState If it should lower/higher
|
|
11
|
+
* @param targetRatio The ratio user want to be at
|
|
12
|
+
*/
|
|
13
|
+
constructor(ratioState, targetRatio) {
|
|
14
|
+
super('AaveV2RatioCheck', getAddr('AaveV2RatioCheck'), ['uint8', 'uint256'], [ratioState, targetRatio]);
|
|
15
|
+
this.mappableArgs = [
|
|
16
|
+
this.args[0],
|
|
17
|
+
this.args[1],
|
|
18
|
+
];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { uint8, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* CompoundV2RatioCheckAction - Checks comp V2 ratio for user position and reverts if faulty
|
|
5
|
+
*
|
|
6
|
+
* @category Checkers
|
|
7
|
+
*/
|
|
8
|
+
export declare class CompoundV2RatioCheckAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param ratioState If it should lower/higher
|
|
11
|
+
* @param targetRatio The ratio user want to be at
|
|
12
|
+
*/
|
|
13
|
+
constructor(ratioState: uint8, targetRatio: uint256);
|
|
14
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* CompoundV2RatioCheckAction - Checks comp V2 ratio for user position and reverts if faulty
|
|
5
|
+
*
|
|
6
|
+
* @category Checkers
|
|
7
|
+
*/
|
|
8
|
+
export class CompoundV2RatioCheckAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param ratioState If it should lower/higher
|
|
11
|
+
* @param targetRatio The ratio user want to be at
|
|
12
|
+
*/
|
|
13
|
+
constructor(ratioState, targetRatio) {
|
|
14
|
+
super('CompV2RatioCheck', getAddr('CompV2RatioCheck'), ['uint8', 'uint256'], [ratioState, targetRatio]);
|
|
15
|
+
this.mappableArgs = [
|
|
16
|
+
this.args[0],
|
|
17
|
+
this.args[1],
|
|
18
|
+
];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { uint8, uint256, EthAddress } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* CurveUsdCollRatioCheck - Checks curveusd coll ratio for user position and reverts if faulty
|
|
5
|
+
*
|
|
6
|
+
* @category Checkers
|
|
7
|
+
*/
|
|
8
|
+
export declare class CurveUsdCollRatioCheck extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param ratioState If it should lower/higher
|
|
11
|
+
* @param targetRatio The ratio user want to be at
|
|
12
|
+
* @param controllerAddr
|
|
13
|
+
*/
|
|
14
|
+
constructor(ratioState: uint8, targetRatio: uint256, controllerAddr: EthAddress);
|
|
15
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* CurveUsdCollRatioCheck - Checks curveusd coll ratio for user position and reverts if faulty
|
|
5
|
+
*
|
|
6
|
+
* @category Checkers
|
|
7
|
+
*/
|
|
8
|
+
export class CurveUsdCollRatioCheck extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param ratioState If it should lower/higher
|
|
11
|
+
* @param targetRatio The ratio user want to be at
|
|
12
|
+
* @param controllerAddr
|
|
13
|
+
*/
|
|
14
|
+
constructor(ratioState, targetRatio, controllerAddr) {
|
|
15
|
+
super('CurveUsdCollRatioCheck', getAddr('CurveUsdCollRatioCheck'), ['uint8', 'uint256', 'address'], [ratioState, targetRatio, controllerAddr]);
|
|
16
|
+
this.mappableArgs = [
|
|
17
|
+
this.args[0],
|
|
18
|
+
this.args[1],
|
|
19
|
+
this.args[2],
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export * from './MakerRatioCheckAction';
|
|
2
2
|
export * from './AaveV3RatioCheckAction';
|
|
3
3
|
export * from './CompoundV3RatioCheckAction';
|
|
4
|
-
export * from './MorphoAaveV2RatioCheckAction';
|
|
5
4
|
export * from './LiquityRatioCheckAction';
|
|
5
|
+
export * from './AaveV2RatioCheckAction';
|
|
6
|
+
export * from './CompoundV2RatioCheckAction';
|
|
7
|
+
export * from './MorphoAaveV2RatioCheckAction';
|
|
6
8
|
export * from './SparkRatioCheckAction';
|
|
7
9
|
export * from './LiquityRatioIncreaseCheckAction';
|
|
10
|
+
export * from './CurveUsdCollRatioCheck';
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export * from './MakerRatioCheckAction';
|
|
2
2
|
export * from './AaveV3RatioCheckAction';
|
|
3
3
|
export * from './CompoundV3RatioCheckAction';
|
|
4
|
-
export * from './MorphoAaveV2RatioCheckAction';
|
|
5
4
|
export * from './LiquityRatioCheckAction';
|
|
5
|
+
export * from './AaveV2RatioCheckAction';
|
|
6
|
+
export * from './CompoundV2RatioCheckAction';
|
|
7
|
+
export * from './MorphoAaveV2RatioCheckAction';
|
|
6
8
|
export * from './SparkRatioCheckAction';
|
|
7
9
|
export * from './LiquityRatioIncreaseCheckAction';
|
|
10
|
+
export * from './CurveUsdCollRatioCheck';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* @category CurveUsd
|
|
5
|
+
*/
|
|
6
|
+
export class CurveUsdGetDebtAction extends Action {
|
|
7
|
+
constructor(controllerAddr, debtor) {
|
|
8
|
+
super('CurveUsdGetDebt', getAddr('CurveUsdGetDebt'), [
|
|
9
|
+
'address',
|
|
10
|
+
'address',
|
|
11
|
+
], [controllerAddr, debtor]);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ActionWithL2 } from '../../ActionWithL2';
|
|
2
|
+
import { EthAddress, uint256, bytes } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Gets a flashloan from Aave v3 and opens a debt position instead of repaying
|
|
5
|
+
*
|
|
6
|
+
* @category Flashloans
|
|
7
|
+
*/
|
|
8
|
+
export declare class AaveV3FlashLoanCarryDebtAction extends ActionWithL2 {
|
|
9
|
+
/**
|
|
10
|
+
* @param loanAmounts
|
|
11
|
+
* @param tokens
|
|
12
|
+
* @param modes
|
|
13
|
+
* @param loanPayer
|
|
14
|
+
* @param flParamGetterAddr
|
|
15
|
+
* @param flParamGetterData
|
|
16
|
+
*/
|
|
17
|
+
constructor(tokens: Array<EthAddress>, loanAmounts: Array<uint256>, modes: Array<uint256>, loanPayer: EthAddress, flParamGetterAddr?: EthAddress, flParamGetterData?: bytes);
|
|
18
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ActionWithL2 } from '../../ActionWithL2';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* Gets a flashloan from Aave v3 and opens a debt position instead of repaying
|
|
5
|
+
*
|
|
6
|
+
* @category Flashloans
|
|
7
|
+
*/
|
|
8
|
+
export class AaveV3FlashLoanCarryDebtAction extends ActionWithL2 {
|
|
9
|
+
/**
|
|
10
|
+
* @param loanAmounts
|
|
11
|
+
* @param tokens
|
|
12
|
+
* @param modes
|
|
13
|
+
* @param loanPayer
|
|
14
|
+
* @param flParamGetterAddr
|
|
15
|
+
* @param flParamGetterData
|
|
16
|
+
*/
|
|
17
|
+
constructor(tokens, loanAmounts, modes, loanPayer, flParamGetterAddr = getAddr('Empty'), flParamGetterData = []) {
|
|
18
|
+
super('FLAaveV3CarryDebt', getAddr('FLAaveV3CarryDebt'), ['address[]', 'uint256[]', 'uint256[]', 'address', 'address', 'bytes', 'bytes'], [tokens, loanAmounts, modes, loanPayer, flParamGetterAddr, flParamGetterData, []]);
|
|
19
|
+
if (tokens.length !== modes.length || tokens.length !== loanAmounts.length) {
|
|
20
|
+
throw new Error('Arrays must be of the same length');
|
|
21
|
+
}
|
|
22
|
+
modes.forEach((mode) => {
|
|
23
|
+
if (mode.toString() !== '1' && mode.toString() !== '2') {
|
|
24
|
+
throw new Error('Invalid borrow mode set');
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -6,6 +6,7 @@ export * from './AaveV3FlashLoanAction';
|
|
|
6
6
|
export * from './AaveV3FlashLoanPaybackAction';
|
|
7
7
|
export * from './AaveV3FlashLoanNoFeeAction';
|
|
8
8
|
export * from './AaveV3FlashLoanNoFeePaybackAction';
|
|
9
|
+
export * from './AaveV3FlashLoanCarryDebtAction';
|
|
9
10
|
export * from './SparkFlashLoanAction';
|
|
10
11
|
export * from './SparkFlashLoanPaybackAction';
|
|
11
12
|
export * from './MakerFlashLoanAction';
|
|
@@ -6,6 +6,7 @@ export * from './AaveV3FlashLoanAction';
|
|
|
6
6
|
export * from './AaveV3FlashLoanPaybackAction';
|
|
7
7
|
export * from './AaveV3FlashLoanNoFeeAction';
|
|
8
8
|
export * from './AaveV3FlashLoanNoFeePaybackAction';
|
|
9
|
+
export * from './AaveV3FlashLoanCarryDebtAction';
|
|
9
10
|
export * from './SparkFlashLoanAction';
|
|
10
11
|
export * from './SparkFlashLoanPaybackAction';
|
|
11
12
|
export * from './MakerFlashLoanAction';
|
|
@@ -23,6 +23,7 @@ import * as chickenBonds from './chickenBonds';
|
|
|
23
23
|
import * as compoundV3 from './compoundV3';
|
|
24
24
|
import * as morpho from './morpho';
|
|
25
25
|
import * as bprotocol from './bprotocol';
|
|
26
|
+
import * as lsv from './lsv';
|
|
26
27
|
import * as curveusd from './curveusd';
|
|
27
28
|
import * as spark from './spark';
|
|
28
|
-
export { aave, maker, compound, basic, flashloan, uniswap, reflexer, dydx, uniswapV3, checkers, liquity, yearn, lido, insta, balancer, curve, guni, mstable, rari, aaveV3, convex, chickenBonds, compoundV3, morpho, bprotocol, spark, curveusd, };
|
|
29
|
+
export { aave, maker, compound, basic, flashloan, uniswap, reflexer, dydx, uniswapV3, checkers, liquity, yearn, lido, insta, balancer, curve, guni, mstable, rari, aaveV3, convex, chickenBonds, compoundV3, morpho, bprotocol, lsv, spark, curveusd, };
|
package/esm/src/actions/index.js
CHANGED
|
@@ -23,6 +23,7 @@ import * as chickenBonds from './chickenBonds';
|
|
|
23
23
|
import * as compoundV3 from './compoundV3';
|
|
24
24
|
import * as morpho from './morpho';
|
|
25
25
|
import * as bprotocol from './bprotocol';
|
|
26
|
+
import * as lsv from './lsv';
|
|
26
27
|
import * as curveusd from './curveusd';
|
|
27
28
|
import * as spark from './spark';
|
|
28
|
-
export { aave, maker, compound, basic, flashloan, uniswap, reflexer, dydx, uniswapV3, checkers, liquity, yearn, lido, insta, balancer, curve, guni, mstable, rari, aaveV3, convex, chickenBonds, compoundV3, morpho, bprotocol, spark, curveusd, };
|
|
29
|
+
export { aave, maker, compound, basic, flashloan, uniswap, reflexer, dydx, uniswapV3, checkers, liquity, yearn, lido, insta, balancer, curve, guni, mstable, rari, aaveV3, convex, chickenBonds, compoundV3, morpho, bprotocol, lsv, spark, curveusd, };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { uint256, uint8 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* @category LSV
|
|
7
|
+
*/
|
|
8
|
+
export declare class LSVBorrowAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param protocol
|
|
11
|
+
* @param amount
|
|
12
|
+
*/
|
|
13
|
+
constructor(protocol: uint8, amount: uint256);
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* @category LSV
|
|
7
|
+
*/
|
|
8
|
+
export class LSVBorrowAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param protocol
|
|
11
|
+
* @param amount
|
|
12
|
+
*/
|
|
13
|
+
constructor(protocol, amount) {
|
|
14
|
+
super('LSVBorrow', getAddr('LSVBorrow'), ['uint256', 'uint256'], [protocol, amount]);
|
|
15
|
+
this.mappableArgs = [
|
|
16
|
+
this.args[1],
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { uint8, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @category LSV
|
|
6
|
+
*/
|
|
7
|
+
export declare class LSVPaybackAction extends Action {
|
|
8
|
+
/**
|
|
9
|
+
* @param protocol
|
|
10
|
+
* @param amount
|
|
11
|
+
*/
|
|
12
|
+
constructor(protocol: uint8, amount: uint256);
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @category LSV
|
|
6
|
+
*/
|
|
7
|
+
export class LSVPaybackAction extends Action {
|
|
8
|
+
/**
|
|
9
|
+
* @param protocol
|
|
10
|
+
* @param amount
|
|
11
|
+
*/
|
|
12
|
+
constructor(protocol, amount) {
|
|
13
|
+
super('LSVPayback', getAddr('LSVPayback'), ['uint256', 'uint256'], [protocol, amount]);
|
|
14
|
+
this.mappableArgs = [
|
|
15
|
+
this.args[1],
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256, uint8 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* @category LSV
|
|
7
|
+
*/
|
|
8
|
+
export declare class LSVSupplyAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param protocol
|
|
11
|
+
* @param token
|
|
12
|
+
* @param amount
|
|
13
|
+
*/
|
|
14
|
+
constructor(protocol: uint8, token: EthAddress, amount: uint256);
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* @category LSV
|
|
7
|
+
*/
|
|
8
|
+
export class LSVSupplyAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param protocol
|
|
11
|
+
* @param token
|
|
12
|
+
* @param amount
|
|
13
|
+
*/
|
|
14
|
+
constructor(protocol, token, amount) {
|
|
15
|
+
super('LSVSupply', getAddr('LSVSupply'), ['uint256', 'address', 'uint256'], [protocol, token, amount]);
|
|
16
|
+
this.mappableArgs = [
|
|
17
|
+
this.args[1],
|
|
18
|
+
this.args[2],
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256, uint8 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @category LSV
|
|
6
|
+
*/
|
|
7
|
+
export declare class LSVWithdrawAction extends Action {
|
|
8
|
+
/**
|
|
9
|
+
* @param protocol
|
|
10
|
+
* @param token
|
|
11
|
+
* @param amount
|
|
12
|
+
* @param isPositionClosing
|
|
13
|
+
*/
|
|
14
|
+
constructor(protocol: uint8, token: EthAddress, amount: uint256, isPositionClosing: boolean);
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @category LSV
|
|
6
|
+
*/
|
|
7
|
+
export class LSVWithdrawAction extends Action {
|
|
8
|
+
/**
|
|
9
|
+
* @param protocol
|
|
10
|
+
* @param token
|
|
11
|
+
* @param amount
|
|
12
|
+
* @param isPositionClosing
|
|
13
|
+
*/
|
|
14
|
+
constructor(protocol, token, amount, isPositionClosing) {
|
|
15
|
+
super('LSVWithdraw', getAddr('LSVWithdraw'), ['uint256', 'address', 'uint256', 'bool'], [protocol, token, amount, isPositionClosing]);
|
|
16
|
+
this.mappableArgs = [
|
|
17
|
+
this.args[1],
|
|
18
|
+
this.args[2],
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Action } from '../../../Action';
|
|
2
|
+
import { EthAddress, uint256 } from '../../../types';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @category MorphoAaveV3
|
|
6
|
+
*/
|
|
7
|
+
export declare class MorphoAaveV3SetManagerAction extends Action {
|
|
8
|
+
/**
|
|
9
|
+
* @param emodeId
|
|
10
|
+
* @param manager
|
|
11
|
+
* @param isAllowed
|
|
12
|
+
*/
|
|
13
|
+
constructor(emodeId: uint256, manager: EthAddress, isAllowed: boolean);
|
|
14
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Action } from '../../../Action';
|
|
2
|
+
import { getAddr } from '../../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @category MorphoAaveV3
|
|
6
|
+
*/
|
|
7
|
+
export class MorphoAaveV3SetManagerAction extends Action {
|
|
8
|
+
/**
|
|
9
|
+
* @param emodeId
|
|
10
|
+
* @param manager
|
|
11
|
+
* @param isAllowed
|
|
12
|
+
*/
|
|
13
|
+
constructor(emodeId, manager, isAllowed) {
|
|
14
|
+
super('MorphoAaveV3SetManager', getAddr('MorphoAaveV3SetManager'), [
|
|
15
|
+
'uint256',
|
|
16
|
+
'address',
|
|
17
|
+
'bool',
|
|
18
|
+
], [emodeId, manager, isAllowed]);
|
|
19
|
+
this.mappableArgs = [
|
|
20
|
+
this.args[0],
|
|
21
|
+
this.args[1],
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
}
|