@defisaver/sdk 1.0.65 → 1.0.66-dev-2

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.
Files changed (59) hide show
  1. package/esm/src/actions/basic/ExecuteSafeTxAction.d.ts +23 -0
  2. package/esm/src/actions/basic/ExecuteSafeTxAction.js +60 -0
  3. package/esm/src/actions/basic/LimitSellAction.d.ts +24 -0
  4. package/esm/src/actions/basic/LimitSellAction.js +63 -0
  5. package/esm/src/actions/basic/RemoveTokenApprovalAction.d.ts +15 -0
  6. package/esm/src/actions/{llamalend/LlamaLendSelfLiquidateAction.js → basic/RemoveTokenApprovalAction.js} +19 -15
  7. package/esm/src/actions/basic/WrapEthAction.d.ts +2 -1
  8. package/esm/src/actions/basic/WrapEthAction.js +4 -3
  9. package/esm/src/actions/basic/index.d.ts +3 -0
  10. package/esm/src/actions/basic/index.js +3 -0
  11. package/esm/src/actions/index.d.ts +1 -2
  12. package/esm/src/actions/index.js +1 -2
  13. package/esm/src/actions/maker/MakerGiveAction.d.ts +1 -2
  14. package/esm/src/actions/maker/MakerGiveAction.js +2 -3
  15. package/esm/src/addresses.d.ts +0 -24
  16. package/esm/src/addresses.js +3 -10
  17. package/esm/src/index.d.ts +0 -96
  18. package/esm/src/triggers/OffchainPriceTrigger.d.ts +10 -0
  19. package/esm/src/triggers/OffchainPriceTrigger.js +12 -0
  20. package/esm/src/triggers/index.d.ts +1 -0
  21. package/esm/src/triggers/index.js +1 -0
  22. package/esm/src/utils/index.d.ts +1 -2
  23. package/esm/src/utils/index.js +1 -2
  24. package/package.json +1 -1
  25. package/src/actions/basic/ExecuteSafeTxAction.ts +85 -0
  26. package/src/actions/basic/LimitSellAction.ts +63 -0
  27. package/src/actions/basic/RemoveTokenApprovalAction.ts +39 -0
  28. package/src/actions/basic/WrapEthAction.ts +4 -3
  29. package/src/actions/basic/index.ts +3 -0
  30. package/src/actions/index.ts +0 -2
  31. package/src/actions/maker/MakerGiveAction.ts +2 -3
  32. package/src/addresses.ts +3 -11
  33. package/src/triggers/OffchainPriceTrigger.ts +14 -0
  34. package/src/triggers/index.ts +2 -0
  35. package/src/utils/index.ts +0 -2
  36. package/umd/index.js +658 -780
  37. package/esm/src/actions/llamalend/LlamaLendBorrowAction.d.ts +0 -15
  38. package/esm/src/actions/llamalend/LlamaLendBorrowAction.js +0 -22
  39. package/esm/src/actions/llamalend/LlamaLendCreateAction.d.ts +0 -22
  40. package/esm/src/actions/llamalend/LlamaLendCreateAction.js +0 -44
  41. package/esm/src/actions/llamalend/LlamaLendPaybackAction.d.ts +0 -22
  42. package/esm/src/actions/llamalend/LlamaLendPaybackAction.js +0 -43
  43. package/esm/src/actions/llamalend/LlamaLendSelfLiquidateAction.d.ts +0 -19
  44. package/esm/src/actions/llamalend/LlamaLendSupplyAction.d.ts +0 -20
  45. package/esm/src/actions/llamalend/LlamaLendSupplyAction.js +0 -40
  46. package/esm/src/actions/llamalend/LlamaLendWithdrawAction.d.ts +0 -15
  47. package/esm/src/actions/llamalend/LlamaLendWithdrawAction.js +0 -22
  48. package/esm/src/actions/llamalend/index.d.ts +0 -6
  49. package/esm/src/actions/llamalend/index.js +0 -6
  50. package/esm/src/utils/llamalend-utils.d.ts +0 -10
  51. package/esm/src/utils/llamalend-utils.js +0 -10
  52. package/src/actions/llamalend/LlamaLendBorrowAction.ts +0 -34
  53. package/src/actions/llamalend/LlamaLendCreateAction.ts +0 -49
  54. package/src/actions/llamalend/LlamaLendPaybackAction.ts +0 -48
  55. package/src/actions/llamalend/LlamaLendSelfLiquidateAction.ts +0 -41
  56. package/src/actions/llamalend/LlamaLendSupplyAction.ts +0 -44
  57. package/src/actions/llamalend/LlamaLendWithdrawAction.ts +0 -34
  58. package/src/actions/llamalend/index.ts +0 -6
  59. package/src/utils/llamalend-utils.ts +0 -11
