Skip to content

Commit

Permalink
feat: add infra files (#170)
Browse files Browse the repository at this point in the history
* feat: add checkpointer infra files

* feat: add sepolia price pusher config

* feat: add mainnet price pusher config
  • Loading branch information
EvolveArt authored Jul 27, 2024
1 parent 3c7942a commit 2a50470
Show file tree
Hide file tree
Showing 9 changed files with 161 additions and 19 deletions.
29 changes: 29 additions & 0 deletions infra/checkpointer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM python:3.12-slim AS base

ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
POETRY_VERSION=1.8.3 \
POETRY_VIRTUALENVS_IN_PROJECT=true \
POETRY_NO_INTERACTION=1

ENV PATH="/root/.local/bin:${PATH}"

FROM base as builder

RUN apt-get update && \
apt-get install --no-install-recommends -y \
gcc \
libgmp3-dev \
pipx

RUN pipx install poetry
COPY pragma-sdk/ /opt/pragma-sdk/
COPY pragma-utils/ /opt/pragma-utils/
COPY checkpointer/ /opt/checkpointer/
WORKDIR /opt/checkpointer
RUN poetry env use 3.12
RUN poetry install
ENTRYPOINT poetry run checkpointer -c config/config.yaml -n ${NETWORK} --oracle-address ${ORACLE_ADDRESS} --admin-address ${ADMIN_ADDRESS} --private-key ${PRIVATE_KEY} -t ${CHECK_INTERVAL} --rpc-url ${RPC_URL}
30 changes: 30 additions & 0 deletions infra/checkpointer/buildspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: 0.2
phases:
pre_build:
commands:
- echo Logging in to Amazon ECR...
- aws --version
- aws ecr get-login-password --region $ECR_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$ECR_REGION.amazonaws.com
- REPOSITORY_URI=$AWS_ACCOUNT_ID.dkr.ecr.$ECR_REGION.amazonaws.com/$ECR_REPOSITORY_NAME
- COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
- IMAGE_TAG=${COMMIT_HASH:=latest}
build:
commands:
- echo Build started on `date`
- echo Building the Docker image...
- ls -ltr
- docker build -f infra/checkpointer/Dockerfile -t $REPOSITORY_URI:latest .
- docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG
post_build:
commands:
- echo Build completed on `date`
- echo Pushing the Docker images...
- docker push $REPOSITORY_URI:latest
- docker push $REPOSITORY_URI:$IMAGE_TAG
- echo Writing image definitions file...
- printf '[{"name":"%s","imageUri":"%s"}]' $ECS_CONTAINER_NAME $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json
artifacts:
files:
- imagedefinitions.json
- infra/checkpointer/config.yml
discard-paths: yes
13 changes: 13 additions & 0 deletions infra/checkpointer/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
path: "/"
container_port: 8080
health_check_path: "/"
container_environment:
- region: "eu-west-3"
- prefix: "/conf/{{ SERVICE_NAME }}/{{ RUN_ENV }}"
- keys:
- NETWORK
- ORACLE_ADDRESS
- ADMIN_ADDRESS
- PRIVATE_KEY
- CHECK_INTERVAL
- RPC_URL
9 changes: 9 additions & 0 deletions infra/checkpointer/config/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
spot:
- pair: BTC/USD
- pair: ETH/USD

future:
- pair: BTC/USD
expiry: 0
- pair: ETH/USD
expiry: 0
26 changes: 26 additions & 0 deletions infra/price-pusher/config/config.mainnet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
- pairs:
spot:
- BTC/USD
- BTC/EUR
- WBTC/USD
- STETH/USD
- ETH/USD
- WSTETH/USD
- STRK/USD
- USDC/USD
- USDT/USD
- DAI/USD
- LORDS/USD
- ZEND/USD
- NSTR/USD
time_difference: 120
price_deviation: 0.0025

- pairs:
future:
- BTC/USD
- ETH/USD
- BTC/USDT
- ETH/USDT
time_difference: 600
price_deviation: 0.05
26 changes: 26 additions & 0 deletions infra/price-pusher/config/config.sepolia.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
- pairs:
spot:
- BTC/USD
- BTC/EUR
- WBTC/USD
- STETH/USD
- ETH/USD
- WSTETH/USD
- STRK/USD
- USDC/USD
- USDT/USD
- DAI/USD
- LORDS/USD
- ZEND/USD
- NSTR/USD
time_difference: 120
price_deviation: 0.0025

- pairs:
future:
- BTC/USD
- ETH/USD
- BTC/USDT
- ETH/USDT
time_difference: 600
price_deviation: 0.05
16 changes: 0 additions & 16 deletions infra/price-pusher/config/config.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion infra/price-pusher/onchain/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ RUN poetry install
FROM base as final
COPY --from=builder /opt /opt
WORKDIR /opt/price-pusher
ENTRYPOINT /opt/price-pusher/.venv/bin/python3.12 price_pusher/main.py -c config/config.example.yaml -t ${TARGET} -n ${NETWORK} -p ${PRIVATE_KEY} --publisher-name ${PUBLISHER_NAME} --publisher-address ${PUBLISHER_ADDRESS} --rpc-url ${RPC_URL}
ENTRYPOINT /opt/price-pusher/.venv/bin/python3.12 price_pusher/main.py -c config/config.yaml -t ${TARGET} -n ${NETWORK} -p ${PRIVATE_KEY} --publisher-name ${PUBLISHER_NAME} --publisher-address ${PUBLISHER_ADDRESS} --rpc-url ${RPC_URL}
29 changes: 27 additions & 2 deletions pragma-sdk/pragma_sdk/supported_assets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
ticker: 'USDT'
coingecko_id: 'tether-usd'

- name: 'Dai'
decimals: 18
ticker: 'DAI'
coingecko_id: 'dai'

- name: 'Circle USD'
decimals: 6
ticker: 'USDC'
Expand Down Expand Up @@ -48,7 +53,27 @@
ticker: 'WBTC'
coingecko_id: 'wrapped-bitcoin'

- name: 'Lido Staked Ethereum'
decimals: 8
- name: 'Wrapped Lido Staked Ether'
decimals: 18
ticker: 'WSTETH'
coingecko_id: 'wrapped-steth'

- name: 'Lido Staked Ether'
decimals: 18
ticker: 'STETH'
coingecko_id: 'staked-ether'

- name: 'Nostra'
decimals: 18
ticker: 'NSTR'
coingecko_id: 'nostra'

- name: 'Lords'
decimals: 18
ticker: 'LORDS'
coingecko_id: 'lords'

- name: 'ZkLend'
decimals: 18
ticker: 'ZEND'
coingecko_id: 'zklend-2'

0 comments on commit 2a50470

Please sign in to comment.