Skip to content

Commit

Permalink
nit: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruv-chauhan committed Jan 6, 2025
1 parent 52b22f2 commit 3eff1b1
Showing 1 changed file with 4 additions and 40 deletions.
44 changes: 4 additions & 40 deletions subgraphs/aave-forks/protocols/superlend/src/mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import {
UserEModeSet,
MintedToTreasury,
} from "../../../generated/LendingPool/LendingPool";
import { Market, _DefaultOracle } from "../../../generated/schema";
import { Market } from "../../../generated/schema";
import {
AAVE_DECIMALS,
getNetworkSpecificConstant,
Expand Down Expand Up @@ -241,8 +241,7 @@ export function handleReserveDataUpdated(event: ReserveDataUpdated): void {

const assetPriceUSD = getAssetPriceInUSDC(
Address.fromBytes(market.inputToken),
manager.getOracleAddress(),
event.transaction.hash.toHexString()
manager.getOracleAddress()
);

_handleReserveDataUpdated(
Expand Down Expand Up @@ -544,8 +543,7 @@ export function handleUserEModeSet(event: UserEModeSet): void {

function getAssetPriceInUSDC(
tokenAddress: Address,
priceOracle: Address,
hash: string
priceOracle: Address
): BigDecimal {
const oracle = AaveOracle.bind(priceOracle);
let oracleResult = readValue<BigInt>(
Expand All @@ -565,41 +563,7 @@ function getAssetPriceInUSDC(
}
}

// if (equalsIgnoreCase(dataSource.network(), Network.ETHERLINK_MAINNET)) {
const priceUSDCInEth = readValue<BigInt>(
oracle.try_getAssetPrice(Address.fromString(USDC_TOKEN_ADDRESS)),
BIGINT_ZERO
);

// if (priceUSDCInEth.equals(BIGINT_ZERO)) {
// return BIGDECIMAL_ZERO;
// } else {
const retval1 = oracleResult
.toBigDecimal()
.div(priceUSDCInEth.toBigDecimal());

// return retval;
// }
// }

const retval2 = oracleResult
.toBigDecimal()
.div(exponentToBigDecimal(AAVE_DECIMALS));

log.warning(
"[getAssetPriceInUSDC] token: {} res: {} usdcineth: {} r1: {} r2: {} tx: {}",
[
tokenAddress.toHexString(),
oracleResult.toString(),
priceUSDCInEth.toString(),
retval1.toString(),
retval2.toString(),
hash,
]
);

return retval2;
// return BIGDECIMAL_ZERO;
return oracleResult.toBigDecimal().div(exponentToBigDecimal(AAVE_DECIMALS));
}

function storeLiquidationProtocolFee(
Expand Down

0 comments on commit 3eff1b1

Please sign in to comment.