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

VELO pricing bot #2

Merged
merged 21 commits into from
Oct 30, 2023
Merged

VELO pricing bot #2

merged 21 commits into from
Oct 30, 2023

Conversation

callmephilip
Copy link
Contributor

@callmephilip callmephilip commented Oct 24, 2023

No description provided.

@linear
Copy link

linear bot commented Oct 24, 2023

OPS-182 Discord Price Bot

This one mainly needs to fetch the price for the VELO/AERO token from the oracle.

There will be an environment variable, say $TOKEN_ADDRESS

We need to

@callmephilip callmephilip requested a review from stas October 27, 2023 16:02
@callmephilip
Copy link
Contributor Author

@stas this is ready for review

Copy link
Contributor

@stas stas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some suggestions, but no blockers. Great work!

.env.example Outdated
@@ -0,0 +1,16 @@
DISCORD_TOKEN_VELO_PRICING=
WEB3_PROVIDER_URI=https://opt-mainnet.g.alchemy.com/v2/TYO_nS5GvA15ccCxYMEzTkAxQHrqk801
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might need to use the public RPC here since we'll be open sourcing this, consider changing it to https://mainnet.optimism.io or any other public RPC

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got specific value i can use?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://mainnet.optimism.io should be ok

.env.example Outdated Show resolved Hide resolved
name: Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally this would build the docker image and run the tests in it. Eg
https://github.com/velodrome-finance/api/blob/main/.github/workflows/ci.yml#L16

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved testing to a separate stage inside Dockerfile

@@ -0,0 +1,38 @@
FROM python:3.10-slim as python-base
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would suggest using alpine image and packages instead of doing our custom image pre-builds, also no need for virtualenvs since it's all a container... Consider

FROM python:3.10-alpine
RUN apk add --no-cache poetry
RUN poetry install --only main
...

This should cleanup a lot the dockerfile.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

staying with python:3.10-slim for now

bots/data.py Outdated Show resolved Hide resolved
):
print("calling pricer")
price_oracle = w3.eth.contract(
address=PRICE_ORACLE_ADDRESS, abi=PRICE_ORACLE_ABI
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: i wonder if we can provide the ABI inline to not carry over the whole file for one simple function call.

In ethers we could inline pass the

abi = [
  "function getManyRatesWithConnectors(uint8, address[]) external view returns (uint256[])",
]



def test_common_sense():
assert 2 == 2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would suggest to have at least a smoke test related to the bots.data module, this way we know the data layer works fine. I don't think it's worth us testing the discord stuff as the calls will be mainly related to their API which should be tested enough. Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added tests for the data layer

@callmephilip callmephilip merged commit 5c5a732 into main Oct 30, 2023
@callmephilip callmephilip deleted the OPS-182-discord-price-bot branch October 30, 2023 16:46
@stas stas mentioned this pull request Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants