Skip to content

Commit 45e018b

Browse files
committed
Confirming DAI payments using the correct received address
1 parent 7827ba8 commit 45e018b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

pretix_eth/management/commands/confirm_payments.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,16 @@ def confirm_payments_for_event(self, event: Event, no_dry_run, log_verbosity=0):
114114
if token.IS_NATIVE_ASSET:
115115
# ETH
116116
payment_amount = w3.eth.getTransaction(signed_message.transaction_hash).value
117+
receipt_reciever = receipt.to.lower()
117118
else:
118119
# DAI
119120
contract = w3.eth.contract(address=token.ADDRESS, abi=TOKEN_ABI)
120121
transaction_details = contract.events.Transfer().processReceipt(receipt)[0].args
121122
payment_amount = transaction_details.value
123+
# take recipient address from the topics, not from the "from" field, as that's the contract address
124+
receipt_reciever = receipt.logs[0].topics[2][12:].hex().lower()
122125

123126
receipt_sender = getattr(receipt, 'from').lower()
124-
receipt_reciever = receipt.to.lower()
125127
correct_sender = receipt_sender == signed_message.sender_address.lower()
126128
correct_recipient = receipt_reciever == signed_message.recipient_address.lower()
127129

0 commit comments

Comments
 (0)