Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Merlin support #94

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,61 @@ MODULE_litecoin-mweb_NODES[]=http://login:[email protected]:1234/
MODULE_litecoin-mweb_REQUESTER_TIMEOUT=60
MODULE_litecoin-mweb_REQUESTER_THREADS=12

####################
# Main Merlin Module
####################

MODULES[]=merlin-main
MODULE_merlin-main_CLASS=MerlinMainModule
MODULE_merlin-main_NODES[]=http://login:[email protected]:1234/
MODULE_merlin-main_NODES[]=http://login:[email protected]:1234/
MODULE_merlin-main_REQUESTER_TIMEOUT=60
MODULE_merlin-main_REQUESTER_THREADS=12

######################
## Trace Merlin Module
######################

MODULES[]=merlin-trace
MODULE_merlin-trace_CLASS=MerlinTraceModule
MODULE_merlin-trace_NODES[]=http://login:[email protected]:1234/
MODULE_merlin-trace_NODES[]=http://login:[email protected]:1234/
MODULE_merlin-trace_REQUESTER_TIMEOUT=60
MODULE_merlin-trace_REQUESTER_THREADS=12

######################
## ERC20 Merlin Module
######################

MODULES[]=merlin-erc-20
MODULE_merlin-erc-20_CLASS=MerlinERC20Module
MODULE_merlin-erc-20_NODES[]=http://login:[email protected]:1234/
MODULE_merlin-erc-20_NODES[]=http://login:[email protected]:1234/
MODULE_merlin-erc-20_REQUESTER_TIMEOUT=60
MODULE_merlin-erc-20_REQUESTER_THREADS=12

#######################
## ERC721 Merlin Module
#######################

MODULES[]=merlin-erc-721
MODULE_merlin-erc-721_CLASS=MerlinERC721Module
MODULE_merlin-erc-721_NODES[]=http://login:[email protected]:1234/
MODULE_merlin-erc-721_NODES[]=http://login:[email protected]:1234/
MODULE_merlin-erc-721_REQUESTER_TIMEOUT=60
MODULE_merlin-erc-721_REQUESTER_THREADS=12

#########################
## ERC-1155 Merlin Module
#########################

MODULES[]=merlin-erc-1155
MODULE_merlin-erc-1155_CLASS=MerlinERC1155Module
MODULE_merlin-erc-1155_NODES[]=http://login:[email protected]:1234/
MODULE_merlin-erc-1155_NODES[]=http://login:[email protected]:1234/
MODULE_merlin-erc-1155_REQUESTER_TIMEOUT=60
MODULE_merlin-erc-1155_REQUESTER_THREADS=12

#######################
## Main Optimism Module
#######################
Expand Down
26 changes: 26 additions & 0 deletions Modules/MerlinERC1155Module.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php declare(strict_types = 1);

/* Idea (c) 2023 Nikita Zhavoronkov, [email protected]
* Copyright (c) 2023-2024 3xpl developers, [email protected], see CONTRIBUTORS.md
* Distributed under the MIT software license, see LICENSE.md */

/* This module processes ERC-1155 MT transfers in Merlin. It requires a geth node to run. */

