@defisaver/sdk 0.1.7 → 0.1.11

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 (43) hide show
  1. package/ACTIONS.md +236 -19
  2. package/AccessLists/AaveAccessLists.js +28 -0
  3. package/AccessLists/BalancerAccessLists.js +20 -0
  4. package/AccessLists/CompoundAccessLists.js +33 -0
  5. package/AccessLists/DyDxAccessLists.js +14 -0
  6. package/AccessLists/FlashLoanAccessLists.js +27 -0
  7. package/AccessLists/GuniAccessLists.js +15 -0
  8. package/AccessLists/InstaAccessLists.js +17 -0
  9. package/AccessLists/LidoAccessLists.js +21 -0
  10. package/AccessLists/LiquityAccessLists.js +81 -0
  11. package/AccessLists/MStableAccessLists.js +18 -0
  12. package/AccessLists/MakerAccessLists.js +44 -0
  13. package/AccessLists/RariAccessLists.js +12 -0
  14. package/AccessLists/ReflexerAccessLists.js +53 -0
  15. package/AccessLists/UniswapAccessLists.js +41 -0
  16. package/AccessLists/UtilsAccessLists.js +41 -0
  17. package/AccessLists/YearnAccessLists.js +14 -0
  18. package/AccessLists/index.js +41 -0
  19. package/DEV.md +14 -0
  20. package/package.json +2 -2
  21. package/src/Action.js +13 -0
  22. package/src/Recipe.js +21 -1
  23. package/src/actions/aave/index.js +0 -2
  24. package/src/actions/basic/AutomationV2Unsub.js +2 -2
  25. package/src/actions/flashloan/BalancerFlashLoanAction.js +2 -2
  26. package/src/actions/flashloan/BalancerFlashLoanPaybackAction.js +2 -2
  27. package/src/actions/flashloan/MakerFlashLoanPaybackAction.js +2 -2
  28. package/src/actions/guni/GUniDeposit.js +43 -0
  29. package/src/actions/guni/GUniWithdraw.js +32 -0
  30. package/src/actions/guni/index.js +6 -0
  31. package/src/actions/index.js +6 -0
  32. package/src/actions/mstable/MStableClaimAction.js +38 -0
  33. package/src/actions/mstable/MStableDepositAction.js +63 -0
  34. package/src/actions/mstable/MStableWithdrawAction.js +66 -0
  35. package/src/actions/mstable/index.js +9 -0
  36. package/src/actions/rari/RariDepositAction.js +31 -0
  37. package/src/actions/rari/RariWithdrawAction.js +33 -0
  38. package/src/actions/rari/index.js +6 -0
  39. package/src/addresses.js +16 -2
  40. package/test/accessLists/MockAccessLists.json +1482 -0
  41. package/test/accessLists/Recipe.js +123 -0
  42. package/test/accessLists/access-lists.js +101 -0
  43. package/src/actions/aave/AaveMigrateLendAction.js +0 -18
