Skip to content

Commit

Permalink
Contribution ingest script updates (#7686)
Browse files Browse the repository at this point in the history
* Only use checksum addresses, clarify input arguments

* Update ingest_grant_txns.py

Co-authored-by: Aditya Anand M C <[email protected]>
  • Loading branch information
mds1 and thelostone-mc authored Nov 11, 2020
1 parent f5d7e23 commit c037172
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions app/grants/management/commands/ingest_grant_txns.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@
"""

# ============================== Set the variables for this run here ===============================
network = "rinkeby"
handle = "mds1"
txid = "0xdc85d562b0c0caf25e03e692d0ccc696ebcf5046cb36d12d4fdf88ceb7cac0e1"
token = "USDT"
to_address = "0xaBEA9132b05A70803a4E85094fD0e1800777fBEF"
from_address = "0x60A5dcB2fC804874883b797f37CbF1b0582ac2dD"
do_write = True
created_on = datetime.datetime(2020, 10, 5, 17, 22, tzinfo=pytz.UTC)
gitcoin_zksync_addr = "0x5b4e39e6649a9c0afd39f068f7076f0ea3125e8a" # required for zkSync cases
network = "rinkeby" # "mainnet" or "rinkeby"
handle = "mds1" # Gitcoin username of user who made the contributions
txid = "0xdc85d562b0c0caf25e03e692d0ccc696ebcf5046cb36d12d4fdf88ceb7cac0e1" # L1 transaction hash
token = "USDT" # token contributions were made in
to_address = "0xaBEA9132b05A70803a4E85094fD0e1800777fBEF" # recipient of the L1 transaction
from_address = "0x60A5dcB2fC804874883b797f37CbF1b0582ac2dD" # from address for hash given by txid
do_write = True # Use True to save contributions to Database
created_on = datetime.datetime(2020, 10, 5, 17, 22, tzinfo=pytz.UTC) # UTC timestamp oftxid
gitcoin_zksync_addr = "0x5b4e39e6649a9c0afd39f068f7076f0ea3125e8a" # user's Gitcoin zkSync address, only used for zkSync cases


class Command(BaseCommand):
Expand Down Expand Up @@ -175,7 +175,7 @@ def handle(self, *args, **options):
zksync_contract = w3.eth.contract(address=zksync_address, abi=zksync_abi)

# Main Execution ===================================================================================
if to_address == bulk_checkout_address:
if w3.toChecksumAddress(to_address) == w3.toChecksumAddress(bulk_checkout_address):
# BulkCheckout
# Make sure tx was successful
receipt = w3.eth.getTransactionReceipt(txid)
Expand Down Expand Up @@ -236,7 +236,7 @@ def handle(self, *args, **options):

# Skip if we are sending back to the user
to = w3.toChecksumAddress(transaction["tx"]["to"])
if to == gitcoin_zksync_addr or to == from_address:
if to == w3.toChecksumAddress(gitcoin_zksync_addr) or to == w3.toChecksumAddress(from_address):
continue

# Extract contribution parameters from the JSON
Expand Down

0 comments on commit c037172

Please sign in to comment.