-
Notifications
You must be signed in to change notification settings - Fork 9
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
Conversation
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 We need to
|
@stas this is ready for review |
There was a problem hiding this 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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
.github/workflows/tests.yml
Outdated
name: Python ${{ matrix.python-version }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
): | ||
print("calling pricer") | ||
price_oracle = w3.eth.contract( | ||
address=PRICE_ORACLE_ADDRESS, abi=PRICE_ORACLE_ABI |
There was a problem hiding this comment.
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[])",
]
tests/test_common_sense.py
Outdated
|
||
|
||
def test_common_sense(): | ||
assert 2 == 2 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
No description provided.