@defisaver/sdk 1.0.40 → 1.0.42-dev
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/aave/AaveClaimAAVEAction.d.ts +14 -0
- package/esm/src/actions/aave/AaveClaimAAVEAction.js +22 -0
- package/esm/src/actions/aave/AaveSupplyAction.js +1 -0
- package/esm/src/actions/aave/index.d.ts +1 -0
- package/esm/src/actions/aave/index.js +1 -0
- package/esm/src/actions/basic/ApproveTokenAction.d.ts +14 -0
- package/esm/src/actions/basic/ApproveTokenAction.js +27 -0
- package/esm/src/actions/basic/LSVSellAction.d.ts +23 -0
- package/esm/src/actions/basic/LSVSellAction.js +61 -0
- package/esm/src/actions/basic/TokenizedVaultAdapterDepositAction.d.ts +22 -0
- package/esm/src/actions/basic/TokenizedVaultAdapterDepositAction.js +35 -0
- package/esm/src/actions/basic/TokenizedVaultAdapterMintAction.d.ts +22 -0
- package/esm/src/actions/basic/TokenizedVaultAdapterMintAction.js +35 -0
- package/esm/src/actions/basic/TokenizedVaultAdapterRedeemAction.d.ts +20 -0
- package/esm/src/actions/basic/TokenizedVaultAdapterRedeemAction.js +33 -0
- package/esm/src/actions/basic/TokenizedVaultAdapterWithdrawAction.d.ts +20 -0
- package/esm/src/actions/basic/TokenizedVaultAdapterWithdrawAction.js +33 -0
- package/esm/src/actions/basic/index.d.ts +6 -0
- package/esm/src/actions/basic/index.js +6 -0
- package/esm/src/actions/index.d.ts +2 -1
- package/esm/src/actions/index.js +2 -1
- package/esm/src/actions/lsv/LSVBorrowAction.d.ts +14 -0
- package/esm/src/actions/lsv/LSVBorrowAction.js +19 -0
- package/esm/src/actions/lsv/LSVPaybackAction.d.ts +13 -0
- package/esm/src/actions/lsv/LSVPaybackAction.js +18 -0
- package/esm/src/actions/lsv/LSVSupplyAction.d.ts +15 -0
- package/esm/src/actions/lsv/LSVSupplyAction.js +21 -0
- package/esm/src/actions/lsv/LSVWithdrawAction.d.ts +15 -0
- package/esm/src/actions/lsv/LSVWithdrawAction.js +21 -0
- package/esm/src/actions/lsv/index.d.ts +4 -0
- package/esm/src/actions/lsv/index.js +4 -0
- package/esm/src/actions/morpho/aaveV3/MorphoAaveV3SetManagerAction.d.ts +14 -0
- package/esm/src/actions/morpho/aaveV3/MorphoAaveV3SetManagerAction.js +24 -0
- package/esm/src/actions/morpho/index.d.ts +1 -0
- package/esm/src/actions/morpho/index.js +1 -0
- package/esm/src/addresses.d.ts +27 -0
- package/esm/src/addresses.js +12 -0
- package/esm/src/index.d.ts +108 -0
- package/esm/src/types.d.ts +20 -20
- package/esm/src/utils/basic-utils.d.ts +6 -0
- package/esm/src/utils/basic-utils.js +7 -0
- package/esm/src/utils/index.d.ts +2 -1
- package/esm/src/utils/index.js +2 -1
- package/package.json +1 -1
- package/src/actions/aave/AaveClaimAAVEAction.ts +29 -0
- package/src/actions/aave/AaveSupplyAction.ts +1 -0
- package/src/actions/aave/index.ts +2 -1
- package/src/actions/basic/ApproveTokenAction.ts +34 -0
- package/src/actions/basic/LSVSellAction.ts +61 -0
- package/src/actions/basic/TokenizedVaultAdapterDepositAction.ts +38 -0
- package/src/actions/basic/TokenizedVaultAdapterMintAction.ts +38 -0
- package/src/actions/basic/TokenizedVaultAdapterRedeemAction.ts +36 -0
- package/src/actions/basic/TokenizedVaultAdapterWithdrawAction.ts +36 -0
- package/src/actions/basic/index.ts +6 -0
- package/src/actions/index.ts +2 -0
- package/src/actions/lsv/LSVBorrowAction.ts +21 -0
- package/src/actions/lsv/LSVPaybackAction.ts +20 -0
- package/src/actions/lsv/LSVSupplyAction.ts +23 -0
- package/src/actions/lsv/LSVWithdrawAction.ts +23 -0
- package/src/actions/lsv/index.ts +4 -0
- package/src/actions/morpho/aaveV3/MorphoAaveV3SetManagerAction.ts +32 -0
- package/src/actions/morpho/index.ts +1 -0
- package/src/addresses.ts +13 -2
- package/src/utils/basic-utils.ts +6 -0
- package/src/utils/index.ts +2 -0
- package/umd/index.js +1046 -558
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,14 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* AaveClaimAAVEAction - Claims AAVE from stkAave
|
|
5
|
+
*
|
|
6
|
+
* @category Aave
|
|
7
|
+
*/
|
|
8
|
+
export declare class AaveClaimAAVEAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param amount - Amount to claim
|
|
11
|
+
* @param to - Address where claimed tokens will end up
|
|
12
|
+
*/
|
|
13
|
+
constructor(amount: uint256, to: EthAddress);
|
|
14
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { requireAddress } from '../../utils/general';
|
|
3
|
+
import { getAddr } from '../../addresses';
|
|
4
|
+
/**
|
|
5
|
+
* AaveClaimAAVEAction - Claims AAVE from stkAave
|
|
6
|
+
*
|
|
7
|
+
* @category Aave
|
|
8
|
+
*/
|
|
9
|
+
export class AaveClaimAAVEAction extends Action {
|
|
10
|
+
/**
|
|
11
|
+
* @param amount - Amount to claim
|
|
12
|
+
* @param to - Address where claimed tokens will end up
|
|
13
|
+
*/
|
|
14
|
+
constructor(amount, to) {
|
|
15
|
+
requireAddress(to);
|
|
16
|
+
super('AaveClaimAAVE', getAddr('AaveClaimAAVE'), ['uint256', 'address'], [amount, to]);
|
|
17
|
+
this.mappableArgs = [
|
|
18
|
+
this.args[1],
|
|
19
|
+
this.args[2],
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @category BasicActions
|
|
6
|
+
*/
|
|
7
|
+
export declare class ApproveTokenAction extends Action {
|
|
8
|
+
/**
|
|
9
|
+
* @param token Token address
|
|
10
|
+
* @param spender
|
|
11
|
+
* @param amount Transfer amount (-1 for whole Recipe (DsProxy) balance)
|
|
12
|
+
*/
|
|
13
|
+
constructor(token: EthAddress, spender: EthAddress, amount: uint256);
|
|
14
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { requireAddress } from '../../utils/general';
|
|
3
|
+
import { getAddr } from '../../addresses';
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @category BasicActions
|
|
7
|
+
*/
|
|
8
|
+
export class ApproveTokenAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param token Token address
|
|
11
|
+
* @param spender
|
|
12
|
+
* @param amount Transfer amount (-1 for whole Recipe (DsProxy) balance)
|
|
13
|
+
*/
|
|
14
|
+
constructor(token, spender, amount) {
|
|
15
|
+
requireAddress(spender);
|
|
16
|
+
super('ApproveToken', getAddr('ApproveToken'), [
|
|
17
|
+
'address',
|
|
18
|
+
'address',
|
|
19
|
+
'uint',
|
|
20
|
+
], [token, spender, amount]);
|
|
21
|
+
this.mappableArgs = [
|
|
22
|
+
this.args[0],
|
|
23
|
+
this.args[1],
|
|
24
|
+
this.args[2],
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ActionWithL2 } from '../../ActionWithL2';
|
|
2
|
+
import { EthAddress } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Sells token on DeFi Saver exchange aggregator without fee
|
|
5
|
+
*
|
|
6
|
+
* @category BasicActions
|
|
7
|
+
*/
|
|
8
|
+
export declare class LSVSellAction 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 protocolFee 0x fee (amount of ETH in Wei)
|
|
15
|
+
*/
|
|
16
|
+
constructor(exchangeOrder: Array<any>, from: EthAddress, to: EthAddress, protocolFee?: string);
|
|
17
|
+
encodeInputs(): string;
|
|
18
|
+
getAssetsToApprove(): Promise<{
|
|
19
|
+
asset: any;
|
|
20
|
+
owner: any;
|
|
21
|
+
}[]>;
|
|
22
|
+
getEthValue(): Promise<string>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
* Sells token on DeFi Saver exchange aggregator without fee
|
|
18
|
+
*
|
|
19
|
+
* @category BasicActions
|
|
20
|
+
*/
|
|
21
|
+
export class LSVSellAction extends ActionWithL2 {
|
|
22
|
+
/**
|
|
23
|
+
* @param exchangeOrder Standard DFS Exchange data
|
|
24
|
+
* @param from Order sender
|
|
25
|
+
* @param to Order recipient
|
|
26
|
+
* @param protocolFee 0x fee (amount of ETH in Wei)
|
|
27
|
+
*/
|
|
28
|
+
constructor(exchangeOrder, from, to, protocolFee = '0') {
|
|
29
|
+
requireAddress(to);
|
|
30
|
+
super('LSVSell', getAddr('LSVSell'), [
|
|
31
|
+
['address', 'address', 'uint256', 'uint256', 'uint256', 'uint256', 'address', 'address', 'bytes', ['address', 'address', 'address', 'uint256', 'uint256', 'bytes']],
|
|
32
|
+
'address',
|
|
33
|
+
'address',
|
|
34
|
+
], [exchangeOrder, from, to]);
|
|
35
|
+
this.protocolFee = protocolFee;
|
|
36
|
+
this.mappableArgs = [
|
|
37
|
+
this.args[0][0],
|
|
38
|
+
this.args[0][1],
|
|
39
|
+
this.args[0][2],
|
|
40
|
+
this.args[1],
|
|
41
|
+
this.args[2],
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
encodeInputs() {
|
|
45
|
+
const executeActionDirectAbi = (ActionAbi.find(({ name }) => name === 'executeActionDirect'));
|
|
46
|
+
return AbiCoder.encodeFunctionCall(executeActionDirectAbi, this._encodeForCall());
|
|
47
|
+
}
|
|
48
|
+
getAssetsToApprove() {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const asset = getAssetInfoByAddress(this.args[0][0]);
|
|
51
|
+
if (asset.symbol !== 'ETH')
|
|
52
|
+
return [{ asset: this.args[0][0], owner: this.args[1] }];
|
|
53
|
+
return [];
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
getEthValue() {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
return this.protocolFee || '0';
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { uint256, EthAddress } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* TokenizedVaultAdapterDepositAction - Action that handles ERC4626 vault deposits
|
|
5
|
+
* @category BasicActions
|
|
6
|
+
*/
|
|
7
|
+
export declare class TokenizedVaultAdapterDepositAction extends Action {
|
|
8
|
+
underlyingAssetAddress: EthAddress;
|
|
9
|
+
/**
|
|
10
|
+
* @param amount Amount of underlying asset to deposit
|
|
11
|
+
* @param minOut Min amount of shares to accept
|
|
12
|
+
* @param vaultAddress Address of the ERC4626 vault
|
|
13
|
+
* @param from Address from which to pull the underlying asset
|
|
14
|
+
* @param to Asset that will receive the minted shares
|
|
15
|
+
* @param underlyingAssetAddress Address of the underlying vault asset, only used in sdk for approvals
|
|
16
|
+
*/
|
|
17
|
+
constructor(amount: uint256, minOut: uint256, vaultAddress: EthAddress, from: EthAddress, to: EthAddress, underlyingAssetAddress: EthAddress);
|
|
18
|
+
getAssetsToApprove(): Promise<{
|
|
19
|
+
asset: string;
|
|
20
|
+
owner: any;
|
|
21
|
+
}[]>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
import { TokenizedVaultOperationId } from '../../utils/basic-utils';
|
|
13
|
+
/**
|
|
14
|
+
* TokenizedVaultAdapterDepositAction - Action that handles ERC4626 vault deposits
|
|
15
|
+
* @category BasicActions
|
|
16
|
+
*/
|
|
17
|
+
export class TokenizedVaultAdapterDepositAction extends Action {
|
|
18
|
+
/**
|
|
19
|
+
* @param amount Amount of underlying asset to deposit
|
|
20
|
+
* @param minOut Min amount of shares to accept
|
|
21
|
+
* @param vaultAddress Address of the ERC4626 vault
|
|
22
|
+
* @param from Address from which to pull the underlying asset
|
|
23
|
+
* @param to Asset that will receive the minted shares
|
|
24
|
+
* @param underlyingAssetAddress Address of the underlying vault asset, only used in sdk for approvals
|
|
25
|
+
*/
|
|
26
|
+
constructor(amount, minOut, vaultAddress, from, to, underlyingAssetAddress) {
|
|
27
|
+
super('TokenizedVaultAdapter', getAddr('TokenizedVaultAdapter'), ['uint256', 'uint256', 'address', 'address', 'address', 'uint8'], [amount, minOut, vaultAddress, from, to, TokenizedVaultOperationId.DEPOSIT]);
|
|
28
|
+
this.underlyingAssetAddress = underlyingAssetAddress;
|
|
29
|
+
}
|
|
30
|
+
getAssetsToApprove() {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
return [{ asset: this.underlyingAssetAddress, owner: this.args[3] }];
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { uint256, EthAddress } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* TokenizedVaultAdapterMintAction - Action that handles ERC4626 vault minting
|
|
5
|
+
* @category BasicActions
|
|
6
|
+
*/
|
|
7
|
+
export declare class TokenizedVaultAdapterMintAction extends Action {
|
|
8
|
+
underlyingAssetAddress: EthAddress;
|
|
9
|
+
/**
|
|
10
|
+
* @param amount Amount of shares to mint
|
|
11
|
+
* @param maxIn Max amount of underlying asset to deposit for minting
|
|
12
|
+
* @param vaultAddress Address of the ERC4626 vault
|
|
13
|
+
* @param from Address from which to pull the underlying asset
|
|
14
|
+
* @param to Asset that will receive the shares minted
|
|
15
|
+
* @param underlyingAssetAddress Address of the underlying vault asset, only used in sdk for approvals
|
|
16
|
+
*/
|
|
17
|
+
constructor(amount: uint256, maxIn: uint256, vaultAddress: EthAddress, from: EthAddress, to: EthAddress, underlyingAssetAddress: EthAddress);
|
|
18
|
+
getAssetsToApprove(): Promise<{
|
|
19
|
+
asset: string;
|
|
20
|
+
owner: any;
|
|
21
|
+
}[]>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
import { TokenizedVaultOperationId } from '../../utils/basic-utils';
|
|
13
|
+
/**
|
|
14
|
+
* TokenizedVaultAdapterMintAction - Action that handles ERC4626 vault minting
|
|
15
|
+
* @category BasicActions
|
|
16
|
+
*/
|
|
17
|
+
export class TokenizedVaultAdapterMintAction extends Action {
|
|
18
|
+
/**
|
|
19
|
+
* @param amount Amount of shares to mint
|
|
20
|
+
* @param maxIn Max amount of underlying asset to deposit for minting
|
|
21
|
+
* @param vaultAddress Address of the ERC4626 vault
|
|
22
|
+
* @param from Address from which to pull the underlying asset
|
|
23
|
+
* @param to Asset that will receive the shares minted
|
|
24
|
+
* @param underlyingAssetAddress Address of the underlying vault asset, only used in sdk for approvals
|
|
25
|
+
*/
|
|
26
|
+
constructor(amount, maxIn, vaultAddress, from, to, underlyingAssetAddress) {
|
|
27
|
+
super('TokenizedVaultAdapter', getAddr('TokenizedVaultAdapter'), ['uint256', 'uint256', 'address', 'address', 'address', 'uint8'], [amount, maxIn, vaultAddress, from, to, TokenizedVaultOperationId.MINT]);
|
|
28
|
+
this.underlyingAssetAddress = underlyingAssetAddress;
|
|
29
|
+
}
|
|
30
|
+
getAssetsToApprove() {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
return [{ asset: this.underlyingAssetAddress, owner: this.args[3] }];
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { uint256, EthAddress } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* TokenizedVaultAdapterRedeemAction - Action that handles ERC4626 vault redemptions
|
|
5
|
+
* @category BasicActions
|
|
6
|
+
*/
|
|
7
|
+
export declare class TokenizedVaultAdapterRedeemAction extends Action {
|
|
8
|
+
/**
|
|
9
|
+
* @param amount Amount of shares to redeem
|
|
10
|
+
* @param minOut Min amount of underlying asset to accept for the shares burned
|
|
11
|
+
* @param vaultAddress Address of the ERC4626 vault
|
|
12
|
+
* @param from Address from which to pull the shares
|
|
13
|
+
* @param to Asset that will receive the underlying asset
|
|
14
|
+
*/
|
|
15
|
+
constructor(amount: uint256, minOut: uint256, vaultAddress: EthAddress, from: EthAddress, to: EthAddress);
|
|
16
|
+
getAssetsToApprove(): Promise<{
|
|
17
|
+
asset: any;
|
|
18
|
+
owner: any;
|
|
19
|
+
}[]>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
import { TokenizedVaultOperationId } from '../../utils/basic-utils';
|
|
13
|
+
/**
|
|
14
|
+
* TokenizedVaultAdapterRedeemAction - Action that handles ERC4626 vault redemptions
|
|
15
|
+
* @category BasicActions
|
|
16
|
+
*/
|
|
17
|
+
export class TokenizedVaultAdapterRedeemAction extends Action {
|
|
18
|
+
/**
|
|
19
|
+
* @param amount Amount of shares to redeem
|
|
20
|
+
* @param minOut Min amount of underlying asset to accept for the shares burned
|
|
21
|
+
* @param vaultAddress Address of the ERC4626 vault
|
|
22
|
+
* @param from Address from which to pull the shares
|
|
23
|
+
* @param to Asset that will receive the underlying asset
|
|
24
|
+
*/
|
|
25
|
+
constructor(amount, minOut, vaultAddress, from, to) {
|
|
26
|
+
super('TokenizedVaultAdapter', getAddr('TokenizedVaultAdapter'), ['uint256', 'uint256', 'address', 'address', 'address', 'uint8'], [amount, minOut, vaultAddress, from, to, TokenizedVaultOperationId.REDEEM]);
|
|
27
|
+
}
|
|
28
|
+
getAssetsToApprove() {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
return [{ asset: this.args[2], owner: this.args[3] }];
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { uint256, EthAddress } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* TokenizedVaultAdapterWithdrawAction - Action that handles ERC4626 vault withdrawals
|
|
5
|
+
* @category BasicActions
|
|
6
|
+
*/
|
|
7
|
+
export declare class TokenizedVaultAdapterWithdrawAction extends Action {
|
|
8
|
+
/**
|
|
9
|
+
* @param amount Amount of underlying asset to withdraw
|
|
10
|
+
* @param maxIn Max amount of shares to burn for withdrawal
|
|
11
|
+
* @param vaultAddress Address of the ERC4626 vault
|
|
12
|
+
* @param from Address from which to pull the shares
|
|
13
|
+
* @param to Asset that will receive the underlying asset
|
|
14
|
+
*/
|
|
15
|
+
constructor(amount: uint256, maxIn: uint256, vaultAddress: EthAddress, from: EthAddress, to: EthAddress);
|
|
16
|
+
getAssetsToApprove(): Promise<{
|
|
17
|
+
asset: any;
|
|
18
|
+
owner: any;
|
|
19
|
+
}[]>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
import { TokenizedVaultOperationId } from '../../utils/basic-utils';
|
|
13
|
+
/**
|
|
14
|
+
* TokenizedVaultAdapterWithdrawAction - Action that handles ERC4626 vault withdrawals
|
|
15
|
+
* @category BasicActions
|
|
16
|
+
*/
|
|
17
|
+
export class TokenizedVaultAdapterWithdrawAction extends Action {
|
|
18
|
+
/**
|
|
19
|
+
* @param amount Amount of underlying asset to withdraw
|
|
20
|
+
* @param maxIn Max amount of shares to burn for withdrawal
|
|
21
|
+
* @param vaultAddress Address of the ERC4626 vault
|
|
22
|
+
* @param from Address from which to pull the shares
|
|
23
|
+
* @param to Asset that will receive the underlying asset
|
|
24
|
+
*/
|
|
25
|
+
constructor(amount, maxIn, vaultAddress, from, to) {
|
|
26
|
+
super('TokenizedVaultAdapter', getAddr('TokenizedVaultAdapter'), ['uint256', 'uint256', 'address', 'address', 'address', 'uint8'], [amount, maxIn, vaultAddress, from, to, TokenizedVaultOperationId.WITHDRAW]);
|
|
27
|
+
}
|
|
28
|
+
getAssetsToApprove() {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
return [{ asset: this.args[2], owner: this.args[3] }];
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -16,5 +16,11 @@ export * from './GasFeeActionL2';
|
|
|
16
16
|
export * from './TransferNFTAction';
|
|
17
17
|
export * from './SendTokensAction';
|
|
18
18
|
export * from './CreateSubAction';
|
|
19
|
+
export * from './LSVSellAction';
|
|
20
|
+
export * from './ApproveTokenAction';
|
|
19
21
|
export * from './SDaiWrapAction';
|
|
20
22
|
export * from './SDaiUnwrapAction';
|
|
23
|
+
export * from './TokenizedVaultAdapterDepositAction';
|
|
24
|
+
export * from './TokenizedVaultAdapterMintAction';
|
|
25
|
+
export * from './TokenizedVaultAdapterRedeemAction';
|
|
26
|
+
export * from './TokenizedVaultAdapterWithdrawAction';
|
|
@@ -16,5 +16,11 @@ export * from './GasFeeActionL2';
|
|
|
16
16
|
export * from './TransferNFTAction';
|
|
17
17
|
export * from './SendTokensAction';
|
|
18
18
|
export * from './CreateSubAction';
|
|
19
|
+
export * from './LSVSellAction';
|
|
20
|
+
export * from './ApproveTokenAction';
|
|
19
21
|
export * from './SDaiWrapAction';
|
|
20
22
|
export * from './SDaiUnwrapAction';
|
|
23
|
+
export * from './TokenizedVaultAdapterDepositAction';
|
|
24
|
+
export * from './TokenizedVaultAdapterMintAction';
|
|
25
|
+
export * from './TokenizedVaultAdapterRedeemAction';
|
|
26
|
+
export * from './TokenizedVaultAdapterWithdrawAction';
|
|
@@ -23,6 +23,7 @@ import * as chickenBonds from './chickenBonds';
|
|
|
23
23
|
import * as compoundV3 from './compoundV3';
|
|
24
24
|
import * as morpho from './morpho';
|
|
25
25
|
import * as bprotocol from './bprotocol';
|
|
26
|
+
import * as lsv from './lsv';
|
|
26
27
|
import * as curveusd from './curveusd';
|
|
27
28
|
import * as spark from './spark';
|
|
28
|
-
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, spark, curveusd, };
|
|
29
|
+
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, };
|
package/esm/src/actions/index.js
CHANGED
|
@@ -23,6 +23,7 @@ import * as chickenBonds from './chickenBonds';
|
|
|
23
23
|
import * as compoundV3 from './compoundV3';
|
|
24
24
|
import * as morpho from './morpho';
|
|
25
25
|
import * as bprotocol from './bprotocol';
|
|
26
|
+
import * as lsv from './lsv';
|
|
26
27
|
import * as curveusd from './curveusd';
|
|
27
28
|
import * as spark from './spark';
|
|
28
|
-
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, spark, curveusd, };
|
|
29
|
+
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, };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { uint256, uint8 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* @category LSV
|
|
7
|
+
*/
|
|
8
|
+
export declare class LSVBorrowAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param protocol
|
|
11
|
+
* @param amount
|
|
12
|
+
*/
|
|
13
|
+
constructor(protocol: uint8, amount: uint256);
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* @category LSV
|
|
7
|
+
*/
|
|
8
|
+
export class LSVBorrowAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param protocol
|
|
11
|
+
* @param amount
|
|
12
|
+
*/
|
|
13
|
+
constructor(protocol, amount) {
|
|
14
|
+
super('LSVBorrow', getAddr('LSVBorrow'), ['uint256', 'uint256'], [protocol, amount]);
|
|
15
|
+
this.mappableArgs = [
|
|
16
|
+
this.args[1],
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { uint8, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @category LSV
|
|
6
|
+
*/
|
|
7
|
+
export declare class LSVPaybackAction extends Action {
|
|
8
|
+
/**
|
|
9
|
+
* @param protocol
|
|
10
|
+
* @param amount
|
|
11
|
+
*/
|
|
12
|
+
constructor(protocol: uint8, amount: uint256);
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @category LSV
|
|
6
|
+
*/
|
|
7
|
+
export class LSVPaybackAction extends Action {
|
|
8
|
+
/**
|
|
9
|
+
* @param protocol
|
|
10
|
+
* @param amount
|
|
11
|
+
*/
|
|
12
|
+
constructor(protocol, amount) {
|
|
13
|
+
super('LSVPayback', getAddr('LSVPayback'), ['uint256', 'uint256'], [protocol, amount]);
|
|
14
|
+
this.mappableArgs = [
|
|
15
|
+
this.args[1],
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256, uint8 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* @category LSV
|
|
7
|
+
*/
|
|
8
|
+
export declare class LSVSupplyAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param protocol
|
|
11
|
+
* @param token
|
|
12
|
+
* @param amount
|
|
13
|
+
*/
|
|
14
|
+
constructor(protocol: uint8, token: EthAddress, amount: uint256);
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* @category LSV
|
|
7
|
+
*/
|
|
8
|
+
export class LSVSupplyAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param protocol
|
|
11
|
+
* @param token
|
|
12
|
+
* @param amount
|
|
13
|
+
*/
|
|
14
|
+
constructor(protocol, token, amount) {
|
|
15
|
+
super('LSVSupply', getAddr('LSVSupply'), ['uint256', 'address', 'uint256'], [protocol, token, amount]);
|
|
16
|
+
this.mappableArgs = [
|
|
17
|
+
this.args[1],
|
|
18
|
+
this.args[2],
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256, uint8 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @category LSV
|
|
6
|
+
*/
|
|
7
|
+
export declare class LSVWithdrawAction extends Action {
|
|
8
|
+
/**
|
|
9
|
+
* @param protocol
|
|
10
|
+
* @param token
|
|
11
|
+
* @param amount
|
|
12
|
+
* @param isPositionClosing
|
|
13
|
+
*/
|
|
14
|
+
constructor(protocol: uint8, token: EthAddress, amount: uint256, isPositionClosing: boolean);
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @category LSV
|
|
6
|
+
*/
|
|
7
|
+
export class LSVWithdrawAction extends Action {
|
|
8
|
+
/**
|
|
9
|
+
* @param protocol
|
|
10
|
+
* @param token
|
|
11
|
+
* @param amount
|
|
12
|
+
* @param isPositionClosing
|
|
13
|
+
*/
|
|
14
|
+
constructor(protocol, token, amount, isPositionClosing) {
|
|
15
|
+
super('LSVWithdraw', getAddr('LSVWithdraw'), ['uint256', 'address', 'uint256', 'bool'], [protocol, token, amount, isPositionClosing]);
|
|
16
|
+
this.mappableArgs = [
|
|
17
|
+
this.args[1],
|
|
18
|
+
this.args[2],
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Action } from '../../../Action';
|
|
2
|
+
import { EthAddress, uint256 } from '../../../types';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @category MorphoAaveV3
|
|
6
|
+
*/
|
|
7
|
+
export declare class MorphoAaveV3SetManagerAction extends Action {
|
|
8
|
+
/**
|
|
9
|
+
* @param emodeId
|
|
10
|
+
* @param manager
|
|
11
|
+
* @param isAllowed
|
|
12
|
+
*/
|
|
13
|
+
constructor(emodeId: uint256, manager: EthAddress, isAllowed: boolean);
|
|
14
|
+
}
|