@defisaver/sdk 0.1.22 → 0.2.0

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 (81) hide show
  1. package/ACTIONS.md +20 -254
  2. package/AccessLists/DyDxAccessLists.js +0 -4
  3. package/AccessLists/InstaAccessLists.js +0 -8
  4. package/AccessLists/UtilsAccessLists.js +0 -5
  5. package/DEV.md +0 -7
  6. package/index.js +4 -0
  7. package/package.json +1 -1
  8. package/src/Action.js +36 -6
  9. package/src/Recipe.js +5 -4
  10. package/src/Strategy.js +63 -0
  11. package/src/abis/Action.json +157 -11
  12. package/src/abis/Recipe.json +92 -47
  13. package/src/actions/aave/AaveBorrowAction.js +11 -2
  14. package/src/actions/aave/AavePaybackAction.js +11 -2
  15. package/src/actions/aave/AaveSupplyAction.js +9 -1
  16. package/src/actions/aave/AaveWithdrawAction.js +8 -1
  17. package/src/actions/basic/GasFeeAction.js +27 -0
  18. package/src/actions/basic/PullTokenAction.js +9 -3
  19. package/src/actions/basic/SellAction.js +6 -5
  20. package/src/actions/basic/SendTokenAction.js +9 -3
  21. package/src/actions/basic/SendTokenAndUnwrapAction.js +36 -0
  22. package/src/actions/basic/SumInputsAction.js +8 -3
  23. package/src/actions/basic/UnwrapEthAction.js +8 -3
  24. package/src/actions/basic/UpdateSubAction.js +19 -0
  25. package/src/actions/basic/WrapEthAction.js +5 -1
  26. package/src/actions/basic/index.js +6 -2
  27. package/src/actions/checkers/MakerRatioCheckAction.js +29 -0
  28. package/src/actions/checkers/index.js +5 -0
  29. package/src/actions/compound/CompoundBorrowAction.js +7 -1
  30. package/src/actions/compound/CompoundClaimAction.js +6 -1
  31. package/src/actions/compound/CompoundPaybackAction.js +7 -1
  32. package/src/actions/compound/CompoundSupplyAction.js +7 -1
  33. package/src/actions/compound/CompoundWithdrawAction.js +7 -1
  34. package/src/actions/dydx/DyDxWithdrawAction.js +7 -1
  35. package/src/actions/dydx/index.js +0 -2
  36. package/src/actions/flashloan/AaveV2FlashLoanAction.js +2 -2
  37. package/src/actions/flashloan/BalancerFlashLoanAction.js +2 -2
  38. package/src/actions/flashloan/DyDxFlashLoanAction.js +1 -1
  39. package/src/actions/flashloan/MakerFlashLoanAction.js +2 -2
  40. package/src/actions/index.js +2 -0
  41. package/src/actions/insta/index.js +0 -2
  42. package/src/actions/liquity/LiquityClaimAction.js +6 -2
  43. package/src/actions/liquity/LiquityCloseAction.js +7 -2
  44. package/src/actions/maker/MakerGenerateAction.js +8 -1
  45. package/src/actions/maker/MakerGiveAction.js +7 -1
  46. package/src/actions/maker/MakerMergeAction.js +7 -1
  47. package/src/actions/maker/MakerOpenVaultAction.js +6 -1
  48. package/src/actions/maker/MakerPaybackAction.js +1 -0
  49. package/src/actions/maker/MakerRatioAction.js +20 -0
  50. package/src/actions/maker/MakerSupplyAction.js +9 -1
  51. package/src/actions/maker/MakerWithdrawAction.js +10 -2
  52. package/src/actions/maker/index.js +2 -0
  53. package/src/actions/mstable/MStableDepositAction.js +2 -2
  54. package/src/actions/mstable/MStableWithdrawAction.js +2 -2
  55. package/src/actions/reflexer/ReflexerGenerateAction.js +7 -1
  56. package/src/actions/reflexer/ReflexerOpenSafeAction.js +5 -1
  57. package/src/actions/reflexer/ReflexerPaybackAction.js +7 -1
  58. package/src/actions/reflexer/ReflexerSupplyAction.js +8 -1
  59. package/src/actions/reflexer/ReflexerWithdrawAction.js +8 -1
  60. package/src/addresses.js +91 -91
  61. package/src/triggers/ChainLinkPriceTrigger.js +12 -0
  62. package/src/triggers/CompoundRatioTrigger.js +11 -0
  63. package/src/triggers/GasPriceTrigger.js +11 -0
  64. package/src/triggers/LiquityRatioTrigger.js +15 -0
  65. package/src/triggers/MakerRatioTrigger.js +15 -0
  66. package/src/triggers/ReflexerRatioTrigger.js +10 -0
  67. package/src/triggers/TimestampTrigger.js +11 -0
  68. package/src/triggers/UniV3CurrentTickTrigger.js +12 -0
  69. package/src/triggers/index.js +19 -0
  70. package/src/utils/general.js +2 -0
  71. package/src/utils/zeroExExchange.js +2 -40
  72. package/test/accessLists/MockAccessLists.json +0 -72
  73. package/test/accessLists/Recipe.js +3 -3
  74. package/test/actions/insta/InstPullTokensAction.js +2 -2
  75. package/test/utils/zeroExExchange.js +0 -8
  76. package/src/actions/basic/BuyAction.js +0 -53
  77. package/src/actions/dydx/DyDxSupplyAction.js +0 -25
  78. package/src/actions/insta/ClaimInstMakerAction.js +0 -21
  79. package/test/actions/basic/BuyAction.js +0 -100
  80. package/test/actions/dydx/DyDxSupplyAction.js +0 -78
  81. package/test/actions/insta/ClaimInstMakerAction.js +0 -46
