@defisaver/sdk 1.0.20 → 1.0.22
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/morpho/aaveV3/MorphoAaveV3BorrowAction.d.ts +18 -0
- package/esm/src/actions/morpho/aaveV3/MorphoAaveV3BorrowAction.js +27 -0
- package/esm/src/actions/morpho/aaveV3/MorphoAaveV3PaybackAction.d.ts +21 -0
- package/esm/src/actions/morpho/aaveV3/MorphoAaveV3PaybackAction.js +44 -0
- package/esm/src/actions/morpho/aaveV3/MorphoAaveV3SupplyAction.d.ts +23 -0
- package/esm/src/actions/morpho/aaveV3/MorphoAaveV3SupplyAction.js +47 -0
- package/esm/src/actions/morpho/aaveV3/MorphoAaveV3WithdrawAction.d.ts +19 -0
- package/esm/src/actions/morpho/aaveV3/MorphoAaveV3WithdrawAction.js +29 -0
- package/esm/src/actions/morpho/index.d.ts +4 -0
- package/esm/src/actions/morpho/index.js +4 -0
- package/esm/src/addresses.d.ts +12 -0
- package/esm/src/addresses.js +5 -0
- package/esm/src/index.d.ts +48 -0
- package/package.json +1 -1
- package/src/actions/morpho/aaveV3/MorphoAaveV3BorrowAction.ts +42 -0
- package/src/actions/morpho/aaveV3/MorphoAaveV3PaybackAction.ts +47 -0
- package/src/actions/morpho/aaveV3/MorphoAaveV3SupplyAction.ts +52 -0
- package/src/actions/morpho/aaveV3/MorphoAaveV3WithdrawAction.ts +45 -0
- package/src/actions/morpho/index.ts +4 -0
- package/src/addresses.ts +6 -0
- package/umd/index.js +232 -45
- package/package-lock.json +0 -21474
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Action } from '../../../Action';
|
|
2
|
+
import { EthAddress, uint256 } from '../../../types';
|
|
3
|
+
/**
|
|
4
|
+
* MorphoAaveV3BorrowAction - Borrow token from Morpho AaveV3
|
|
5
|
+
*
|
|
6
|
+
* @category Morpho
|
|
7
|
+
*/
|
|
8
|
+
export declare class MorphoAaveV3BorrowAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
|
|
11
|
+
* @param tokenAddr - Address of tokenAddr (underlying)
|
|
12
|
+
* @param amount - Token amount
|
|
13
|
+
* @param to - The address we are sending the borrowed tokens to
|
|
14
|
+
* @param onBehalf - For what user we are borrowing the tokens, defaults to proxy
|
|
15
|
+
* @param maxIterations - Max number of iterations for p2p matching, 0 will use default num of iterations
|
|
16
|
+
*/
|
|
17
|
+
constructor(emodeId: uint256, tokenAddr: EthAddress, amount: uint256, to: EthAddress, onBehalf?: EthAddress, maxIterations?: uint256);
|
|
18
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Action } from '../../../Action';
|
|
2
|
+
import { getAddr } from '../../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* MorphoAaveV3BorrowAction - Borrow token from Morpho AaveV3
|
|
5
|
+
*
|
|
6
|
+
* @category Morpho
|
|
7
|
+
*/
|
|
8
|
+
export class MorphoAaveV3BorrowAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
|
|
11
|
+
* @param tokenAddr - Address of tokenAddr (underlying)
|
|
12
|
+
* @param amount - Token amount
|
|
13
|
+
* @param to - The address we are sending the borrowed tokens to
|
|
14
|
+
* @param onBehalf - For what user we are borrowing the tokens, defaults to proxy
|
|
15
|
+
* @param maxIterations - Max number of iterations for p2p matching, 0 will use default num of iterations
|
|
16
|
+
*/
|
|
17
|
+
constructor(emodeId, tokenAddr, amount, to, onBehalf = getAddr('Empty'), maxIterations = '4') {
|
|
18
|
+
super('MorphoAaveV3Borrow', getAddr('MorphoAaveV3Borrow'), ['uint256', 'address', 'uint256', 'address', 'address', 'uint256'], [emodeId, tokenAddr, amount, to, onBehalf, maxIterations]);
|
|
19
|
+
this.mappableArgs = [
|
|
20
|
+
this.args[0],
|
|
21
|
+
this.args[1],
|
|
22
|
+
this.args[2],
|
|
23
|
+
this.args[3],
|
|
24
|
+
this.args[4],
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Action } from '../../../Action';
|
|
2
|
+
import { EthAddress, uint256 } from '../../../types';
|
|
3
|
+
/**
|
|
4
|
+
* MorphoAaveV3PaybackAction - Payback token to Morpho AaveV3
|
|
5
|
+
*
|
|
6
|
+
* @category Morpho
|
|
7
|
+
*/
|
|
8
|
+
export declare class MorphoAaveV3PaybackAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
|
|
11
|
+
* @param tokenAddr - Address of tokenAddr (underlying)
|
|
12
|
+
* @param amount - Token amount
|
|
13
|
+
* @param from - Tokens will be sent from this address
|
|
14
|
+
* @param onBehalf - For what user we are paying back the debt, defaults to proxy
|
|
15
|
+
*/
|
|
16
|
+
constructor(emodeId: uint256, tokenAddr: EthAddress, amount: uint256, from: EthAddress, onBehalf?: EthAddress);
|
|
17
|
+
getAssetsToApprove(): Promise<{
|
|
18
|
+
asset: any;
|
|
19
|
+
owner: any;
|
|
20
|
+
}[]>;
|
|
21
|
+
}
|
|
@@ -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 { getAssetInfoByAddress } from '@defisaver/tokens';
|
|
11
|
+
import { Action } from '../../../Action';
|
|
12
|
+
import { getAddr } from '../../../addresses';
|
|
13
|
+
/**
|
|
14
|
+
* MorphoAaveV3PaybackAction - Payback token to Morpho AaveV3
|
|
15
|
+
*
|
|
16
|
+
* @category Morpho
|
|
17
|
+
*/
|
|
18
|
+
export class MorphoAaveV3PaybackAction extends Action {
|
|
19
|
+
/**
|
|
20
|
+
* @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
|
|
21
|
+
* @param tokenAddr - Address of tokenAddr (underlying)
|
|
22
|
+
* @param amount - Token amount
|
|
23
|
+
* @param from - Tokens will be sent from this address
|
|
24
|
+
* @param onBehalf - For what user we are paying back the debt, defaults to proxy
|
|
25
|
+
*/
|
|
26
|
+
constructor(emodeId, tokenAddr, amount, from, onBehalf = getAddr('Empty')) {
|
|
27
|
+
super('MorphoAaveV3Payback', getAddr('MorphoAaveV3Payback'), ['uint256', 'address', 'uint256', 'address', 'address'], [emodeId, tokenAddr, amount, from, onBehalf]);
|
|
28
|
+
this.mappableArgs = [
|
|
29
|
+
this.args[0],
|
|
30
|
+
this.args[1],
|
|
31
|
+
this.args[2],
|
|
32
|
+
this.args[3],
|
|
33
|
+
this.args[4],
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
getAssetsToApprove() {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
const asset = getAssetInfoByAddress(this.args[1]);
|
|
39
|
+
if (asset.symbol !== 'ETH')
|
|
40
|
+
return [{ asset: this.args[1], owner: this.args[3] }];
|
|
41
|
+
return [];
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Action } from '../../../Action';
|
|
2
|
+
import { EthAddress, uint256 } from '../../../types';
|
|
3
|
+
/**
|
|
4
|
+
* MorphoAaveV3SupplyAction - Supply token to morpho aaveV3
|
|
5
|
+
*
|
|
6
|
+
* @category Morpho
|
|
7
|
+
*/
|
|
8
|
+
export declare class MorphoAaveV3SupplyAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
|
|
11
|
+
* @param tokenAddr - Address of tokenAddr (underlying)
|
|
12
|
+
* @param amount - Token amount
|
|
13
|
+
* @param from - Tokens will be sent from this address
|
|
14
|
+
* @param onBehalf - For what user we are paying back the debt, defaults to proxy
|
|
15
|
+
* @param supplyAsColl Whether to supplyAsCollateral or regular supply
|
|
16
|
+
* @param maxIterations Max number of iterations for p2p matching, 0 will use default num of iterations
|
|
17
|
+
*/
|
|
18
|
+
constructor(emodeId: uint256, tokenAddr: EthAddress, amount: uint256, from: EthAddress, onBehalf?: EthAddress, supplyAsColl?: boolean, maxIterations?: uint256);
|
|
19
|
+
getAssetsToApprove(): Promise<{
|
|
20
|
+
asset: any;
|
|
21
|
+
owner: any;
|
|
22
|
+
}[]>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
* MorphoAaveV3SupplyAction - Supply token to morpho aaveV3
|
|
15
|
+
*
|
|
16
|
+
* @category Morpho
|
|
17
|
+
*/
|
|
18
|
+
export class MorphoAaveV3SupplyAction extends Action {
|
|
19
|
+
/**
|
|
20
|
+
* @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
|
|
21
|
+
* @param tokenAddr - Address of tokenAddr (underlying)
|
|
22
|
+
* @param amount - Token amount
|
|
23
|
+
* @param from - Tokens will be sent from this address
|
|
24
|
+
* @param onBehalf - For what user we are paying back the debt, defaults to proxy
|
|
25
|
+
* @param supplyAsColl Whether to supplyAsCollateral or regular supply
|
|
26
|
+
* @param maxIterations Max number of iterations for p2p matching, 0 will use default num of iterations
|
|
27
|
+
*/
|
|
28
|
+
constructor(emodeId, tokenAddr, amount, from, onBehalf = getAddr('Empty'), supplyAsColl = true, maxIterations = '4') {
|
|
29
|
+
super('MorphoAaveV3Supply', getAddr('MorphoAaveV3Supply'), ['uint256', 'address', 'uint256', 'address', 'address', 'bool', 'uint256'], [emodeId, tokenAddr, amount, from, onBehalf, supplyAsColl, maxIterations]);
|
|
30
|
+
this.mappableArgs = [
|
|
31
|
+
this.args[0],
|
|
32
|
+
this.args[1],
|
|
33
|
+
this.args[2],
|
|
34
|
+
this.args[3],
|
|
35
|
+
this.args[4],
|
|
36
|
+
this.args[5],
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
getAssetsToApprove() {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
const asset = getAssetInfoByAddress(this.args[1]);
|
|
42
|
+
if (asset.symbol !== 'ETH')
|
|
43
|
+
return [{ asset: this.args[1], owner: this.args[3] }];
|
|
44
|
+
return [];
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Action } from '../../../Action';
|
|
2
|
+
import { EthAddress, uint256 } from '../../../types';
|
|
3
|
+
/**
|
|
4
|
+
* MorphoAaveV3WithdrawAction - Withdraw token from Morpho AaveV3
|
|
5
|
+
*
|
|
6
|
+
* @category Morpho
|
|
7
|
+
*/
|
|
8
|
+
export declare class MorphoAaveV3WithdrawAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
|
|
11
|
+
* @param tokenAddr - Address of tokenAddr (underlying)
|
|
12
|
+
* @param amount - Token amount
|
|
13
|
+
* @param to - Tokens will be sent to this address
|
|
14
|
+
* @param onBehalf - For what user we are withdrawing the tokens, defaults to proxy
|
|
15
|
+
* @param withdrawAsColl - If we want to withdraw from collateral or from pure supply
|
|
16
|
+
* @param maxIterations - Max number of iterations for p2p matching, 0 will use default num of iterations
|
|
17
|
+
*/
|
|
18
|
+
constructor(emodeId: uint256, tokenAddr: EthAddress, amount: uint256, to: EthAddress, onBehalf?: EthAddress, withdrawAsColl?: boolean, maxIterations?: uint256);
|
|
19
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Action } from '../../../Action';
|
|
2
|
+
import { getAddr } from '../../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* MorphoAaveV3WithdrawAction - Withdraw token from Morpho AaveV3
|
|
5
|
+
*
|
|
6
|
+
* @category Morpho
|
|
7
|
+
*/
|
|
8
|
+
export class MorphoAaveV3WithdrawAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
|
|
11
|
+
* @param tokenAddr - Address of tokenAddr (underlying)
|
|
12
|
+
* @param amount - Token amount
|
|
13
|
+
* @param to - Tokens will be sent to this address
|
|
14
|
+
* @param onBehalf - For what user we are withdrawing the tokens, defaults to proxy
|
|
15
|
+
* @param withdrawAsColl - If we want to withdraw from collateral or from pure supply
|
|
16
|
+
* @param maxIterations - Max number of iterations for p2p matching, 0 will use default num of iterations
|
|
17
|
+
*/
|
|
18
|
+
constructor(emodeId, tokenAddr, amount, to, onBehalf = getAddr('Empty'), withdrawAsColl = true, maxIterations = '4') {
|
|
19
|
+
super('MorphoAaveV3Withdraw', getAddr('MorphoAaveV3Withdraw'), ['uint256', 'address', 'uint256', 'address', 'address', 'bool', 'uint256'], [emodeId, tokenAddr, amount, to, onBehalf, withdrawAsColl, maxIterations]);
|
|
20
|
+
this.mappableArgs = [
|
|
21
|
+
this.args[0],
|
|
22
|
+
this.args[1],
|
|
23
|
+
this.args[2],
|
|
24
|
+
this.args[3],
|
|
25
|
+
this.args[4],
|
|
26
|
+
this.args[5],
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -3,3 +3,7 @@ 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,3 +3,7 @@ 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,6 +54,10 @@ 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;
|
|
57
61
|
CompBorrow: string;
|
|
58
62
|
CompClaim: string;
|
|
59
63
|
CompPayback: string;
|
|
@@ -206,6 +210,10 @@ export declare const actionAddresses: {
|
|
|
206
210
|
MorphoAaveV2Supply?: undefined;
|
|
207
211
|
MorphoAaveV2Withdraw?: undefined;
|
|
208
212
|
MorphoClaim?: undefined;
|
|
213
|
+
MorphoAaveV3Borrow?: undefined;
|
|
214
|
+
MorphoAaveV3Payback?: undefined;
|
|
215
|
+
MorphoAaveV3Supply?: undefined;
|
|
216
|
+
MorphoAaveV3Withdraw?: undefined;
|
|
209
217
|
CompBorrow?: undefined;
|
|
210
218
|
CompClaim?: undefined;
|
|
211
219
|
CompPayback?: undefined;
|
|
@@ -345,6 +353,10 @@ export declare const actionAddresses: {
|
|
|
345
353
|
MorphoAaveV2Supply?: undefined;
|
|
346
354
|
MorphoAaveV2Withdraw?: undefined;
|
|
347
355
|
MorphoClaim?: undefined;
|
|
356
|
+
MorphoAaveV3Borrow?: undefined;
|
|
357
|
+
MorphoAaveV3Payback?: undefined;
|
|
358
|
+
MorphoAaveV3Supply?: undefined;
|
|
359
|
+
MorphoAaveV3Withdraw?: undefined;
|
|
348
360
|
CompBorrow?: undefined;
|
|
349
361
|
CompClaim?: undefined;
|
|
350
362
|
CompPayback?: undefined;
|
package/esm/src/addresses.js
CHANGED
|
@@ -62,6 +62,11 @@ 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',
|
|
65
70
|
// compound
|
|
66
71
|
CompBorrow: '0x8495579BF6Ae848f7E59686536F834f1d2CCd79C',
|
|
67
72
|
CompClaim: '0x81F488cF7A0128A9DB5e7207042cCAB1CB0ac902',
|
package/esm/src/index.d.ts
CHANGED
|
@@ -65,6 +65,10 @@ 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;
|
|
68
72
|
CompBorrow: string;
|
|
69
73
|
CompClaim: string;
|
|
70
74
|
CompPayback: string;
|
|
@@ -217,6 +221,10 @@ declare const actionAddressesAllChains: {
|
|
|
217
221
|
MorphoAaveV2Supply?: undefined;
|
|
218
222
|
MorphoAaveV2Withdraw?: undefined;
|
|
219
223
|
MorphoClaim?: undefined;
|
|
224
|
+
MorphoAaveV3Borrow?: undefined;
|
|
225
|
+
MorphoAaveV3Payback?: undefined;
|
|
226
|
+
MorphoAaveV3Supply?: undefined;
|
|
227
|
+
MorphoAaveV3Withdraw?: undefined;
|
|
220
228
|
CompBorrow?: undefined;
|
|
221
229
|
CompClaim?: undefined;
|
|
222
230
|
CompPayback?: undefined;
|
|
@@ -356,6 +364,10 @@ declare const actionAddressesAllChains: {
|
|
|
356
364
|
MorphoAaveV2Supply?: undefined;
|
|
357
365
|
MorphoAaveV2Withdraw?: undefined;
|
|
358
366
|
MorphoClaim?: undefined;
|
|
367
|
+
MorphoAaveV3Borrow?: undefined;
|
|
368
|
+
MorphoAaveV3Payback?: undefined;
|
|
369
|
+
MorphoAaveV3Supply?: undefined;
|
|
370
|
+
MorphoAaveV3Withdraw?: undefined;
|
|
359
371
|
CompBorrow?: undefined;
|
|
360
372
|
CompClaim?: undefined;
|
|
361
373
|
CompPayback?: undefined;
|
|
@@ -487,6 +499,10 @@ declare const actionAddresses: (chainId?: null) => {
|
|
|
487
499
|
MorphoAaveV2Supply: string;
|
|
488
500
|
MorphoAaveV2Withdraw: string;
|
|
489
501
|
MorphoClaim: string;
|
|
502
|
+
MorphoAaveV3Borrow: string;
|
|
503
|
+
MorphoAaveV3Payback: string;
|
|
504
|
+
MorphoAaveV3Supply: string;
|
|
505
|
+
MorphoAaveV3Withdraw: string;
|
|
490
506
|
CompBorrow: string;
|
|
491
507
|
CompClaim: string;
|
|
492
508
|
CompPayback: string;
|
|
@@ -639,6 +655,10 @@ declare const actionAddresses: (chainId?: null) => {
|
|
|
639
655
|
MorphoAaveV2Supply?: undefined;
|
|
640
656
|
MorphoAaveV2Withdraw?: undefined;
|
|
641
657
|
MorphoClaim?: undefined;
|
|
658
|
+
MorphoAaveV3Borrow?: undefined;
|
|
659
|
+
MorphoAaveV3Payback?: undefined;
|
|
660
|
+
MorphoAaveV3Supply?: undefined;
|
|
661
|
+
MorphoAaveV3Withdraw?: undefined;
|
|
642
662
|
CompBorrow?: undefined;
|
|
643
663
|
CompClaim?: undefined;
|
|
644
664
|
CompPayback?: undefined;
|
|
@@ -778,6 +798,10 @@ declare const actionAddresses: (chainId?: null) => {
|
|
|
778
798
|
MorphoAaveV2Supply?: undefined;
|
|
779
799
|
MorphoAaveV2Withdraw?: undefined;
|
|
780
800
|
MorphoClaim?: undefined;
|
|
801
|
+
MorphoAaveV3Borrow?: undefined;
|
|
802
|
+
MorphoAaveV3Payback?: undefined;
|
|
803
|
+
MorphoAaveV3Supply?: undefined;
|
|
804
|
+
MorphoAaveV3Withdraw?: undefined;
|
|
781
805
|
CompBorrow?: undefined;
|
|
782
806
|
CompClaim?: undefined;
|
|
783
807
|
CompPayback?: undefined;
|
|
@@ -1006,6 +1030,10 @@ declare const _default: {
|
|
|
1006
1030
|
MorphoAaveV2Supply: string;
|
|
1007
1031
|
MorphoAaveV2Withdraw: string;
|
|
1008
1032
|
MorphoClaim: string;
|
|
1033
|
+
MorphoAaveV3Borrow: string;
|
|
1034
|
+
MorphoAaveV3Payback: string;
|
|
1035
|
+
MorphoAaveV3Supply: string;
|
|
1036
|
+
MorphoAaveV3Withdraw: string;
|
|
1009
1037
|
CompBorrow: string;
|
|
1010
1038
|
CompClaim: string;
|
|
1011
1039
|
CompPayback: string;
|
|
@@ -1158,6 +1186,10 @@ declare const _default: {
|
|
|
1158
1186
|
MorphoAaveV2Supply?: undefined;
|
|
1159
1187
|
MorphoAaveV2Withdraw?: undefined;
|
|
1160
1188
|
MorphoClaim?: undefined;
|
|
1189
|
+
MorphoAaveV3Borrow?: undefined;
|
|
1190
|
+
MorphoAaveV3Payback?: undefined;
|
|
1191
|
+
MorphoAaveV3Supply?: undefined;
|
|
1192
|
+
MorphoAaveV3Withdraw?: undefined;
|
|
1161
1193
|
CompBorrow?: undefined;
|
|
1162
1194
|
CompClaim?: undefined;
|
|
1163
1195
|
CompPayback?: undefined;
|
|
@@ -1297,6 +1329,10 @@ declare const _default: {
|
|
|
1297
1329
|
MorphoAaveV2Supply?: undefined;
|
|
1298
1330
|
MorphoAaveV2Withdraw?: undefined;
|
|
1299
1331
|
MorphoClaim?: undefined;
|
|
1332
|
+
MorphoAaveV3Borrow?: undefined;
|
|
1333
|
+
MorphoAaveV3Payback?: undefined;
|
|
1334
|
+
MorphoAaveV3Supply?: undefined;
|
|
1335
|
+
MorphoAaveV3Withdraw?: undefined;
|
|
1300
1336
|
CompBorrow?: undefined;
|
|
1301
1337
|
CompClaim?: undefined;
|
|
1302
1338
|
CompPayback?: undefined;
|
|
@@ -1428,6 +1464,10 @@ declare const _default: {
|
|
|
1428
1464
|
MorphoAaveV2Supply: string;
|
|
1429
1465
|
MorphoAaveV2Withdraw: string;
|
|
1430
1466
|
MorphoClaim: string;
|
|
1467
|
+
MorphoAaveV3Borrow: string;
|
|
1468
|
+
MorphoAaveV3Payback: string;
|
|
1469
|
+
MorphoAaveV3Supply: string;
|
|
1470
|
+
MorphoAaveV3Withdraw: string;
|
|
1431
1471
|
CompBorrow: string;
|
|
1432
1472
|
CompClaim: string;
|
|
1433
1473
|
CompPayback: string;
|
|
@@ -1580,6 +1620,10 @@ declare const _default: {
|
|
|
1580
1620
|
MorphoAaveV2Supply?: undefined;
|
|
1581
1621
|
MorphoAaveV2Withdraw?: undefined;
|
|
1582
1622
|
MorphoClaim?: undefined;
|
|
1623
|
+
MorphoAaveV3Borrow?: undefined;
|
|
1624
|
+
MorphoAaveV3Payback?: undefined;
|
|
1625
|
+
MorphoAaveV3Supply?: undefined;
|
|
1626
|
+
MorphoAaveV3Withdraw?: undefined;
|
|
1583
1627
|
CompBorrow?: undefined;
|
|
1584
1628
|
CompClaim?: undefined;
|
|
1585
1629
|
CompPayback?: undefined;
|
|
@@ -1719,6 +1763,10 @@ declare const _default: {
|
|
|
1719
1763
|
MorphoAaveV2Supply?: undefined;
|
|
1720
1764
|
MorphoAaveV2Withdraw?: undefined;
|
|
1721
1765
|
MorphoClaim?: undefined;
|
|
1766
|
+
MorphoAaveV3Borrow?: undefined;
|
|
1767
|
+
MorphoAaveV3Payback?: undefined;
|
|
1768
|
+
MorphoAaveV3Supply?: undefined;
|
|
1769
|
+
MorphoAaveV3Withdraw?: undefined;
|
|
1722
1770
|
CompBorrow?: undefined;
|
|
1723
1771
|
CompClaim?: undefined;
|
|
1724
1772
|
CompPayback?: undefined;
|
package/package.json
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Action } from '../../../Action';
|
|
2
|
+
import { getAddr } from '../../../addresses';
|
|
3
|
+
import { EthAddress, uint256 } from '../../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* MorphoAaveV3BorrowAction - Borrow token from Morpho AaveV3
|
|
7
|
+
*
|
|
8
|
+
* @category Morpho
|
|
9
|
+
*/
|
|
10
|
+
export class MorphoAaveV3BorrowAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
|
|
13
|
+
* @param tokenAddr - Address of tokenAddr (underlying)
|
|
14
|
+
* @param amount - Token amount
|
|
15
|
+
* @param to - The address we are sending the borrowed tokens to
|
|
16
|
+
* @param onBehalf - For what user we are borrowing the tokens, defaults to proxy
|
|
17
|
+
* @param maxIterations - Max number of iterations for p2p matching, 0 will use default num of iterations
|
|
18
|
+
*/
|
|
19
|
+
constructor(
|
|
20
|
+
emodeId: uint256,
|
|
21
|
+
tokenAddr: EthAddress,
|
|
22
|
+
amount: uint256,
|
|
23
|
+
to: EthAddress,
|
|
24
|
+
onBehalf: EthAddress = getAddr('Empty'),
|
|
25
|
+
maxIterations: uint256 = '4',
|
|
26
|
+
) {
|
|
27
|
+
super(
|
|
28
|
+
'MorphoAaveV3Borrow',
|
|
29
|
+
getAddr('MorphoAaveV3Borrow'),
|
|
30
|
+
['uint256', 'address', 'uint256', 'address', 'address', 'uint256'],
|
|
31
|
+
[emodeId, tokenAddr, amount, to, onBehalf, maxIterations],
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
this.mappableArgs = [
|
|
35
|
+
this.args[0],
|
|
36
|
+
this.args[1],
|
|
37
|
+
this.args[2],
|
|
38
|
+
this.args[3],
|
|
39
|
+
this.args[4],
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { getAssetInfoByAddress } from '@defisaver/tokens';
|
|
2
|
+
import { Action } from '../../../Action';
|
|
3
|
+
import { getAddr } from '../../../addresses';
|
|
4
|
+
import { EthAddress, uint256 } from '../../../types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* MorphoAaveV3PaybackAction - Payback token to Morpho AaveV3
|
|
8
|
+
*
|
|
9
|
+
* @category Morpho
|
|
10
|
+
*/
|
|
11
|
+
export class MorphoAaveV3PaybackAction extends Action {
|
|
12
|
+
/**
|
|
13
|
+
* @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
|
|
14
|
+
* @param tokenAddr - Address of tokenAddr (underlying)
|
|
15
|
+
* @param amount - Token amount
|
|
16
|
+
* @param from - Tokens will be sent from this address
|
|
17
|
+
* @param onBehalf - For what user we are paying back the debt, defaults to proxy
|
|
18
|
+
*/
|
|
19
|
+
constructor(
|
|
20
|
+
emodeId: uint256,
|
|
21
|
+
tokenAddr: EthAddress,
|
|
22
|
+
amount: uint256,
|
|
23
|
+
from: EthAddress,
|
|
24
|
+
onBehalf: EthAddress = getAddr('Empty'),
|
|
25
|
+
) {
|
|
26
|
+
super(
|
|
27
|
+
'MorphoAaveV3Payback',
|
|
28
|
+
getAddr('MorphoAaveV3Payback'),
|
|
29
|
+
['uint256', 'address', 'uint256', 'address', 'address'],
|
|
30
|
+
[emodeId, tokenAddr, amount, from, onBehalf],
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
this.mappableArgs = [
|
|
34
|
+
this.args[0],
|
|
35
|
+
this.args[1],
|
|
36
|
+
this.args[2],
|
|
37
|
+
this.args[3],
|
|
38
|
+
this.args[4],
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async getAssetsToApprove() {
|
|
43
|
+
const asset = getAssetInfoByAddress(this.args[1]);
|
|
44
|
+
if (asset.symbol !== 'ETH') return [{ asset: this.args[1], owner: this.args[3] }];
|
|
45
|
+
return [];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { getAssetInfoByAddress } from '@defisaver/tokens';
|
|
2
|
+
import { Action } from '../../../Action';
|
|
3
|
+
import { getAddr } from '../../../addresses';
|
|
4
|
+
import { EthAddress, uint256 } from '../../../types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* MorphoAaveV3SupplyAction - Supply token to morpho aaveV3
|
|
8
|
+
*
|
|
9
|
+
* @category Morpho
|
|
10
|
+
*/
|
|
11
|
+
export class MorphoAaveV3SupplyAction extends Action {
|
|
12
|
+
/**
|
|
13
|
+
* @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
|
|
14
|
+
* @param tokenAddr - Address of tokenAddr (underlying)
|
|
15
|
+
* @param amount - Token amount
|
|
16
|
+
* @param from - Tokens will be sent from this address
|
|
17
|
+
* @param onBehalf - For what user we are paying back the debt, defaults to proxy
|
|
18
|
+
* @param supplyAsColl Whether to supplyAsCollateral or regular supply
|
|
19
|
+
* @param maxIterations Max number of iterations for p2p matching, 0 will use default num of iterations
|
|
20
|
+
*/
|
|
21
|
+
constructor(
|
|
22
|
+
emodeId:uint256,
|
|
23
|
+
tokenAddr:EthAddress,
|
|
24
|
+
amount:uint256,
|
|
25
|
+
from:EthAddress,
|
|
26
|
+
onBehalf:EthAddress = getAddr('Empty'),
|
|
27
|
+
supplyAsColl:boolean = true,
|
|
28
|
+
maxIterations:uint256 = '4',
|
|
29
|
+
) {
|
|
30
|
+
super(
|
|
31
|
+
'MorphoAaveV3Supply',
|
|
32
|
+
getAddr('MorphoAaveV3Supply'),
|
|
33
|
+
['uint256', 'address', 'uint256', 'address', 'address', 'bool', 'uint256'],
|
|
34
|
+
[emodeId, tokenAddr, amount, from, onBehalf, supplyAsColl, maxIterations],
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
this.mappableArgs = [
|
|
38
|
+
this.args[0],
|
|
39
|
+
this.args[1],
|
|
40
|
+
this.args[2],
|
|
41
|
+
this.args[3],
|
|
42
|
+
this.args[4],
|
|
43
|
+
this.args[5],
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async getAssetsToApprove() {
|
|
48
|
+
const asset = getAssetInfoByAddress(this.args[1]);
|
|
49
|
+
if (asset.symbol !== 'ETH') return [{ asset: this.args[1], owner: this.args[3] }];
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Action } from '../../../Action';
|
|
2
|
+
import { getAddr } from '../../../addresses';
|
|
3
|
+
import { EthAddress, uint256 } from '../../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* MorphoAaveV3WithdrawAction - Withdraw token from Morpho AaveV3
|
|
7
|
+
*
|
|
8
|
+
* @category Morpho
|
|
9
|
+
*/
|
|
10
|
+
export class MorphoAaveV3WithdrawAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
|
|
13
|
+
* @param tokenAddr - Address of tokenAddr (underlying)
|
|
14
|
+
* @param amount - Token amount
|
|
15
|
+
* @param to - Tokens will be sent to this address
|
|
16
|
+
* @param onBehalf - For what user we are withdrawing the tokens, defaults to proxy
|
|
17
|
+
* @param withdrawAsColl - If we want to withdraw from collateral or from pure supply
|
|
18
|
+
* @param maxIterations - Max number of iterations for p2p matching, 0 will use default num of iterations
|
|
19
|
+
*/
|
|
20
|
+
constructor(
|
|
21
|
+
emodeId: uint256,
|
|
22
|
+
tokenAddr: EthAddress,
|
|
23
|
+
amount: uint256,
|
|
24
|
+
to: EthAddress,
|
|
25
|
+
onBehalf: EthAddress = getAddr('Empty'),
|
|
26
|
+
withdrawAsColl: boolean = true,
|
|
27
|
+
maxIterations: uint256 = '4',
|
|
28
|
+
) {
|
|
29
|
+
super(
|
|
30
|
+
'MorphoAaveV3Withdraw',
|
|
31
|
+
getAddr('MorphoAaveV3Withdraw'),
|
|
32
|
+
['uint256', 'address', 'uint256', 'address', 'address', 'bool', 'uint256'],
|
|
33
|
+
[emodeId, tokenAddr, amount, to, onBehalf, withdrawAsColl, maxIterations],
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
this.mappableArgs = [
|
|
37
|
+
this.args[0],
|
|
38
|
+
this.args[1],
|
|
39
|
+
this.args[2],
|
|
40
|
+
this.args[3],
|
|
41
|
+
this.args[4],
|
|
42
|
+
this.args[5],
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -3,3 +3,7 @@ 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/src/addresses.ts
CHANGED
|
@@ -71,6 +71,12 @@ export const actionAddresses = {
|
|
|
71
71
|
MorphoAaveV2Withdraw: '0x29a8b5a8889f465c85b778edccf984e44ad70f12',
|
|
72
72
|
MorphoClaim: '0xa269C841E26EA8Ee1F0350a2E5905F71446998dC',
|
|
73
73
|
|
|
74
|
+
// morpho aave v3
|
|
75
|
+
MorphoAaveV3Borrow: '0x487719C57b88477F19423aB0652b3E26b96baA7F',
|
|
76
|
+
MorphoAaveV3Payback: '0x36b8b968c81D97cBfAa642e206b634A6f378d287',
|
|
77
|
+
MorphoAaveV3Supply: '0x51fA8FBc6F0aDEfe2FBA06104FCA39f5beD69291',
|
|
78
|
+
MorphoAaveV3Withdraw: '0xdc3e74C4cD577275296ceFE36A3D082223AfF206',
|
|
79
|
+
|
|
74
80
|
// compound
|
|
75
81
|
CompBorrow: '0x8495579BF6Ae848f7E59686536F834f1d2CCd79C',
|
|
76
82
|
CompClaim: '0x81F488cF7A0128A9DB5e7207042cCAB1CB0ac902',
|