mirror of
https://github.com/Instadapp/assembly.git
synced 2024-07-29 22:37:06 +00:00
Merge pull request #15 from mstfash/reflexer
This commit is contained in:
commit
17ccb19b51
|
@ -25,6 +25,8 @@ const defaultSafe = {
|
||||||
netvalue: "0"
|
netvalue: "0"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const oracleRelayerAddress = "0x4ed9C0dCa0479bC64d8f4EB3007126D5791f7851";
|
||||||
|
|
||||||
const safeId = ref(null);
|
const safeId = ref(null);
|
||||||
const safes = ref([]);
|
const safes = ref([]);
|
||||||
const isNewSafe = ref(false);
|
const isNewSafe = ref(false);
|
||||||
|
@ -202,6 +204,10 @@ async function getSafeTypes(web3) {
|
||||||
.getColInfo(reflexerSafes.types)
|
.getColInfo(reflexerSafes.types)
|
||||||
.call();
|
.call();
|
||||||
|
|
||||||
|
const rawRedemptionPrice = await web3.eth.getStorageAt(
|
||||||
|
oracleRelayerAddress,
|
||||||
|
4
|
||||||
|
);
|
||||||
return reflexerSafes.allSafes.map(
|
return reflexerSafes.allSafes.map(
|
||||||
({ type, token, key: tokenKey, disabled, safeTokenType }, i) => {
|
({ type, token, key: tokenKey, disabled, safeTokenType }, i) => {
|
||||||
const [rate, price, ratioCbyD, debtCeiling, totalDebt] = rawData[i];
|
const [rate, price, ratioCbyD, debtCeiling, totalDebt] = rawData[i];
|
||||||
|
@ -213,7 +219,13 @@ async function getSafeTypes(web3) {
|
||||||
disabled,
|
disabled,
|
||||||
safeTokenType,
|
safeTokenType,
|
||||||
rate: calRate(rate),
|
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)
|
liquidation: new BigNumber(1)
|
||||||
.dividedBy(new BigNumber(ratioCbyD).dividedBy(1e27))
|
.dividedBy(new BigNumber(ratioCbyD).dividedBy(1e27))
|
||||||
.toFixed(),
|
.toFixed(),
|
||||||
|
@ -244,6 +256,10 @@ async function getSafes(user, web3) {
|
||||||
.getSafes(user)
|
.getSafes(user)
|
||||||
.call();
|
.call();
|
||||||
|
|
||||||
|
const rawRedemptionPrice = await web3.eth.getStorageAt(
|
||||||
|
oracleRelayerAddress,
|
||||||
|
4
|
||||||
|
);
|
||||||
return rawData.map(
|
return rawData.map(
|
||||||
([
|
([
|
||||||
id,
|
id,
|
||||||
|
@ -260,7 +276,9 @@ async function getSafes(user, web3) {
|
||||||
]) => {
|
]) => {
|
||||||
const collateral = new BigNumber(collInWei).dividedBy(1e18);
|
const collateral = new BigNumber(collInWei).dividedBy(1e18);
|
||||||
const debt = new BigNumber(debtInWei).dividedBy(1e18);
|
const debt = new BigNumber(debtInWei).dividedBy(1e18);
|
||||||
const price = new BigNumber(priceInWei).dividedBy(1e27);
|
const price = new BigNumber(priceInWei)
|
||||||
|
.times(rawRedemptionPrice)
|
||||||
|
.dividedBy(1e54);
|
||||||
|
|
||||||
const safe = reflexerSafes.getSafeByType(type);
|
const safe = reflexerSafes.getSafeByType(type);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user