Skip to content

Commit

Permalink
Bugfix: Price oracle mode (#184)
Browse files Browse the repository at this point in the history
* Add correct chain logic for price oracle token selection.

* Adding newly deployed price oracle.
  • Loading branch information
jfarid27 authored Nov 12, 2024
1 parent 7a42a2e commit fc6c731
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ const MODE_CONSTANTS: chainConstants = {
usdc: findToken(MODE_WHITELISTED_TOKENS, "USDC"),
oracle: {
getAddress: (blockNumber: number) => {
return "0xC7d87726753d2e7a8823db6c96a4f44e4D502a21";
return "0xE50621a0527A43534D565B67D64be7C79807F269";
},
startBlock: 15407790,
startBlock: 15591759,
updateDelta: 60 * 60, // 1 hour
},
rewardToken: {
Expand Down
6 changes: 3 additions & 3 deletions src/PriceOracle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export async function set_whitelisted_prices(
): Promise<void> {
// Skip if not yet available
let startBlock =
CHAIN_CONSTANTS[chainId].oracle.startBlock || Number.MAX_SAFE_INTEGER;
CHAIN_CONSTANTS[chainId].oracle.startBlock;

if (blockNumber < startBlock) return;

Expand All @@ -105,8 +105,7 @@ export async function set_whitelisted_prices(
if (!tokensNeedUpdate) return;

// Get token data for chain
const tokenData =
chainId === 10 ? OPTIMISM_WHITELISTED_TOKENS : BASE_WHITELISTED_TOKENS;
const tokenData = CHAIN_CONSTANTS[chainId].whitelistedTokens;

// Get prices from oracle and filter if token is not created yet
const addresses = tokenData
Expand Down Expand Up @@ -177,6 +176,7 @@ export async function set_whitelisted_prices(
chainId: chainId,
lastUpdatedTimestamp: blockDatetime,
};

context.TokenPriceSnapshot.set(tokenPrice);
}

Expand Down

0 comments on commit fc6c731

Please sign in to comment.