Skip to content

Instantly share code, notes, and snippets.

@nightwolf93
Created March 25, 2021 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nightwolf93/a9f0df182dca15cec6542a0a7fdeddd3 to your computer and use it in GitHub Desktop.
Save nightwolf93/a9f0df182dca15cec6542a0a7fdeddd3 to your computer and use it in GitHub Desktop.

Hello !

First, thanks a lot for being part of GraphLinq. Today, we will explain you how to make your first Graph on the GraphLinq IDE.

What is the GraphLinq IDE

GraphLinq IDE is a powerfull interface that allow your to create your workflow as a Graph, this interface is available at https://ide.graphlinq.io and it's free to use even if you host your own GraphLinq Engine.

You can have access to the source code of the IDE here :
https://github.com/GraphLinq/GraphLinq.IDE

Lets me introduce the interface and how to use it

The GraphLinq IDE interface

Toolbox

As you can see when you launch for the first time the IDE, the IDE will create a empty graph for you.

On the left side you have the Toolbox where you can find all available logical block that you can use to create your graph. You can use the search bar to find the block you need, for example if you type "telegram" you will find all blocks for Telegram.

Telegram Search

To add a block in your graph just click on it and the block will appear in the middle of graph. You can move it as you want into the workspace.

Terminal

At the bottom of the IDE you can find the terminal. This terminal allow you to know what IDE does like for example if you deploy a graph you will the hash and the result of the deployment.

Terminal

You will also be able to see all "logs" that the graph print. There is a "Print" block available in the toolbox that allow to write in it in real time.

If there is error in your graph you will see it in the terminal too, simple as that !

Menu

At the top of the IDE you can find the menu, when you move your cursor on each menu, there is a submenu too.

Menu

File Menu
In this menu you have the choice to :

  • Create a new graph
  • Load a graph from a file
  • Save the graph in your browser
  • Save the graph as file

Execution
There is only one option in this menu, the "Launch" option, that will allow you to deploy your graph on the engine and test it.
If you want to launch your graph you need to connect your wallet first, you can do it with the Connect To Wallet button at the top right side of the IDE

Documentation
Redirect you to our online documentation

Help
Redirect you to our Telegram Channel
https://t.me/graphlinq

GraphSpace

This is where all the graph creation will take place, where you can move and connect blocks for making your workflow.

GraphLinq GraphSpace

How to make a simple Uniswap Watcher

In GraphLinq you can have access to Uniswap Events, that allow to track for example every swap for a pair.

In this example we will show how to create a alert if someone buy more than 1 Ether of GLQ on the GLQ-ETH pair.

Step 1 - Listen the Uniswap Swap Event

To be able to listen swap on Uniswap you will to add a "On Uniswap Swap" block to your graph, search it in the toolbox and add the block.

Uniswap Swap Block

Let me explain how a block work.
At the left side you have "Input Parameters", this block need a Ethereum Connection and a Contract Address as input.

So we will provide to this block what he need. Search for Ethereum Connector and String in the toolbox and add them. Connect them by clicking on each output parameter in each block like in the image below.

Ethereum and String block

As you can see some parameters have colors, that determine the type of the parameter.

The yellow dot is a execution parameter that mean when you connection a "Output" execution parameter to a "Input" execution parameter, the block will execute him after his execution.

Each block have a color that determine the type of the block, for example a blue block mean a "Connector Block", the orange one is a "Event Block" and the green one is a "Variable Block" where you can edit the output parameter directly on the IDE.

In the image above you can see that i have put in the "String" parameter the address of the Uniswap Pair that i want to monitor, in this example it's the GLQ-ETH pair at the address 0x7d9c8d888d03df89461c645bd1108ae138b63a2a

You can delete a block with the cross icon when you have your cursor on the block header. To delete a connection you need to right click on a connection dot.

Step 2 - Condition

To be able to filter only the transactions we want we will use "Branches" it's special blocks that allow you check to have condition on output parameters.

We will use a Decimal Branch here to check if the wallet has buy more than 1 ether worth of GLQ.

Decimal Branch Block

You can connect the two variable that you want to compare at the "Left Side" of the block (Input Parameters) and execute the block you want with condition symbol on the "Right Side" (Output Execution Parameters)

Connect them like in the image below

Connect your branch block to variables

In this condition we will check if "Amount1In" >= 1.

Step 3 - Print the transaction

After the branch condition you can execute any block you want, that include for example a Telegram Message from your bot, Discord message, Tweet or push notification.

We will link the ">=" condition to a "Print" block, this block allow you to write into the terminal of the GraphLinq IDE and to save text in your dashboard logs.

Just search for "Print" in the toolbox and add it and link it to the ">=" condition.

Print block

You can add in the message the amount, sender ... by using for example the "Replace String in String" block.

Step 4 - Launch your graph

To be able to launch your Graph you need to be logged first on the top right of the IDE.
After that just click on "Launch" in the "Execution" menu and wait for the deployment.
After a couple of seconds you will see in your terminal that the graph has been deployed you get the "Hash" of him and will see logs appear too.

Terminal Logs

You can also check your running graph on our dashboard https://app.graphlinq.io/app/graphs.

Dashboard

Congrats, you have make your Graph on GraphLinq 🎉

Now you understand how to use the GraphLinq IDE, you can play with it for FREE for now.
We will announce when you will need GLQ token to run them, these GLQ token will be burned each time the graph execute one block. You can get more informations about the GLQ token here https://docs.graphlinq.io/token

Have fun on GraphLinq !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment