github.com/TrueBlocks/trueblocks-core/src/apps/chifra@v0.0.0-20241022031540-b362680128f7/pkg/rpc/get_block_rewards.go (about) 1 // Copyright 2021 The TrueBlocks Authors. All rights reserved. 2 // Use of this source code is governed by a license that can 3 // be found in the LICENSE file. 4 5 package rpc 6 7 import ( 8 "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" 9 ) 10 11 // TODO: The following most likely does not work for non-mainnet chains which 12 // TODO: don't know anything about the Known blocks. 13 14 // getBlockReward returns the block reward for a given block number 15 func (conn *Connection) getBlockReward(bn base.Blknum) *base.Wei { 16 if bn == 0 { 17 return base.NewWei(0) 18 } else if bn < base.KnownBlock(conn.Chain, base.Byzantium) { 19 return base.NewWei(5000000000000000000) 20 } else if bn < base.KnownBlock(conn.Chain, base.Constantinople) { 21 return base.NewWei(3000000000000000000) 22 } else if bn < base.KnownBlock(conn.Chain, base.Merge) { 23 return base.NewWei(2000000000000000000) 24 } else { 25 return base.NewWei(0) 26 } 27 }