Skip to content

Commit

Permalink
RPC: getLoanInfo (#654)
Browse files Browse the repository at this point in the history
* rpc function implementation

* add test

* append api md file

* fix interface

* revert indentation changes caused by extra plugin

* fix no longer using dynamic oracle id

* remove jsdoc `see` numbering

* move docs to new structure

* remove old website doc

* skip flaky scrypt difficulty tuning benchmark test

* revert md file auto lint fix

* fix merged md

* revert minor change

* add extra test check collateral and loan usd value
fix syntax based on latest defid/rpc changes

* rework everything for getloaninfo rpc

* revert test skip

* include setGovHeight test and doc

* rename all getloaninfo var to camel case

* add rpc, test, doc

* add invalid activation height test

* remove setGov ORACLE_BLOCK_INTERVAL (consensus no longer allow)

* disable docker pruning

* fix test, %BLOCK_INTERVAL is always zero now

* address few change request

* remove log

Co-authored-by: surangap <[email protected]>

Co-authored-by: surangap <[email protected]>
  • Loading branch information
ivan-zynesis and surangap authored Nov 18, 2021
1 parent 51f0aaf commit e9246b6
Show file tree
Hide file tree
Showing 3 changed files with 632 additions and 0 deletions.
34 changes: 34 additions & 0 deletions docs/node/RPC Category/16-loan.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,40 @@ interface CollateralTokenDetail {
}
```

## getLoanInfo

Quick access to multiple API with consolidated total collateral and loan value.

```ts title="client.loan.getLoanInfo()"
interface loan {
getLoanInfo (): Promise<GetLoanInfoResult>
}

interface GetLoanInfoResult {
currentPriceBlock: BigNumber
nextPriceBlock: BigNumber
defaults: LoanConfig
totals: LoanSummary
}

interface LoanConfig {
fixedIntervalBlocks: BigNumber
maxPriceDeviationPct: BigNumber
minOraclesPerPrice: BigNumber
scheme: string
}

interface LoanSummary {
collateralTokens: BigNumber
collateralValue: BigNumber
loanTokens: BigNumber
loanValue: BigNumber
openAuctions: BigNumber
openVaults: BigNumber
schemes: BigNumber
}
```

## setLoanToken

Creates (and submits to local node and network) a token for a price feed set in collateral token.
Expand Down
Loading

0 comments on commit e9246b6

Please sign in to comment.