package/src/addresses.js CHANGED
@@ -1,133 +1,133 @@
1
1
 
2
2
 
3
3
  const actionAddresses = {
4
- 'TaskExecutor': '0xb3e5371d55e1e84bfFE7D0b57Bd9c6A4C6b3C635',
5
- 'DFSRegistry': '0xD6049E1F5F3EfF1F921f5532aF1A1632bA23929C',
4
+ 'RecipeExecutor': '0xe822d76c2632FC52f3eaa686bDA9Cea3212579D8',
5
+ 'DFSRegistry': '0x287778F121F134C66212FB16c9b53eC991D32f5b',
6
6
 
7
7
  // utils
8
- 'WrapEth': '0x9E702937F42Db2cE58342Ca5F213Ef33D51AEF6b',
9
- 'UnwrapEth': '0x5cD02A169CfE5B0596B352547879Dd60B7033488',
10
- 'PullToken': '0x795a89f6D4E97A959fe81aa22772441323783479',
11
- 'SendToken': '0xBbe0D7f2AF01aE678f8A873CB2d2EB73871C9b5A',
12
- 'SumInputs': '0xCdef35425579fc566B6Ee0499A79256ac88d25cf',
13
- 'SubInputs': '0x3f71c5b806c2aCFA88bd7Ae5F7f8A14121E0FcA6',
14
- 'ChangeProxyOwner': '0x32cEdFfF6e64f6cD1907Ae0b27b78c36320587E7',
15
- 'TokenBalance': '0xFEb82445aEaA675D59A43CD5833f5A6807f97ea2',
16
- 'AutomationV2Unsub': '0xd3D70313d1E2ab6ae47674C88390Fd9865806201',
8
+ 'WrapEth': '0x8EbBd35f84D7f0DFCBEf08fD30CD09176133251A',
9
+ 'UnwrapEth': '0xDB6C8cFDd7c1C0F8895CDBC01Dbf4A6D4B6d2a29',
10
+ 'PullToken': '0x254cA89a00d53ab61de2Ba5641DBDC01aE48aed4',
11
+ 'SendToken': '0x5612e490c9549486dF16b34EBfD0E8b6cF6a1717',
12
+ 'SumInputs': '0x70907d840aBBc984Fd949311d2f005e6aC4a4D7a',
13
+ 'SubInputs': '0xe1804b756188F63f723d2FECc02988D0Cc1aB823',
14
+ 'ChangeProxyOwner': '0x81cA52CfE66421d0ceF82d5F33230e43b5F23D2B',
15
+ 'TokenBalance': '0xa92B177950F1460119940436515FD857C24494BC',
16
+ 'AutomationV2Unsub': '0xe35Fb12fE9796847751076aCf5ee7d124108612C',
17
+ 'SendTokenAndUnwrap': '0xeecd376026335261c89faD40D89625391b1eFF6a',
17
18
 
18
19
  // exchange
19
- 'DFSSell': '0xf4adae649B2c3B2795608b2D222c852929944898',
20
- 'DFSBuy': '0x939dCad6A3D1fEACccB60Af90876D904468CbF66',
20
+ 'DFSSell': '0x1abDDCae131ce200e66140d9fBd0C37F7a40e642',
21
21
 
22
22
  // maker
23
- 'McdGenerate': '0x2bF4586636329Ae930cFe085a1e57BAb4a8f741b',
24
- 'McdGive': '0xD2dc5DA4172a3901C9f26c7cd29eFE656Fc20332',
25
- 'McdMerge': '0x66c7f4C7e59b6e780142aaD5c9f427FA5F8dfFc6',
26
- 'McdOpen': '0x72AFC60B90c976397C37B5c64DDc067Ea521D388',
27
- 'McdPayback': '0xb7C2c78846493Bed18fa07B51fcc5EAFAc9d629C',
28
- 'McdSupply': '0x91c3167aC51F92c2f720C6A8418FDF46060698A1',
29
- 'McdWithdraw': '0x3c232F0ae183C3e2eb421e8e317318Dfe85a7b10',
30
- 'McdClaim': '0xd78783b50227A84d43604843065494e2666182Ab',
23
+ 'McdGenerate': '0xCb50a91C0f12f439b8bf11E9474B9c1ED62Bf7a3',
24
+ 'McdGive': '0xf9556A87BF424834FDe7De0547b58E36Cb42EF01',
25
+ 'McdMerge': '0x6D06C6c2BCeaEC31b0F8Cd68C594120dDCcCC427',
26
+ 'McdOpen': '0x1b54e8b6073ac7382c42830BE715466aDA11Cf37',
27
+ 'McdPayback': '0xE68AeD979Af6f85516fF485D098804c0f9eD9A5b',
28
+ 'McdSupply': '0x84372e73e1A2E95510869D2D81A3ef1AEC9e0Da8',
29
+ 'McdWithdraw': '0xa704FBBe2f7ea8eF45a8280f6Bf96939eBC73252',
30
+ 'McdClaim': '0xc0FC0f5Ba156E16217F8C7f400AEc0a658419C13',
31
31
 
32
32
  // reflexer
33
- 'ReflexerSupply': '0x24C537A93A9ab75b5A593BA0B2dc03200345A844',
34
- 'ReflexerWithdraw': '0xcA99fB3430180E43bC1929a3a84d0500E3118e0A',
35
- 'ReflexerPayback': '0x0c8320033340277791C5dCD9BC87d20f086BB34b',
36
- 'ReflexerGenerate': '0x28E78093dF6d370Ca9ea1aC85668d8a097f09087',
37
- 'ReflexerOpen': '0xcf174aFFbB7be200afa37Dfc4CD067ae3Cb91054',
38
- 'ReflexerNativeUniV2SaviourDeposit':'0x5F66CC360657Bf224aa280Ae104550b5042E185a',
39
- 'ReflexerNativeUniV2SaviourGetReserves':'0x9C7518F7a0f5bC4D57702fcE8C0778F7Fb2f09f8',
40
- 'ReflexerNativeUniV2SaviourWithdraw':'0x6a61363243Cad1BE5caaE5e53284520592deB154',
33
+ 'ReflexerSupply': '0xd7a36CD4ce7CCc2F1376Dc5C48BaC84380A4f698',
34
+ 'ReflexerWithdraw': '0xD8a14d447AB6789F3bf1Eb763b6306db3FC3d666',
35
+ 'ReflexerPayback': '0xcC6838d8a61a4b29Ea565d39C38b830f1491cb29',
36
+ 'ReflexerGenerate': '0x8e8Fd178A5FAE3A29F9CB1A06aBBBCFd5B83beb7',
37
+ 'ReflexerOpen': '0x4704a7cBd4d913d1233765B70531D601b4384011',
38
+
39
+ // not deployed as currently not used
40
+ 'ReflexerNativeUniV2SaviourDeposit':'0x0000000000000000000000000000000000000000',
41
+ 'ReflexerNativeUniV2SaviourGetReserves':'0x0000000000000000000000000000000000000000',
42
+ 'ReflexerNativeUniV2SaviourWithdraw':'0x0000000000000000000000000000000000000000',
41
43
 
42
44
  // aave
43
- 'AaveBorrow': '0xEdBbF97C505309e5174E164fbec3cAE774d310Ea',
44
- 'AavePayback': '0xb583Bc7603E5E482F475Ec9Ea90129029D53fbc8',
45
- 'AaveSupply': '0xC71113E9122465e8bCd42123f840Df99abaF29F1',
46
- 'AaveWithdraw': '0xE06Fc1CBD78Eb0799d5B0ca62D51B065886e08FC',
47
- 'AaveCollateralSwitch': '0x27d77c80A88665342C98Ea31B687A5fc8ca9a445',
45
+ 'AaveBorrow': '0x1B95E800a869bc3F89914470a7901D93D1401cD1',
46
+ 'AavePayback': '0x066225964999F1D07C888c5Ac4a6C885bDa88b9A',
47
+ 'AaveSupply': '0xEbB200a529058B561B42Eab510DA157a63243CEc',
48
+ 'AaveWithdraw': '0x754C58fA92246414a448c1ed44ea3D1AD446d482',
49
+ 'AaveCollateralSwitch': '0xFf5dfF1B90bd5Aa6E12768AB497dB90cc9DE6F5d',
48
50
 
49
51
  // compound
50
- 'CompBorrow': '0xde1b05266f2D05Bf9216B76500583c2b7785b7e9',
51
- 'CompClaim': '0xAA165C03fF61301b79f35649157f6738263739A3',
52
- 'CompPayback': '0x67D2CC825730cCb70FD4579E55cDb3cf3152fcb6',
53
- 'CompSupply': '0x1F22890C166B30cE8769b7B55354064C254e063F',
54
- 'CompWithdraw': '0xD326a003bcfDbad0E9A4Ccc37a76Ce264345F38a',
55
- 'CompGetDebt': '0x009109AB7b8CAFf748cdA2F272F36043528Bef2C',
56
- 'CompCollateralSwitch': '0x1c0BD1E4da2c3108f6caA64609E89a37531B0f86',
52
+ 'CompBorrow': '0x8495579BF6Ae848f7E59686536F834f1d2CCd79C',
53
+ 'CompClaim': '0x81F488cF7A0128A9DB5e7207042cCAB1CB0ac902',
54
+ 'CompPayback': '0x2881590d5FfBd1e88BFc0Dc292f10e5377977f87',
55
+ 'CompSupply': '0xB4CEDe40b249b756Ce0EAa3e14F6af89f25f9a3d',
56
+ 'CompWithdraw': '0x3792F83D6A82091cb53052458038CC86e206463F',
57
+ 'CompGetDebt': '0xc2B8f8423bc8Fe2e9A44cA9d364d835D1751b725',
58
+ 'CompCollateralSwitch': '0xC3d89139508A3883775D3d1E62E2A0fea363b448',
57
59
 
58
60
  // flashloan
59
- 'FLAaveV2': '0x45F17B18134B4398468A5bcdCdf22f0e1cAbEad5',
60
- 'FLDyDx': '0x973065599BACa33FC9CAD2823710f1332D2B7805',
61
- 'FLMaker': '0xEA2C6B373Ea3e596995d2523a74592E22EE49BFF',
62
- 'FLBalancer': '0x81c69A428fDB21bBaB8A7434fF511382058c29dC',
61
+ 'FLAaveV2': '0xa4d52ED15018a5be4adE5796899e5d75cc8759C1',
62
+ 'FLDyDx': '0x08AC78B418fCB0DDF1096533856A757C28d430d7',
63
+ 'FLMaker': '0xd393582bE148A45585aB202Fa7Cc789Fa5127223',
64
+ 'FLBalancer': '0x5C7a9f4635AE4F95da2e45317311AAe255FB71B3',
63
65
 
64
66
  // uniswap
65
- 'UniSupply': '0xcAE220B5398AfAad75bfeb946164f6C23CF65A98',
66
- 'UniWithdraw': '0x847aF4eFDf64E4F54Af95D3b867DfC92f4Ea91B4',
67
+ 'UniSupply': '0x9935e12F0218E61c27D7f23eAC9A9D6881a078eC',
68
+ 'UniWithdraw': '0xf8bb8F68b0A45DC315F3f7602a60cfb274B00951',
67
69
 
68
70
  // uniswap V3
69
- 'UniCollectV3': '0x4D49FB2Cc0DF856b936CCA1816A9e6DD0ADFa232',
70
- 'UniMintV3': '0x488794Aa06Ec668fDeC29375CB8B6629f4692B0B',
71
- 'UniSupplyV3': '0x1dc3C2c16195bD6e49f6ED05F1f482c3C7FD35Af',
72
- 'UniWithdrawV3': '0xe5FAB89bdC01130c686B35540531EB1cBbaE8ff3',
73
- 'UniCreatePoolV3': '0xAD599cA05C7295a0cbc5CD696BF3f7E633402C99',
71
+ 'UniCollectV3': '0x331D7C3F6E710cB6cFE94c4Aa04AC3345AC00e00',
72
+ 'UniMintV3': '0x3dF75BE8Fb0a6186BE9705cACaa6dD2a4Ec3e40C',
73
+ 'UniSupplyV3': '0x0CA4255b37DD083dBD48Ca74d575F46037992520',
74
+ 'UniWithdrawV3': '0xe06224593D9c860B2fBF39eEA3b9B8A85b77Fbc4',
75
+ 'UniCreatePoolV3': '0x9058aAbEdEfe652b1d85DBBAB48Dfa78db613C44',
74
76
 
75
77
  // dydx
76
- 'DyDxSupply': '0xA8D1C1eea86573cBcC919fbf28Db542bDfE7Ed5b',
77
- 'DyDxWithdraw': '0x55AA33F42D79DbD3f1885b410e4796d641549bC3',
78
+ 'DyDxWithdraw': '0x827089C5Fc7653655c4080c660Cd8f755F818443',
78
79
 
79
80
  // yearn
80
- 'YearnSupply': '0x3B8538B070a0890ef7E13FF60c9d19F893a93B8a',
81
- 'YearnWithdraw': '0x03CC90F24C23C9F766902917c32411417c28Db92',
81
+ 'YearnSupply': '0x837D6E7F469b3cC820B0a6Da25415D5aE0A861c4',
82
+ 'YearnWithdraw': '0x563eF9b1075628E62aDc657702517dEA72ca08d6',
82
83
 
83
84
  // liquity
84
- 'LiquityClose': '0x9C563dc9F8e3FcCF996DAB4b6B6003fb7Bbca90f',
85
- 'LiquityBorrow': '0x46e8fE6bbE3C08eCc250295583490be9ac97B969',
86
- 'LiquityOpen': '0x50D69350E2629987551C563E19D29dee6Faf3A78',
87
- 'LiquityPayback': '0x86eCa72dF81ae76AfF0dEeC01521154F33147e46',
88
- 'LiquityWithdraw': '0x8CDA51bB0D7E03252d554Ba5Bbb9254f3deB8441',
89
- 'LiquitySupply': '0x7d9157a022A263EFd34C867Fd261235D45B48453',
90
- 'LiquitySPDeposit': '0x20D85391A69E9906b67238cb82E51114dE7116a9',
91
- 'LiquitySPWithdraw': '0x621ac2A927cc9323C23f7792e8FD25aAbc9cC04B',
92
- 'LiquityStake': '0xF0782DE9d734e54aa080B985d6a9235880C48Fe5',
93
- 'LiquityUnstake': '0xc39DdBa031D014BFC1E3b6158842Ffb43f8D47e9',
94
- 'LiquityEthGainToTrove': '0x60427bD08785527FDca7d84d2A75871273E9F209',
95
- 'LiquityClaim': '0x5a2E638DE65323c55f1245f920B84dB4603002eE',
96
- 'LiquityRedeem': '0x6C5Dd88D033c8857254Cc94098BF75Ac275B17c7',
85
+ 'LiquityClose': '0x4B2d174129789a88e92D46342201F207132144b7',
86
+ 'LiquityBorrow': '0xF978d6C5c8af80a059AdB85EEb64F14C9c436D68',
87
+ 'LiquityOpen': '0x4EFF392cc69B31Ad159EcfA10305251b2d8E40E0',
88
+ 'LiquityPayback': '0x8fc7D24414e9740ed9841d9205D458e3677e71f7',
89
+ 'LiquityWithdraw': '0x733F53579bEcdd3Ed07e745A55Ee9af8B9669048',
90
+ 'LiquitySupply': '0xD539943e080C2a29e3f1DB2d45Ea7240d7ddDEE2',
91
+ 'LiquitySPDeposit': '0x5aB0244a00a733f16E6b238B462bdF3538C698E1',
92
+ 'LiquitySPWithdraw': '0xa71817957eaF993fAA9a1F4B5c2402c0aeFCd9C6',
93
+ 'LiquityStake': '0x671280800B540cbF073561d84A297a2c4c5D529F',
94
+ 'LiquityUnstake': '0x86FDD4A6438D448a794A44ABBe47D57590b3350d',
95
+ 'LiquityEthGainToTrove': '0x65e19f967B3F3cB6466110aD238039F5423E3177',
96
+ 'LiquityClaim': '0x526735aDcBe5c9059275c5ED2E0574b4a24b875e',
97
+ 'LiquityRedeem': '0x20B78854658011394C931EF2BF3cEEA2Fe62E7f0',
97
98
 
98
99
  // lido
99
- 'LidoStake': '0x71D44c05B94438fe09a4A7F4dB75fb421dEC1067',
100
- 'LidoWrap': '0x752e08eB2882DA273Cb8b70151f6c6c33f34D62b',
101
- 'LidoUnwrap': '0x37800CF1Fe630efc5F2E15A2e182E5C5084861D9',
100
+ 'LidoStake': '0x4a7dd38D2BcA817fb68165155F869ca4179d8060',
101
+ 'LidoWrap': '0xE637544390db79EdDE0a9CAF352ED0FfF7451bDB',
102
+ 'LidoUnwrap': '0x910F73Fb8C0Bd15423c0D0BaD9F1ed95187a48fD',
102
103
 
103
104
  // insta
104
- 'ClaimInstMaker': '0x15E22A8160F0bDb619C6846C982F8D208A5670D2',
105
- 'InstPullTokens': '0x37FC940Be30e11d578243dEBea4f9B950E22aC99',
105
+ 'InstPullTokens': '0xf2c87782D6Eff0511e82007119BAC40e9ba86F69',
106
106
 
107
107
  // balancer
108
- 'BalancerV2Supply': '0xD78E5D95A28a67F7851b0a94505790813A92E405',
109
- 'BalancerV2Withdraw': '0xCcf4b96407BEF25D7df1c95045CCF64950e73E97',
110
- 'BalancerV2Claim': '0x259Ae83567858B7960d2De0D00F3717a764aD73B',
108
+ 'BalancerV2Supply': '0xE48123018Db5e9075841C61EA702cEca51621191',
109
+ 'BalancerV2Withdraw': '0xbED38692438b90AF738F8A7A3142C217DE8fB069',
110
+ 'BalancerV2Claim': '0xEac7c5bEFaA6E17f1A2e86947eEd6419c74A7C03',
111
111
 
112
112
  // GUni
113
- 'GUniWithdraw': '0xa329263fFac25F86E03481Ec39307bbf5DbeDD83',
114
- 'GUniDeposit': '0xe943958f01630038c23f8471a2d0ea4378e58b0d',
113
+ 'GUniWithdraw': '0x6F7cD7C0Dd3634E14bAB91FDF3bCE0a4315b3C59',
114
+ 'GUniDeposit': '0xb247cD4cab056800cCDa7cE1AFB781a8bFA9b57A',
115
+
116
+ // Rari
117
+ 'RariDeposit': '0x77A05c15f62F1fA6471D466001E21C1B189fcA9F',
118
+ 'RariWithdraw': '0xa052eD427EFa63B5bb87c409449a47e7C50317e3',
115
119
 
116
- // Rari
117
- 'RariDeposit': '0xC627A3F12c4f7236218a511DC10e3f5ead1a1D7c',
118
- 'RariWithdraw': '0x8408EeCcC2c2FC25F2cF720398DAAD0A05EfE487',
120
+ // mStable
121
+ 'MStableDeposit': '0xdf24ed1250fbfa274316b50Bc9A009aFA8F61E16',
122
+ 'MStableWithdraw': '0xa4d5d3e56012C1eD8aba4bE246964962DC3F735f',
119
123
 
120
- // mStable
121
- 'MStableDeposit': '0x1887235CFE1927782a3e7eD15fb073586c949858',
122
- 'MStableWithdraw': '0xb164456190577fbBe8FB8bF5Fa48a106b328A579',
124
+ 'MStableClaim': '0xD56F0EC66267958e08c91547c259cCAC006BF118',
123
125
 
124
- 'MStableDepositNew': '0x2AFfE3899d985212aD8ee99e1269D7Dd17576f1d',
125
- 'MStableWithdrawNew': '0x6468215Bf4811244Ab78599e1df9206716A35aB7',
126
+ 'McdRatioCheck': '0x3f09773e5e945C6Aa1bc8a8B3492f507620DE1e1',
127
+ 'GasFeeTaker': '0x431F1E1A9859EF99953801dbdeB31d2846ADcc0d',
126
128
 
127
- 'MStableClaim': '0x28279A806aDeDedFD33e39C7375dc0c0ee943847',
128
-
129
- 'CurveStethPoolDeposit': '0x0f042a5CC97C4cd8D8136c28F966839f195D08B9',
130
- 'CurveStethPoolWithdraw': '0x2F4ad71Bd8045d0633B304BD2d94ef349eB09105',
129
+ 'CurveStethPoolDeposit': '0x5Ae5870dC0C780e9eb68bE7a223eCd7F3BDad12B',
130
+ 'CurveStethPoolWithdraw': '0x4089731d843Ce52699Fe64F68556aBbD95D70D00',
131
131
  };
