parallel-finance/parallel

add rpc crate for loans pallet and implement get_account_liquidity JSON-RPC

yz89 opened this issue · 1 comments

yz89 commented

Motivation

We're going to open up the liquidation functionality to our community, so we would like to provide essential JSON-RPC interfaces for them to access the liquidation status easily.

The most important interface is getAccountLiquidity.

Suggested Solution

Add a rpc crate for loans pallet. such as https://github.com/open-web3-stack/open-runtime-module-library/tree/master/oracle/rpc

Then implement the JSON-RPC loans_getAccountLiquidity:

HTTP GET:
loans_getAccountLiquidity?account=5GBykvvrUz3vwTttgHzUEPdm7G1FND1reBfddQLdiaCbhoMd

Return:

{
  "address": "5GBykvvrUz3vwTttgHzUEPdm7G1FND1reBfddQLdiaCbhoMd",
  "liquidity": "72532",
  "shortfall": "0"
}
yz89 commented

Ayush is working on this issue.