@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/types.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
type AccessListItem = {
|
|
1
|
+
declare type AccessListItem = {
|
|
2
2
|
address: EthAddress;
|
|
3
3
|
storageKeys: Array<any>;
|
|
4
4
|
};
|
|
5
|
-
type AccessList = Array<Array<any>>;
|
|
6
|
-
type AccessLists = {
|
|
5
|
+
declare type AccessList = Array<Array<any>>;
|
|
6
|
+
declare type AccessLists = {
|
|
7
7
|
[key: string]: AccessList;
|
|
8
8
|
};
|
|
9
|
-
type Config = {
|
|
9
|
+
declare type Config = {
|
|
10
10
|
chainId: number;
|
|
11
11
|
testingMode: boolean;
|
|
12
12
|
[key: string]: any;
|
|
13
13
|
};
|
|
14
|
-
type Network = {
|
|
14
|
+
declare type Network = {
|
|
15
15
|
chainId: number;
|
|
16
16
|
chainName: string;
|
|
17
17
|
blockExplorerUrls: Array<string>;
|
|
@@ -23,23 +23,23 @@ type Network = {
|
|
|
23
23
|
symbol: string;
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
|
-
type Networks = {
|
|
26
|
+
declare type Networks = {
|
|
27
27
|
ethereum: Network;
|
|
28
28
|
optimism: Network;
|
|
29
29
|
arbitrum: Network;
|
|
30
30
|
};
|
|
31
|
-
type EthAddress = string;
|
|
32
|
-
type bytes32 = string;
|
|
33
|
-
type bytes = string | Array<any>;
|
|
34
|
-
type uint256 = string;
|
|
35
|
-
type uint32 = string;
|
|
36
|
-
type uint160 = string;
|
|
37
|
-
type uint128 = string;
|
|
38
|
-
type uint80 = string;
|
|
39
|
-
type uint64 = string;
|
|
40
|
-
type uint24 = string;
|
|
41
|
-
type uint16 = string;
|
|
42
|
-
type uint8 = string;
|
|
43
|
-
type int256 = string;
|
|
44
|
-
type int24 = string;
|
|
31
|
+
declare type EthAddress = string;
|
|
32
|
+
declare type bytes32 = string;
|
|
33
|
+
declare type bytes = string | Array<any>;
|
|
34
|
+
declare type uint256 = string;
|
|
35
|
+
declare type uint32 = string;
|
|
36
|
+
declare type uint160 = string;
|
|
37
|
+
declare type uint128 = string;
|
|
38
|
+
declare type uint80 = string;
|
|
39
|
+
declare type uint64 = string;
|
|
40
|
+
declare type uint24 = string;
|
|
41
|
+
declare type uint16 = string;
|
|
42
|
+
declare type uint8 = string;
|
|
43
|
+
declare type int256 = string;
|
|
44
|
+
declare type int24 = string;
|
|
45
45
|
export { AccessList, AccessListItem, AccessLists, Config, Network, Networks, EthAddress, bytes32, bytes, uint256, uint160, uint32, uint128, uint80, uint64, uint24, uint16, uint8, int256, int24, };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export var TokenizedVaultOperationId;
|
|
2
|
+
(function (TokenizedVaultOperationId) {
|
|
3
|
+
TokenizedVaultOperationId[TokenizedVaultOperationId["DEPOSIT"] = 0] = "DEPOSIT";
|
|
4
|
+
TokenizedVaultOperationId[TokenizedVaultOperationId["MINT"] = 1] = "MINT";
|
|
5
|
+
TokenizedVaultOperationId[TokenizedVaultOperationId["WITHDRAW"] = 2] = "WITHDRAW";
|
|
6
|
+
TokenizedVaultOperationId[TokenizedVaultOperationId["REDEEM"] = 3] = "REDEEM";
|
|
7
|
+
})(TokenizedVaultOperationId || (TokenizedVaultOperationId = {}));
|
package/esm/src/utils/index.d.ts
CHANGED
|
@@ -5,4 +5,5 @@ import * as convexUtils from './convex-utils';
|
|
|
5
5
|
import mstableAssetPairs from './mstableAssetPairs';
|
|
6
6
|
import * as curveUtils from './curve-utils';
|
|
7
7
|
import * as curveusdUtils from './curveusd-utils';
|
|
8
|
-
|
|
8
|
+
import * as basicUtils from './basic-utils';
|
|
9
|
+
export { zeroExExchange, uniswapLP, uniswapV3LP, mstableAssetPairs, convexUtils, curveUtils, curveusdUtils, basicUtils, };
|
package/esm/src/utils/index.js
CHANGED
|
@@ -5,4 +5,5 @@ import * as convexUtils from './convex-utils';
|
|
|
5
5
|
import mstableAssetPairs from './mstableAssetPairs';
|
|
6
6
|
import * as curveUtils from './curve-utils';
|
|
7
7
|
import * as curveusdUtils from './curveusd-utils';
|
|
8
|
-
|
|
8
|
+
import * as basicUtils from './basic-utils';
|
|
9
|
+
export { zeroExExchange, uniswapLP, uniswapV3LP, mstableAssetPairs, convexUtils, curveUtils, curveusdUtils, basicUtils, };
|
package/package.json
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { requireAddress } from '../../utils/general';
|
|
3
|
+
import { getAddr } from '../../addresses';
|
|
4
|
+
import { EthAddress, uint256 } from '../../types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* AaveClaimAAVEAction - Claims AAVE from stkAave
|
|
8
|
+
*
|
|
9
|
+
* @category Aave
|
|
10
|
+
*/
|
|
11
|
+
export class AaveClaimAAVEAction extends Action {
|
|
12
|
+
/**
|
|
13
|
+
* @param amount - Amount to claim
|
|
14
|
+
* @param to - Address where claimed tokens will end up
|
|
15
|
+
*/
|
|
16
|
+
constructor(amount: uint256, to: EthAddress) {
|
|
17
|
+
requireAddress(to);
|
|
18
|
+
super(
|
|
19
|
+
'AaveClaimAAVE',
|
|
20
|
+
getAddr('AaveClaimAAVE'),
|
|
21
|
+
['uint256', 'address'],
|
|
22
|
+
[amount, to],
|
|
23
|
+
);
|
|
24
|
+
this.mappableArgs = [
|
|
25
|
+
this.args[1],
|
|
26
|
+
this.args[2],
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -5,4 +5,5 @@ export * from './AaveWithdrawAction';
|
|
|
5
5
|
export * from './AaveClaimStkAaveAction';
|
|
6
6
|
export * from './AaveCollateralSwitchAction';
|
|
7
7
|
export * from './AaveFinalizeUnstakeAction';
|
|
8
|
-
export * from './AaveStartUnstakeAction';
|
|
8
|
+
export * from './AaveStartUnstakeAction';
|
|
9
|
+
export * from './AaveClaimAAVEAction';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { requireAddress } from '../../utils/general';
|
|
3
|
+
import { getAddr } from '../../addresses';
|
|
4
|
+
import { EthAddress, uint256 } from '../../types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @category BasicActions
|
|
9
|
+
*/
|
|
10
|
+
export class ApproveTokenAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param token Token address
|
|
13
|
+
* @param spender
|
|
14
|
+
* @param amount Transfer amount (-1 for whole Recipe (DsProxy) balance)
|
|
15
|
+
*/
|
|
16
|
+
constructor(token: EthAddress, spender: EthAddress, amount:uint256) {
|
|
17
|
+
requireAddress(spender);
|
|
18
|
+
super(
|
|
19
|
+
'ApproveToken',
|
|
20
|
+
getAddr('ApproveToken'),
|
|
21
|
+
[
|
|
22
|
+
'address',
|
|
23
|
+
'address',
|
|
24
|
+
'uint',
|
|
25
|
+
],
|
|
26
|
+
[token, spender, amount],
|
|
27
|
+
);
|
|
28
|
+
this.mappableArgs = [
|
|
29
|
+
this.args[0],
|
|
30
|
+
this.args[1],
|
|
31
|
+
this.args[2],
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import AbiCoder from 'web3-eth-abi';
|
|
2
|
+
import { getAssetInfoByAddress } from '@defisaver/tokens';
|
|
3
|
+
import ActionAbi from '../../abis/Action.json';
|
|
4
|
+
import { ActionWithL2 } from '../../ActionWithL2';
|
|
5
|
+
import { requireAddress } from '../../utils/general';
|
|
6
|
+
import { getAddr } from '../../addresses';
|
|
7
|
+
import { EthAddress } from '../../types';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Sells token on DeFi Saver exchange aggregator without fee
|
|
11
|
+
*
|
|
12
|
+
* @category BasicActions
|
|
13
|
+
*/
|
|
14
|
+
export class LSVSellAction extends ActionWithL2 {
|
|
15
|
+
protocolFee:string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @param exchangeOrder Standard DFS Exchange data
|
|
19
|
+
* @param from Order sender
|
|
20
|
+
* @param to Order recipient
|
|
21
|
+
* @param protocolFee 0x fee (amount of ETH in Wei)
|
|
22
|
+
*/
|
|
23
|
+
constructor(exchangeOrder:Array<any>, from:EthAddress, to:EthAddress, protocolFee = '0') {
|
|
24
|
+
requireAddress(to);
|
|
25
|
+
super(
|
|
26
|
+
'LSVSell',
|
|
27
|
+
getAddr('LSVSell'),
|
|
28
|
+
[
|
|
29
|
+
['address', 'address', 'uint256', 'uint256', 'uint256', 'uint256', 'address', 'address', 'bytes', ['address', 'address', 'address', 'uint256', 'uint256', 'bytes']],
|
|
30
|
+
'address',
|
|
31
|
+
'address',
|
|
32
|
+
],
|
|
33
|
+
[exchangeOrder, from, to],
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
this.protocolFee = protocolFee;
|
|
37
|
+
|
|
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
|
+
|
|
47
|
+
encodeInputs() {
|
|
48
|
+
const executeActionDirectAbi: any = (ActionAbi.find(({ name }) => name === 'executeActionDirect'))!;
|
|
49
|
+
return AbiCoder.encodeFunctionCall(executeActionDirectAbi, this._encodeForCall());
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async getAssetsToApprove() {
|
|
53
|
+
const asset = getAssetInfoByAddress(this.args[0][0]);
|
|
54
|
+
if (asset.symbol !== 'ETH') return [{ asset: this.args[0][0], owner: this.args[1] }];
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async getEthValue() {
|
|
59
|
+
return this.protocolFee || '0';
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { uint256, EthAddress } from '../../types';
|
|
4
|
+
import { TokenizedVaultOperationId } from '../../utils/basic-utils';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* TokenizedVaultAdapterDepositAction - Action that handles ERC4626 vault deposits
|
|
8
|
+
* @category BasicActions
|
|
9
|
+
*/
|
|
10
|
+
export class TokenizedVaultAdapterDepositAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param amount Amount of underlying asset to deposit
|
|
13
|
+
* @param minOut Min amount of shares to accept
|
|
14
|
+
* @param vaultAddress Address of the ERC4626 vault
|
|
15
|
+
* @param from Address from which to pull the underlying asset
|
|
16
|
+
* @param to Asset that will receive the minted shares
|
|
17
|
+
* @param underlyingAssetAddress Address of the underlying vault asset, only used in sdk for approvals
|
|
18
|
+
*/
|
|
19
|
+
constructor(
|
|
20
|
+
amount: uint256,
|
|
21
|
+
minOut: uint256,
|
|
22
|
+
vaultAddress: EthAddress,
|
|
23
|
+
from: EthAddress,
|
|
24
|
+
to: EthAddress,
|
|
25
|
+
public underlyingAssetAddress: EthAddress,
|
|
26
|
+
) {
|
|
27
|
+
super(
|
|
28
|
+
'TokenizedVaultAdapter',
|
|
29
|
+
getAddr('TokenizedVaultAdapter'),
|
|
30
|
+
['uint256', 'uint256', 'address', 'address', 'address', 'uint8'],
|
|
31
|
+
[amount, minOut, vaultAddress, from, to, TokenizedVaultOperationId.DEPOSIT],
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async getAssetsToApprove() {
|
|
36
|
+
return [{ asset: this.underlyingAssetAddress, owner: this.args[3] }];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { uint256, EthAddress } from '../../types';
|
|
4
|
+
import { TokenizedVaultOperationId } from '../../utils/basic-utils';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* TokenizedVaultAdapterMintAction - Action that handles ERC4626 vault minting
|
|
8
|
+
* @category BasicActions
|
|
9
|
+
*/
|
|
10
|
+
export class TokenizedVaultAdapterMintAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param amount Amount of shares to mint
|
|
13
|
+
* @param maxIn Max amount of underlying asset to deposit for minting
|
|
14
|
+
* @param vaultAddress Address of the ERC4626 vault
|
|
15
|
+
* @param from Address from which to pull the underlying asset
|
|
16
|
+
* @param to Asset that will receive the shares minted
|
|
17
|
+
* @param underlyingAssetAddress Address of the underlying vault asset, only used in sdk for approvals
|
|
18
|
+
*/
|
|
19
|
+
constructor(
|
|
20
|
+
amount: uint256,
|
|
21
|
+
maxIn: uint256,
|
|
22
|
+
vaultAddress: EthAddress,
|
|
23
|
+
from: EthAddress,
|
|
24
|
+
to: EthAddress,
|
|
25
|
+
public underlyingAssetAddress: EthAddress,
|
|
26
|
+
) {
|
|
27
|
+
super(
|
|
28
|
+
'TokenizedVaultAdapter',
|
|
29
|
+
getAddr('TokenizedVaultAdapter'),
|
|
30
|
+
['uint256', 'uint256', 'address', 'address', 'address', 'uint8'],
|
|
31
|
+
[amount, maxIn, vaultAddress, from, to, TokenizedVaultOperationId.MINT],
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async getAssetsToApprove() {
|
|
36
|
+
return [{ asset: this.underlyingAssetAddress, owner: this.args[3] }];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { uint256, EthAddress } from '../../types';
|
|
4
|
+
import { TokenizedVaultOperationId } from '../../utils/basic-utils';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* TokenizedVaultAdapterRedeemAction - Action that handles ERC4626 vault redemptions
|
|
8
|
+
* @category BasicActions
|
|
9
|
+
*/
|
|
10
|
+
export class TokenizedVaultAdapterRedeemAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param amount Amount of shares to redeem
|
|
13
|
+
* @param minOut Min amount of underlying asset to accept for the shares burned
|
|
14
|
+
* @param vaultAddress Address of the ERC4626 vault
|
|
15
|
+
* @param from Address from which to pull the shares
|
|
16
|
+
* @param to Asset that will receive the underlying asset
|
|
17
|
+
*/
|
|
18
|
+
constructor(
|
|
19
|
+
amount: uint256,
|
|
20
|
+
minOut: uint256,
|
|
21
|
+
vaultAddress: EthAddress,
|
|
22
|
+
from: EthAddress,
|
|
23
|
+
to: EthAddress,
|
|
24
|
+
) {
|
|
25
|
+
super(
|
|
26
|
+
'TokenizedVaultAdapter',
|
|
27
|
+
getAddr('TokenizedVaultAdapter'),
|
|
28
|
+
['uint256', 'uint256', 'address', 'address', 'address', 'uint8'],
|
|
29
|
+
[amount, minOut, vaultAddress, from, to, TokenizedVaultOperationId.REDEEM],
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async getAssetsToApprove() {
|
|
34
|
+
return [{ asset: this.args[2], owner: this.args[3] }];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { uint256, EthAddress } from '../../types';
|
|
4
|
+
import { TokenizedVaultOperationId } from '../../utils/basic-utils';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* TokenizedVaultAdapterWithdrawAction - Action that handles ERC4626 vault withdrawals
|
|
8
|
+
* @category BasicActions
|
|
9
|
+
*/
|
|
10
|
+
export class TokenizedVaultAdapterWithdrawAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param amount Amount of underlying asset to withdraw
|
|
13
|
+
* @param maxIn Max amount of shares to burn for withdrawal
|
|
14
|
+
* @param vaultAddress Address of the ERC4626 vault
|
|
15
|
+
* @param from Address from which to pull the shares
|
|
16
|
+
* @param to Asset that will receive the underlying asset
|
|
17
|
+
*/
|
|
18
|
+
constructor(
|
|
19
|
+
amount: uint256,
|
|
20
|
+
maxIn: uint256,
|
|
21
|
+
vaultAddress: EthAddress,
|
|
22
|
+
from: EthAddress,
|
|
23
|
+
to: EthAddress,
|
|
24
|
+
) {
|
|
25
|
+
super(
|
|
26
|
+
'TokenizedVaultAdapter',
|
|
27
|
+
getAddr('TokenizedVaultAdapter'),
|
|
28
|
+
['uint256', 'uint256', 'address', 'address', 'address', 'uint8'],
|
|
29
|
+
[amount, maxIn, vaultAddress, from, to, TokenizedVaultOperationId.WITHDRAW],
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async getAssetsToApprove() {
|
|
34
|
+
return [{ asset: this.args[2], owner: this.args[3] }];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -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';
|
package/src/actions/index.ts
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
29
|
|
|
@@ -52,6 +53,7 @@ export {
|
|
|
52
53
|
compoundV3,
|
|
53
54
|
morpho,
|
|
54
55
|
bprotocol,
|
|
56
|
+
lsv,
|
|
55
57
|
spark,
|
|
56
58
|
curveusd,
|
|
57
59
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, uint256, uint8 } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* @category LSV
|
|
9
|
+
*/
|
|
10
|
+
export class LSVBorrowAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param protocol
|
|
13
|
+
* @param amount
|
|
14
|
+
*/
|
|
15
|
+
constructor(protocol:uint8, amount:uint256) {
|
|
16
|
+
super('LSVBorrow', getAddr('LSVBorrow'), ['uint256', 'uint256'], [protocol, amount]);
|
|
17
|
+
this.mappableArgs = [
|
|
18
|
+
this.args[1],
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { uint8, uint256 } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @category LSV
|
|
8
|
+
*/
|
|
9
|
+
export class LSVPaybackAction extends Action {
|
|
10
|
+
/**
|
|
11
|
+
* @param protocol
|
|
12
|
+
* @param amount
|
|
13
|
+
*/
|
|
14
|
+
constructor(protocol:uint8, amount:uint256) {
|
|
15
|
+
super('LSVPayback', getAddr('LSVPayback'), ['uint256', 'uint256'], [protocol, amount]);
|
|
16
|
+
this.mappableArgs = [
|
|
17
|
+
this.args[1],
|
|
18
|
+
];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, uint256, uint8 } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* @category LSV
|
|
9
|
+
*/
|
|
10
|
+
export class LSVSupplyAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param protocol
|
|
13
|
+
* @param token
|
|
14
|
+
* @param amount
|
|
15
|
+
*/
|
|
16
|
+
constructor(protocol:uint8, token:EthAddress, amount:uint256) {
|
|
17
|
+
super('LSVSupply', getAddr('LSVSupply'), ['uint256', 'address', 'uint256'], [protocol, token, amount]);
|
|
18
|
+
this.mappableArgs = [
|
|
19
|
+
this.args[1],
|
|
20
|
+
this.args[2],
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, uint256, uint8 } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @category LSV
|
|
8
|
+
*/
|
|
9
|
+
export class LSVWithdrawAction extends Action {
|
|
10
|
+
/**
|
|
11
|
+
* @param protocol
|
|
12
|
+
* @param token
|
|
13
|
+
* @param amount
|
|
14
|
+
* @param isPositionClosing
|
|
15
|
+
*/
|
|
16
|
+
constructor(protocol:uint8, token:EthAddress, amount:uint256, isPositionClosing:boolean) {
|
|
17
|
+
super('LSVWithdraw', getAddr('LSVWithdraw'), ['uint256', 'address', 'uint256', 'bool'], [protocol, token, amount, isPositionClosing]);
|
|
18
|
+
this.mappableArgs = [
|
|
19
|
+
this.args[1],
|
|
20
|
+
this.args[2],
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Action } from '../../../Action';
|
|
2
|
+
import { getAddr } from '../../../addresses';
|
|
3
|
+
import { EthAddress, uint256 } from '../../../types';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @category MorphoAaveV3
|
|
9
|
+
*/
|
|
10
|
+
export class MorphoAaveV3SetManagerAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param emodeId
|
|
13
|
+
* @param manager
|
|
14
|
+
* @param isAllowed
|
|
15
|
+
*/
|
|
16
|
+
constructor(emodeId: uint256, manager: EthAddress, isAllowed:boolean) {
|
|
17
|
+
super(
|
|
18
|
+
'MorphoAaveV3SetManager',
|
|
19
|
+
getAddr('MorphoAaveV3SetManager'),
|
|
20
|
+
[
|
|
21
|
+
'uint256',
|
|
22
|
+
'address',
|
|
23
|
+
'bool',
|
|
24
|
+
],
|
|
25
|
+
[emodeId, manager, isAllowed],
|
|
26
|
+
);
|
|
27
|
+
this.mappableArgs = [
|
|
28
|
+
this.args[0],
|
|
29
|
+
this.args[1],
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
}
|
package/src/addresses.ts
CHANGED
|
@@ -18,8 +18,10 @@ export const actionAddresses = {
|
|
|
18
18
|
UpdateSub: '0xF6Cb8f7e61a64075ec8FAC3f298745605E543233',
|
|
19
19
|
TransferNFT: '0x861e893E1796F81248e75F06C0b09Abdc8fe2f6F',
|
|
20
20
|
CreateSub: '0x7308e88BB21B934478E75bB6A2143b8cfDFf2961',
|
|
21
|
+
ApproveToken: '0xA4161cED7A29F0a3424e464a4a2dBf75888c5BF9',
|
|
21
22
|
SDaiWrap: '0xac7Ac294F29d818D26Bd9DF86d36904B1Ed346Ae',
|
|
22
23
|
SDaiUnwrap: '0xe8Cb536BB96075241c4bd8f1831A8577562F2B32',
|
|
24
|
+
TokenizedVaultAdapter: '0x3944364Ce3a273D269707484F3a676fCa17E08b8',
|
|
23
25
|
|
|
24
26
|
// exchange
|
|
25
27
|
DFSSell: '0x951D7B421f45FF0e4A8ddE0288aE3f9C2C69b784',
|
|
@@ -55,7 +57,7 @@ export const actionAddresses = {
|
|
|
55
57
|
AaveWithdraw: '0x754C58fA92246414a448c1ed44ea3D1AD446d482',
|
|
56
58
|
AaveCollateralSwitch: '0xFf5dfF1B90bd5Aa6E12768AB497dB90cc9DE6F5d',
|
|
57
59
|
AaveUnstake: '0x2FE4024e350cD2c64D2fd0Db5d16F5cE54Ca0E09',
|
|
58
|
-
|
|
60
|
+
AaveClaimAAVE: '0xd52855bD011F3D87565f9040DdE2A59fB1b27b15',
|
|
59
61
|
// aave v3
|
|
60
62
|
AaveV3Withdraw: '0x9D4e4b26A5E2e6Dad30C5d95F5cE78A8310F04C2',
|
|
61
63
|
AaveV3SwapBorrowRateMode: '0x630F530Ac523C935cf2528E62D0A06F8900C5b1B',
|
|
@@ -68,6 +70,13 @@ export const actionAddresses = {
|
|
|
68
70
|
AaveV3ATokenPayback: '0xDe5c012cd1878D86E91309593764895a3adb380E',
|
|
69
71
|
AaveV3View: '0x9ECB0645b357fDD7B92789B91595160862Bd45d0',
|
|
70
72
|
|
|
73
|
+
// LSV action
|
|
74
|
+
LSVWithdraw: '0x0A4Ef5ADf759064b546441a50109eCbC2528A455',
|
|
75
|
+
LSVBorrow: '0x7dFB434527Fdb39854156cDBa9bF4799E36E7e82',
|
|
76
|
+
LSVSupply: '0x984c00DC098c98bed1CDfe2Ed786Fe1443da6671',
|
|
77
|
+
LSVPayback: '0x10749CE97583dBcEb54a083386CC8438C4e0FE65',
|
|
78
|
+
LSVSell: '0x0c1bb9A39d4A0EF4215Ade19Ce4F954E8419Dfd7',
|
|
79
|
+
|
|
71
80
|
// morpho aave v2
|
|
72
81
|
MorphoAaveV2Borrow: '0xa85C3E41Bf9F75a381927e1Aa9b00f77C4631109',
|
|
73
82
|
MorphoAaveV2Payback: '0x5dd0E0835acbb08aa4A4599d70fB2d93969fa7b7',
|
|
@@ -80,6 +89,7 @@ export const actionAddresses = {
|
|
|
80
89
|
MorphoAaveV3Payback: '0x36b8b968c81D97cBfAa642e206b634A6f378d287',
|
|
81
90
|
MorphoAaveV3Supply: '0x51fA8FBc6F0aDEfe2FBA06104FCA39f5beD69291',
|
|
82
91
|
MorphoAaveV3Withdraw: '0xdc3e74C4cD577275296ceFE36A3D082223AfF206',
|
|
92
|
+
MorphoAaveV3SetManager: '0x1082AE0565504E3617BD5b6E80f91B59b81a82D9',
|
|
83
93
|
|
|
84
94
|
// spark
|
|
85
95
|
SparkBorrow: '0x3E2C366065bA0f6f9936C2C6A802D72F250b27AA',
|
|
@@ -242,7 +252,7 @@ export const actionAddresses = {
|
|
|
242
252
|
SendTokenAndUnwrap: '0x8000174366066923D554cb466e190258A6FF3b1f',
|
|
243
253
|
ToggleSub: '0x988C5C24AE6348404196267e19962f36961CAc29',
|
|
244
254
|
TokenBalance: '0xC6FF5b01f7c7b35b6e093fF70D2332B361C5Be5A',
|
|
245
|
-
|
|
255
|
+
TokenizedVaultAdapter: '0xdf31669FEd440f5BfF658ca0bBF0D22B8abdeb73',
|
|
246
256
|
|
|
247
257
|
// aave v3
|
|
248
258
|
AaveV3ATokenPayback: '0x71B27114D1777298bD46c3770C42F9f807C49847',
|
|
@@ -284,6 +294,7 @@ export const actionAddresses = {
|
|
|
284
294
|
SendTokenAndUnwrap: '0x0fb867A5Ee1CA9426D3dAb95e613Be166218b977',
|
|
285
295
|
ToggleSub: '0x71015226EADFd4aC887fB56556F64338e352439b',
|
|
286
296
|
TokenBalance: '0x483B903E702F60698Dd8124558C6199922737f1F',
|
|
297
|
+
TokenizedVaultAdapter: '0xD05C512bDFf6D3eAc5328807B3bC075F35271167',
|
|
287
298
|
|
|
288
299
|
// aave v3
|
|
289
300
|
AaveV3ATokenPayback: '0x261906e5E0D0D38D9cBb5c10dB9c4031aabdf8C1',
|
package/src/utils/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ import * as convexUtils from './convex-utils';
|
|
|
5
5
|
import mstableAssetPairs from './mstableAssetPairs';
|
|
6
6
|
import * as curveUtils from './curve-utils';
|
|
7
7
|
import * as curveusdUtils from './curveusd-utils';
|
|
8
|
+
import * as basicUtils from './basic-utils';
|
|
8
9
|
|
|
9
10
|
export {
|
|
10
11
|
zeroExExchange,
|
|
@@ -14,4 +15,5 @@ export {
|
|
|
14
15
|
convexUtils,
|
|
15
16
|
curveUtils,
|
|
16
17
|
curveusdUtils,
|
|
18
|
+
basicUtils,
|
|
17
19
|
};
|