Repeatable solution to find the current Health Factor of a specified AAVE Wallet Address.
- Javascript
- @aave/core-v3
- ethers (^5.2.0)
Install with npm install
- userAddress: This is the wallet address of the user you would like to check the Health Factor of.
- contractAddress: The address on the network of the AAVE Pool Smart Contract for V3.
The current values that you can use for the mainnets (please check the above link as these may be outdated):
- This project also works with spark.fi, which is a fork of Aave:
0xC13e21B648A5Ee794902342038FF3aDAB66BE987
- This project also works with spark.fi, which is a fork of Aave:
-
-
jsonRpcUrls: Semicolon-separated list of JSON RPC endpoints of the nodes.
-
For Ethereum mainnet nodes, check EthereumNodes.com
-
Avalanche - you can use https://api.avax.network/ext/bc/C/rpc as the endpoint
-
- healthFactorThreshold: What health factor is acceptable. If health factor is lower than this threshold, error is printed and process exits with error code Default: 1.5
export jsonRpcUrls="https://cloudflare-eth.com/;https://rpc.ankr.com/eth;https://eth.llamarpc.com;https://eth-mainnet.public.blastapi.io;https://rpc.flashbots.net/;https://ethereum.publicnode.com"
The health factor is obtained by querying the AAVE Pool smart contract and making use of it's ability to return a health factor for a given account.
I use my own signal-monitoring infrastructure to get notified using Signal when health decreases.
Check out an example setup in examples directory to see how to set it up (after setting up signal-monitoring first).
Brandon Grant
Email
with modifications by Juraj Bednar
Project Github