final class MerlinERC1155Module extends EVMERC1155Module implements Module, MultipleBalanceSpecial
{
function initialize()
{
// CoreModule
$this->blockchain = 'merlin';
$this->module = 'merlin-erc-1155';
$this->is_main = false;
$this->first_block_date = '2024-02-02';
$this->first_block_id = 0;

$this->extra_features = [EVMSpecialFeatures::zkEVM];

$this->tests = [
['block' => 1546384, 'result' => 'a:2:{s:6:"events";a:2:{i:0;a:8:{s:11:"transaction";s:66:"0x891e356287d20f100f61e02d9862cd6ee1e4b29f234ab4fa1972ca160e80f3ae";s:8:"currency";s:42:"0x5e68be9a532eadf5edcbc2bec857d3d4b2e3aec5";s:7:"address";s:42:"0x0000000000000000000000000000000000000000";s:8:"sort_key";i:0;s:6:"effect";s:2:"-1";s:5:"extra";s:1:"2";s:5:"block";i:1546384;s:4:"time";s:19:"2024-05-15 08:10:21";}i:1;a:8:{s:11:"transaction";s:66:"0x891e356287d20f100f61e02d9862cd6ee1e4b29f234ab4fa1972ca160e80f3ae";s:8:"currency";s:42:"0x5e68be9a532eadf5edcbc2bec857d3d4b2e3aec5";s:7:"address";s:42:"0xe0a5996cebbc85d5188d8f1e85ccff8c64f2dba3";s:8:"sort_key";i:1;s:6:"effect";s:1:"1";s:5:"extra";s:1:"2";s:5:"block";i:1546384;s:4:"time";s:19:"2024-05-15 08:10:21";}}s:10:"currencies";a:1:{i:0;a:3:{s:2:"id";s:42:"0x5e68be9a532eadf5edcbc2bec857d3d4b2e3aec5";s:4:"name";s:0:"";s:6:"symbol";s:0:"";}}}'],
];
}
}
26 changes: 26 additions & 0 deletions Modules/MerlinERC20Module.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php declare(strict_types = 1);

/* Idea (c) 2023 Nikita Zhavoronkov, [email protected]
* Copyright (c) 2023-2024 3xpl developers, [email protected], see CONTRIBUTORS.md
* Distributed under the MIT software license, see LICENSE.md */

/* This module processes ERC-20 token transfers in Merlin. It requires a geth node to run. */

final class MerlinERC20Module extends EVMERC20Module implements Module, MultipleBalanceSpecial, SupplySpecial
{
function initialize()
{
// CoreModule
$this->blockchain = 'merlin';
$this->module = 'merlin-erc-20';
$this->is_main = false;
$this->first_block_date = '2024-02-02';
$this->first_block_id = 0;

$this->extra_features = [EVMSpecialFeatures::zkEVM];

$this->tests = [
['block' => 1546383, 'result' => 'a:2:{s:6:"events";a:2:{i:0;a:7:{s:11:"transaction";s:66:"0x6615d37b5f1905b14bf581998e8f0d3dbb553c7de3c1f3a5b4ed5cc0d83eaeb5";s:8:"currency";s:42:"0x32a4b8b10222f85301874837f27f4c416117b811";s:7:"address";s:42:"0x3b248606bc8d7f7101c5a84c2e7b68628dc18aa2";s:8:"sort_key";i:0;s:6:"effect";s:12:"-88980600000";s:5:"block";i:1546383;s:4:"time";s:19:"2024-05-15 08:10:15";}i:1;a:7:{s:11:"transaction";s:66:"0x6615d37b5f1905b14bf581998e8f0d3dbb553c7de3c1f3a5b4ed5cc0d83eaeb5";s:8:"currency";s:42:"0x32a4b8b10222f85301874837f27f4c416117b811";s:7:"address";s:42:"0x778ff94195adde29a05a92b0e9031e44e2efdb8e";s:8:"sort_key";i:1;s:6:"effect";s:11:"88980600000";s:5:"block";i:1546383;s:4:"time";s:19:"2024-05-15 08:10:15";}}s:10:"currencies";a:1:{i:0;a:4:{s:2:"id";s:42:"0x32a4b8b10222f85301874837f27f4c416117b811";s:4:"name";s:8:"E•MOON";s:6:"symbol";s:26:"DOG•GO•TO•THE•MOON";s:8:"decimals";i:5;}}}'],
];
}
}
26 changes: 26 additions & 0 deletions Modules/MerlinERC721Module.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php declare(strict_types = 1);

