-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathRootstockMainModule.php
More file actions
54 lines (44 loc) · 1.99 KB
/
RootstockMainModule.php
File metadata and controls
54 lines (44 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php declare(strict_types=1);
/* Idea (c) 2023 Nikita Zhavoronkov, nikzh@nikzh.com
* Copyright (c) 2023-2024 3xpl developers, 3@3xpl.com, see CONTRIBUTORS.md
* Distributed under the MIT software license, see LICENSE.md */
/* This is the main Rootstock module. */
final class RootstockMainModule extends EVMMainModule implements Module, BalanceSpecial, TransactionSpecials, AddressSpecials, BroadcastTransactionSpecial
{
function initialize()
{
// CoreModule
$this->blockchain = 'rootstock';
$this->module = 'rootstock-main';
$this->is_main = true;
$this->first_block_date = '2018-01-02';
$this->currency = 'smart-bitcoin';
$this->currency_details = ['name' => 'Smart Bitcoin', 'symbol' => 'RBTC', 'decimals' => 18, 'description' => null];
// EVMMainModule
$this->evm_implementation = EVMImplementation::geth;
$this->extra_features = [EVMSpecialFeatures::rskEVM, EVMSpecialFeatures::FeeCollectorAddress];
$this->reward_function = function ($block_id) {
return '0';
};
$this->fee_collector_address = '0x0000000000000000000000000000000001000008';
// Handles (RNS)
// https://dev.rootstock.io/rif/rns/mainnet/
$this->handles_implemented = true;
$this->handles_regex = '/(.*)\.rsk/';
$this->api_get_handle = function($handle)
{
if (!preg_match($this->handles_regex, $handle))
return null;
require_once __DIR__ . '/../Engine/Crypto/Keccak.php';
$hash = $this->ens_name_to_hash($handle);
if (is_null($hash) || $hash === '')
return null;
$resolver = $this->ens_get_data($hash, '0x0178b8bf', '0xcb868aeabd31e2b66f74e9a55cf064abb31a4ad5');
$address = $this->ens_get_data_from_resolver($resolver, $hash, '0x3b3b57de', -40);
if ($address)
return '0x' . $address;
else
return null;
};
}
}