132
132
 
133
133
  const otherAddresses = {
@@ -0,0 +1,12 @@
1
+ const Action = require("../Action");
2
+ const {getAddr} = require("../addresses.js");
3
+
4
+ class ChainLinkPriceTrigger extends Action {
5
+
6
+ constructor(tokenAddr, price, state) {
7
+ super("ChainLinkPriceTrigger", getAddr("ChainLinkPriceTrigger"), [["address", "uint256", "uint8"]], [[...arguments]]);
8
+ }
9
+
10
+ }
11
+
12
+ module.exports = ChainLinkPriceTrigger;
@@ -0,0 +1,11 @@
1
+ const Action = require("../Action");
2
+ const {getAddr} = require("../addresses.js");
3
+
4
+ class CompoundRatioTrigger extends Action {
5
+
6
+ constructor(user, ratio, state) {
7
+ super("CompoundRatioTrigger", getAddr("CompoundRatioTrigger"), [["address", "uint256", "uint8"]], [[...arguments]]);
8
+ }
9
+ }
10
+
11
+ module.exports = CompoundRatioTrigger;
@@ -0,0 +1,11 @@
1
+ const Action = require("../Action");
2
+ const {getAddr} = require("../addresses.js");
3
+
4
+ class GasPriceTrigger extends Action {
5
+
6
+ constructor(maxGasPrice) {
7
+ super("GasPriceTrigger", getAddr("GasPriceTrigger"), [["uint256"]], [[...arguments]]);
8
+ }
9
+ }
10
+
11
+ module.exports = GasPriceTrigger;
@@ -0,0 +1,15 @@
1
+ const Action = require("../Action");
2
+
3
+ class LiquityRatioTrigger extends Action {
4
+
5
+ constructor(troveOwner, ratio, state) {
6
+ super(
7
+ "LiquityRatioTrigger",
8
+ getAddr("LiquityRatioTrigger"),
9
+ [["addresss", "uint256", "uint8"]],
10
+ [[...arguments]]
11
+ );
12
+ }
13
+ }
14
+
15
+ module.exports = LiquityRatioTrigger;
@@ -0,0 +1,15 @@
1
+ const Action = require("../Action");
2
+ const {getAddr} = require("../addresses.js");
3
+
4
+ class MakerRatioTrigger extends Action {
5
+
6
+ constructor(vaultId, ratio, state) {
7
+ super("McdRatioTrigger", getAddr("McdRatioTrigger"), [["uint256", "uint256", "uint8"]], [[...arguments]]);
8
+ }
9
+
10
+ async getEthValue() {
11
+ return this.args[0];
12
+ }
13
+ }
14
+
15
+ module.exports = MakerRatioTrigger;
@@ -0,0 +1,10 @@
1
+ const Action = require("../Action");
2
+
3
+ class ReflexerRatioTrigger extends Action {
4
+
5
+ constructor(vaultId, ratio, state) {
6
+ super("ReflexerRatioTrigger", getAddr("ReflexerRatioTrigger"), [["uint256", "uint256", "uint8"]], [[...arguments]]);
7
+ }
8
+ }
9
+
10
+ module.exports = ReflexerRatioTrigger;
@@ -0,0 +1,11 @@
1
+ const Action = require("../Action");
2
+ const {getAddr} = require("../addresses.js");
3
+
4
+ class TimestampTrigger extends Action {
5
+
6
+ constructor(nextTimestamp) {
7
+ super("TimestampTrigger", getAddr("TimestampTrigger"), [["uint256"]], [[...arguments]]);
8
+ }
9
+ }
10
+
11
+ module.exports = TimestampTrigger;
@@ -0,0 +1,12 @@
1
+ const Action = require("../Action");
2
+ const {getAddr} = require("../addresses.js");
3
+
4
+ class UniV3CurrentTickTrigger extends Action {
5
+
6
+ constructor(tokenId, state) {
7
+ super("UniV3CurrentTickTrigger", getAddr("UniV3CurrentTickTrigger"), [["uint256", "uint8"]], [[...arguments]]);
8
+ }
9
+
10
+ }
11
+
12
+ module.exports = UniV3CurrentTickTrigger;
@@ -0,0 +1,19 @@
1
+ const MakerRatioTrigger = require('./MakerRatioTrigger');
2
+ const ChainLinkPriceTrigger = require('./ChainLinkPriceTrigger');
3
+ const UniV3CurrentTickTrigger = require('./UniV3CurrentTickTrigger');
4
+ const TimestampTrigger = require('./TimestampTrigger');
5
+ const GasPriceTrigger = require('./GasPriceTrigger');
6
+ const CompoundRatioTrigger = require('./CompoundRatioTrigger');
7
+ const ReflexerRatioTrigger = require('./ReflexerRatioTrigger');
8
+ const LiquityRatioTrigger = require('./LiquityRatioTrigger');
9
+
10
+ module.exports = {
11
+ MakerRatioTrigger,
12
+ ChainLinkPriceTrigger,
13
+ UniV3CurrentTickTrigger,
14
+ TimestampTrigger,
15
+ GasPriceTrigger,
16
+ CompoundRatioTrigger,
17
+ ReflexerRatioTrigger,
18
+ LiquityRatioTrigger,
19
+ }
@@ -2,6 +2,8 @@ const Dec = require('decimal.js');
2
2
  const {getAssetInfo} = require('@defisaver/tokens');
3
3
 
4
4
  module.exports.requireAddress = (address) => {
5
+ if (address.startsWith('%') || address.startsWith('&')) return;
6
+
5
7
  if (typeof address !== 'string') throw new Error('Address is not a string');
6
8
  if (address === '') throw new Error('Address is empty string');
7
9
  if (address.length < 42) throw new Error(`Address too short (${address.length} instead of 42)`);
@@ -7,7 +7,6 @@ const axios = require('axios');
7
7
  const {assetAmountInWei, getAssetInfo} = require('@defisaver/tokens');
8
8
 
9
9
  const SellAction = require('../actions/basic/SellAction');
10
- const BuyAction = require('../actions/basic/BuyAction');
11
10
  const {parsePriceFromContract, formatPriceForContract} = require('./general');
12
11
  const API_URL = 'https://api.0x.org/swap/v1/';
13
12
  const ZEROX_WRAPPER = '0x0c4e16899f2059F4e41ddB164317414a5c0d2988';
@@ -124,7 +123,7 @@ module.exports.estimateBuyPrice = async (buyAmount, buyToken, sellToken) => esti
124
123
  * @param shouldSell {Boolean} look for price to sell or to buy (if false sellToken becomes becomes buyToken and vice-versa)
125
124
  * @param fromAccount {EthAddress} Withdraw funds from this addr
126
125
  * @param toAccount {EthAddress} Send funds to this addr
127
- * @return {Promise<(SellAction|BuyAction)>} SellAction or BuyAction
126
+ * @return {Promise<(SellAction>} SellAction
128
127
  *
129
128
  * @private
130
129
  */
@@ -179,9 +178,7 @@ const createExchangeAction = async (
179
178
  '0x', // wrapperData,
180
179
  offchainDataArray,
181
180
  ];
182
- return shouldSell
183
- ? new SellAction(orderData, fromAccount, toAccount, protocolFee)
184
- : new BuyAction(orderData, fromAccount, toAccount, protocolFee)
181
+ return new SellAction(orderData, fromAccount, toAccount, protocolFee)
185
182
  };
186
183
 
187
184
  /**
@@ -217,38 +214,3 @@ module.exports.createSellAction = async (
217
214
  fromAccount,
218
215
  toAccount,
219
216
  );
220
-
221
-
222
- /**
223
- * Fetches prices and creates order ready to be passed to transaction.
224
- * This should only be called when before sending tx, not to be used for just querying the price.
225
- * For that purpose, the estimateBuyPrice method can be used.
226
- *
227
- * @param buyAmount {string} Amount of asset being bought ('1500.123')
228
- * @param buyToken {string} Symbol for asset being bought ('DAI')
229
- * @param sellToken {string} Symbol for asset being sold ('ETH')
230
- * @param expectedPrice {string} Price received from estimatePrice (so minPrice can be calculated based on what user saw)
231
- * @param acceptedSlippagePercent {string|Number} Slippage percentage tolerated [0-100]
232
- * @param fromAccount {EthAddress} Withdraw funds from this addr
233
- * @param toAccount {EthAddress} Send funds to this addr
234
- * @return {Promise<BuyAction>}
235
- */
236
- module.exports.createBuyAction = async (
237
- buyAmount,
238
- buyToken,
239
- sellToken,
240
- expectedPrice,
241
- acceptedSlippagePercent,
242
- fromAccount,
243
- toAccount,
244
- ) => createExchangeAction(
245
- sellToken,
246
- buyToken,
247
- '0',
248
- buyAmount,
249
- expectedPrice,
250
- acceptedSlippagePercent,
251
- false,
252
- fromAccount,
253
- toAccount,
254
- );
@@ -626,23 +626,6 @@
626
626
  ]
627
627
  ]
