@defisaver/sdk 1.3.23 → 1.3.24

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.
@@ -28,7 +28,7 @@ export class LimitSellAction extends ActionWithL2 {
28
28
  */
29
29
  constructor(exchangeOrder, from, to, gasUsed, protocolFee = '0') {
30
30
  requireAddress(to);
31
- super('LimitSell', getAddr('LimitSell'), [
31
+ super('LimitSell', getAddr('Empty'), [
32
32
  ['address', 'address', 'uint256', 'uint256', 'uint256', 'uint256', 'address', 'address', 'bytes', ['address', 'address', 'address', 'uint256', 'uint256', 'bytes']],
33
33
  'address',
34
34
  'address',
@@ -0,0 +1,25 @@
1
+ import { ActionWithL2 } from '../../ActionWithL2';
2
+ import { EthAddress, uint256 } from '../../types';
3
+ /**
4
+ * Limit sell action used as part of the LimitSell Strategy on L2
5
+ *
6
+ * @category BasicActions
7
+ */
8
+ export declare class LimitSellActionL2 extends ActionWithL2 {
9
+ protocolFee: string;
10
+ /**
11
+ * @param exchangeOrder Standard DFS Exchange data
12
+ * @param from Order sender
13
+ * @param to Order recipient
14
+ * @param gasUsed Amount of gas spent as part of the strategy
15
+ * @param l1GasCostInEth Additional tx cost for L1 in eth
16
+ * @param protocolFee 0x fee (amount of ETH in Wei)
17
+ */
18
+ constructor(exchangeOrder: Array<any>, from: EthAddress, to: EthAddress, gasUsed: uint256, l1GasCostInEth: uint256, protocolFee?: string);
19
+ encodeInputs(): string;
20
+ getAssetsToApprove(): Promise<{
21
+ asset: any;
22
+ owner: any;
23
+ }[]>;
24
+ getEthValue(): Promise<string>;
25
+ }
@@ -0,0 +1,65 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import AbiCoder from 'web3-eth-abi';
11
+ import { getAssetInfoByAddress } from '@defisaver/tokens';
12
+ import ActionAbi from '../../abis/Action.json';
13
+ import { ActionWithL2 } from '../../ActionWithL2';
14
+ import { requireAddress } from '../../utils/general';
15
+ import { getAddr } from '../../addresses';
16
+ /**
17
+ * Limit sell action used as part of the LimitSell Strategy on L2
18
+ *
19
+ * @category BasicActions
20
+ */
21
+ export class LimitSellActionL2 extends ActionWithL2 {
22
+ /**
23
+ * @param exchangeOrder Standard DFS Exchange data
24
+ * @param from Order sender
25
+ * @param to Order recipient
26
+ * @param gasUsed Amount of gas spent as part of the strategy
27
+ * @param l1GasCostInEth Additional tx cost for L1 in eth
28
+ * @param protocolFee 0x fee (amount of ETH in Wei)
29
+ */
30
+ constructor(exchangeOrder, from, to, gasUsed, l1GasCostInEth, protocolFee = '0') {
31
+ requireAddress(to);
32
+ super('LimitSellL2', getAddr('Empty'), [
33
+ ['address', 'address', 'uint256', 'uint256', 'uint256', 'uint256', 'address', 'address', 'bytes', ['address', 'address', 'address', 'uint256', 'uint256', 'bytes']],
34
+ 'address',
35
+ 'address',
36
+ 'uint256',
37
+ 'uint256',
38
+ ], [exchangeOrder, from, to, gasUsed, l1GasCostInEth]);
39
+ this.protocolFee = protocolFee;
40
+ this.mappableArgs = [
41
+ this.args[0][0],
42
+ this.args[0][1],
43
+ this.args[0][2],
44
+ this.args[1],
45
+ this.args[2],
46
+ ];
47
+ }
48
+ encodeInputs() {
49
+ const executeActionDirectAbi = (ActionAbi.find(({ name }) => name === 'executeActionDirect'));
50
+ return AbiCoder.encodeFunctionCall(executeActionDirectAbi, this._encodeForCall());
51
+ }
52
+ getAssetsToApprove() {
53
+ return __awaiter(this, void 0, void 0, function* () {
54
+ const asset = getAssetInfoByAddress(this.args[0][0]);
55
+ if (asset.symbol !== 'ETH')
56
+ return [{ asset: this.args[0][0], owner: this.args[1] }];
57
+ return [];
58
+ });
59
+ }
60
+ getEthValue() {
61
+ return __awaiter(this, void 0, void 0, function* () {
62
+ return this.protocolFee || '0';
63
+ });
64
+ }
65
+ }
@@ -17,6 +17,7 @@ export * from './TransferNFTAction';
17
17
  export * from './SendTokensAction';
18
18
  export * from './CreateSubAction';
19
19
  export * from './LSVSellAction';
20
+ export * from './LimitSellActionL2';
20
21
  export * from './ApproveTokenAction';
21
22
  export * from './SDaiWrapAction';
22
23
  export * from './SDaiUnwrapAction';
@@ -17,6 +17,7 @@ export * from './TransferNFTAction';
17
17
  export * from './SendTokensAction';
18
18
  export * from './CreateSubAction';
19
19
  export * from './LSVSellAction';
20
+ export * from './LimitSellActionL2';
20
21
  export * from './ApproveTokenAction';
21
22
  export * from './SDaiWrapAction';
22
23
  export * from './SDaiUnwrapAction';
@@ -0,0 +1,18 @@
1
+ import { Action } from '../../Action';
2
+ import { EthAddress, uint256, bytes } from '../../types';
3
+ import { FlashLoanId } from './FlashLoanId';
4
+ /**
5
+ * Gets a flashloan from BalancerV3
6
+ *
7
+ * @category Flashloans
8
+ */
9
+ export declare class BalancerV3FlashLoanAction extends Action implements FlashLoanId {
10
+ flashLoanId: number;
11
+ /**
12
+ * @param tokens
13
+ * @param loanAmounts
14
+ * @param flParamGetterAddr
15
+ * @param flParamGetterData
16
+ */
17
+ constructor(tokens: Array<EthAddress>, loanAmounts: Array<uint256>, flParamGetterAddr?: EthAddress, flParamGetterData?: bytes);
18
+ }
@@ -0,0 +1,35 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ /**
4
+ * Gets a flashloan from BalancerV3
5
+ *
6
+ * @category Flashloans
7
+ */
8
+ export class BalancerV3FlashLoanAction extends Action {
9
+ /**
10
+ * @param tokens
11
+ * @param loanAmounts
12
+ * @param flParamGetterAddr
13
+ * @param flParamGetterData
14
+ */
15
+ constructor(tokens, loanAmounts, flParamGetterAddr = getAddr('Empty'), flParamGetterData = []) {
16
+ super('FLAction', getAddr('FLAction'), [
17
+ 'address[]',
18
+ 'uint256[]',
19
+ 'uint256[]',
20
+ 'address',
21
+ 'address',
22
+ 'bytes',
23
+ 'bytes',
24
+ ], [
25
+ tokens,
26
+ loanAmounts,
27
+ [],
28
+ getAddr('Empty'),
29
+ flParamGetterAddr,
30
+ flParamGetterData,
31
+ [],
32
+ ]);
33
+ this.flashLoanId = 10;
34
+ }
35
+ }
@@ -9,8 +9,8 @@ import { FlashLoanId } from './FlashLoanId';
9
9
  export declare class SparkFlashLoanAction extends ActionWithL2 implements FlashLoanId {
10
10
  flashLoanId: number;
11
11
  /**
12
- * @param loanAmounts
13
12
  * @param tokens
13
+ * @param loanAmounts
14
14
  * @param modes
15
15
  * @param loanPayer
16
16
  * @param flParamGetterAddr
@@ -7,8 +7,8 @@ import { getAddr } from '../../addresses';
7
7
  */
8
8
  export class SparkFlashLoanAction extends ActionWithL2 {
9
9
  /**
10
- * @param loanAmounts
11
10
  * @param tokens
11
+ * @param loanAmounts
12
12
  * @param modes
13
13
  * @param loanPayer
14
14
  * @param flParamGetterAddr
@@ -24,3 +24,4 @@ export * from './MorphoBlueFlashLoanAction';
24
24
  export * from './MorphoBlueFlashLoanPaybackAction';
25
25
  export * from './FLPaybackAction';
26
26
  export * from './CurveUsdFlashLoanAction';
27
+ export * from './BalancerV3FlashLoanAction';
@@ -24,3 +24,4 @@ export * from './MorphoBlueFlashLoanAction';
24
24
  export * from './MorphoBlueFlashLoanPaybackAction';
25
25
  export * from './FLPaybackAction';
26
26
  export * from './CurveUsdFlashLoanAction';
27
+ export * from './BalancerV3FlashLoanAction';
@@ -588,8 +588,8 @@ export const actionAddresses = {
588
588
  TransferNFT: '0xAC17f651591f417934EeA04CF6629584Eb50A4bB',
589
589
  TokenizedVaultAdapter: '0x1155BF929D78F1DeF999ACedE1867f79A7C66066',
590
590
  // Flashloan
591
- FLAction: '0x27c0bae2338ce28097122393faf90375b9395dd1',
592
- FLAaveV3: '0x27c0bae2338ce28097122393faf90375b9395dd1',
591
+ FLAction: '0x04ce4b2a9F524d976a8eD8a49B9313C5a2C3ccAD',
592
+ FLAaveV3: '0x04ce4b2a9F524d976a8eD8a49B9313C5a2C3ccAD',
593
593
  // AaveV3
594
594
  AaveV3Withdraw: '0xae56474aBe3C271579b513b6668864e39f65Ae15',
595
595
  AaveV3Supply: '0x7dFF34190d0307fC234fc7E8C152C9715083eB02',
@@ -622,8 +622,8 @@ export const actionAddresses = {
622
622
  TransferNFT: '0x6d1722AE426FF9f509726bdA037d5203d83e7818',
623
623
  TokenizedVaultAdapter: '0x75198244Ad7b3ebFCbFd67e6e06B1452bd6Fa831',
624
624
  // Flashloan
625
- FLAction: '0xa67f6A6Af60dD626ce7bF3d4705ABe5D593D90Ec',
626
- FLAaveV3: '0xa67f6A6Af60dD626ce7bF3d4705ABe5D593D90Ec',
625
+ FLAction: '0x40C9ce603923AACD0b7407Ff0EE844c9C067cEB7',
626
+ FLAaveV3: '0x40C9ce603923AACD0b7407Ff0EE844c9C067cEB7',
627
627
  // AaveV3
628
628
  AaveV3Withdraw: '0x4839d021A24820e57C31D386d430e2e82694F73B',
629
629
  AaveV3Supply: '0x9D95de57631DD8Ac071892843DA67FEe52EA3962',
@@ -707,7 +707,7 @@ export const otherAddresses = {
707
707
  Empty: '0x0000000000000000000000000000000000000000',
708
708
  },
709
709
  [NETWORKS.linea.chainId]: {
710
- RecipeExecutor: '0x50bCFC115283dF48Ab6382551B9B93b08E197747',
710
+ RecipeExecutor: '0x903F7C93FFC4AAbaBB096a7A722F1f057816B399',
711
711
  DFSRegistry: '0x09fBeC68D216667C3262211D2E5609578951dCE0',
712
712
  DSGuardFactory: '0x02a516861f41262f22617511d00b6fccab65f762',
713
713
  AdminVault: '0x71a9ef13c960c2f1dd17962d3592a5bcdfad6de0',
@@ -715,7 +715,7 @@ export const otherAddresses = {
715
715
  Empty: '0x0000000000000000000000000000000000000000',
716
716
  },
717
717
  [NETWORKS.plasma.chainId]: {
718
- RecipeExecutor: '0xB8af168883D049FF9C811ab5B5DE179f3e7d6Fb7',
718
+ RecipeExecutor: '0xe1315EE74E2A3057c0ede9E0E2cf30b3ee3ad121',
719
719
  DFSRegistry: '0x44e98bB58d725F2eF93a195F518b335dCB784c78',
720
720
  AdminVault: '0x6AB90ff536f0E2a880DbCdef1bB665C2acC0eDdC',
721
721
  DefisaverLogger: '0x02a516861f41262F22617511d00B6FCcAb65f762',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defisaver/sdk",
3
- "version": "1.3.23",
3
+ "version": "1.3.24",
4
4
  "description": "",
5
5
  "main": "./umd/index.js",
6
6
  "module": "./esm/src/index.js",
@@ -25,7 +25,7 @@ export class LimitSellAction extends ActionWithL2 {
25
25
  requireAddress(to);
26
26
  super(
27
27
  'LimitSell',
28
- getAddr('LimitSell'),
28
+ getAddr('Empty'),
29
29
  [
30
30
  ['address', 'address', 'uint256', 'uint256', 'uint256', 'uint256', 'address', 'address', 'bytes', ['address', 'address', 'address', 'uint256', 'uint256', 'bytes']],
31
31
  'address',
@@ -0,0 +1,65 @@
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, uint256 } from '../../types';
8
+
9
+ /**
10
+ * Limit sell action used as part of the LimitSell Strategy on L2
11
+ *
12
+ * @category BasicActions
13
+ */
14
+ export class LimitSellActionL2 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 gasUsed Amount of gas spent as part of the strategy
22
+ * @param l1GasCostInEth Additional tx cost for L1 in eth
23
+ * @param protocolFee 0x fee (amount of ETH in Wei)
24
+ */
25
+ constructor(exchangeOrder:Array<any>, from:EthAddress, to:EthAddress, gasUsed: uint256, l1GasCostInEth: uint256, protocolFee = '0') {
26
+ requireAddress(to);
27
+ super(
28
+ 'LimitSellL2',
29
+ getAddr('Empty'),
30
+ [
31
+ ['address', 'address', 'uint256', 'uint256', 'uint256', 'uint256', 'address', 'address', 'bytes', ['address', 'address', 'address', 'uint256', 'uint256', 'bytes']],
32
+ 'address',
33
+ 'address',
34
+ 'uint256',
35
+ 'uint256',
36
+ ],
37
+ [exchangeOrder, from, to, gasUsed, l1GasCostInEth],
38
+ );
39
+
40
+ this.protocolFee = protocolFee;
41
+
42
+ this.mappableArgs = [
43
+ this.args[0][0],
44
+ this.args[0][1],
45
+ this.args[0][2],
46
+ this.args[1],
47
+ this.args[2],
48
+ ];
49
+ }
50
+
51
+ encodeInputs() {
52
+ const executeActionDirectAbi: any = (ActionAbi.find(({ name }) => name === 'executeActionDirect'))!;
53
+ return AbiCoder.encodeFunctionCall(executeActionDirectAbi, this._encodeForCall());
54
+ }
55
+
56
+ async getAssetsToApprove() {
57
+ const asset = getAssetInfoByAddress(this.args[0][0]);
58
+ if (asset.symbol !== 'ETH') return [{ asset: this.args[0][0], owner: this.args[1] }];
59
+ return [];
60
+ }
61
+
62
+ async getEthValue() {
63
+ return this.protocolFee || '0';
64
+ }
65
+ }
@@ -17,6 +17,7 @@ export * from './TransferNFTAction';
17
17
  export * from './SendTokensAction';
18
18
  export * from './CreateSubAction';
19
19
  export * from './LSVSellAction';
20
+ export * from './LimitSellActionL2';
20
21
  export * from './ApproveTokenAction';
21
22
  export * from './SDaiWrapAction';
22
23
  export * from './SDaiUnwrapAction';
@@ -0,0 +1,49 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ import { EthAddress, uint256, bytes } from '../../types';
4
+ import { FlashLoanId } from './FlashLoanId';
5
+
6
+ /**
7
+ * Gets a flashloan from BalancerV3
8
+ *
9
+ * @category Flashloans
10
+ */
11
+ export class BalancerV3FlashLoanAction extends Action implements FlashLoanId {
12
+ public flashLoanId = 10;
13
+
14
+ /**
15
+ * @param tokens
16
+ * @param loanAmounts
17
+ * @param flParamGetterAddr
18
+ * @param flParamGetterData
19
+ */
20
+ constructor(
21
+ tokens: Array<EthAddress>,
22
+ loanAmounts: Array<uint256>,
23
+ flParamGetterAddr: EthAddress = getAddr('Empty'),
24
+ flParamGetterData: bytes = [],
25
+ ) {
26
+ super(
27
+ 'FLAction',
28
+ getAddr('FLAction'),
29
+ [
30
+ 'address[]',
31
+ 'uint256[]',
32
+ 'uint256[]',
33
+ 'address',
34
+ 'address',
35
+ 'bytes',
36
+ 'bytes',
37
+ ],
38
+ [
39
+ tokens,
40
+ loanAmounts,
41
+ [],
42
+ getAddr('Empty'),
43
+ flParamGetterAddr,
44
+ flParamGetterData,
45
+ [],
46
+ ],
47
+ );
48
+ }
49
+ }
@@ -12,8 +12,8 @@ export class SparkFlashLoanAction extends ActionWithL2 implements FlashLoanId {
12
12
  public flashLoanId = 7;
13
13
 
14
14
  /**
15
- * @param loanAmounts
16
15
  * @param tokens
16
+ * @param loanAmounts
17
17
  * @param modes
18
18
  * @param loanPayer
19
19
  * @param flParamGetterAddr
@@ -24,3 +24,4 @@ export * from './MorphoBlueFlashLoanAction';
24
24
  export * from './MorphoBlueFlashLoanPaybackAction';
25
25
  export * from './FLPaybackAction';
26
26
  export * from './CurveUsdFlashLoanAction';
27
+ export * from './BalancerV3FlashLoanAction';
package/src/addresses.ts CHANGED
@@ -698,8 +698,8 @@ export const actionAddresses = {
698
698
  TokenizedVaultAdapter: '0x1155BF929D78F1DeF999ACedE1867f79A7C66066',
699
699
 
700
700
  // Flashloan
701
- FLAction: '0x27c0bae2338ce28097122393faf90375b9395dd1', // fix temp
702
- FLAaveV3: '0x27c0bae2338ce28097122393faf90375b9395dd1',
701
+ FLAction: '0x04ce4b2a9F524d976a8eD8a49B9313C5a2C3ccAD', // fix temp
702
+ FLAaveV3: '0x04ce4b2a9F524d976a8eD8a49B9313C5a2C3ccAD',
703
703
 
704
704
  // AaveV3
705
705
  AaveV3Withdraw: '0xae56474aBe3C271579b513b6668864e39f65Ae15',
@@ -734,8 +734,8 @@ export const actionAddresses = {
734
734
  TokenizedVaultAdapter: '0x75198244Ad7b3ebFCbFd67e6e06B1452bd6Fa831',
735
735
 
736
736
  // Flashloan
737
- FLAction: '0xa67f6A6Af60dD626ce7bF3d4705ABe5D593D90Ec', // fix temp
738
- FLAaveV3: '0xa67f6A6Af60dD626ce7bF3d4705ABe5D593D90Ec',
737
+ FLAction: '0x40C9ce603923AACD0b7407Ff0EE844c9C067cEB7', // fix temp
738
+ FLAaveV3: '0x40C9ce603923AACD0b7407Ff0EE844c9C067cEB7',
739
739
 
740
740
  // AaveV3
741
741
  AaveV3Withdraw: '0x4839d021A24820e57C31D386d430e2e82694F73B',
@@ -829,7 +829,7 @@ export const otherAddresses = {
829
829
  Empty: '0x0000000000000000000000000000000000000000',
830
830
  },
831
831
  [NETWORKS.linea.chainId]: {
832
- RecipeExecutor: '0x50bCFC115283dF48Ab6382551B9B93b08E197747',
832
+ RecipeExecutor: '0x903F7C93FFC4AAbaBB096a7A722F1f057816B399',
833
833
  DFSRegistry: '0x09fBeC68D216667C3262211D2E5609578951dCE0',
834
834
  DSGuardFactory: '0x02a516861f41262f22617511d00b6fccab65f762',
835
835
  AdminVault: '0x71a9ef13c960c2f1dd17962d3592a5bcdfad6de0',
@@ -837,7 +837,7 @@ export const otherAddresses = {
837
837
  Empty: '0x0000000000000000000000000000000000000000',
838
838
  },
839
839
  [NETWORKS.plasma.chainId]: {
840
- RecipeExecutor: '0xB8af168883D049FF9C811ab5B5DE179f3e7d6Fb7',
840
+ RecipeExecutor: '0xe1315EE74E2A3057c0ede9E0E2cf30b3ee3ad121',
841
841
  DFSRegistry: '0x44e98bB58d725F2eF93a195F518b335dCB784c78',
842
842
  AdminVault: '0x6AB90ff536f0E2a880DbCdef1bB665C2acC0eDdC',
843
843
  DefisaverLogger: '0x02a516861f41262F22617511d00B6FCcAb65f762',