diff --git a/composables/protocols/useReflexerPosition.ts b/composables/protocols/useReflexerPosition.ts index 61479e5..59e2c10 100644 --- a/composables/protocols/useReflexerPosition.ts +++ b/composables/protocols/useReflexerPosition.ts @@ -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(),