@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
package/esm/src/Action.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AccessListItem, EthAddress } from './types';
|
|
2
|
-
type ParamTypes = Array<string | Array<any>>;
|
|
3
|
-
type Args = Array<any>;
|
|
2
|
+
declare type ParamTypes = Array<string | Array<any>>;
|
|
3
|
+
declare type Args = Array<any>;
|
|
4
4
|
/**
|
|
5
5
|
* Single action that can be executed directly, or combined into a set (ie. supply a vault)
|
|
6
6
|
*
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, bytes, uint256, uint8 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* ExecuteSafeTxAction - Execute Safe transaction
|
|
5
|
+
*
|
|
6
|
+
* @category BasicActions
|
|
7
|
+
*/
|
|
8
|
+
export declare class ExecuteSafeTxAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param safe Address of the Safe wallet
|
|
11
|
+
* @param to Destination address of Safe transaction
|
|
12
|
+
* @param value Ether value of Safe transaction
|
|
13
|
+
* @param data Data payload of Safe transaction
|
|
14
|
+
* @param operation Operation type of Safe transaction. 0 = call, 1 = delegateCall
|
|
15
|
+
* @param safeTxGas Gas that should be used for the Safe transaction
|
|
16
|
+
* @param baseGas Gas costs that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund)
|
|
17
|
+
* @param gasPrice Gas price that should be used for the payment calculation
|
|
18
|
+
* @param gasToken Token address (or 0 if ETH) that is used for the payment
|
|
19
|
+
* @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin
|
|
20
|
+
* @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v})
|
|
21
|
+
*/
|
|
22
|
+
constructor(safe: EthAddress, to: EthAddress, value: uint256, data: bytes, operation: uint8, safeTxGas: uint256, baseGas: uint256, gasPrice: uint256, gasToken: EthAddress, refundReceiver: EthAddress, signatures: bytes);
|
|
23
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* ExecuteSafeTxAction - Execute Safe transaction
|
|
5
|
+
*
|
|
6
|
+
* @category BasicActions
|
|
7
|
+
*/
|
|
8
|
+
export class ExecuteSafeTxAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param safe Address of the Safe wallet
|
|
11
|
+
* @param to Destination address of Safe transaction
|
|
12
|
+
* @param value Ether value of Safe transaction
|
|
13
|
+
* @param data Data payload of Safe transaction
|
|
14
|
+
* @param operation Operation type of Safe transaction. 0 = call, 1 = delegateCall
|
|
15
|
+
* @param safeTxGas Gas that should be used for the Safe transaction
|
|
16
|
+
* @param baseGas Gas costs that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund)
|
|
17
|
+
* @param gasPrice Gas price that should be used for the payment calculation
|
|
18
|
+
* @param gasToken Token address (or 0 if ETH) that is used for the payment
|
|
19
|
+
* @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin
|
|
20
|
+
* @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v})
|
|
21
|
+
*/
|
|
22
|
+
constructor(safe, to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, signatures) {
|
|
23
|
+
super('ExecuteSafeTx', getAddr('ExecuteSafeTx'), [
|
|
24
|
+
'address',
|
|
25
|
+
'address',
|
|
26
|
+
'uint256',
|
|
27
|
+
'bytes',
|
|
28
|
+
'uint8',
|
|
29
|
+
'uint256',
|
|
30
|
+
'uint256',
|
|
31
|
+
'uint256',
|
|
32
|
+
'address',
|
|
33
|
+
'address',
|
|
34
|
+
'bytes',
|
|
35
|
+
], [
|
|
36
|
+
safe,
|
|
37
|
+
to,
|
|
38
|
+
value,
|
|
39
|
+
data,
|
|
40
|
+
operation,
|
|
41
|
+
safeTxGas,
|
|
42
|
+
baseGas,
|
|
43
|
+
gasPrice,
|
|
44
|
+
gasToken,
|
|
45
|
+
refundReceiver,
|
|
46
|
+
signatures,
|
|
47
|
+
]);
|
|
48
|
+
this.mappableArgs = [
|
|
49
|
+
this.args[0],
|
|
50
|
+
this.args[1],
|
|
51
|
+
this.args[2],
|
|
52
|
+
this.args[4],
|
|
53
|
+
this.args[5],
|
|
54
|
+
this.args[6],
|
|
55
|
+
this.args[7],
|
|
56
|
+
this.args[8],
|
|
57
|
+
this.args[9],
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ActionWithL2 } from '../../ActionWithL2';
|
|
2
|
+
import { EthAddress, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Limit sell action used as part of the LimitSell Strategy
|
|
5
|
+
*
|
|
6
|
+
* @category BasicActions
|
|
7
|
+
*/
|
|
8
|
+
export declare class LimitSellAction extends ActionWithL2 {
|
|
9
|
+
protocolFee: string;
|
|
10
|
+
/**
|
|
11
|
+
* @param exchangeOrder Standard DFS Exchange data
|
|
12
|
+
* @param from Order sender
|
|
13
|
+
* @param to Order recipient
|
|
14
|
+
* @param gasUsed Amount of gas spent as part of the strategy
|
|
15
|
+
* @param protocolFee 0x fee (amount of ETH in Wei)
|
|
16
|
+
*/
|
|
17
|
+
constructor(exchangeOrder: Array<any>, from: EthAddress, to: EthAddress, gasUsed: uint256, protocolFee?: string);
|
|
18
|
+
encodeInputs(): string;
|
|
19
|
+
getAssetsToApprove(): Promise<{
|
|
20
|
+
asset: any;
|
|
21
|
+
owner: any;
|
|
22
|
+
}[]>;
|
|
23
|
+
getEthValue(): Promise<string>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
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 AbiCoder from 'web3-eth-abi';
|
|
11
|
+
import { getAssetInfoByAddress } from '@defisaver/tokens';
|
|
12
|
+
import ActionAbi from '../../abis/Action.json';
|
|
13
|
+
import { ActionWithL2 } from '../../ActionWithL2';
|
|
14
|
+
import { requireAddress } from '../../utils/general';
|
|
15
|
+
import { getAddr } from '../../addresses';
|
|
16
|
+
/**
|
|
17
|
+
* Limit sell action used as part of the LimitSell Strategy
|
|
18
|
+
*
|
|
19
|
+
* @category BasicActions
|
|
20
|
+
*/
|
|
21
|
+
export class LimitSellAction extends ActionWithL2 {
|
|
22
|
+
/**
|
|
23
|
+
* @param exchangeOrder Standard DFS Exchange data
|
|
24
|
+
* @param from Order sender
|
|
25
|
+
* @param to Order recipient
|
|
26
|
+
* @param gasUsed Amount of gas spent as part of the strategy
|
|
27
|
+
* @param protocolFee 0x fee (amount of ETH in Wei)
|
|
28
|
+
*/
|
|
29
|
+
constructor(exchangeOrder, from, to, gasUsed, protocolFee = '0') {
|
|
30
|
+
requireAddress(to);
|
|
31
|
+
super('LimitSell', getAddr('LimitSell'), [
|
|
32
|
+
['address', 'address', 'uint256', 'uint256', 'uint256', 'uint256', 'address', 'address', 'bytes', ['address', 'address', 'address', 'uint256', 'uint256', 'bytes']],
|
|
33
|
+
'address',
|
|
34
|
+
'address',
|
|
35
|
+
'uint256',
|
|
36
|
+
], [exchangeOrder, from, to, gasUsed]);
|
|
37
|
+
this.protocolFee = protocolFee;
|
|
38
|
+
this.mappableArgs = [
|
|
39
|
+
this.args[0][0],
|
|
40
|
+
this.args[0][1],
|
|
41
|
+
this.args[0][2],
|
|
42
|
+
this.args[1],
|
|
43
|
+
this.args[2],
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
encodeInputs() {
|
|
47
|
+
const executeActionDirectAbi = (ActionAbi.find(({ name }) => name === 'executeActionDirect'));
|
|
48
|
+
return AbiCoder.encodeFunctionCall(executeActionDirectAbi, this._encodeForCall());
|
|
49
|
+
}
|
|
50
|
+
getAssetsToApprove() {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const asset = getAssetInfoByAddress(this.args[0][0]);
|
|
53
|
+
if (asset.symbol !== 'ETH')
|
|
54
|
+
return [{ asset: this.args[0][0], owner: this.args[1] }];
|
|
55
|
+
return [];
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
getEthValue() {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
return this.protocolFee || '0';
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Remove approval for a spender to pull tokens from user wallet
|
|
5
|
+
*
|
|
6
|
+
* @category BasicActions
|
|
7
|
+
*/
|
|
8
|
+
export declare class RemoveTokenApprovalAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param token Token address
|
|
11
|
+
* @param spender Spender address
|
|
12
|
+
*/
|
|
13
|
+
constructor(token: EthAddress, spender: EthAddress);
|
|
14
|
+
getAssetsToApprove(): Promise<never[]>;
|
|
15
|
+
}
|
|
@@ -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 { requireAddress } from '../../utils/general';
|
|
11
|
+
import { Action } from '../../Action';
|
|
12
|
+
import { getAddr } from '../../addresses';
|
|
13
|
+
/**
|
|
14
|
+
* Remove approval for a spender to pull tokens from user wallet
|
|
15
|
+
*
|
|
16
|
+
* @category BasicActions
|
|
17
|
+
*/
|
|
18
|
+
export class RemoveTokenApprovalAction extends Action {
|
|
19
|
+
/**
|
|
20
|
+
* @param token Token address
|
|
21
|
+
* @param spender Spender address
|
|
22
|
+
*/
|
|
23
|
+
constructor(token, spender) {
|
|
24
|
+
requireAddress(spender);
|
|
25
|
+
super('RemoveTokenApproval', getAddr('RemoveTokenApproval'), [
|
|
26
|
+
'address',
|
|
27
|
+
'address',
|
|
28
|
+
], [
|
|
29
|
+
token,
|
|
30
|
+
spender,
|
|
31
|
+
]);
|
|
32
|
+
this.mappableArgs = [
|
|
33
|
+
this.args[0],
|
|
34
|
+
this.args[1],
|
|
35
|
+
];
|
|
36
|
+
}
|
|
37
|
+
getAssetsToApprove() {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
return [];
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -24,3 +24,6 @@ export * from './TokenizedVaultAdapterDepositAction';
|
|
|
24
24
|
export * from './TokenizedVaultAdapterMintAction';
|
|
25
25
|
export * from './TokenizedVaultAdapterRedeemAction';
|
|
26
26
|
export * from './TokenizedVaultAdapterWithdrawAction';
|
|
27
|
+
export * from './LimitSellAction';
|
|
28
|
+
export * from './ExecuteSafeTxAction';
|
|
29
|
+
export * from './RemoveTokenApprovalAction';
|
|
@@ -24,3 +24,6 @@ export * from './TokenizedVaultAdapterDepositAction';
|
|
|
24
24
|
export * from './TokenizedVaultAdapterMintAction';
|
|
25
25
|
export * from './TokenizedVaultAdapterRedeemAction';
|
|
26
26
|
export * from './TokenizedVaultAdapterWithdrawAction';
|
|
27
|
+
export * from './LimitSellAction';
|
|
28
|
+
export * from './ExecuteSafeTxAction';
|
|
29
|
+
export * from './RemoveTokenApprovalAction';
|
|
@@ -50,5 +50,8 @@ _FLAction_instances = new WeakSet(), _FLAction_handleArgs = function _FLAction_h
|
|
|
50
50
|
if (specificFLAction.constructor.name === 'SparkFlashLoanAction') {
|
|
51
51
|
argsToReturn[5] = [7];
|
|
52
52
|
}
|
|
53
|
+
if (specificFLAction.constructor.name === 'MorphoBlueFlashLoanAction') {
|
|
54
|
+
argsToReturn[5] = [8];
|
|
55
|
+
}
|
|
53
56
|
return argsToReturn;
|
|
54
57
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256, bytes } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Gets a flashloan from MorphoBlue
|
|
5
|
+
*
|
|
6
|
+
* @category Flashloans
|
|
7
|
+
*/
|
|
8
|
+
export declare class MorphoBlueFlashLoanAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param token
|
|
11
|
+
* @param amount
|
|
12
|
+
* @param flParamGetterAddr
|
|
13
|
+
* @param flParamGetterData
|
|
14
|
+
*/
|
|
15
|
+
constructor(token: EthAddress, amount: uint256, flParamGetterAddr?: EthAddress, flParamGetterData?: bytes);
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* Gets a flashloan from MorphoBlue
|
|
5
|
+
*
|
|
6
|
+
* @category Flashloans
|
|
7
|
+
*/
|
|
8
|
+
export class MorphoBlueFlashLoanAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param token
|
|
11
|
+
* @param amount
|
|
12
|
+
* @param flParamGetterAddr
|
|
13
|
+
* @param flParamGetterData
|
|
14
|
+
*/
|
|
15
|
+
constructor(token, amount, flParamGetterAddr = getAddr('Empty'), flParamGetterData = []) {
|
|
16
|
+
super('FLMorphoBlue', getAddr('FLMorphoBlue'), ['address[]', 'uint256[]', 'uint256[]', 'address', 'address', 'bytes', 'bytes'], [[token], [amount], [], getAddr('Empty'), flParamGetterAddr, flParamGetterData, []]);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SendTokenAction } from '../basic';
|
|
2
|
+
import { EthAddress, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Pays back a flashloan from MorphoBlue
|
|
5
|
+
*
|
|
6
|
+
* @category Flashloans
|
|
7
|
+
*/
|
|
8
|
+
export declare class MorphoBlueFlashLoanPaybackAction extends SendTokenAction {
|
|
9
|
+
/**
|
|
10
|
+
* @param loanAmount
|
|
11
|
+
* @param tokenAddr
|
|
12
|
+
*/
|
|
13
|
+
constructor(loanAmount: uint256, tokenAddr: EthAddress);
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SendTokenAction } from '../basic';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* Pays back a flashloan from MorphoBlue
|
|
5
|
+
*
|
|
6
|
+
* @category Flashloans
|
|
7
|
+
*/
|
|
8
|
+
export class MorphoBlueFlashLoanPaybackAction extends SendTokenAction {
|
|
9
|
+
/**
|
|
10
|
+
* @param loanAmount
|
|
11
|
+
* @param tokenAddr
|
|
12
|
+
*/
|
|
13
|
+
constructor(loanAmount, tokenAddr) {
|
|
14
|
+
super(tokenAddr, getAddr('FLMorphoBlue'), loanAmount);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -20,3 +20,5 @@ export * from './UniV3FlashLoanAction';
|
|
|
20
20
|
export * from './UniV3FlashLoanPaybackAction';
|
|
21
21
|
export * from './GhoFlashLoanAction';
|
|
22
22
|
export * from './GhoFlashLoanPaybackAction';
|
|
23
|
+
export * from './MorphoBlueFlashLoanAction';
|
|
24
|
+
export * from './MorphoBlueFlashLoanPaybackAction';
|
|
@@ -20,3 +20,5 @@ export * from './UniV3FlashLoanAction';
|
|
|
20
20
|
export * from './UniV3FlashLoanPaybackAction';
|
|
21
21
|
export * from './GhoFlashLoanAction';
|
|
22
22
|
export * from './GhoFlashLoanPaybackAction';
|
|
23
|
+
export * from './MorphoBlueFlashLoanAction';
|
|
24
|
+
export * from './MorphoBlueFlashLoanPaybackAction';
|
|
@@ -26,4 +26,5 @@ 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
|
-
|
|
29
|
+
import * as morphoblue from './morpho-blue';
|
|
30
|
+
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, lsv, spark, curveusd, morphoblue, };
|
package/esm/src/actions/index.js
CHANGED
|
@@ -26,4 +26,5 @@ 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
|
-
|
|
29
|
+
import * as morphoblue from './morpho-blue';
|
|
30
|
+
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, lsv, spark, curveusd, morphoblue, };
|
|
@@ -9,8 +9,7 @@ export declare class MakerGiveAction extends Action {
|
|
|
9
9
|
/**
|
|
10
10
|
* @param vaultId
|
|
11
11
|
* @param newOwner
|
|
12
|
-
* @param createProxy
|
|
13
12
|
* @param mcdManager
|
|
14
13
|
*/
|
|
15
|
-
constructor(vaultId: uint256, newOwner: EthAddress,
|
|
14
|
+
constructor(vaultId: uint256, newOwner: EthAddress, mcdManager?: EthAddress);
|
|
16
15
|
}
|
|
@@ -10,12 +10,11 @@ export class MakerGiveAction extends Action {
|
|
|
10
10
|
/**
|
|
11
11
|
* @param vaultId
|
|
12
12
|
* @param newOwner
|
|
13
|
-
* @param createProxy
|
|
14
13
|
* @param mcdManager
|
|
15
14
|
*/
|
|
16
|
-
constructor(vaultId, newOwner,
|
|
15
|
+
constructor(vaultId, newOwner, mcdManager = getAddr('McdCdpManager')) {
|
|
17
16
|
requireAddress(newOwner);
|
|
18
|
-
super('McdGive', getAddr('McdGive'), ['uint256', 'address', '
|
|
17
|
+
super('McdGive', getAddr('McdGive'), ['uint256', 'address', 'address'], [vaultId, newOwner, mcdManager]);
|
|
19
18
|
this.mappableArgs = [
|
|
20
19
|
this.args[0],
|
|
21
20
|
this.args[1],
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* MorphoBlueBorrowAction - Borrow a token from MorphoBlue
|
|
5
|
+
*
|
|
6
|
+
* @category MorphoBlue
|
|
7
|
+
*/
|
|
8
|
+
export declare class MorphoBlueBorrowAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param loanToken - MarketParams loanToken
|
|
11
|
+
* @param collateralToken - MarketParams collateralToken
|
|
12
|
+
* @param oracle - MarketParams oracle
|
|
13
|
+
* @param irm - MarketParams irm
|
|
14
|
+
* @param lltv - MarketParams lltv
|
|
15
|
+
* @param borrowAmount - amount of loanToken to borrow
|
|
16
|
+
* @param onBehalf - onBehalf of whom to borrow
|
|
17
|
+
* @param to - address to receive borrowed tokens
|
|
18
|
+
*/
|
|
19
|
+
constructor(loanToken: EthAddress, collateralToken: EthAddress, oracle: EthAddress, irm: EthAddress, lltv: uint256, borrowAmount: uint256, onBehalf: EthAddress, to: EthAddress);
|
|
20
|
+
getAssetsToApprove(): Promise<never[]>;
|
|
21
|
+
}
|
|
@@ -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 { Action } from '../../Action';
|
|
11
|
+
import { getAddr } from '../../addresses';
|
|
12
|
+
/**
|
|
13
|
+
* MorphoBlueBorrowAction - Borrow a token from MorphoBlue
|
|
14
|
+
*
|
|
15
|
+
* @category MorphoBlue
|
|
16
|
+
*/
|
|
17
|
+
export class MorphoBlueBorrowAction extends Action {
|
|
18
|
+
/**
|
|
19
|
+
* @param loanToken - MarketParams loanToken
|
|
20
|
+
* @param collateralToken - MarketParams collateralToken
|
|
21
|
+
* @param oracle - MarketParams oracle
|
|
22
|
+
* @param irm - MarketParams irm
|
|
23
|
+
* @param lltv - MarketParams lltv
|
|
24
|
+
* @param borrowAmount - amount of loanToken to borrow
|
|
25
|
+
* @param onBehalf - onBehalf of whom to borrow
|
|
26
|
+
* @param to - address to receive borrowed tokens
|
|
27
|
+
*/
|
|
28
|
+
constructor(loanToken, collateralToken, oracle, irm, lltv, borrowAmount, onBehalf, to) {
|
|
29
|
+
super('MorphoBlueBorrow', getAddr('MorphoBlueBorrow'), [['address', 'address', 'address', 'address', 'uint256'], 'uint256', 'address', 'address'], [[loanToken, collateralToken, oracle, irm, lltv], borrowAmount, onBehalf, to]);
|
|
30
|
+
this.mappableArgs = [
|
|
31
|
+
this.args[0][0],
|
|
32
|
+
this.args[0][1],
|
|
33
|
+
this.args[0][2],
|
|
34
|
+
this.args[0][3],
|
|
35
|
+
this.args[0][4],
|
|
36
|
+
this.args[1],
|
|
37
|
+
this.args[2],
|
|
38
|
+
this.args[3],
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
getAssetsToApprove() {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
return [];
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* MorphoBluePaybackAction - Payback debt on MorphoBlue
|
|
5
|
+
*
|
|
6
|
+
* @category MorphoBlue
|
|
7
|
+
*/
|
|
8
|
+
export declare class MorphoBluePaybackAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param loanToken - MarketParams loanToken
|
|
11
|
+
* @param collateralToken - MarketParams collateralToken
|
|
12
|
+
* @param oracle - MarketParams oracle
|
|
13
|
+
* @param irm - MarketParams irm
|
|
14
|
+
* @param lltv - MarketParams lltv
|
|
15
|
+
* @param paybackAmount - Amount of debt to repay (uint.max for full debt repayment)
|
|
16
|
+
* @param from - Address from which to pull tokens with which to repay debt
|
|
17
|
+
* @param onBehalf - Position owner whose debt we are paying back
|
|
18
|
+
*/
|
|
19
|
+
constructor(loanToken: EthAddress, collateralToken: EthAddress, oracle: EthAddress, irm: EthAddress, lltv: uint256, paybackAmount: uint256, from: EthAddress, onBehalf: EthAddress);
|
|
20
|
+
getAssetsToApprove(): Promise<{
|
|
21
|
+
asset: any;
|
|
22
|
+
owner: any;
|
|
23
|
+
}[]>;
|
|
24
|
+
}
|
|
@@ -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 { Action } from '../../Action';
|
|
11
|
+
import { getAddr } from '../../addresses';
|
|
12
|
+
/**
|
|
13
|
+
* MorphoBluePaybackAction - Payback debt on MorphoBlue
|
|
14
|
+
*
|
|
15
|
+
* @category MorphoBlue
|
|
16
|
+
*/
|
|
17
|
+
export class MorphoBluePaybackAction extends Action {
|
|
18
|
+
/**
|
|
19
|
+
* @param loanToken - MarketParams loanToken
|
|
20
|
+
* @param collateralToken - MarketParams collateralToken
|
|
21
|
+
* @param oracle - MarketParams oracle
|
|
22
|
+
* @param irm - MarketParams irm
|
|
23
|
+
* @param lltv - MarketParams lltv
|
|
24
|
+
* @param paybackAmount - Amount of debt to repay (uint.max for full debt repayment)
|
|
25
|
+
* @param from - Address from which to pull tokens with which to repay debt
|
|
26
|
+
* @param onBehalf - Position owner whose debt we are paying back
|
|
27
|
+
*/
|
|
28
|
+
constructor(loanToken, collateralToken, oracle, irm, lltv, paybackAmount, from, onBehalf) {
|
|
29
|
+
super('MorphoBluePayback', getAddr('MorphoBluePayback'), [['address', 'address', 'address', 'address', 'uint256'], 'uint256', 'address', 'address'], [[loanToken, collateralToken, oracle, irm, lltv], paybackAmount, from, onBehalf]);
|
|
30
|
+
this.mappableArgs = [
|
|
31
|
+
this.args[0][0],
|
|
32
|
+
this.args[0][1],
|
|
33
|
+
this.args[0][2],
|
|
34
|
+
this.args[0][3],
|
|
35
|
+
this.args[0][4],
|
|
36
|
+
this.args[1],
|
|
37
|
+
this.args[2],
|
|
38
|
+
this.args[3],
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
getAssetsToApprove() {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
return [{ asset: this.args[0][0], owner: this.args[2] }];
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* @category MorphoBlue
|
|
5
|
+
*/
|
|
6
|
+
export declare class MorphoBlueSetAuthAction extends Action {
|
|
7
|
+
/**
|
|
8
|
+
* @param manager
|
|
9
|
+
* @param newIsAuthorized
|
|
10
|
+
*/
|
|
11
|
+
constructor(manager: EthAddress, newIsAuthorized: boolean);
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* @category MorphoBlue
|
|
5
|
+
*/
|
|
6
|
+
export class MorphoBlueSetAuthAction extends Action {
|
|
7
|
+
/**
|
|
8
|
+
* @param manager
|
|
9
|
+
* @param newIsAuthorized
|
|
10
|
+
*/
|
|
11
|
+
constructor(manager, newIsAuthorized) {
|
|
12
|
+
super('MorphoBlueSetAuth', getAddr('MorphoBlueSetAuth'), [
|
|
13
|
+
'address',
|
|
14
|
+
'bool',
|
|
15
|
+
], [manager, newIsAuthorized]);
|
|
16
|
+
this.mappableArgs = [this.args[0], this.args[1]];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, bytes32, uint256, uint8 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* @category MorphoBlue
|
|
5
|
+
*/
|
|
6
|
+
export declare class MorphoBlueSetAuthWithSigAction extends Action {
|
|
7
|
+
/**
|
|
8
|
+
* @param manager
|
|
9
|
+
* @param newIsAuthorized
|
|
10
|
+
*/
|
|
11
|
+
constructor(authorizer: EthAddress, authorized: EthAddress, isAuthorized: boolean, nonce: uint256, deadline: uint256, v: uint8, r: bytes32, s: bytes32);
|
|
12
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* @category MorphoBlue
|
|
5
|
+
*/
|
|
6
|
+
export class MorphoBlueSetAuthWithSigAction extends Action {
|
|
7
|
+
/**
|
|
8
|
+
* @param manager
|
|
9
|
+
* @param newIsAuthorized
|
|
10
|
+
*/
|
|
11
|
+
constructor(authorizer, authorized, isAuthorized, nonce, deadline, v, r, s) {
|
|
12
|
+
super('MorphoBlueSetAuthWithSig', getAddr('MorphoBlueSetAuthWithSig'), [
|
|
13
|
+
['address', 'address', 'bool', 'uint256', 'uint256'],
|
|
14
|
+
['uint8', 'bytes32', 'bytes32'],
|
|
15
|
+
], [
|
|
16
|
+
[authorizer, authorized, isAuthorized, nonce, deadline],
|
|
17
|
+
[v, r, s],
|
|
18
|
+
]);
|
|
19
|
+
this.mappableArgs = [];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* MorphoBlueSupplyAction - Supply token as a lender on MorphoBlue to earn interest
|
|
5
|
+
*
|
|
6
|
+
* @category MorphoBlue
|
|
7
|
+
*/
|
|
8
|
+
export declare class MorphoBlueSupplyAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param loanToken - MarketParams loanToken
|
|
11
|
+
* @param collateralToken - MarketParams collateralToken
|
|
12
|
+
* @param oracle - MarketParams oracle
|
|
13
|
+
* @param irm - MarketParams irm
|
|
14
|
+
* @param lltv - MarketParams lltv
|
|
15
|
+
* @param supplyAmount - Amount of loanToken to supply
|
|
16
|
+
* @param from - Address from which to pull tokens
|
|
17
|
+
* @param onBehalf - on whose behalf to supply the tokens
|
|
18
|
+
*/
|
|
19
|
+
constructor(loanToken: EthAddress, collateralToken: EthAddress, oracle: EthAddress, irm: EthAddress, lltv: uint256, supplyAmount: uint256, from: EthAddress, onBehalf: EthAddress);
|
|
20
|
+
getAssetsToApprove(): Promise<{
|
|
21
|
+
asset: any;
|
|
22
|
+
owner: any;
|
|
23
|
+
}[]>;
|
|
24
|
+
}
|