@defisaver/sdk 1.2.20 → 1.2.21-dev-fluid-claim
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/FluidClaimAction.d.ts +19 -0
- package/esm/src/actions/fluid/FluidClaimAction.js +37 -0
- 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/fluid/index.d.ts +1 -0
- package/esm/src/actions/fluid/index.js +1 -0
- package/esm/src/addresses.d.ts +4 -0
- package/esm/src/addresses.js +1 -0
- package/esm/src/index.d.ts +16 -0
- package/package.json +1 -1
- package/src/actions/fluid/FluidClaimAction.ts +58 -0
- 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/fluid/index.ts +2 -1
- package/src/addresses.ts +1 -0
- package/umd/index.js +198 -83
- package/yarn-error.log +3976 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256, bytes32, uint8, bytes } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* FluidClaimAction - Claim Fluid rewards
|
|
5
|
+
*
|
|
6
|
+
* @category Fluid
|
|
7
|
+
*/
|
|
8
|
+
export declare class FluidClaimAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param to Address to send the claimed tokens to.
|
|
11
|
+
* @param cumulativeAmount Total cumulative amount of tokens to claim (Obtained from API).
|
|
12
|
+
* @param positionId The ID of the position. For earn positions, this will be fToken address (Obtained from API).
|
|
13
|
+
* @param positionType The type of the position (Obtained from API).
|
|
14
|
+
* @param cycle The cycle of the rewards program (Obtained from API).
|
|
15
|
+
* @param merkleProof The Merkle proof to claim the rewards (Obtained from API).
|
|
16
|
+
* @param metadata Additional metadata for the claim. (Obtained from API).
|
|
17
|
+
*/
|
|
18
|
+
constructor(to: EthAddress, cumulativeAmount: uint256, positionId: bytes32, positionType: uint8, cycle: uint256, merkleProof: Array<bytes32>, metadata: bytes);
|
|
19
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* FluidClaimAction - Claim Fluid rewards
|
|
5
|
+
*
|
|
6
|
+
* @category Fluid
|
|
7
|
+
*/
|
|
8
|
+
export class FluidClaimAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param to Address to send the claimed tokens to.
|
|
11
|
+
* @param cumulativeAmount Total cumulative amount of tokens to claim (Obtained from API).
|
|
12
|
+
* @param positionId The ID of the position. For earn positions, this will be fToken address (Obtained from API).
|
|
13
|
+
* @param positionType The type of the position (Obtained from API).
|
|
14
|
+
* @param cycle The cycle of the rewards program (Obtained from API).
|
|
15
|
+
* @param merkleProof The Merkle proof to claim the rewards (Obtained from API).
|
|
16
|
+
* @param metadata Additional metadata for the claim. (Obtained from API).
|
|
17
|
+
*/
|
|
18
|
+
constructor(to, cumulativeAmount, positionId, positionType, cycle, merkleProof, metadata) {
|
|
19
|
+
super('FluidClaim', getAddr('FluidClaim'), [
|
|
20
|
+
'address',
|
|
21
|
+
'uint256',
|
|
22
|
+
'bytes32',
|
|
23
|
+
'uint8',
|
|
24
|
+
'uint256',
|
|
25
|
+
'bytes32[]',
|
|
26
|
+
'bytes', // metadata
|
|
27
|
+
], [
|
|
28
|
+
to,
|
|
29
|
+
cumulativeAmount,
|
|
30
|
+
positionId,
|
|
31
|
+
positionType,
|
|
32
|
+
cycle,
|
|
33
|
+
merkleProof,
|
|
34
|
+
metadata,
|
|
35
|
+
]);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -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
|
}
|
package/esm/src/addresses.d.ts
CHANGED
|
@@ -254,6 +254,7 @@ export declare const actionAddresses: {
|
|
|
254
254
|
FluidVaultT1Withdraw: string;
|
|
255
255
|
FluidVaultT1Supply: string;
|
|
256
256
|
FluidView: string;
|
|
257
|
+
FluidClaim: string;
|
|
257
258
|
AaveV3DelegateCredit?: undefined;
|
|
258
259
|
AaveV3RatioTrigger?: undefined;
|
|
259
260
|
GasFeeTakerL2?: undefined;
|
|
@@ -517,6 +518,7 @@ export declare const actionAddresses: {
|
|
|
517
518
|
FluidVaultT1Withdraw?: undefined;
|
|
518
519
|
FluidVaultT1Supply?: undefined;
|
|
519
520
|
FluidView?: undefined;
|
|
521
|
+
FluidClaim?: undefined;
|
|
520
522
|
MorphoBlueView?: undefined;
|
|
521
523
|
} | {
|
|
522
524
|
DFSSell: string;
|
|
@@ -774,6 +776,7 @@ export declare const actionAddresses: {
|
|
|
774
776
|
EtherFiWrap?: undefined;
|
|
775
777
|
EtherFiUnwrap?: undefined;
|
|
776
778
|
KingClaim?: undefined;
|
|
779
|
+
FluidClaim?: undefined;
|
|
777
780
|
AaveV3DelegateCredit?: undefined;
|
|
778
781
|
AaveV3RatioTrigger?: undefined;
|
|
779
782
|
MorphoBlueView?: undefined;
|
|
@@ -1033,6 +1036,7 @@ export declare const actionAddresses: {
|
|
|
1033
1036
|
EtherFiWrap?: undefined;
|
|
1034
1037
|
EtherFiUnwrap?: undefined;
|
|
1035
1038
|
KingClaim?: undefined;
|
|
1039
|
+
FluidClaim?: undefined;
|
|
1036
1040
|
AaveV3DelegateCredit?: undefined;
|
|
1037
1041
|
AaveV3RatioTrigger?: undefined;
|
|
1038
1042
|
AaveV3RatioCheck?: undefined;
|
package/esm/src/addresses.js
CHANGED
|
@@ -290,6 +290,7 @@ export const actionAddresses = {
|
|
|
290
290
|
FluidVaultT1Withdraw: '0x5673b9ab4A035C5C7474C344664Be91DaFafa17E',
|
|
291
291
|
FluidVaultT1Supply: '0x0c6100209D8A0bb14CC7d18e45dA1bd1E7a3a187',
|
|
292
292
|
FluidView: '0xf8e3bbf7c95057be1fD5E741a9ADb73E956dC724',
|
|
293
|
+
FluidClaim: '0x0bC0aeF7702C204DEF308994C84D8fBce676dB47',
|
|
293
294
|
},
|
|
294
295
|
[NETWORKS.optimism.chainId]: {
|
|
295
296
|
DFSSell: '0x9f234af5c10c136863a20865ba00b26951ab8269',
|
package/esm/src/index.d.ts
CHANGED
|
@@ -265,6 +265,7 @@ declare const actionAddressesAllChains: {
|
|
|
265
265
|
FluidVaultT1Withdraw: string;
|
|
266
266
|
FluidVaultT1Supply: string;
|
|
267
267
|
FluidView: string;
|
|
268
|
+
FluidClaim: string;
|
|
268
269
|
AaveV3DelegateCredit?: undefined;
|
|
269
270
|
AaveV3RatioTrigger?: undefined;
|
|
270
271
|
GasFeeTakerL2?: undefined;
|
|
@@ -528,6 +529,7 @@ declare const actionAddressesAllChains: {
|
|
|
528
529
|
FluidVaultT1Withdraw?: undefined;
|
|
529
530
|
FluidVaultT1Supply?: undefined;
|
|
530
531
|
FluidView?: undefined;
|
|
532
|
+
FluidClaim?: undefined;
|
|
531
533
|
MorphoBlueView?: undefined;
|
|
532
534
|
} | {
|
|
533
535
|
DFSSell: string;
|
|
@@ -785,6 +787,7 @@ declare const actionAddressesAllChains: {
|
|
|
785
787
|
EtherFiWrap?: undefined;
|
|
786
788
|
EtherFiUnwrap?: undefined;
|
|
787
789
|
KingClaim?: undefined;
|
|
790
|
+
FluidClaim?: undefined;
|
|
788
791
|
AaveV3DelegateCredit?: undefined;
|
|
789
792
|
AaveV3RatioTrigger?: undefined;
|
|
790
793
|
MorphoBlueView?: undefined;
|
|
@@ -1044,6 +1047,7 @@ declare const actionAddressesAllChains: {
|
|
|
1044
1047
|
EtherFiWrap?: undefined;
|
|
1045
1048
|
EtherFiUnwrap?: undefined;
|
|
1046
1049
|
KingClaim?: undefined;
|
|
1050
|
+
FluidClaim?: undefined;
|
|
1047
1051
|
AaveV3DelegateCredit?: undefined;
|
|
1048
1052
|
AaveV3RatioTrigger?: undefined;
|
|
1049
1053
|
AaveV3RatioCheck?: undefined;
|
|
@@ -1303,6 +1307,7 @@ declare const actionAddresses: (chainId?: null) => {
|
|
|
1303
1307
|
FluidVaultT1Withdraw: string;
|
|
1304
1308
|
FluidVaultT1Supply: string;
|
|
1305
1309
|
FluidView: string;
|
|
1310
|
+
FluidClaim: string;
|
|
1306
1311
|
AaveV3DelegateCredit?: undefined;
|
|
1307
1312
|
AaveV3RatioTrigger?: undefined;
|
|
1308
1313
|
GasFeeTakerL2?: undefined;
|
|
@@ -1566,6 +1571,7 @@ declare const actionAddresses: (chainId?: null) => {
|
|
|
1566
1571
|
FluidVaultT1Withdraw?: undefined;
|
|
1567
1572
|
FluidVaultT1Supply?: undefined;
|
|
1568
1573
|
FluidView?: undefined;
|
|
1574
|
+
FluidClaim?: undefined;
|
|
1569
1575
|
MorphoBlueView?: undefined;
|
|
1570
1576
|
} | {
|
|
1571
1577
|
DFSSell: string;
|
|
@@ -1823,6 +1829,7 @@ declare const actionAddresses: (chainId?: null) => {
|
|
|
1823
1829
|
EtherFiWrap?: undefined;
|
|
1824
1830
|
EtherFiUnwrap?: undefined;
|
|
1825
1831
|
KingClaim?: undefined;
|
|
1832
|
+
FluidClaim?: undefined;
|
|
1826
1833
|
AaveV3DelegateCredit?: undefined;
|
|
1827
1834
|
AaveV3RatioTrigger?: undefined;
|
|
1828
1835
|
MorphoBlueView?: undefined;
|
|
@@ -2082,6 +2089,7 @@ declare const actionAddresses: (chainId?: null) => {
|
|
|
2082
2089
|
EtherFiWrap?: undefined;
|
|
2083
2090
|
EtherFiUnwrap?: undefined;
|
|
2084
2091
|
KingClaim?: undefined;
|
|
2092
|
+
FluidClaim?: undefined;
|
|
2085
2093
|
AaveV3DelegateCredit?: undefined;
|
|
2086
2094
|
AaveV3RatioTrigger?: undefined;
|
|
2087
2095
|
AaveV3RatioCheck?: undefined;
|
|
@@ -2484,6 +2492,7 @@ declare const _default: {
|
|
|
2484
2492
|
FluidVaultT1Withdraw: string;
|
|
2485
2493
|
FluidVaultT1Supply: string;
|
|
2486
2494
|
FluidView: string;
|
|
2495
|
+
FluidClaim: string;
|
|
2487
2496
|
AaveV3DelegateCredit?: undefined;
|
|
2488
2497
|
AaveV3RatioTrigger?: undefined;
|
|
2489
2498
|
GasFeeTakerL2?: undefined;
|
|
@@ -2747,6 +2756,7 @@ declare const _default: {
|
|
|
2747
2756
|
FluidVaultT1Withdraw?: undefined;
|
|
2748
2757
|
FluidVaultT1Supply?: undefined;
|
|
2749
2758
|
FluidView?: undefined;
|
|
2759
|
+
FluidClaim?: undefined;
|
|
2750
2760
|
MorphoBlueView?: undefined;
|
|
2751
2761
|
} | {
|
|
2752
2762
|
DFSSell: string;
|
|
@@ -3004,6 +3014,7 @@ declare const _default: {
|
|
|
3004
3014
|
EtherFiWrap?: undefined;
|
|
3005
3015
|
EtherFiUnwrap?: undefined;
|
|
3006
3016
|
KingClaim?: undefined;
|
|
3017
|
+
FluidClaim?: undefined;
|
|
3007
3018
|
AaveV3DelegateCredit?: undefined;
|
|
3008
3019
|
AaveV3RatioTrigger?: undefined;
|
|
3009
3020
|
MorphoBlueView?: undefined;
|
|
@@ -3263,6 +3274,7 @@ declare const _default: {
|
|
|
3263
3274
|
EtherFiWrap?: undefined;
|
|
3264
3275
|
EtherFiUnwrap?: undefined;
|
|
3265
3276
|
KingClaim?: undefined;
|
|
3277
|
+
FluidClaim?: undefined;
|
|
3266
3278
|
AaveV3DelegateCredit?: undefined;
|
|
3267
3279
|
AaveV3RatioTrigger?: undefined;
|
|
3268
3280
|
AaveV3RatioCheck?: undefined;
|
|
@@ -3522,6 +3534,7 @@ declare const _default: {
|
|
|
3522
3534
|
FluidVaultT1Withdraw: string;
|
|
3523
3535
|
FluidVaultT1Supply: string;
|
|
3524
3536
|
FluidView: string;
|
|
3537
|
+
FluidClaim: string;
|
|
3525
3538
|
AaveV3DelegateCredit?: undefined;
|
|
3526
3539
|
AaveV3RatioTrigger?: undefined;
|
|
3527
3540
|
GasFeeTakerL2?: undefined;
|
|
@@ -3785,6 +3798,7 @@ declare const _default: {
|
|
|
3785
3798
|
FluidVaultT1Withdraw?: undefined;
|
|
3786
3799
|
FluidVaultT1Supply?: undefined;
|
|
3787
3800
|
FluidView?: undefined;
|
|
3801
|
+
FluidClaim?: undefined;
|
|
3788
3802
|
MorphoBlueView?: undefined;
|
|
3789
3803
|
} | {
|
|
3790
3804
|
DFSSell: string;
|
|
@@ -4042,6 +4056,7 @@ declare const _default: {
|
|
|
4042
4056
|
EtherFiWrap?: undefined;
|
|
4043
4057
|
EtherFiUnwrap?: undefined;
|
|
4044
4058
|
KingClaim?: undefined;
|
|
4059
|
+
FluidClaim?: undefined;
|
|
4045
4060
|
AaveV3DelegateCredit?: undefined;
|
|
4046
4061
|
AaveV3RatioTrigger?: undefined;
|
|
4047
4062
|
MorphoBlueView?: undefined;
|
|
@@ -4301,6 +4316,7 @@ declare const _default: {
|
|
|
4301
4316
|
EtherFiWrap?: undefined;
|
|
4302
4317
|
EtherFiUnwrap?: undefined;
|
|
4303
4318
|
KingClaim?: undefined;
|
|
4319
|
+
FluidClaim?: undefined;
|
|
4304
4320
|
AaveV3DelegateCredit?: undefined;
|
|
4305
4321
|
AaveV3RatioTrigger?: undefined;
|
|
4306
4322
|
AaveV3RatioCheck?: undefined;
|
package/package.json
CHANGED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import {
|
|
4
|
+
EthAddress,
|
|
5
|
+
uint256,
|
|
6
|
+
bytes32,
|
|
7
|
+
uint8,
|
|
8
|
+
bytes,
|
|
9
|
+
} from '../../types';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* FluidClaimAction - Claim Fluid rewards
|
|
13
|
+
*
|
|
14
|
+
* @category Fluid
|
|
15
|
+
*/
|
|
16
|
+
export class FluidClaimAction extends Action {
|
|
17
|
+
/**
|
|
18
|
+
* @param to Address to send the claimed tokens to.
|
|
19
|
+
* @param cumulativeAmount Total cumulative amount of tokens to claim (Obtained from API).
|
|
20
|
+
* @param positionId The ID of the position. For earn positions, this will be fToken address (Obtained from API).
|
|
21
|
+
* @param positionType The type of the position (Obtained from API).
|
|
22
|
+
* @param cycle The cycle of the rewards program (Obtained from API).
|
|
23
|
+
* @param merkleProof The Merkle proof to claim the rewards (Obtained from API).
|
|
24
|
+
* @param metadata Additional metadata for the claim. (Obtained from API).
|
|
25
|
+
*/
|
|
26
|
+
constructor(
|
|
27
|
+
to: EthAddress,
|
|
28
|
+
cumulativeAmount: uint256,
|
|
29
|
+
positionId: bytes32,
|
|
30
|
+
positionType: uint8,
|
|
31
|
+
cycle: uint256,
|
|
32
|
+
merkleProof: Array<bytes32>,
|
|
33
|
+
metadata: bytes,
|
|
34
|
+
) {
|
|
35
|
+
super(
|
|
36
|
+
'FluidClaim',
|
|
37
|
+
getAddr('FluidClaim'),
|
|
38
|
+
[
|
|
39
|
+
'address', // to
|
|
40
|
+
'uint256', // cumulativeAmount
|
|
41
|
+
'bytes32', // positionId
|
|
42
|
+
'uint8', // positionType
|
|
43
|
+
'uint256', // cycle
|
|
44
|
+
'bytes32[]', // merkleProof
|
|
45
|
+
'bytes', // metadata
|
|
46
|
+
],
|
|
47
|
+
[
|
|
48
|
+
to,
|
|
49
|
+
cumulativeAmount,
|
|
50
|
+
positionId,
|
|
51
|
+
positionType,
|
|
52
|
+
cycle,
|
|
53
|
+
merkleProof,
|
|
54
|
+
metadata,
|
|
55
|
+
],
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -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
|
}
|
|
@@ -3,4 +3,5 @@ export * from './FluidVaultT1AdjustAction';
|
|
|
3
3
|
export * from './FluidVaultT1BorrowAction';
|
|
4
4
|
export * from './FluidVaultT1PaybackAction';
|
|
5
5
|
export * from './FluidVaultT1SupplyAction';
|
|
6
|
-
export * from './FluidVaultT1WithdrawAction';
|
|
6
|
+
export * from './FluidVaultT1WithdrawAction';
|
|
7
|
+
export * from './FluidClaimAction';
|
package/src/addresses.ts
CHANGED
|
@@ -335,6 +335,7 @@ export const actionAddresses = {
|
|
|
335
335
|
FluidVaultT1Withdraw: '0x5673b9ab4A035C5C7474C344664Be91DaFafa17E',
|
|
336
336
|
FluidVaultT1Supply: '0x0c6100209D8A0bb14CC7d18e45dA1bd1E7a3a187',
|
|
337
337
|
FluidView: '0xf8e3bbf7c95057be1fD5E741a9ADb73E956dC724',
|
|
338
|
+
FluidClaim: '0x0bC0aeF7702C204DEF308994C84D8fBce676dB47',
|
|
338
339
|
},
|
|
339
340
|
[NETWORKS.optimism.chainId]: {
|
|
340
341
|
DFSSell: '0x9f234af5c10c136863a20865ba00b26951ab8269',
|