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

Fix/covered protocols #66

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,9 @@ def new(self, session, indx, block, tx_hash, args, contract_address):

ProtocolCoverage.update(session, protocol.id, coverage_amount, timestamp)

# Coverages are updated, make new TVC calculation
self.calc_tvc(session, indx, block)

class ClaimCreated:
def new(self, session, indx, block, tx_hash, args, contract_address):
protocol_bytes_id = Protocol.parse_bytes_id(args["protocol"])
Expand Down
9 changes: 8 additions & 1 deletion settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
DB_USER = config("DB_USER")
DB_PASS = config("DB_PASS")
DB_PORT = config("DB_PORT")
DB_NAME = config("DB_NAME")
if os.environ.get('PYTEST_CURRENT_TEST'):
DB_NAME = config("DB_NAME_TEST", default='indexer_test')
else:
DB_NAME = config("DB_NAME")

DATABASE_URI = "postgresql+psycopg2://{}:{}@localhost:{}/{}".format(DB_USER, DB_PASS, DB_PORT, DB_NAME)
DB = create_engine(
Expand Down Expand Up @@ -93,6 +96,10 @@
with open("./meta/protocols.csv", newline="") as csv_file:
PROTOCOLS_CSV = list(csv.DictReader(csv_file))

# Remove as it conflicts with "premium" when rendering /protocols
for entry in PROTOCOLS_CSV:
del entry["premium"]

# Checksum addresses
PROTOCOLS_CSV = [{**entry, "agent": Web3.toChecksumAddress(entry["agent"])} for entry in PROTOCOLS_CSV]

Expand Down
Loading