628
628
  ],
629
- "DyDxSupply": [
630
- [
631
- "0xA8D1C1eea86573cBcC919fbf28Db542bDfE7Ed5b",
632
- [ 1, 0, 14, 5, 3, 12 ]
633
- ],
634
- [
635
- "0x1E0447b19BB6EcFdAe1e4AE1694b0C3659614e4e",
636
- [ 13, 1, 12, 10, 9 ]
637
- ],
638
- [
639
- "0x5c55B921f590a89C1Ebe84dF170E655a82b62126",
640
- [
641
- 10, 6, 1, 7,
642
- 0, 5, 13
643
- ]
644
- ]
645
- ],
646
629
  "DyDxWithdraw": [
647
630
  [
648
631
  "0x55AA33F42D79DbD3f1885b410e4796d641549bC3",
@@ -893,41 +876,6 @@
893
876
  [ 3, 5, 14, 7, 6, 11 ]
894
877
  ]
895
878
  ],
896
- "ClaimInstMaker": [
897
- [
898
- "0x15E22A8160F0bDb619C6846C982F8D208A5670D2",
899
- [
900
- 0, 12, 6, 1,
901
- 13, 5, 9
902
- ]
903
- ],
904
- [
905
- "0x2971AdFa57b20E5a416aE5a708A8655A9c74f723",
906
- [ 7, 3, 9, 5, 15 ]
907
- ],
908
- [
909
- "0x5ef30b9986345249bc32d8928B7ee64DE9435E39",
910
- [ 3, 8, 1, 9, 4, 7 ]
911
- ],
912
- [
913
- "0xAC838332afc2937FdED89c16a59b2ED8e8e2743c",
914
- [ 10, 4, 3, 0, 1, 15 ]
915
- ],
916
- [
917
- "0x6f40d4A6237C257fff2dB00FA0510DeEECd303eb",
918
- [
919
- 14, 11, 5, 10,
920
- 6, 9, 12, 13
921
- ]
922
- ],
923
- [
924
- "0x5c55B921f590a89C1Ebe84dF170E655a82b62126",
925
- [
926
- 12, 4, 1, 9,
927
- 5, 10, 11, 0
928
- ]
929
- ]
930
- ],
931
879
  "InstPullTokens": [
932
880
  [
933
881
  "0x37FC940Be30e11d578243dEBea4f9B950E22aC99",
@@ -1397,26 +1345,6 @@
1397
1345
  [ 10, 3, 8, 13, 6, 9 ]
1398
1346
  ]
1399
1347
  ],