/* Idea (c) 2023 Nikita Zhavoronkov, [email protected]
* Copyright (c) 2023-2024 3xpl developers, [email protected], see CONTRIBUTORS.md
* Distributed under the MIT software license, see LICENSE.md */

/* This module processes ERC-721 NFT transfers in Merlin. It requires a geth node to run. */

final class MerlinERC721Module extends EVMERC721Module implements Module, MultipleBalanceSpecial
{
function initialize()
{
// CoreModule
$this->blockchain = 'merlin';
$this->module = 'merlin-erc-721';
$this->is_main = false;
$this->first_block_date = '2024-02-02';
$this->first_block_id = 0;

$this->extra_features = [EVMSpecialFeatures::zkEVM];

$this->tests = [
['block' => 1546385, 'result' => 'a:2:{s:6:"events";a:14:{i:0;a:8:{s:11:"transaction";s:66:"0x63ff2d02067f6fb8adad2411d18196c4ae140d765dc5f1a36a99ce4ccb8b9ea9";s:8:"currency";s:42:"0xd32e14cc9aa5413622fd00b28e50adfbf25c7ef8";s:7:"address";s:42:"0x0000000000000000000000000000000000000000";s:8:"sort_key";i:0;s:6:"effect";s:2:"-1";s:5:"extra";s:4:"8259";s:5:"block";i:1546385;s:4:"time";s:19:"2024-05-15 08:10:28";}i:1;a:8:{s:11:"transaction";s:66:"0x63ff2d02067f6fb8adad2411d18196c4ae140d765dc5f1a36a99ce4ccb8b9ea9";s:8:"currency";s:42:"0xd32e14cc9aa5413622fd00b28e50adfbf25c7ef8";s:7:"address";s:42:"0xc72ad28e8fdeaa23e05da938b3309d85e3121745";s:8:"sort_key";i:1;s:6:"effect";s:1:"1";s:5:"extra";s:4:"8259";s:5:"block";i:1546385;s:4:"time";s:19:"2024-05-15 08:10:28";}i:2;a:8:{s:11:"transaction";s:66:"0x63ff2d02067f6fb8adad2411d18196c4ae140d765dc5f1a36a99ce4ccb8b9ea9";s:8:"currency";s:42:"0xd32e14cc9aa5413622fd00b28e50adfbf25c7ef8";s:7:"address";s:42:"0x0000000000000000000000000000000000000000";s:8:"sort_key";i:2;s:6:"effect";s:2:"-1";s:5:"extra";s:4:"9892";s:5:"block";i:1546385;s:4:"time";s:19:"2024-05-15 08:10:28";}i:3;a:8:{s:11:"transaction";s:66:"0x63ff2d02067f6fb8adad2411d18196c4ae140d765dc5f1a36a99ce4ccb8b9ea9";s:8:"currency";s:42:"0xd32e14cc9aa5413622fd00b28e50adfbf25c7ef8";s:7:"address";s:42:"0xc72ad28e8fdeaa23e05da938b3309d85e3121745";s:8:"sort_key";i:3;s:6:"effect";s:1:"1";s:5:"extra";s:4:"9892";s:5:"block";i:1546385;s:4:"time";s:19:"2024-05-15 08:10:28";}i:4;a:8:{s:11:"transaction";s:66:"0x63ff2d02067f6fb8adad2411d18196c4ae140d765dc5f1a36a99ce4ccb8b9ea9";s:8:"currency";s:42:"0xd32e14cc9aa5413622fd00b28e50adfbf25c7ef8";s:7:"address";s:42:"0x0000000000000000000000000000000000000000";s:8:"sort_key";i:4;s:6:"effect";s:2:"-1";s:5:"extra";s:4:"9917";s:5:"block";i:1546385;s:4:"time";s:19:"2024-05-15 08:10:28";}i:5;a:8:{s:11:"transaction";s:66:"0x63ff2d02067f6fb8adad2411d18196c4ae140d765dc5f1a36a99ce4ccb8b9ea9";s:8:"currency";s:42:"0xd32e14cc9aa5413622fd00b28e50adfbf25c7ef8";s:7:"address";s:42:"0xc72ad28e8fdeaa23e05da938b3309d85e3121745";s:8:"sort_key";i:5;s:6:"effect";s:1:"1";s:5:"extra";s:4:"9917";s:5:"block";i:1546385;s:4:"time";s:19:"2024-05-15 08:10:28";}i:6;a:8:{s:11:"transaction";s:66:"0x42e1c312f6369805c47b48309fa4447a0844ca4322373f1ea6946a4573fd8564";s:8:"currency";s:42:"0x1eb48c61402502c655e6a59b30e9f1c93121f701";s:7:"address";s:42:"0x0000000000000000000000000000000000000000";s:8:"sort_key";i:6;s:6:"effect";s:2:"-1";s:5:"extra";s:5:"13565";s:5:"block";i:1546385;s:4:"time";s:19:"2024-05-15 08:10:28";}i:7;a:8:{s:11:"transaction";s:66:"0x42e1c312f6369805c47b48309fa4447a0844ca4322373f1ea6946a4573fd8564";s:8:"currency";s:42:"0x1eb48c61402502c655e6a59b30e9f1c93121f701";s:7:"address";s:42:"0xc72ad28e8fdeaa23e05da938b3309d85e3121745";s:8:"sort_key";i:7;s:6:"effect";s:1:"1";s:5:"extra";s:5:"13565";s:5:"block";i:1546385;s:4:"time";s:19:"2024-05-15 08:10:28";}i:8;a:8:{s:11:"transaction";s:66:"0x42e1c312f6369805c47b48309fa4447a0844ca4322373f1ea6946a4573fd8564";s:8:"currency";s:42:"0x1eb48c61402502c655e6a59b30e9f1c93121f701";s:7:"address";s:42:"0x0000000000000000000000000000000000000000";s:8:"sort_key";i:8;s:6:"effect";s:2:"-1";s:5:"extra";s:4:"4009";s:5:"block";i:1546385;s:4:"time";s:19:"2024-05-15 08:10:28";}i:9;a:8:{s:11:"transaction";s:66:"0x42e1c312f6369805c47b48309fa4447a0844ca4322373f1ea6946a4573fd8564";s:8:"currency";s:42:"0x1eb48c61402502c655e6a59b30e9f1c93121f701";s:7:"address";s:42:"0xc72ad28e8fdeaa23e05da938b3309d85e3121745";s:8:"sort_key";i:9;s:6:"effect";s:1:"1";s:5:"extra";s:4:"4009";s:5:"block";i:1546385;s:4:"time";s:19:"2024-05-15 08:10:28";}i:10;a:8:{s:11:"transaction";s:66:"0x42e1c312f6369805c47b48309fa4447a0844ca4322373f1ea6946a4573fd8564";s:8:"currency";s:42:"0x1eb48c61402502c655e6a59b30e9f1c93121f701";s:7:"address";s:42:"0x0000000000000000000000000000000000000000";s:8:"sort_key";i:10;s:6:"effect";s:2:"-1";s:5:"extra";s:5:"32069";s:5:"block";i:1546385;s:4:"time";s:19:"2024-05-15 08:10:28";}i:11;a:8:{s:11:"transaction";s:66:"0x42e1c312f6369805c47b48309fa4447a0844ca4322373f1ea6946a4573fd8564";s:8:"currency";s:42:"0x1eb48c61402502c655e6a59b30e9f1c93121f701";s:7:"address";s:42:"0xc72ad28e8fdeaa23e05da938b3309d85e3121745";s:8:"sort_key";i:11;s:6:"effect";s:1:"1";s:5:"extra";s:5:"32069";s:5:"block";i:1546385;s:4:"time";s:19:"2024-05-15 08:10:28";}i:12;a:8:{s:11:"transaction";s:66:"0x42e1c312f6369805c47b48309fa4447a0844ca4322373f1ea6946a4573fd8564";s:8:"currency";s:42:"0x1eb48c61402502c655e6a59b30e9f1c93121f701";s:7:"address";s:42:"0x0000000000000000000000000000000000000000";s:8:"sort_key";i:12;s:6:"effect";s:2:"-1";s:5:"extra";s:5:"32070";s:5:"block";i:1546385;s:4:"time";s:19:"2024-05-15 08:10:28";}i:13;a:8:{s:11:"transaction";s:66:"0x42e1c312f6369805c47b48309fa4447a0844ca4322373f1ea6946a4573fd8564";s:8:"currency";s:42:"0x1eb48c61402502c655e6a59b30e9f1c93121f701";s:7:"address";s:42:"0xc72ad28e8fdeaa23e05da938b3309d85e3121745";s:8:"sort_key";i:13;s:6:"effect";s:1:"1";s:5:"extra";s:5:"32070";s:5:"block";i:1546385;s:4:"time";s:19:"2024-05-15 08:10:28";}}s:10:"currencies";a:2:{i:0;a:3:{s:2:"id";s:42:"0xd32e14cc9aa5413622fd00b28e50adfbf25c7ef8";s:4:"name";s:21:"Merlin\'s Seal BRC-420";s:6:"symbol";s:9:"M-BRC-420";}i:1;a:3:{s:2:"id";s:42:"0x1eb48c61402502c655e6a59b30e9f1c93121f701";s:4:"name";s:2:"Ts";s:6:"symbol";s:22:"M-This song about NFTs";}}}'],
];
}
}
30 changes: 30 additions & 0 deletions Modules/MerlinMainModule.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php declare(strict_types = 1);

