diff --git a/.env.example b/.env.example index d7379cb..7974853 100644 --- a/.env.example +++ b/.env.example @@ -1545,3 +1545,42 @@ MODULE_groestlcoin-main_NODES[]=http://login:password@127.0.0.1:1234/ MODULE_groestlcoin-main_NODES[]=http://login:password@127.0.0.2:1234/ MODULE_groestlcoin-main_REQUESTER_TIMEOUT=60 MODULE_groestlcoin-main_REQUESTER_THREADS=12 + +############### +## Bitfinity ## +############### + +MODULES[]=bitfinity-main +MODULE_bitfinity-main_CLASS=BitfinityMainModule +MODULE_bitfinity-main_NODES[]=http://login:password@127.0.0.1:1234/ +MODULE_bitfinity-main_NODES[]=http://login:password@127.0.0.1:1234/ +MODULE_bitfinity-main_REQUESTER_TIMEOUT=60 +MODULE_bitfinity-main_REQUESTER_THREADS=12 + +MODULES[]=bitfinity-trace +MODULE_bitfinity-trace_CLASS=BitfinityTraceModule +MODULE_bitfinity-trace_NODES[]=http://login:password@127.0.0.1:1234/ +MODULE_bitfinity-trace_NODES[]=http://login:password@127.0.0.1:1234/ +MODULE_bitfinity-trace_REQUESTER_TIMEOUT=60 +MODULE_bitfinity-trace_REQUESTER_THREADS=12 + +MODULES[]=bitfinity-erc-20 +MODULE_bitfinity-erc-20_CLASS=BitfinityERC20Module +MODULE_bitfinity-erc-20_NODES[]=http://login:password@127.0.0.1:1234/ +MODULE_bitfinity-erc-20_NODES[]=http://login:password@127.0.0.1:1234/ +MODULE_bitfinity-erc-20_REQUESTER_TIMEOUT=60 +MODULE_bitfinity-erc-20_REQUESTER_THREADS=12 + +MODULES[]=bitfinity-erc-721 +MODULE_bitfinity-erc-721_CLASS=BitfinityERC721Module +MODULE_bitfinity-erc-721_NODES[]=http://login:password@127.0.0.1:1234/ +MODULE_bitfinity-erc-721_NODES[]=http://login:password@127.0.0.1:1234/ +MODULE_bitfinity-erc-721_REQUESTER_TIMEOUT=60 +MODULE_bitfinity-erc-721_REQUESTER_THREADS=12 + +MODULES[]=bitfinity-erc-1155 +MODULE_bitfinity-erc-1155_CLASS=BitfinityERC1155Module +MODULE_bitfinity-erc-1155_NODES[]=http://login:password@127.0.0.1:1234/ +MODULE_bitfinity-erc-1155_NODES[]=http://login:password@127.0.0.1:1234/ +MODULE_bitfinity-erc-1155_REQUESTER_TIMEOUT=60 +MODULE_bitfinity-erc-1155_REQUESTER_THREADS=12 diff --git a/Modules/BOBMainModule.php b/Modules/BOBMainModule.php index 4de0ef2..65eaedd 100644 --- a/Modules/BOBMainModule.php +++ b/Modules/BOBMainModule.php @@ -21,7 +21,7 @@ function initialize() // EVMMainModule $this->evm_implementation = EVMImplementation::geth; - $this->extra_features = [EVMSpecialFeatures::EffectiveGasPriceCanBeZero]; + $this->extra_features = [EVMSpecialFeatures::EffectiveGasPriceCanBeZeroOrNull]; $this->reward_function = function($block_id) { return '0'; diff --git a/Modules/BitfinityERC1155Module.php b/Modules/BitfinityERC1155Module.php new file mode 100644 index 0000000..b9ab452 --- /dev/null +++ b/Modules/BitfinityERC1155Module.php @@ -0,0 +1,22 @@ +blockchain = 'bitfinity'; + $this->module = 'bitfinity-erc-1155'; + $this->is_main = false; + $this->first_block_date = '2024-06-17'; + $this->first_block_id = 0; + + $this->tests = []; // currently, only testnet contains erc1155 activity + } +} diff --git a/Modules/BitfinityERC20Module.php b/Modules/BitfinityERC20Module.php new file mode 100644 index 0000000..379e7bf --- /dev/null +++ b/Modules/BitfinityERC20Module.php @@ -0,0 +1,22 @@ +blockchain = 'bitfinity'; + $this->module = 'bitfinity-erc-20'; + $this->is_main = false; + $this->first_block_date = '2024-06-17'; + $this->first_block_id = 0; + + $this->tests = []; // currently, only testnet contains erc20 activity + } +} diff --git a/Modules/BitfinityERC721Module.php b/Modules/BitfinityERC721Module.php new file mode 100644 index 0000000..ef42644 --- /dev/null +++ b/Modules/BitfinityERC721Module.php @@ -0,0 +1,22 @@ +blockchain = 'bitfinity'; + $this->module = 'bitfinity-erc-721'; + $this->is_main = false; + $this->first_block_date = '2024-06-17'; + $this->first_block_id = 0; + + $this->tests = []; // currently, only testnet contains erc721 activity + } +} diff --git a/Modules/BitfinityMainModule.php b/Modules/BitfinityMainModule.php new file mode 100644 index 0000000..0b68243 --- /dev/null +++ b/Modules/BitfinityMainModule.php @@ -0,0 +1,40 @@ +blockchain = 'bitfinity'; + $this->module = 'bitfinity-main'; + $this->is_main = true; + $this->first_block_date = '2024-06-17'; + $this->currency = 'BITFINITY'; + $this->currency_details = ['name' => 'BITFINITY', 'symbol' => 'BFT', 'decimals' => 18, 'description' => null]; + + // EVMMainModule + $this->evm_implementation = EVMImplementation::geth; + $this->extra_features = [ + EVMSpecialFeatures::EffectiveGasPriceCanBeZeroOrNull, + ]; + $this->reward_function = function($block_id) + { + return '0'; + }; + + // Handles + $this->handles_implemented = false; + + // Tests + $this->tests = [ + ['block' => 0, 'result' => 'a:2:{s:6:"events";a:2:{i:0;a:8:{s:11:"transaction";N;s:7:"address";s:4:"0x00";s:6:"effect";s:2:"-0";s:6:"failed";s:1:"f";s:5:"extra";s:1:"r";s:5:"block";i:0;s:4:"time";s:19:"2024-06-17 14:04:47";s:8:"sort_key";i:0;}i:1;a:8:{s:11:"transaction";N;s:7:"address";s:42:"0x0000000000000000000000000000000000000000";s:6:"effect";s:1:"0";s:6:"failed";s:1:"f";s:5:"extra";s:1:"r";s:5:"block";i:0;s:4:"time";s:19:"2024-06-17 14:04:47";s:8:"sort_key";i:1;}}s:10:"currencies";N;}'], + ['block' => 583440, 'result' => 'a:2:{s:6:"events";a:6:{i:0;a:8:{s:11:"transaction";s:66:"0x767378c389899012ee2052ac43a62af9a18cbe0150ea4243d2dcd9a8728931f9";s:7:"address";s:42:"0xba819e618e7fb8edc2d83763d97b96d94281dc44";s:6:"effect";s:7:"-147000";s:6:"failed";s:1:"f";s:5:"extra";s:1:"b";s:5:"block";i:583440;s:4:"time";s:19:"2024-07-09 15:38:39";s:8:"sort_key";i:0;}i:1;a:8:{s:11:"transaction";s:66:"0x767378c389899012ee2052ac43a62af9a18cbe0150ea4243d2dcd9a8728931f9";s:7:"address";s:4:"0x00";s:6:"effect";s:6:"147000";s:6:"failed";s:1:"f";s:5:"extra";s:1:"b";s:5:"block";i:583440;s:4:"time";s:19:"2024-07-09 15:38:39";s:8:"sort_key";i:1;}i:2;a:8:{s:11:"transaction";s:66:"0x767378c389899012ee2052ac43a62af9a18cbe0150ea4243d2dcd9a8728931f9";s:7:"address";s:42:"0xba819e618e7fb8edc2d83763d97b96d94281dc44";s:6:"effect";s:12:"-10000000000";s:6:"failed";s:1:"f";s:5:"extra";N;s:5:"block";i:583440;s:4:"time";s:19:"2024-07-09 15:38:39";s:8:"sort_key";i:2;}i:3;a:8:{s:11:"transaction";s:66:"0x767378c389899012ee2052ac43a62af9a18cbe0150ea4243d2dcd9a8728931f9";s:7:"address";s:42:"0xc0f8c3ec1b30933a7b7e7df4dfa49324b9598ea9";s:6:"effect";s:11:"10000000000";s:6:"failed";s:1:"f";s:5:"extra";N;s:5:"block";i:583440;s:4:"time";s:19:"2024-07-09 15:38:39";s:8:"sort_key";i:3;}i:4;a:8:{s:11:"transaction";N;s:7:"address";s:4:"0x00";s:6:"effect";s:2:"-0";s:6:"failed";s:1:"f";s:5:"extra";s:1:"r";s:5:"block";i:583440;s:4:"time";s:19:"2024-07-09 15:38:39";s:8:"sort_key";i:4;}i:5;a:8:{s:11:"transaction";N;s:7:"address";s:42:"0x0000000000000000000000000000000000000000";s:6:"effect";s:1:"0";s:6:"failed";s:1:"f";s:5:"extra";s:1:"r";s:5:"block";i:583440;s:4:"time";s:19:"2024-07-09 15:38:39";s:8:"sort_key";i:5;}}s:10:"currencies";N;}'] + ]; + } +} diff --git a/Modules/BitfinityTraceModule.php b/Modules/BitfinityTraceModule.php new file mode 100644 index 0000000..0b9ead6 --- /dev/null +++ b/Modules/BitfinityTraceModule.php @@ -0,0 +1,23 @@ +blockchain = 'bitfinity'; + $this->module = 'bitfinity-trace'; + $this->complements = 'bitfinity-main'; + $this->is_main = false; + $this->first_block_date = '2024-06-17'; + + // EVMTraceModule + $this->evm_implementation = EVMImplementation::geth; + } +} diff --git a/Modules/Common/EVMMainModule.php b/Modules/Common/EVMMainModule.php index 6bb75b2..4d76503 100644 --- a/Modules/Common/EVMMainModule.php +++ b/Modules/Common/EVMMainModule.php @@ -265,7 +265,7 @@ final public function pre_process_block($block_id) if (in_array(EVMSpecialFeatures::HasSystemTransactions, $this->extra_features)) $transaction_data[($general_data[$i]['hash'])]['type'] = $receipt_data[$i]['type']; - + if (in_array(EVMSpecialFeatures::EIP4844, $this->extra_features)) { $transaction_data[($general_data[$i]['hash'])]['type'] = $receipt_data[$i]['type']; @@ -398,10 +398,12 @@ final public function pre_process_block($block_id) { $this_gas_used = to_int256_from_0xhex($transaction['gasUsed']); $this_burned = (!is_null($base_fee_per_gas)) ? bcmul($base_fee_per_gas, $this_gas_used) : '0'; - $this_to_miner = bcsub(bcmul(to_int256_from_0xhex($transaction['effectiveGasPrice']), $this_gas_used), $this_burned); + $this_effective_gas_price = (!is_null($transaction['effectiveGasPrice'])) ? to_int256_from_0xhex($transaction['effectiveGasPrice']) : '0'; + + $this_to_miner = bcsub(bcmul($this_effective_gas_price, $this_gas_used), $this_burned); - if (in_array(EVMSpecialFeatures::EffectiveGasPriceCanBeZero, $this->extra_features)) - if ($transaction['effectiveGasPrice'] === '0x0') + if (in_array(EVMSpecialFeatures::EffectiveGasPriceCanBeZeroOrNull, $this->extra_features)) + if ($transaction['effectiveGasPrice'] === '0x0' || is_null($transaction['effectiveGasPrice'])) $this_to_miner = '0'; // The fee is $this_burned + $this_to_miner diff --git a/Modules/Common/EVMTraits.php b/Modules/Common/EVMTraits.php index 880732a..f818c2a 100644 --- a/Modules/Common/EVMTraits.php +++ b/Modules/Common/EVMTraits.php @@ -33,7 +33,7 @@ enum EVMSpecialFeatures case zkEVM; case SpecialSenderPaysNoFee; case HasSystemTransactions; - case EffectiveGasPriceCanBeZero; + case EffectiveGasPriceCanBeZeroOrNull; case NoEIP1559BurnFee; // Linea does this case rskEVM; // Rootstock has different traces and deferred validators rewards (in N+4000 block). case TraceBlockSupport; // Support for `trace_block` in RPC API diff --git a/Modules/GnosisChainMainModule.php b/Modules/GnosisChainMainModule.php index b384092..a2112f8 100644 --- a/Modules/GnosisChainMainModule.php +++ b/Modules/GnosisChainMainModule.php @@ -24,7 +24,7 @@ function initialize() // EVMMainModule $this->evm_implementation = EVMImplementation::Erigon; // Change to geth if you're running Nethermind, but this would be slower - $this->extra_features = [EVMSpecialFeatures::EffectiveGasPriceCanBeZero]; + $this->extra_features = [EVMSpecialFeatures::EffectiveGasPriceCanBeZeroOrNull]; $this->reward_function = function($block_id) { return '0';