Skip to content
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
20 changes: 20 additions & 0 deletions Modules/BounceBitERC1155Module.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?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 module processes ERC-1155 token transfers in BounceBit. */

final class BounceBitERC1155Module extends EVMERC1155Module implements Module, MultipleBalanceSpecial
{
function initialize()
{
// CoreModule
$this->blockchain = 'bouncebit';
$this->module = 'bouncebit-erc-1155';
$this->is_main = false;
$this->first_block_date = '2024-04-08';
$this->first_block_id = 1;
}
}
24 changes: 24 additions & 0 deletions Modules/BounceBitERC20Module.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?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 module processes ERC-20 token transfers in BounceBit. */

final class BounceBitERC20Module extends EVMERC20Module implements Module, MultipleBalanceSpecial, SupplySpecial
{
function initialize()
{
// CoreModule
$this->blockchain = 'bouncebit';
$this->module = 'bouncebit-erc-20';
$this->is_main = false;
$this->first_block_date = '2024-04-08';
$this->first_block_id = 1;
$this->tests = [
['block' => 150387, '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:2372;s:4:"time";s:19:"2024-04-10 19:24:23";s:8:"sort_key";i:0;}i:1;a:8:{s:11:"transaction";N;s:7:"address";s:8:"treasury";s:6:"effect";s:1:"0";s:6:"failed";s:1:"f";s:5:"extra";s:1:"r";s:5:"block";i:2372;s:4:"time";s:19:"2024-04-10 19:24:23";s:8:"sort_key";i:1;}}s:10:"currencies";N;}'],
['block' => 2369594, 'result' => 'a:2:{s:6:"events";a:4:{i:0;a:7:{s:11:"transaction";s:66:"0x5bec430459b9f2ad54f60dd691aa6f562aa7483e6ea4759cd5829282e953b296";s:8:"currency";s:42:"0x7f150c293c97172c75983bd8ac084c187107ea19";s:7:"address";s:42:"0x0000000000000000000000000000000000000000";s:8:"sort_key";i:0;s:6:"effect";s:16:"-100000000000000";s:5:"block";i:2369594;s:4:"time";s:19:"2024-07-16 14:24:57";}i:1;a:7:{s:11:"transaction";s:66:"0x5bec430459b9f2ad54f60dd691aa6f562aa7483e6ea4759cd5829282e953b296";s:8:"currency";s:42:"0x7f150c293c97172c75983bd8ac084c187107ea19";s:7:"address";s:42:"0x8fbad0655df10e92cca0ecc48a902b170ac7b2b0";s:8:"sort_key";i:1;s:6:"effect";s:15:"100000000000000";s:5:"block";i:2369594;s:4:"time";s:19:"2024-07-16 14:24:57";}i:2;a:7:{s:11:"transaction";s:66:"0x5bec430459b9f2ad54f60dd691aa6f562aa7483e6ea4759cd5829282e953b296";s:8:"currency";s:42:"0xf5e11df1ebcf78b6b6d26e04ff19cd786a1e81dc";s:7:"address";s:42:"0x8fbad0655df10e92cca0ecc48a902b170ac7b2b0";s:8:"sort_key";i:2;s:6:"effect";s:16:"-100000000000000";s:5:"block";i:2369594;s:4:"time";s:19:"2024-07-16 14:24:57";}i:3;a:7:{s:11:"transaction";s:66:"0x5bec430459b9f2ad54f60dd691aa6f562aa7483e6ea4759cd5829282e953b296";s:8:"currency";s:42:"0xf5e11df1ebcf78b6b6d26e04ff19cd786a1e81dc";s:7:"address";s:42:"0x7f150c293c97172c75983bd8ac084c187107ea19";s:8:"sort_key";i:3;s:6:"effect";s:15:"100000000000000";s:5:"block";i:2369594;s:4:"time";s:19:"2024-07-16 14:24:57";}}s:10:"currencies";a:2:{i:0;a:4:{s:2:"id";s:42:"0x7f150c293c97172c75983bd8ac084c187107ea19";s:4:"name";s:18:"Liquid staked BBTC";s:6:"symbol";s:6:"stBBTC";s:8:"decimals";i:18;}i:1;a:4:{s:2:"id";s:42:"0xf5e11df1ebcf78b6b6d26e04ff19cd786a1e81dc";s:4:"name";s:13:"BounceBit BTC";s:6:"symbol";s:4:"BBTC";s:8:"decimals";i:18;}}}'],
];
}
}
20 changes: 20 additions & 0 deletions Modules/BounceBitERC721Module.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?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 module processes ERC-721 NFT transfers in BounceBit. */

