This commit is contained in:
Luke Van Seters 2021-08-27 09:49:00 -04:00
parent 0e6cd420ec
commit 9d364b5804
2 changed files with 11 additions and 7 deletions

View File

@ -24,9 +24,11 @@ def get_miner_payments(
eth_transfers, to_address=miner_address.lower() eth_transfers, to_address=miner_address.lower()
) )
wei_transfered_to_miner = sum( coinbase_transfer = sum(transfer.amount for transfer in miner_eth_transfers)
transfer.amount for transfer in miner_eth_transfers
) gas_cost = receipt.effective_gas_price * receipt.gas_used
total_gas_cost = gas_cost + coinbase_transfer
gas_price_with_coinbase_transfer = total_gas_cost / receipt.gas_used
miner_payments.append( miner_payments.append(
MinerPayment( MinerPayment(
@ -34,9 +36,10 @@ def get_miner_payments(
block_number=receipt.block_number, block_number=receipt.block_number,
transaction_hash=receipt.transaction_hash, transaction_hash=receipt.transaction_hash,
transaction_index=receipt.transaction_index, transaction_index=receipt.transaction_index,
effective_gas_price=receipt.effective_gas_price, gas_price=receipt.effective_gas_price,
gas_price_with_coinbase_transfer=gas_price_with_coinbase_transfer,
gas_used=receipt.gas_used, gas_used=receipt.gas_used,
wei_transfered_to_miner=wei_transfered_to_miner, coinbase_transfer=coinbase_transfer,
) )
) )

View File

@ -6,6 +6,7 @@ class MinerPayment(BaseModel):
transaction_hash: str transaction_hash: str
transaction_index: int transaction_index: int
miner_address: str miner_address: str
wei_transfered_to_miner: int coinbase_transfer: int
effective_gas_price: int gas_price: int
gas_price_with_coinbase_transfer: int
gas_used: int gas_used: int