/* Idea (c) 2023 Nikita Zhavoronkov, [email protected]
* Copyright (c) 2023-2024 3xpl developers, [email protected], see CONTRIBUTORS.md
* Distributed under the MIT software license, see LICENSE.md */

/* This is the main Merlin module. It requires a geth node to run. */

final class MerlinMainModule extends EVMMainModule implements Module, BalanceSpecial, TransactionSpecials, AddressSpecials
{
function initialize()
{
// CoreModule
$this->blockchain = 'merlin';
$this->module = 'merlin-main';
$this->is_main = true;
$this->first_block_date = '2024-02-02';
$this->first_block_id = 0;
$this->currency = 'merlin-bitcoin';
$this->currency_details = ['name' => 'Bitcoin', 'symbol' => 'BTC', 'decimals' => 18, 'description' => null]; // https://docs.merlinchain.io/merlin-docs/developers/builder-guides/fees/gas#gas-token

// EVMMainModule
$this->evm_implementation = EVMImplementation::geth;
$this->extra_features = []; // https://docs.merlinchain.io/merlin-docs/developers/builder-guides/fees
$this->reward_function = function($block_id)
{
return '0';
};
}
}
26 changes: 26 additions & 0 deletions Modules/MerlinTraceModule.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php declare(strict_types = 1);

/* Idea (c) 2023 Nikita Zhavoronkov, [email protected]
* Copyright (c) 2023-2024 3xpl developers, [email protected], see CONTRIBUTORS.md
* Distributed under the MIT software license, see LICENSE.md */

/* This is the Merlin trace module. It requires a geth node to run. */
/* DISABLED */

final class MerlinTraceModule extends EVMTraceModule implements Module
{
function initialize()
{
// CoreModule
$this->blockchain = 'merlin';
$this->module = 'merlin-trace';
$this->complements = 'merlin-main';
$this->is_main = false;
$this->first_block_date = '2024-02-02';
$this->first_block_id = 0;

// EVMTraceModule
$this->evm_implementation = EVMImplementation::geth;
$this->extra_features = [EVMSpecialFeatures::zkEVM];
}
}