mirror of
https://github.com/Instadapp/assembly.git
synced 2024-07-29 22:37:06 +00:00
fix liquidation price
This commit is contained in:
parent
4f2ea1cb68
commit
c35ef57561
|
@ -25,6 +25,8 @@ const defaultSafe = {
|
|||
netvalue: "0"
|
||||
};
|
||||
|
||||
const oracleRelayerAddress = "0x4ed9C0dCa0479bC64d8f4EB3007126D5791f7851";
|
||||
|
||||
const safeId = ref(null);
|
||||
const safes = ref([]);
|
||||
const isNewSafe = ref(false);
|
||||
|
@ -202,6 +204,10 @@ async function getSafeTypes(web3) {
|
|||
.getColInfo(reflexerSafes.types)
|
||||
.call();
|
||||
|
||||
const rawRedemptionPrice = await web3.eth.getStorageAt(
|
||||
oracleRelayerAddress,
|
||||
4
|
||||
);
|
||||
return reflexerSafes.allSafes.map(
|
||||
({ type, token, key: tokenKey, disabled, safeTokenType }, i) => {
|
||||
const [rate, price, ratioCbyD, debtCeiling, totalDebt] = rawData[i];
|
||||
|
@ -213,7 +219,13 @@ async function getSafeTypes(web3) {
|
|||
disabled,
|
||||
safeTokenType,
|
||||
rate: calRate(rate),
|
||||
price: new BigNumber(price).dividedBy(1e27).toFixed(),
|
||||
redemptionPrice: new BigNumber(rawRedemptionPrice)
|
||||
.dividedBy(1e27)
|
||||
.toFixed(),
|
||||
price: new BigNumber(price)
|
||||
.times(rawRedemptionPrice)
|
||||
.dividedBy(1e54)
|
||||
.toFixed(),
|
||||
liquidation: new BigNumber(1)
|
||||
.dividedBy(new BigNumber(ratioCbyD).dividedBy(1e27))
|
||||
.toFixed(),
|
||||
|
|
Loading…
Reference in New Issue
Block a user