Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:UnitapApp/unitap-backend into de…
Browse files Browse the repository at this point in the history
…velop
  • Loading branch information
ShayanShiravani committed Oct 17, 2023
2 parents 8f887a1 + 4e2052f commit f19e2b5
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tmp2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import csv
from prizetap.models import LineaRaffleEntries, Raffle
from prizetap.utils import LineaPrizetapContractClient


def get_winners(raffle):
raffle_client = LineaPrizetapContractClient(raffle)
winner_addresses = raffle_client.get_raffle_winners()
return winner_addresses


def set_winners(raffle, winner_addresses):
for entry in raffle.linea_entries:
if entry.wallet_address in winner_addresses:
entry.is_winner = True
entry.save()


def count_winners(raffle):
winners = 0
for entry in raffle.linea_entries:
if entry.is_winner:
winners += 1
print(winners)


linea_raffle = Raffle.objects.get(name="Linea Gas Pass")
count_winners(linea_raffle)
winners = get_winners(linea_raffle)
print("a", winners)
print("b", len(winners))
set_winners(linea_raffle, winners)
count_winners("a", linea_raffle)

0 comments on commit f19e2b5

Please sign in to comment.