otomato-sdk 1.5.41 → 1.5.43

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.
@@ -155,6 +155,32 @@ export const TRIGGERS = {
155
155
  "value": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
156
156
  }
157
157
  ]
158
+ },
159
+ {
160
+ "name": "Binance balance check",
161
+ "description": "Gets triggered when the Binance hot wallet balance falls below 7B USDT",
162
+ "parameters": [
163
+ {
164
+ "key": "chainId",
165
+ "value": 1
166
+ },
167
+ {
168
+ "key": "comparisonValue",
169
+ "value": "7000000000000000000000000000n"
170
+ },
171
+ {
172
+ "key": "condition",
173
+ "value": "lt"
174
+ },
175
+ {
176
+ "key": "contractAddress",
177
+ "value": "0xdac17f958d2ee523a2206206994597c13d831ec7"
178
+ },
179
+ {
180
+ "key": "abiParams.account",
181
+ "value": "0xF977814e90dA44bFA03b6295A0616a897441aceC"
182
+ }
183
+ ]
158
184
  }
159
185
  ],
160
186
  "blockId": 5,
@@ -1194,7 +1220,7 @@ export const ACTIONS = {
1194
1220
  "key": "slippage",
1195
1221
  "type": "percentage",
1196
1222
  "description": "The maximum allowable difference between the expected price and the actual price at the time of execution, expressed as a percentage. This protects the transaction from significant price fluctuations.",
1197
- "value": 0.3,
1223
+ "value": 1,
1198
1224
  "mandatory": true,
1199
1225
  "category": 1
1200
1226
  }
@@ -1222,7 +1248,7 @@ export const ACTIONS = {
1222
1248
  },
1223
1249
  {
1224
1250
  "key": "slippage",
1225
- "value": 0.3
1251
+ "value": 1
1226
1252
  }
1227
1253
  ]
1228
1254
  }
@@ -1924,7 +1950,7 @@ export const ACTIONS = {
1924
1950
  "key": "slippage",
1925
1951
  "type": "percentage",
1926
1952
  "description": "The maximum allowable difference between the expected price and the actual price at the time of execution, expressed as a percentage. This protects the transaction from significant price fluctuations.",
1927
- "value": 0.3,
1953
+ "value": 1,
1928
1954
  "mandatory": true,
1929
1955
  "category": 1
1930
1956
  },
@@ -1952,7 +1978,7 @@ export const ACTIONS = {
1952
1978
  },
1953
1979
  {
1954
1980
  "key": "slippage",
1955
- "value": 0.3
1981
+ "value": 1
1956
1982
  }
1957
1983
  ]
1958
1984
  }
@@ -12,7 +12,8 @@ export const WORKFLOW_TEMPLATES_TAGS = {
12
12
  NFTS: 'NFTs',
13
13
  SOCIALS: 'Socials',
14
14
  TRADING: 'Trading',
15
- ON_CHAIN_MONITORING: 'On-chain monitoring'
15
+ ON_CHAIN_MONITORING: 'On-chain monitoring',
16
+ YIELD: 'Yield'
16
17
  };
