Python Listeners & Handlers
Our alert system relies on so called python listeners : those scripts are continuously listening to the transaction on our running Ethereum node and applying the filters defined for every alerts. You can access the whole code hereinafter :
There is three types of listeners :
- Events Listeners : are emitting alerts for specific events on a contract or group of contracts. Example : Transfer event of INV token contract address.
- State Variation Listeners : are emitting alerts based on the change in value of view state functions. They have a floor of 5% defined for triggering their corresponding handle. Example : change of Oracle getUnderlyingPrice() by 20% for INV token contract address.
- Transaction Listeners : are emitting alerts any time a transaction occurs on a specific address. Example : Treasury Multisig emits a new transaction on the main net.
Those listeners are pointing to 3 corresponding events handlers hence alert types. In every handler we define for the events and alerts the condition to send the message to our discord. For the two first types, these conditions are related to contract metrics, like amount of the operation in USD or variation in relative percentage.
For instance, this is how we define the condition in the oracle alert to send the message. Note that we could have inserted a different picture or content for every different case to customize it further.
handlers.py
if abs(self.change) > 0.2:
content = '<@&role-tagged>'
level = 3
color = colors.red
send = True
elif abs(self.change) > 0.1:
level = 2
color = colors.dark_orange
send = True
elif abs(self.change) > 0.05:
level = 1
color = colors.orange
send = True
Last modified 1yr ago