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

feat: quite a lot of stuff I've maintained for the past few months #715

Merged
merged 55 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
69eab43
chore: replace deprecated Logger.warn
BobTheBuidler Oct 8, 2024
b2602e2
feat: filter out lps with vaults
BobTheBuidler Oct 8, 2024
63887a0
feat: refactor to prep for bal apy previews
BobTheBuidler Oct 8, 2024
44e9f83
update make
0xBasically Oct 8, 2024
60988ef
feat: delay curve loading
BobTheBuidler Oct 8, 2024
7448733
chore: remove deprecated code
BobTheBuidler Oct 8, 2024
9e93063
chore: add comment
BobTheBuidler Oct 8, 2024
1fe6f0e
feat: async log loading
BobTheBuidler Oct 8, 2024
aa03fa7
feat: more stuff
BobTheBuidler Oct 8, 2024
589d446
feat: more stuff
BobTheBuidler Oct 8, 2024
d6c18c9
fix: load_strategies
BobTheBuidler Oct 8, 2024
8f8ae24
fix: Harvests
BobTheBuidler Oct 8, 2024
008913d
fix: registry loader time
BobTheBuidler Oct 8, 2024
5392357
str not encodable
BobTheBuidler Oct 8, 2024
bac8316
feat: support rkp3r in ypm
BobTheBuidler Oct 8, 2024
e19b386
fix: vault loader
BobTheBuidler Oct 8, 2024
8bee62e
chore: cleanup treasury-txs logs
BobTheBuidler Oct 8, 2024
fb5fb53
chore: contract -> Contract
BobTheBuidler Oct 8, 2024
c18f5fa
chore: cleanup
BobTheBuidler Oct 8, 2024
66f87f5
chore: add comment
BobTheBuidler Oct 8, 2024
3ee9aa3
feat: asyncify curve simple
BobTheBuidler Oct 8, 2024
3867862
chore: remove unneeded code
BobTheBuidler Oct 8, 2024
08eaa3a
fix: treasury txs TypeErr
BobTheBuidler Oct 8, 2024
1c60a6f
fix: from_address is None
BobTheBuidler Oct 8, 2024
090fa54
fix: SyntaxError
BobTheBuidler Oct 8, 2024
f6a19f1
fix(temp): logs for treasury-tx
BobTheBuidler Oct 8, 2024
d822ac2
chore: refactor with new dep members
BobTheBuidler Oct 8, 2024
a9b10dd
chore: replace contract with Contract
BobTheBuidler Oct 8, 2024
2a901c0
feat: optimize db entity handling
BobTheBuidler Oct 8, 2024
e22c38e
feat: load streams with treasry txs exporter
BobTheBuidler Oct 8, 2024
0a04813
fix: asyncify yeth
BobTheBuidler Oct 8, 2024
de1bb0a
feat: make build --no-cache
BobTheBuidler Oct 8, 2024
fbe8fe9
feat: processing queue
BobTheBuidler Oct 8, 2024
b35b609
fix: adapt to ypm 3.6
BobTheBuidler Oct 8, 2024
9a7d3b0
feat: make way less eth_getLogs calls
BobTheBuidler Oct 8, 2024
32354d1
feat: disable sms exporter on base
BobTheBuidler Oct 8, 2024
0117236
chore: replace deprecated dank_w3
BobTheBuidler Oct 8, 2024
885ae0a
fix: treasury and sms on non-mainnet
BobTheBuidler Oct 8, 2024
0363c0e
feat: use Queue, save ram
BobTheBuidler Oct 8, 2024
ca902c5
feat: sort txs
BobTheBuidler Oct 8, 2024
84774db
fix: hanging sorter
BobTheBuidler Oct 8, 2024
b752259
feat: brownie 1.20.3 disables eager caching
BobTheBuidler Oct 8, 2024
1627d97
feat: faster eth-abi
BobTheBuidler Oct 8, 2024
c8aec10
feat: faster builds with poetry
BobTheBuidler Nov 9, 2024
db9cff1
chore: add shitcoins to shitcoins
BobTheBuidler Nov 9, 2024
0c73a52
feat: sort txs
BobTheBuidler Nov 9, 2024
29c3c52
chore: bump eth-portfolio and ypricemagic
BobTheBuidler Nov 9, 2024
5f53f2f
feat: a bunch of old stuff
BobTheBuidler Nov 9, 2024
716ab75
chore: remove unused imports
BobTheBuidler Nov 9, 2024
49992cf
chore: refactor accountant
BobTheBuidler Nov 9, 2024
b3a4f1c
chore: bump deps
BobTheBuidler Nov 9, 2024
2cf031b
feat: optimize streams with caches
BobTheBuidler Nov 9, 2024
95f6f3b
chore: add detail to exc
BobTheBuidler Nov 9, 2024
df2aa4a
chore: rename constant
BobTheBuidler Nov 9, 2024
661963a
chore: bump brownie to 1.20
BobTheBuidler Nov 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
FROM python:3.10.12-slim as builder
RUN apt-get update && \
apt-get install -y gcc git
ADD requirements.txt ./
RUN mkdir -p /install
# NOTE: We have to do this to force pyyaml to install
RUN pip3 install --prefix=/install "Cython<3.0" "pyyaml==5.4.1" --no-build-isolation
RUN pip3 install --prefix=/install -r requirements.txt

