@defisaver/sdk 1.0.11 → 1.0.13
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/flashloan/FLAction.js +4 -4
- package/esm/src/actions/index.d.ts +2 -1
- package/esm/src/actions/index.js +2 -1
- package/esm/src/actions/liquity/LiquityAdjustAction.d.ts +21 -0
- package/esm/src/actions/liquity/LiquityAdjustAction.js +33 -0
- package/esm/src/actions/liquity/index.d.ts +1 -0
- package/esm/src/actions/liquity/index.js +1 -0
- package/esm/src/actions/maker/MakerBoostCompositeAction.d.ts +20 -0
- package/esm/src/actions/maker/MakerBoostCompositeAction.js +48 -0
- package/esm/src/actions/maker/MakerRepayCompositeAction.d.ts +20 -0
- package/esm/src/actions/maker/MakerRepayCompositeAction.js +48 -0
- package/esm/src/actions/maker/index.d.ts +2 -0
- package/esm/src/actions/maker/index.js +2 -0
- package/esm/src/actions/morpho/MorphoAaveV2BorrowAction.d.ts +16 -0
- package/esm/src/actions/morpho/MorphoAaveV2BorrowAction.js +23 -0
- package/esm/src/actions/morpho/MorphoAaveV2PaybackAction.d.ts +20 -0
- package/esm/src/actions/morpho/MorphoAaveV2PaybackAction.js +42 -0
- package/esm/src/actions/morpho/MorphoAaveV2SupplyAction.d.ts +21 -0
- package/esm/src/actions/morpho/MorphoAaveV2SupplyAction.js +43 -0
- package/esm/src/actions/morpho/MorphoAaveV2WithdrawAction.d.ts +15 -0
- package/esm/src/actions/morpho/MorphoAaveV2WithdrawAction.js +22 -0
- package/esm/src/actions/morpho/MorphoClaimAction.d.ts +15 -0
- package/esm/src/actions/morpho/MorphoClaimAction.js +20 -0
- package/esm/src/actions/morpho/index.d.ts +5 -0
- package/esm/src/actions/morpho/index.js +5 -0
- package/esm/src/addresses.d.ts +21 -0
- package/esm/src/addresses.js +8 -0
- package/esm/src/index.d.ts +84 -0
- package/package.json +1 -1
- package/src/actions/flashloan/FLAction.ts +4 -4
- package/src/actions/index.ts +2 -0
- package/src/actions/liquity/LiquityAdjustAction.ts +51 -0
- package/src/actions/liquity/index.ts +2 -1
- package/src/actions/maker/MakerBoostCompositeAction.ts +55 -0
- package/src/actions/maker/MakerRepayCompositeAction.ts +55 -0
- package/src/actions/maker/index.ts +3 -1
- package/src/actions/morpho/MorphoAaveV2BorrowAction.ts +36 -0
- package/src/actions/morpho/MorphoAaveV2PaybackAction.ts +34 -0
- package/src/actions/morpho/MorphoAaveV2SupplyAction.ts +46 -0
- package/src/actions/morpho/MorphoAaveV2WithdrawAction.ts +25 -0
- package/src/actions/morpho/MorphoClaimAction.ts +23 -0
- package/src/actions/morpho/index.ts +5 -0
- package/src/addresses.ts +10 -0
- package/umd/index.js +712 -377
|
@@ -29,16 +29,16 @@ _FLAction_instances = new WeakSet(), _FLAction_handleArgs = function _FLAction_h
|
|
|
29
29
|
[],
|
|
30
30
|
specificFLAction.args[6],
|
|
31
31
|
];
|
|
32
|
-
if (specificFLAction.constructor.name === '
|
|
32
|
+
if (specificFLAction.constructor.name === 'AaveV2FlashLoanAction') {
|
|
33
33
|
argsToReturn[5] = [1];
|
|
34
34
|
}
|
|
35
|
-
if (specificFLAction.constructor.name === '
|
|
35
|
+
if (specificFLAction.constructor.name === 'AaveV3FlashLoanAction') {
|
|
36
36
|
argsToReturn[5] = [1];
|
|
37
37
|
}
|
|
38
|
-
if (specificFLAction.constructor.name === '
|
|
38
|
+
if (specificFLAction.constructor.name === 'BalancerFlashLoanAction') {
|
|
39
39
|
argsToReturn[5] = [2];
|
|
40
40
|
}
|
|
41
|
-
if (specificFLAction.constructor.name === '
|
|
41
|
+
if (specificFLAction.constructor.name === 'EulerFlashLoanAction') {
|
|
42
42
|
argsToReturn[5] = [3];
|
|
43
43
|
}
|
|
44
44
|
if (specificFLAction.constructor.name === 'MakerFlashLoanAction') {
|
|
@@ -21,4 +21,5 @@ import * as aaveV3 from './aaveV3';
|
|
|
21
21
|
import * as convex from './convex';
|
|
22
22
|
import * as chickenBonds from './chickenBonds';
|
|
23
23
|
import * as compoundV3 from './compoundV3';
|
|
24
|
-
|
|
24
|
+
import * as morpho from './morpho';
|
|
25
|
+
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, };
|
package/esm/src/actions/index.js
CHANGED
|
@@ -21,4 +21,5 @@ import * as aaveV3 from './aaveV3';
|
|
|
21
21
|
import * as convex from './convex';
|
|
22
22
|
import * as chickenBonds from './chickenBonds';
|
|
23
23
|
import * as compoundV3 from './compoundV3';
|
|
24
|
-
|
|
24
|
+
import * as morpho from './morpho';
|
|
25
|
+
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, };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256, uint8 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* LiquityAdjustAction - Adjust action for Liquity
|
|
5
|
+
*
|
|
6
|
+
* @category Liquity
|
|
7
|
+
*/
|
|
8
|
+
export declare class LiquityAdjustAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param maxFeePercentage Highest borrowing fee to accept
|
|
11
|
+
* @param collAmount Amount of collateral (weth) to deposit
|
|
12
|
+
* @param lusdAmount Amount of LUSD tokens to borrow
|
|
13
|
+
* @param collChange Whether to supply or withdraw collateral
|
|
14
|
+
* @param debtChange Whether to borrow or repay LUSD
|
|
15
|
+
* @param from Address where to pull the tokens from
|
|
16
|
+
* @param to Address that will receive the borrowed tokens
|
|
17
|
+
* @param upperHint Address in the linked list to use as an upper limit
|
|
18
|
+
* @param lowerHint Address in the linked list to use as a lower limit
|
|
19
|
+
*/
|
|
20
|
+
constructor(maxFeePercentage: uint256, collAmount: uint256, lusdAmount: uint256, collChange: uint8, debtChange: uint8, from: EthAddress, to: EthAddress, upperHint: EthAddress, lowerHint: EthAddress);
|
|
21
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { requireAddress } from '../../utils/general';
|
|
3
|
+
import { getAddr } from '../../addresses';
|
|
4
|
+
/**
|
|
5
|
+
* LiquityAdjustAction - Adjust action for Liquity
|
|
6
|
+
*
|
|
7
|
+
* @category Liquity
|
|
8
|
+
*/
|
|
9
|
+
export class LiquityAdjustAction extends Action {
|
|
10
|
+
/**
|
|
11
|
+
* @param maxFeePercentage Highest borrowing fee to accept
|
|
12
|
+
* @param collAmount Amount of collateral (weth) to deposit
|
|
13
|
+
* @param lusdAmount Amount of LUSD tokens to borrow
|
|
14
|
+
* @param collChange Whether to supply or withdraw collateral
|
|
15
|
+
* @param debtChange Whether to borrow or repay LUSD
|
|
16
|
+
* @param from Address where to pull the tokens from
|
|
17
|
+
* @param to Address that will receive the borrowed tokens
|
|
18
|
+
* @param upperHint Address in the linked list to use as an upper limit
|
|
19
|
+
* @param lowerHint Address in the linked list to use as a lower limit
|
|
20
|
+
*/
|
|
21
|
+
constructor(maxFeePercentage, collAmount, lusdAmount, collChange, debtChange, from, to, upperHint, lowerHint) {
|
|
22
|
+
requireAddress(from);
|
|
23
|
+
requireAddress(to);
|
|
24
|
+
super('LiquityAdjust', getAddr('LiquityAdjust'), ['uint256', 'uint256', 'uint256', 'uint8', 'uint8', 'address', 'address', 'address', 'address'], [maxFeePercentage, collAmount, lusdAmount, collChange, debtChange, from, to, upperHint, lowerHint]);
|
|
25
|
+
this.mappableArgs = [
|
|
26
|
+
this.args[0],
|
|
27
|
+
this.args[1],
|
|
28
|
+
this.args[2],
|
|
29
|
+
this.args[5],
|
|
30
|
+
this.args[6],
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* MakerBoostCompositeAction - executes a boost in a single action
|
|
5
|
+
*
|
|
6
|
+
* @category Maker
|
|
7
|
+
*/
|
|
8
|
+
export declare class MakerBoostCompositeAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param vaultId
|
|
11
|
+
* @param joinAddr
|
|
12
|
+
* @param gasUsed
|
|
13
|
+
* @param flAddress
|
|
14
|
+
* @param flAmount
|
|
15
|
+
* @param nextPrice
|
|
16
|
+
* @param targetRatio
|
|
17
|
+
* @param exchangeParams
|
|
18
|
+
*/
|
|
19
|
+
constructor(vaultId: uint256, joinAddr: EthAddress, gasUsed: EthAddress, flAddress: EthAddress, flAmount: uint256, nextPrice: uint256, targetRatio: uint256, exchangeParams: Array<any>);
|
|
20
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* MakerBoostCompositeAction - executes a boost in a single action
|
|
5
|
+
*
|
|
6
|
+
* @category Maker
|
|
7
|
+
*/
|
|
8
|
+
export class MakerBoostCompositeAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param vaultId
|
|
11
|
+
* @param joinAddr
|
|
12
|
+
* @param gasUsed
|
|
13
|
+
* @param flAddress
|
|
14
|
+
* @param flAmount
|
|
15
|
+
* @param nextPrice
|
|
16
|
+
* @param targetRatio
|
|
17
|
+
* @param exchangeParams
|
|
18
|
+
*/
|
|
19
|
+
constructor(vaultId, joinAddr, gasUsed, flAddress, flAmount, nextPrice, targetRatio, exchangeParams) {
|
|
20
|
+
super('McdBoostComposite', getAddr('McdBoostComposite'), [
|
|
21
|
+
'uint256',
|
|
22
|
+
'address',
|
|
23
|
+
'uint256',
|
|
24
|
+
'address',
|
|
25
|
+
'uint256',
|
|
26
|
+
'uint256',
|
|
27
|
+
'uint256',
|
|
28
|
+
['address', 'address', 'uint256', 'uint256', 'uint256', 'uint256', 'address', 'address', 'bytes', ['address', 'address', 'address', 'uint256', 'uint256', 'bytes']],
|
|
29
|
+
], [
|
|
30
|
+
vaultId,
|
|
31
|
+
joinAddr,
|
|
32
|
+
gasUsed,
|
|
33
|
+
flAddress,
|
|
34
|
+
flAmount,
|
|
35
|
+
nextPrice,
|
|
36
|
+
targetRatio,
|
|
37
|
+
exchangeParams,
|
|
38
|
+
]);
|
|
39
|
+
this.mappableArgs = [
|
|
40
|
+
this.args[0],
|
|
41
|
+
this.args[1],
|
|
42
|
+
this.args[4],
|
|
43
|
+
this.args[5][0],
|
|
44
|
+
this.args[5][1],
|
|
45
|
+
this.args[5][2],
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* MakerRepayCompositeAction - executes a repay in a single action
|
|
5
|
+
*
|
|
6
|
+
* @category Maker
|
|
7
|
+
*/
|
|
8
|
+
export declare class MakerRepayCompositeAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param vaultId
|
|
11
|
+
* @param joinAddr
|
|
12
|
+
* @param gasUsed
|
|
13
|
+
* @param flAddress
|
|
14
|
+
* @param flAmount
|
|
15
|
+
* @param nextPrice
|
|
16
|
+
* @param targetRatio
|
|
17
|
+
* @param exchangeParams
|
|
18
|
+
*/
|
|
19
|
+
constructor(vaultId: uint256, joinAddr: EthAddress, gasUsed: EthAddress, flAddress: EthAddress, flAmount: uint256, nextPrice: uint256, targetRatio: uint256, exchangeParams: Array<any>);
|
|
20
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* MakerRepayCompositeAction - executes a repay in a single action
|
|
5
|
+
*
|
|
6
|
+
* @category Maker
|
|
7
|
+
*/
|
|
8
|
+
export class MakerRepayCompositeAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param vaultId
|
|
11
|
+
* @param joinAddr
|
|
12
|
+
* @param gasUsed
|
|
13
|
+
* @param flAddress
|
|
14
|
+
* @param flAmount
|
|
15
|
+
* @param nextPrice
|
|
16
|
+
* @param targetRatio
|
|
17
|
+
* @param exchangeParams
|
|
18
|
+
*/
|
|
19
|
+
constructor(vaultId, joinAddr, gasUsed, flAddress, flAmount, nextPrice, targetRatio, exchangeParams) {
|
|
20
|
+
super('McdRepayComposite', getAddr('McdRepayComposite'), [
|
|
21
|
+
'uint256',
|
|
22
|
+
'address',
|
|
23
|
+
'uint256',
|
|
24
|
+
'address',
|
|
25
|
+
'uint256',
|
|
26
|
+
'uint256',
|
|
27
|
+
'uint256',
|
|
28
|
+
['address', 'address', 'uint256', 'uint256', 'uint256', 'uint256', 'address', 'address', 'bytes', ['address', 'address', 'address', 'uint256', 'uint256', 'bytes']],
|
|
29
|
+
], [
|
|
30
|
+
vaultId,
|
|
31
|
+
joinAddr,
|
|
32
|
+
gasUsed,
|
|
33
|
+
flAddress,
|
|
34
|
+
flAmount,
|
|
35
|
+
nextPrice,
|
|
36
|
+
targetRatio,
|
|
37
|
+
exchangeParams,
|
|
38
|
+
]);
|
|
39
|
+
this.mappableArgs = [
|
|
40
|
+
this.args[0],
|
|
41
|
+
this.args[1],
|
|
42
|
+
this.args[4],
|
|
43
|
+
this.args[5][0],
|
|
44
|
+
this.args[5][1],
|
|
45
|
+
this.args[5][2],
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* MorphoAaveV2BorrowAction - Borrow token from morpho on behalf of proxy
|
|
5
|
+
*
|
|
6
|
+
* @category Morpho
|
|
7
|
+
*/
|
|
8
|
+
export declare class MorphoAaveV2BorrowAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param tokenAddr - Address of Token
|
|
11
|
+
* @param amount - Amount to borrow
|
|
12
|
+
* @param to - Borrowed tokens will be sent to this address
|
|
13
|
+
* @param maxGasForMatching - Max gas to spend on p2p matching
|
|
14
|
+
*/
|
|
15
|
+
constructor(tokenAddr: EthAddress, amount: uint256, to: EthAddress, maxGasForMatching?: uint256);
|
|
16
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* MorphoAaveV2BorrowAction - Borrow token from morpho on behalf of proxy
|
|
5
|
+
*
|
|
6
|
+
* @category Morpho
|
|
7
|
+
*/
|
|
8
|
+
export class MorphoAaveV2BorrowAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param tokenAddr - Address of Token
|
|
11
|
+
* @param amount - Amount to borrow
|
|
12
|
+
* @param to - Borrowed tokens will be sent to this address
|
|
13
|
+
* @param maxGasForMatching - Max gas to spend on p2p matching
|
|
14
|
+
*/
|
|
15
|
+
constructor(tokenAddr, amount, to, maxGasForMatching = '0') {
|
|
16
|
+
super('MorphoAaveV2Borrow', getAddr('MorphoAaveV2Borrow'), ['address', 'uint256', 'address', 'uint256'], [tokenAddr, amount, to, maxGasForMatching]);
|
|
17
|
+
this.mappableArgs = [
|
|
18
|
+
this.args[0],
|
|
19
|
+
this.args[1],
|
|
20
|
+
this.args[2],
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* MorphoAaveV2PaybackAction - Supply token to morpho
|
|
5
|
+
*
|
|
6
|
+
* @category Morpho
|
|
7
|
+
*/
|
|
8
|
+
export declare class MorphoAaveV2PaybackAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param tokenAddr - Address of Token
|
|
11
|
+
* @param amount - Token amount
|
|
12
|
+
* @param from - Tokens will be sent from this address
|
|
13
|
+
* @param onBehalf - Tokens will be paid back to this address' position (defaults to sender's proxy)
|
|
14
|
+
*/
|
|
15
|
+
constructor(tokenAddr: EthAddress, amount: uint256, from: EthAddress, onBehalf?: EthAddress);
|
|
16
|
+
getAssetsToApprove(): Promise<{
|
|
17
|
+
asset: any;
|
|
18
|
+
owner: any;
|
|
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 { getAssetInfoByAddress } from '@defisaver/tokens';
|
|
11
|
+
import { Action } from '../../Action';
|
|
12
|
+
import { getAddr } from '../../addresses';
|
|
13
|
+
/**
|
|
14
|
+
* MorphoAaveV2PaybackAction - Supply token to morpho
|
|
15
|
+
*
|
|
16
|
+
* @category Morpho
|
|
17
|
+
*/
|
|
18
|
+
export class MorphoAaveV2PaybackAction extends Action {
|
|
19
|
+
/**
|
|
20
|
+
* @param tokenAddr - Address of Token
|
|
21
|
+
* @param amount - Token amount
|
|
22
|
+
* @param from - Tokens will be sent from this address
|
|
23
|
+
* @param onBehalf - Tokens will be paid back to this address' position (defaults to sender's proxy)
|
|
24
|
+
*/
|
|
25
|
+
constructor(tokenAddr, amount, from, onBehalf = getAddr('Empty')) {
|
|
26
|
+
super('MorphoAaveV2Payback', getAddr('MorphoAaveV2Payback'), ['address', 'uint256', 'address', 'address'], [tokenAddr, amount, from, onBehalf]);
|
|
27
|
+
this.mappableArgs = [
|
|
28
|
+
this.args[0],
|
|
29
|
+
this.args[1],
|
|
30
|
+
this.args[2],
|
|
31
|
+
this.args[3],
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
getAssetsToApprove() {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
const asset = getAssetInfoByAddress(this.args[0]);
|
|
37
|
+
if (asset.symbol !== 'ETH')
|
|
38
|
+
return [{ asset: this.args[0], owner: this.args[2] }];
|
|
39
|
+
return [];
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* MorphoAaveV2SupplyAction - Supply token to morpho
|
|
5
|
+
*
|
|
6
|
+
* @category Morpho
|
|
7
|
+
*/
|
|
8
|
+
export declare class MorphoAaveV2SupplyAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param tokenAddr - Address of tokenAddr
|
|
11
|
+
* @param amount - Token amount
|
|
12
|
+
* @param from - Tokens will be sent from this address
|
|
13
|
+
* @param onBehalf - Tokens will be supplied to this address' position (defaults to sender's proxy)
|
|
14
|
+
* @param maxGasForMatching - Max gas to spend on p2p matching
|
|
15
|
+
*/
|
|
16
|
+
constructor(tokenAddr: EthAddress, amount: uint256, from: EthAddress, onBehalf?: EthAddress, maxGasForMatching?: uint256);
|
|
17
|
+
getAssetsToApprove(): Promise<{
|
|
18
|
+
asset: any;
|
|
19
|
+
owner: any;
|
|
20
|
+
}[]>;
|
|
21
|
+
}
|
|
@@ -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 { getAssetInfoByAddress } from '@defisaver/tokens';
|
|
11
|
+
import { Action } from '../../Action';
|
|
12
|
+
import { getAddr } from '../../addresses';
|
|
13
|
+
/**
|
|
14
|
+
* MorphoAaveV2SupplyAction - Supply token to morpho
|
|
15
|
+
*
|
|
16
|
+
* @category Morpho
|
|
17
|
+
*/
|
|
18
|
+
export class MorphoAaveV2SupplyAction extends Action {
|
|
19
|
+
/**
|
|
20
|
+
* @param tokenAddr - Address of tokenAddr
|
|
21
|
+
* @param amount - Token amount
|
|
22
|
+
* @param from - Tokens will be sent from this address
|
|
23
|
+
* @param onBehalf - Tokens will be supplied to this address' position (defaults to sender's proxy)
|
|
24
|
+
* @param maxGasForMatching - Max gas to spend on p2p matching
|
|
25
|
+
*/
|
|
26
|
+
constructor(tokenAddr, amount, from, onBehalf = getAddr('Empty'), maxGasForMatching = '0') {
|
|
27
|
+
super('MorphoAaveV2Supply', getAddr('MorphoAaveV2Supply'), ['address', 'uint256', 'address', 'address', 'uint256'], [tokenAddr, amount, from, onBehalf, maxGasForMatching]);
|
|
28
|
+
this.mappableArgs = [
|
|
29
|
+
this.args[0],
|
|
30
|
+
this.args[1],
|
|
31
|
+
this.args[2],
|
|
32
|
+
this.args[3],
|
|
33
|
+
];
|
|
34
|
+
}
|
|
35
|
+
getAssetsToApprove() {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const asset = getAssetInfoByAddress(this.args[0]);
|
|
38
|
+
if (asset.symbol !== 'ETH')
|
|
39
|
+
return [{ asset: this.args[0], owner: this.args[2] }];
|
|
40
|
+
return [];
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* MorphoAaveV2WithdrawAction - Withdraw token from morpho
|
|
5
|
+
*
|
|
6
|
+
* @category Morpho
|
|
7
|
+
*/
|
|
8
|
+
export declare class MorphoAaveV2WithdrawAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param tokenAddr - Address of Token
|
|
11
|
+
* @param amount - Token amount
|
|
12
|
+
* @param to - Tokens will be withdrawn to this address
|
|
13
|
+
*/
|
|
14
|
+
constructor(tokenAddr: EthAddress, amount: uint256, to: EthAddress);
|
|
15
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* MorphoAaveV2WithdrawAction - Withdraw token from morpho
|
|
5
|
+
*
|
|
6
|
+
* @category Morpho
|
|
7
|
+
*/
|
|
8
|
+
export class MorphoAaveV2WithdrawAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param tokenAddr - Address of Token
|
|
11
|
+
* @param amount - Token amount
|
|
12
|
+
* @param to - Tokens will be withdrawn to this address
|
|
13
|
+
*/
|
|
14
|
+
constructor(tokenAddr, amount, to) {
|
|
15
|
+
super('MorphoAaveV2Withdraw', getAddr('MorphoAaveV2Withdraw'), ['address', 'uint256', 'address'], [tokenAddr, amount, to]);
|
|
16
|
+
this.mappableArgs = [
|
|
17
|
+
this.args[0],
|
|
18
|
+
this.args[1],
|
|
19
|
+
this.args[2],
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256, bytes32 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* MorphoClaimAction - Claim Morpho rewards
|
|
5
|
+
*
|
|
6
|
+
* @category Morpho
|
|
7
|
+
*/
|
|
8
|
+
export declare class MorphoClaimAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param onBehalfOf - Address for which to claim
|
|
11
|
+
* @param claimable - Claimable amount
|
|
12
|
+
* @param proof - Merkle proof of claim
|
|
13
|
+
*/
|
|
14
|
+
constructor(onBehalfOf: EthAddress, claimable: uint256, proof: Array<bytes32>);
|
|
15
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* MorphoClaimAction - Claim Morpho rewards
|
|
5
|
+
*
|
|
6
|
+
* @category Morpho
|
|
7
|
+
*/
|
|
8
|
+
export class MorphoClaimAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param onBehalfOf - Address for which to claim
|
|
11
|
+
* @param claimable - Claimable amount
|
|
12
|
+
* @param proof - Merkle proof of claim
|
|
13
|
+
*/
|
|
14
|
+
constructor(onBehalfOf, claimable, proof) {
|
|
15
|
+
super('MorphoClaim', getAddr('MorphoClaim'), ['address', 'uint256', 'bytes32[]'], [onBehalfOf, claimable, proof]);
|
|
16
|
+
this.mappableArgs = [
|
|
17
|
+
this.args[0],
|
|
18
|
+
];
|
|
19
|
+
}
|
|
20
|
+
}
|
package/esm/src/addresses.d.ts
CHANGED
|
@@ -47,6 +47,11 @@ export declare const actionAddresses: {
|
|
|
47
47
|
AaveV3Borrow: string;
|
|
48
48
|
AaveV3ATokenPayback: string;
|
|
49
49
|
AaveV3View: string;
|
|
50
|
+
MorphoAaveV2Borrow: string;
|
|
51
|
+
MorphoAaveV2Payback: string;
|
|
52
|
+
MorphoAaveV2Supply: string;
|
|
53
|
+
MorphoAaveV2Withdraw: string;
|
|
54
|
+
MorphoClaim: string;
|
|
50
55
|
CompBorrow: string;
|
|
51
56
|
CompClaim: string;
|
|
52
57
|
CompPayback: string;
|
|
@@ -103,6 +108,8 @@ export declare const actionAddresses: {
|
|
|
103
108
|
CurveStethPoolWithdraw: string;
|
|
104
109
|
CurveDeposit: string;
|
|
105
110
|
CurveWithdraw: string;
|
|
111
|
+
McdBoostComposite: string;
|
|
112
|
+
McdRepayComposite: string;
|
|
106
113
|
FLEuler: string;
|
|
107
114
|
TrailingStopTrigger: string;
|
|
108
115
|
CBRebondTrigger: string;
|
|
@@ -184,6 +191,11 @@ export declare const actionAddresses: {
|
|
|
184
191
|
AaveWithdraw?: undefined;
|
|
185
192
|
AaveCollateralSwitch?: undefined;
|
|
186
193
|
AaveV3View?: undefined;
|
|
194
|
+
MorphoAaveV2Borrow?: undefined;
|
|
195
|
+
MorphoAaveV2Payback?: undefined;
|
|
196
|
+
MorphoAaveV2Supply?: undefined;
|
|
197
|
+
MorphoAaveV2Withdraw?: undefined;
|
|
198
|
+
MorphoClaim?: undefined;
|
|
187
199
|
CompBorrow?: undefined;
|
|
188
200
|
CompClaim?: undefined;
|
|
189
201
|
CompPayback?: undefined;
|
|
@@ -232,6 +244,8 @@ export declare const actionAddresses: {
|
|
|
232
244
|
CurveStethPoolWithdraw?: undefined;
|
|
233
245
|
CurveDeposit?: undefined;
|
|
234
246
|
CurveWithdraw?: undefined;
|
|
247
|
+
McdBoostComposite?: undefined;
|
|
248
|
+
McdRepayComposite?: undefined;
|
|
235
249
|
FLEuler?: undefined;
|
|
236
250
|
TrailingStopTrigger?: undefined;
|
|
237
251
|
CBRebondTrigger?: undefined;
|
|
@@ -309,6 +323,11 @@ export declare const actionAddresses: {
|
|
|
309
323
|
AaveCollateralSwitch?: undefined;
|
|
310
324
|
AaveV3ClaimRewards?: undefined;
|
|
311
325
|
AaveV3View?: undefined;
|
|
326
|
+
MorphoAaveV2Borrow?: undefined;
|
|
327
|
+
MorphoAaveV2Payback?: undefined;
|
|
328
|
+
MorphoAaveV2Supply?: undefined;
|
|
329
|
+
MorphoAaveV2Withdraw?: undefined;
|
|
330
|
+
MorphoClaim?: undefined;
|
|
312
331
|
CompBorrow?: undefined;
|
|
313
332
|
CompClaim?: undefined;
|
|
314
333
|
CompPayback?: undefined;
|
|
@@ -357,6 +376,8 @@ export declare const actionAddresses: {
|
|
|
357
376
|
CurveStethPoolWithdraw?: undefined;
|
|
358
377
|
CurveDeposit?: undefined;
|
|
359
378
|
CurveWithdraw?: undefined;
|
|
379
|
+
McdBoostComposite?: undefined;
|
|
380
|
+
McdRepayComposite?: undefined;
|
|
360
381
|
FLEuler?: undefined;
|
|
361
382
|
TrailingStopTrigger?: undefined;
|
|
362
383
|
CBRebondTrigger?: undefined;
|
package/esm/src/addresses.js
CHANGED
|
@@ -54,6 +54,12 @@ export const actionAddresses = {
|
|
|
54
54
|
AaveV3Borrow: '0x7079ba1Bd00EeFCD2a260BbD6D088230505e3858',
|
|
55
55
|
AaveV3ATokenPayback: '0xDe5c012cd1878D86E91309593764895a3adb380E',
|
|
56
56
|
AaveV3View: '0x9ECB0645b357fDD7B92789B91595160862Bd45d0',
|
|
57
|
+
// morpho aave v2
|
|
58
|
+
MorphoAaveV2Borrow: '0xa85C3E41Bf9F75a381927e1Aa9b00f77C4631109',
|
|
59
|
+
MorphoAaveV2Payback: '0x5dd0E0835acbb08aa4A4599d70fB2d93969fa7b7',
|
|
60
|
+
MorphoAaveV2Supply: '0x60ED1Cf5Da785AA4FD4A4fF3f8cFc0682d60E0F3',
|
|
61
|
+
MorphoAaveV2Withdraw: '0x391bAbCcBDa1d591a0Bb91730B525d6E596dc88a',
|
|
62
|
+
MorphoClaim: '0xa269C841E26EA8Ee1F0350a2E5905F71446998dC',
|
|
57
63
|
// compound
|
|
58
64
|
CompBorrow: '0x8495579BF6Ae848f7E59686536F834f1d2CCd79C',
|
|
59
65
|
CompClaim: '0x81F488cF7A0128A9DB5e7207042cCAB1CB0ac902',
|
|
@@ -123,6 +129,8 @@ export const actionAddresses = {
|
|
|
123
129
|
CurveStethPoolWithdraw: '0x4089731d843Ce52699Fe64F68556aBbD95D70D00',
|
|
124
130
|
CurveDeposit: '0x160225c24300bD9fAA03Bc007D5e72bDbbcA9257',
|
|
125
131
|
CurveWithdraw: '0xb6Be5c486dD65c2cb18A388671b348E62307F0B3',
|
|
132
|
+
McdBoostComposite: '0x0000000000000000000000000000000000000000',
|
|
133
|
+
McdRepayComposite: '0x0000000000000000000000000000000000000000',
|
|
126
134
|
// Euler
|
|
127
135
|
FLEuler: '0x66DC6444CdC099153f89332e0d4C87af5C966A75',
|
|
128
136
|
TrailingStopTrigger: '0x0000000000000000000000000000000000000000',
|