Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oracle price fetching refactoring #512

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/helpers/hardhat/overwrites.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const overwriteCurrentOraclePrice = async (network: string, collateralTyp
const collateralConfig = getCollateralConfigByType(collateralType);
const oracleAddress = await getOracleAddressByCollateralType(network, collateralType);
const amoutInteger = amount.shiftedBy(DAI_NUMBER_OF_DIGITS).toFixed();
const valueWithValidity = createStructCoder().encode(['uint128', 'uint128'], ['1', amoutInteger]);
const valueWithValidity = createStructCoder().encode(['uint128', 'uint128'], [amoutInteger, '1']);
await overwriteUintValueInAddress(
oracleAddress,
collateralConfig.oracle.currentPriceSlotAddress,
Expand Down
6 changes: 3 additions & 3 deletions core/simulations/configs/onboardNewCollateral.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import createVaultWithCollateral, {
} from '../helpers/createVaultWithCollateral';
import deploySpell, { getAllSpellNames } from '../helpers/deploySpell';
import executeSpell from '../helpers/executeSpell';
import { getCurrentOraclePriceByCollateralType } from '../../src/oracles';
import { getOsmPrices } from '../../src/oracles';
import { overwriteCurrentOraclePrice } from '../../helpers/hardhat/overwrites';
import promptToSelectOneOption from '../helpers/promptToSelectOneOption';

Expand Down Expand Up @@ -52,8 +52,8 @@ const simulation: Simulation = {
);
// overwrite oracle price
await overwriteCurrentOraclePrice(TEST_NETWORK, collateralType, new BigNumber(1000));
const oraclePrice = await getCurrentOraclePriceByCollateralType(TEST_NETWORK, collateralType);
console.info(`New ${collateralType} oracle price is ${oraclePrice.toFixed()} DAI`);
const oraclePrices = await getOsmPrices(TEST_NETWORK, collateralType);
console.info(`New ${collateralType} oracle price is ${oraclePrices.currentUnitPrice.toFixed()} DAI`);
// create and liquidate vault
const collateralOwned = await calculateMinCollateralAmountToOpenVault(collateralType);
const vaultId = await createVaultWithCollateral(collateralType, collateralOwned);
Expand Down
Loading