final class BounceBitERC721Module extends EVMERC721Module implements Module, MultipleBalanceSpecial
{
function initialize()
{
// CoreModule
$this->blockchain = 'bouncebit';
$this->module = 'bouncebit-erc-721';
$this->is_main = false;
$this->first_block_date = '2024-04-08';
$this->first_block_id = 1;
}
}
38 changes: 38 additions & 0 deletions Modules/BounceBitMainModule.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?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 BounceBit module. */

final class BounceBitMainModule extends EVMMainModule implements Module, BalanceSpecial, TransactionSpecials, AddressSpecials
{
function initialize()
{
// CoreModule
$this->blockchain = 'bouncebit';
$this->module = 'bouncebit-main';
$this->is_main = true;
$this->first_block_date = '2024-04-08';
$this->first_block_id = 1;
$this->currency = 'bouncebit';
$this->currency_details = ['name' => 'BounceBit', 'symbol' => 'BB', 'decimals' => 18, 'description' => null];

// EVMMainModule
$this->evm_implementation = EVMImplementation::geth;
$this->extra_features = [EVMSpecialFeatures::FeesToTreasury];
$this->reward_function = function($block_id)
{
return '0';
};

// Handles
$this->handles_implemented = false;
$this->tests = [
['block' => 1, '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:1;s:4:"time";s:19:"2024-04-08 06:43:00";s:8:"sort_key";i:0;}i:1;a:8:{s:11:"transaction";N;s:7:"address";s:8:"treasury";s:6:"effect";s:1:"0";s:6:"failed";s:1:"f";s:5:"extra";s:1:"r";s:5:"block";i:1;s:4:"time";s:19:"2024-04-08 06:43:00";s:8:"sort_key";i:1;}}s:10:"currencies";N;}'],
['block' => 2372, '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:2372;s:4:"time";s:19:"2024-04-10 19:24:23";s:8:"sort_key";i:0;}i:1;a:8:{s:11:"transaction";N;s:7:"address";s:8:"treasury";s:6:"effect";s:1:"0";s:6:"failed";s:1:"f";s:5:"extra";s:1:"r";s:5:"block";i:2372;s:4:"time";s:19:"2024-04-10 19:24:23";s:8:"sort_key";i:1;}}s:10:"currencies";N;}'],
['block' => 2372111, 'result' => 'a:2:{s:6:"events";a:8:{i:0;a:8:{s:11:"transaction";s:66:"0x5c9d15c0918dfd621b4e0e54a70d84c4d1ecacf36cde6190353defe861c24dde";s:7:"address";s:42:"0x503c2a26bf64294d7955c929127a29847f7db57a";s:6:"effect";s:16:"-246680000000000";s:6:"failed";s:1:"f";s:5:"extra";s:1:"b";s:5:"block";i:2372111;s:4:"time";s:19:"2024-07-16 16:56:29";s:8:"sort_key";i:0;}i:1;a:8:{s:11:"transaction";s:66:"0x5c9d15c0918dfd621b4e0e54a70d84c4d1ecacf36cde6190353defe861c24dde";s:7:"address";s:4:"0x00";s:6:"effect";s:15:"246680000000000";s:6:"failed";s:1:"f";s:5:"extra";s:1:"b";s:5:"block";i:2372111;s:4:"time";s:19:"2024-07-16 16:56:29";s:8:"sort_key";i:1;}i:2;a:8:{s:11:"transaction";s:66:"0x5c9d15c0918dfd621b4e0e54a70d84c4d1ecacf36cde6190353defe861c24dde";s:7:"address";s:42:"0x503c2a26bf64294d7955c929127a29847f7db57a";s:6:"effect";s:15:"-30835000000000";s:6:"failed";s:1:"f";s:5:"extra";s:1:"f";s:5:"block";i:2372111;s:4:"time";s:19:"2024-07-16 16:56:29";s:8:"sort_key";i:2;}i:3;a:8:{s:11:"transaction";s:66:"0x5c9d15c0918dfd621b4e0e54a70d84c4d1ecacf36cde6190353defe861c24dde";s:7:"address";s:8:"treasury";s:6:"effect";s:14:"30835000000000";s:6:"failed";s:1:"f";s:5:"extra";s:1:"f";s:5:"block";i:2372111;s:4:"time";s:19:"2024-07-16 16:56:29";s:8:"sort_key";i:3;}i:4;a:8:{s:11:"transaction";s:66:"0x5c9d15c0918dfd621b4e0e54a70d84c4d1ecacf36cde6190353defe861c24dde";s:7:"address";s:42:"0x503c2a26bf64294d7955c929127a29847f7db57a";s:6:"effect";s:2:"-0";s:6:"failed";s:1:"f";s:5:"extra";N;s:5:"block";i:2372111;s:4:"time";s:19:"2024-07-16 16:56:29";s:8:"sort_key";i:4;}i:5;a:8:{s:11:"transaction";s:66:"0x5c9d15c0918dfd621b4e0e54a70d84c4d1ecacf36cde6190353defe861c24dde";s:7:"address";s:42:"0xc226ff4526afee15d32665f3ef3b291ac1e0c731";s:6:"effect";s:1:"0";s:6:"failed";s:1:"f";s:5:"extra";N;s:5:"block";i:2372111;s:4:"time";s:19:"2024-07-16 16:56:29";s:8:"sort_key";i:5;}i:6;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:2372111;s:4:"time";s:19:"2024-07-16 16:56:29";s:8:"sort_key";i:6;}i:7;a:8:{s:11:"transaction";N;s:7:"address";s:8:"treasury";s:6:"effect";s:1:"0";s:6:"failed";s:1:"f";s:5:"extra";s:1:"r";s:5:"block";i:2372111;s:4:"time";s:19:"2024-07-16 16:56:29";s:8:"sort_key";i:7;}}s:10:"currencies";N;}'],
];
}
}
27 changes: 27 additions & 0 deletions Modules/BounceBitTraceModule.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php declare(strict_types = 1);