1400
- "DFSBuy": [
1401
- [
1402
- "0x939dCad6A3D1fEACccB60Af90876D904468CbF66",
1403
- [ 11, 5, 8, 0, 9, 12 ]
1404
- ],
1405
- [
1406
- "0x25dd3F51e0C3c3Ff164DDC02A8E4D65Bb9cBB12D",
1407
- [
1408
- 1, 5, 3, 14,
1409
- 7, 11, 12, 4
1410
- ]
1411
- ],
1412
- [
1413
- "0x5c55B921f590a89C1Ebe84dF170E655a82b62126",
1414
- [
1415
- 1, 3, 2, 9,
1416
- 0, 15, 6
1417
- ]
1418
- ]
1419
- ],
1420
1348
  "SendToken": [
1421
1349
  [
1422
1350
  "0xBbe0D7f2AF01aE678f8A873CB2d2EB73871C9b5A",
@@ -21,7 +21,7 @@ class Recipe {
21
21
 
22
22
  this.name = name;
23
23
  this.actions = actions;
24
- this.taskExecutorAddress = getAddr('TaskExecutor');
24
+ this.recipeExecutorAddress = getAddr('RecipeExecutor');
25
25
  }
26
26
 
27
27
  /**
@@ -56,7 +56,7 @@ class Recipe {
56
56
  encodeForDsProxyCall() {
57
57
  const executeTaskAbi = RecipeAbi.find(({name}) => name === 'executeTask');
58
58
  return [
59
- this.taskExecutorAddress,
59
+ this.recipeExecutorAddress,
60
60
  AbiCoder.encodeFunctionCall(executeTaskAbi, this._encodeForCall()),
61
61
  ];
62
62
  }
@@ -107,7 +107,7 @@ class Recipe {
107
107
  */
108
108
  getAccessList() {
109
109
  const addressMapping = {
110
- [getAddr('TaskExecutor')]: [],
110
+ [getAddr('RecipeExecutor')]: [],
111
111
  [getAddr('DFSRegistry')]: [],
112
112
  };
113
113
  this.actions.forEach((action) => {
@@ -3,14 +3,14 @@ const {encodeForDsProxyCall, encodeForRecipe} = require('../../_actionUtils');
3
3
  const {assert} = require('chai');
4
4
  const { getAddr } = require('../../../src/addresses.js');
5
5
 
6
- describe('Action: ClaimInstMakerAction', () => {
6
+ describe('Action: InstPullTokensAction', () => {
7
7
  let action;
8
8
 
9
9
  const dsaAddress = '0x63bf1D484d7D799722b1BA9c91f5ffa6d416D60A';
10
10
  const to = '0x0a80C3C540eEF99811f4579fa7b1A0617294e06f';
11
11
 
12
12
 
13
- context('Claim INST tokens for Maker vault', () => {
13
+ context('InstPullTokensAction action test', () => {
14
14
  it('constructor', () => {
15
15
  action = new dfs.actions.insta.InstPullTokensAction(
16
16
  dsaAddress,
@@ -83,12 +83,4 @@ describe('Exchange utils', () => {
83
83
  }).timeout(10000);
84
84
  })
85
85
 
86
- context('Get BuyAction via 0x', function() {
87
- it('Creates action', async () => {
88
- const action = await exchangeUtils.createBuyAction('10000', 'DAI', 'ETH', '0', 0, myAddr, myAddr);
89
- assert.instanceOf(action, dfs.actions.basic.BuyAction);
90
- assert.equal(action.args[1], myAddr);
91
- assert.equal(action.args[2], myAddr);
92
- }).timeout(10000);
93
- })
94
86
  })
@@ -1,53 +0,0 @@
1
- const Action = require("../../Action");
2
- const {requireAddress} = require("../../utils/general");
3
- const {getAssetInfoByAddress} = require("@defisaver/tokens");
4
- const {getAddr} = require('../../addresses.js');
5
- const Dec = require('decimal.js');
6
- const {parsePriceFromContract} = require('../../utils/general');
7
-
8
- /**
9
- * Buys an exact amount of dest token on DeFi Saver exchange aggregator
10
- */
11
- class BuyAction extends Action {
12
- /**
13
- * @param exchangeOrder {Array} Standard DFS Exchange data
14
- * @param from {string} Order sender
15
- * @param to {string} Order recipient
16
- * @param protocolFee {string} 0x fee (amount of ETH in Wei)
17
- */
18
- constructor(exchangeOrder, from, to, protocolFee) {
19
- requireAddress(to);
20
- super(
21
- 'DFSBuy',
22
- getAddr('DFSBuy'),
23
- [
24
- ["address","address","uint256","uint256","uint256","uint256","address","address","bytes",["address","address","address","uint256","uint256","bytes"]],
25
- "address",
26
- "address",
27
- ],
28
- [exchangeOrder, from, to]
29
- );
30
-
31
- this.protocolFee = protocolFee;
32
-
33
- this.mappableArgs = [
34
- this.args[0][0],
35
- this.args[0][1],
36
- this.args[0][3],
37
- this.args[1],
38
- this.args[2],
39
- ];
40
- }
41
-
42
- async getAssetsToApprove() {
43
- const asset = getAssetInfoByAddress(this.args[0][0]);
44
- if (asset.symbol !== 'ETH') return [{asset: this.args[0][0], owner: this.args[1]}];
45
- return [];
46
- }
47
-
48
- async getEthValue() {
49
- return this.protocolFee || '0';
50
- }
51
- }
52
-
53
- module.exports = BuyAction;