Skip to content

Commit

Permalink
change tmp.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohamad Bastin committed Oct 17, 2023
1 parent c712f47 commit e379f7b
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 27 deletions.
6 changes: 3 additions & 3 deletions tmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def split_list(input_list, chunk_size):
]


addresses_chunks = split_list(addresses, 100)
chances_chunks = split_list(chances, 100)
addresses_chunks = split_list(addresses[369:], 100)
chances_chunks = split_list(chances[369:], 100)


for i in addresses_chunks:
Expand All @@ -51,5 +51,5 @@ def add_entries(data_dict):
)


add_entries(data_dict)
# add_entries(data_dict)
print(LineaRaffleEntries.objects.all().count())
117 changes: 93 additions & 24 deletions tmp2.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,102 @@
import csv
from prizetap.models import LineaRaffleEntries, Raffle
from prizetap.utils import LineaPrizetapContractClient

winners = [
"0xA231a5Ae629a0F15e1C1EB3FfBf813589e206926",
"0x9f6e94E4fe7A0526B27552e7fE051db63886A441",
"0x51D648F5F66652097d793235eBd6E774f6A77AF6",
"0xf9DFF5d16439b7a24419be1484ABD50e2c60e620",
"0x8763Cfe56B224Fba5125Ec2A1B2cCFDE43C2aF6B",
"0xA63AdCafB1a6a4229916fBeE82D50095a3635f3F",
"0x480fDAC187f65a80D2559f2BDf7f5db9B8E36D2a",
"0x42b40C18fd55822c03d7966146F0305fDffeC556",
"0xd454ED303748Bb5a433388F9508433ba5d507030",
"0xCA024Cc7C74d0DE58C0dEF263fdc5C9cEF45351e",
"0x08a9B4221A84Bb39Faa7D6fE0F7664EFEc9511aC",
"0xd5B224F44D6421058ab43Af63add9af0EFf9896e",
"0xfD7Ec5aA742F32300BEBCf44855275Ba3D737c94",
"0x610Fb99011Cef57175aAdCEfdA0086822e0d5e2d",
"0x3587f95530ed2fc300dFd4006642722a718a179e",
"0x435143Cc1aD24F23167Ba06531f4669A375179A0",
"0x0d8106d2ba1173043d800185FBA525763F364fD0",
"0x7c23A81Ed302F026b53D74c881088A04a6Fe121e",
"0x857C26509CE7c28757eA562813F2ae3ad3AAFBac",
"0xA3a527d1a247d9C69f7AD2c9842cdf6989B7B75A",
"0xe442145711Bf3c56452F0dcc730f3ad65Ce230Cc",
"0x31EA2730A76c7d480bba0267Eb91d02a3087ea88",
"0x2Bd9Fe75a7D355359C9450B025cCd20ABDa8A3AD",
"0x1Db7373B68b09a319cE16874860026Ce9DbA3845",
"0x9310a32F12A28f9F4fB54d60A41Eb3bfBD86a16a",
"0x7Decc05384062a182A00Dcf049e553bC0Ecb4630",
"0x8ba1f30Aa7E5763Baf157F2821776fC5Bf78Ae69",
"0xE27d9E71A92eb928D033194987be22998b336068",
"0xdA0F4b7C7e77D34190A22EA2574d60FA0633E8C7",
"0xC1123A379399E2A07fba2B965aB42A8e7500Dc77",
"0x83eAd847CC4bDD3d479207EcFE0D276C2D26f06C",
"0xcEa0378B24a1C7cEA48d5Df77d2900fb1898fB4E",
"0xd1875347f9061E5a17bd97CCBB5b9C5aD33DaF18",
"0x39BB1652551C0De130A97026FF39cd48964863E4",
"0xD4D66ACc07318b5B20cb46e684CDC7f5F1C148B0",
"0x8e6Db1ffbb82c1E148DcF8865e8f491816065dC3",
"0xB2Df04F4536B99666E3968d14761bb890d002Df3",
"0x37838B2e65552C6e15Fa8E3639163a50B1bCDde3",
"0x2C21DC4fe422fBAdd7DC1edA8AC4D10a8D9fFa2e",
"0x0EF0866E92DA4f8712AaF2b503c434cdF192f3f0",
"0xA971305B99eD4F6869f98135979206b8dC1f0eDa",
"0xFfb8C9ec9951B1d22AE0676A8965de43412CeB7d",
"0xdcb6E52C0802186de2505A98fFb3adD79F6AA711",
"0x4c4361a6852231E891fD124c287f53aEB24F539D",
"0xF6e5Adf2ffEeFdbC2D62E10DC3629b211F464ce6",
"0xf9506E0bd0d1F41E32b94dC2Ba6918D85955641E",
"0x6E61526B020096e1f2aed74Fdaf0e66247b6fF49",
"0x16021a584b2dB7b99DB5368aB66031961Fa8cd13",
"0x3090A8da23358422A98A0cC2DDEDa51ebdeB27d0",
"0x7CdDEd391CEF865b7F03905b0c29da129B308E4e",
"0x244cf975996Fa8Ea19cAb33706d4e0AEc97b2aD3",
"0x507551Ae8F089D459322f4c7E67d1567B4FC9e12",
"0xb63689c89FC7F1089E02708B0483e71C56F7Ce86",
"0x776f013A773BEC54BfD022b3c64870806697cEEb",
"0x724aA571841DaDbaFBd5a2C34a7Cf94e182Be5EC",
"0xc6d4A1FaAeFb4d2661F3d235995F1B78B46Bf9DE",
"0x1690a5A4830ec4D9DAfCA3769DAdD7472ABBd153",
"0xc05ED8F3adbC1007d9d8dEbc21a721Aa951FAD50",
"0x54f7783B7ce0939Deb74EA704A8e5A0468862823",
"0xEC126F4C4261690bA958195925c232ca80E8a862",
"0xc5A1b9bFB4eFf5bA4B0BD9eab6c27C625997CF4c",
"0x989b1A61b4796151f51852EFa1F128A02c5E3a32",
"0xC6F5f0f619148317025EE9527384971b2E61b377",
"0x6710447707295209D4B3ce160C19F62B2472D06c",
"0x3c800EB80DcC3bd8217F73771e92064016E16F9c",
"0x05a9b6d8DF2088E825b2055D72F8F3243ae30417",
"0xF2b9d00E6208EC1e27Da00a7deBa73BC105056Aa",
"0x7bA1CBe79c811ee2ae33a9207240376f2cCaAd9f",
"0x0a1a8a13fd2c3094B8F563B4944Db4e18bFcF90C",
"0x0c4F890A7b98486Ded2B80510a2656A9aE778a1d",
"0xE9Ad3a680b4cd89f13484A22fd1823922d64eb1a",
"0xF348D71730A16892CE864F5d72AA4470bf03e938",
"0x8e5b87e44F62f5e977911836216E5A0d866e4983",
"0x493a91A299C7D0DfEd26Ed84bc2184C6016ED60F",
"0xE813EcA6798d42C5DA06aA4b6506F4569d990EAE",
"0xD5E23c650758A077Cc96060718Bbe631585C2C95",
"0xDf4F68FeF95c1327CC067156625007C304Ec3110",
"0xE5E853f567A6c4824dD98C366AA9F9f0CA8365C6",
"0x0b817A4CC314F7A645DC0caa83653a33755442AC",
"0x4Cf53a1c57ABC6Ad011Ff833bEF33B37075D7fa7",
"0x06D618E1B16e351ab6c99fa9C7991Ac6753cD26C",
"0x5bcF13cF8C2bcD82b13AD606c344A3737Cc587f0",
"0x72Fcb7a980C2cA19cE937cE5a1EA00F6bb7aAE30",
"0x76e31A629B238d9eAB3D51292878Dab5eE8934b4",
]

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


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()
print(LineaRaffleEntries.objects.filter(is_winner=True).count())


def count_winners(raffle):
winners = 0
for entry in raffle.linea_entries:
if entry.is_winner:
winners += 1
print(winners)
for i in LineaRaffleEntries.objects.all():
if i.wallet_address in winners:
i.is_winner = True
i.save()


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)
print(LineaRaffleEntries.objects.filter(is_winner=True).count())

0 comments on commit e379f7b

Please sign in to comment.