@defisaver/sdk 1.0.35 → 1.0.37
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/SDaiUnwrapAction.d.ts +15 -0
- package/esm/src/actions/basic/SDaiUnwrapAction.js +24 -0
- package/esm/src/actions/basic/SDaiWrapAction.d.ts +15 -0
- package/esm/src/actions/basic/SDaiWrapAction.js +24 -0
- package/esm/src/actions/basic/index.d.ts +2 -0
- package/esm/src/actions/basic/index.js +2 -0
- package/esm/src/actions/checkers/SparkRatioCheckAction.d.ts +14 -0
- package/esm/src/actions/checkers/SparkRatioCheckAction.js +20 -0
- package/esm/src/actions/checkers/index.d.ts +1 -0
- package/esm/src/actions/checkers/index.js +1 -0
- package/esm/src/actions/curveusd/CurveUsdBorrowAction.d.ts +15 -0
- package/esm/src/actions/curveusd/CurveUsdBorrowAction.js +22 -0
- package/esm/src/actions/curveusd/CurveUsdCreateAction.d.ts +22 -0
- package/esm/src/actions/curveusd/CurveUsdCreateAction.js +44 -0
- package/esm/src/actions/curveusd/CurveUsdLevCreateAction.d.ts +9 -0
- package/esm/src/actions/curveusd/CurveUsdLevCreateAction.js +16 -0
- package/esm/src/actions/curveusd/CurveUsdPaybackAction.d.ts +22 -0
- package/esm/src/actions/curveusd/CurveUsdPaybackAction.js +43 -0
- package/esm/src/actions/curveusd/CurveUsdRepayAction.d.ts +9 -0
- package/esm/src/actions/curveusd/CurveUsdRepayAction.js +14 -0
- package/esm/src/actions/curveusd/CurveUsdSelfLiquidateAction.d.ts +19 -0
- package/esm/src/actions/curveusd/CurveUsdSelfLiquidateAction.js +38 -0
- package/esm/src/actions/curveusd/CurveUsdSelfLiquidateWithCollAction.d.ts +9 -0
- package/esm/src/actions/curveusd/CurveUsdSelfLiquidateWithCollAction.js +16 -0
- package/esm/src/actions/curveusd/CurveUsdSupplyAction.d.ts +20 -0
- package/esm/src/actions/curveusd/CurveUsdSupplyAction.js +40 -0
- package/esm/src/actions/curveusd/CurveUsdWithdrawAction.d.ts +15 -0
- package/esm/src/actions/curveusd/CurveUsdWithdrawAction.js +22 -0
- package/esm/src/actions/curveusd/index.d.ts +9 -0
- package/esm/src/actions/curveusd/index.js +9 -0
- package/esm/src/actions/flashloan/FLAction.js +8 -2
- package/esm/src/actions/flashloan/SparkFlashLoanAction.d.ts +18 -0
- package/esm/src/actions/flashloan/SparkFlashLoanAction.js +20 -0
- package/esm/src/actions/flashloan/SparkFlashLoanPaybackAction.d.ts +14 -0
- package/esm/src/actions/flashloan/SparkFlashLoanPaybackAction.js +16 -0
- package/esm/src/actions/flashloan/index.d.ts +2 -0
- package/esm/src/actions/flashloan/index.js +2 -0
- package/esm/src/actions/index.d.ts +3 -1
- package/esm/src/actions/index.js +3 -1
- package/esm/src/actions/spark/SparkBorrowAction.d.ts +21 -0
- package/esm/src/actions/spark/SparkBorrowAction.js +59 -0
- package/esm/src/actions/spark/SparkClaimRewardsAction.d.ts +18 -0
- package/esm/src/actions/spark/SparkClaimRewardsAction.js +40 -0
- package/esm/src/actions/spark/SparkCollateralSwitchAction.d.ts +18 -0
- package/esm/src/actions/spark/SparkCollateralSwitchAction.js +39 -0
- package/esm/src/actions/spark/SparkPaybackAction.d.ts +27 -0
- package/esm/src/actions/spark/SparkPaybackAction.js +77 -0
- package/esm/src/actions/spark/SparkSetEModeAction.d.ts +16 -0
- package/esm/src/actions/spark/SparkSetEModeAction.js +33 -0
- package/esm/src/actions/spark/SparkSpTokenPaybackAction.d.ts +25 -0
- package/esm/src/actions/spark/SparkSpTokenPaybackAction.js +64 -0
- package/esm/src/actions/spark/SparkSupplyAction.d.ts +27 -0
- package/esm/src/actions/spark/SparkSupplyAction.js +77 -0
- package/esm/src/actions/spark/SparkSwapBorrowRateModeAction.d.ts +18 -0
- package/esm/src/actions/spark/SparkSwapBorrowRateModeAction.js +38 -0
- package/esm/src/actions/spark/SparkWithdrawAction.d.ts +18 -0
- package/esm/src/actions/spark/SparkWithdrawAction.js +45 -0
- package/esm/src/actions/spark/index.d.ts +9 -0
- package/esm/src/actions/spark/index.js +9 -0
- package/esm/src/addresses.d.ts +66 -0
- package/esm/src/addresses.js +24 -0
- package/esm/src/index.d.ts +264 -0
- package/esm/src/triggers/SparkQuotePriceTrigger.d.ts +10 -0
- package/esm/src/triggers/SparkQuotePriceTrigger.js +12 -0
- package/esm/src/triggers/SparkRatioTrigger.d.ts +10 -0
- package/esm/src/triggers/SparkRatioTrigger.js +12 -0
- package/esm/src/triggers/index.d.ts +2 -0
- package/esm/src/triggers/index.js +2 -0
- package/esm/src/types.d.ts +3 -1
- package/esm/src/utils/curveusd-utils.d.ts +20 -0
- package/esm/src/utils/curveusd-utils.js +12 -0
- package/esm/src/utils/index.d.ts +2 -1
- package/esm/src/utils/index.js +2 -1
- package/package.json +1 -1
- package/src/actions/basic/SDaiUnwrapAction.ts +32 -0
- package/src/actions/basic/SDaiWrapAction.ts +32 -0
- package/src/actions/basic/index.ts +2 -0
- package/src/actions/checkers/SparkRatioCheckAction.ts +23 -0
- package/src/actions/checkers/index.ts +2 -1
- package/src/actions/curveusd/CurveUsdBorrowAction.ts +34 -0
- package/src/actions/curveusd/CurveUsdCreateAction.ts +49 -0
- package/src/actions/curveusd/CurveUsdLevCreateAction.ts +40 -0
- package/src/actions/curveusd/CurveUsdPaybackAction.ts +48 -0
- package/src/actions/curveusd/CurveUsdRepayAction.ts +36 -0
- package/src/actions/curveusd/CurveUsdSelfLiquidateAction.ts +41 -0
- package/src/actions/curveusd/CurveUsdSelfLiquidateWithCollAction.ts +40 -0
- package/src/actions/curveusd/CurveUsdSupplyAction.ts +44 -0
- package/src/actions/curveusd/CurveUsdWithdrawAction.ts +34 -0
- package/src/actions/curveusd/index.ts +10 -0
- package/src/actions/flashloan/FLAction.ts +8 -2
- package/src/actions/flashloan/SparkFlashLoanAction.ts +27 -0
- package/src/actions/flashloan/SparkFlashLoanPaybackAction.ts +18 -0
- package/src/actions/flashloan/index.ts +2 -0
- package/src/actions/index.ts +4 -0
- package/src/actions/spark/SparkBorrowAction.ts +68 -0
- package/src/actions/spark/SparkClaimRewardsAction.ts +50 -0
- package/src/actions/spark/SparkCollateralSwitchAction.ts +47 -0
- package/src/actions/spark/SparkPaybackAction.ts +77 -0
- package/src/actions/spark/SparkSetEModeAction.ts +40 -0
- package/src/actions/spark/SparkSpTokenPaybackAction.ts +64 -0
- package/src/actions/spark/SparkSupplyAction.ts +75 -0
- package/src/actions/spark/SparkSwapBorrowRateModeAction.ts +46 -0
- package/src/actions/spark/SparkWithdrawAction.ts +53 -0
- package/src/actions/spark/index.ts +9 -0
- package/src/addresses.ts +27 -0
- package/src/triggers/SparkQuotePriceTrigger.ts +14 -0
- package/src/triggers/SparkRatioTrigger.ts +14 -0
- package/src/triggers/index.ts +2 -0
- package/src/types.ts +3 -1
- package/src/utils/curveusd-utils.ts +15 -0
- package/src/utils/index.ts +2 -0
- package/umd/index.js +1625 -392
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* SDaiUnwrapAction - Unwrap sDAI to DAI
|
|
5
|
+
*
|
|
6
|
+
* @category Spark
|
|
7
|
+
*/
|
|
8
|
+
export declare class SDaiUnwrapAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param amount Amount of token to unwrap
|
|
11
|
+
* @param from Address we are pulling sDAI from (fallback to proxy)
|
|
12
|
+
* @param to Address we are sending DAI to (fallback to proxy)
|
|
13
|
+
*/
|
|
14
|
+
constructor(amount: uint256, from?: EthAddress, to?: EthAddress);
|
|
15
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { requireAddress } from '../../utils/general';
|
|
4
|
+
/**
|
|
5
|
+
* SDaiUnwrapAction - Unwrap sDAI to DAI
|
|
6
|
+
*
|
|
7
|
+
* @category Spark
|
|
8
|
+
*/
|
|
9
|
+
export class SDaiUnwrapAction extends Action {
|
|
10
|
+
/**
|
|
11
|
+
* @param amount Amount of token to unwrap
|
|
12
|
+
* @param from Address we are pulling sDAI from (fallback to proxy)
|
|
13
|
+
* @param to Address we are sending DAI to (fallback to proxy)
|
|
14
|
+
*/
|
|
15
|
+
constructor(amount, from = getAddr('Empty'), to = getAddr('Empty')) {
|
|
16
|
+
requireAddress(to);
|
|
17
|
+
super('SDaiUnwrap', getAddr('SDaiUnwrap'), ['uint256', 'address', 'address'], [amount, from, to]);
|
|
18
|
+
this.mappableArgs = [
|
|
19
|
+
this.args[0],
|
|
20
|
+
this.args[1],
|
|
21
|
+
this.args[2],
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* SDaiWrapAction - Wrap DAI to sDAI
|
|
5
|
+
*
|
|
6
|
+
* @category Spark
|
|
7
|
+
*/
|
|
8
|
+
export declare class SDaiWrapAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param amount Amount of token to wrap
|
|
11
|
+
* @param from Address we are pulling DAI from (fallback to proxy)
|
|
12
|
+
* @param to Address we are sending sDAI to (fallback to proxy)
|
|
13
|
+
*/
|
|
14
|
+
constructor(amount: uint256, from?: EthAddress, to?: EthAddress);
|
|
15
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { requireAddress } from '../../utils/general';
|
|
4
|
+
/**
|
|
5
|
+
* SDaiWrapAction - Wrap DAI to sDAI
|
|
6
|
+
*
|
|
7
|
+
* @category Spark
|
|
8
|
+
*/
|
|
9
|
+
export class SDaiWrapAction extends Action {
|
|
10
|
+
/**
|
|
11
|
+
* @param amount Amount of token to wrap
|
|
12
|
+
* @param from Address we are pulling DAI from (fallback to proxy)
|
|
13
|
+
* @param to Address we are sending sDAI to (fallback to proxy)
|
|
14
|
+
*/
|
|
15
|
+
constructor(amount, from = getAddr('Empty'), to = getAddr('Empty')) {
|
|
16
|
+
requireAddress(to);
|
|
17
|
+
super('SDaiWrap', getAddr('SDaiWrap'), ['uint256', 'address', 'address'], [amount, from, to]);
|
|
18
|
+
this.mappableArgs = [
|
|
19
|
+
this.args[0],
|
|
20
|
+
this.args[1],
|
|
21
|
+
this.args[2],
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { uint8, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* SparkRatioCheckAction - Checks spark ratio for users proxy position and reverts if faulty
|
|
5
|
+
*
|
|
6
|
+
* @category Checkers
|
|
7
|
+
*/
|
|
8
|
+
export declare class SparkRatioCheckAction 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
|
+
* SparkRatioCheckAction - Checks spark ratio for users proxy position and reverts if faulty
|
|
5
|
+
*
|
|
6
|
+
* @category Checkers
|
|
7
|
+
*/
|
|
8
|
+
export class SparkRatioCheckAction 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('SparkRatioCheck', getAddr('SparkRatioCheck'), ['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 { EthAddress, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* CurveUsdBorrowAction - Action that borrows crvUSD from proxy curveusd position
|
|
5
|
+
*
|
|
6
|
+
* @category CurveUsd
|
|
7
|
+
*/
|
|
8
|
+
export declare class CurveUsdBorrowAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* address controllerAddress - Address of the curveusd market controller
|
|
11
|
+
* address to - Address that will receive the borrowed crvUSD, will default to proxy
|
|
12
|
+
* uint256 debtAmount - Amount of crvUSD to borrow
|
|
13
|
+
*/
|
|
14
|
+
constructor(controllerAddress: EthAddress, to: EthAddress, debtAmount: uint256);
|
|
15
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* CurveUsdBorrowAction - Action that borrows crvUSD from proxy curveusd position
|
|
5
|
+
*
|
|
6
|
+
* @category CurveUsd
|
|
7
|
+
*/
|
|
8
|
+
export class CurveUsdBorrowAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* address controllerAddress - Address of the curveusd market controller
|
|
11
|
+
* address to - Address that will receive the borrowed crvUSD, will default to proxy
|
|
12
|
+
* uint256 debtAmount - Amount of crvUSD to borrow
|
|
13
|
+
*/
|
|
14
|
+
/// @dev debtAmount must be non-zero
|
|
15
|
+
/// @dev if debtAmount == uintMax will borrow as much as the collateral will support
|
|
16
|
+
constructor(controllerAddress, to, debtAmount) {
|
|
17
|
+
super('CurveUsdBorrow', getAddr('CurveUsdBorrow'), ['address', 'address', 'uint256'], [controllerAddress, to, debtAmount]);
|
|
18
|
+
this.mappableArgs = [
|
|
19
|
+
...this.args,
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* CurveUsdCreateAction - Action that creates a curveusd position on behalf of proxy
|
|
5
|
+
*
|
|
6
|
+
* @category CurveUsd
|
|
7
|
+
*/
|
|
8
|
+
export declare class CurveUsdCreateAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* address controllerAddress - Address of the curveusd market controller
|
|
11
|
+
* address from - Address from which to pull collateral asset, will default to proxy
|
|
12
|
+
* address to - Address that will receive the borrowed crvUSD, will default to proxy
|
|
13
|
+
* uint256 collateralAmount - Amount of collateral asset to supply
|
|
14
|
+
* uint256 debtAmount - Amount of crvUSD to borrow
|
|
15
|
+
* uint256 nBands - Number of bands in which the collateral will be supplied
|
|
16
|
+
*/
|
|
17
|
+
constructor(controllerAddress: EthAddress, from: EthAddress, to: EthAddress, collateralAmount: uint256, debtAmount: uint256, nBands: uint256);
|
|
18
|
+
getAssetsToApprove(): Promise<{
|
|
19
|
+
owner: any;
|
|
20
|
+
asset: string;
|
|
21
|
+
}[]>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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 { Action } from '../../Action';
|
|
11
|
+
import { requireAddress } from '../../utils/general';
|
|
12
|
+
import { getAddr } from '../../addresses';
|
|
13
|
+
import { controllerToAssetMap } from '../../utils/curveusd-utils';
|
|
14
|
+
/**
|
|
15
|
+
* CurveUsdCreateAction - Action that creates a curveusd position on behalf of proxy
|
|
16
|
+
*
|
|
17
|
+
* @category CurveUsd
|
|
18
|
+
*/
|
|
19
|
+
export class CurveUsdCreateAction extends Action {
|
|
20
|
+
/**
|
|
21
|
+
* address controllerAddress - Address of the curveusd market controller
|
|
22
|
+
* address from - Address from which to pull collateral asset, will default to proxy
|
|
23
|
+
* address to - Address that will receive the borrowed crvUSD, will default to proxy
|
|
24
|
+
* uint256 collateralAmount - Amount of collateral asset to supply
|
|
25
|
+
* uint256 debtAmount - Amount of crvUSD to borrow
|
|
26
|
+
* uint256 nBands - Number of bands in which the collateral will be supplied
|
|
27
|
+
*/
|
|
28
|
+
/// @dev both collateralAmount and debtAmount must be non-zero and can be maxUint
|
|
29
|
+
constructor(controllerAddress, from, to, collateralAmount, debtAmount, nBands) {
|
|
30
|
+
requireAddress(to);
|
|
31
|
+
super('CurveUsdCreate', getAddr('CurveUsdCreate'), ['address', 'address', 'address', 'uint256', 'uint256', 'uint256'], [controllerAddress, from, to, collateralAmount, debtAmount, nBands]);
|
|
32
|
+
this.mappableArgs = [
|
|
33
|
+
...this.args,
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
getAssetsToApprove() {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
return [{
|
|
39
|
+
owner: this.args[1],
|
|
40
|
+
asset: controllerToAssetMap[this.args[0]],
|
|
41
|
+
}];
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256, uint32, bytes } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @category CurveUsd
|
|
6
|
+
*/
|
|
7
|
+
export declare class CurveUsdLevCreateAction extends Action {
|
|
8
|
+
constructor(controllerAddress: EthAddress, collateralAmount: uint256, debtAmount: uint256, minAmount: uint256, nBands: uint256, from: EthAddress, additionData: bytes, gasUsed: uint32, dfsFeeDivider: uint32, useSteth: Boolean);
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { requireAddress } from '../../utils/general';
|
|
3
|
+
import { getAddr } from '../../addresses';
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @category CurveUsd
|
|
7
|
+
*/
|
|
8
|
+
export class CurveUsdLevCreateAction extends Action {
|
|
9
|
+
constructor(controllerAddress, collateralAmount, debtAmount, minAmount, nBands, from, additionData, gasUsed, dfsFeeDivider, useSteth) {
|
|
10
|
+
requireAddress(from);
|
|
11
|
+
super('CurveUsdLevCreate', getAddr('CurveUsdLevCreate'), ['address', 'uint256', 'uint256', 'uint256', 'uint256', 'address', 'bytes', 'uint32', 'uint32', 'bool'], [controllerAddress, collateralAmount, debtAmount, minAmount, nBands, from, additionData, gasUsed, dfsFeeDivider, useSteth]);
|
|
12
|
+
this.mappableArgs = [
|
|
13
|
+
...this.args,
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256, int256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* CurveUsdPaybackAction - Action that pays back crvUSD to a curveusd position
|
|
5
|
+
*
|
|
6
|
+
* @category CurveUsd
|
|
7
|
+
*/
|
|
8
|
+
export declare class CurveUsdPaybackAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* address controllerAddress - Address of the curveusd market controller
|
|
11
|
+
* address from - Address from which to pull crvUSD, will default to proxy
|
|
12
|
+
* address onBehalfOf - Address for which we are paying back debt, will default to proxy
|
|
13
|
+
* address to - Address that will receive the crvUSD and collateral asset if close, will default to proxy
|
|
14
|
+
* uint256 debtAmount - Amount of crvUSD to payback
|
|
15
|
+
* int256 maxActiveBand - Don't allow active band to be higher than this (to prevent front-running the repay)
|
|
16
|
+
*/
|
|
17
|
+
constructor(controllerAddress: EthAddress, from: EthAddress, onBehalfOf: EthAddress, to: EthAddress, debtAmount: uint256, maxActiveBand: int256);
|
|
18
|
+
getAssetsToApprove(): Promise<{
|
|
19
|
+
owner: any;
|
|
20
|
+
asset: string;
|
|
21
|
+
}[]>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
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 { getAssetInfo } from '@defisaver/tokens';
|
|
11
|
+
import { Action } from '../../Action';
|
|
12
|
+
import { getAddr } from '../../addresses';
|
|
13
|
+
/**
|
|
14
|
+
* CurveUsdPaybackAction - Action that pays back crvUSD to a curveusd position
|
|
15
|
+
*
|
|
16
|
+
* @category CurveUsd
|
|
17
|
+
*/
|
|
18
|
+
export class CurveUsdPaybackAction extends Action {
|
|
19
|
+
/**
|
|
20
|
+
* address controllerAddress - Address of the curveusd market controller
|
|
21
|
+
* address from - Address from which to pull crvUSD, will default to proxy
|
|
22
|
+
* address onBehalfOf - Address for which we are paying back debt, will default to proxy
|
|
23
|
+
* address to - Address that will receive the crvUSD and collateral asset if close, will default to proxy
|
|
24
|
+
* uint256 debtAmount - Amount of crvUSD to payback
|
|
25
|
+
* int256 maxActiveBand - Don't allow active band to be higher than this (to prevent front-running the repay)
|
|
26
|
+
*/
|
|
27
|
+
/// @dev debtAmount must be non-zero
|
|
28
|
+
/// @dev if debtAmount >= debt will repay whole debt and close the position, transfering collateral
|
|
29
|
+
constructor(controllerAddress, from, onBehalfOf, to, debtAmount, maxActiveBand) {
|
|
30
|
+
super('CurveUsdPayback', getAddr('CurveUsdPayback'), ['address', 'address', 'address', 'address', 'uint256', 'int256'], [controllerAddress, from, onBehalfOf, to, debtAmount, maxActiveBand]);
|
|
31
|
+
this.mappableArgs = [
|
|
32
|
+
...this.args,
|
|
33
|
+
];
|
|
34
|
+
}
|
|
35
|
+
getAssetsToApprove() {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
return [{
|
|
38
|
+
owner: this.args[1],
|
|
39
|
+
asset: getAssetInfo('crvUSD').address,
|
|
40
|
+
}];
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256, uint32, bytes } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @category CurveUsd
|
|
6
|
+
*/
|
|
7
|
+
export declare class CurveUsdRepayAction extends Action {
|
|
8
|
+
constructor(controllerAddress: EthAddress, collAmount: uint256, to: EthAddress, minAmount: uint256, additionData: bytes, gasUsed: uint32, dfsFeeDivider: uint32, useSteth: Boolean);
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @category CurveUsd
|
|
6
|
+
*/
|
|
7
|
+
export class CurveUsdRepayAction extends Action {
|
|
8
|
+
constructor(controllerAddress, collAmount, to, minAmount, additionData, gasUsed, dfsFeeDivider, useSteth) {
|
|
9
|
+
super('CurveUsdRepay', getAddr('CurveUsdRepay'), ['address', 'uint256', 'address', 'uint256', 'bytes', 'uint32', 'uint32', 'bool'], [controllerAddress, collAmount, to, minAmount, additionData, gasUsed, dfsFeeDivider, useSteth]);
|
|
10
|
+
this.mappableArgs = [
|
|
11
|
+
...this.args,
|
|
12
|
+
];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @category CurveUsd
|
|
6
|
+
*/
|
|
7
|
+
export declare class CurveUsdSelfLiquidateAction extends Action {
|
|
8
|
+
/**
|
|
9
|
+
@param controllerAddress Address of the curveusd market controller
|
|
10
|
+
@param minCrvUsdExpected Minimum amount of crvUsd as collateral for the user to have
|
|
11
|
+
@param from Address from which to pull crvUSD if needed
|
|
12
|
+
@param to Address that will receive the crvUSD and collateral asset
|
|
13
|
+
*/
|
|
14
|
+
constructor(controllerAddress: EthAddress, minCrvUsdExpected: uint256, from: EthAddress, to: EthAddress);
|
|
15
|
+
getAssetsToApprove(): Promise<{
|
|
16
|
+
owner: any;
|
|
17
|
+
asset: string;
|
|
18
|
+
}[]>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
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 { getAssetInfo } from '@defisaver/tokens';
|
|
11
|
+
import { Action } from '../../Action';
|
|
12
|
+
import { getAddr } from '../../addresses';
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @category CurveUsd
|
|
16
|
+
*/
|
|
17
|
+
export class CurveUsdSelfLiquidateAction extends Action {
|
|
18
|
+
/**
|
|
19
|
+
@param controllerAddress Address of the curveusd market controller
|
|
20
|
+
@param minCrvUsdExpected Minimum amount of crvUsd as collateral for the user to have
|
|
21
|
+
@param from Address from which to pull crvUSD if needed
|
|
22
|
+
@param to Address that will receive the crvUSD and collateral asset
|
|
23
|
+
*/
|
|
24
|
+
constructor(controllerAddress, minCrvUsdExpected, from, to) {
|
|
25
|
+
super('CurveUsdSelfLiquidate', getAddr('CurveUsdSelfLiquidate'), ['address', 'uint256', 'address', 'address'], [controllerAddress, minCrvUsdExpected, from, to]);
|
|
26
|
+
this.mappableArgs = [
|
|
27
|
+
...this.args,
|
|
28
|
+
];
|
|
29
|
+
}
|
|
30
|
+
getAssetsToApprove() {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
return [{
|
|
33
|
+
owner: this.args[1],
|
|
34
|
+
asset: getAssetInfo('crvUSD').address,
|
|
35
|
+
}];
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256, uint32, bytes } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @category CurveUsd
|
|
6
|
+
*/
|
|
7
|
+
export declare class CurveUsdSelfLiquidateWithCollAction extends Action {
|
|
8
|
+
constructor(controllerAddress: EthAddress, percentage: uint256, minCrvUsdExpected: uint256, swapAmount: uint256, minAmount: uint256, to: EthAddress, additionData: bytes, gasUsed: uint32, dfsFeeDivider: uint32, useSteth: Boolean);
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { requireAddress } from '../../utils/general';
|
|
3
|
+
import { getAddr } from '../../addresses';
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @category CurveUsd
|
|
7
|
+
*/
|
|
8
|
+
export class CurveUsdSelfLiquidateWithCollAction extends Action {
|
|
9
|
+
constructor(controllerAddress, percentage, minCrvUsdExpected, swapAmount, minAmount, to, additionData, gasUsed, dfsFeeDivider, useSteth) {
|
|
10
|
+
requireAddress(to);
|
|
11
|
+
super('CurveUsdSelfLiquidateWithColl', getAddr('CurveUsdSelfLiquidateWithColl'), ['address', 'uint256', 'uint256', 'uint256', 'uint256', 'address', 'bytes', 'uint32', 'uint32', 'bool'], [controllerAddress, percentage, minCrvUsdExpected, swapAmount, minAmount, to, additionData, gasUsed, dfsFeeDivider, useSteth]);
|
|
12
|
+
this.mappableArgs = [
|
|
13
|
+
...this.args,
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* CurveUsdSupplyAction - Action that supplies collateral to a curveusd position
|
|
5
|
+
*
|
|
6
|
+
* @category CurveUsd
|
|
7
|
+
*/
|
|
8
|
+
export declare class CurveUsdSupplyAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* address controllerAddress - Address of the curveusd market controller
|
|
11
|
+
* address from - Address from which to pull collateral asset, will default to proxy
|
|
12
|
+
* address onBehalfOf - Address for which we are supplying, will default to proxy
|
|
13
|
+
* uint256 collateralAmount - Amount of collateral asset to supply
|
|
14
|
+
*/
|
|
15
|
+
constructor(controllerAddress: EthAddress, from: EthAddress, onBehalfOf: EthAddress, collateralAmount: uint256);
|
|
16
|
+
getAssetsToApprove(): Promise<{
|
|
17
|
+
owner: any;
|
|
18
|
+
asset: string;
|
|
19
|
+
}[]>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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 { Action } from '../../Action';
|
|
11
|
+
import { getAddr } from '../../addresses';
|
|
12
|
+
import { controllerToAssetMap } from '../../utils/curveusd-utils';
|
|
13
|
+
/**
|
|
14
|
+
* CurveUsdSupplyAction - Action that supplies collateral to a curveusd position
|
|
15
|
+
*
|
|
16
|
+
* @category CurveUsd
|
|
17
|
+
*/
|
|
18
|
+
export class CurveUsdSupplyAction extends Action {
|
|
19
|
+
/**
|
|
20
|
+
* address controllerAddress - Address of the curveusd market controller
|
|
21
|
+
* address from - Address from which to pull collateral asset, will default to proxy
|
|
22
|
+
* address onBehalfOf - Address for which we are supplying, will default to proxy
|
|
23
|
+
* uint256 collateralAmount - Amount of collateral asset to supply
|
|
24
|
+
*/
|
|
25
|
+
/// @dev collateralAmount must be non-zero, can be maxUint
|
|
26
|
+
constructor(controllerAddress, from, onBehalfOf, collateralAmount) {
|
|
27
|
+
super('CurveUsdSupply', getAddr('CurveUsdSupply'), ['address', 'address', 'address', 'uint256'], [controllerAddress, from, onBehalfOf, collateralAmount]);
|
|
28
|
+
this.mappableArgs = [
|
|
29
|
+
...this.args,
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
getAssetsToApprove() {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
return [{
|
|
35
|
+
owner: this.args[1],
|
|
36
|
+
asset: controllerToAssetMap[this.args[0]],
|
|
37
|
+
}];
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* CurveUsdWithdrawAction - Action that withdraws collateral from proxy curveusd position
|
|
5
|
+
*
|
|
6
|
+
* @category CurveUsd
|
|
7
|
+
*/
|
|
8
|
+
export declare class CurveUsdWithdrawAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* address controllerAddress - Address of the curveusd market controller
|
|
11
|
+
* address to - Address that will receive the withdrawn collateral, will default to proxy
|
|
12
|
+
* uint256 collateralAmount - Amount of collateral to withdraw
|
|
13
|
+
*/
|
|
14
|
+
constructor(controllerAddress: EthAddress, to: EthAddress, collateralAmount: uint256);
|
|
15
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* CurveUsdWithdrawAction - Action that withdraws collateral from proxy curveusd position
|
|
5
|
+
*
|
|
6
|
+
* @category CurveUsd
|
|
7
|
+
*/
|
|
8
|
+
export class CurveUsdWithdrawAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* address controllerAddress - Address of the curveusd market controller
|
|
11
|
+
* address to - Address that will receive the withdrawn collateral, will default to proxy
|
|
12
|
+
* uint256 collateralAmount - Amount of collateral to withdraw
|
|
13
|
+
*/
|
|
14
|
+
/// @dev collateralAmount must be non-zero
|
|
15
|
+
/// @dev if collateralAmount == uintMax will withdraw as much as the debt will allow
|
|
16
|
+
constructor(controllerAddress, to, collateralAmount) {
|
|
17
|
+
super('CurveUsdWithdraw', getAddr('CurveUsdWithdraw'), ['address', 'address', 'uint256'], [controllerAddress, to, collateralAmount]);
|
|
18
|
+
this.mappableArgs = [
|
|
19
|
+
...this.args,
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './CurveUsdCreateAction';
|
|
2
|
+
export * from './CurveUsdSupplyAction';
|
|
3
|
+
export * from './CurveUsdWithdrawAction';
|
|
4
|
+
export * from './CurveUsdBorrowAction';
|
|
5
|
+
export * from './CurveUsdPaybackAction';
|
|
6
|
+
export * from './CurveUsdRepayAction';
|
|
7
|
+
export * from './CurveUsdSelfLiquidateAction';
|
|
8
|
+
export * from './CurveUsdLevCreateAction';
|
|
9
|
+
export * from './CurveUsdSelfLiquidateWithCollAction';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './CurveUsdCreateAction';
|
|
2
|
+
export * from './CurveUsdSupplyAction';
|
|
3
|
+
export * from './CurveUsdWithdrawAction';
|
|
4
|
+
export * from './CurveUsdBorrowAction';
|
|
5
|
+
export * from './CurveUsdPaybackAction';
|
|
6
|
+
export * from './CurveUsdRepayAction';
|
|
7
|
+
export * from './CurveUsdSelfLiquidateAction';
|
|
8
|
+
export * from './CurveUsdLevCreateAction';
|
|
9
|
+
export * from './CurveUsdSelfLiquidateWithCollAction';
|
|
@@ -35,14 +35,20 @@ _FLAction_instances = new WeakSet(), _FLAction_handleArgs = function _FLAction_h
|
|
|
35
35
|
if (specificFLAction.constructor.name === 'BalancerFlashLoanAction') {
|
|
36
36
|
argsToReturn[5] = [2];
|
|
37
37
|
}
|
|
38
|
-
if (specificFLAction.constructor.name === '
|
|
38
|
+
if (specificFLAction.constructor.name === 'GhoFlashLoanAction') {
|
|
39
39
|
argsToReturn[5] = [3];
|
|
40
40
|
}
|
|
41
41
|
if (specificFLAction.constructor.name === 'MakerFlashLoanAction') {
|
|
42
42
|
argsToReturn[5] = [4];
|
|
43
43
|
}
|
|
44
|
-
if (specificFLAction.constructor.name === '
|
|
44
|
+
if (specificFLAction.constructor.name === 'AaveV3FlashLoanAction') {
|
|
45
45
|
argsToReturn[5] = [5];
|
|
46
46
|
}
|
|
47
|
+
if (specificFLAction.constructor.name === 'UniV3FlashLoanAction') {
|
|
48
|
+
argsToReturn[5] = [6];
|
|
49
|
+
}
|
|
50
|
+
if (specificFLAction.constructor.name === 'SparkFlashLoanAction') {
|
|
51
|
+
argsToReturn[5] = [7];
|
|
52
|
+
}
|
|
47
53
|
return argsToReturn;
|
|
48
54
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ActionWithL2 } from '../../ActionWithL2';
|
|
2
|
+
import { EthAddress, uint256, bytes } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Gets a flashloan from Spark with fee enabled
|
|
5
|
+
*
|
|
6
|
+
* @category Flashloans
|
|
7
|
+
*/
|
|
8
|
+
export declare class SparkFlashLoanAction 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
|
+
}
|