@@ -18,3 +18,4 @@ export * from './SparkQuotePriceTrigger';
18
18
  export * from './LiquityDebtInFrontWithLimitTrigger';
19
19
  export * from './CurveUsdCollRatioTrigger';
20
20
  export * from './MorphoBlueRatioTrigger';
21
+ export * from './OffchainPriceTrigger';
@@ -6,5 +6,4 @@ 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
- import * as llamaLenUtils from './llamalend-utils';
10
- export { zeroExExchange, uniswapLP, uniswapV3LP, mstableAssetPairs, convexUtils, curveUtils, curveusdUtils, basicUtils, llamaLenUtils, };
9
+ export { zeroExExchange, uniswapLP, uniswapV3LP, mstableAssetPairs, convexUtils, curveUtils, curveusdUtils, basicUtils, };
@@ -6,5 +6,4 @@ 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
- import * as llamaLenUtils from './llamalend-utils';
10
- export { zeroExExchange, uniswapLP, uniswapV3LP, mstableAssetPairs, convexUtils, curveUtils, curveusdUtils, basicUtils, llamaLenUtils, };
9
+ export { zeroExExchange, uniswapLP, uniswapV3LP, mstableAssetPairs, convexUtils, curveUtils, curveusdUtils, basicUtils, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defisaver/sdk",
3
- "version": "1.0.65",
3
+ "version": "1.0.66-dev-2",
4
4
  "description": "",
5
5
  "main": "./umd/index.js",
6
6
  "module": "./esm/src/index.js",
@@ -0,0 +1,85 @@
1
+ import { Action } from '../../Action';
2
+ import { getAddr } from '../../addresses';
3
+ import {
4
+ EthAddress,
5
+ bytes,
6
+ uint256,
7
+ uint8,
8
+ } from '../../types';
9
+
10
+ /**
11
+ * ExecuteSafeTxAction - Execute Safe transaction
12
+ *
13
+ * @category BasicActions
14
+ */
15
+ export class ExecuteSafeTxAction extends Action {
16
+ /**
17
+ * @param safe Address of the Safe wallet
18
+ * @param to Destination address of Safe transaction
19
+ * @param value Ether value of Safe transaction
20
+ * @param data Data payload of Safe transaction
21
+ * @param operation Operation type of Safe transaction. 0 = call, 1 = delegateCall
22
+ * @param safeTxGas Gas that should be used for the Safe transaction
23
+ * @param baseGas Gas costs that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund)
24
+ * @param gasPrice Gas price that should be used for the payment calculation
25
+ * @param gasToken Token address (or 0 if ETH) that is used for the payment
26
+ * @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin
27
+ * @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v})
28
+ */
29
+ constructor(
30
+ safe: EthAddress,
31
+ to: EthAddress,
32
+ value: uint256,
33
+ data: bytes,
34
+ operation: uint8,
35
+ safeTxGas: uint256,
36
+ baseGas: uint256,
37
+ gasPrice: uint256,
38
+ gasToken: EthAddress,
39
+ refundReceiver: EthAddress,
40
+ signatures: bytes,
41
+ ) {
42
+ super(
43
+ 'ExecuteSafeTx',
44
+ getAddr('ExecuteSafeTx'),
45
+ [
46
+ 'address',
47
+ 'address',
48
+ 'uint256',
49
+ 'bytes',
50
+ 'uint8',
51
+ 'uint256',
52
+ 'uint256',
53
+ 'uint256',
54
+ 'address',
55
+ 'address',
56
+ 'bytes',
57
+ ],
58
+ [
59
+ safe,
60
+ to,
61
+ value,
62
+ data,
63
+ operation,
64
+ safeTxGas,
65
+ baseGas,
66
+ gasPrice,
67
+ gasToken,
68
+ refundReceiver,
69
+ signatures,
70
+ ],
71
+ );
72
+
73
+ this.mappableArgs = [
74
+ this.args[0],
75
+ this.args[1],
76
+ this.args[2],
77
+ this.args[4],
78
+ this.args[5],
79
+ this.args[6],
80
+ this.args[7],
81
+ this.args[8],
82
+ this.args[9],
83
+ ];
84
+ }
85
+ }
@@ -0,0 +1,63 @@
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
11
+ *
12
+ * @category BasicActions
13
+ */
14
+ export class LimitSellAction 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 protocolFee 0x fee (amount of ETH in Wei)
23
+ */
24
+ constructor(exchangeOrder:Array<any>, from:EthAddress, to:EthAddress, gasUsed: uint256, protocolFee = '0') {
25
+ requireAddress(to);
26
+ super(
27
+ 'LimitSell',
28
+ getAddr('LimitSell'),
29
+ [
30
+ ['address', 'address', 'uint256', 'uint256', 'uint256', 'uint256', 'address', 'address', 'bytes', ['address', 'address', 'address', 'uint256', 'uint256', 'bytes']],
31
+ 'address',
32
+ 'address',
33
+ 'uint256',
34
+ ],
35
+ [exchangeOrder, from, to, gasUsed],
36
+ );
37
+
38
+ this.protocolFee = protocolFee;
39
+
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
+
49
+ encodeInputs() {
50
+ const executeActionDirectAbi: any = (ActionAbi.find(({ name }) => name === 'executeActionDirect'))!;
51
+ return AbiCoder.encodeFunctionCall(executeActionDirectAbi, this._encodeForCall());
52
+ }
53
+
54
+ async getAssetsToApprove() {
55
+ const asset = getAssetInfoByAddress(this.args[0][0]);
56
+ if (asset.symbol !== 'ETH') return [{ asset: this.args[0][0], owner: this.args[1] }];
57
+ return [];
58
+ }
59
+
60
+ async getEthValue() {
61
+ return this.protocolFee || '0';
62
+ }
63
+ }
@@ -0,0 +1,39 @@
1
+ import { requireAddress } from '../../utils/general';
2
+ import { Action } from '../../Action';
3
+ import { getAddr } from '../../addresses';
4
+ import { EthAddress, uint256 } from '../../types';
5
+
6
+ /**
7
+ * Remove approval for a spender to pull tokens from user wallet
8
+ *
9
+ * @category BasicActions
10
+ */
11
+ export class RemoveTokenApprovalAction extends Action {
12
+ /**
13
+ * @param token Token address
14
+ * @param spender Spender address
15
+ */
16
+ constructor(token:EthAddress, spender:EthAddress) {
17
+ requireAddress(spender);
18
+ super(
19
+ 'RemoveTokenApproval',
20
+ getAddr('RemoveTokenApproval'),
21
+ [
22
+ 'address',
23
+ 'address',
24
+ ],
25
+ [
26
+ token,
27
+ spender,
28
+ ],
29
+ );
30
+ this.mappableArgs = [
31
+ this.args[0],
32
+ this.args[1],
33
+ ];
34
+ }
35
+
36
+ async getAssetsToApprove() {
37
+ return [];
38
+ }
39
+ }
@@ -10,13 +10,14 @@ import { uint256 } from '../../types';
10
10
  export class WrapEthAction extends ActionWithL2 {
11
11
  /**
12
12
  * @param amount Wrap amount
13
+ * @param includeEthInTx If true, the transaction will include the ETH value in the transaction
13
14
  */
14
- constructor(amount:uint256) {
15
- super('WrapEth', getAddr('WrapEth'), ['uint256'], [amount]);
15
+ constructor(amount:uint256, includeEthInTx = true) {
16
+ super('WrapEth', getAddr('WrapEth'), ['uint256', 'bool'], [amount, includeEthInTx]);
16
17
  }
17
18
 
18
19
  async getEthValue() {
19
- return this.args[0];
20
+ return this.args[1] ? this.args[0] : 0;
20
21
  }
21
22
 
22
23
  encodeInputs() {
@@ -24,3 +24,6 @@ export * from './TokenizedVaultAdapterDepositAction';
24
24
  export * from './TokenizedVaultAdapterMintAction';
25
25
  export * from './TokenizedVaultAdapterRedeemAction';
26
26
  export * from './TokenizedVaultAdapterWithdrawAction';
27
+ export * from './LimitSellAction';
28
+ export * from './ExecuteSafeTxAction';
29
+ export * from './RemoveTokenApprovalAction';
@@ -27,7 +27,6 @@ import * as lsv from './lsv';
27
27
  import * as curveusd from './curveusd';
28
28
  import * as spark from './spark';
29
29
  import * as morphoblue from './morpho-blue';
30
- import * as llamalend from './llamalend';
31
30
 
32
31
  export {
33
32
  aave,
@@ -59,5 +58,4 @@ export {
59
58
  spark,
60
59
  curveusd,
61
60
  morphoblue,
62
- llamalend,
63
61
  };
@@ -12,12 +12,11 @@ export class MakerGiveAction extends Action {
12
12
  /**
13
13
  * @param vaultId
14
14
  * @param newOwner
15
- * @param createProxy
16
15
  * @param mcdManager
17
16
  */
18
- constructor(vaultId:uint256, newOwner:EthAddress, createProxy:boolean, mcdManager:EthAddress = getAddr('McdCdpManager')) {
17
+ constructor(vaultId:uint256, newOwner:EthAddress, mcdManager:EthAddress = getAddr('McdCdpManager')) {
19
18
  requireAddress(newOwner);
20
- super('McdGive', getAddr('McdGive'), ['uint256', 'address', 'bool', 'address'], [vaultId, newOwner, createProxy, mcdManager]);
19
+ super('McdGive', getAddr('McdGive'), ['uint256', 'address', 'address'], [vaultId, newOwner, mcdManager]);
21
20
 
22
21
  this.mappableArgs = [
23
22
  this.args[0],
package/src/addresses.ts CHANGED
@@ -24,7 +24,7 @@ export const actionAddresses = {
24
24
  TokenizedVaultAdapter: '0x3944364Ce3a273D269707484F3a676fCa17E08b8',
25
25
 
26
26
  // exchange
27
- DFSSell: '0x951D7B421f45FF0e4A8ddE0288aE3f9C2C69b784',
27
+ DFSSell: '0x561013c605A17f5dC5b738C8a3fF9c5F33DbC3d8',
28
28
 
29
29
  // maker
30
30
  McdGenerate: '0xCb50a91C0f12f439b8bf11E9474B9c1ED62Bf7a3',
@@ -122,7 +122,7 @@ export const actionAddresses = {
122
122
  FLMaker: '0x672DE08e36A1698fD5e9E34045F81558dB4c1AFE',
123
123
  FLBalancer: '0x540a83E36E5E6Aa916A6c591934d800e17115048',
124
124
  FLSpark: '0xe9Fe5a0f5e4B370Ae60d837da58744666D5C06F7',
125
- FLAction: '0x72915D41982DfCAf30b871290618E59C45Edba7F',
125
+ FLAction: '0x2b10B000292745099Deb15304A247c0816bd8b73',
126
126
  FLUniV3: '0x9CAdAC8Be718572F82B672b950c53F0b58483A35',
127
127
  FLGho: '0xbb67b81dD080a406227A38965d0393f396ddECBc',
128
128
  FLMorphoBlue: '0x6206C96EAc5EAC546861438A9f953B6BEa50EBAB',
@@ -257,14 +257,6 @@ export const actionAddresses = {
257
257
  MorphoBluePayback: '0x9f437E5F705E02d77adC2e72C34926978776b085',
258
258
  MorphoBlueSetAuth: '0xf30935e20c6357c7bcecd5e58ad6de26d54b9f64',
259
259
  MorphoBlueSetAuthWithSig: '0xE2d5fCDBf73BAd24A0FCAf6B2733933A98021808',
260
-
261
- // llamalend
262
- LlamaLendCreate: '0x4349be191ea63173eD98b7fC1b0DeC1ef9Bc6c11',
263
- LlamaLendSupply: '0x1900eF943bD1b038c58d9F35C3825F119F9BB730',
264
- LlamaLendBorrow: '0xCF693585C47049F3eACc2285E7Fe4e80123b2520',
265
- LlamaLendWithdraw: '0x2593Da3c4110C531541424e9e847cd7905894C52',
266
- LlamaLendPayback: '0x5b506b7a0117dbcd086632575da599bb603eb602',
267
- LlamaLendSelfLiquidate: '0xe4944e0e46177300fa4c351ef72b95b9655e8394',
268
260
  },
269
261
  [NETWORKS.optimism.chainId]: {
270
262
  DFSSell: '0xC6c601fcAa870efd26C624F8c65fbc54cBe533b1',
@@ -400,7 +392,7 @@ export const actionAddresses = {
400
392
 
401
393
  export const otherAddresses = {
402
394
  [NETWORKS.ethereum.chainId]: {
403
- RecipeExecutor: '0x1D6DEdb49AF91A11B5C5F34954FD3E8cC4f03A86',
395
+ RecipeExecutor: '0x10B748Dc504C2515Bb6A9e23CB2F686090b6c584',
404
396
  DFSRegistry: '0x287778F121F134C66212FB16c9b53eC991D32f5b',
405
397
  DFSProxyRegistry: '0x29474FdaC7142f9aB7773B8e38264FA15E3805ed',
406
398
  ProxyRegistry: '0x4678f0a6958e4D2Bc4F1BAF7Bc52E8F3564f3fE4',
@@ -0,0 +1,14 @@
1
+ import { Action } from '../Action';
2
+ import { getAddr } from '../addresses';
3
+ import { uint256, uint8 } from '../types';
4
+
5
+ /**
6
+ *
7
+ *
8
+ * @category Triggers
9
+ */
10
+ export class OffchainPriceTrigger extends Action {
11
+ constructor(limitPrice:uint256, limitType: uint8) {
12
+ super('OffchainPriceTrigger', getAddr('OffchainPriceTrigger'), ['uint256', 'uint8'], [limitPrice, limitType]);
13
+ }
14
+ }
@@ -18,3 +18,5 @@ export * from './SparkQuotePriceTrigger';
18
18
  export * from './LiquityDebtInFrontWithLimitTrigger';
19
19
  export * from './CurveUsdCollRatioTrigger';
20
20
  export * from './MorphoBlueRatioTrigger';
21
+ export * from './OffchainPriceTrigger';
22
+
@@ -6,7 +6,6 @@ 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
- import * as llamaLenUtils from './llamalend-utils';
10
9
 
11
10
  export {
12
11
  zeroExExchange,
@@ -17,5 +16,4 @@ export {
17
16
  curveUtils,
18
17
  curveusdUtils,
19
18
  basicUtils,
20
- llamaLenUtils,
21
19
  };