@defisaver/sdk 1.0.62 → 1.0.63-dev-1
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/Action.d.ts +2 -2
- package/esm/src/actions/basic/ExecuteSafeTxAction.d.ts +23 -0
- package/esm/src/actions/basic/ExecuteSafeTxAction.js +60 -0
- package/esm/src/actions/basic/LimitSellAction.d.ts +24 -0
- package/esm/src/actions/basic/LimitSellAction.js +63 -0
- package/esm/src/actions/basic/RemoveTokenApprovalAction.d.ts +15 -0
- package/esm/src/actions/basic/RemoveTokenApprovalAction.js +42 -0
- package/esm/src/actions/basic/index.d.ts +3 -0
- package/esm/src/actions/basic/index.js +3 -0
- package/esm/src/actions/flashloan/FLAction.js +3 -0
- package/esm/src/actions/flashloan/MorphoBlueFlashLoanAction.d.ts +16 -0
- package/esm/src/actions/flashloan/MorphoBlueFlashLoanAction.js +18 -0
- package/esm/src/actions/flashloan/MorphoBlueFlashLoanPaybackAction.d.ts +14 -0
- package/esm/src/actions/flashloan/MorphoBlueFlashLoanPaybackAction.js +16 -0
- package/esm/src/actions/flashloan/index.d.ts +2 -0
- package/esm/src/actions/flashloan/index.js +2 -0
- package/esm/src/actions/index.d.ts +2 -1
- package/esm/src/actions/index.js +2 -1
- package/esm/src/actions/maker/MakerGiveAction.d.ts +1 -2
- package/esm/src/actions/maker/MakerGiveAction.js +2 -3
- package/esm/src/actions/morpho-blue/MorphoBlueBorrowAction.d.ts +21 -0
- package/esm/src/actions/morpho-blue/MorphoBlueBorrowAction.js +46 -0
- package/esm/src/actions/morpho-blue/MorphoBluePaybackAction.d.ts +24 -0
- package/esm/src/actions/morpho-blue/MorphoBluePaybackAction.js +46 -0
- package/esm/src/actions/morpho-blue/MorphoBlueSetAuthAction.d.ts +12 -0
- package/esm/src/actions/morpho-blue/MorphoBlueSetAuthAction.js +18 -0
- package/esm/src/actions/morpho-blue/MorphoBlueSetAuthWithSigAction.d.ts +12 -0
- package/esm/src/actions/morpho-blue/MorphoBlueSetAuthWithSigAction.js +21 -0
- package/esm/src/actions/morpho-blue/MorphoBlueSupplyAction.d.ts +24 -0
- package/esm/src/actions/morpho-blue/MorphoBlueSupplyAction.js +46 -0
- package/esm/src/actions/morpho-blue/MorphoBlueSupplyCollateralAction.d.ts +24 -0
- package/esm/src/actions/morpho-blue/MorphoBlueSupplyCollateralAction.js +46 -0
- package/esm/src/actions/morpho-blue/MorphoBlueWithdrawAction.d.ts +21 -0
- package/esm/src/actions/morpho-blue/MorphoBlueWithdrawAction.js +46 -0
- package/esm/src/actions/morpho-blue/MorphoBlueWithdrawCollateralAction.d.ts +21 -0
- package/esm/src/actions/morpho-blue/MorphoBlueWithdrawCollateralAction.js +46 -0
- package/esm/src/actions/morpho-blue/index.d.ts +8 -0
- package/esm/src/actions/morpho-blue/index.js +8 -0
- package/esm/src/addresses.d.ts +36 -0
- package/esm/src/addresses.js +12 -3
- package/esm/src/index.d.ts +144 -0
- package/esm/src/triggers/OffchainPriceTrigger.d.ts +10 -0
- package/esm/src/triggers/OffchainPriceTrigger.js +12 -0
- package/esm/src/triggers/index.d.ts +1 -0
- package/esm/src/triggers/index.js +1 -0
- package/esm/src/types.d.ts +20 -20
- package/package.json +1 -1
- package/src/actions/basic/ExecuteSafeTxAction.ts +85 -0
- package/src/actions/basic/LimitSellAction.ts +63 -0
- package/src/actions/basic/RemoveTokenApprovalAction.ts +39 -0
- package/src/actions/basic/index.ts +3 -0
- package/src/actions/flashloan/FLAction.ts +3 -0
- package/src/actions/flashloan/MorphoBlueFlashLoanAction.ts +25 -0
- package/src/actions/flashloan/MorphoBlueFlashLoanPaybackAction.ts +18 -0
- package/src/actions/flashloan/index.ts +3 -1
- package/src/actions/index.ts +2 -0
- package/src/actions/maker/MakerGiveAction.ts +2 -3
- package/src/actions/morpho-blue/MorphoBlueBorrowAction.ts +54 -0
- package/src/actions/morpho-blue/MorphoBluePaybackAction.ts +54 -0
- package/src/actions/morpho-blue/MorphoBlueSetAuthAction.ts +25 -0
- package/src/actions/morpho-blue/MorphoBlueSetAuthWithSigAction.ts +39 -0
- package/src/actions/morpho-blue/MorphoBlueSupplyAction.ts +54 -0
- package/src/actions/morpho-blue/MorphoBlueSupplyCollateralAction.ts +54 -0
- package/src/actions/morpho-blue/MorphoBlueWithdrawAction.ts +54 -0
- package/src/actions/morpho-blue/MorphoBlueWithdrawCollateralAction.ts +54 -0
- package/src/actions/morpho-blue/index.ts +8 -0
- package/src/addresses.ts +13 -3
- package/src/triggers/OffchainPriceTrigger.ts +14 -0
- package/src/triggers/index.ts +2 -0
- package/umd/index.js +1703 -1086
- package/yarn-error.log +0 -3976
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, uint256, bytes } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Gets a flashloan from MorphoBlue
|
|
7
|
+
*
|
|
8
|
+
* @category Flashloans
|
|
9
|
+
*/
|
|
10
|
+
export class MorphoBlueFlashLoanAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param token
|
|
13
|
+
* @param amount
|
|
14
|
+
* @param flParamGetterAddr
|
|
15
|
+
* @param flParamGetterData
|
|
16
|
+
*/
|
|
17
|
+
constructor(token:EthAddress, amount:uint256, flParamGetterAddr:EthAddress = getAddr('Empty'), flParamGetterData:bytes = []) {
|
|
18
|
+
super(
|
|
19
|
+
'FLMorphoBlue',
|
|
20
|
+
getAddr('FLMorphoBlue'),
|
|
21
|
+
['address[]', 'uint256[]', 'uint256[]', 'address', 'address', 'bytes', 'bytes'],
|
|
22
|
+
[[token], [amount], [], getAddr('Empty'), flParamGetterAddr, flParamGetterData, []],
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SendTokenAction } from '../basic';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, uint256 } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Pays back a flashloan from MorphoBlue
|
|
7
|
+
*
|
|
8
|
+
* @category Flashloans
|
|
9
|
+
*/
|
|
10
|
+
export class MorphoBlueFlashLoanPaybackAction extends SendTokenAction {
|
|
11
|
+
/**
|
|
12
|
+
* @param loanAmount
|
|
13
|
+
* @param tokenAddr
|
|
14
|
+
*/
|
|
15
|
+
constructor(loanAmount: uint256, tokenAddr: EthAddress) {
|
|
16
|
+
super(tokenAddr, getAddr('FLMorphoBlue'), loanAmount);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -19,4 +19,6 @@ export * from './FLAction';
|
|
|
19
19
|
export * from './UniV3FlashLoanAction';
|
|
20
20
|
export * from './UniV3FlashLoanPaybackAction';
|
|
21
21
|
export * from './GhoFlashLoanAction';
|
|
22
|
-
export * from './GhoFlashLoanPaybackAction';
|
|
22
|
+
export * from './GhoFlashLoanPaybackAction';
|
|
23
|
+
export * from './MorphoBlueFlashLoanAction';
|
|
24
|
+
export * from './MorphoBlueFlashLoanPaybackAction';
|
package/src/actions/index.ts
CHANGED
|
@@ -26,6 +26,7 @@ import * as bprotocol from './bprotocol';
|
|
|
26
26
|
import * as lsv from './lsv';
|
|
27
27
|
import * as curveusd from './curveusd';
|
|
28
28
|
import * as spark from './spark';
|
|
29
|
+
import * as morphoblue from './morpho-blue';
|
|
29
30
|
|
|
30
31
|
export {
|
|
31
32
|
aave,
|
|
@@ -56,4 +57,5 @@ export {
|
|
|
56
57
|
lsv,
|
|
57
58
|
spark,
|
|
58
59
|
curveusd,
|
|
60
|
+
morphoblue,
|
|
59
61
|
};
|
|
@@ -12,12 +12,11 @@ export class MakerGiveAction extends Action {
|
|
|
12
12
|
/**
|
|
13
13
|
* @param vaultId
|
|
14
14
|
* @param newOwner
|
|
15
|
-
* @param createProxy
|
|
16
15
|
* @param mcdManager
|
|
17
16
|
*/
|
|
18
|
-
constructor(vaultId:uint256, newOwner:EthAddress,
|
|
17
|
+
constructor(vaultId:uint256, newOwner:EthAddress, mcdManager:EthAddress = getAddr('McdCdpManager')) {
|
|
19
18
|
requireAddress(newOwner);
|
|
20
|
-
super('McdGive', getAddr('McdGive'), ['uint256', 'address', '
|
|
19
|
+
super('McdGive', getAddr('McdGive'), ['uint256', 'address', 'address'], [vaultId, newOwner, mcdManager]);
|
|
21
20
|
|
|
22
21
|
this.mappableArgs = [
|
|
23
22
|
this.args[0],
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
* MorphoBlueBorrowAction - Borrow a token from MorphoBlue
|
|
8
|
+
*
|
|
9
|
+
* @category MorphoBlue
|
|
10
|
+
*/
|
|
11
|
+
export class MorphoBlueBorrowAction extends Action {
|
|
12
|
+
/**
|
|
13
|
+
* @param loanToken - MarketParams loanToken
|
|
14
|
+
* @param collateralToken - MarketParams collateralToken
|
|
15
|
+
* @param oracle - MarketParams oracle
|
|
16
|
+
* @param irm - MarketParams irm
|
|
17
|
+
* @param lltv - MarketParams lltv
|
|
18
|
+
* @param borrowAmount - amount of loanToken to borrow
|
|
19
|
+
* @param onBehalf - onBehalf of whom to borrow
|
|
20
|
+
* @param to - address to receive borrowed tokens
|
|
21
|
+
*/
|
|
22
|
+
constructor(
|
|
23
|
+
loanToken:EthAddress,
|
|
24
|
+
collateralToken:EthAddress,
|
|
25
|
+
oracle:EthAddress,
|
|
26
|
+
irm:EthAddress,
|
|
27
|
+
lltv:uint256,
|
|
28
|
+
borrowAmount:uint256,
|
|
29
|
+
onBehalf:EthAddress,
|
|
30
|
+
to:EthAddress,
|
|
31
|
+
) {
|
|
32
|
+
super(
|
|
33
|
+
'MorphoBlueBorrow',
|
|
34
|
+
getAddr('MorphoBlueBorrow'),
|
|
35
|
+
[['address', 'address', 'address', 'address', 'uint256'], 'uint256', 'address', 'address'],
|
|
36
|
+
[[loanToken, collateralToken, oracle, irm, lltv], borrowAmount, onBehalf, to],
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
this.mappableArgs = [
|
|
40
|
+
this.args[0][0],
|
|
41
|
+
this.args[0][1],
|
|
42
|
+
this.args[0][2],
|
|
43
|
+
this.args[0][3],
|
|
44
|
+
this.args[0][4],
|
|
45
|
+
this.args[1],
|
|
46
|
+
this.args[2],
|
|
47
|
+
this.args[3],
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async getAssetsToApprove() {
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
* MorphoBluePaybackAction - Payback debt on MorphoBlue
|
|
8
|
+
*
|
|
9
|
+
* @category MorphoBlue
|
|
10
|
+
*/
|
|
11
|
+
export class MorphoBluePaybackAction extends Action {
|
|
12
|
+
/**
|
|
13
|
+
* @param loanToken - MarketParams loanToken
|
|
14
|
+
* @param collateralToken - MarketParams collateralToken
|
|
15
|
+
* @param oracle - MarketParams oracle
|
|
16
|
+
* @param irm - MarketParams irm
|
|
17
|
+
* @param lltv - MarketParams lltv
|
|
18
|
+
* @param paybackAmount - Amount of debt to repay (uint.max for full debt repayment)
|
|
19
|
+
* @param from - Address from which to pull tokens with which to repay debt
|
|
20
|
+
* @param onBehalf - Position owner whose debt we are paying back
|
|
21
|
+
*/
|
|
22
|
+
constructor(
|
|
23
|
+
loanToken:EthAddress,
|
|
24
|
+
collateralToken:EthAddress,
|
|
25
|
+
oracle:EthAddress,
|
|
26
|
+
irm:EthAddress,
|
|
27
|
+
lltv:uint256,
|
|
28
|
+
paybackAmount:uint256,
|
|
29
|
+
from:EthAddress,
|
|
30
|
+
onBehalf:EthAddress,
|
|
31
|
+
) {
|
|
32
|
+
super(
|
|
33
|
+
'MorphoBluePayback',
|
|
34
|
+
getAddr('MorphoBluePayback'),
|
|
35
|
+
[['address', 'address', 'address', 'address', 'uint256'], 'uint256', 'address', 'address'],
|
|
36
|
+
[[loanToken, collateralToken, oracle, irm, lltv], paybackAmount, from, onBehalf],
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
this.mappableArgs = [
|
|
40
|
+
this.args[0][0],
|
|
41
|
+
this.args[0][1],
|
|
42
|
+
this.args[0][2],
|
|
43
|
+
this.args[0][3],
|
|
44
|
+
this.args[0][4],
|
|
45
|
+
this.args[1],
|
|
46
|
+
this.args[2],
|
|
47
|
+
this.args[3],
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async getAssetsToApprove() {
|
|
52
|
+
return [{ asset: this.args[0][0], owner: this.args[2] }];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, uint256 } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @category MorphoBlue
|
|
7
|
+
*/
|
|
8
|
+
export class MorphoBlueSetAuthAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param manager
|
|
11
|
+
* @param newIsAuthorized
|
|
12
|
+
*/
|
|
13
|
+
constructor(manager:EthAddress, newIsAuthorized:boolean) {
|
|
14
|
+
super(
|
|
15
|
+
'MorphoBlueSetAuth',
|
|
16
|
+
getAddr('MorphoBlueSetAuth'),
|
|
17
|
+
[
|
|
18
|
+
'address',
|
|
19
|
+
'bool',
|
|
20
|
+
],
|
|
21
|
+
[manager, newIsAuthorized],
|
|
22
|
+
);
|
|
23
|
+
this.mappableArgs = [this.args[0], this.args[1]];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import {
|
|
4
|
+
EthAddress, bytes32, uint256, uint8,
|
|
5
|
+
} from '../../types';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @category MorphoBlue
|
|
9
|
+
*/
|
|
10
|
+
export class MorphoBlueSetAuthWithSigAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param manager
|
|
13
|
+
* @param newIsAuthorized
|
|
14
|
+
*/
|
|
15
|
+
constructor(
|
|
16
|
+
authorizer:EthAddress,
|
|
17
|
+
authorized:EthAddress,
|
|
18
|
+
isAuthorized:boolean,
|
|
19
|
+
nonce:uint256,
|
|
20
|
+
deadline:uint256,
|
|
21
|
+
v:uint8,
|
|
22
|
+
r:bytes32,
|
|
23
|
+
s:bytes32,
|
|
24
|
+
) {
|
|
25
|
+
super(
|
|
26
|
+
'MorphoBlueSetAuthWithSig',
|
|
27
|
+
getAddr('MorphoBlueSetAuthWithSig'),
|
|
28
|
+
[
|
|
29
|
+
['address', 'address', 'bool', 'uint256', 'uint256'],
|
|
30
|
+
['uint8', 'bytes32', 'bytes32'],
|
|
31
|
+
],
|
|
32
|
+
[
|
|
33
|
+
[authorizer, authorized, isAuthorized, nonce, deadline],
|
|
34
|
+
[v, r, s],
|
|
35
|
+
],
|
|
36
|
+
);
|
|
37
|
+
this.mappableArgs = [];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
* MorphoBlueSupplyAction - Supply token as a lender on MorphoBlue to earn interest
|
|
8
|
+
*
|
|
9
|
+
* @category MorphoBlue
|
|
10
|
+
*/
|
|
11
|
+
export class MorphoBlueSupplyAction extends Action {
|
|
12
|
+
/**
|
|
13
|
+
* @param loanToken - MarketParams loanToken
|
|
14
|
+
* @param collateralToken - MarketParams collateralToken
|
|
15
|
+
* @param oracle - MarketParams oracle
|
|
16
|
+
* @param irm - MarketParams irm
|
|
17
|
+
* @param lltv - MarketParams lltv
|
|
18
|
+
* @param supplyAmount - Amount of loanToken to supply
|
|
19
|
+
* @param from - Address from which to pull tokens
|
|
20
|
+
* @param onBehalf - on whose behalf to supply the tokens
|
|
21
|
+
*/
|
|
22
|
+
constructor(
|
|
23
|
+
loanToken:EthAddress,
|
|
24
|
+
collateralToken:EthAddress,
|
|
25
|
+
oracle:EthAddress,
|
|
26
|
+
irm:EthAddress,
|
|
27
|
+
lltv:uint256,
|
|
28
|
+
supplyAmount:uint256,
|
|
29
|
+
from:EthAddress,
|
|
30
|
+
onBehalf:EthAddress,
|
|
31
|
+
) {
|
|
32
|
+
super(
|
|
33
|
+
'MorphoBlueSupply',
|
|
34
|
+
getAddr('MorphoBlueSupply'),
|
|
35
|
+
[['address', 'address', 'address', 'address', 'uint256'], 'uint256', 'address', 'address'],
|
|
36
|
+
[[loanToken, collateralToken, oracle, irm, lltv], supplyAmount, from, onBehalf],
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
this.mappableArgs = [
|
|
40
|
+
this.args[0][0],
|
|
41
|
+
this.args[0][1],
|
|
42
|
+
this.args[0][2],
|
|
43
|
+
this.args[0][3],
|
|
44
|
+
this.args[0][4],
|
|
45
|
+
this.args[1],
|
|
46
|
+
this.args[2],
|
|
47
|
+
this.args[3],
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async getAssetsToApprove() {
|
|
52
|
+
return [{ asset: this.args[0][0], owner: this.args[2] }];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
* MorphoBlueSupplyCollateralAction - Supply token to use as collateral on MorphoBlue
|
|
8
|
+
*
|
|
9
|
+
* @category MorphoBlue
|
|
10
|
+
*/
|
|
11
|
+
export class MorphoBlueSupplyCollateralAction extends Action {
|
|
12
|
+
/**
|
|
13
|
+
* @param loanToken - MarketParams loanToken
|
|
14
|
+
* @param collateralToken - MarketParams collateralToken
|
|
15
|
+
* @param oracle - MarketParams oracle
|
|
16
|
+
* @param irm - MarketParams irm
|
|
17
|
+
* @param lltv - MarketParams lltv
|
|
18
|
+
* @param supplyAmount - Amount of collateral token to supply
|
|
19
|
+
* @param from - Address from which to pull tokens
|
|
20
|
+
* @param onBehalf - On whose behalf to supply tokens as collateral
|
|
21
|
+
*/
|
|
22
|
+
constructor(
|
|
23
|
+
loanToken:EthAddress,
|
|
24
|
+
collateralToken:EthAddress,
|
|
25
|
+
oracle:EthAddress,
|
|
26
|
+
irm:EthAddress,
|
|
27
|
+
lltv:uint256,
|
|
28
|
+
supplyAmount:uint256,
|
|
29
|
+
from:EthAddress,
|
|
30
|
+
onBehalf:EthAddress,
|
|
31
|
+
) {
|
|
32
|
+
super(
|
|
33
|
+
'MorphoBlueSupplyCollateral',
|
|
34
|
+
getAddr('MorphoBlueSupplyCollateral'),
|
|
35
|
+
[['address', 'address', 'address', 'address', 'uint256'], 'uint256', 'address', 'address'],
|
|
36
|
+
[[loanToken, collateralToken, oracle, irm, lltv], supplyAmount, from, onBehalf],
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
this.mappableArgs = [
|
|
40
|
+
this.args[0][0],
|
|
41
|
+
this.args[0][1],
|
|
42
|
+
this.args[0][2],
|
|
43
|
+
this.args[0][3],
|
|
44
|
+
this.args[0][4],
|
|
45
|
+
this.args[1],
|
|
46
|
+
this.args[2],
|
|
47
|
+
this.args[3],
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async getAssetsToApprove() {
|
|
52
|
+
return [{ asset: this.args[0][1], owner: this.args[2] }];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
* MorphoBlueWithdrawAction - Withdraw interest earning tokens from MorphoBlue
|
|
8
|
+
*
|
|
9
|
+
* @category MorphoBlue
|
|
10
|
+
*/
|
|
11
|
+
export class MorphoBlueWithdrawAction extends Action {
|
|
12
|
+
/**
|
|
13
|
+
* @param loanToken - MarketParams loanToken
|
|
14
|
+
* @param collateralToken - MarketParams collateralToken
|
|
15
|
+
* @param oracle - MarketParams oracle
|
|
16
|
+
* @param irm - MarketParams irm
|
|
17
|
+
* @param lltv - MarketParams lltv
|
|
18
|
+
* @param withdrawAmount - Amount of tokens to withdraw (uint.max for full withdrawal)
|
|
19
|
+
* @param onBehalf - From whose position should we withdraw tokens
|
|
20
|
+
* @param to - address which will receive withdrawn tokens
|
|
21
|
+
*/
|
|
22
|
+
constructor(
|
|
23
|
+
loanToken:EthAddress,
|
|
24
|
+
collateralToken:EthAddress,
|
|
25
|
+
oracle:EthAddress,
|
|
26
|
+
irm:EthAddress,
|
|
27
|
+
lltv:uint256,
|
|
28
|
+
withdrawAmount:uint256,
|
|
29
|
+
onBehalf:EthAddress,
|
|
30
|
+
to:EthAddress,
|
|
31
|
+
) {
|
|
32
|
+
super(
|
|
33
|
+
'MorphoBlueWithdraw',
|
|
34
|
+
getAddr('MorphoBlueWithdraw'),
|
|
35
|
+
[['address', 'address', 'address', 'address', 'uint256'], 'uint256', 'address', 'address'],
|
|
36
|
+
[[loanToken, collateralToken, oracle, irm, lltv], withdrawAmount, onBehalf, to],
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
this.mappableArgs = [
|
|
40
|
+
this.args[0][0],
|
|
41
|
+
this.args[0][1],
|
|
42
|
+
this.args[0][2],
|
|
43
|
+
this.args[0][3],
|
|
44
|
+
this.args[0][4],
|
|
45
|
+
this.args[1],
|
|
46
|
+
this.args[2],
|
|
47
|
+
this.args[3],
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async getAssetsToApprove() {
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
* MorphoBlueWithdrawCollateralAction - Withdraw tokens that are used as collateral on MorphoBlue
|
|
8
|
+
*
|
|
9
|
+
* @category MorphoBlue
|
|
10
|
+
*/
|
|
11
|
+
export class MorphoBlueWithdrawCollateralAction extends Action {
|
|
12
|
+
/**
|
|
13
|
+
* @param loanToken - MarketParams loanToken
|
|
14
|
+
* @param collateralToken - MarketParams collateralToken
|
|
15
|
+
* @param oracle - MarketParams oracle
|
|
16
|
+
* @param irm - MarketParams irm
|
|
17
|
+
* @param lltv - MarketParams lltv
|
|
18
|
+
* @param withdrawAmount - Amount of tokens to withdraw
|
|
19
|
+
* @param onBehalf - From whose position should we withdraw tokens
|
|
20
|
+
* @param to - address which will receive withdrawn tokens
|
|
21
|
+
*/
|
|
22
|
+
constructor(
|
|
23
|
+
loanToken:EthAddress,
|
|
24
|
+
collateralToken:EthAddress,
|
|
25
|
+
oracle:EthAddress,
|
|
26
|
+
irm:EthAddress,
|
|
27
|
+
lltv:uint256,
|
|
28
|
+
withdrawAmount:uint256,
|
|
29
|
+
onBehalf:EthAddress,
|
|
30
|
+
to:EthAddress,
|
|
31
|
+
) {
|
|
32
|
+
super(
|
|
33
|
+
'MorphoBlueWithdrawCollateral',
|
|
34
|
+
getAddr('MorphoBlueWithdrawCollateral'),
|
|
35
|
+
[['address', 'address', 'address', 'address', 'uint256'], 'uint256', 'address', 'address'],
|
|
36
|
+
[[loanToken, collateralToken, oracle, irm, lltv], withdrawAmount, onBehalf, to],
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
this.mappableArgs = [
|
|
40
|
+
this.args[0][0],
|
|
41
|
+
this.args[0][1],
|
|
42
|
+
this.args[0][2],
|
|
43
|
+
this.args[0][3],
|
|
44
|
+
this.args[0][4],
|
|
45
|
+
this.args[1],
|
|
46
|
+
this.args[2],
|
|
47
|
+
this.args[3],
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async getAssetsToApprove() {
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './MorphoBlueSupplyAction';
|
|
2
|
+
export * from './MorphoBlueSupplyCollateralAction';
|
|
3
|
+
export * from './MorphoBlueBorrowAction';
|
|
4
|
+
export * from './MorphoBluePaybackAction';
|
|
5
|
+
export * from './MorphoBlueWithdrawCollateralAction';
|
|
6
|
+
export * from './MorphoBlueWithdrawAction';
|
|
7
|
+
export * from './MorphoBlueSetAuthAction';
|
|
8
|
+
export * from './MorphoBlueSetAuthWithSigAction';
|
package/src/addresses.ts
CHANGED
|
@@ -24,7 +24,7 @@ export const actionAddresses = {
|
|
|
24
24
|
TokenizedVaultAdapter: '0x3944364Ce3a273D269707484F3a676fCa17E08b8',
|
|
25
25
|
|
|
26
26
|
// exchange
|
|
27
|
-
DFSSell: '
|
|
27
|
+
DFSSell: '0x561013c605A17f5dC5b738C8a3fF9c5F33DbC3d8',
|
|
28
28
|
|
|
29
29
|
// maker
|
|
30
30
|
McdGenerate: '0xCb50a91C0f12f439b8bf11E9474B9c1ED62Bf7a3',
|
|
@@ -122,9 +122,10 @@ export const actionAddresses = {
|
|
|
122
122
|
FLMaker: '0x672DE08e36A1698fD5e9E34045F81558dB4c1AFE',
|
|
123
123
|
FLBalancer: '0x540a83E36E5E6Aa916A6c591934d800e17115048',
|
|
124
124
|
FLSpark: '0xe9Fe5a0f5e4B370Ae60d837da58744666D5C06F7',
|
|
125
|
-
FLAction: '
|
|
125
|
+
FLAction: '0x2b10B000292745099Deb15304A247c0816bd8b73',
|
|
126
126
|
FLUniV3: '0x9CAdAC8Be718572F82B672b950c53F0b58483A35',
|
|
127
127
|
FLGho: '0xbb67b81dD080a406227A38965d0393f396ddECBc',
|
|
128
|
+
FLMorphoBlue: '0x6206C96EAc5EAC546861438A9f953B6BEa50EBAB',
|
|
128
129
|
|
|
129
130
|
// uniswap
|
|
130
131
|
UniSupply: '0x9935e12F0218E61c27D7f23eAC9A9D6881a078eC',
|
|
@@ -247,6 +248,15 @@ export const actionAddresses = {
|
|
|
247
248
|
CurveUsdGetDebt: '0x3Bb41d3f300dA758780fe7696bb4fB93cD7172fB',
|
|
248
249
|
CurveUsdCollRatioTrigger: '0xFCc610809b735BB13E583c5E46595457083D2b0c',
|
|
249
250
|
CurveUsdCollRatioCheck: '0x8c65f37ca216de1625886431249be13ead051388',
|
|
251
|
+
|
|
252
|
+
MorphoBlueSupply: '0x1D0F6027Eeb118dEc06055735eE840E3Fe3E6f9a',
|
|
253
|
+
MorphoBlueSupplyCollateral: '0x1cdAC5D4b207e8DBd308504BbedD5D1BD19D26ac',
|
|
254
|
+
MorphoBlueWithdraw: '0xE97c7D2838D068C967B7c40080e09A08B9b11fca',
|
|
255
|
+
MorphoBlueWithdrawCollateral: '0xF339F5272E48f9b2c074dcCF7e169259465A4872',
|
|
256
|
+
MorphoBlueBorrow: '0xcc05A3e06DA9Bd2827C7e86a96C63EAda3935AA0',
|
|
257
|
+
MorphoBluePayback: '0x9f437E5F705E02d77adC2e72C34926978776b085',
|
|
258
|
+
MorphoBlueSetAuth: '0xf30935e20c6357c7bcecd5e58ad6de26d54b9f64',
|
|
259
|
+
MorphoBlueSetAuthWithSig: '0xE2d5fCDBf73BAd24A0FCAf6B2733933A98021808',
|
|
250
260
|
},
|
|
251
261
|
[NETWORKS.optimism.chainId]: {
|
|
252
262
|
DFSSell: '0xC6c601fcAa870efd26C624F8c65fbc54cBe533b1',
|
|
@@ -379,7 +389,7 @@ export const actionAddresses = {
|
|
|
379
389
|
|
|
380
390
|
export const otherAddresses = {
|
|
381
391
|
[NETWORKS.ethereum.chainId]: {
|
|
382
|
-
RecipeExecutor: '
|
|
392
|
+
RecipeExecutor: '0x10B748Dc504C2515Bb6A9e23CB2F686090b6c584',
|
|
383
393
|
DFSRegistry: '0x287778F121F134C66212FB16c9b53eC991D32f5b',
|
|
384
394
|
DFSProxyRegistry: '0x29474FdaC7142f9aB7773B8e38264FA15E3805ed',
|
|
385
395
|
ProxyRegistry: '0x4678f0a6958e4D2Bc4F1BAF7Bc52E8F3564f3fE4',
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Action } from '../Action';
|
|
2
|
+
import { getAddr } from '../addresses';
|
|
3
|
+
import { uint256, uint8 } from '../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* @category Triggers
|
|
9
|
+
*/
|
|
10
|
+
export class OffchainPriceTrigger extends Action {
|
|
11
|
+
constructor(limitPrice:uint256, limitType: uint8) {
|
|
12
|
+
super('OffchainPriceTrigger', getAddr('OffchainPriceTrigger'), ['uint256', 'uint8'], [limitPrice, limitType]);
|
|
13
|
+
}
|
|
14
|
+
}
|
package/src/triggers/index.ts
CHANGED