FROM python:3.10.12-slim
COPY --from=builder /install /usr/local
RUN apt-get update
RUN apt-get install python3-tk -y
RUN apt-get update && apt-get install -y gcc git python3-tk
RUN mkdir -p /app/yearn-exporter
WORKDIR /app/yearn-exporter
RUN pip3 install poetry
ADD pyproject.toml ./
ADD poetry.lock ./
RUN poetry run pip install "cython<3.0.0" wheel
RUN poetry run pip install pyyaml==5.4.1 --no-build-isolation
RUN poetry install
# 0.5.1 is faster than 0.5.0 due to parsimonius 0.10 but won't install with brownie at the moment
#RUN poetry run pip3 install "eth-abi>=5.1,<6"
ADD . /app/yearn-exporter

ENTRYPOINT ["./entrypoint.sh"]
22 changes: 17 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,18 @@ apy-yeth-monitoring:

apy-yeth:
make up commands="yeth" network=eth filter=yeth

aerodrome-apy-previews:
make up commands="drome_apy_previews" network=base

aerodrome-apy-previews-monitoring:
make up commands="drome_apy_previews with_monitoring" network=base

velodrome-apy-previews:
make up commands="drome_apy_previews" network=optimism

velodrome-apy-previews-monitoring:
make up commands="drome_apy_previews with_monitoring" network=optimism

aerodrome-apy-previews:
make up commands="drome_apy_previews" network=base
Expand Down Expand Up @@ -324,8 +336,8 @@ yeth:
# utils
fetch-memray:
mkdir reports/memray -p
sudo cp -r /var/lib/docker/volumes/yearn-exporter-worker-ethereum_memray/_data/ reports/memray/ethereum
sudo cp -r /var/lib/docker/volumes/yearn-exporter-worker-fantom_memray/_data/ reports/memray/fantom
sudo cp -r /var/lib/docker/volumes/yearn-exporter-worker-arbitrum_memray/_data/ reports/memray/arbitrum
sudo cp -r /var/lib/docker/volumes/yearn-exporter-worker-optimism_memray/_data/ reports/memray/optimism
sudo cp -r /var/lib/docker/volumes/yearn-exporter-worker-gnosis_memray/_data/ reports/memray/gnosis
sudo cp -r /raid/docker/volumes/yearn-exporter-worker-ethereum_memray/_data/ reports/memray/ethereum
sudo cp -r /raid/docker/volumes/yearn-exporter-worker-fantom_memray/_data/ reports/memray/fantom
sudo cp -r /raid/docker/volumes/yearn-exporter-worker-arbitrum_memray/_data/ reports/memray/arbitrum
sudo cp -r /raid/docker/volumes/yearn-exporter-worker-optimism_memray/_data/ reports/memray/optimism
sudo cp -r /raid/docker/volumes/yearn-exporter-worker-gnosis_memray/_data/ reports/memray/gnosis
1 change: 1 addition & 0 deletions brownie-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ networks:
default: mainnet

autofetch_sources: false
eager_caching: false

compiler:
evm_version: london
Expand Down
6 changes: 3 additions & 3 deletions brownie_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ BROWNIE_NETWORK=${BROWNIE_NETWORK:-mainnet} # default to Ethereum mainnet
EXPLORER=${EXPLORER:-$DEFAULT_EXPLORER}

# add Base to brownie's network list
if ! brownie networks list | grep Base > /dev/null; then
brownie networks add Base base-main host=https://base.meowrpc.com chainid=8453 explorer=https://api.basescan.org/api || true
if ! poetry run brownie networks list | grep Base > /dev/null; then
poetry run brownie networks add Base base-main host=https://base.meowrpc.com chainid=8453 explorer=https://api.basescan.org/api || true
fi

# modify the network
if [[ ! -z "$WEB3_PROVIDER" ]]; then
brownie networks modify $BROWNIE_NETWORK host=$WEB3_PROVIDER explorer=$EXPLORER
poetry run brownie networks modify $BROWNIE_NETWORK host=$WEB3_PROVIDER explorer=$EXPLORER
fi
6 changes: 3 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ fi
echo "Running brownie for $@ on network $BROWNIE_NETWORK..."

# Normal Mods
brownie run $@ --network $BROWNIE_NETWORK -r
poetry run brownie run $@ --network $BROWNIE_NETWORK -r

# Memray Live Mode
#memray run --trace-python-allocators --live-remote --live-port=9999 /usr/local/bin/brownie run $@ --network $BROWNIE_NETWORK -r
#poetry run memray run --trace-python-allocators --live-remote --live-port=9999 /usr/local/bin/brownie run $@ --network $BROWNIE_NETWORK -r

# Memray Export Mode
#memray run --trace-python-allocators --output /app/yearn-exporter/memray/$BROWNIE_NETWORK/[email protected] --force /usr/local/bin/brownie run $@ --network $BROWNIE_NETWORK -r
#poetry run memray run --trace-python-allocators --output /app/yearn-exporter/memray/$BROWNIE_NETWORK/[email protected] --force /usr/local/bin/brownie run $@ --network $BROWNIE_NETWORK -r
27 changes: 27 additions & 0 deletions loader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

import asyncio
import hashlib
import os
import time
from types import ModuleType

import aiofiles
from async_lru import alru_cache


@alru_cache(maxsize=None)
async def hash_module(module: ModuleType) -> bytes:
is_directory = hasattr(module, '__path__')
if not is_directory:
return hashlib.sha256(await read_file(module.__file__)).digest()
contents = await asyncio.gather(*[
read_file(f'{dir}/{file}')
for path in module.__path__
for dir, dirs, files in os.walk(path)
for file in files
])
return hashlib.sha256(b"".join(contents)).digest()

async def read_file(file_path: str) -> bytes:
async with aiofiles.open(file_path, mode='rb') as handle:
return await handle.read()
Loading
Loading