@defisaver/sdk 1.2.19 → 1.2.20-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/actions/fluid/FluidVaultT1OpenAction.d.ts +7 -1
- package/esm/src/actions/fluid/FluidVaultT1OpenAction.js +21 -1
- package/esm/src/actions/fluid/FluidVaultT1PaybackAction.d.ts +7 -1
- package/esm/src/actions/fluid/FluidVaultT1PaybackAction.js +21 -1
- package/esm/src/actions/fluid/FluidVaultT1SupplyAction.d.ts +7 -1
- package/esm/src/actions/fluid/FluidVaultT1SupplyAction.js +21 -1
- package/esm/src/actions/morpho-blue/MorphoBlueClaimAction.d.ts +17 -0
- package/esm/src/actions/morpho-blue/MorphoBlueClaimAction.js +19 -0
- package/esm/src/actions/morpho-blue/index.d.ts +1 -0
- package/esm/src/actions/morpho-blue/index.js +1 -0
- package/esm/src/addresses.d.ts +4 -0
- package/esm/src/addresses.js +2 -0
- package/esm/src/index.d.ts +16 -0
- package/package.json +1 -1
- package/src/actions/fluid/FluidVaultT1OpenAction.ts +12 -0
- package/src/actions/fluid/FluidVaultT1PaybackAction.ts +12 -0
- package/src/actions/fluid/FluidVaultT1SupplyAction.ts +12 -0
- package/src/actions/morpho-blue/MorphoBlueClaimAction.ts +32 -0
- package/src/actions/morpho-blue/index.ts +2 -1
- package/src/addresses.ts +2 -0
- package/test/actions/morpho-blue/MorphoBlueClaimAction.js +46 -0
- package/umd/index.js +299 -198
|
@@ -6,6 +6,7 @@ import { EthAddress, uint256 } from '../../types';
|
|
|
6
6
|
* @category Fluid
|
|
7
7
|
*/
|
|
8
8
|
export declare class FluidVaultT1OpenAction extends Action {
|
|
9
|
+
tokenForApproval: EthAddress;
|
|
9
10
|
/**
|
|
10
11
|
* @param vault The address of the Fluid Vault T1
|
|
11
12
|
* @param collAmount Amount of collateral to deposit.
|
|
@@ -13,6 +14,11 @@ export declare class FluidVaultT1OpenAction extends Action {
|
|
|
13
14
|
* @param from Address to pull the collateral from.
|
|
14
15
|
* @param to Address to send the borrowed assets to.
|
|
15
16
|
* @param wrapBorrowedEth Whether to wrap the borrowed ETH into WETH if the borrowed asset is ETH.
|
|
17
|
+
* @param collToken Address of the collateral token.
|
|
16
18
|
*/
|
|
17
|
-
constructor(vault: EthAddress, collAmount: uint256, debtAmount: uint256, from: EthAddress, to: EthAddress, wrapBorrowedEth: boolean);
|
|
19
|
+
constructor(vault: EthAddress, collAmount: uint256, debtAmount: uint256, from: EthAddress, to: EthAddress, wrapBorrowedEth: boolean, collToken: EthAddress);
|
|
20
|
+
getAssetsToApprove(): Promise<{
|
|
21
|
+
asset: string;
|
|
22
|
+
owner: any;
|
|
23
|
+
}[]>;
|
|
18
24
|
}
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { getAssetInfoByAddress } from '@defisaver/tokens';
|
|
1
11
|
import { Action } from '../../Action';
|
|
2
12
|
import { getAddr } from '../../addresses';
|
|
3
13
|
/**
|
|
@@ -13,8 +23,9 @@ export class FluidVaultT1OpenAction extends Action {
|
|
|
13
23
|
* @param from Address to pull the collateral from.
|
|
14
24
|
* @param to Address to send the borrowed assets to.
|
|
15
25
|
* @param wrapBorrowedEth Whether to wrap the borrowed ETH into WETH if the borrowed asset is ETH.
|
|
26
|
+
* @param collToken Address of the collateral token.
|
|
16
27
|
*/
|
|
17
|
-
constructor(vault, collAmount, debtAmount, from, to, wrapBorrowedEth) {
|
|
28
|
+
constructor(vault, collAmount, debtAmount, from, to, wrapBorrowedEth, collToken) {
|
|
18
29
|
super('FluidVaultT1Open', getAddr('FluidVaultT1Open'), ['address', 'uint256', 'uint256', 'address', 'address', 'bool'], [vault, collAmount, debtAmount, from, to, wrapBorrowedEth]);
|
|
19
30
|
this.mappableArgs = [
|
|
20
31
|
this.args[0],
|
|
@@ -24,5 +35,14 @@ export class FluidVaultT1OpenAction extends Action {
|
|
|
24
35
|
this.args[4],
|
|
25
36
|
this.args[5],
|
|
26
37
|
];
|
|
38
|
+
this.tokenForApproval = collToken;
|
|
39
|
+
}
|
|
40
|
+
getAssetsToApprove() {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
const asset = getAssetInfoByAddress(this.tokenForApproval);
|
|
43
|
+
if (asset.symbol !== 'ETH')
|
|
44
|
+
return [{ asset: this.tokenForApproval, owner: this.args[3] }];
|
|
45
|
+
return [];
|
|
46
|
+
});
|
|
27
47
|
}
|
|
28
48
|
}
|
|
@@ -6,11 +6,17 @@ import { EthAddress, uint256 } from '../../types';
|
|
|
6
6
|
* @category Fluid
|
|
7
7
|
*/
|
|
8
8
|
export declare class FluidVaultT1PaybackAction extends Action {
|
|
9
|
+
tokenForApproval: EthAddress;
|
|
9
10
|
/**
|
|
10
11
|
* @param vault The address of the Fluid Vault T1
|
|
11
12
|
* @param nftId ID of the NFT representing the position
|
|
12
13
|
* @param amount Amount to payback
|
|
13
14
|
* @param from Address to pull the tokens from
|
|
15
|
+
* @param debtToken Address of the debt token
|
|
14
16
|
*/
|
|
15
|
-
constructor(vault: EthAddress, nftId: uint256, amount: uint256, from: EthAddress);
|
|
17
|
+
constructor(vault: EthAddress, nftId: uint256, amount: uint256, from: EthAddress, debtToken: EthAddress);
|
|
18
|
+
getAssetsToApprove(): Promise<{
|
|
19
|
+
asset: string;
|
|
20
|
+
owner: any;
|
|
21
|
+
}[]>;
|
|
16
22
|
}
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { getAssetInfoByAddress } from '@defisaver/tokens';
|
|
1
11
|
import { Action } from '../../Action';
|
|
2
12
|
import { getAddr } from '../../addresses';
|
|
3
13
|
/**
|
|
@@ -11,8 +21,9 @@ export class FluidVaultT1PaybackAction extends Action {
|
|
|
11
21
|
* @param nftId ID of the NFT representing the position
|
|
12
22
|
* @param amount Amount to payback
|
|
13
23
|
* @param from Address to pull the tokens from
|
|
24
|
+
* @param debtToken Address of the debt token
|
|
14
25
|
*/
|
|
15
|
-
constructor(vault, nftId, amount, from) {
|
|
26
|
+
constructor(vault, nftId, amount, from, debtToken) {
|
|
16
27
|
super('FluidVaultT1Payback', getAddr('FluidVaultT1Payback'), ['address', 'uint256', 'uint256', 'address'], [vault, nftId, amount, from]);
|
|
17
28
|
this.mappableArgs = [
|
|
18
29
|
this.args[0],
|
|
@@ -20,5 +31,14 @@ export class FluidVaultT1PaybackAction extends Action {
|
|
|
20
31
|
this.args[2],
|
|
21
32
|
this.args[3],
|
|
22
33
|
];
|
|
34
|
+
this.tokenForApproval = debtToken;
|
|
35
|
+
}
|
|
36
|
+
getAssetsToApprove() {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
const asset = getAssetInfoByAddress(this.tokenForApproval);
|
|
39
|
+
if (asset.symbol !== 'ETH')
|
|
40
|
+
return [{ asset: this.tokenForApproval, owner: this.args[3] }];
|
|
41
|
+
return [];
|
|
42
|
+
});
|
|
23
43
|
}
|
|
24
44
|
}
|
|
@@ -6,11 +6,17 @@ import { EthAddress, uint256 } from '../../types';
|
|
|
6
6
|
* @category Fluid
|
|
7
7
|
*/
|
|
8
8
|
export declare class FluidVaultT1SupplyAction extends Action {
|
|
9
|
+
tokenForApproval: EthAddress;
|
|
9
10
|
/**
|
|
10
11
|
* @param vault The address of the Fluid Vault T1
|
|
11
12
|
* @param nftId ID of the NFT representing the position
|
|
12
13
|
* @param amount Amount to supply
|
|
13
14
|
* @param from Address to pull the tokens from
|
|
15
|
+
* @param collToken Address of the collateral token
|
|
14
16
|
*/
|
|
15
|
-
constructor(vault: EthAddress, nftId: uint256, amount: uint256, from: EthAddress);
|
|
17
|
+
constructor(vault: EthAddress, nftId: uint256, amount: uint256, from: EthAddress, collToken: EthAddress);
|
|
18
|
+
getAssetsToApprove(): Promise<{
|
|
19
|
+
asset: string;
|
|
20
|
+
owner: any;
|
|
21
|
+
}[]>;
|
|
16
22
|
}
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { getAssetInfoByAddress } from '@defisaver/tokens';
|
|
1
11
|
import { Action } from '../../Action';
|
|
2
12
|
import { getAddr } from '../../addresses';
|
|
3
13
|
/**
|
|
@@ -11,8 +21,9 @@ export class FluidVaultT1SupplyAction extends Action {
|
|
|
11
21
|
* @param nftId ID of the NFT representing the position
|
|
12
22
|
* @param amount Amount to supply
|
|
13
23
|
* @param from Address to pull the tokens from
|
|
24
|
+
* @param collToken Address of the collateral token
|
|
14
25
|
*/
|
|
15
|
-
constructor(vault, nftId, amount, from) {
|
|
26
|
+
constructor(vault, nftId, amount, from, collToken) {
|
|
16
27
|
super('FluidVaultT1Supply', getAddr('FluidVaultT1Supply'), ['address', 'uint256', 'uint256', 'address'], [vault, nftId, amount, from]);
|
|
17
28
|
this.mappableArgs = [
|
|
18
29
|
this.args[0],
|
|
@@ -20,5 +31,14 @@ export class FluidVaultT1SupplyAction extends Action {
|
|
|
20
31
|
this.args[2],
|
|
21
32
|
this.args[3],
|
|
22
33
|
];
|
|
34
|
+
this.tokenForApproval = collToken;
|
|
35
|
+
}
|
|
36
|
+
getAssetsToApprove() {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
const asset = getAssetInfoByAddress(this.tokenForApproval);
|
|
39
|
+
if (asset.symbol !== 'ETH')
|
|
40
|
+
return [{ asset: this.tokenForApproval, owner: this.args[3] }];
|
|
41
|
+
return [];
|
|
42
|
+
});
|
|
23
43
|
}
|
|
24
44
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { bytes32, EthAddress, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* MorphoBlueClaimAction - Claim rewards for MorphoBlue users
|
|
5
|
+
*
|
|
6
|
+
* @category MorphoBlue
|
|
7
|
+
*/
|
|
8
|
+
export declare class MorphoBlueClaimAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param to The address to which to send the reward tokens. Only used if claiming for the smart wallet.
|
|
11
|
+
* @param token The address of the token to claim.
|
|
12
|
+
* @param distributor The address of the morpho distributor contract.
|
|
13
|
+
* @param claimable The overall claimable amount of token rewards.
|
|
14
|
+
* @param merkleProof The merkle proof to claim the rewards.
|
|
15
|
+
*/
|
|
16
|
+
constructor(to: EthAddress, token: EthAddress, distributor: EthAddress, claimable: uint256, merkleProof: Array<bytes32>);
|
|
17
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* MorphoBlueClaimAction - Claim rewards for MorphoBlue users
|
|
5
|
+
*
|
|
6
|
+
* @category MorphoBlue
|
|
7
|
+
*/
|
|
8
|
+
export class MorphoBlueClaimAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param to The address to which to send the reward tokens. Only used if claiming for the smart wallet.
|
|
11
|
+
* @param token The address of the token to claim.
|
|
12
|
+
* @param distributor The address of the morpho distributor contract.
|
|
13
|
+
* @param claimable The overall claimable amount of token rewards.
|
|
14
|
+
* @param merkleProof The merkle proof to claim the rewards.
|
|
15
|
+
*/
|
|
16
|
+
constructor(to, token, distributor, claimable, merkleProof) {
|
|
17
|
+
super('MorphoBlueClaim', getAddr('MorphoBlueClaim'), ['address', 'address', 'address', 'uint256', 'bytes32[]'], [to, token, distributor, claimable, merkleProof]);
|
|
18
|
+
}
|
|
19
|
+
}
|
package/esm/src/addresses.d.ts
CHANGED
|
@@ -223,6 +223,7 @@ export declare const actionAddresses: {
|
|
|
223
223
|
MorphoBlueSetAuthWithSig: string;
|
|
224
224
|
MorphoTokenWrap: string;
|
|
225
225
|
MorphoBlueReallocateLiquidity: string;
|
|
226
|
+
MorphoBlueClaim: string;
|
|
226
227
|
LlamaLendCreate: string;
|
|
227
228
|
LlamaLendSupply: string;
|
|
228
229
|
LlamaLendBorrow: string;
|
|
@@ -485,6 +486,7 @@ export declare const actionAddresses: {
|
|
|
485
486
|
MorphoBlueSetAuthWithSig?: undefined;
|
|
486
487
|
MorphoTokenWrap?: undefined;
|
|
487
488
|
MorphoBlueReallocateLiquidity?: undefined;
|
|
489
|
+
MorphoBlueClaim?: undefined;
|
|
488
490
|
LlamaLendCreate?: undefined;
|
|
489
491
|
LlamaLendSupply?: undefined;
|
|
490
492
|
LlamaLendBorrow?: undefined;
|
|
@@ -759,6 +761,7 @@ export declare const actionAddresses: {
|
|
|
759
761
|
MorphoBlueSetAuthWithSig?: undefined;
|
|
760
762
|
MorphoTokenWrap?: undefined;
|
|
761
763
|
MorphoBlueReallocateLiquidity?: undefined;
|
|
764
|
+
MorphoBlueClaim?: undefined;
|
|
762
765
|
EulerV2Supply?: undefined;
|
|
763
766
|
EulerV2Withdraw?: undefined;
|
|
764
767
|
EulerV2Borrow?: undefined;
|
|
@@ -827,6 +830,7 @@ export declare const actionAddresses: {
|
|
|
827
830
|
MorphoBlueSetAuthWithSig: string;
|
|
828
831
|
MorphoBlueView: string;
|
|
829
832
|
MorphoBlueReallocateLiquidity: string;
|
|
833
|
+
MorphoBlueClaim: string;
|
|
830
834
|
FluidVaultT1Open: string;
|
|
831
835
|
FluidVaultT1Adjust: string;
|
|
832
836
|
FluidVaultT1Borrow: string;
|
package/esm/src/addresses.js
CHANGED
|
@@ -255,6 +255,7 @@ export const actionAddresses = {
|
|
|
255
255
|
MorphoBlueSetAuthWithSig: '0xE2d5fCDBf73BAd24A0FCAf6B2733933A98021808',
|
|
256
256
|
MorphoTokenWrap: '0x71b6d268c2Aabcb0dA16CbA4c77e65d9e29b0644',
|
|
257
257
|
MorphoBlueReallocateLiquidity: '0x17cCA8194602020e855CC8Bc11ffA82d8F998A93',
|
|
258
|
+
MorphoBlueClaim: '0xBB562a790AD7773D54A423bD2A10E4073cb98142',
|
|
258
259
|
// llamalend
|
|
259
260
|
LlamaLendCreate: '0x4349be191ea63173eD98b7fC1b0DeC1ef9Bc6c11',
|
|
260
261
|
LlamaLendSupply: '0x1900eF943bD1b038c58d9F35C3825F119F9BB730',
|
|
@@ -476,6 +477,7 @@ export const actionAddresses = {
|
|
|
476
477
|
MorphoBlueSetAuthWithSig: '0x80be65342f6172a6cd0b6a2653e8a887e3f46cab',
|
|
477
478
|
MorphoBlueView: '0xdbcacf59c5063da8b15481f88e7d70e13c92f2a1',
|
|
478
479
|
MorphoBlueReallocateLiquidity: '0x5Ea7F30E40F6A25BE2aD23A6FC1C31A6c95F3dc8',
|
|
480
|
+
MorphoBlueClaim: '0xE279E9100d6d524602f98E8736BA5F8f065Dd3e0',
|
|
479
481
|
// fluid
|
|
480
482
|
FluidVaultT1Open: '0xCd4d5896AEAf97e738d3E7215ac01c2CF97474bc',
|
|
481
483
|
FluidVaultT1Adjust: '0x93bFBf44b87be48D46b25Fe0C7F549A79Ca05167',
|
package/esm/src/index.d.ts
CHANGED
|
@@ -234,6 +234,7 @@ declare const actionAddressesAllChains: {
|
|
|
234
234
|
MorphoBlueSetAuthWithSig: string;
|
|
235
235
|
MorphoTokenWrap: string;
|
|
236
236
|
MorphoBlueReallocateLiquidity: string;
|
|
237
|
+
MorphoBlueClaim: string;
|
|
237
238
|
LlamaLendCreate: string;
|
|
238
239
|
LlamaLendSupply: string;
|
|
239
240
|
LlamaLendBorrow: string;
|
|
@@ -496,6 +497,7 @@ declare const actionAddressesAllChains: {
|
|
|
496
497
|
MorphoBlueSetAuthWithSig?: undefined;
|
|
497
498
|
MorphoTokenWrap?: undefined;
|
|
498
499
|
MorphoBlueReallocateLiquidity?: undefined;
|
|
500
|
+
MorphoBlueClaim?: undefined;
|
|
499
501
|
LlamaLendCreate?: undefined;
|
|
500
502
|
LlamaLendSupply?: undefined;
|
|
501
503
|
LlamaLendBorrow?: undefined;
|
|
@@ -770,6 +772,7 @@ declare const actionAddressesAllChains: {
|
|
|
770
772
|
MorphoBlueSetAuthWithSig?: undefined;
|
|
771
773
|
MorphoTokenWrap?: undefined;
|
|
772
774
|
MorphoBlueReallocateLiquidity?: undefined;
|
|
775
|
+
MorphoBlueClaim?: undefined;
|
|
773
776
|
EulerV2Supply?: undefined;
|
|
774
777
|
EulerV2Withdraw?: undefined;
|
|
775
778
|
EulerV2Borrow?: undefined;
|
|
@@ -838,6 +841,7 @@ declare const actionAddressesAllChains: {
|
|
|
838
841
|
MorphoBlueSetAuthWithSig: string;
|
|
839
842
|
MorphoBlueView: string;
|
|
840
843
|
MorphoBlueReallocateLiquidity: string;
|
|
844
|
+
MorphoBlueClaim: string;
|
|
841
845
|
FluidVaultT1Open: string;
|
|
842
846
|
FluidVaultT1Adjust: string;
|
|
843
847
|
FluidVaultT1Borrow: string;
|
|
@@ -1268,6 +1272,7 @@ declare const actionAddresses: (chainId?: null) => {
|
|
|
1268
1272
|
MorphoBlueSetAuthWithSig: string;
|
|
1269
1273
|
MorphoTokenWrap: string;
|
|
1270
1274
|
MorphoBlueReallocateLiquidity: string;
|
|
1275
|
+
MorphoBlueClaim: string;
|
|
1271
1276
|
LlamaLendCreate: string;
|
|
1272
1277
|
LlamaLendSupply: string;
|
|
1273
1278
|
LlamaLendBorrow: string;
|
|
@@ -1530,6 +1535,7 @@ declare const actionAddresses: (chainId?: null) => {
|
|
|
1530
1535
|
MorphoBlueSetAuthWithSig?: undefined;
|
|
1531
1536
|
MorphoTokenWrap?: undefined;
|
|
1532
1537
|
MorphoBlueReallocateLiquidity?: undefined;
|
|
1538
|
+
MorphoBlueClaim?: undefined;
|
|
1533
1539
|
LlamaLendCreate?: undefined;
|
|
1534
1540
|
LlamaLendSupply?: undefined;
|
|
1535
1541
|
LlamaLendBorrow?: undefined;
|
|
@@ -1804,6 +1810,7 @@ declare const actionAddresses: (chainId?: null) => {
|
|
|
1804
1810
|
MorphoBlueSetAuthWithSig?: undefined;
|
|
1805
1811
|
MorphoTokenWrap?: undefined;
|
|
1806
1812
|
MorphoBlueReallocateLiquidity?: undefined;
|
|
1813
|
+
MorphoBlueClaim?: undefined;
|
|
1807
1814
|
EulerV2Supply?: undefined;
|
|
1808
1815
|
EulerV2Withdraw?: undefined;
|
|
1809
1816
|
EulerV2Borrow?: undefined;
|
|
@@ -1872,6 +1879,7 @@ declare const actionAddresses: (chainId?: null) => {
|
|
|
1872
1879
|
MorphoBlueSetAuthWithSig: string;
|
|
1873
1880
|
MorphoBlueView: string;
|
|
1874
1881
|
MorphoBlueReallocateLiquidity: string;
|
|
1882
|
+
MorphoBlueClaim: string;
|
|
1875
1883
|
FluidVaultT1Open: string;
|
|
1876
1884
|
FluidVaultT1Adjust: string;
|
|
1877
1885
|
FluidVaultT1Borrow: string;
|
|
@@ -2445,6 +2453,7 @@ declare const _default: {
|
|
|
2445
2453
|
MorphoBlueSetAuthWithSig: string;
|
|
2446
2454
|
MorphoTokenWrap: string;
|
|
2447
2455
|
MorphoBlueReallocateLiquidity: string;
|
|
2456
|
+
MorphoBlueClaim: string;
|
|
2448
2457
|
LlamaLendCreate: string;
|
|
2449
2458
|
LlamaLendSupply: string;
|
|
2450
2459
|
LlamaLendBorrow: string;
|
|
@@ -2707,6 +2716,7 @@ declare const _default: {
|
|
|
2707
2716
|
MorphoBlueSetAuthWithSig?: undefined;
|
|
2708
2717
|
MorphoTokenWrap?: undefined;
|
|
2709
2718
|
MorphoBlueReallocateLiquidity?: undefined;
|
|
2719
|
+
MorphoBlueClaim?: undefined;
|
|
2710
2720
|
LlamaLendCreate?: undefined;
|
|
2711
2721
|
LlamaLendSupply?: undefined;
|
|
2712
2722
|
LlamaLendBorrow?: undefined;
|
|
@@ -2981,6 +2991,7 @@ declare const _default: {
|
|
|
2981
2991
|
MorphoBlueSetAuthWithSig?: undefined;
|
|
2982
2992
|
MorphoTokenWrap?: undefined;
|
|
2983
2993
|
MorphoBlueReallocateLiquidity?: undefined;
|
|
2994
|
+
MorphoBlueClaim?: undefined;
|
|
2984
2995
|
EulerV2Supply?: undefined;
|
|
2985
2996
|
EulerV2Withdraw?: undefined;
|
|
2986
2997
|
EulerV2Borrow?: undefined;
|
|
@@ -3049,6 +3060,7 @@ declare const _default: {
|
|
|
3049
3060
|
MorphoBlueSetAuthWithSig: string;
|
|
3050
3061
|
MorphoBlueView: string;
|
|
3051
3062
|
MorphoBlueReallocateLiquidity: string;
|
|
3063
|
+
MorphoBlueClaim: string;
|
|
3052
3064
|
FluidVaultT1Open: string;
|
|
3053
3065
|
FluidVaultT1Adjust: string;
|
|
3054
3066
|
FluidVaultT1Borrow: string;
|
|
@@ -3479,6 +3491,7 @@ declare const _default: {
|
|
|
3479
3491
|
MorphoBlueSetAuthWithSig: string;
|
|
3480
3492
|
MorphoTokenWrap: string;
|
|
3481
3493
|
MorphoBlueReallocateLiquidity: string;
|
|
3494
|
+
MorphoBlueClaim: string;
|
|
3482
3495
|
LlamaLendCreate: string;
|
|
3483
3496
|
LlamaLendSupply: string;
|
|
3484
3497
|
LlamaLendBorrow: string;
|
|
@@ -3741,6 +3754,7 @@ declare const _default: {
|
|
|
3741
3754
|
MorphoBlueSetAuthWithSig?: undefined;
|
|
3742
3755
|
MorphoTokenWrap?: undefined;
|
|
3743
3756
|
MorphoBlueReallocateLiquidity?: undefined;
|
|
3757
|
+
MorphoBlueClaim?: undefined;
|
|
3744
3758
|
LlamaLendCreate?: undefined;
|
|
3745
3759
|
LlamaLendSupply?: undefined;
|
|
3746
3760
|
LlamaLendBorrow?: undefined;
|
|
@@ -4015,6 +4029,7 @@ declare const _default: {
|
|
|
4015
4029
|
MorphoBlueSetAuthWithSig?: undefined;
|
|
4016
4030
|
MorphoTokenWrap?: undefined;
|
|
4017
4031
|
MorphoBlueReallocateLiquidity?: undefined;
|
|
4032
|
+
MorphoBlueClaim?: undefined;
|
|
4018
4033
|
EulerV2Supply?: undefined;
|
|
4019
4034
|
EulerV2Withdraw?: undefined;
|
|
4020
4035
|
EulerV2Borrow?: undefined;
|
|
@@ -4083,6 +4098,7 @@ declare const _default: {
|
|
|
4083
4098
|
MorphoBlueSetAuthWithSig: string;
|
|
4084
4099
|
MorphoBlueView: string;
|
|
4085
4100
|
MorphoBlueReallocateLiquidity: string;
|
|
4101
|
+
MorphoBlueClaim: string;
|
|
4086
4102
|
FluidVaultT1Open: string;
|
|
4087
4103
|
FluidVaultT1Adjust: string;
|
|
4088
4104
|
FluidVaultT1Borrow: string;
|
package/package.json
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getAssetInfoByAddress } from '@defisaver/tokens';
|
|
1
2
|
import { Action } from '../../Action';
|
|
2
3
|
import { getAddr } from '../../addresses';
|
|
3
4
|
import { EthAddress, uint256 } from '../../types';
|
|
@@ -8,6 +9,8 @@ import { EthAddress, uint256 } from '../../types';
|
|
|
8
9
|
* @category Fluid
|
|
9
10
|
*/
|
|
10
11
|
export class FluidVaultT1OpenAction extends Action {
|
|
12
|
+
tokenForApproval: EthAddress;
|
|
13
|
+
|
|
11
14
|
/**
|
|
12
15
|
* @param vault The address of the Fluid Vault T1
|
|
13
16
|
* @param collAmount Amount of collateral to deposit.
|
|
@@ -15,6 +18,7 @@ export class FluidVaultT1OpenAction extends Action {
|
|
|
15
18
|
* @param from Address to pull the collateral from.
|
|
16
19
|
* @param to Address to send the borrowed assets to.
|
|
17
20
|
* @param wrapBorrowedEth Whether to wrap the borrowed ETH into WETH if the borrowed asset is ETH.
|
|
21
|
+
* @param collToken Address of the collateral token.
|
|
18
22
|
*/
|
|
19
23
|
constructor(
|
|
20
24
|
vault: EthAddress,
|
|
@@ -23,6 +27,7 @@ export class FluidVaultT1OpenAction extends Action {
|
|
|
23
27
|
from: EthAddress,
|
|
24
28
|
to: EthAddress,
|
|
25
29
|
wrapBorrowedEth: boolean,
|
|
30
|
+
collToken: EthAddress,
|
|
26
31
|
) {
|
|
27
32
|
super(
|
|
28
33
|
'FluidVaultT1Open',
|
|
@@ -39,5 +44,12 @@ export class FluidVaultT1OpenAction extends Action {
|
|
|
39
44
|
this.args[4],
|
|
40
45
|
this.args[5],
|
|
41
46
|
];
|
|
47
|
+
this.tokenForApproval = collToken;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async getAssetsToApprove() {
|
|
51
|
+
const asset = getAssetInfoByAddress(this.tokenForApproval);
|
|
52
|
+
if (asset.symbol !== 'ETH') return [{ asset: this.tokenForApproval, owner: this.args[3] }];
|
|
53
|
+
return [];
|
|
42
54
|
}
|
|
43
55
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getAssetInfoByAddress } from '@defisaver/tokens';
|
|
1
2
|
import { Action } from '../../Action';
|
|
2
3
|
import { getAddr } from '../../addresses';
|
|
3
4
|
import { EthAddress, uint256 } from '../../types';
|
|
@@ -8,17 +9,21 @@ import { EthAddress, uint256 } from '../../types';
|
|
|
8
9
|
* @category Fluid
|
|
9
10
|
*/
|
|
10
11
|
export class FluidVaultT1PaybackAction extends Action {
|
|
12
|
+
tokenForApproval: EthAddress;
|
|
13
|
+
|
|
11
14
|
/**
|
|
12
15
|
* @param vault The address of the Fluid Vault T1
|
|
13
16
|
* @param nftId ID of the NFT representing the position
|
|
14
17
|
* @param amount Amount to payback
|
|
15
18
|
* @param from Address to pull the tokens from
|
|
19
|
+
* @param debtToken Address of the debt token
|
|
16
20
|
*/
|
|
17
21
|
constructor(
|
|
18
22
|
vault: EthAddress,
|
|
19
23
|
nftId: uint256,
|
|
20
24
|
amount: uint256,
|
|
21
25
|
from: EthAddress,
|
|
26
|
+
debtToken: EthAddress,
|
|
22
27
|
) {
|
|
23
28
|
super(
|
|
24
29
|
'FluidVaultT1Payback',
|
|
@@ -33,5 +38,12 @@ export class FluidVaultT1PaybackAction extends Action {
|
|
|
33
38
|
this.args[2],
|
|
34
39
|
this.args[3],
|
|
35
40
|
];
|
|
41
|
+
this.tokenForApproval = debtToken;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async getAssetsToApprove() {
|
|
45
|
+
const asset = getAssetInfoByAddress(this.tokenForApproval);
|
|
46
|
+
if (asset.symbol !== 'ETH') return [{ asset: this.tokenForApproval, owner: this.args[3] }];
|
|
47
|
+
return [];
|
|
36
48
|
}
|
|
37
49
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getAssetInfoByAddress } from '@defisaver/tokens';
|
|
1
2
|
import { Action } from '../../Action';
|
|
2
3
|
import { getAddr } from '../../addresses';
|
|
3
4
|
import { EthAddress, uint256 } from '../../types';
|
|
@@ -8,17 +9,21 @@ import { EthAddress, uint256 } from '../../types';
|
|
|
8
9
|
* @category Fluid
|
|
9
10
|
*/
|
|
10
11
|
export class FluidVaultT1SupplyAction extends Action {
|
|
12
|
+
tokenForApproval: EthAddress;
|
|
13
|
+
|
|
11
14
|
/**
|
|
12
15
|
* @param vault The address of the Fluid Vault T1
|
|
13
16
|
* @param nftId ID of the NFT representing the position
|
|
14
17
|
* @param amount Amount to supply
|
|
15
18
|
* @param from Address to pull the tokens from
|
|
19
|
+
* @param collToken Address of the collateral token
|
|
16
20
|
*/
|
|
17
21
|
constructor(
|
|
18
22
|
vault: EthAddress,
|
|
19
23
|
nftId: uint256,
|
|
20
24
|
amount: uint256,
|
|
21
25
|
from: EthAddress,
|
|
26
|
+
collToken: EthAddress,
|
|
22
27
|
) {
|
|
23
28
|
super(
|
|
24
29
|
'FluidVaultT1Supply',
|
|
@@ -33,5 +38,12 @@ export class FluidVaultT1SupplyAction extends Action {
|
|
|
33
38
|
this.args[2],
|
|
34
39
|
this.args[3],
|
|
35
40
|
];
|
|
41
|
+
this.tokenForApproval = collToken;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async getAssetsToApprove() {
|
|
45
|
+
const asset = getAssetInfoByAddress(this.tokenForApproval);
|
|
46
|
+
if (asset.symbol !== 'ETH') return [{ asset: this.tokenForApproval, owner: this.args[3] }];
|
|
47
|
+
return [];
|
|
36
48
|
}
|
|
37
49
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { bytes32, EthAddress, uint256 } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* MorphoBlueClaimAction - Claim rewards for MorphoBlue users
|
|
7
|
+
*
|
|
8
|
+
* @category MorphoBlue
|
|
9
|
+
*/
|
|
10
|
+
export class MorphoBlueClaimAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param to The address to which to send the reward tokens. Only used if claiming for the smart wallet.
|
|
13
|
+
* @param token The address of the token to claim.
|
|
14
|
+
* @param distributor The address of the morpho distributor contract.
|
|
15
|
+
* @param claimable The overall claimable amount of token rewards.
|
|
16
|
+
* @param merkleProof The merkle proof to claim the rewards.
|
|
17
|
+
*/
|
|
18
|
+
constructor(
|
|
19
|
+
to:EthAddress,
|
|
20
|
+
token:EthAddress,
|
|
21
|
+
distributor:EthAddress,
|
|
22
|
+
claimable:uint256,
|
|
23
|
+
merkleProof: Array<bytes32>,
|
|
24
|
+
) {
|
|
25
|
+
super(
|
|
26
|
+
'MorphoBlueClaim',
|
|
27
|
+
getAddr('MorphoBlueClaim'),
|
|
28
|
+
['address', 'address', 'address', 'uint256', 'bytes32[]'],
|
|
29
|
+
[to, token, distributor, claimable, merkleProof],
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -7,4 +7,5 @@ export * from './MorphoBlueWithdrawAction';
|
|
|
7
7
|
export * from './MorphoBlueSetAuthAction';
|
|
8
8
|
export * from './MorphoBlueSetAuthWithSigAction';
|
|
9
9
|
export * from './MorphoTokenWrapAction';
|
|
10
|
-
export * from './MorphoBlueReallocateLiquidityAction';
|
|
10
|
+
export * from './MorphoBlueReallocateLiquidityAction';
|
|
11
|
+
export * from './MorphoBlueClaimAction';
|
package/src/addresses.ts
CHANGED
|
@@ -293,6 +293,7 @@ export const actionAddresses = {
|
|
|
293
293
|
MorphoBlueSetAuthWithSig: '0xE2d5fCDBf73BAd24A0FCAf6B2733933A98021808',
|
|
294
294
|
MorphoTokenWrap: '0x71b6d268c2Aabcb0dA16CbA4c77e65d9e29b0644',
|
|
295
295
|
MorphoBlueReallocateLiquidity: '0x17cCA8194602020e855CC8Bc11ffA82d8F998A93',
|
|
296
|
+
MorphoBlueClaim: '0xBB562a790AD7773D54A423bD2A10E4073cb98142',
|
|
296
297
|
|
|
297
298
|
// llamalend
|
|
298
299
|
LlamaLendCreate: '0x4349be191ea63173eD98b7fC1b0DeC1ef9Bc6c11',
|
|
@@ -541,6 +542,7 @@ export const actionAddresses = {
|
|
|
541
542
|
MorphoBlueSetAuthWithSig: '0x80be65342f6172a6cd0b6a2653e8a887e3f46cab',
|
|
542
543
|
MorphoBlueView: '0xdbcacf59c5063da8b15481f88e7d70e13c92f2a1',
|
|
543
544
|
MorphoBlueReallocateLiquidity: '0x5Ea7F30E40F6A25BE2aD23A6FC1C31A6c95F3dc8',
|
|
545
|
+
MorphoBlueClaim: '0xE279E9100d6d524602f98E8736BA5F8f065Dd3e0',
|
|
544
546
|
|
|
545
547
|
// fluid
|
|
546
548
|
FluidVaultT1Open: '0xCd4d5896AEAf97e738d3E7215ac01c2CF97474bc',
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const dfs = require('../../../src');
|
|
2
|
+
const {getAssetInfo} = require("@defisaver/tokens");
|
|
3
|
+
const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
|
|
4
|
+
const {assert} = require('chai');
|
|
5
|
+
|
|
6
|
+
describe('Action: MorphoBlueClaimAction', () => {
|
|
7
|
+
let action;
|
|
8
|
+
context('Claim encoding', () => {
|
|
9
|
+
it('constructor', () => {
|
|
10
|
+
const to = '0xC093dFcC2cBc4e9488589B7c2245a7F1DA043389';
|
|
11
|
+
const claimable = '4809093062235489680';
|
|
12
|
+
const rewardToken = '0x58d97b57bb95320f9a05dc918aef65434969c2b2';
|
|
13
|
+
const distributorContract = '0x330eefa8a787552DC5cAd3C3cA644844B1E61Ddb';
|
|
14
|
+
const proofs = [
|
|
15
|
+
'0xd496d2a15cf30a2af545b0fd4ced50fb4224bb54e7c9add4885c7b7408c907a1',
|
|
16
|
+
'0x6a8fc6432934b1f2c9f9aed040f4389c0450dd94aff92b16864060e95fba4290',
|
|
17
|
+
'0xb7491e5e898e774e11c50044140df4c1c74bf9cd7855bac78f0709699ed0e6b7',
|
|
18
|
+
'0xc8cd758ed1b442458a4bf192598e1bc6409b4c7c234a89d343ca47e35c027a58',
|
|
19
|
+
'0x67ad524dd5256feff4322b22e13d2b169bce720accedaf441b5151d03eede9ea',
|
|
20
|
+
'0x01c9e73be64a955a74b847b5d842be13815b8c057c96793df609581cf744a303',
|
|
21
|
+
'0x48056ed0d5975f309d2cfa166f5ef7e0a927445708aa04bd2c572cd583a6a6c9',
|
|
22
|
+
'0x1ca9e9f414cdc19dd87fa5a78225cce4a8b2ca332a814e2240172c82159ba86e',
|
|
23
|
+
'0x98290a0226d9dcca1fa16f5187393edd00bba4cae92a41ea608739ae804d41f0',
|
|
24
|
+
'0x5c4b48ece06d268a3a151db9392dff6b087a041eb002e4f41f04e98b6a9350ea',
|
|
25
|
+
'0xb18f55aa8bf9d073eab748bb54f7629551df5a8df04f03d677b1005c8b606ec1',
|
|
26
|
+
'0x844d1e6cac34639fc9e192fc7d94015472661d264f640df6e56d47ff800b66ed',
|
|
27
|
+
'0xef63a6a4f186536ca66dbd3af102630029e7bf10830268d6d90bc4415e0238e2',
|
|
28
|
+
'0x9b2fc088dde10283dc02fef8e9eb1a76c22ca3df5bfaec0ba88d712dac926ce5',
|
|
29
|
+
'0xf7889f06c88c1c1006a7b9710fb95745b8df7279cdca977331a75aac7f9416cd',
|
|
30
|
+
];
|
|
31
|
+
action = new dfs.actions.morphoblue.MorphoBlueClaimAction(
|
|
32
|
+
to,
|
|
33
|
+
rewardToken,
|
|
34
|
+
distributorContract,
|
|
35
|
+
claimable,
|
|
36
|
+
proofs,
|
|
37
|
+
);
|
|
38
|
+
})
|
|
39
|
+
it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
|
|
40
|
+
it('encodeForRecipe', () => encodeForRecipe(action));
|
|
41
|
+
it('getEthValue', async () => {
|
|
42
|
+
const ethValue = await action.getEthValue();
|
|
43
|
+
assert.equal(ethValue, '0');
|
|
44
|
+
})
|
|
45
|
+
})
|
|
46
|
+
})
|