/* Idea (c) 2023 Nikita Zhavoronkov, nikzh@nikzh.com
* Copyright (c) 2023 3xpl developers, 3@3xpl.com, see CONTRIBUTORS.md
* Distributed under the MIT software license, see LICENSE.md */

/* This module processes internal BounceBit transactions (using block tracing). It requires an archival node to run. */

final class BounceBitTraceModule extends EVMTraceModule implements Module
{
function initialize()
{
// CoreModule
$this->blockchain = 'bouncebit';
$this->module = 'bouncebit-trace';
$this->complements = 'bouncebit-main';
$this->is_main = false;
$this->first_block_date = '2024-04-08';
$this->first_block_id = 1;

// EVMTraceModule
$this->evm_implementation = EVMImplementation::geth;
$this->tests = [
['block' =>2374738, 'result' => 'a:2:{s:6:"events";a:2:{i:0;a:7:{s:11:"transaction";s:66:"0x4254a319a69c866eb701c01086ae23355eaa6a0c2510516f2c6bf46f98e205c9";s:7:"address";s:42:"0x3be72fcc9eaba1283744909b7b8260a4bc8ec956";s:8:"sort_key";i:0;s:6:"effect";s:21:"-83893757661856936691";s:5:"extra";N;s:5:"block";i:2374738;s:4:"time";s:19:"2024-07-16 19:32:06";}i:1;a:7:{s:11:"transaction";s:66:"0x4254a319a69c866eb701c01086ae23355eaa6a0c2510516f2c6bf46f98e205c9";s:7:"address";s:42:"0xd2f2e0cb8aa04235c868acbc9ac9782af0d21595";s:8:"sort_key";i:1;s:6:"effect";s:20:"83893757661856936691";s:5:"extra";N;s:5:"block";i:2374738;s:4:"time";s:19:"2024-07-16 19:32:06";}}s:10:"currencies";N;}'],
];
}
}
3 changes: 3 additions & 0 deletions Modules/Common/EVMMainModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ final public function pre_process_block($block_id)

// Data processing

if (in_array(EVMSpecialFeatures::FeesToTreasury, $this->extra_features))
$miner = 'treasury';

$this->block_time = date('Y-m-d H:i:s', to_int64_from_0xhex($block_time));

if (($ic = count($general_data)) !== count($receipt_data))
Expand Down
1 change: 1 addition & 0 deletions Modules/Common/EVMTraits.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ enum EVMSpecialFeatures
case rskEVM; // Rootstock has different traces and deferred validators rewards (in N+4000 block).
case TraceBlockSupport; // Support for `trace_block` in RPC API
case EIP4844; // Support of blob transaction
case FeesToTreasury; // when the fee is not directly added to the block author balance
}

trait EVMTraits
Expand Down