17
18
  const createModeTransferNotificationWorkflow = () => {
18
19
  const modeTransferTrigger = new Trigger(TRIGGERS.TOKENS.TRANSFER.TRANSFER);
@@ -26,24 +27,57 @@ const createModeTransferNotificationWorkflow = () => {
26
27
  const edge = new Edge({ source: modeTransferTrigger, target: telegramAction });
27
28
  return new Workflow('MODE transfer notification', [modeTransferTrigger, telegramAction], [edge]);
28
29
  };
29
- const createETHFearAndGreedBuy = () => {
30
+ const createETHFearAndGreedBuy = () => __awaiter(void 0, void 0, void 0, function* () {
30
31
  const trigger = new Trigger(TRIGGERS.SOCIALS.FEAR_AND_GREED.GET_FEAR_AND_GREED_INDEX);
31
32
  trigger.setCondition('lt');
32
33
  trigger.setComparisonValue(30);
33
34
  trigger.setPosition(400, 120);
34
- const telegramAction = new Action(ACTIONS.NOTIFICATIONS.TELEGRAM.SEND_MESSAGE);
35
- telegramAction.setParams("message", "The market sentiment is extremely fearful. Consider buying ETH (NFA).");
36
- telegramAction.setPosition(400, 240);
37
- const edge = new Edge({ source: trigger, target: telegramAction });
38
- return new Workflow('Buy ETH when the market sentiment is extremely fearful', [trigger, telegramAction], [edge]);
39
- };
35
+ const odosAction = new Action(ACTIONS.SWAP.ODOS.SWAP);
36
+ const chain = CHAINS.MODE;
37
+ odosAction.setChainId(chain);
38
+ odosAction.setParams("tokenIn", getTokenFromSymbol(chain, 'USDC').contractAddress);
39
+ odosAction.setParams("tokenOut", getTokenFromSymbol(chain, 'sUSDE').contractAddress);
40
+ odosAction.setParams("amount", yield convertToTokenUnitsFromSymbol(100, chain, 'USDC'));
41
+ odosAction.setPosition(400, 240);
42
+ const edge = new Edge({ source: trigger, target: odosAction });
43
+ return new Workflow('Buy ETH when the market sentiment is extremely fearful', [trigger, odosAction], [edge]);
44
+ });
45
+ const createETHFearAndGreedCapitalEfficientBuy = () => __awaiter(void 0, void 0, void 0, function* () {
46
+ const trigger = new Trigger(TRIGGERS.SOCIALS.FEAR_AND_GREED.GET_FEAR_AND_GREED_INDEX);
47
+ trigger.setCondition('lt');
48
+ trigger.setComparisonValue(30);
49
+ trigger.setPosition(400, 120);
50
+ const chain = CHAINS.MODE;
51
+ const tokenIn = 'USDC';
52
+ const tokenOut = 'WETH';
53
+ const ionicWithdraw = new Action(ACTIONS.LENDING.IONIC.WITHDRAW);
54
+ ionicWithdraw.setChainId(chain);
55
+ ionicWithdraw.setParams('tokenToWithdraw', getTokenFromSymbol(chain, tokenIn).contractAddress);
56
+ ionicWithdraw.setParams('amount', yield convertToTokenUnitsFromSymbol(1, chain, tokenIn));
57
+ ionicWithdraw.setPosition(400, 240);
58
+ const odosAction = new Action(ACTIONS.SWAP.ODOS.SWAP);
59
+ odosAction.setChainId(chain);
60
+ odosAction.setParams("tokenIn", getTokenFromSymbol(chain, tokenIn).contractAddress);
61
+ odosAction.setParams("tokenOut", getTokenFromSymbol(chain, tokenOut).contractAddress);
62
+ odosAction.setParams("amount", ionicWithdraw.getParameterVariableName('amount'));
63
+ odosAction.setPosition(400, 360);
64
+ const ionicDeposit = new Action(ACTIONS.LENDING.IONIC.DEPOSIT);
65
+ ionicDeposit.setChainId(chain);
66
+ ionicDeposit.setParams('tokenToDeposit', getTokenFromSymbol(chain, tokenOut).contractAddress);
67
+ ionicDeposit.setParams('amount', odosAction.getOutputVariableName('amountOut'));
68
+ ionicDeposit.setPosition(400, 480);
69
+ const edge1 = new Edge({ source: trigger, target: ionicWithdraw });
70
+ const edge2 = new Edge({ source: ionicWithdraw, target: odosAction });
71
+ const edge3 = new Edge({ source: odosAction, target: ionicDeposit });
72
+ return new Workflow('Fear and greed buy ETH (capital efficient)', [trigger, odosAction, ionicWithdraw, ionicDeposit], [edge1, edge2, edge3]);
73
+ });
40
74
  const createSUsdeYieldBuy = () => __awaiter(void 0, void 0, void 0, function* () {
41
75
  const trigger = new Trigger(TRIGGERS.YIELD.ETHENA.SUSDE_YIELD);
42
76
  trigger.setCondition('gt');
43
77
  trigger.setComparisonValue(20);
44
78
  trigger.setPosition(400, 120);
45
79
  const odosAction = new Action(ACTIONS.SWAP.ODOS.SWAP);
46
- const chain = CHAINS.ETHEREUM;
80
+ const chain = CHAINS.MODE;
47
81
  odosAction.setChainId(chain);
48
82
  odosAction.setParams("tokenIn", getTokenFromSymbol(chain, 'USDC').contractAddress);
49
83
  odosAction.setParams("tokenOut", getTokenFromSymbol(chain, 'sUSDE').contractAddress);
@@ -82,6 +116,13 @@ export const WORKFLOW_TEMPLATES = [
82
116
  'thumbnail': 'https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/templates/fear_and_greed.jpg',
83
117
  createWorkflow: createETHFearAndGreedBuy
84
118
  },
119
+ {
120
+ 'name': 'Buy ETH when the market sentiment is extremely fearful - capital efficient',
121
+ 'description': 'Buy ETH when the Bitcoin Fear and Greed Index is below 30. The idle funds are generating yield on Ionic.',
122
+ 'tags': [WORKFLOW_TEMPLATES_TAGS.TRADING, WORKFLOW_TEMPLATES_TAGS.SOCIALS, WORKFLOW_TEMPLATES_TAGS.YIELD],
123
+ 'thumbnail': 'https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/templates/fear_and_greed.jpg',
124
+ createWorkflow: createETHFearAndGreedCapitalEfficientBuy
125
+ },
85
126
  {
86
127
  'name': 'Buy sUSDE when the yield is above 20%',
87
128
  'description': 'Buy sUSDE when the yield is above 20%',
@@ -86,7 +86,7 @@ export class Node {
86
86
  }
87
87
  }
88
88
  catch (e) {
89
- console.error(`Error processing parameter ${key}:`, e);
89
+ // console.error(`Error processing parameter ${key}:`, e);
90
90
  }
91
91
  // Validate the value type
92
92
  if (validateType(param.type, value)) {
@@ -1,5 +1,8 @@
1
1
  import { ethers } from 'ethers';
2
2
  export function validateType(expectedType, value) {
3
+ if (typeof value === 'string' && isVariable(value)) {
4
+ return true; // Allow all variable strings
5
+ }
3
6
  switch (expectedType) {
4
7
  case 'bool':
5
8
  case 'boolean':
@@ -50,6 +53,9 @@ export function validateType(expectedType, value) {
50
53
  return false;
51
54
  }
52
55
  }
56
+ function isVariable(value) {
57
+ return /\{\{nodeMap\.[^.}]+\.(?:output|parameters(?:\.abi\.parameters)?)\.[^.}]+\}\}/.test(value);
58
+ }
53
59
  export function typeIsNumber(type) {
54
60
  switch (type) {
55
61
  case 'integer':
@@ -4,6 +4,7 @@ export declare const WORKFLOW_TEMPLATES_TAGS: {
4
4
  SOCIALS: string;
5
5
  TRADING: string;
6
6
  ON_CHAIN_MONITORING: string;
7
+ YIELD: string;
7
8
  };
8
9
  export declare const WORKFLOW_TEMPLATES: ({
9
10
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "otomato-sdk",
3
- "version": "1.5.41",
3
+ "version": "1.5.43",
4
4
  "description": "An SDK for building and managing automations on Otomato",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/types/src/index.d.ts",