@defisaver/sdk 1.0.22 → 1.0.24
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/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 +46 -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/CurveUsdSupplyAction.d.ts +20 -0
- package/esm/src/actions/curveusd/CurveUsdSupplyAction.js +42 -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 +5 -0
- package/esm/src/actions/curveusd/index.js +5 -0
- package/esm/src/actions/index.d.ts +2 -1
- package/esm/src/actions/index.js +2 -1
- package/esm/src/actions/morpho/index.d.ts +0 -4
- package/esm/src/actions/morpho/index.js +0 -4
- package/esm/src/addresses.d.ts +0 -12
- package/esm/src/addresses.js +0 -5
- package/esm/src/index.d.ts +0 -48
- package/esm/src/types.d.ts +2 -1
- package/esm/src/utils/curveusd-utils.d.ts +10 -0
- package/esm/src/utils/curveusd-utils.js +6 -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/curveusd/CurveUsdBorrowAction.ts +34 -0
- package/src/actions/curveusd/CurveUsdCreateAction.ts +53 -0
- package/src/actions/curveusd/CurveUsdPaybackAction.ts +48 -0
- package/src/actions/curveusd/CurveUsdSupplyAction.ts +48 -0
- package/src/actions/curveusd/CurveUsdWithdrawAction.ts +34 -0
- package/src/actions/curveusd/index.ts +5 -0
- package/src/actions/index.ts +2 -0
- package/src/actions/morpho/index.ts +0 -4
- package/src/addresses.ts +0 -6
- package/src/types.ts +2 -1
- package/src/utils/curveusd-utils.ts +8 -0
- package/src/utils/index.ts +2 -0
- package/umd/index.js +311 -189
- package/yarn-error.log +3976 -0
- package/esm/src/actions/morpho/aaveV3/MorphoAaveV3BorrowAction.d.ts +0 -18
- package/esm/src/actions/morpho/aaveV3/MorphoAaveV3BorrowAction.js +0 -27
- package/esm/src/actions/morpho/aaveV3/MorphoAaveV3PaybackAction.d.ts +0 -21
- package/esm/src/actions/morpho/aaveV3/MorphoAaveV3PaybackAction.js +0 -44
- package/esm/src/actions/morpho/aaveV3/MorphoAaveV3SupplyAction.d.ts +0 -23
- package/esm/src/actions/morpho/aaveV3/MorphoAaveV3SupplyAction.js +0 -47
- package/esm/src/actions/morpho/aaveV3/MorphoAaveV3WithdrawAction.d.ts +0 -19
- package/esm/src/actions/morpho/aaveV3/MorphoAaveV3WithdrawAction.js +0 -29
- package/src/actions/morpho/aaveV3/MorphoAaveV3BorrowAction.ts +0 -42
- package/src/actions/morpho/aaveV3/MorphoAaveV3PaybackAction.ts +0 -47
- package/src/actions/morpho/aaveV3/MorphoAaveV3SupplyAction.ts +0 -52
- package/src/actions/morpho/aaveV3/MorphoAaveV3WithdrawAction.ts +0 -45
|
@@ -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,46 @@
|
|
|
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 { compare } from '@defisaver/tokens/esm/utils';
|
|
11
|
+
import { getAssetInfo } from '@defisaver/tokens';
|
|
12
|
+
import { Action } from '../../Action';
|
|
13
|
+
import { requireAddress } from '../../utils/general';
|
|
14
|
+
import { getAddr } from '../../addresses';
|
|
15
|
+
import { curveusdMarkets } from '../../utils/curveusd-utils';
|
|
16
|
+
/**
|
|
17
|
+
* CurveUsdCreateAction - Action that creates a curveusd position on behalf of proxy
|
|
18
|
+
*
|
|
19
|
+
* @category CurveUsd
|
|
20
|
+
*/
|
|
21
|
+
export class CurveUsdCreateAction extends Action {
|
|
22
|
+
/**
|
|
23
|
+
* address controllerAddress - Address of the curveusd market controller
|
|
24
|
+
* address from - Address from which to pull collateral asset, will default to proxy
|
|
25
|
+
* address to - Address that will receive the borrowed crvUSD, will default to proxy
|
|
26
|
+
* uint256 collateralAmount - Amount of collateral asset to supply
|
|
27
|
+
* uint256 debtAmount - Amount of crvUSD to borrow
|
|
28
|
+
* uint256 nBands - Number of bands in which the collateral will be supplied
|
|
29
|
+
*/
|
|
30
|
+
/// @dev both collateralAmount and debtAmount must be non-zero and can be maxUint
|
|
31
|
+
constructor(controllerAddress, from, to, collateralAmount, debtAmount, nBands) {
|
|
32
|
+
requireAddress(to);
|
|
33
|
+
super('CurveUsdCreate', getAddr('CurveUsdCreate'), ['address', 'address', 'address', 'uint256', 'uint256', 'uint256'], [controllerAddress, from, to, collateralAmount, debtAmount, nBands]);
|
|
34
|
+
this.mappableArgs = [
|
|
35
|
+
...this.args,
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
getAssetsToApprove() {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
return [{
|
|
41
|
+
owner: this.args[1],
|
|
42
|
+
asset: getAssetInfo(Object.entries(curveusdMarkets).filter(([, { controllerAddress }]) => compare(controllerAddress, this.args[0]))[0][0]).address,
|
|
43
|
+
}];
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -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('CurveUsdBorrow', getAddr('CurveUsdBorrow'), ['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,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,42 @@
|
|
|
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 { compare } from '@defisaver/tokens/esm/utils';
|
|
11
|
+
import { getAssetInfo } from '@defisaver/tokens';
|
|
12
|
+
import { Action } from '../../Action';
|
|
13
|
+
import { getAddr } from '../../addresses';
|
|
14
|
+
import { curveusdMarkets } from '../../utils/curveusd-utils';
|
|
15
|
+
/**
|
|
16
|
+
* CurveUsdSupplyAction - Action that supplies collateral to a curveusd position
|
|
17
|
+
*
|
|
18
|
+
* @category CurveUsd
|
|
19
|
+
*/
|
|
20
|
+
export class CurveUsdSupplyAction extends Action {
|
|
21
|
+
/**
|
|
22
|
+
* address controllerAddress - Address of the curveusd market controller
|
|
23
|
+
* address from - Address from which to pull collateral asset, will default to proxy
|
|
24
|
+
* address onBehalfOf - Address for which we are supplying, will default to proxy
|
|
25
|
+
* uint256 collateralAmount - Amount of collateral asset to supply
|
|
26
|
+
*/
|
|
27
|
+
/// @dev collateralAmount must be non-zero, can be maxUint
|
|
28
|
+
constructor(controllerAddress, from, onBehalfOf, collateralAmount) {
|
|
29
|
+
super('CurveUsdSupply', getAddr('CurveUsdSupply'), ['address', 'address', 'address', 'uint256'], [controllerAddress, from, onBehalfOf, collateralAmount]);
|
|
30
|
+
this.mappableArgs = [
|
|
31
|
+
...this.args,
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
getAssetsToApprove() {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
return [{
|
|
37
|
+
owner: this.args[1],
|
|
38
|
+
asset: getAssetInfo(Object.entries(curveusdMarkets).filter(([, { controllerAddress }]) => compare(controllerAddress, this.args[0]))[0][0]).address,
|
|
39
|
+
}];
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -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('CurveUsdSupply', getAddr('CurveUsdSupply'), ['address', 'address', 'uint256'], [controllerAddress, to, collateralAmount]);
|
|
18
|
+
this.mappableArgs = [
|
|
19
|
+
...this.args,
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -23,4 +23,5 @@ 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
|
-
|
|
26
|
+
import * as curveusd from './curveusd';
|
|
27
|
+
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, curveusd, };
|
package/esm/src/actions/index.js
CHANGED
|
@@ -23,4 +23,5 @@ 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
|
-
|
|
26
|
+
import * as curveusd from './curveusd';
|
|
27
|
+
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, curveusd, };
|
|
@@ -3,7 +3,3 @@ export * from './MorphoAaveV2WithdrawAction';
|
|
|
3
3
|
export * from './MorphoAaveV2BorrowAction';
|
|
4
4
|
export * from './MorphoAaveV2PaybackAction';
|
|
5
5
|
export * from './MorphoClaimAction';
|
|
6
|
-
export * from './aaveV3/MorphoAaveV3SupplyAction';
|
|
7
|
-
export * from './aaveV3/MorphoAaveV3WithdrawAction';
|
|
8
|
-
export * from './aaveV3/MorphoAaveV3BorrowAction';
|
|
9
|
-
export * from './aaveV3/MorphoAaveV3PaybackAction';
|
|
@@ -3,7 +3,3 @@ export * from './MorphoAaveV2WithdrawAction';
|
|
|
3
3
|
export * from './MorphoAaveV2BorrowAction';
|
|
4
4
|
export * from './MorphoAaveV2PaybackAction';
|
|
5
5
|
export * from './MorphoClaimAction';
|
|
6
|
-
export * from './aaveV3/MorphoAaveV3SupplyAction';
|
|
7
|
-
export * from './aaveV3/MorphoAaveV3WithdrawAction';
|
|
8
|
-
export * from './aaveV3/MorphoAaveV3BorrowAction';
|
|
9
|
-
export * from './aaveV3/MorphoAaveV3PaybackAction';
|
package/esm/src/addresses.d.ts
CHANGED
|
@@ -54,10 +54,6 @@ export declare const actionAddresses: {
|
|
|
54
54
|
MorphoAaveV2Supply: string;
|
|
55
55
|
MorphoAaveV2Withdraw: string;
|
|
56
56
|
MorphoClaim: string;
|
|
57
|
-
MorphoAaveV3Borrow: string;
|
|
58
|
-
MorphoAaveV3Payback: string;
|
|
59
|
-
MorphoAaveV3Supply: string;
|
|
60
|
-
MorphoAaveV3Withdraw: string;
|
|
61
57
|
CompBorrow: string;
|
|
62
58
|
CompClaim: string;
|
|
63
59
|
CompPayback: string;
|
|
@@ -210,10 +206,6 @@ export declare const actionAddresses: {
|
|
|
210
206
|
MorphoAaveV2Supply?: undefined;
|
|
211
207
|
MorphoAaveV2Withdraw?: undefined;
|
|
212
208
|
MorphoClaim?: undefined;
|
|
213
|
-
MorphoAaveV3Borrow?: undefined;
|
|
214
|
-
MorphoAaveV3Payback?: undefined;
|
|
215
|
-
MorphoAaveV3Supply?: undefined;
|
|
216
|
-
MorphoAaveV3Withdraw?: undefined;
|
|
217
209
|
CompBorrow?: undefined;
|
|
218
210
|
CompClaim?: undefined;
|
|
219
211
|
CompPayback?: undefined;
|
|
@@ -353,10 +345,6 @@ export declare const actionAddresses: {
|
|
|
353
345
|
MorphoAaveV2Supply?: undefined;
|
|
354
346
|
MorphoAaveV2Withdraw?: undefined;
|
|
355
347
|
MorphoClaim?: undefined;
|
|
356
|
-
MorphoAaveV3Borrow?: undefined;
|
|
357
|
-
MorphoAaveV3Payback?: undefined;
|
|
358
|
-
MorphoAaveV3Supply?: undefined;
|
|
359
|
-
MorphoAaveV3Withdraw?: undefined;
|
|
360
348
|
CompBorrow?: undefined;
|
|
361
349
|
CompClaim?: undefined;
|
|
362
350
|
CompPayback?: undefined;
|
package/esm/src/addresses.js
CHANGED
|
@@ -62,11 +62,6 @@ export const actionAddresses = {
|
|
|
62
62
|
MorphoAaveV2Supply: '0x60ED1Cf5Da785AA4FD4A4fF3f8cFc0682d60E0F3',
|
|
63
63
|
MorphoAaveV2Withdraw: '0x29a8b5a8889f465c85b778edccf984e44ad70f12',
|
|
64
64
|
MorphoClaim: '0xa269C841E26EA8Ee1F0350a2E5905F71446998dC',
|
|
65
|
-
// morpho aave v3
|
|
66
|
-
MorphoAaveV3Borrow: '0x487719C57b88477F19423aB0652b3E26b96baA7F',
|
|
67
|
-
MorphoAaveV3Payback: '0x36b8b968c81D97cBfAa642e206b634A6f378d287',
|
|
68
|
-
MorphoAaveV3Supply: '0x51fA8FBc6F0aDEfe2FBA06104FCA39f5beD69291',
|
|
69
|
-
MorphoAaveV3Withdraw: '0xdc3e74C4cD577275296ceFE36A3D082223AfF206',
|
|
70
65
|
// compound
|
|
71
66
|
CompBorrow: '0x8495579BF6Ae848f7E59686536F834f1d2CCd79C',
|
|
72
67
|
CompClaim: '0x81F488cF7A0128A9DB5e7207042cCAB1CB0ac902',
|
package/esm/src/index.d.ts
CHANGED
|
@@ -65,10 +65,6 @@ declare const actionAddressesAllChains: {
|
|
|
65
65
|
MorphoAaveV2Supply: string;
|
|
66
66
|
MorphoAaveV2Withdraw: string;
|
|
67
67
|
MorphoClaim: string;
|
|
68
|
-
MorphoAaveV3Borrow: string;
|
|
69
|
-
MorphoAaveV3Payback: string;
|
|
70
|
-
MorphoAaveV3Supply: string;
|
|
71
|
-
MorphoAaveV3Withdraw: string;
|
|
72
68
|
CompBorrow: string;
|
|
73
69
|
CompClaim: string;
|
|
74
70
|
CompPayback: string;
|
|
@@ -221,10 +217,6 @@ declare const actionAddressesAllChains: {
|
|
|
221
217
|
MorphoAaveV2Supply?: undefined;
|
|
222
218
|
MorphoAaveV2Withdraw?: undefined;
|
|
223
219
|
MorphoClaim?: undefined;
|
|
224
|
-
MorphoAaveV3Borrow?: undefined;
|
|
225
|
-
MorphoAaveV3Payback?: undefined;
|
|
226
|
-
MorphoAaveV3Supply?: undefined;
|
|
227
|
-
MorphoAaveV3Withdraw?: undefined;
|
|
228
220
|
CompBorrow?: undefined;
|
|
229
221
|
CompClaim?: undefined;
|
|
230
222
|
CompPayback?: undefined;
|
|
@@ -364,10 +356,6 @@ declare const actionAddressesAllChains: {
|
|
|
364
356
|
MorphoAaveV2Supply?: undefined;
|
|
365
357
|
MorphoAaveV2Withdraw?: undefined;
|
|
366
358
|
MorphoClaim?: undefined;
|
|
367
|
-
MorphoAaveV3Borrow?: undefined;
|
|
368
|
-
MorphoAaveV3Payback?: undefined;
|
|
369
|
-
MorphoAaveV3Supply?: undefined;
|
|
370
|
-
MorphoAaveV3Withdraw?: undefined;
|
|
371
359
|
CompBorrow?: undefined;
|
|
372
360
|
CompClaim?: undefined;
|
|
373
361
|
CompPayback?: undefined;
|
|
@@ -499,10 +487,6 @@ declare const actionAddresses: (chainId?: null) => {
|
|
|
499
487
|
MorphoAaveV2Supply: string;
|
|
500
488
|
MorphoAaveV2Withdraw: string;
|
|
501
489
|
MorphoClaim: string;
|
|
502
|
-
MorphoAaveV3Borrow: string;
|
|
503
|
-
MorphoAaveV3Payback: string;
|
|
504
|
-
MorphoAaveV3Supply: string;
|
|
505
|
-
MorphoAaveV3Withdraw: string;
|
|
506
490
|
CompBorrow: string;
|
|
507
491
|
CompClaim: string;
|
|
508
492
|
CompPayback: string;
|
|
@@ -655,10 +639,6 @@ declare const actionAddresses: (chainId?: null) => {
|
|
|
655
639
|
MorphoAaveV2Supply?: undefined;
|
|
656
640
|
MorphoAaveV2Withdraw?: undefined;
|
|
657
641
|
MorphoClaim?: undefined;
|
|
658
|
-
MorphoAaveV3Borrow?: undefined;
|
|
659
|
-
MorphoAaveV3Payback?: undefined;
|
|
660
|
-
MorphoAaveV3Supply?: undefined;
|
|
661
|
-
MorphoAaveV3Withdraw?: undefined;
|
|
662
642
|
CompBorrow?: undefined;
|
|
663
643
|
CompClaim?: undefined;
|
|
664
644
|
CompPayback?: undefined;
|
|
@@ -798,10 +778,6 @@ declare const actionAddresses: (chainId?: null) => {
|
|
|
798
778
|
MorphoAaveV2Supply?: undefined;
|
|
799
779
|
MorphoAaveV2Withdraw?: undefined;
|
|
800
780
|
MorphoClaim?: undefined;
|
|
801
|
-
MorphoAaveV3Borrow?: undefined;
|
|
802
|
-
MorphoAaveV3Payback?: undefined;
|
|
803
|
-
MorphoAaveV3Supply?: undefined;
|
|
804
|
-
MorphoAaveV3Withdraw?: undefined;
|
|
805
781
|
CompBorrow?: undefined;
|
|
806
782
|
CompClaim?: undefined;
|
|
807
783
|
CompPayback?: undefined;
|
|
@@ -1030,10 +1006,6 @@ declare const _default: {
|
|
|
1030
1006
|
MorphoAaveV2Supply: string;
|
|
1031
1007
|
MorphoAaveV2Withdraw: string;
|
|
1032
1008
|
MorphoClaim: string;
|
|
1033
|
-
MorphoAaveV3Borrow: string;
|
|
1034
|
-
MorphoAaveV3Payback: string;
|
|
1035
|
-
MorphoAaveV3Supply: string;
|
|
1036
|
-
MorphoAaveV3Withdraw: string;
|
|
1037
1009
|
CompBorrow: string;
|
|
1038
1010
|
CompClaim: string;
|
|
1039
1011
|
CompPayback: string;
|
|
@@ -1186,10 +1158,6 @@ declare const _default: {
|
|
|
1186
1158
|
MorphoAaveV2Supply?: undefined;
|
|
1187
1159
|
MorphoAaveV2Withdraw?: undefined;
|
|
1188
1160
|
MorphoClaim?: undefined;
|
|
1189
|
-
MorphoAaveV3Borrow?: undefined;
|
|
1190
|
-
MorphoAaveV3Payback?: undefined;
|
|
1191
|
-
MorphoAaveV3Supply?: undefined;
|
|
1192
|
-
MorphoAaveV3Withdraw?: undefined;
|
|
1193
1161
|
CompBorrow?: undefined;
|
|
1194
1162
|
CompClaim?: undefined;
|
|
1195
1163
|
CompPayback?: undefined;
|
|
@@ -1329,10 +1297,6 @@ declare const _default: {
|
|
|
1329
1297
|
MorphoAaveV2Supply?: undefined;
|
|
1330
1298
|
MorphoAaveV2Withdraw?: undefined;
|
|
1331
1299
|
MorphoClaim?: undefined;
|
|
1332
|
-
MorphoAaveV3Borrow?: undefined;
|
|
1333
|
-
MorphoAaveV3Payback?: undefined;
|
|
1334
|
-
MorphoAaveV3Supply?: undefined;
|
|
1335
|
-
MorphoAaveV3Withdraw?: undefined;
|
|
1336
1300
|
CompBorrow?: undefined;
|
|
1337
1301
|
CompClaim?: undefined;
|
|
1338
1302
|
CompPayback?: undefined;
|
|
@@ -1464,10 +1428,6 @@ declare const _default: {
|
|
|
1464
1428
|
MorphoAaveV2Supply: string;
|
|
1465
1429
|
MorphoAaveV2Withdraw: string;
|
|
1466
1430
|
MorphoClaim: string;
|
|
1467
|
-
MorphoAaveV3Borrow: string;
|
|
1468
|
-
MorphoAaveV3Payback: string;
|
|
1469
|
-
MorphoAaveV3Supply: string;
|
|
1470
|
-
MorphoAaveV3Withdraw: string;
|
|
1471
1431
|
CompBorrow: string;
|
|
1472
1432
|
CompClaim: string;
|
|
1473
1433
|
CompPayback: string;
|
|
@@ -1620,10 +1580,6 @@ declare const _default: {
|
|
|
1620
1580
|
MorphoAaveV2Supply?: undefined;
|
|
1621
1581
|
MorphoAaveV2Withdraw?: undefined;
|
|
1622
1582
|
MorphoClaim?: undefined;
|
|
1623
|
-
MorphoAaveV3Borrow?: undefined;
|
|
1624
|
-
MorphoAaveV3Payback?: undefined;
|
|
1625
|
-
MorphoAaveV3Supply?: undefined;
|
|
1626
|
-
MorphoAaveV3Withdraw?: undefined;
|
|
1627
1583
|
CompBorrow?: undefined;
|
|
1628
1584
|
CompClaim?: undefined;
|
|
1629
1585
|
CompPayback?: undefined;
|
|
@@ -1763,10 +1719,6 @@ declare const _default: {
|
|
|
1763
1719
|
MorphoAaveV2Supply?: undefined;
|
|
1764
1720
|
MorphoAaveV2Withdraw?: undefined;
|
|
1765
1721
|
MorphoClaim?: undefined;
|
|
1766
|
-
MorphoAaveV3Borrow?: undefined;
|
|
1767
|
-
MorphoAaveV3Payback?: undefined;
|
|
1768
|
-
MorphoAaveV3Supply?: undefined;
|
|
1769
|
-
MorphoAaveV3Withdraw?: undefined;
|
|
1770
1722
|
CompBorrow?: undefined;
|
|
1771
1723
|
CompClaim?: undefined;
|
|
1772
1724
|
CompPayback?: undefined;
|
package/esm/src/types.d.ts
CHANGED
|
@@ -39,5 +39,6 @@ type uint64 = string;
|
|
|
39
39
|
type uint24 = string;
|
|
40
40
|
type uint16 = string;
|
|
41
41
|
type uint8 = string;
|
|
42
|
+
type int256 = string;
|
|
42
43
|
type int24 = string;
|
|
43
|
-
export { AccessList, AccessListItem, AccessLists, Config, Network, Networks, EthAddress, bytes32, bytes, uint256, uint160, uint128, uint80, uint64, uint24, uint16, uint8, int24, };
|
|
44
|
+
export { AccessList, AccessListItem, AccessLists, Config, Network, Networks, EthAddress, bytes32, bytes, uint256, uint160, uint128, uint80, uint64, uint24, uint16, uint8, int256, int24, };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const curveusdMarkets: {
|
|
2
|
+
sfrxETH: {
|
|
3
|
+
controllerAddress: string;
|
|
4
|
+
debtAvailableBlock: number;
|
|
5
|
+
};
|
|
6
|
+
wstETH: {
|
|
7
|
+
controllerAddress: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export declare const controllerFactoryAddress = "0xC9332fdCB1C491Dcc683bAe86Fe3cb70360738BC";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// @dev debtAvailableBlock is only used in v3-contracts repo
|
|
2
|
+
export const curveusdMarkets = {
|
|
3
|
+
sfrxETH: { controllerAddress: '0x8472a9a7632b173c8cf3a86d3afec50c35548e76', debtAvailableBlock: 17425859 },
|
|
4
|
+
wstETH: { controllerAddress: '0x100dAa78fC509Db39Ef7D04DE0c1ABD299f4C6CE' },
|
|
5
|
+
};
|
|
6
|
+
export const controllerFactoryAddress = '0xC9332fdCB1C491Dcc683bAe86Fe3cb70360738BC';
|
package/esm/src/utils/index.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ import * as uniswapV3LP from './uniswapV3LP';
|
|
|
4
4
|
import * as convexUtils from './convex-utils';
|
|
5
5
|
import mstableAssetPairs from './mstableAssetPairs';
|
|
6
6
|
import * as curveUtils from './curve-utils';
|
|
7
|
-
|
|
7
|
+
import * as curveusdUtils from './curveusd-utils';
|
|
8
|
+
export { zeroExExchange, uniswapLP, uniswapV3LP, mstableAssetPairs, convexUtils, curveUtils, curveusdUtils, };
|
package/esm/src/utils/index.js
CHANGED
|
@@ -4,4 +4,5 @@ import * as uniswapV3LP from './uniswapV3LP';
|
|
|
4
4
|
import * as convexUtils from './convex-utils';
|
|
5
5
|
import mstableAssetPairs from './mstableAssetPairs';
|
|
6
6
|
import * as curveUtils from './curve-utils';
|
|
7
|
-
|
|
7
|
+
import * as curveusdUtils from './curveusd-utils';
|
|
8
|
+
export { zeroExExchange, uniswapLP, uniswapV3LP, mstableAssetPairs, convexUtils, curveUtils, curveusdUtils, };
|
package/package.json
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, uint256 } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* CurveUsdBorrowAction - Action that borrows crvUSD from proxy curveusd position
|
|
7
|
+
*
|
|
8
|
+
* @category CurveUsd
|
|
9
|
+
*/
|
|
10
|
+
export class CurveUsdBorrowAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* address controllerAddress - Address of the curveusd market controller
|
|
13
|
+
* address to - Address that will receive the borrowed crvUSD, will default to proxy
|
|
14
|
+
* uint256 debtAmount - Amount of crvUSD to borrow
|
|
15
|
+
*/
|
|
16
|
+
/// @dev debtAmount must be non-zero
|
|
17
|
+
/// @dev if debtAmount == uintMax will borrow as much as the collateral will support
|
|
18
|
+
constructor(
|
|
19
|
+
controllerAddress: EthAddress,
|
|
20
|
+
to: EthAddress,
|
|
21
|
+
debtAmount: uint256,
|
|
22
|
+
) {
|
|
23
|
+
super(
|
|
24
|
+
'CurveUsdBorrow',
|
|
25
|
+
getAddr('CurveUsdBorrow'),
|
|
26
|
+
['address', 'address', 'uint256'],
|
|
27
|
+
[controllerAddress, to, debtAmount],
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
this.mappableArgs = [
|
|
31
|
+
...this.args,
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { compare } from '@defisaver/tokens/esm/utils';
|
|
2
|
+
import { getAssetInfo } from '@defisaver/tokens';
|
|
3
|
+
import { Action } from '../../Action';
|
|
4
|
+
import { requireAddress } from '../../utils/general';
|
|
5
|
+
import { getAddr } from '../../addresses';
|
|
6
|
+
import { EthAddress, uint256 } from '../../types';
|
|
7
|
+
import { curveusdMarkets } from '../../utils/curveusd-utils';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* CurveUsdCreateAction - Action that creates a curveusd position on behalf of proxy
|
|
11
|
+
*
|
|
12
|
+
* @category CurveUsd
|
|
13
|
+
*/
|
|
14
|
+
export class CurveUsdCreateAction extends Action {
|
|
15
|
+
/**
|
|
16
|
+
* address controllerAddress - Address of the curveusd market controller
|
|
17
|
+
* address from - Address from which to pull collateral asset, will default to proxy
|
|
18
|
+
* address to - Address that will receive the borrowed crvUSD, will default to proxy
|
|
19
|
+
* uint256 collateralAmount - Amount of collateral asset to supply
|
|
20
|
+
* uint256 debtAmount - Amount of crvUSD to borrow
|
|
21
|
+
* uint256 nBands - Number of bands in which the collateral will be supplied
|
|
22
|
+
*/
|
|
23
|
+
/// @dev both collateralAmount and debtAmount must be non-zero and can be maxUint
|
|
24
|
+
constructor(
|
|
25
|
+
controllerAddress: EthAddress,
|
|
26
|
+
from: EthAddress,
|
|
27
|
+
to: EthAddress,
|
|
28
|
+
collateralAmount: uint256,
|
|
29
|
+
debtAmount: uint256,
|
|
30
|
+
nBands: uint256,
|
|
31
|
+
) {
|
|
32
|
+
requireAddress(to);
|
|
33
|
+
super(
|
|
34
|
+
'CurveUsdCreate',
|
|
35
|
+
getAddr('CurveUsdCreate'),
|
|
36
|
+
['address', 'address', 'address', 'uint256', 'uint256', 'uint256'],
|
|
37
|
+
[controllerAddress, from, to, collateralAmount, debtAmount, nBands],
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
this.mappableArgs = [
|
|
41
|
+
...this.args,
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async getAssetsToApprove() {
|
|
46
|
+
return [{
|
|
47
|
+
owner: this.args[1],
|
|
48
|
+
asset: getAssetInfo(
|
|
49
|
+
Object.entries(curveusdMarkets).filter(([, { controllerAddress }]) => compare(controllerAddress, this.args[0]))[0][0],
|
|
50
|
+
).address,
|
|
51
|
+
}];
|
|
52
|
+
}
|
|
53
|
+
}
|