@@ -0,0 +1,31 @@
1
+ const Action = require("../../Action");
2
+ const { getAssetInfo } = require("@defisaver/tokens");
3
+ const { getAddr } = require('../../addresses.js');
4
+
5
+ /**
6
+ * RariDepositAction - action that deposits one stablecoin (DAI, USDC, USDT, TUSD, BUSD, and sUSD) and receives RSPT back
7
+ */
8
+ class RariDepositAction extends Action {
9
+ /**
10
+ * @param fundManager {EthAddress} fundManager for the pool which we want to deposit into
11
+ * @param stablecoinAddress {EthAddress} stablecoin token address
12
+ * @param poolTokenAddress {EthAddress} poolTokenAddress
13
+ * @param amount {string} amount of stablecoin to pull and deposit
14
+ * @param from {EthAddress} stablecoins will be taken from this address
15
+ * @param to {EthAddress} RSPT will be sent to this address
16
+ */
17
+ constructor(fundManager, stablecoinAddress, poolTokenAddress, amount, from, to) {
18
+ super('RariDeposit', getAddr('RariDeposit'), [['address', 'address', 'address', 'uint256', 'address', 'address']], [[fundManager, stablecoinAddress, poolTokenAddress, amount, from, to]]);
19
+ this.mappableArgs = [
20
+ this.args[0][3],
21
+ this.args[0][4],
22
+ this.args[0][5],
23
+ ];
24
+ }
25
+
26
+ async getAssetsToApprove() {
27
+ return [{asset: this.args[0][1], owner: this.args[0][4]}];
28
+ }
29
+ }
30
+
31
+ module.exports = RariDepositAction;
@@ -0,0 +1,33 @@
1
+ const Action = require("../../Action");
2
+ const { getAssetInfo } = require("@defisaver/tokens");
3
+ const { getAddr } = require('../../addresses.js');
4
+
5
+ /**
6
+ * RariWithdrawAction - Send pool tokens to fund manager which burns them, receive underlying stablecoin back
7
+ */
8
+ class RariWithdrawAction extends Action {
9
+ /**
10
+ * @param fundManager {EthAddress} fundManager for the pool which we want to withdraw from
11
+ * @param poolTokenAddress {EthAddress} poolToken address
12
+ * @param poolTokensAmountToPull {string} amount of tokens to pull to proxy
13
+ * @param from {EthAddress} poolTokens will be taken from this address
14
+ * @param stablecoinAddress {EthAddress} stablecoin token address
15
+ * @param stablecoinAmountToWithdraw {string} amount of stablecoin to withdraw from Rari
16
+ * @param to {EthAddress} stablecoins withdrawn will be sent to this address
17
+ */
18
+ constructor(fundManager, poolTokenAddress, poolTokensAmountToPull, from, stablecoinAddress, stablecoinAmountToWithdraw, to) {
19
+ super('RariWithdraw', getAddr('RariWithdraw'), [['address', 'address', 'uint256', 'address', 'address', 'uint256', 'address']], [[fundManager, poolTokenAddress, poolTokensAmountToPull, from, stablecoinAddress, stablecoinAmountToWithdraw, to]]);
20
+ this.mappableArgs = [
21
+ this.args[0][2],
22
+ this.args[0][3],
23
+ this.args[0][5],
24
+ this.args[0][6],
25
+ ];
26
+ }
27
+
28
+ async getAssetsToApprove() {
29
+ return [{asset: this.args[0][1], owner: this.args[0][3]}];
30
+ }
31
+ }
32
+
33
+ module.exports = RariWithdrawAction;
@@ -0,0 +1,6 @@
1
+ const RariDepositAction = require('./RariDepositAction');
2
+ const RariWithdrawAction = require('./RariWithdrawAction');
3
+ module.exports = {
4
+ RariDepositAction,
5
+ RariWithdrawAction,
6
+ }
package/src/addresses.js CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  const actionAddresses = {
4
4
  'TaskExecutor': '0xb3e5371d55e1e84bfFE7D0b57Bd9c6A4C6b3C635',
5
+ 'DFSRegistry': '0xD6049E1F5F3EfF1F921f5532aF1A1632bA23929C',
5
6
 
6
7
  // utils
7
8
  'WrapEth': '0x9E702937F42Db2cE58342Ca5F213Ef33D51AEF6b',
@@ -15,7 +16,7 @@ const actionAddresses = {
15
16
  'AutomationV2Unsub': '0xd3D70313d1E2ab6ae47674C88390Fd9865806201',
16
17
 
17
18
  // exchange
18
- 'DFSSell': '0x9A765623F9De2D7dB26afb5f7Bb85592DF094CDB',
19
+ 'DFSSell': '0xf4adae649B2c3B2795608b2D222c852929944898',
19
20
  'DFSBuy': '0x939dCad6A3D1fEACccB60Af90876D904468CbF66',
20
21
 
21
22
  // maker
@@ -79,7 +80,7 @@ const actionAddresses = {
79
80
  'YearnWithdraw': '0x5BDf949c3a74E4F78328f6ad1F3697CC8edbe1A2',
80
81
 
81
82
  // liquity
82
- 'LiquityClose': '0x4Eb6e5C7fbf7b6850912f893B85bB87109E86a1f',
83
+ 'LiquityClose': '0x9C563dc9F8e3FcCF996DAB4b6B6003fb7Bbca90f',
83
84
  'LiquityBorrow': '0x46e8fE6bbE3C08eCc250295583490be9ac97B969',
84
85
  'LiquityOpen': '0x50D69350E2629987551C563E19D29dee6Faf3A78',
85
86
  'LiquityPayback': '0x86eCa72dF81ae76AfF0dEeC01521154F33147e46',
@@ -106,6 +107,19 @@ const actionAddresses = {
106
107
  'BalancerV2Supply': '0xD78E5D95A28a67F7851b0a94505790813A92E405',
107
108
  'BalancerV2Withdraw': '0xCcf4b96407BEF25D7df1c95045CCF64950e73E97',
108
109
  'BalancerV2Claim': '0x259Ae83567858B7960d2De0D00F3717a764aD73B',
110
+
111
+ // GUni
112
+ 'GUniWithdraw': '0xa329263fFac25F86E03481Ec39307bbf5DbeDD83',
113
+ 'GUniDeposit': '0xe943958f01630038c23f8471a2d0ea4378e58b0d',
114
+
115
+ // Rari
116
+ 'RariDeposit': '0xC627A3F12c4f7236218a511DC10e3f5ead1a1D7c',
117
+ 'RariWithdraw': '0x8408EeCcC2c2FC25F2cF720398DAAD0A05EfE487',
118
+
119
+ // mStable
120
+ 'MStableDeposit': '0x1887235CFE1927782a3e7eD15fb073586c949858',
121
+ 'MStableWithdraw': '0xb164456190577fbBe8FB8bF5Fa48a106b328A579',
122
+ 'MStableClaim': '0x28279A806aDeDedFD33e39C7375dc0c0ee943847',
109
123
  };
110
124
 
111
125
  const otherAddresses = {