Skip to content

Commit

Permalink
Merge pull request #964 from ionicprotocol/development
Browse files Browse the repository at this point in the history
  • Loading branch information
rhlsthrm authored Jan 17, 2025
2 parents c0b4944 + c53fa0a commit f63305e
Show file tree
Hide file tree
Showing 19 changed files with 1,213 additions and 269 deletions.
3 changes: 3 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,6 @@ schedule = "@hourly"

[functions."asset-price-and-rates-*"]
schedule = "@hourly"

[functions."asset-master-data-*"]
schedule = "@hourly"
9 changes: 9 additions & 0 deletions ops/prod/config.tf
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,14 @@ locals {
PYTH_UPDATER_ETHEREUM_ADMIN_PRIVATE_KEY = var.pyth_updater_ethereum_admin_private_key, # Use PYTH_UPDATER specific variable
}
)
pyth_updater_optimism_lambda_variables = merge(
local.shared_env_vars_lambda,
{
DISCORD_WEBHOOK_URL = var.pyth_updater_discord_webhook_url,
UPTIME_PYTH_UPDATER_API = var.uptime_pyth_updater_api,
PYTH_UPDATER_ETHEREUM_ADMIN_ACCOUNT = var.pyth_updater_ethereum_admin_account, # Use PYTH_UPDATER specific variable
PYTH_UPDATER_ETHEREUM_ADMIN_PRIVATE_KEY = var.pyth_updater_ethereum_admin_private_key, # Use PYTH_UPDATER specific variable
}
)
}

15 changes: 15 additions & 0 deletions ops/prod/optimism.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,19 @@ module "optimism_mainnet_liquidator_ecs" {
security_group_ids = ["sg-0a3996557af867ad0"]
region = var.region
liquidator_container_name = "${var.liquidator_container_name}-optimism"
}
module "optimism_mainnet_pyth_rpc_0" {
source = "../modules/lambda"
ecr_repository_name = local.pyth_updater_ecr_repository_name
docker_image_tag = var.bots_image_tag
container_family = "pyth-updater-rpc-0"
environment = "mainnet"
target_chain_id = local.optimism_mainnet_chain_id
container_env_vars = merge(
local.pyth_updater_optimism_lambda_variables,
{ WEB3_HTTP_PROVIDER_URLS = local.optimism_mainnet_rpc_0 }
)
schedule_expression = "rate(5 minutes)"
timeout = 700
memory_size = 512
}
5 changes: 3 additions & 2 deletions packages/bots/pyth-updater/src/config/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { base, mode } from '@ionicprotocol/chains';
import { base, mode, optimism } from '@ionicprotocol/chains';

import { pythConfig as basePythConfig } from './base';
import { pythConfig as modePythConfig } from './mode';

import { pythConfig as optimismPythConfig } from './optimism';
export const chainIdToConfig = {
[mode.chainId]: modePythConfig,
[base.chainId]: basePythConfig,
[optimism.chainId]: optimismPythConfig,
};
21 changes: 21 additions & 0 deletions packages/bots/pyth-updater/src/config/optimism.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { PythAssetConfig } from '../types';

import { pythConfig as commonPythConfig } from './common';

export const pythConfig: PythAssetConfig[] = [
...commonPythConfig,
{
// price feed for WBTC
priceId: '0xc9d8b075a5c69303365ae23633d4e085199bf5c520a3b90fed1322a0342ffc33',
configRefreshRateInSeconds: 3600,
validTimePeriodSeconds: 86400, // 24 hrs
deviationThresholdBps: 100, // 1%
},
{
// price feed for SNX
priceId: '0x39d020f60982ed892abbcd4a06a276a9f9b7bfbce003204c110b6e488f502da3',
configRefreshRateInSeconds: 3600,
validTimePeriodSeconds: 86400, // 24 hrs
deviationThresholdBps: 100, // 1%
},
];
4 changes: 3 additions & 1 deletion packages/bots/pyth-updater/src/run.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createPublicClient, createWalletClient, fallback, Hex, http } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
import { base, mode } from 'viem/chains';
import { base, mode, optimism } from 'viem/chains';

import { chainIdToConfig } from './config';
import config from './config/service';
Expand All @@ -15,6 +15,8 @@ export const run = async (): Promise<void> => {
chain = mode;
} else if (config.chainId === base.id) {
chain = base;
} else if (config.chainId === optimism.id) {
chain = optimism;
} else {
throw new Error(`Unsupported chain ID: ${config.chainId}`);
}
Expand Down
Loading

0 comments on commit f63305e

Please sign in to comment.