otomato-sdk 2.0.29 → 2.0.30
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.
|
@@ -164,6 +164,45 @@ const gasMonitoring = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
164
164
|
const edge = new Edge({ source: trigger, target: notificationAction });
|
|
165
165
|
return new Workflow('Get notified when the gas price on Ethereum drops below 6 gwei', [trigger, notificationAction], [edge]);
|
|
166
166
|
});
|
|
167
|
+
const dailyYieldEmail = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
168
|
+
const trigger = new Trigger(TRIGGERS.CORE.EVERY_PERIOD.EVERY_PERIOD);
|
|
169
|
+
const notificationAction = new Action(ACTIONS.NOTIFICATIONS.EMAIL.SEND_EMAIL);
|
|
170
|
+
notificationAction.setParams("body", `Daily Yield Report 🚀
|
|
171
|
+
|
|
172
|
+
------------------ USDC ------------------------
|
|
173
|
+
|
|
174
|
+
📍 On Base
|
|
175
|
+
• IONIC: {{external.functions.ionicLendingRate(8453,0x833589fcd6edb6e08f4c7c32d4f71b54bda02913)}}
|
|
176
|
+
• AAVE: {{external.functions.aaveLendingRate(8453,0x833589fcd6edb6e08f4c7c32d4f71b54bda02913)}}
|
|
177
|
+
• Compound: {{external.functions.compoundLendingRate(8453,0x833589fcd6edb6e08f4c7c32d4f71b54bda02913,0)}}
|
|
178
|
+
• Ironclad: {{external.functions.ironcladLendingRate(8453,0x833589fcd6edb6e08f4c7c32d4f71b54bda02913)}}
|
|
179
|
+
• Moonwell: {{external.functions.moonwellLendingRate(8453,0x833589fcd6edb6e08f4c7c32d4f71b54bda02913)}}
|
|
180
|
+
|
|
181
|
+
📍 On Mode
|
|
182
|
+
• IONIC: {{external.functions.ionicLendingRate(34443,0xd988097fb8612cc24eeC14542bC03424c656005f)}}
|
|
183
|
+
• Ironclad: {{external.functions.ironcladLendingRate(34443,0xd988097fb8612cc24eeC14542bC03424c656005f)}}
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
------------------ ETH ------------------------
|
|
187
|
+
|
|
188
|
+
📍 On Base
|
|
189
|
+
• IONIC: {{external.functions.ionicLendingRate(8453,0x4200000000000000000000000000000000000006)}}
|
|
190
|
+
• AAVE: {{external.functions.aaveLendingRate(8453,0x4200000000000000000000000000000000000006)}}
|
|
191
|
+
• Compound: {{external.functions.compoundLendingRate(8453,0x4200000000000000000000000000000000000006,0)}}
|
|
192
|
+
• Ironclad: {{external.functions.ironcladLendingRate(8453,0x4200000000000000000000000000000000000006)}}
|
|
193
|
+
• Moonwell: {{external.functions.moonwellLendingRate(8453,0x4200000000000000000000000000000000000006)}}
|
|
194
|
+
|
|
195
|
+
📍 On Mode
|
|
196
|
+
• IONIC: {{external.functions.ionicLendingRate(34443,0x4200000000000000000000000000000000000006)}}
|
|
197
|
+
• Ironclad: {{external.functions.ironcladLendingRate(34443,0x4200000000000000000000000000000000000006)}}
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
See you tomorrow!`);
|
|
201
|
+
notificationAction.setParams("subject", "Daily yield updates");
|
|
202
|
+
notificationAction.setPosition(400, 240);
|
|
203
|
+
const edge = new Edge({ source: trigger, target: notificationAction });
|
|
204
|
+
return new Workflow('Daily yield updates', [trigger, notificationAction], [edge]);
|
|
205
|
+
});
|
|
167
206
|
export const WORKFLOW_TEMPLATES = [
|
|
168
207
|
{
|
|
169
208
|
'name': 'MODE transfer notification',
|
|
@@ -266,5 +305,16 @@ export const WORKFLOW_TEMPLATES = [
|
|
|
266
305
|
ACTIONS.NOTIFICATIONS.EMAIL.SEND_EMAIL.image
|
|
267
306
|
],
|
|
268
307
|
createWorkflow: gasMonitoring
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
'name': 'Daily yield updates',
|
|
311
|
+
'description': 'Receive an email every day with a recap from all the money market yields for ETH and USDC.',
|
|
312
|
+
'tags': [WORKFLOW_TEMPLATES_TAGS.ON_CHAIN_MONITORING, WORKFLOW_TEMPLATES_TAGS.NOTIFICATIONS],
|
|
313
|
+
'thumbnail': 'https://otomato-sdk-images.s3.eu-west-1.amazonaws.com/templates/gasMonitoring.jpg',
|
|
314
|
+
'image': [
|
|
315
|
+
TRIGGERS.CORE.EVERY_PERIOD.EVERY_PERIOD.image,
|
|
316
|
+
ACTIONS.NOTIFICATIONS.EMAIL.SEND_EMAIL.image
|
|
317
|
+
],
|
|
318
|
+
createWorkflow: dailyYieldEmail
|
|
269
319
|
}
|
|
270
320
|
];
|
|
@@ -72,21 +72,38 @@ export function positionWorkflowNodesAvoidOverlap(workflow) {
|
|
|
72
72
|
addToLevel(node);
|
|
73
73
|
}
|
|
74
74
|
});
|
|
75
|
-
// 3) Resolve horizontal overlaps
|
|
75
|
+
// 3) Resolve horizontal overlaps and enforce parent grouping
|
|
76
76
|
levels.forEach((nodes, level) => {
|
|
77
|
-
//
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
77
|
+
// Group nodes by their parent
|
|
78
|
+
const parentGroups = new Map();
|
|
79
|
+
nodes.forEach((node) => {
|
|
80
|
+
const parents = getParents(node, workflow.edges);
|
|
81
|
+
if (parents.length > 0) {
|
|
82
|
+
const parent = parents[0]; // Assuming single parent for simplicity
|
|
83
|
+
if (!parentGroups.has(parent)) {
|
|
84
|
+
parentGroups.set(parent, []);
|
|
85
|
+
}
|
|
86
|
+
parentGroups.get(parent).push(node);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
// Flatten the groups back into a sorted array
|
|
90
|
+
const groupedNodes = [];
|
|
91
|
+
parentGroups.forEach((group) => {
|
|
92
|
+
groupedNodes.push(...group);
|
|
93
|
+
});
|
|
94
|
+
// Sort nodes by x within each group to detect overlaps
|
|
95
|
+
groupedNodes.sort((a, b) => { var _a, _b; return ((_a = a.position.x) !== null && _a !== void 0 ? _a : 0) - ((_b = b.position.x) !== null && _b !== void 0 ? _b : 0); });
|
|
96
|
+
// Shift nodes within groups to resolve overlaps
|
|
97
|
+
for (let i = 1; i < groupedNodes.length; i++) {
|
|
98
|
+
const prev = groupedNodes[i - 1];
|
|
99
|
+
const current = groupedNodes[i];
|
|
83
100
|
if (current.position.x - prev.position.x < xSpacing) {
|
|
84
101
|
const shift = xSpacing - (current.position.x - prev.position.x);
|
|
85
102
|
moveNodeAndChildren(current, shift, workflow.edges);
|
|
86
103
|
}
|
|
87
104
|
}
|
|
88
105
|
});
|
|
89
|
-
// 4) **Center each parent over its children** (the
|
|
106
|
+
// 4) **Center each parent over its children** (the existing step)
|
|
90
107
|
centerParentXPositions(workflow);
|
|
91
108
|
}
|
|
92
109
|
/**
|