js-waku icon indicating copy to clipboard operation
js-waku copied to clipboard

DeFi Alert

Open D4nte opened this issue 2 years ago • 6 comments

Problem

DeFi smart contract have automated actions that may lead to impact of the asset of one user.

For example, in the case of a lending platform, an under-collaterized loan might get a margin call or liquidation that automatically sell the collateral on the market.

Receiving alerts before such event occurred is valuable to the end user.

For example. at Aave they recommend using HAL which is a Web3 IFTTT service. HAL is centralized. Also, when you give your Ethereum address to HAL you can also give your email, Twitter, Slack and Discord. A great way to dox yourself.

Proposed Solutions

Create a monitoring node (monitor) that watches the blockchain and dispatch alerts over Waku. Build a SDK to process said alerts in the user's wallet/PoC website.

sequenceDiagram
  Monitor->>Ethereum: Monitor Aave contract
  Note over Monitor: Calculate Health Factor for Alice's Address
  Note over Monitor: Alice's Health Factor drops below 2
  Monitor ->> Waku: Alert for Alice
  Waku ->> Alice's Wallet: Alert for Alice
  Note over Alice's Wallet: Display Alert
  Note over Alice's Wallet: Alice take action and increase her collateral

Notes

First PoC can manually take the address to monitor. Then, we can add a system where users (via wallet or dAPP) send a subscription message over Waku. From which moment the monitor can start monitoring their address and sending alerts.

Maybe the subscription can be done on chain, as a payment to a potential monitor. Some economic incentives would need to be designed as if they are payment done to 1 monitor then there may be poor redundancy/censorship resistance. Having a pool system might make sense.

D4nte avatar Apr 13 '22 11:04 D4nte

Note that this could be eligible for an Aave grant.

D4nte avatar Apr 13 '22 12:04 D4nte

how do I apply for this bounty?

molekilla avatar Apr 24 '22 12:04 molekilla

This is easy. But I haven't been able to run js-waku in Node, we can disucss off topic andI can share you my github repo. If js-waku could be made to work with Node then we can monitor and do the bounty proposal

molekilla avatar Apr 24 '22 12:04 molekilla

@molekilla This is a bounty idea. We haven't yet decided to move forward with it. Watch the issue and you'll be alerted if we make it a bounty.

js-waku targets the Browser but it should work in NodeJS. Feel free to open an issue so I can investigate.

However, if you are deploying NodeJS services then I'd recommend to look into nwaku and using the JSON RPC API. The main reason for this recommendation is that only the "light client" side of the protocols have been implemented in js-waku so far, whereas nwaku has most/all the protocols implemented.

D4nte avatar May 03 '22 00:05 D4nte

@molekilla i had a bit of tribulation getting js-waku to work with node. but ultimately succeeded. i think the latest release may have addressed some of the issues. feel free to contact me out of band, i can provide the steps i used for a successful install and implementation (if your issues persist)

dmh1974 avatar May 19 '22 09:05 dmh1974

Note I do maintain a project that uses js-waku with NodeJS: https://github.com/status-im/waku-tests

D4nte avatar May 27 '22 04:05 D4nte