Skip to content

Commit

Permalink
Ignore zero wei transfers (#405)
Browse files Browse the repository at this point in the history
Today's dry-run failed because of an assertion that fails with the
following msg:

`AssertionError: Can't construct negative transfer of 0`

It seems the script is now trying to add some zero wei transfers for
partner fees. I admit i don't know why these transfers show up now and
weren't showing up before, but for now this PR proposes to relax the
test and only complain for negative transfers for partner fees, while
ignoring the zero wei transfers.
  • Loading branch information
harisang authored Oct 7, 2024
1 parent c4f9c6c commit 11ccd2e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions src/fetch/payouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,13 +332,16 @@ def prepare_transfers(
)
)
for address in partner_fees_wei:
transfers.append(
Transfer(
token=None,
recipient=Address(address),
amount_wei=partner_fees_wei[address],
amount_wei = partner_fees_wei[address]
assert amount_wei >= 0, f"Can't construct negative transfer of {amount_wei}"
if amount_wei > 0:
transfers.append(
Transfer(
token=None,
recipient=Address(address),
amount_wei=amount_wei,
)
)
)

return PeriodPayouts(overdrafts, transfers)

Expand Down
2 changes: 1 addition & 1 deletion src/models/transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Transfer:
amount_wei: int

def __init__(self, token: Optional[Token], recipient: Address, amount_wei: int):
assert amount_wei > 0, f"Can't construct negative transfer of {amount_wei}"
assert amount_wei > 0, f"Can't construct non-positive transfer of {amount_wei}"

self.token = token
self._recipient = recipient
Expand Down

0 comments on commit 11ccd2e

Please sign in to comment.