├── .gitignore ├── .gitmodules ├── .travis.yml ├── CMakeLists.txt ├── Dockerfile ├── Doxyfile ├── LICENSE.md ├── README.md ├── documentation ├── api_notes.md ├── building.md ├── debug_node_plugin.md ├── doxygen │ ├── DoxygenLayout.xml │ ├── customdoxygen.css │ ├── footer.html │ ├── header.html │ └── images │ │ └── golos.svg ├── git_guildelines.md ├── plugin.md └── testing.md ├── libraries ├── CMakeLists.txt ├── api │ ├── CMakeLists.txt │ ├── account_api_object.cpp │ ├── block_objects.cpp │ ├── chain_api_properties.cpp │ ├── content_utils.cpp │ ├── discussion_helper.cpp │ ├── dynamic_global_property_api_object.cpp │ ├── include │ │ └── golos │ │ │ └── api │ │ │ ├── account_api_object.hpp │ │ │ ├── account_vote.hpp │ │ │ ├── asset_api_object.hpp │ │ │ ├── block_objects.hpp │ │ │ ├── callback_info.hpp │ │ │ ├── chain_api_properties.hpp │ │ │ ├── comment_api_object.hpp │ │ │ ├── content_utils.hpp │ │ │ ├── discussion.hpp │ │ │ ├── discussion_helper.hpp │ │ │ ├── dynamic_global_property_api_object.hpp │ │ │ ├── operation_history_extender.hpp │ │ │ ├── reblog_entry.hpp │ │ │ ├── vote_state.hpp │ │ │ └── witness_api_object.hpp │ └── witness_api_object.cpp ├── chain │ ├── CMakeLists.txt │ ├── block_log.cpp │ ├── chain_properties_evaluators.cpp │ ├── comment_app_helper.cpp │ ├── curation_info.cpp │ ├── database.cpp │ ├── database_comment_bill.cpp │ ├── database_market_events.cpp │ ├── database_nft_objects.cpp │ ├── database_paid_subscription_objects.cpp │ ├── database_proposal_object.cpp │ ├── database_worker_objects.cpp │ ├── evaluator.cpp │ ├── fork_database.cpp │ ├── freezing_utils.cpp │ ├── hardfork.d │ │ ├── 0-preamble.hf │ │ ├── 0_1.hf │ │ ├── 0_10.hf │ │ ├── 0_11.hf │ │ ├── 0_12.hf │ │ ├── 0_13.hf │ │ ├── 0_14.hf │ │ ├── 0_15.hf │ │ ├── 0_16.hf │ │ ├── 0_17.hf │ │ ├── 0_18.hf │ │ ├── 0_19.hf │ │ ├── 0_2.hf │ │ ├── 0_20.hf │ │ ├── 0_21.hf │ │ ├── 0_22.hf │ │ ├── 0_23.hf │ │ ├── 0_24.hf │ │ ├── 0_25.hf │ │ ├── 0_26.hf │ │ ├── 0_27.hf │ │ ├── 0_28.hf │ │ ├── 0_29.hf │ │ ├── 0_3.hf │ │ ├── 0_30.hf │ │ ├── 0_4.hf │ │ ├── 0_5.hf │ │ ├── 0_6.hf │ │ ├── 0_7.hf │ │ ├── 0_8.hf │ │ └── 0_9.hf │ ├── hf_actions.cpp │ ├── include │ │ └── golos │ │ │ └── chain │ │ │ ├── account_object.hpp │ │ │ ├── block_log.hpp │ │ │ ├── block_summary_object.hpp │ │ │ ├── comment_app_helper.hpp │ │ │ ├── comment_bill.hpp │ │ │ ├── comment_object.hpp │ │ │ ├── compound.hpp │ │ │ ├── curation_info.hpp │ │ │ ├── custom_operation_interpreter.hpp │ │ │ ├── database.hpp │ │ │ ├── database_exceptions.hpp │ │ │ ├── db_with.hpp │ │ │ ├── evaluator.hpp │ │ │ ├── evaluator_registry.hpp │ │ │ ├── event_objects.hpp │ │ │ ├── fork_database.hpp │ │ │ ├── freezing_utils.hpp │ │ │ ├── generic_custom_operation_interpreter.hpp │ │ │ ├── global_property_object.hpp │ │ │ ├── hf_actions.hpp │ │ │ ├── immutable_chain_parameters.hpp │ │ │ ├── index.hpp │ │ │ ├── nft_objects.hpp │ │ │ ├── node_property_object.hpp │ │ │ ├── operation_history_extender.hpp │ │ │ ├── operation_notification.hpp │ │ │ ├── paid_subscription_objects.hpp │ │ │ ├── proposal_object.hpp │ │ │ ├── reputation_manager.hpp │ │ │ ├── shared_authority.hpp │ │ │ ├── shared_db_merkle.hpp │ │ │ ├── snapshot_state.hpp │ │ │ ├── steem_evaluator.hpp │ │ │ ├── steem_object_types.hpp │ │ │ ├── steem_objects.hpp │ │ │ ├── transaction_object.hpp │ │ │ ├── witness_objects.hpp │ │ │ └── worker_objects.hpp │ ├── nft_evaluators.cpp │ ├── paid_subscription_evaluators.cpp │ ├── proposal_evaluator.cpp │ ├── proposal_object.cpp │ ├── shared_authority.cpp │ ├── steem_evaluator.cpp │ ├── steem_objects.cpp │ ├── transaction_object.cpp │ └── worker_evaluators.cpp ├── network │ ├── CMakeLists.txt │ ├── core_messages.cpp │ ├── include │ │ └── golos │ │ │ └── network │ │ │ ├── config.hpp │ │ │ ├── core_messages.hpp │ │ │ ├── exceptions.hpp │ │ │ ├── message.hpp │ │ │ ├── message_oriented_connection.hpp │ │ │ ├── node.hpp │ │ │ ├── peer_connection.hpp │ │ │ ├── peer_database.hpp │ │ │ └── stcp_socket.hpp │ ├── message_oriented_connection.cpp │ ├── node.cpp │ ├── peer_connection.cpp │ ├── peer_database.cpp │ └── stcp_socket.cpp ├── protocol │ ├── CMakeLists.txt │ ├── asset.cpp │ ├── authority.cpp │ ├── block.cpp │ ├── byteswap.hpp │ ├── donate_targets.cpp │ ├── get_config.cpp │ ├── include │ │ └── golos │ │ │ └── protocol │ │ │ ├── README.md │ │ │ ├── asset.hpp │ │ │ ├── authority.hpp │ │ │ ├── base.hpp │ │ │ ├── block.hpp │ │ │ ├── block_header.hpp │ │ │ ├── config.hpp │ │ │ ├── config_old.hpp │ │ │ ├── donate_targets.hpp │ │ │ ├── exceptions.hpp │ │ │ ├── get_config.hpp │ │ │ ├── market_events.hpp │ │ │ ├── nft_operations.hpp │ │ │ ├── operation_util.hpp │ │ │ ├── operation_util_impl.hpp │ │ │ ├── operations.hpp │ │ │ ├── paid_subscription_operations.hpp │ │ │ ├── proposal_operations.hpp │ │ │ ├── protocol.hpp │ │ │ ├── reward_curve.hpp │ │ │ ├── sign_state.hpp │ │ │ ├── steem_operations.hpp │ │ │ ├── steem_virtual_operations.hpp │ │ │ ├── transaction.hpp │ │ │ ├── types.hpp │ │ │ ├── uint128lh_t.hpp │ │ │ ├── validate_helper.hpp │ │ │ ├── version.hpp │ │ │ ├── worker_exceptions.hpp │ │ │ └── worker_operations.hpp │ ├── nft_operations.cpp │ ├── operation_util_impl.cpp │ ├── operations.cpp │ ├── paid_subscription_operations.cpp │ ├── proposal_operations.cpp │ ├── sign_state.cpp │ ├── steem_operations.cpp │ ├── transaction.cpp │ ├── types.cpp │ ├── version.cpp │ └── worker_operations.cpp ├── time │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── time │ │ │ └── time.hpp │ └── time.cpp ├── utilities │ ├── CMakeLists.txt │ ├── git_revision.cpp.in │ ├── include │ │ └── graphene │ │ │ └── utilities │ │ │ ├── git_revision.hpp │ │ │ ├── key_conversion.hpp │ │ │ ├── padding_ostream.hpp │ │ │ ├── string_escape.hpp │ │ │ ├── tempdir.hpp │ │ │ └── words.hpp │ ├── key_conversion.cpp │ ├── string_escape.cpp │ ├── tempdir.cpp │ └── words.cpp └── wallet │ ├── CMakeLists.txt │ ├── Doxyfile.in │ ├── api_documentation_standin.cpp │ ├── generate_api_documentation.pl │ ├── include │ └── golos │ │ └── wallet │ │ ├── api_documentation.hpp │ │ ├── reflect_util.hpp │ │ ├── remote_node_api.hpp │ │ ├── time_converter.hpp │ │ └── wallet.hpp │ └── wallet.cpp ├── plugins ├── CMakeLists.txt ├── account_by_key │ ├── CMakeLists.txt │ ├── account_by_key_plugin.cpp │ └── include │ │ └── golos │ │ └── plugins │ │ └── account_by_key │ │ ├── account_by_key_objects.hpp │ │ └── account_by_key_plugin.hpp ├── account_history │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── account_history │ │ │ ├── history_object.hpp │ │ │ └── plugin.hpp │ └── plugin.cpp ├── account_notes │ ├── CMakeLists.txt │ ├── account_notes_evaluators.cpp │ ├── account_notes_operations.cpp │ ├── account_notes_plugin.cpp │ └── include │ │ └── golos │ │ └── plugins │ │ └── account_notes │ │ ├── account_notes_api_objects.hpp │ │ ├── account_notes_evaluators.hpp │ │ ├── account_notes_objects.hpp │ │ ├── account_notes_operations.hpp │ │ └── account_notes_plugin.hpp ├── account_relations │ ├── CMakeLists.txt │ ├── account_relations.cpp │ └── include │ │ └── golos │ │ └── plugins │ │ └── account_relations │ │ ├── account_relation_api_object.hpp │ │ └── account_relations.hpp ├── auth_util │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── auth_util │ │ │ └── plugin.hpp │ └── plugin.cpp ├── block_info │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── block_info │ │ │ ├── block_info.hpp │ │ │ └── plugin.hpp │ └── plugin.cpp ├── chain │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── chain │ │ │ └── plugin.hpp │ ├── plugin.cpp │ ├── serialize_state.cpp │ └── serialize_state.hpp ├── cryptor │ ├── CMakeLists.txt │ ├── cryptor.cpp │ └── include │ │ └── golos │ │ └── plugins │ │ └── cryptor │ │ ├── cryptor.hpp │ │ ├── cryptor_api_objects.hpp │ │ └── cryptor_queries.hpp ├── database_api │ ├── CMakeLists.txt │ ├── account_recovery_api_object.cpp │ ├── api.cpp │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── database_api │ │ │ ├── api_objects │ │ │ ├── account_balance_api_object.hpp │ │ │ ├── account_query.hpp │ │ │ ├── account_recovery_api_object.hpp │ │ │ ├── account_recovery_request_api_object.hpp │ │ │ ├── asset_api_sort.hpp │ │ │ ├── owner_authority_history_api_object.hpp │ │ │ ├── proposal_api_object.hpp │ │ │ └── savings_withdraw_api_object.hpp │ │ │ ├── forward.hpp │ │ │ ├── plugin.hpp │ │ │ └── state.hpp │ └── proposal_api_object.cpp ├── debug_node │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── debug_node │ │ │ └── plugin.hpp │ └── plugin.cpp ├── elastic_search │ ├── CMakeLists.txt │ ├── elastic_search_plugin.cpp │ └── include │ │ └── golos │ │ └── plugins │ │ └── elastic_search │ │ ├── elastic_search_plugin.hpp │ │ └── elastic_search_state.hpp ├── event_plugin │ ├── CMakeLists.txt │ ├── event_plugin.cpp │ └── include │ │ └── golos │ │ └── plugins │ │ └── event_plugin │ │ ├── event_api_objects.hpp │ │ └── event_plugin.hpp ├── exchange │ ├── CMakeLists.txt │ ├── exchange.cpp │ └── include │ │ └── golos │ │ └── plugins │ │ └── exchange │ │ ├── exchange.hpp │ │ ├── exchange_queries.hpp │ │ └── exchange_types.hpp ├── follow │ ├── CMakeLists.txt │ ├── follow_evaluators.cpp │ ├── follow_operations.cpp │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── follow │ │ │ ├── follow_api_object.hpp │ │ │ ├── follow_evaluators.hpp │ │ │ ├── follow_forward.hpp │ │ │ ├── follow_objects.hpp │ │ │ ├── follow_operations.hpp │ │ │ └── plugin.hpp │ └── plugin.cpp ├── json_rpc │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── json_rpc │ │ │ ├── api_helper.hpp │ │ │ ├── plugin.hpp │ │ │ └── utility.hpp │ └── plugin.cpp ├── market_history │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── market_history │ │ │ ├── market_history_callbacks.hpp │ │ │ ├── market_history_objects.hpp │ │ │ ├── market_history_plugin.hpp │ │ │ └── market_history_visitor.hpp │ ├── market_history_plugin.cpp │ └── market_history_visitor.cpp ├── mongo_db │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── mongo_db │ │ │ ├── mongo_db_operations.hpp │ │ │ ├── mongo_db_plugin.hpp │ │ │ ├── mongo_db_state.hpp │ │ │ ├── mongo_db_types.hpp │ │ │ └── mongo_db_writer.hpp │ ├── mongo_db_operations.cpp │ ├── mongo_db_plugin.cpp │ ├── mongo_db_state.cpp │ ├── mongo_db_types.cpp │ └── mongo_db_writer.cpp ├── network_broadcast_api │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── network_broadcast_api │ │ │ └── network_broadcast_api_plugin.hpp │ └── network_broadcast_api.cpp ├── nft_api │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── nft_api │ │ │ ├── nft_api.hpp │ │ │ ├── nft_api_objects.hpp │ │ │ └── nft_api_queries.hpp │ └── nft_api.cpp ├── operation_dump │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── operation_dump │ │ │ ├── operation_dump_container.hpp │ │ │ ├── operation_dump_plugin.hpp │ │ │ └── operation_dump_visitor.hpp │ └── operation_dump_plugin.cpp ├── operation_history │ ├── CMakeLists.txt │ ├── applied_operation.cpp │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── operation_history │ │ │ ├── applied_operation.hpp │ │ │ ├── history_object.hpp │ │ │ ├── history_queries.hpp │ │ │ └── plugin.hpp │ └── plugin.cpp ├── p2p │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── p2p │ │ │ └── p2p_plugin.hpp │ └── p2p_plugin.cpp ├── paid_subscription_api │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── paid_subscription_api │ │ │ ├── paid_subscription_api.hpp │ │ │ ├── paid_subscription_api_objects.hpp │ │ │ └── paid_subscription_api_queries.hpp │ └── paid_subscription_api.cpp ├── private_message │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── private_message │ │ │ ├── private_message_api_objects.hpp │ │ │ ├── private_message_evaluators.hpp │ │ │ ├── private_message_exceptions.hpp │ │ │ ├── private_message_objects.hpp │ │ │ ├── private_message_operations.hpp │ │ │ ├── private_message_plugin.hpp │ │ │ └── private_message_queries.hpp │ ├── private_message_evaluators.cpp │ ├── private_message_objects.cpp │ ├── private_message_operations.cpp │ └── private_message_plugin.cpp ├── raw_block │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── raw_block │ │ │ └── plugin.hpp │ └── plugin.cpp ├── social_network │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── social_network │ │ │ ├── social_network.hpp │ │ │ ├── social_network_queries.hpp │ │ │ └── social_network_types.hpp │ └── social_network.cpp ├── statsd │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── statsd │ │ │ ├── plugin.hpp │ │ │ ├── runtime_bucket_object.hpp │ │ │ └── statistics_sender.hpp │ ├── plugin.cpp │ └── statistics_sender.cpp ├── tags │ ├── CMakeLists.txt │ ├── discussion_query.cpp │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── tags │ │ │ ├── discussion_query.hpp │ │ │ ├── plugin.hpp │ │ │ ├── tag_api_object.hpp │ │ │ ├── tag_visitor.hpp │ │ │ ├── tags_object.hpp │ │ │ └── tags_sort.hpp │ ├── plugin.cpp │ └── tag_visitor.cpp ├── test_api │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── test_api │ │ │ └── test_api_plugin.hpp │ └── test_api_plugin.cpp ├── webserver │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── webserver │ │ │ └── webserver_plugin.hpp │ └── webserver_plugin.cpp ├── witness │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── witness │ │ │ └── witness.hpp │ └── witness.cpp ├── witness_api │ ├── CMakeLists.txt │ ├── include │ │ └── golos │ │ │ └── plugins │ │ │ └── witness_api │ │ │ ├── api_objects │ │ │ ├── feed_history_api_object.hpp │ │ │ └── witness_vote_api_object.hpp │ │ │ └── plugin.hpp │ └── plugin.cpp └── worker_api │ ├── CMakeLists.txt │ ├── include │ └── golos │ │ └── plugins │ │ └── worker_api │ │ ├── worker_api_objects.hpp │ │ ├── worker_api_plugin.hpp │ │ ├── worker_api_queries.hpp │ │ └── worker_api_sorts.hpp │ ├── worker_api_plugin.cpp │ └── worker_api_queries.cpp ├── programs ├── CMakeLists.txt ├── build_helpers │ ├── CMakeLists.txt │ ├── cat-parts.cpp │ ├── cat_parts.py │ ├── check_reflect.py │ └── configure_build.py ├── cli_wallet │ ├── CMakeLists.txt │ └── main.cpp ├── golosd │ ├── CMakeLists.txt │ └── main.cpp ├── historian │ ├── CMakeLists.txt │ ├── main.cpp │ ├── program_options.hpp │ ├── progress_bar.hpp │ └── special_operation_visitor.hpp ├── js_operation_serializer │ ├── CMakeLists.txt │ └── main.cpp ├── meter │ ├── CMakeLists.txt │ ├── main.cpp │ └── plugins.hpp ├── size_checker │ ├── CMakeLists.txt │ └── main.cpp └── util │ ├── CMakeLists.txt │ ├── get_dev_key.cpp │ ├── inflation_model.cpp │ ├── inflation_plot.py │ ├── newplugin.py │ ├── pretty_schema.py │ ├── saltpass.py │ ├── schema_test.cpp │ ├── sign_digest.cpp │ ├── sign_transaction.cpp │ ├── test_block_log.cpp │ └── test_shared_mem.cpp ├── share └── golosd │ ├── config │ ├── config.ini │ ├── config_debug.ini │ ├── config_elastic.ini │ ├── config_exchange.ini │ ├── config_mongo.ini │ └── config_witness.ini │ ├── docker │ ├── Dockerfile-livetest │ ├── Dockerfile-mongo │ ├── Dockerfile-test │ ├── Dockerfile-testnet │ └── Dockerfile-testnet-mongo │ ├── golosd.sh │ ├── golosd_debug.sh │ ├── golosdctl │ ├── seednodes │ ├── seednodes_empty │ └── snapshot5392323.json ├── tests ├── CMakeLists.txt ├── README.md ├── common │ ├── builder.cpp │ ├── builder.hpp │ ├── comment_reward.hpp │ ├── cryptor_fixture.hpp │ ├── database_fixture.cpp │ ├── database_fixture.hpp │ ├── gbg_helper.hpp │ ├── helpers.hpp │ ├── worker_api_fixture.hpp │ └── worker_fixture.hpp ├── generate_empty_blocks │ └── CMakeLists.txt ├── plugin_tests │ ├── account_history.cpp │ ├── account_notes.cpp │ ├── chain.cpp │ ├── cryptor.cpp │ ├── event_plugin.cpp │ ├── follow.cpp │ ├── json_rpc.cpp │ ├── main.cpp │ ├── market_history.cpp │ ├── operation_history.cpp │ ├── plugin_ops.cpp │ ├── private_message.cpp │ ├── worker_api_payment.cpp │ └── worker_api_request.cpp └── tests │ ├── auction_window_tests.cpp │ ├── basic_tests.cpp │ ├── block_tests.cpp │ ├── hf17_tests.cpp │ ├── hf22_tests.cpp │ ├── hf26_tests.cpp │ ├── hf27_tests.cpp │ ├── hf29_tests.cpp │ ├── hf30_tests.cpp │ ├── live_tests.cpp │ ├── main.cpp │ ├── operation_tests.cpp │ ├── operation_time_tests.cpp │ ├── proposal_tests.cpp │ ├── serialization_tests.cpp │ ├── transit_tests.cpp │ ├── worker_payment_tests.cpp │ └── worker_request_tests.cpp └── thirdparty ├── CMakeLists.txt └── indicators ├── CMakeLists.txt ├── LICENSE ├── LICENSE.termcolor └── include └── indicators ├── block_progress_bar.hpp ├── color.hpp ├── cursor_control.hpp ├── cursor_movement.hpp ├── details └── stream_helper.hpp ├── display_width.hpp ├── dynamic_progress.hpp ├── font_style.hpp ├── indeterminate_progress_bar.hpp ├── multi_progress.hpp ├── progress_bar.hpp ├── progress_spinner.hpp ├── progress_type.hpp ├── setting.hpp ├── termcolor.hpp └── terminal_size.hpp /.gitignore: -------------------------------------------------------------------------------- 1 | *.a 2 | *.so 3 | *.dylib 4 | *.sw* 5 | 6 | *.cmake 7 | CMakeCache.txt 8 | CMakeFiles 9 | Makefile 10 | compile_commands.json 11 | moc_* 12 | *.moc 13 | hardfork.hpp 14 | 15 | lcov 16 | 17 | libraries/utilities/git_revision.cpp 18 | 19 | libraries/wallet/Doxyfile 20 | libraries/wallet/api_documentation.cpp 21 | libraries/wallet/doxygen 22 | 23 | programs/cli_wallet/cli_wallet 24 | programs/js_operation_serializer/js_operation_serializer 25 | programs/golosd/golosd 26 | programs/golosd/test 27 | programs/delayed_node 28 | programs/build_helpers/cat-parts 29 | programs/size_checker/size_checker 30 | programs/util/get_dev_key 31 | programs/util/inflation_model 32 | 33 | tests/app_test 34 | tests/chain_bench 35 | tests/chain_test 36 | tests/plugin_test 37 | tests/intense_test 38 | tests/performance_test 39 | 40 | wallet.json 41 | witness_node_data_dir 42 | 43 | *.wallet 44 | 45 | documentation/doxygen/html 46 | documentation/doxygen/xml 47 | documentation/doxygen/latex 48 | 49 | *.pyc 50 | *.pyo 51 | *.egg-info/ 52 | .vscode/settings.json 53 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "thirdparty/chainbase"] 2 | path = thirdparty/chainbase 3 | url = https://github.com/golos-blockchain/chainbase.git 4 | [submodule "thirdparty/appbase"] 5 | path = thirdparty/appbase 6 | url = https://github.com/golos-blockchain/appbase.git 7 | [submodule "thirdparty/fc"] 8 | path = thirdparty/fc 9 | url = https://github.com/golos-blockchain/chain-fc 10 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | os: linux 2 | 3 | language: cpp 4 | 5 | services: 6 | - docker 7 | 8 | before_install: 9 | - echo "$TRAVIS_BRANCH" 10 | 11 | env: 12 | - DOCKERFILE=share/golosd/docker/Dockerfile-test DOCKERNAME="-test" 13 | #- DOCKERFILE=share/golosd/docker/Dockerfile-livetest DOCKERNAME="-livetest" 14 | #- DOCKERFILE=Dockerfile DOCKERNAME="" 15 | 16 | jobs: 17 | fast_finish: true 18 | 19 | script: 20 | - if [ "$TRAVIS_BRANCH" == "master" ]; then 21 | export DOCKERNAME="latest""$DOCKERNAME"; 22 | elif [ "$TRAVIS_BRANCH" == "livetest" ]; then 23 | export DOCKERNAME="livetest""$DOCKERNAME"; 24 | else 25 | export DOCKERNAME="$TRAVIS_BRANCH""$DOCKERNAME"; 26 | fi 27 | - echo "$DOCKERFILE" 28 | - echo "$DOCKERNAME" 29 | - if [ -n "$DOCKERNAME" ]; then 30 | docker build -t golos-blockchain/golos:"$DOCKERNAME" -f "$DOCKERFILE" .; 31 | fi 32 | 33 | after_success: 34 | # - echo "$EXPORTNAME" 35 | # - docker images 36 | # - if [ -n "$EXPORTNAME" ]; then 37 | # docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"; 38 | # docker push golos-blockchain/golos:"$EXPORTNAME"; 39 | # fi 40 | # - if [ "$TRAVIS_BRANCH" == "master" -a "$EXPORTNAME" == "latest" ]; then 41 | # bash deploy/deploy.sh; 42 | # fi -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018 Golos Core, and contributors. 2 | 3 | The following license applies to code contained within this repository that 4 | is created by Golos Core. Other copyright holders have licensed dependencies 5 | such as Graphene, FC, and Boost under their own individual licenses. 6 | 7 | The MIT License 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Welcome to the repository GOLOS blockchain 2 | 3 | - Free transactions 4 | - Fast block confirmations (3 seconds) 5 | - Hierarchical role based permissions (keys) 6 | - Delegated Proof-of-Stake Consensus (DPOS) 7 | - Good choice for placing your own dApps 8 | 9 | ## Documentation 10 | 11 | Instructions for launching a [delegate node](https://wiki.golos.id/witnesses/node/guide), a public [API node](https://wiki.golos.id/witnesses/node/guide-api), and launching a blockchain [node for exchanges](https://wiki.golos.id/witnesses/node/guide-exchange) are available in the community Wiki. 12 | 13 | ## Quickstart 14 | 15 | Just want to get up and running quickly? Try deploying a prebuilt dockerized container, image is available at docker hub - https://hub.docker.com/r/golosblockchain/golos/tags 16 | 17 | Docker image tags: 18 | 19 | - **latest** - built from master branch, used to run mainnet Golos 20 | - **testnet** - built from master branch, could be used to run test network 21 | 22 | ``` 23 | sudo docker run -d \ 24 | -p 4243:4243 \ 25 | -p 8090:8090 \ 26 | -p 8091:8091 \ 27 | -v /etc/golosd:/etc/golosd \ 28 | -v /var/lib/golosd:/var/lib/golosd \ 29 | --name golosd golosblockchain/golos:latest 30 | 31 | sudo docker logs -f golosd 32 | ``` 33 | 34 | To attach to the golosd you should use the cli_wallet: 35 | ``` 36 | sudo docker exec -ti golosd \ 37 | /usr/local/bin/cli_wallet \ 38 | --server-rpc-endpoint="ws://127.0.0.1:8091" 39 | ``` 40 | 41 | ## Seed Nodes 42 | 43 | A list of some seed nodes to get you started can be found in 44 | [share/golosd/seednodes](share/golosd/seednodes). This same file is baked into the docker images. 45 | -------------------------------------------------------------------------------- /documentation/doxygen/footer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | 16 | 17 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /documentation/plugin.md: -------------------------------------------------------------------------------- 1 | 2 | How plugins work 3 | ---------------- 4 | 5 | All plugins in the `libraries/plugins` directory are iterated over by `CMakeLists.txt` and placed in a CMake environment variable `STEEMIT_INTERNAL_PLUGINS`, which is used to create a runtime-accessible list of available plugins used by the argument parsing. 6 | 7 | Similarly, `external_plugins` is set aside for third-party plugins. Just drop plugin code into `external_plugins` directory, `make steemd`, and the new plugin will be available. 8 | 9 | There is a plugin in `example_plugins` called `hello_api` which is a working example of adding a custom API call. 10 | 11 | Registering plugins 12 | ------------------- 13 | 14 | - Plugins are enabled with the `enable-plugin` config file option. 15 | - When specifying plugins, you should specify `witness` and `account_history` in addition to the new plugins. 16 | - Some plugins may keep records in the database (currently only `account_history` does). If you change whether such a plugin is disabled/enabled, you should also replay the chain. Detecting this situation and automatically replaying when needed will be implemented in a future release. 17 | - If you want to make API's available publicly, you must use the `public-api` option. 18 | - When specifying public API's, you should specify `database_api` and `login_api` in addition to the new plugins. 19 | - The `api-user` option allows for password protected access to an API. 20 | 21 | Autogenerating code 22 | ------------------- 23 | 24 | A skeleton structure containing much of the boilerplate of creating a new plugin with an API can be autogenerated by running `programs/util/newplugin.py`. 25 | 26 | - Register signal handlers in `plugin_startup()` (if needed) 27 | - Add methods to `myplugin_api` class and reflect them in `FC_API` declaration 28 | -------------------------------------------------------------------------------- /libraries/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(api) 2 | add_subdirectory(chain) 3 | add_subdirectory(protocol) 4 | add_subdirectory(network) 5 | add_subdirectory(time) 6 | add_subdirectory(utilities) 7 | add_subdirectory(wallet) 8 | -------------------------------------------------------------------------------- /libraries/api/block_objects.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace golos { namespace api { 4 | 5 | block_operation::block_operation() = default; 6 | 7 | annotated_signed_block::annotated_signed_block() = default; 8 | 9 | annotated_signed_block::annotated_signed_block(const signed_block& block) 10 | : signed_block(block) { 11 | block_id = id(); 12 | signing_key = signee(); 13 | transaction_ids.reserve(transactions.size()); 14 | for (const signed_transaction& tx : transactions) { 15 | transaction_ids.push_back(tx.id()); 16 | } 17 | } 18 | 19 | annotated_signed_block::annotated_signed_block(const signed_block& block, const block_operations& ops) 20 | : annotated_signed_block(block) { 21 | _virtual_operations = ops; 22 | } 23 | 24 | timed_signed_block::timed_signed_block() = default; 25 | 26 | timed_signed_block::timed_signed_block(const signed_block& block) 27 | : signed_block(block) { 28 | timestamp_msec = time_point(block.timestamp).time_since_epoch().to_milliseconds(); 29 | } 30 | 31 | timed_block_header::timed_block_header() = default; 32 | 33 | timed_block_header::timed_block_header(const block_header& bh) 34 | : block_header(bh) { 35 | timestamp_msec = time_point(bh.timestamp).time_since_epoch().to_milliseconds(); 36 | } 37 | 38 | } } // golos::api -------------------------------------------------------------------------------- /libraries/api/content_utils.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace golos { namespace api { 4 | 5 | fc::optional process_content_prefs(const opt_prefs& prefs, const account_name_type& author, const database& _db) { 6 | bad_comment res; 7 | if (!!prefs) { 8 | for (const auto& pair : prefs->blockers) { 9 | bool blocking = _db.is_blocking(pair.first, author); 10 | if (blocking) { 11 | res.who_blocked.insert(pair.first); 12 | if (pair.second.remove) { 13 | res.to_remove = true; 14 | } 15 | } 16 | } 17 | } 18 | if (!res.who_blocked.size()) { 19 | return fc::optional(); 20 | } 21 | return res; 22 | } 23 | 24 | }} 25 | -------------------------------------------------------------------------------- /libraries/api/include/golos/api/account_vote.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace golos { namespace api { 7 | 8 | struct account_vote { 9 | std::string authorperm; 10 | uint64_t weight = 0; 11 | int64_t rshares = 0; 12 | int16_t percent = 0; 13 | fc::time_point_sec time; 14 | }; 15 | 16 | } } // golos::api 17 | 18 | 19 | 20 | FC_REFLECT((golos::api::account_vote), (authorperm)(weight)(rshares)(percent)(time)); -------------------------------------------------------------------------------- /libraries/api/include/golos/api/callback_info.hpp: -------------------------------------------------------------------------------- 1 | 2 | namespace golos { namespace api { 3 | 4 | template 5 | struct callback_info { 6 | using callback_t = std::function; 7 | using ptr = std::shared_ptr; 8 | using cont = std::list; 9 | 10 | callback_t callback; 11 | boost::signals2::connection connection; 12 | typename cont::iterator it; 13 | 14 | void connect( 15 | boost::signals2::signal& sig, 16 | cont& free_cont, 17 | callback_t cb 18 | ) { 19 | callback = cb; 20 | connection = sig.connect([this, &free_cont](arg item) { 21 | wlog("V3"); 22 | try { 23 | this->callback(item); 24 | } catch (...) { 25 | free_cont.push_back(*this->it); 26 | this->connection.disconnect(); 27 | } 28 | }); 29 | } 30 | }; 31 | 32 | } } // golos::api 33 | -------------------------------------------------------------------------------- /libraries/api/include/golos/api/content_utils.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace golos { namespace api { 7 | 8 | fc::optional process_content_prefs(const opt_prefs& prefs, const account_name_type& author, const database& _db); 9 | 10 | }} 11 | -------------------------------------------------------------------------------- /libraries/api/include/golos/api/reblog_entry.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace golos { namespace api { 6 | 7 | struct reblog_entry { 8 | account_name_type author; 9 | std::string title; 10 | std::string body; 11 | std::string json_metadata; 12 | 13 | reblog_entry() = default; 14 | 15 | reblog_entry(const account_name_type& author_, const std::string& title_, const std::string& body_, 16 | const std::string& json_metadata_) 17 | : author(author_), title(title_), body(body_), json_metadata(json_metadata_) { 18 | } 19 | }; 20 | 21 | } } // golos::api 22 | 23 | FC_REFLECT((golos::api::reblog_entry), (author)(title)(body)(json_metadata)); -------------------------------------------------------------------------------- /libraries/api/include/golos/api/vote_state.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace golos { namespace api { 6 | using golos::protocol::share_type; 7 | struct vote_state { 8 | string voter; 9 | uint64_t weight = 0; 10 | int64_t rshares = 0; 11 | int16_t percent = 0; 12 | fc::optional reputation; 13 | time_point_sec time; 14 | }; 15 | 16 | } } // golos::api 17 | 18 | 19 | FC_REFLECT((golos::api::vote_state), (voter)(weight)(rshares)(percent)(reputation)(time)); -------------------------------------------------------------------------------- /libraries/api/include/golos/api/witness_api_object.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace golos { namespace api { 8 | using namespace golos::chain; 9 | 10 | struct witness_api_object { 11 | witness_api_object(const witness_object &w, const database& db); 12 | 13 | witness_api_object() = default; 14 | 15 | witness_object::id_type id; 16 | account_name_type owner; 17 | time_point_sec created; 18 | std::string url; 19 | uint32_t total_missed; 20 | uint64_t last_aslot; 21 | uint64_t last_confirmed_block_num; 22 | uint64_t pow_worker; 23 | public_key_type signing_key; 24 | api::chain_api_properties props; 25 | price sbd_exchange_rate; 26 | time_point_sec last_sbd_exchange_update; 27 | share_type votes; 28 | fc::uint128_t virtual_last_update; 29 | fc::uint128_t virtual_position; 30 | fc::uint128_t virtual_scheduled_time; 31 | digest_type last_work; 32 | version running_version; 33 | hardfork_version hardfork_version_vote; 34 | time_point_sec hardfork_time_vote; 35 | time_point_sec transit_to_cyberway_vote = STEEMIT_GENESIS_TIME; 36 | }; 37 | 38 | } } // golos::api 39 | 40 | 41 | FC_REFLECT( 42 | (golos::api::witness_api_object), 43 | (id)(owner)(created)(url)(votes)(virtual_last_update)(virtual_position)(virtual_scheduled_time) 44 | (total_missed)(last_aslot)(last_confirmed_block_num)(pow_worker)(signing_key)(props) 45 | (sbd_exchange_rate)(last_sbd_exchange_update)(last_work)(running_version)(hardfork_version_vote) 46 | (hardfork_time_vote)(transit_to_cyberway_vote)) -------------------------------------------------------------------------------- /libraries/api/witness_api_object.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace golos { namespace api { 4 | witness_api_object::witness_api_object(const witness_object &w, const database& db) 5 | : id(w.id), owner(w.owner), created(w.created), 6 | url(to_string(w.url)), total_missed(w.total_missed), last_aslot(w.last_aslot), 7 | last_confirmed_block_num(w.last_confirmed_block_num), pow_worker(w.pow_worker), 8 | signing_key(w.signing_key), props(w.props, db), sbd_exchange_rate(w.sbd_exchange_rate), 9 | last_sbd_exchange_update(w.last_sbd_exchange_update), votes(w.votes), 10 | virtual_last_update(w.virtual_last_update), virtual_position(w.virtual_position), 11 | virtual_scheduled_time(w.virtual_scheduled_time), last_work(w.last_work), 12 | running_version(w.running_version), hardfork_version_vote(w.hardfork_version_vote), 13 | hardfork_time_vote(w.hardfork_time_vote), transit_to_cyberway_vote(w.transit_to_cyberway_vote) { 14 | } 15 | } } // golos::api -------------------------------------------------------------------------------- /libraries/chain/database_comment_bill.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | namespace golos { namespace chain { 5 | 6 | void database::set_clear_comment_bills(bool clear_comment_bills) { 7 | _clear_comment_bills = clear_comment_bills; 8 | } 9 | 10 | const comment_bill_object* database::find_comment_bill(const comment_id_type& id) const { 11 | return find(id); 12 | } 13 | 14 | comment_bill database::get_comment_bill(const comment_id_type& id) const { 15 | const auto* obj = find_comment_bill(id); 16 | if (obj) { 17 | return obj->bill; 18 | } else { 19 | return comment_bill(); 20 | } 21 | } 22 | 23 | const comment_bill_object* database::upsert_comment_bill(const comment_id_type& id) { 24 | const auto* obj = find_comment_bill(id); 25 | if (obj) { 26 | return obj; 27 | } 28 | return &create([&](auto& obj) { 29 | obj.comment = id; 30 | }); 31 | } 32 | 33 | }} 34 | -------------------------------------------------------------------------------- /libraries/chain/database_market_events.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | namespace golos { namespace chain { 7 | 8 | void database::push_order_create_event(const limit_order_object& order) { 9 | order_create_operation op; 10 | op.orderid = order.orderid; 11 | op.created = order.created; 12 | op.expiration = order.expiration; 13 | op.seller = order.seller; 14 | op.for_sale = asset(order.for_sale, order.symbol); 15 | op.sell_price = order.sell_price; 16 | push_event(op); 17 | } 18 | 19 | void database::push_order_delete_event(const limit_order_object& order) { 20 | order_delete_operation op; 21 | op.orderid = order.orderid; 22 | op.seller = order.seller; 23 | op.sell_price = order.sell_price; 24 | push_event(op); 25 | } 26 | 27 | } } // golos::chain 28 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_1.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_1 2 | #define STEEMIT_HARDFORK_0_1 1 3 | #define STEEMIT_HARDFORK_0_1_TIME 1476788420 4 | #define STEEMIT_HARDFORK_0_1_VERSION hardfork_version( 0, 1 ) 5 | #endif 6 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_10.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_10 2 | #define STEEMIT_HARDFORK_0_10 10 3 | #define STEEMIT_HARDFORK_0_10__141 STEEMIT_HARDFORK_0_10 4 | #define STEEMIT_HARDFORK_0_10__149 STEEMIT_HARDFORK_0_10 5 | 6 | #define STEEMIT_MIN_LIQUIDITY_REWARD_PERIOD_SEC_HF10 fc::seconds(60*30) /// 30 min 7 | #define STEEMIT_HARDFORK_0_10_TIME 1476788600 //2016-07-15T12:00:00 UTC 8 | #define STEEMIT_HARDFORK_0_10_VERSION hardfork_version( 0, 10 ) 9 | #endif 10 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_11.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_11 2 | #define STEEMIT_HARDFORK_0_11 11 3 | #define STEEMIT_HARDFORK_0_11__169 STEEMIT_HARDFORK_0_11 4 | 5 | #define STEEMIT_HARDFORK_0_11_TIME 1476788620 // 2016-07-17T15:00:00 UTC (11:00:00 EDT) 6 | #define STEEMIT_HARDFORK_0_11_VERSION hardfork_version( 0, 11 ) 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_12.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_12 2 | #define STEEMIT_HARDFORK_0_12 12 3 | #define STEEMIT_HARDFORK_0_12__176 (STEEMIT_HARDFORK_0_12) 4 | #define STEEMIT_HARDFORK_0_12__177 (STEEMIT_HARDFORK_0_12) 5 | #define STEEMIT_HARDFORK_0_12__178 (STEEMIT_HARDFORK_0_12) 6 | #define STEEMIT_HARDFORK_0_12__179 (STEEMIT_HARDFORK_0_12) 7 | 8 | #define STEEMIT_HARDFORK_0_12_TIME 1476788640 9 | #define STEEMIT_HARDFORK_0_12_VERSION hardfork_version( 0, 12 ) 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_13.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_13 2 | #define STEEMIT_HARDFORK_0_13 13 3 | #define STEEMIT_HARDFORK_0_13__248 (STEEMIT_HARDFORK_0_13) 4 | #define STEEMIT_HARDFORK_0_13__256 (STEEMIT_HARDFORK_0_13) 5 | #define STEEMIT_HARDFORK_0_13__257 (STEEMIT_HARDFORK_0_13) 6 | 7 | #define STEEMIT_HARDFORK_0_13_TIME 1476788660 8 | #define STEEMIT_HARDFORK_0_13_VERSION hardfork_version( 0, 13 ) 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_14.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_14 2 | #define STEEMIT_HARDFORK_0_14 14 3 | #define STEEMIT_HARDFORK_0_14__324 (STEEMIT_HARDFORK_0_14) 4 | 5 | #define STEEMIT_HARDFORK_0_14__143 (STEEMIT_HARDFORK_0_14) 6 | #define STEEMIT_HARDFORK_0_14__230 (STEEMIT_HARDFORK_0_14) 7 | #define STEEMIT_HARDFORK_0_14__239 (STEEMIT_HARDFORK_0_14) 8 | #define STEEMIT_HARDFORK_0_14__259 (STEEMIT_HARDFORK_0_14) 9 | #define STEEMIT_HARDFORK_0_14__278 (STEEMIT_HARDFORK_0_14) 10 | #define STEEMIT_HARDFORK_0_14__306 (STEEMIT_HARDFORK_0_14) 11 | #define STEEMIT_HARDFORK_0_14__307 (STEEMIT_HARDFORK_0_14) 12 | #define STEEMIT_HARDFORK_0_14__317 (STEEMIT_HARDFORK_0_14) 13 | #define STEEMIT_HARDFORK_0_14__327 (STEEMIT_HARDFORK_0_14) 14 | #define STEEMIT_HARDFORK_0_14__240 (STEEMIT_HARDFORK_0_14) 15 | #define STEEMIT_HARDFORK_0_14__410 (STEEMIT_HARDFORK_0_14) 16 | 17 | #define STEEMIT_HARDFORK_0_14_TIME 1476788680 18 | 19 | #define STEEMIT_HARDFORK_0_14_VERSION hardfork_version( 0, 14 ) 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_15.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_15 2 | #define STEEMIT_HARDFORK_0_15 15 3 | #define STEEMIT_HARDFORK_0_15__465 (STEEMIT_HARDFORK_0_15) 4 | 5 | #ifdef STEEMIT_BUILD_TESTNET 6 | #define STEEMIT_HARDFORK_0_15_TIME 1488196780 7 | #else 8 | #define STEEMIT_HARDFORK_0_15_TIME 1488369000 9 | #endif 10 | 11 | #define STEEMIT_HARDFORK_0_15_VERSION hardfork_version( 0, 15 ) 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_17.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_17 2 | #define STEEMIT_HARDFORK_0_17 17 3 | #define STEEMIT_HARDFORK_0_17__430 (STEEMIT_HARDFORK_0_17) // Remove comment depth limit 4 | #define STEEMIT_HARDFORK_0_17__431 (STEEMIT_HARDFORK_0_17) // Single cachout window 5 | #define STEEMIT_HARDFORK_0_17__432 (STEEMIT_HARDFORK_0_17) // Comment reward beneficiaries 6 | #define STEEMIT_HARDFORK_0_17__433 (STEEMIT_HARDFORK_0_17) // Linear reward curve 7 | 8 | #ifdef STEEMIT_BUILD_TESTNET 9 | #define STEEMIT_HARDFORK_0_17_TIME 1519894800 // 1 mar 2018 12:00:00 MSK 10 | #else 11 | #define STEEMIT_HARDFORK_0_17_TIME 1522832400 // 4 apr 2018 12:00:00 MSK 12 | #endif 13 | 14 | #define STEEMIT_HARDFORK_0_17_VERSION hardfork_version( 0, 17 ) 15 | 16 | #define STEEMIT_HF_17_NUM_POSTS (50000) 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_18.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_18 2 | #define STEEMIT_HARDFORK_0_18 18 3 | #define STEEMIT_HARDFORK_0_18__196 (STEEMIT_HARDFORK_0_18) // Split json_metadata from account object 4 | #define STEEMIT_HARDFORK_0_18__220 (STEEMIT_HARDFORK_0_18) // Witness price feed expire 5 | #define STEEMIT_HARDFORK_0_18__535 (STEEMIT_HARDFORK_0_18) // Golos Power delegation 6 | #define STEEMIT_HARDFORK_0_18__536 (STEEMIT_HARDFORK_0_18) // Comments should be editable forever 7 | #define STEEMIT_HARDFORK_0_18__542 (STEEMIT_HARDFORK_0_18) // Proposal transactions 8 | #define STEEMIT_HARDFORK_0_18__673 (STEEMIT_HARDFORK_0_18) // Votable delegation params 9 | 10 | #ifdef STEEMIT_BUILD_TESTNET 11 | #define STEEMIT_HARDFORK_0_18_TIME 1523869200 // 16 apr 2018 12:00:00 MSK 12 | #else 13 | #define STEEMIT_HARDFORK_0_18_TIME 1529485200 // 20 jun 2018 12:00:00 MSK 14 | #endif 15 | 16 | #define STEEMIT_HARDFORK_0_18_VERSION hardfork_version( 0, 18 ) 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_19.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_19 2 | #define STEEMIT_HARDFORK_0_19 19 3 | #define STEEMIT_HARDFORK_0_19__898 (STEEMIT_HARDFORK_0_19) // Add votable auction window size 4 | #define STEEMIT_HARDFORK_0_19__295 (STEEMIT_HARDFORK_0_19) // Referral program implemented 5 | #define STEEMIT_HARDFORK_0_19__533_1002 (STEEMIT_HARDFORK_0_19) // Leaky algorithm for comment, vote and post bandwidth 6 | #define STEEMIT_HARDFORK_0_19__756 (STEEMIT_HARDFORK_0_19) // Vesting shares delegation with interest 7 | #define STEEMIT_HARDFORK_0_19__971 (STEEMIT_HARDFORK_0_19) // Withdraw vests to another account resests on account recover 8 | #define STEEMIT_HARDFORK_0_19__924 (STEEMIT_HARDFORK_0_19) // Bandwidth for custom_json operations 9 | #define STEEMIT_HARDFORK_0_19__952 (STEEMIT_HARDFORK_0_19) // Stop the GBG emission if its count is more than 10% 10 | #define STEEMIT_HARDFORK_0_19__324 (STEEMIT_HARDFORK_0_19) // Add curation rewards percent setting by post author 11 | #define STEEMIT_HARDFORK_0_19__677 (STEEMIT_HARDFORK_0_19) // Allow to select curation reward curve 12 | 13 | #ifdef STEEMIT_BUILD_TESTNET 14 | #define STEEMIT_HARDFORK_0_19_TIME 1534755600 // 20 aug 2018 12:00:00 MSK 15 | #else 16 | #define STEEMIT_HARDFORK_0_19_TIME 1544778000 // 14 dec 2018 12:00:00 MSK 17 | #endif 18 | 19 | #define STEEMIT_HARDFORK_0_19_VERSION hardfork_version( 0, 19 ) 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_2.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_2 2 | #define STEEMIT_HARDFORK_0_2 2 3 | #define STEEMIT_HARDFORK_0_2_TIME 1476788440 4 | #define STEEMIT_HARDFORK_0_2_VERSION hardfork_version( 0, 2 ) 5 | #endif 6 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_20.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_20 2 | #define STEEMIT_HARDFORK_0_20 20 3 | #define STEEMIT_HARDFORK_0_20__1074 (STEEMIT_HARDFORK_0_20) // Blockchain stopped due to negative payment of curator reward 4 | #define STEEMIT_HARDFORK_0_20__1075 (STEEMIT_HARDFORK_0_20) // Author can change curation percent after voting on post 5 | 6 | #ifdef STEEMIT_BUILD_TESTNET 7 | #define STEEMIT_HARDFORK_0_20_TIME 1547701200 // 17 jan 2019 12:00:00 MSK 8 | #else 9 | #define STEEMIT_HARDFORK_0_20_TIME 1547787600 // 18 jan 2019 12:00:00 MSK 10 | #endif 11 | 12 | #define STEEMIT_HARDFORK_0_20_VERSION hardfork_version( 0, 20 ) 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_22.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_22 2 | #define STEEMIT_HARDFORK_0_22 22 3 | 4 | #define STEEMIT_HARDFORK_0_22__8 (STEEMIT_HARDFORK_0_22) // Workers 5 | #define STEEMIT_HARDFORK_0_22__65 (STEEMIT_HARDFORK_0_22) // Remove limit on max delegate interest witness prop 6 | #define STEEMIT_HARDFORK_0_22__66 (STEEMIT_HARDFORK_0_22) // Remove limit on min curation percent witness prop 7 | #define STEEMIT_HARDFORK_0_22__67 (STEEMIT_HARDFORK_0_22) // Fix post bandwidth 8 | #define STEEMIT_HARDFORK_0_22__68 (STEEMIT_HARDFORK_0_22) // Voting with stake for witnesses 9 | #define STEEMIT_HARDFORK_0_22__64 (STEEMIT_HARDFORK_0_22) // Force conversion SBD debt to GOLOS on account balances 10 | #define STEEMIT_HARDFORK_0_22__76 (STEEMIT_HARDFORK_0_22) // Make vote regeneration per day votable by witnesses 11 | #define STEEMIT_HARDFORK_0_22__77 (STEEMIT_HARDFORK_0_22) // Clearing votes on idling witnesses. 12 | #define STEEMIT_HARDFORK_0_22__78 (STEEMIT_HARDFORK_0_22) // Lowering vesting shares on idling accounts. 13 | #define STEEMIT_HARDFORK_0_22__79 (STEEMIT_HARDFORK_0_22) // Change block skipping timeout to reset witness signing key. 14 | 15 | #ifdef STEEMIT_BUILD_TESTNET 16 | #define STEEMIT_HARDFORK_0_22_TIME 1563958800 // 24 jul 2019 12:00:00 MSK 17 | #else 18 | #define STEEMIT_HARDFORK_0_22_TIME 1577293200 // 25 dec 2019 20:00:00 MSK 19 | #endif 20 | 21 | #define STEEMIT_HARDFORK_0_22_VERSION hardfork_version( 0, 22 ) 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_23.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_23 2 | #define STEEMIT_HARDFORK_0_23 23 3 | 4 | #define STEEMIT_HARDFORK_0_23__83 (STEEMIT_HARDFORK_0_23) // Donates 5 | #define STEEMIT_HARDFORK_0_23__93 (STEEMIT_HARDFORK_0_23) // Donates for referrals 6 | #define STEEMIT_HARDFORK_0_23__84 (STEEMIT_HARDFORK_0_23) // Transfer SBD payouts to workers instead of authors 7 | #define STEEMIT_HARDFORK_0_23__98 (STEEMIT_HARDFORK_0_23) // Invites 8 | #define STEEMIT_HARDFORK_0_23__104 (STEEMIT_HARDFORK_0_23) // Set vesting withdraw interval to 8 weeks 9 | 10 | #ifdef STEEMIT_BUILD_TESTNET 11 | #define STEEMIT_HARDFORK_0_23_TIME 1585558800 // 30 mar 2020 12:00:00 MSK 12 | #else 13 | #define STEEMIT_HARDFORK_0_23_TIME 1590426000 // 25 may 2020 20:00:00 MSK 14 | #endif 15 | 16 | #define STEEMIT_HARDFORK_0_23_VERSION hardfork_version( 0, 23 ) 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_24.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_24 2 | #define STEEMIT_HARDFORK_0_24 24 3 | 4 | #define STEEMIT_HARDFORK_0_24__95 (STEEMIT_HARDFORK_0_24) // User-Issued Assets 5 | #define STEEMIT_HARDFORK_0_24__111 (STEEMIT_HARDFORK_0_24) // invite_transfer, invite_donate 6 | #define STEEMIT_HARDFORK_0_24__120 (STEEMIT_HARDFORK_0_24) // Creating invites which will add creator as referrer on registering account with them 7 | #define STEEMIT_HARDFORK_0_24__121 (STEEMIT_HARDFORK_0_24) // limit_order_cancel_ex_operation which cancels all order by specified pair 8 | 9 | #ifdef STEEMIT_BUILD_TESTNET 10 | #define STEEMIT_HARDFORK_0_24_TIME 1596240000 // 1 aug 2020 03:00:00 MSK 11 | #else 12 | #define STEEMIT_HARDFORK_0_24_TIME 1603645200 // 25 oct 2020 20:00:00 MSK 13 | #endif 14 | 15 | #define STEEMIT_HARDFORK_0_24_VERSION hardfork_version( 0, 24 ) 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_25.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_25 2 | #define STEEMIT_HARDFORK_0_25 25 3 | 4 | #define STEEMIT_HARDFORK_0_25__122 (STEEMIT_HARDFORK_0_25) // Account idleness - minimum of non-withdrawing vesting shares 5 | 6 | #ifdef STEEMIT_BUILD_TESTNET 7 | #define STEEMIT_HARDFORK_0_25_TIME 1605891600 // 20 nov 2020 20:00:00 MSK 8 | #else 9 | #define STEEMIT_HARDFORK_0_25_TIME 1608483600 // 20 dec 2020 20:00:00 MSK 10 | #endif 11 | 12 | #define STEEMIT_HARDFORK_0_25_VERSION hardfork_version( 0, 25 ) 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_26.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_26 2 | #define STEEMIT_HARDFORK_0_26 26 3 | 4 | #define STEEMIT_HARDFORK_0_26__155 (STEEMIT_HARDFORK_0_26) // GOLOS to GBG conversion 5 | #define STEEMIT_HARDFORK_0_26__162 (STEEMIT_HARDFORK_0_26) // Min vesting shares to receive curate rewards 6 | #define STEEMIT_HARDFORK_0_26__159 (STEEMIT_HARDFORK_0_26) // Fix canceling orders 7 | #define STEEMIT_HARDFORK_0_26__131 (STEEMIT_HARDFORK_0_26) // SBD interest only on saving balance 8 | #define STEEMIT_HARDFORK_0_26__164 (STEEMIT_HARDFORK_0_26) // Upvoting/downvoting reputation 9 | #define STEEMIT_HARDFORK_0_26__163 (STEEMIT_HARDFORK_0_26) // Change emission distribution 10 | #define STEEMIT_HARDFORK_0_26__168 (STEEMIT_HARDFORK_0_26) // Negrep posting bandwidth 11 | #define STEEMIT_HARDFORK_0_26__157 (STEEMIT_HARDFORK_0_26) // Set vesting withdraw interval to 4 weeks 12 | 13 | #ifdef STEEMIT_BUILD_TESTNET 14 | #define STEEMIT_HARDFORK_0_26_TIME 1608483600 // 20 dec 2020 20:00:00 MSK 15 | #else 16 | #define STEEMIT_HARDFORK_0_26_TIME 1632070800 // 19 sep 2021 20:00:00 MSK 17 | #endif 18 | 19 | #define STEEMIT_HARDFORK_0_26_VERSION hardfork_version( 0, 26 ) 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_27.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_27 2 | #define STEEMIT_HARDFORK_0_27 27 3 | 4 | #define STEEMIT_HARDFORK_0_27__199 (STEEMIT_HARDFORK_0_27) // Registering with "newacc" (transfer) 5 | #define STEEMIT_HARDFORK_0_27__200 (STEEMIT_HARDFORK_0_27) // Account creation fee workers percent 6 | #define STEEMIT_HARDFORK_0_27__202 (STEEMIT_HARDFORK_0_27) // Return emission distribution 7 | #define STEEMIT_HARDFORK_0_27__203 (STEEMIT_HARDFORK_0_27) // Account cleaning 8 | #define STEEMIT_HARDFORK_0_27__204 (STEEMIT_HARDFORK_0_27) // Do not pay for posts by negative reputation authors 9 | #define STEEMIT_HARDFORK_0_27__185 (STEEMIT_HARDFORK_0_27) // Blacklist and "do not bother" button 10 | #define STEEMIT_HARDFORK_0_27__207 (STEEMIT_HARDFORK_0_27) // Burning null TIP-balances 11 | #define STEEMIT_HARDFORK_0_27__209 (STEEMIT_HARDFORK_0_27) // Negrep 12 | 13 | #ifdef STEEMIT_BUILD_TESTNET 14 | #define STEEMIT_HARDFORK_0_27_TIME 1655053200 // 12 jun 2022 20:00:00 MSK 15 | #else 16 | #define STEEMIT_HARDFORK_0_27_TIME 1662915600 // 11 sep 2022 20:00:00 MSK 17 | #endif 18 | 19 | #define STEEMIT_HARDFORK_0_27_VERSION hardfork_version( 0, 27 ) 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_28.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_28 2 | #define STEEMIT_HARDFORK_0_28 28 3 | 4 | #define STEEMIT_HARDFORK_0_28__214 (STEEMIT_HARDFORK_0_28) // Improve VS undelegation 5 | #define STEEMIT_HARDFORK_0_28__215 (STEEMIT_HARDFORK_0_28) // Fix VS excessive week 6 | #define STEEMIT_HARDFORK_0_28__216 (STEEMIT_HARDFORK_0_28) // Deprecate miners in witnesses scheduling 7 | #define STEEMIT_HARDFORK_0_28__217 (STEEMIT_HARDFORK_0_28) // Fee for reputation downvoting 8 | #define STEEMIT_HARDFORK_0_28__218 (STEEMIT_HARDFORK_0_28) // Accumulative balance for users with low GP 9 | #define STEEMIT_HARDFORK_0_28__219 (STEEMIT_HARDFORK_0_28) // Automatic GBG interest payments 10 | 11 | #ifdef STEEMIT_BUILD_TESTNET 12 | #define STEEMIT_HARDFORK_0_28_TIME 1668531600 // 15 nov 2022 20:00:00 MSK 13 | #else 14 | #define STEEMIT_HARDFORK_0_28_TIME 1674320400 // 21 jan 2023 20:00:00 MSK 15 | #endif 16 | 17 | #define STEEMIT_HARDFORK_0_28_VERSION hardfork_version( 0, 28 ) 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_29.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_29 2 | #define STEEMIT_HARDFORK_0_29 29 3 | 4 | #define STEEMIT_HARDFORK_0_29__230 (STEEMIT_HARDFORK_0_29) // Paid subscriptions (recurrent payments) 5 | #define STEEMIT_HARDFORK_0_29__201 (STEEMIT_HARDFORK_0_29) // NFT 6 | 7 | #ifdef STEEMIT_BUILD_TESTNET 8 | #define STEEMIT_HARDFORK_0_29_TIME 1668531600 // 15 nov 2022 20:00:00 MSK 9 | #else 10 | #define STEEMIT_HARDFORK_0_29_TIME 1699203600 // 5 nov 2023 20:00:00 MSK 11 | #endif 12 | 13 | #define STEEMIT_HARDFORK_0_29_VERSION hardfork_version( 0, 29 ) 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_3.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_3 2 | #define STEEMIT_HARDFORK_0_3 3 3 | #define STEEMIT_HARDFORK_0_3_TIME 1476788460 4 | #define STEEMIT_HARDFORK_0_3_VERSION hardfork_version( 0, 3 ) 5 | #endif 6 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_30.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_30 2 | #define STEEMIT_HARDFORK_0_30 30 3 | 4 | #define STEEMIT_HARDFORK_0_30__236 (STEEMIT_HARDFORK_0_30) // NFT auction 5 | 6 | #ifdef STEEMIT_BUILD_TESTNET 7 | #define STEEMIT_HARDFORK_0_30_TIME 1700420400 // 19 nov 2023 22:00:00 MSK 8 | #else 9 | #define STEEMIT_HARDFORK_0_30_TIME 1734195600 // 14 dec 2024 20:00:00 MSK 10 | #endif 11 | 12 | #define STEEMIT_HARDFORK_0_30_VERSION hardfork_version( 0, 30 ) 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_4.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_4 2 | #define STEEMIT_HARDFORK_0_4 4 3 | #define STEEMIT_HARDFORK_0_4_TIME 1476788480 4 | #define STEEMIT_HARDFORK_0_4_VERSION hardfork_version( 0, 4 ) 5 | #endif 6 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_5.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_5 2 | #define STEEMIT_HARDFORK_0_5 5 3 | #define STEEMIT_HARDFORK_0_5__22 ( STEEMIT_HARDFORK_0_5 ) 4 | #define STEEMIT_HARDFORK_0_5__54 ( STEEMIT_HARDFORK_0_5 ) 5 | #define STEEMIT_HARDFORK_0_5__55 ( STEEMIT_HARDFORK_0_5 ) 6 | #define STEEMIT_HARDFORK_0_5__56 ( STEEMIT_HARDFORK_0_5 ) 7 | #define STEEMIT_HARDFORK_0_5__57 ( STEEMIT_HARDFORK_0_5 ) 8 | #define STEEMIT_HARDFORK_0_5__59 ( STEEMIT_HARDFORK_0_5 ) 9 | #define STEEMIT_HARDFORK_0_5__62 ( STEEMIT_HARDFORK_0_5 ) 10 | #define STEEMIT_HARDFORK_0_5_TIME 1476788500 11 | #define STEEMIT_HARDFORK_0_5_VERSION hardfork_version( 0, 5 ) 12 | #endif 13 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_6.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_6 2 | #define STEEMIT_HARDFORK_0_6 6 3 | #define STEEMIT_HARDFORK_0_6__74 STEEMIT_HARDFORK_0_6 4 | #define STEEMIT_HARDFORK_0_6__78 STEEMIT_HARDFORK_0_6 5 | #define STEEMIT_HARDFORK_0_6__80 STEEMIT_HARDFORK_0_6 6 | #define STEEMIT_HARDFORK_0_6__101 STEEMIT_HARDFORK_0_6 7 | #define STEEMIT_HARDFORK_0_6__104 STEEMIT_HARDFORK_0_6 8 | #define STEEMIT_HARDFORK_0_6__112 STEEMIT_HARDFORK_0_6 9 | #define STEEMIT_HARDFORK_0_6__113 STEEMIT_HARDFORK_0_6 10 | #define STEEMIT_HARDFORK_0_6__114 STEEMIT_HARDFORK_0_6 11 | #define STEEMIT_HARDFORK_0_6__127 STEEMIT_HARDFORK_0_6 12 | 13 | #define STEEMIT_HARDFORK_0_6_TIME 1476788520 14 | #define STEEMIT_HARDFORK_0_6_REVERSE_AUCTION_TIME (1476788510) 15 | #define STEEMIT_HARDFORK_0_6_VERSION hardfork_version( 0, 6 ) 16 | #endif 17 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_7.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_7 2 | #define STEEMIT_HARDFORK_0_7 7 3 | #define STEEMIT_HARDFORK_0_7__117 STEEMIT_HARDFORK_0_7 4 | 5 | #define STEEMIT_HARDFORK_0_7_TIME 1476788540 6 | #define STEEMIT_HARDFORK_0_7_VERSION hardfork_version( 0, 7 ) 7 | #endif 8 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_8.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_8 2 | #define STEEMIT_HARDFORK_0_8 8 3 | #define STEEMIT_HARDFORK_0_8__116 STEEMIT_HARDFORK_0_8 4 | 5 | #define STEEMIT_HARDFORK_0_8_TIME 1476788560 6 | #define STEEMIT_HARDFORK_0_8_VERSION hardfork_version( 0, 8 ) 7 | #endif 8 | -------------------------------------------------------------------------------- /libraries/chain/hardfork.d/0_9.hf: -------------------------------------------------------------------------------- 1 | #ifndef STEEMIT_HARDFORK_0_9 2 | #define STEEMIT_HARDFORK_0_9 9 3 | #define STEEMIT_HARDFORK_0_9__141 STEEMIT_HARDFORK_0_9 4 | 5 | #define STEEMIT_HARDFORK_0_9_TIME 1476788580 6 | #define STEEMIT_HARDFORK_0_9_VERSION hardfork_version( 0, 9 ) 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /libraries/chain/include/golos/chain/block_summary_object.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace golos { 6 | namespace chain { 7 | 8 | using golos::protocol::block_id_type; 9 | 10 | /** 11 | * @brief tracks minimal information about past blocks to implement TaPOS 12 | * @ingroup object 13 | * 14 | * When attempting to calculate the validity of a transaction we need to 15 | * lookup a past block and check its block hash and the time it occurred 16 | * so we can calculate whether the current transaction is valid and at 17 | * what time it should expire. 18 | */ 19 | class block_summary_object 20 | : public object { 21 | public: 22 | template 23 | block_summary_object(Constructor &&c, allocator a) { 24 | c(*this); 25 | } 26 | 27 | block_summary_object() { 28 | }; 29 | 30 | id_type id; 31 | block_id_type block_id; 32 | }; 33 | 34 | typedef multi_index_container < 35 | block_summary_object, 36 | indexed_by< 37 | ordered_unique < tag < by_id>, 38 | member> 39 | >, 40 | allocator 41 | > 42 | block_summary_index; 43 | 44 | } 45 | } // golos::chain 46 | 47 | FC_REFLECT((golos::chain::block_summary_object), (id)(block_id)) 48 | CHAINBASE_SET_INDEX_TYPE(golos::chain::block_summary_object, golos::chain::block_summary_index) 49 | -------------------------------------------------------------------------------- /libraries/chain/include/golos/chain/comment_app_helper.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | namespace golos { namespace chain { 9 | 10 | comment_app parse_comment_app(const database& _db, const comment_operation& op); 11 | 12 | const comment_app_id* find_comment_app_id(const database& _db, const comment_app& app); 13 | 14 | comment_app get_comment_app_by_id(const database& _db, const comment_app_id& id); 15 | 16 | comment_app_id singleton_comment_app(database& _db, const comment_app& app); 17 | 18 | }} 19 | -------------------------------------------------------------------------------- /libraries/chain/include/golos/chain/curation_info.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace golos { namespace chain { 7 | 8 | struct comment_vote_info { 9 | const comment_vote_object* vote = nullptr; 10 | uint64_t weight = 0; ///< defines the score this vote receives, used by vote payout calc. 0 if a negative vote or changed votes. 11 | }; // struct comment_vote_info 12 | 13 | struct comment_curation_info { 14 | const comment_object& comment; 15 | asset min_vesting_shares_to_curate = asset(0, VESTS_SYMBOL); ///< Same as min_golos_power_to_curate, but in GESTS 16 | 17 | std::vector vote_list; 18 | 19 | uint64_t total_vote_weight = 0; ///< The total weight of voting rewards, used to calculate pro-rata share of curation payouts 20 | uint64_t auction_window_weight = 0; ///< The weight of auction window without weight of voters 21 | uint64_t votes_in_auction_window_weight = 0; ///< The weight of votes in auction window 22 | uint64_t votes_after_auction_window_weight = 0; 23 | protocol::curation_curve curve = protocol::curation_curve::detect; 24 | 25 | comment_curation_info(comment_curation_info&&) = default; 26 | comment_curation_info(const comment_curation_info&) = delete; 27 | 28 | comment_curation_info(database& db, const comment_object&, bool); 29 | }; // struct comment_curation_info 30 | 31 | } } // namespace golos::chain -------------------------------------------------------------------------------- /libraries/chain/include/golos/chain/custom_operation_interpreter.hpp: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | 6 | namespace golos { 7 | namespace schema { 8 | struct abstract_schema; 9 | } 10 | } 11 | 12 | namespace golos { 13 | namespace protocol { 14 | struct custom_json_operation; 15 | } 16 | } 17 | 18 | namespace golos { 19 | namespace chain { 20 | 21 | class custom_operation_interpreter { 22 | public: 23 | virtual void apply(const protocol::custom_json_operation &op) = 0; 24 | 25 | virtual void apply(const protocol::custom_binary_operation &op) = 0; 26 | }; 27 | 28 | } 29 | } // golos::chain 30 | -------------------------------------------------------------------------------- /libraries/chain/include/golos/chain/evaluator_registry.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace golos { 6 | namespace chain { 7 | 8 | template 9 | class evaluator_registry { 10 | public: 11 | evaluator_registry(database &d) 12 | : _db(d) { 13 | for (int i = 0; i < OperationType::count(); i++) { 14 | _op_evaluators.emplace_back(); 15 | } 16 | } 17 | 18 | template 19 | void register_evaluator(Args... args) { 20 | _op_evaluators[OperationType::template tag::value].reset(new EvaluatorType(_db, args...)); 21 | } 22 | 23 | evaluator &get_evaluator(const OperationType &op) { 24 | int i_which = op.which(); 25 | uint64_t u_which = uint64_t(i_which); 26 | if (i_which < 0) 27 | assert("Negative operation tag" && false); 28 | if (u_which >= _op_evaluators.size()) 29 | assert("No registered evaluator for this operation" && 30 | false); 31 | unique_ptr> &eval = _op_evaluators[u_which]; 32 | if (!eval) 33 | assert("No registered evaluator for this operation" && 34 | false); 35 | return *eval; 36 | } 37 | 38 | std::vector>> _op_evaluators; 39 | database &_db; 40 | }; 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /libraries/chain/include/golos/chain/event_objects.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace golos { namespace chain { 7 | 8 | using namespace golos::protocol; 9 | 10 | class event_object : public object { 11 | public: 12 | event_object() = delete; 13 | 14 | template 15 | event_object(Constructor&& c, allocator a) 16 | : serialized_op(a.get_segment_manager()) { 17 | c(*this); 18 | }; 19 | 20 | id_type id; 21 | buffer_type serialized_op; 22 | }; 23 | 24 | using event_index = multi_index_container< 25 | event_object, 26 | indexed_by< 27 | ordered_unique< 28 | tag, 29 | member 30 | > 31 | >, 32 | allocator>; 33 | 34 | } } // golos::chain 35 | 36 | CHAINBASE_SET_INDEX_TYPE( 37 | golos::chain::event_object, 38 | golos::chain::event_index); 39 | -------------------------------------------------------------------------------- /libraries/chain/include/golos/chain/freezing_utils.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace golos { namespace chain { 4 | 5 | class freezing_utils { 6 | public: 7 | freezing_utils(database& db); 8 | 9 | bool is_inactive(const account_object& acc); 10 | 11 | bool is_system_account(account_name_type name); 12 | 13 | void unfreeze(const account_object& acc, const asset& fee); 14 | 15 | database& _db; 16 | uint32_t hardfork; 17 | bool hf_long_ago = false; 18 | bool hf_ago_ended_now = false; 19 | }; 20 | 21 | }} // golos::chain 22 | -------------------------------------------------------------------------------- /libraries/chain/include/golos/chain/hf_actions.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace golos { namespace chain { 4 | 5 | class hf_actions { 6 | public: 7 | hf_actions(database& db); 8 | 9 | void prepare_for_tests(); 10 | void create_worker_pool(); 11 | void create_registrator_account(); 12 | void convert_min_curate_golos_power(); 13 | void fix_vesting_withdrawals(); 14 | private: 15 | template 16 | void create_test_account(account_name_type acc, FillAuth&& fillAuth, FillAccount&& fillAcc); 17 | 18 | template 19 | void create_test_account(account_name_type acc, FillAuth&& fillAuth); 20 | 21 | database& _db; 22 | }; 23 | 24 | }} // golos::chain 25 | -------------------------------------------------------------------------------- /libraries/chain/include/golos/chain/immutable_chain_parameters.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | #include 8 | 9 | namespace golos { 10 | namespace chain { 11 | 12 | struct immutable_chain_parameters { 13 | uint16_t min_committee_member_count = STEEMIT_DEFAULT_MIN_COMMITTEE_MEMBER_COUNT; 14 | uint16_t min_witness_count = STEEMIT_DEFAULT_MIN_WITNESS_COUNT; 15 | uint32_t num_special_accounts = 0; 16 | uint32_t num_special_assets = 0; 17 | }; 18 | 19 | } 20 | } // golos::chain 21 | 22 | FC_REFLECT((golos::chain::immutable_chain_parameters), 23 | (min_committee_member_count) 24 | (min_witness_count) 25 | (num_special_accounts) 26 | (num_special_assets) 27 | ) 28 | -------------------------------------------------------------------------------- /libraries/chain/include/golos/chain/index.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace golos { 6 | namespace chain { 7 | 8 | template 9 | void _add_index_impl(database &db) { 10 | db.add_index(); 11 | } 12 | 13 | template 14 | void add_core_index(database &db) { 15 | _add_index_impl(db); 16 | } 17 | 18 | template 19 | void add_plugin_index(database &db) { 20 | db._plugin_index_signal.connect([&db]() { _add_index_impl(db); }); 21 | } 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /libraries/chain/include/golos/chain/node_property_object.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace golos { 4 | namespace chain { 5 | 6 | /** 7 | * @brief Contains per-node database configuration. 8 | * 9 | * Transactions are evaluated differently based on per-node state. 10 | * Settings here may change based on whether the node is syncing or up-to-date. 11 | * Or whether the node is a witness node. Or if we're processing a 12 | * transaction in a witness-signed block vs. a fresh transaction 13 | * from the p2p network. Or configuration-specified tradeoffs of 14 | * performance/hardfork resilience vs. paranoia. 15 | */ 16 | class node_property_object { 17 | public: 18 | node_property_object() { 19 | } 20 | 21 | ~node_property_object() { 22 | } 23 | 24 | uint32_t skip_flags = 0; 25 | }; 26 | } 27 | } // golos::chain 28 | -------------------------------------------------------------------------------- /libraries/chain/include/golos/chain/operation_history_extender.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golos-blockchain/chain-node/5c2289a5ba5e460b4dd84aa611f4d9dd2aa7957b/libraries/chain/include/golos/chain/operation_history_extender.hpp -------------------------------------------------------------------------------- /libraries/chain/include/golos/chain/operation_notification.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace golos { namespace chain { 7 | 8 | using protocol::operation; 9 | 10 | struct operation_notification { 11 | operation_notification(const operation &o) : op(o) { 12 | } 13 | 14 | bool stored_in_db = false; 15 | int64_t db_id = 0; 16 | transaction_id_type trx_id; 17 | uint32_t block = 0; 18 | uint32_t trx_in_block = 0; 19 | uint16_t op_in_trx = 0; 20 | uint32_t virtual_op = 0; 21 | const operation& op; 22 | }; 23 | 24 | } } // golos::chain 25 | -------------------------------------------------------------------------------- /libraries/chain/include/golos/chain/shared_db_merkle.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace golos { 4 | namespace chain { 5 | 6 | inline static const map &get_shared_db_merkle() { 7 | static const map shared_db_merkle 8 | { 9 | {3705111, checksum_type("0a8f0fd5450c3706ec8b8cbad795cd0b3679bf35")}, 10 | {3705120, checksum_type("2027edb72b671f7011c8cc4c7a8b59c39b305093")}, 11 | {3713940, checksum_type("bf8a1d516927c506ebdbb7b38bef2e992435435f")}, 12 | {3714132, checksum_type("e8b77773d268b72c8d650337b8cce360bbe64779")}, 13 | {3714567, checksum_type("45af59a8c2d7d4a606151ef5dae03d2dfe13fbdd")}, 14 | {3714588, checksum_type("e64275443bdc82f104ac936486d367af8f6d1584")}, 15 | {4138790, checksum_type("f65a3a788a2ef52406d8ba5705d7288be228403f")}, 16 | {5435426, checksum_type("0b32538b2d22bd3146d54b6e3cb5ae8b9780e8a5")} 17 | }; 18 | 19 | return shared_db_merkle; 20 | } 21 | 22 | } 23 | } //golos::chain 24 | -------------------------------------------------------------------------------- /libraries/protocol/byteswap.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef _WIN32 4 | # include 5 | # define bswap_64(x) _byteswap_uint64(x) 6 | #elif defined(__APPLE__) 7 | # include 8 | # define bswap_64(x) OSSwapInt64(x) 9 | #else 10 | # include 11 | #endif 12 | -------------------------------------------------------------------------------- /libraries/protocol/include/golos/protocol/README.md: -------------------------------------------------------------------------------- 1 | Protocol Definition 2 | -------------------- 3 | 4 | The classes declared in these headers provide the complete definition of the 5 | Vaporware protocol and are organized according to feature. Nothing in this 6 | directory should depend upon anything other than fc or other types defined 7 | in the protocol directory. 8 | 9 | To be more specific, implementation details such as the objects defined in 10 | the object database should not be required here. 11 | -------------------------------------------------------------------------------- /libraries/protocol/include/golos/protocol/block.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace golos { namespace protocol { 7 | 8 | struct signed_block : public signed_block_header { 9 | checksum_type calculate_merkle_root() const; 10 | 11 | vector transactions; 12 | }; 13 | 14 | } } // golos::protocol 15 | 16 | FC_REFLECT_DERIVED((golos::protocol::signed_block), ((golos::protocol::signed_block_header)), (transactions)) 17 | -------------------------------------------------------------------------------- /libraries/protocol/include/golos/protocol/block_header.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace golos { 6 | namespace protocol { 7 | 8 | struct block_header { 9 | digest_type digest() const; 10 | 11 | block_id_type previous; 12 | 13 | uint32_t block_num() const { 14 | return num_from_id(previous) + 1; 15 | } 16 | 17 | fc::time_point_sec timestamp; 18 | string witness; 19 | checksum_type transaction_merkle_root; 20 | block_header_extensions_type extensions; 21 | 22 | static uint32_t num_from_id(const block_id_type &id); 23 | }; 24 | 25 | struct signed_block_header : public block_header { 26 | block_id_type id() const; 27 | 28 | fc::ecc::public_key signee() const; 29 | 30 | void sign(const fc::ecc::private_key &signer); 31 | 32 | bool validate_signee(const fc::ecc::public_key &expected_signee) const; 33 | 34 | signature_type witness_signature; 35 | }; 36 | 37 | 38 | } 39 | } // golos::protocol 40 | 41 | FC_REFLECT((golos::protocol::block_header), (previous)(timestamp)(witness)(transaction_merkle_root)(extensions)) 42 | FC_REFLECT_DERIVED((golos::protocol::signed_block_header), ((golos::protocol::block_header)), (witness_signature)) 43 | -------------------------------------------------------------------------------- /libraries/protocol/include/golos/protocol/config_old.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef STEEMIT_BUILD_TESTNET 4 | 5 | #define STEEMIT_CONTENT_REWARD_PERCENT_PRE_HF22 (66.67*STEEMIT_1_PERCENT) //66.67% of inflation, 6 | //7.125% inflation 7 | #define STEEMIT_VESTING_FUND_PERCENT_PRE_HF22 (26.67*STEEMIT_1_PERCENT) //26.67% of inflation, 8 | //1.425% inflation 9 | #define GOLOS_WORKER_REWARD_PERCENT_PRE_HF26 (15.00*STEEMIT_1_PERCENT) 10 | #define GOLOS_WITNESS_REWARD_PERCENT_PRE_HF26 (10.00*STEEMIT_1_PERCENT) 11 | #define GOLOS_VESTING_REWARD_PERCENT_PRE_HF26 (10.00*STEEMIT_1_PERCENT) 12 | 13 | #else 14 | 15 | #define STEEMIT_CONTENT_REWARD_PERCENT_PRE_HF22 (66.67*STEEMIT_1_PERCENT) //66.67% of inflation, 16 | //7.125% inflation 17 | #define STEEMIT_VESTING_FUND_PERCENT_PRE_HF22 (26.67*STEEMIT_1_PERCENT) //26.67% of inflation, 18 | //1.425% inflation 19 | #define GOLOS_WORKER_REWARD_PERCENT_PRE_HF26 (15.00*STEEMIT_1_PERCENT) 20 | #define GOLOS_WITNESS_REWARD_PERCENT_PRE_HF26 (10.00*STEEMIT_1_PERCENT) 21 | #define GOLOS_VESTING_REWARD_PERCENT_PRE_HF26 (10.00*STEEMIT_1_PERCENT) 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /libraries/protocol/include/golos/protocol/donate_targets.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace golos { namespace protocol { 6 | 7 | struct blog_donate { 8 | account_name_type author; 9 | std::string permlink; 10 | bool wrong; 11 | }; 12 | 13 | fc::optional get_blog_donate(const donate_operation& op); 14 | 15 | struct message_donate { 16 | std::string group; 17 | account_name_type from; 18 | account_name_type to; 19 | uint64_t nonce; 20 | bool wrong; 21 | }; 22 | 23 | fc::optional get_message_donate(const donate_operation& op); 24 | 25 | }} 26 | -------------------------------------------------------------------------------- /libraries/protocol/include/golos/protocol/get_config.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace golos { 6 | namespace protocol { 7 | 8 | fc::variant_object get_config(); 9 | 10 | } 11 | } // golos::protocol 12 | -------------------------------------------------------------------------------- /libraries/protocol/include/golos/protocol/market_events.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | namespace golos { namespace protocol { 11 | 12 | struct order_create_operation : public virtual_operation { 13 | order_create_operation() { 14 | } 15 | 16 | order_create_operation(uint32_t oid, fc::time_point_sec c, fc::time_point_sec e, 17 | const account_name_type& s, const price& sp) : 18 | orderid(oid), created(c), expiration(e), seller(s), sell_price(sp) { 19 | } 20 | 21 | uint32_t orderid = 0; 22 | fc::time_point_sec created; 23 | fc::time_point_sec expiration; 24 | account_name_type seller; 25 | asset for_sale; 26 | price sell_price; 27 | }; 28 | 29 | struct order_delete_operation : public virtual_operation { 30 | order_delete_operation() { 31 | } 32 | 33 | order_delete_operation(uint32_t oid, const account_name_type& s, const price& sp) : 34 | orderid(oid), seller(s), sell_price(sp) { 35 | } 36 | 37 | uint32_t orderid = 0; 38 | account_name_type seller; 39 | price sell_price; 40 | }; 41 | 42 | } } //golos::protocol 43 | 44 | FC_REFLECT((golos::protocol::order_create_operation), 45 | (orderid)(created)(expiration)(seller)(for_sale)(sell_price) 46 | ) 47 | 48 | FC_REFLECT((golos::protocol::order_delete_operation), 49 | (orderid)(seller)(sell_price) 50 | ) 51 | -------------------------------------------------------------------------------- /libraries/protocol/include/golos/protocol/operation_util.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | // 13 | // Place DECLARE_OPERATION_TYPE in a .hpp file to declare 14 | // functions related to your operation type 15 | // 16 | #define DECLARE_OPERATION_TYPE(OperationType) \ 17 | namespace fc { \ 18 | \ 19 | void to_variant(const OperationType&, fc::variant&); \ 20 | void from_variant(const fc::variant&, OperationType&); \ 21 | \ 22 | } /* fc */ \ 23 | \ 24 | namespace golos { namespace protocol { \ 25 | \ 26 | void operation_validate(const OperationType&); \ 27 | void operation_get_required_authorities( \ 28 | const OperationType& op, \ 29 | flat_set& active, \ 30 | flat_set& owner, \ 31 | flat_set& posting, \ 32 | vector& other); \ 33 | \ 34 | } } /* golos::protocol */ 35 | -------------------------------------------------------------------------------- /libraries/protocol/include/golos/protocol/protocol.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | -------------------------------------------------------------------------------- /libraries/protocol/include/golos/protocol/reward_curve.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace golos { namespace protocol { 6 | 7 | enum class curation_curve: uint8_t { 8 | bounded, 9 | linear, 10 | square_root, 11 | _size, 12 | detect = 100, ///< get from current settings 13 | }; // enum curation_curve 14 | 15 | } } // namespace golos::protocol 16 | 17 | FC_REFLECT_ENUM(golos::protocol::curation_curve, (detect)(bounded)(linear)(square_root)(_size)) 18 | -------------------------------------------------------------------------------- /libraries/protocol/include/golos/protocol/sign_state.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace golos { namespace protocol { 7 | 8 | using authority_getter = std::function< authority (const account_name_type&) > ; 9 | 10 | struct sign_state { 11 | /** returns true if we have a signature for this key or can 12 | * produce a signature for this key, else returns false. 13 | */ 14 | bool signed_by(const public_key_type& k); 15 | 16 | bool check_authority(const account_name_type& id); 17 | 18 | /** 19 | * Checks to see if we have signatures of the active authorites of 20 | * the accounts specified in authority or the keys specified. 21 | */ 22 | bool check_authority(const authority& au, uint32_t depth = 0); 23 | 24 | bool remove_unused_signatures(); 25 | 26 | bool filter_unused_approvals(); 27 | 28 | sign_state( 29 | const flat_set& sigs, 30 | const authority_getter& a, 31 | const flat_set& keys); 32 | 33 | const authority_getter& get_active; 34 | const fc::flat_set& available_keys; 35 | 36 | fc::flat_map provided_signatures; 37 | std::vector unused_signatures; 38 | std::vector used_signatures; 39 | fc::flat_map approved_by; 40 | std::vector unused_approvals; 41 | uint32_t max_recursion = STEEMIT_MAX_SIG_CHECK_DEPTH; 42 | }; 43 | 44 | } } // golos::protocol 45 | -------------------------------------------------------------------------------- /libraries/protocol/include/golos/protocol/worker_exceptions.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | // State exceptions and related 6 | 7 | #define REQUEST_STATE worker_request_state 8 | 9 | #define CHECK_REQUEST_STATE(EXPR, MSG) \ 10 | GOLOS_CHECK_LOGIC(EXPR, \ 11 | logic_exception::incorrect_request_state, \ 12 | MSG) 13 | 14 | // Some another helpers 15 | 16 | #define CHECK_NO_VOTE_REPEAT(STATE1, STATE2) \ 17 | GOLOS_CHECK_LOGIC(STATE1 != STATE2, \ 18 | logic_exception::already_voted_in_similar_way, \ 19 | "You already have voted for this object with this state") 20 | 21 | #define CHECK_POST(POST) \ 22 | GOLOS_CHECK_LOGIC(POST.parent_author == STEEMIT_ROOT_POST_PARENT, \ 23 | logic_exception::post_is_not_root, \ 24 | "Can be created only on root post"); \ 25 | GOLOS_CHECK_LOGIC(POST.cashout_time != fc::time_point_sec::maximum(), \ 26 | logic_exception::post_should_be_in_cashout_window, \ 27 | "Post should be in cashout window") 28 | -------------------------------------------------------------------------------- /libraries/protocol/operation_util_impl.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace fc { 4 | 5 | std::string name_from_type(const std::string &type_name) { 6 | auto start = type_name.find_last_of(':') + 1; 7 | auto end = type_name.find_last_of('_'); 8 | return type_name.substr(start, end - start); 9 | } 10 | 11 | } // fc 12 | -------------------------------------------------------------------------------- /libraries/time/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "include/golos/time/*.hpp") 2 | 3 | if(BUILD_SHARED_LIBRARIES) 4 | add_library(graphene_time SHARED 5 | time.cpp 6 | ) 7 | else() 8 | add_library(graphene_time STATIC 9 | time.cpp 10 | ) 11 | endif() 12 | 13 | target_link_libraries(graphene_time fc) 14 | target_include_directories(graphene_time 15 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") 16 | 17 | install(TARGETS 18 | graphene_time 19 | 20 | RUNTIME DESTINATION bin 21 | LIBRARY DESTINATION lib 22 | ARCHIVE DESTINATION lib 23 | ) 24 | install(FILES ${HEADERS} DESTINATION "include/golos/time") 25 | -------------------------------------------------------------------------------- /libraries/time/include/golos/time/time.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace golos { 8 | namespace time { 9 | 10 | typedef fc::signal time_discontinuity_signal_type; 11 | extern time_discontinuity_signal_type time_discontinuity_signal; 12 | 13 | fc::time_point now(); 14 | 15 | void start_simulated_time(const fc::time_point sim_time); 16 | 17 | void advance_simulated_time_to(const fc::time_point sim_time); 18 | 19 | void advance_time(int32_t delta_seconds); 20 | 21 | } 22 | } // golos::time 23 | -------------------------------------------------------------------------------- /libraries/time/time.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | namespace golos { 11 | namespace time { 12 | 13 | static int32_t simulated_time = 0; 14 | static int32_t adjusted_time_sec = 0; 15 | 16 | time_discontinuity_signal_type time_discontinuity_signal; 17 | 18 | fc::time_point now() { 19 | if (simulated_time) { 20 | return fc::time_point() + 21 | fc::seconds(simulated_time + adjusted_time_sec); 22 | } 23 | 24 | return fc::time_point::now() + fc::seconds(adjusted_time_sec); 25 | } 26 | 27 | void start_simulated_time(const fc::time_point sim_time) { 28 | simulated_time = sim_time.sec_since_epoch(); 29 | adjusted_time_sec = 0; 30 | } 31 | 32 | void advance_simulated_time_to(const fc::time_point sim_time) { 33 | simulated_time = sim_time.sec_since_epoch(); 34 | adjusted_time_sec = 0; 35 | } 36 | 37 | void advance_time(int32_t delta_seconds) { 38 | adjusted_time_sec += delta_seconds; 39 | time_discontinuity_signal(); 40 | } 41 | 42 | } 43 | } // golos::time 44 | -------------------------------------------------------------------------------- /libraries/utilities/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/libraries/fc/GitVersionGen") 2 | include(GetGitRevisionDescription) 3 | get_git_head_revision(GIT_REFSPEC GRAPHENE_GIT_REVISION_SHA) 4 | get_git_unix_timestamp(GRAPHENE_GIT_REVISION_UNIX_TIMESTAMP) 5 | git_describe(GRAPHENE_GIT_REVISION_DESCRIPTION --tags) 6 | if(NOT GRAPHENE_GIT_REVISION_DESCRIPTION) 7 | set(GRAPHENE_GIT_REVISION_DESCRIPTION "unknown") 8 | endif(NOT GRAPHENE_GIT_REVISION_DESCRIPTION) 9 | 10 | file(GLOB HEADERS "include/graphene/utilities/*.hpp") 11 | 12 | set(sources 13 | key_conversion.cpp 14 | string_escape.cpp 15 | tempdir.cpp 16 | words.cpp 17 | ${HEADERS}) 18 | 19 | configure_file("${CMAKE_CURRENT_SOURCE_DIR}/git_revision.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/git_revision.cpp" @ONLY) 20 | list(APPEND sources "${CMAKE_CURRENT_BINARY_DIR}/git_revision.cpp") 21 | 22 | if(BUILD_SHARED_LIBRARIES) 23 | add_library(graphene_utilities SHARED 24 | ${sources} 25 | ${HEADERS}) 26 | else() 27 | add_library(graphene_utilities STATIC 28 | ${sources} 29 | ${HEADERS}) 30 | endif() 31 | target_link_libraries(graphene_utilities fc) 32 | target_include_directories(graphene_utilities 33 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") 34 | if(USE_PCH) 35 | set_target_properties(graphene_utilities PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE) 36 | cotire(graphene_utilities) 37 | endif(USE_PCH) 38 | 39 | install(TARGETS 40 | graphene_utilities 41 | 42 | RUNTIME DESTINATION bin 43 | LIBRARY DESTINATION lib 44 | ARCHIVE DESTINATION lib 45 | ) 46 | install(FILES ${HEADERS} DESTINATION "include/graphene/utilities") 47 | -------------------------------------------------------------------------------- /libraries/utilities/git_revision.cpp.in: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define GRAPHENE_GIT_REVISION_SHA "@GRAPHENE_GIT_REVISION_SHA@" 5 | #define GRAPHENE_GIT_REVISION_UNIX_TIMESTAMP @GRAPHENE_GIT_REVISION_UNIX_TIMESTAMP@ 6 | #define GRAPHENE_GIT_REVISION_DESCRIPTION "@GRAPHENE_GIT_REVISION_DESCRIPTION@" 7 | 8 | namespace golos { 9 | namespace utilities { 10 | 11 | const char *const git_revision_sha = GRAPHENE_GIT_REVISION_SHA; 12 | const uint32_t git_revision_unix_timestamp = GRAPHENE_GIT_REVISION_UNIX_TIMESTAMP; 13 | const char *const git_revision_description = GRAPHENE_GIT_REVISION_DESCRIPTION; 14 | 15 | } 16 | } // end namespace golos::utilities 17 | -------------------------------------------------------------------------------- /libraries/utilities/include/graphene/utilities/git_revision.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Cryptonomex, Inc., and contributors. 3 | * 4 | * The MIT License 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | #pragma once 25 | 26 | #include 27 | 28 | namespace golos { 29 | namespace utilities { 30 | 31 | extern const char *const git_revision_sha; 32 | extern const uint32_t git_revision_unix_timestamp; 33 | extern const char *const git_revision_description; 34 | 35 | } 36 | } // end namespace golos::utilities 37 | -------------------------------------------------------------------------------- /libraries/utilities/include/graphene/utilities/key_conversion.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Cryptonomex, Inc., and contributors. 3 | * 4 | * The MIT License 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | #pragma once 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | namespace golos { 31 | namespace utilities { 32 | 33 | std::string key_to_wif(const fc::sha256 &private_secret); 34 | 35 | std::string key_to_wif(const fc::ecc::private_key &key); 36 | 37 | fc::optional wif_to_key(const std::string &wif_key); 38 | 39 | } 40 | } // end namespace golos::utilities 41 | -------------------------------------------------------------------------------- /libraries/utilities/include/graphene/utilities/string_escape.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Cryptonomex, Inc., and contributors. 3 | * 4 | * The MIT License 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | #pragma once 25 | 26 | #include 27 | 28 | namespace golos { 29 | namespace utilities { 30 | 31 | std::string escape_string_for_c_source_code(const std::string &input); 32 | 33 | } 34 | } // end namespace golos::utilities 35 | -------------------------------------------------------------------------------- /libraries/utilities/include/graphene/utilities/tempdir.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Cryptonomex, Inc., and contributors. 3 | * 4 | * The MIT License 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | #pragma once 25 | 26 | #include 27 | 28 | #include 29 | 30 | namespace golos { 31 | namespace utilities { 32 | 33 | fc::path temp_directory_path(); 34 | 35 | } 36 | } // golos::utilities 37 | -------------------------------------------------------------------------------- /libraries/utilities/include/graphene/utilities/words.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace golos { 4 | namespace words { 5 | 6 | typedef const char *const_char_ptr; 7 | extern const const_char_ptr word_list[]; 8 | extern const uint32_t word_list_size; 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /libraries/utilities/tempdir.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Cryptonomex, Inc., and contributors. 3 | * 4 | * The MIT License 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | #include 26 | 27 | namespace golos { 28 | namespace utilities { 29 | 30 | fc::path temp_directory_path() { 31 | const char *graphene_tempdir = getenv("GRAPHENE_TEMPDIR"); 32 | if (graphene_tempdir != nullptr) { 33 | return fc::path(graphene_tempdir); 34 | } 35 | return fc::temp_directory_path() / "golos-tmp"; 36 | } 37 | 38 | } 39 | } // golos::utilities 40 | -------------------------------------------------------------------------------- /libraries/wallet/include/golos/wallet/time_converter.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace golos { namespace wallet { 6 | 7 | class time_converter { 8 | private: 9 | time_point_sec tps; 10 | public: 11 | time_converter(const std::string& s, const time_point_sec& start_tps, const time_point_sec& default_tps) { 12 | if (s.empty()) { 13 | tps = default_tps; 14 | return; 15 | } 16 | if (s.at(0) == '+') { 17 | tps = start_tps; 18 | tps += std::stoi(s.substr(1)); 19 | return; 20 | } 21 | if (s.at(0) == '-') { 22 | tps = start_tps; 23 | tps -= std::stoi(s.substr(1)); 24 | return; 25 | } 26 | tps = time_point_sec::from_iso_string(s); 27 | if (tps.sec_since_epoch() == 0) { 28 | tps = default_tps; 29 | return; 30 | } 31 | } 32 | 33 | time_point_sec time() { 34 | return tps; 35 | } 36 | }; 37 | 38 | } 39 | } // golos::wallet -------------------------------------------------------------------------------- /plugins/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # for each subdirectory containing a CMakeLists.txt, add that subdirectory 2 | set(ENV{STEEMIT_INTERNAL_PLUGINS} "") 3 | file(GLOB children RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *) 4 | foreach(child ${children}) 5 | if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${child}") 6 | if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${child}/CMakeLists.txt") 7 | add_subdirectory("${child}") 8 | set(ENV{STEEMIT_INTERNAL_PLUGINS} "$ENV{STEEMIT_INTERNAL_PLUGINS};${child}") 9 | endif() 10 | endif() 11 | endforeach() 12 | -------------------------------------------------------------------------------- /plugins/account_by_key/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET account_by_key) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/account_by_key/account_by_key_objects.hpp 5 | include/golos/plugins/account_by_key/account_by_key_plugin.hpp 6 | ) 7 | 8 | list(APPEND CURRENT_TARGET_SOURCES 9 | account_by_key_plugin.cpp 10 | ) 11 | 12 | if(BUILD_SHARED_LIBRARIES) 13 | add_library(golos_${CURRENT_TARGET} SHARED 14 | ${CURRENT_TARGET_HEADERS} 15 | ${CURRENT_TARGET_SOURCES} 16 | ) 17 | else() 18 | add_library(golos_${CURRENT_TARGET} STATIC 19 | ${CURRENT_TARGET_HEADERS} 20 | ${CURRENT_TARGET_SOURCES} 21 | ) 22 | endif() 23 | 24 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 25 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 26 | 27 | target_link_libraries( 28 | golos_${CURRENT_TARGET} 29 | golos::chain_plugin 30 | golos::p2p 31 | golos::protocol 32 | golos::network 33 | graphene_utilities 34 | graphene_time 35 | appbase 36 | ) 37 | target_include_directories(golos_${CURRENT_TARGET} 38 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") 39 | 40 | install(TARGETS 41 | golos_${CURRENT_TARGET} 42 | 43 | RUNTIME DESTINATION bin 44 | LIBRARY DESTINATION lib 45 | ARCHIVE DESTINATION lib 46 | ) -------------------------------------------------------------------------------- /plugins/account_history/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET account_history) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/account_history/plugin.hpp 5 | include/golos/plugins/account_history/history_object.hpp 6 | ) 7 | 8 | list(APPEND CURRENT_TARGET_SOURCES 9 | plugin.cpp 10 | ) 11 | 12 | if (BUILD_SHARED_LIBRARIES) 13 | add_library(golos_${CURRENT_TARGET} SHARED 14 | ${CURRENT_TARGET_HEADERS} 15 | ${CURRENT_TARGET_SOURCES} 16 | ) 17 | else() 18 | add_library(golos_${CURRENT_TARGET} STATIC 19 | ${CURRENT_TARGET_HEADERS} 20 | ${CURRENT_TARGET_SOURCES} 21 | ) 22 | endif() 23 | 24 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 25 | 26 | target_link_libraries ( 27 | golos_${CURRENT_TARGET} 28 | golos_chain 29 | golos_chain_plugin 30 | golos_protocol 31 | golos::operation_history 32 | appbase 33 | golos_json_rpc 34 | graphene_time 35 | chainbase 36 | fc 37 | ) 38 | 39 | target_include_directories(golos_${CURRENT_TARGET} 40 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" 41 | "${CMAKE_CURRENT_SOURCE_DIR}/../../" 42 | ) 43 | 44 | install(TARGETS 45 | golos_${CURRENT_TARGET} 46 | 47 | RUNTIME DESTINATION bin 48 | LIBRARY DESTINATION lib 49 | ARCHIVE DESTINATION lib 50 | ) -------------------------------------------------------------------------------- /plugins/account_notes/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET account_notes) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/account_notes/account_notes_plugin.hpp 5 | ) 6 | 7 | list(APPEND CURRENT_TARGET_SOURCES 8 | account_notes_evaluators.cpp 9 | account_notes_operations.cpp 10 | account_notes_plugin.cpp 11 | ) 12 | 13 | if(BUILD_SHARED_LIBRARIES) 14 | add_library(golos_${CURRENT_TARGET} SHARED 15 | ${CURRENT_TARGET_HEADERS} 16 | ${CURRENT_TARGET_SOURCES} 17 | ) 18 | else() 19 | add_library(golos_${CURRENT_TARGET} STATIC 20 | ${CURRENT_TARGET_HEADERS} 21 | ${CURRENT_TARGET_SOURCES} 22 | ) 23 | endif() 24 | 25 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 26 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 27 | 28 | target_link_libraries( 29 | golos_${CURRENT_TARGET} 30 | golos::chain_plugin 31 | golos::protocol 32 | golos::network 33 | golos::json_rpc 34 | graphene_utilities 35 | graphene_time 36 | appbase 37 | ) 38 | target_include_directories(golos_${CURRENT_TARGET} 39 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") 40 | 41 | install(TARGETS 42 | golos_${CURRENT_TARGET} 43 | 44 | RUNTIME DESTINATION bin 45 | LIBRARY DESTINATION lib 46 | ARCHIVE DESTINATION lib 47 | ) 48 | 49 | -------------------------------------------------------------------------------- /plugins/account_notes/include/golos/plugins/account_notes/account_notes_api_objects.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace golos { namespace plugins { namespace account_notes { 4 | 5 | struct account_notes_settings_api_object { 6 | account_notes_settings_api_object() = default; 7 | 8 | account_notes_settings_api_object(uint16_t max_kl, uint16_t max_vl, uint16_t max_nc) 9 | : max_key_length(max_kl), max_value_length(max_vl), max_note_count(max_nc) { 10 | } 11 | 12 | uint16_t max_key_length = 0; 13 | uint16_t max_value_length = 0; 14 | uint16_t max_note_count = 0; 15 | flat_set tracked_accounts; 16 | flat_set untracked_accounts; 17 | }; 18 | 19 | } } } // golos::plugins::account_notes 20 | 21 | FC_REFLECT((golos::plugins::account_notes::account_notes_settings_api_object), 22 | (max_key_length)(max_value_length)(max_note_count)(tracked_accounts)(untracked_accounts)); 23 | -------------------------------------------------------------------------------- /plugins/account_notes/include/golos/plugins/account_notes/account_notes_evaluators.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | namespace golos { namespace plugins { namespace account_notes { 9 | 10 | using golos::chain::database; 11 | using golos::chain::evaluator; 12 | using golos::chain::evaluator_impl; 13 | 14 | class set_value_evaluator : public evaluator_impl { 15 | public: 16 | using operation_type = set_value_operation; 17 | 18 | set_value_evaluator(database& db, const account_notes_settings_api_object* settings) 19 | : evaluator_impl(db), settings_(settings) { 20 | } 21 | 22 | void do_apply(const set_value_operation& o); 23 | 24 | private: 25 | bool is_tracked_account(const account_name_type& account); 26 | 27 | const account_notes_settings_api_object* settings_; 28 | }; 29 | 30 | } } } // golos::plugins::account_notes 31 | -------------------------------------------------------------------------------- /plugins/account_notes/include/golos/plugins/account_notes/account_notes_operations.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace golos { namespace plugins { namespace account_notes { 7 | 8 | using golos::protocol::base_operation; 9 | using golos::protocol::account_name_type; 10 | 11 | struct set_value_operation : base_operation { 12 | account_name_type account; 13 | string key; 14 | string value; 15 | 16 | void validate() const; 17 | 18 | bool is_posting() const { 19 | std::string pst = "pst."; 20 | std::string g_pst = "g.pst."; 21 | if (key.size() >= pst.size()) { 22 | if (key.substr(0, pst.size()) == pst) return true; 23 | } else { 24 | return false; 25 | } 26 | if (key.substr(0, g_pst.size()) == g_pst) return true; 27 | return false; 28 | } 29 | 30 | void get_required_active_authorities(flat_set& a) const { 31 | if (!is_posting()) a.insert(account); 32 | } 33 | 34 | void get_required_posting_authorities(flat_set& a) const { 35 | if (is_posting()) a.insert(account); 36 | } 37 | }; 38 | 39 | using account_notes_plugin_operation = fc::static_variant; 40 | 41 | } } } // golos::plugins::account_notes 42 | 43 | FC_REFLECT((golos::plugins::account_notes::set_value_operation), (account)(key)(value)); 44 | 45 | FC_REFLECT_TYPENAME((golos::plugins::account_notes::account_notes_plugin_operation)); 46 | DECLARE_OPERATION_TYPE(golos::plugins::account_notes::account_notes_plugin_operation) 47 | -------------------------------------------------------------------------------- /plugins/account_notes/include/golos/plugins/account_notes/account_notes_plugin.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | namespace golos { namespace plugins { namespace account_notes { 10 | 11 | using namespace golos::chain; 12 | 13 | using key_values = std::map; 14 | 15 | DEFINE_API_ARGS(get_values, json_rpc::msg_pack, key_values) 16 | DEFINE_API_ARGS(get_values_settings, json_rpc::msg_pack, account_notes_settings_api_object) 17 | 18 | /** 19 | * This plugin provides the support of key-value storage for additional data for the accounts. 20 | * 21 | */ 22 | class account_notes_plugin final : public appbase::plugin { 23 | public: 24 | APPBASE_PLUGIN_REQUIRES((json_rpc::plugin)) 25 | 26 | account_notes_plugin(); 27 | 28 | ~account_notes_plugin(); 29 | 30 | void set_program_options( 31 | boost::program_options::options_description& cli, 32 | boost::program_options::options_description& cfg) override; 33 | 34 | void plugin_initialize(const boost::program_options::variables_map& options) override; 35 | 36 | void plugin_startup() override; 37 | 38 | void plugin_shutdown() override; 39 | 40 | static const std::string& name(); 41 | 42 | DECLARE_API( 43 | (get_values) 44 | (get_values_settings) 45 | ) 46 | 47 | private: 48 | class account_notes_plugin_impl; 49 | 50 | std::unique_ptr my; 51 | }; 52 | 53 | } } } //golos::plugins::account_notes 54 | -------------------------------------------------------------------------------- /plugins/account_relations/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET account_relations) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/account_relations/account_relations.hpp 5 | include/golos/plugins/account_relations/account_relation_api_object.hpp 6 | ) 7 | 8 | list(APPEND CURRENT_TARGET_SOURCES 9 | account_relations.cpp 10 | ) 11 | 12 | if(BUILD_SHARED_LIBRARIES) 13 | add_library(golos_${CURRENT_TARGET} SHARED 14 | ${CURRENT_TARGET_HEADERS} 15 | ${CURRENT_TARGET_SOURCES} 16 | ) 17 | else() 18 | add_library(golos_${CURRENT_TARGET} STATIC 19 | ${CURRENT_TARGET_HEADERS} 20 | ${CURRENT_TARGET_SOURCES} 21 | ) 22 | endif() 23 | 24 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 25 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 26 | 27 | target_link_libraries( 28 | golos_${CURRENT_TARGET} 29 | golos::chain_plugin 30 | golos::json_rpc 31 | golos::social_network 32 | golos::tags 33 | appbase 34 | ) 35 | 36 | target_include_directories(golos_${CURRENT_TARGET} 37 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") 38 | 39 | install(TARGETS 40 | golos_${CURRENT_TARGET} 41 | 42 | RUNTIME DESTINATION bin 43 | LIBRARY DESTINATION lib 44 | ARCHIVE DESTINATION lib 45 | ) 46 | -------------------------------------------------------------------------------- /plugins/account_relations/include/golos/plugins/account_relations/account_relations.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | namespace golos { namespace plugins { namespace account_relations { 9 | 10 | namespace bpo = boost::program_options; 11 | using namespace golos::chain; 12 | 13 | DEFINE_API_ARGS(list_account_relations, json_rpc::msg_pack, fc::mutable_variant_object) 14 | DEFINE_API_ARGS(get_account_relations, json_rpc::msg_pack, fc::mutable_variant_object) 15 | 16 | class account_relations final : public appbase::plugin { 17 | public: 18 | 19 | APPBASE_PLUGIN_REQUIRES((json_rpc::plugin)(chain::plugin)) 20 | 21 | account_relations(); 22 | 23 | virtual ~account_relations(); 24 | 25 | void set_program_options(bpo::options_description& cli, bpo::options_description& cfg) override; 26 | 27 | void plugin_initialize(const bpo::variables_map& options) override; 28 | 29 | void plugin_startup() override; 30 | 31 | void plugin_shutdown() override; 32 | 33 | static const std::string& name(); 34 | 35 | DECLARE_API( 36 | (list_account_relations) 37 | (get_account_relations) 38 | ) 39 | private: 40 | class impl; 41 | 42 | std::unique_ptr my; 43 | }; 44 | 45 | } } } // golos::plugins::account_relations 46 | -------------------------------------------------------------------------------- /plugins/auth_util/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET auth_util) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/auth_util/plugin.hpp 5 | ) 6 | 7 | list(APPEND CURRENT_TARGET_SOURCES 8 | plugin.cpp 9 | ) 10 | 11 | if (BUILD_SHARED_LIBRARIES) 12 | add_library(golos_${CURRENT_TARGET} SHARED 13 | ${CURRENT_TARGET_HEADERS} 14 | ${CURRENT_TARGET_SOURCES} 15 | ) 16 | else() 17 | add_library(golos_${CURRENT_TARGET} STATIC 18 | ${CURRENT_TARGET_HEADERS} 19 | ${CURRENT_TARGET_SOURCES} 20 | ) 21 | endif() 22 | 23 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 24 | 25 | target_link_libraries ( 26 | golos_${CURRENT_TARGET} 27 | golos_chain 28 | golos_chain_plugin 29 | golos_protocol 30 | appbase 31 | fc 32 | ) 33 | 34 | target_include_directories(golos_${CURRENT_TARGET} 35 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" 36 | "${CMAKE_CURRENT_SOURCE_DIR}/../../" 37 | ) 38 | 39 | install(TARGETS 40 | golos_${CURRENT_TARGET} 41 | 42 | RUNTIME DESTINATION bin 43 | LIBRARY DESTINATION lib 44 | ARCHIVE DESTINATION lib 45 | ) 46 | -------------------------------------------------------------------------------- /plugins/auth_util/include/golos/plugins/auth_util/plugin.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | namespace golos { 13 | namespace plugins { 14 | namespace auth_util { 15 | 16 | using golos::plugins::json_rpc::msg_pack; 17 | 18 | 19 | DEFINE_API_ARGS ( check_authority_signature, msg_pack, std::vector) 20 | 21 | class plugin final : public appbase::plugin { 22 | public: 23 | constexpr static const char *plugin_name = "auth_util"; 24 | 25 | APPBASE_PLUGIN_REQUIRES((chain::plugin)) 26 | 27 | static const std::string &name() { 28 | static std::string name = plugin_name; 29 | return name; 30 | } 31 | 32 | plugin(); 33 | 34 | ~plugin(); 35 | 36 | void set_program_options(boost::program_options::options_description &cli, 37 | boost::program_options::options_description &cfg) override; 38 | 39 | void plugin_initialize(const boost::program_options::variables_map &options) override; 40 | 41 | void plugin_startup() override; 42 | 43 | void plugin_shutdown() override { 44 | } 45 | 46 | DECLARE_API ( 47 | (check_authority_signature) 48 | ) 49 | 50 | private: 51 | struct plugin_impl; 52 | 53 | std::unique_ptr my; 54 | }; 55 | 56 | } 57 | } 58 | } // golos::plugins::auth_util 59 | 60 | -------------------------------------------------------------------------------- /plugins/block_info/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET block_info) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/block_info/plugin.hpp 5 | include/golos/plugins/block_info/block_info.hpp 6 | ) 7 | 8 | list(APPEND CURRENT_TARGET_SOURCES 9 | plugin.cpp 10 | ) 11 | 12 | if(BUILD_SHARED_LIBRARIES) 13 | add_library(golos_${CURRENT_TARGET} SHARED 14 | ${CURRENT_TARGET_HEADERS} 15 | ${CURRENT_TARGET_SOURCES} 16 | ) 17 | else() 18 | add_library(golos_${CURRENT_TARGET} STATIC 19 | ${CURRENT_TARGET_HEADERS} 20 | ${CURRENT_TARGET_SOURCES} 21 | ) 22 | endif() 23 | 24 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 25 | 26 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 27 | 28 | target_link_libraries( 29 | golos_${CURRENT_TARGET} 30 | golos_chain 31 | golos_protocol 32 | appbase 33 | golos_chain_plugin 34 | golos::json_rpc 35 | fc 36 | ) 37 | 38 | target_include_directories( 39 | golos_${CURRENT_TARGET} 40 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" 41 | "${CMAKE_CURRENT_SOURCE_DIR}/../../" 42 | ) 43 | 44 | install(TARGETS 45 | golos_${CURRENT_TARGET} 46 | 47 | RUNTIME DESTINATION bin 48 | LIBRARY DESTINATION lib 49 | ARCHIVE DESTINATION lib 50 | ) 51 | -------------------------------------------------------------------------------- /plugins/block_info/include/golos/plugins/block_info/block_info.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace golos { 6 | namespace plugins { 7 | namespace block_info { 8 | 9 | struct block_info { 10 | golos::chain::block_id_type block_id; 11 | uint32_t block_size = 0; 12 | uint32_t average_block_size = 0; 13 | uint64_t aslot = 0; 14 | uint32_t last_irreversible_block_num = 0; 15 | uint32_t num_pow_witnesses = 0; 16 | }; 17 | 18 | struct block_with_info { 19 | golos::chain::signed_block block; 20 | block_info info; 21 | }; 22 | 23 | } } } 24 | 25 | 26 | FC_REFLECT( (golos::plugins::block_info::block_info), 27 | (block_id) 28 | (block_size) 29 | (average_block_size) 30 | (aslot) 31 | (last_irreversible_block_num) 32 | (num_pow_witnesses) 33 | ) 34 | 35 | 36 | FC_REFLECT( (golos::plugins::block_info::block_with_info), 37 | (block) 38 | (info) 39 | ) 40 | -------------------------------------------------------------------------------- /plugins/chain/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET chain_plugin) 2 | list(APPEND CURRENT_TARGET_HEADERS 3 | include/golos/plugins/chain/plugin.hpp 4 | ) 5 | 6 | list(APPEND CURRENT_TARGET_SOURCES 7 | plugin.cpp 8 | serialize_state.cpp 9 | ) 10 | 11 | if(BUILD_SHARED_LIBRARIES) 12 | add_library(golos_${CURRENT_TARGET} SHARED 13 | ${CURRENT_TARGET_HEADERS} 14 | ${CURRENT_TARGET_SOURCES} 15 | ) 16 | else() 17 | add_library(golos_${CURRENT_TARGET} STATIC 18 | ${CURRENT_TARGET_HEADERS} 19 | ${CURRENT_TARGET_SOURCES} 20 | ) 21 | endif() 22 | 23 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 24 | 25 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 26 | 27 | target_link_libraries( 28 | golos_${CURRENT_TARGET} 29 | golos_chain 30 | golos_protocol 31 | fc 32 | appbase 33 | golos::json_rpc 34 | ) 35 | target_include_directories(golos_${CURRENT_TARGET} 36 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/../../") 37 | 38 | install(TARGETS 39 | golos_${CURRENT_TARGET} 40 | RUNTIME DESTINATION bin 41 | LIBRARY DESTINATION lib 42 | ARCHIVE DESTINATION lib 43 | ) 44 | install(FILES ${HEADERS} DESTINATION "include/golos/chain_plugin") 45 | -------------------------------------------------------------------------------- /plugins/chain/serialize_state.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // this file must only be included from serialize_state.cpp 4 | // required to declare some packers before so they become visible to compiler 5 | 6 | namespace fc { 7 | class uint128_t; 8 | template class fixed_string; 9 | } 10 | namespace golos { namespace chain { 11 | using account_name_type = fc::fixed_string; 12 | struct shared_authority; 13 | class comment_object; 14 | class savings_withdraw_object; 15 | }} 16 | namespace golos { namespace protocol { 17 | struct beneficiary_route_type; 18 | }} 19 | 20 | 21 | namespace fc { namespace raw { 22 | 23 | template void pack(S&, const golos::chain::comment_object&); 24 | template void pack(S&, const golos::chain::savings_withdraw_object&); 25 | template void pack(S&, const golos::chain::account_name_type&); 26 | template void pack(S&, const golos::chain::shared_authority&); 27 | template void pack(S&, const golos::protocol::beneficiary_route_type&); 28 | 29 | }} // fc::raw 30 | -------------------------------------------------------------------------------- /plugins/cryptor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET cryptor) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/cryptor/cryptor.hpp 5 | include/golos/plugins/cryptor/cryptor_queries.hpp 6 | ) 7 | 8 | list(APPEND CURRENT_TARGET_SOURCES 9 | cryptor.cpp 10 | ) 11 | 12 | if(BUILD_SHARED_LIBRARIES) 13 | add_library(golos_${CURRENT_TARGET} SHARED 14 | ${CURRENT_TARGET_HEADERS} 15 | ${CURRENT_TARGET_SOURCES} 16 | ) 17 | else() 18 | add_library(golos_${CURRENT_TARGET} STATIC 19 | ${CURRENT_TARGET_HEADERS} 20 | ${CURRENT_TARGET_SOURCES} 21 | ) 22 | endif() 23 | 24 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 25 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 26 | 27 | target_link_libraries( 28 | golos_${CURRENT_TARGET} 29 | golos::chain_plugin 30 | golos::json_rpc 31 | golos::paid_subscription_api 32 | golos::private_message 33 | golos::social_network 34 | appbase 35 | ) 36 | 37 | target_include_directories(golos_${CURRENT_TARGET} 38 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") 39 | 40 | install(TARGETS 41 | golos_${CURRENT_TARGET} 42 | 43 | RUNTIME DESTINATION bin 44 | LIBRARY DESTINATION lib 45 | ARCHIVE DESTINATION lib 46 | ) 47 | -------------------------------------------------------------------------------- /plugins/cryptor/include/golos/plugins/cryptor/cryptor.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | namespace golos { namespace plugins { namespace cryptor { 12 | 13 | namespace bpo = boost::program_options; 14 | using namespace golos::chain; 15 | 16 | DEFINE_API_ARGS(encrypt_body, json_rpc::msg_pack, encrypted_api_object) 17 | DEFINE_API_ARGS(decrypt_comments, json_rpc::msg_pack, decrypted_api_object) 18 | DEFINE_API_ARGS(decrypt_messages, json_rpc::msg_pack, decrypted_api_object) 19 | 20 | class cryptor final : public appbase::plugin { 21 | public: 22 | 23 | APPBASE_PLUGIN_REQUIRES((json_rpc::plugin)(chain::plugin)(paid_subscription_api::paid_subscription_api_plugin)) 24 | 25 | cryptor(); 26 | 27 | virtual ~cryptor(); 28 | 29 | void set_program_options(bpo::options_description& cli, bpo::options_description& cfg) override; 30 | 31 | void plugin_initialize(const bpo::variables_map& options) override; 32 | 33 | void plugin_startup() override; 34 | 35 | void plugin_shutdown() override; 36 | 37 | static const std::string& name(); 38 | 39 | DECLARE_API( 40 | (encrypt_body) 41 | (decrypt_comments) 42 | (decrypt_messages) 43 | ) 44 | 45 | decrypted_api_object our_decrypt_messages(const decrypt_messages_query& query) const; 46 | private: 47 | class cryptor_impl; 48 | 49 | std::unique_ptr my; 50 | }; 51 | 52 | } } } // golos::plugins::cryptor 53 | -------------------------------------------------------------------------------- /plugins/database_api/account_recovery_api_object.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/golos-blockchain/chain-node/5c2289a5ba5e460b4dd84aa611f4d9dd2aa7957b/plugins/database_api/account_recovery_api_object.cpp -------------------------------------------------------------------------------- /plugins/database_api/include/golos/plugins/database_api/api_objects/account_query.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace golos { 8 | namespace plugins { 9 | namespace database_api { 10 | struct account_query { 11 | account_name_type current; 12 | }; 13 | } 14 | } 15 | } 16 | 17 | FC_REFLECT((golos::plugins::database_api::account_query), 18 | (current) 19 | ) 20 | -------------------------------------------------------------------------------- /plugins/database_api/include/golos/plugins/database_api/api_objects/account_recovery_request_api_object.hpp: -------------------------------------------------------------------------------- 1 | #ifndef GOLOS_ACCOUNT_RECOVERY_REQUEST_API_OBJ_HPP 2 | #define GOLOS_ACCOUNT_RECOVERY_REQUEST_API_OBJ_HPP 3 | 4 | #include 5 | 6 | namespace golos { 7 | namespace plugins { 8 | namespace database_api { 9 | using golos::chain::account_recovery_request_object; 10 | 11 | struct account_recovery_request_api_object { 12 | account_recovery_request_api_object(const golos::chain::account_recovery_request_object &o) : id(o.id), 13 | account_to_recover(o.account_to_recover), new_owner_authority(authority(o.new_owner_authority)), 14 | expires(o.expires) { 15 | } 16 | 17 | account_recovery_request_api_object() { 18 | } 19 | 20 | account_recovery_request_object::id_type id; 21 | account_name_type account_to_recover; 22 | authority new_owner_authority; 23 | time_point_sec expires; 24 | }; 25 | } 26 | } 27 | } 28 | 29 | 30 | FC_REFLECT((golos::plugins::database_api::account_recovery_request_api_object), 31 | (id)(account_to_recover)(new_owner_authority)(expires)) 32 | 33 | 34 | #endif //GOLOS_ACCOUNT_RECOVERY_REQUEST_API_OBJ_HPP 35 | -------------------------------------------------------------------------------- /plugins/database_api/include/golos/plugins/database_api/api_objects/asset_api_sort.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace golos { namespace plugins { namespace database_api { 4 | 5 | enum class asset_api_sort { 6 | by_symbol_name, 7 | by_marketed, 8 | }; 9 | 10 | } } } // golos::plugins::database_api 11 | 12 | FC_REFLECT_ENUM(golos::plugins::database_api::asset_api_sort, (by_symbol_name)(by_marketed)) 13 | -------------------------------------------------------------------------------- /plugins/database_api/include/golos/plugins/database_api/api_objects/owner_authority_history_api_object.hpp: -------------------------------------------------------------------------------- 1 | #ifndef GOLOS_OWNER_AUTHORITY_HISTORY_API_OBJ_HPP 2 | #define GOLOS_OWNER_AUTHORITY_HISTORY_API_OBJ_HPP 3 | 4 | #include 5 | 6 | namespace golos { 7 | namespace plugins { 8 | namespace database_api { 9 | 10 | using protocol::authority; 11 | using golos::protocol::account_name_type; 12 | using golos::chain::owner_authority_history_object; 13 | 14 | struct owner_authority_history_api_object { 15 | owner_authority_history_api_object(const golos::chain::owner_authority_history_object &o) : id(o.id), 16 | account(o.account), previous_owner_authority(authority(o.previous_owner_authority)), 17 | last_valid_time(o.last_valid_time) { 18 | } 19 | 20 | owner_authority_history_api_object() { 21 | } 22 | 23 | owner_authority_history_object::id_type id; 24 | 25 | account_name_type account; 26 | authority previous_owner_authority; 27 | time_point_sec last_valid_time; 28 | }; 29 | } 30 | } 31 | } 32 | 33 | FC_REFLECT((golos::plugins::database_api::owner_authority_history_api_object), 34 | (id)(account)(previous_owner_authority)(last_valid_time)) 35 | #endif //GOLOS_OWNER_AUTHORITY_HISTORY_API_OBJ_HPP 36 | -------------------------------------------------------------------------------- /plugins/database_api/include/golos/plugins/database_api/api_objects/proposal_api_object.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | #include 8 | 9 | namespace golos { namespace plugins { namespace database_api { 10 | 11 | struct proposal_api_object final { 12 | proposal_api_object() = default; 13 | 14 | proposal_api_object(const golos::chain::proposal_object& p); 15 | 16 | protocol::account_name_type author; 17 | std::string title; 18 | std::string memo; 19 | 20 | time_point_sec expiration_time; 21 | optional review_period_time; 22 | std::vector proposed_operations; 23 | flat_set required_active_approvals; 24 | flat_set available_active_approvals; 25 | flat_set required_owner_approvals; 26 | flat_set available_owner_approvals; 27 | flat_set required_posting_approvals; 28 | flat_set available_posting_approvals; 29 | flat_set available_key_approvals; 30 | }; 31 | 32 | }}} // golos::plugins::database_api 33 | 34 | FC_REFLECT( 35 | (golos::plugins::database_api::proposal_api_object), 36 | (author)(title)(memo)(expiration_time)(review_period_time)(proposed_operations) 37 | (required_active_approvals)(available_active_approvals) 38 | (required_owner_approvals)(available_owner_approvals) 39 | (required_posting_approvals)(available_posting_approvals) 40 | (available_key_approvals)) -------------------------------------------------------------------------------- /plugins/database_api/include/golos/plugins/database_api/api_objects/savings_withdraw_api_object.hpp: -------------------------------------------------------------------------------- 1 | #ifndef GOLOS_SAVINGS_WITHDRAW_API_OBJ_HPP 2 | #define GOLOS_SAVINGS_WITHDRAW_API_OBJ_HPP 3 | 4 | #include 5 | #include 6 | 7 | namespace golos { 8 | namespace plugins { 9 | namespace database_api { 10 | using golos::chain::savings_withdraw_object; 11 | 12 | struct savings_withdraw_api_object { 13 | savings_withdraw_api_object(const golos::chain::savings_withdraw_object &o) : id(o.id), from(o.from), to(o.to), 14 | memo(golos::chain::to_string(o.memo)), request_id(o.request_id), amount(o.amount), complete(o.complete) { 15 | } 16 | 17 | savings_withdraw_api_object() { 18 | } 19 | 20 | savings_withdraw_object::id_type id; 21 | account_name_type from; 22 | account_name_type to; 23 | string memo; 24 | uint32_t request_id = 0; 25 | asset amount; 26 | time_point_sec complete; 27 | }; 28 | } 29 | } 30 | } 31 | 32 | FC_REFLECT((golos::plugins::database_api::savings_withdraw_api_object), 33 | (id)(from)(to)(memo)(request_id)(amount)(complete)) 34 | 35 | #endif //GOLOS_SAVINGS_WITHDRAW_API_OBJ_HPP 36 | -------------------------------------------------------------------------------- /plugins/database_api/include/golos/plugins/database_api/forward.hpp: -------------------------------------------------------------------------------- 1 | #ifndef GOLOS_FORWARD_HPP 2 | #define GOLOS_FORWARD_HPP 3 | 4 | #include 5 | 6 | namespace golos { namespace plugins { namespace database_api { 7 | typedef golos::chain::change_recovery_account_request_object change_recovery_account_request_api_object; 8 | typedef golos::chain::block_summary_object block_summary_api_object; 9 | typedef golos::chain::comment_vote_object comment_vote_api_object; 10 | typedef golos::chain::convert_request_object convert_request_api_object; 11 | typedef golos::chain::escrow_object escrow_api_object; 12 | typedef golos::chain::liquidity_reward_balance_object liquidity_reward_balance_api_object; 13 | typedef golos::chain::limit_order_object limit_order_api_object; 14 | typedef golos::chain::withdraw_vesting_route_object withdraw_vesting_route_api_object; 15 | typedef golos::chain::decline_voting_rights_request_object decline_voting_rights_request_api_object; 16 | typedef golos::chain::witness_vote_object witness_vote_api_object; 17 | typedef golos::chain::witness_schedule_object witness_schedule_api_object; 18 | typedef golos::chain::account_bandwidth_object account_bandwidth_api_object; 19 | 20 | using vesting_delegation_api_object = golos::chain::vesting_delegation_object; 21 | using vesting_delegation_expiration_api_object = golos::chain::vesting_delegation_expiration_object; 22 | using invite_api_object = golos::chain::invite_object; 23 | 24 | } } } // golos::plugins::database_api 25 | 26 | #endif //GOLOS_FORWARD_HPP 27 | -------------------------------------------------------------------------------- /plugins/database_api/proposal_api_object.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace golos { namespace plugins { namespace database_api { 4 | 5 | proposal_api_object::proposal_api_object(const golos::chain::proposal_object& p) 6 | : author(p.author), 7 | title(golos::chain::to_string(p.title)), 8 | memo(golos::chain::to_string(p.memo)), 9 | expiration_time(p.expiration_time), 10 | review_period_time(p.review_period_time), 11 | proposed_operations(p.operations()), 12 | required_active_approvals(p.required_active_approvals.begin(), p.required_active_approvals.end()), 13 | available_active_approvals(p.available_active_approvals.begin(), p.available_active_approvals.end()), 14 | required_owner_approvals(p.required_owner_approvals.begin(), p.required_owner_approvals.end()), 15 | available_owner_approvals(p.available_owner_approvals.begin(), p.available_owner_approvals.end()), 16 | required_posting_approvals(p.required_posting_approvals.begin(), p.required_posting_approvals.end()), 17 | available_posting_approvals(p.available_posting_approvals.begin(), p.available_posting_approvals.end()), 18 | available_key_approvals(p.available_key_approvals.begin(), p.available_key_approvals.end()) { 19 | } 20 | 21 | }}} // golos::plugins::database_api -------------------------------------------------------------------------------- /plugins/debug_node/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET debug_node) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/debug_node/plugin.hpp 5 | ) 6 | 7 | list(APPEND CURRENT_TARGET_SOURCES 8 | plugin.cpp 9 | ) 10 | 11 | if(BUILD_SHARED_LIBRARIES) 12 | add_library(golos_${CURRENT_TARGET} SHARED 13 | ${CURRENT_TARGET_HEADERS} 14 | ${CURRENT_TARGET_SOURCES} 15 | ) 16 | else() 17 | add_library(golos_${CURRENT_TARGET} STATIC 18 | ${CURRENT_TARGET_HEADERS} 19 | ${CURRENT_TARGET_SOURCES} 20 | ) 21 | endif() 22 | 23 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 24 | 25 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 26 | 27 | target_link_libraries( 28 | golos_${CURRENT_TARGET} 29 | golos_chain 30 | golos_protocol 31 | appbase 32 | graphene_utilities 33 | golos_chain_plugin 34 | # golos_json_rpc_plugin 35 | fc 36 | ) 37 | 38 | target_include_directories( 39 | golos_${CURRENT_TARGET} 40 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" 41 | "${CMAKE_CURRENT_SOURCE_DIR}/../../" 42 | ) 43 | 44 | install(TARGETS 45 | golos_${CURRENT_TARGET} 46 | 47 | RUNTIME DESTINATION bin 48 | LIBRARY DESTINATION lib 49 | ARCHIVE DESTINATION lib 50 | ) 51 | -------------------------------------------------------------------------------- /plugins/elastic_search/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET elastic_search) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/elastic_search/elastic_search_plugin.hpp 5 | include/golos/plugins/elastic_search/elastic_search_state.hpp 6 | ) 7 | 8 | list(APPEND CURRENT_TARGET_SOURCES 9 | elastic_search_plugin.cpp 10 | ) 11 | 12 | if(BUILD_SHARED_LIBRARIES) 13 | add_library(golos_${CURRENT_TARGET} SHARED 14 | ${CURRENT_TARGET_HEADERS} 15 | ${CURRENT_TARGET_SOURCES} 16 | ) 17 | else() 18 | add_library(golos_${CURRENT_TARGET} STATIC 19 | ${CURRENT_TARGET_HEADERS} 20 | ${CURRENT_TARGET_SOURCES} 21 | ) 22 | endif() 23 | 24 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 25 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 26 | 27 | target_link_libraries( 28 | golos_${CURRENT_TARGET} 29 | golos::chain_plugin 30 | golos::social_network 31 | golos::tags 32 | appbase 33 | ) 34 | 35 | target_include_directories(golos_${CURRENT_TARGET} 36 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") 37 | 38 | install(TARGETS 39 | golos_${CURRENT_TARGET} 40 | 41 | RUNTIME DESTINATION bin 42 | LIBRARY DESTINATION lib 43 | ARCHIVE DESTINATION lib 44 | ) 45 | -------------------------------------------------------------------------------- /plugins/elastic_search/include/golos/plugins/elastic_search/elastic_search_plugin.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace golos { namespace plugins { namespace elastic_search { 8 | 9 | namespace bpo = boost::program_options; 10 | using namespace golos::chain; 11 | 12 | class elastic_search_plugin final : public appbase::plugin { 13 | public: 14 | 15 | APPBASE_PLUGIN_REQUIRES((chain::plugin)) 16 | 17 | elastic_search_plugin(); 18 | 19 | virtual ~elastic_search_plugin(); 20 | 21 | void set_program_options(bpo::options_description& cli, bpo::options_description& cfg) override; 22 | 23 | void plugin_initialize(const bpo::variables_map& options) override; 24 | 25 | void plugin_startup() override; 26 | 27 | void plugin_shutdown() override; 28 | 29 | static const std::string& name(); 30 | 31 | private: 32 | class elastic_search_plugin_impl; 33 | 34 | std::unique_ptr my; 35 | }; 36 | 37 | } } } // golos::plugins::elastic_search 38 | -------------------------------------------------------------------------------- /plugins/event_plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET event_plugin) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/event_plugin/event_plugin.hpp 5 | ) 6 | 7 | list(APPEND CURRENT_TARGET_SOURCES 8 | event_plugin.cpp 9 | ) 10 | 11 | if(BUILD_SHARED_LIBRARIES) 12 | add_library(golos_${CURRENT_TARGET} SHARED 13 | ${CURRENT_TARGET_HEADERS} 14 | ${CURRENT_TARGET_SOURCES} 15 | ) 16 | else() 17 | add_library(golos_${CURRENT_TARGET} STATIC 18 | ${CURRENT_TARGET_HEADERS} 19 | ${CURRENT_TARGET_SOURCES} 20 | ) 21 | endif() 22 | 23 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 24 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 25 | 26 | target_link_libraries( 27 | golos_${CURRENT_TARGET} 28 | golos::chain_plugin 29 | golos::json_rpc 30 | golos::social_network 31 | golos::tags 32 | appbase 33 | ) 34 | 35 | target_include_directories(golos_${CURRENT_TARGET} 36 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") 37 | 38 | install(TARGETS 39 | golos_${CURRENT_TARGET} 40 | 41 | RUNTIME DESTINATION bin 42 | LIBRARY DESTINATION lib 43 | ARCHIVE DESTINATION lib 44 | ) 45 | -------------------------------------------------------------------------------- /plugins/event_plugin/include/golos/plugins/event_plugin/event_plugin.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | namespace golos { namespace plugins { namespace event_plugin { 10 | 11 | namespace bpo = boost::program_options; 12 | using namespace golos::chain; 13 | 14 | DEFINE_API_ARGS(get_events_in_block, json_rpc::msg_pack, std::vector) 15 | 16 | class event_plugin final : public appbase::plugin { 17 | public: 18 | 19 | APPBASE_PLUGIN_REQUIRES((json_rpc::plugin)(chain::plugin)) 20 | 21 | event_plugin(); 22 | 23 | virtual ~event_plugin(); 24 | 25 | void set_program_options(bpo::options_description& cli, bpo::options_description& cfg) override; 26 | 27 | void plugin_initialize(const bpo::variables_map& options) override; 28 | 29 | void plugin_startup() override; 30 | 31 | void plugin_shutdown() override; 32 | 33 | static const std::string& name(); 34 | 35 | DECLARE_API( 36 | (get_events_in_block) 37 | ) 38 | private: 39 | class event_plugin_impl; 40 | 41 | std::unique_ptr my; 42 | }; 43 | 44 | } } } // golos::plugins::event_plugin 45 | -------------------------------------------------------------------------------- /plugins/exchange/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET exchange) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/exchange/exchange.hpp 5 | include/golos/plugins/exchange/exchange_queries.hpp 6 | include/golos/plugins/exchange/exchange_types.hpp 7 | ) 8 | 9 | list(APPEND CURRENT_TARGET_SOURCES 10 | exchange.cpp 11 | ) 12 | 13 | if(BUILD_SHARED_LIBRARIES) 14 | add_library(golos_${CURRENT_TARGET} SHARED 15 | ${CURRENT_TARGET_HEADERS} 16 | ${CURRENT_TARGET_SOURCES} 17 | ) 18 | else() 19 | add_library(golos_${CURRENT_TARGET} STATIC 20 | ${CURRENT_TARGET_HEADERS} 21 | ${CURRENT_TARGET_SOURCES} 22 | ) 23 | endif() 24 | 25 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 26 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 27 | 28 | target_link_libraries( 29 | golos_${CURRENT_TARGET} 30 | golos::chain_plugin 31 | golos::json_rpc 32 | appbase 33 | ) 34 | 35 | target_include_directories(golos_${CURRENT_TARGET} 36 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") 37 | 38 | install(TARGETS 39 | golos_${CURRENT_TARGET} 40 | 41 | RUNTIME DESTINATION bin 42 | LIBRARY DESTINATION lib 43 | ARCHIVE DESTINATION lib 44 | ) 45 | -------------------------------------------------------------------------------- /plugins/exchange/include/golos/plugins/exchange/exchange.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | namespace golos { namespace plugins { namespace exchange { 9 | 10 | namespace bpo = boost::program_options; 11 | using namespace golos::chain; 12 | 13 | DEFINE_API_ARGS(get_exchange, json_rpc::msg_pack, fc::mutable_variant_object) 14 | 15 | class exchange final : public appbase::plugin { 16 | public: 17 | 18 | APPBASE_PLUGIN_REQUIRES((json_rpc::plugin)(chain::plugin)) 19 | 20 | exchange(); 21 | 22 | virtual ~exchange(); 23 | 24 | void set_program_options(bpo::options_description& cli, bpo::options_description& cfg) override; 25 | 26 | void plugin_initialize(const bpo::variables_map& options) override; 27 | 28 | void plugin_startup() override; 29 | 30 | void plugin_shutdown() override; 31 | 32 | static const std::string& name(); 33 | 34 | DECLARE_API( 35 | (get_exchange) 36 | ) 37 | private: 38 | class exchange_impl; 39 | 40 | std::unique_ptr my; 41 | }; 42 | 43 | } } } // golos::plugins::exchange 44 | -------------------------------------------------------------------------------- /plugins/follow/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET follow) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/follow/follow_api_object.hpp 5 | include/golos/plugins/follow/follow_evaluators.hpp 6 | include/golos/plugins/follow/follow_objects.hpp 7 | include/golos/plugins/follow/follow_operations.hpp 8 | include/golos/plugins/follow/follow_forward.hpp 9 | include/golos/plugins/follow/plugin.hpp 10 | ) 11 | 12 | list(APPEND CURRENT_TARGET_SOURCES 13 | follow_evaluators.cpp 14 | follow_operations.cpp 15 | plugin.cpp 16 | ) 17 | 18 | if(BUILD_SHARED_LIBRARIES) 19 | add_library(golos_${CURRENT_TARGET} SHARED 20 | ${CURRENT_TARGET_HEADERS} 21 | ${CURRENT_TARGET_SOURCES} 22 | ) 23 | else() 24 | add_library(golos_${CURRENT_TARGET} STATIC 25 | ${CURRENT_TARGET_HEADERS} 26 | ${CURRENT_TARGET_SOURCES} 27 | ) 28 | endif() 29 | 30 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 31 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 32 | 33 | target_link_libraries( 34 | golos_${CURRENT_TARGET} 35 | golos_chain 36 | golos::json_rpc 37 | golos::chain_plugin 38 | golos::protocol 39 | golos::api 40 | golos::social_network 41 | appbase 42 | fc 43 | ) 44 | target_include_directories(golos_${CURRENT_TARGET} PUBLIC "include") 45 | 46 | install(TARGETS 47 | golos_${CURRENT_TARGET} 48 | 49 | RUNTIME DESTINATION bin 50 | LIBRARY DESTINATION lib 51 | ARCHIVE DESTINATION lib 52 | ) -------------------------------------------------------------------------------- /plugins/follow/include/golos/plugins/follow/follow_forward.hpp: -------------------------------------------------------------------------------- 1 | #ifndef GOLOS_FOLLOW_FORWARD_HPP 2 | #define GOLOS_FOLLOW_FORWARD_HPP 3 | 4 | #include 5 | 6 | namespace golos { 7 | namespace plugins { 8 | namespace follow { 9 | 10 | enum follow_type { 11 | undefined, 12 | blog, 13 | ignore 14 | }; 15 | 16 | }}} 17 | 18 | FC_REFLECT_ENUM(golos::plugins::follow::follow_type, (undefined)(blog)(ignore)) 19 | 20 | #endif //GOLOS_FORWARD_HPP 21 | -------------------------------------------------------------------------------- /plugins/json_rpc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET json_rpc) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/json_rpc/plugin.hpp 5 | include/golos/plugins/json_rpc/utility.hpp 6 | ) 7 | 8 | list(APPEND CURRENT_TARGET_SOURCES 9 | plugin.cpp 10 | ) 11 | 12 | if(BUILD_SHARED_LIBRARIES) 13 | add_library(golos_${CURRENT_TARGET} SHARED 14 | ${CURRENT_TARGET_HEADERS} 15 | ${CURRENT_TARGET_SOURCES} 16 | ) 17 | else() 18 | add_library(golos_${CURRENT_TARGET} STATIC 19 | ${CURRENT_TARGET_HEADERS} 20 | ${CURRENT_TARGET_SOURCES} 21 | ) 22 | endif() 23 | 24 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 25 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 26 | target_link_libraries(golos_${CURRENT_TARGET} golos_protocol appbase fc) 27 | target_include_directories(golos_${CURRENT_TARGET} 28 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/../../") 29 | 30 | install(TARGETS 31 | golos_${CURRENT_TARGET} 32 | 33 | RUNTIME DESTINATION bin 34 | LIBRARY DESTINATION lib 35 | ARCHIVE DESTINATION lib 36 | ) 37 | -------------------------------------------------------------------------------- /plugins/market_history/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET market_history) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/market_history/market_history_plugin.hpp 5 | include/golos/plugins/market_history/market_history_objects.hpp 6 | include/golos/plugins/market_history/market_history_visitor.hpp 7 | ) 8 | 9 | list(APPEND CURRENT_TARGET_SOURCES 10 | market_history_plugin.cpp 11 | market_history_visitor.cpp 12 | ) 13 | 14 | if(BUILD_SHARED_LIBRARIES) 15 | add_library(golos_${CURRENT_TARGET} SHARED 16 | ${CURRENT_TARGET_HEADERS} 17 | ${CURRENT_TARGET_SOURCES} 18 | ) 19 | else() 20 | add_library(golos_${CURRENT_TARGET} STATIC 21 | ${CURRENT_TARGET_HEADERS} 22 | ${CURRENT_TARGET_SOURCES} 23 | ) 24 | endif() 25 | 26 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 27 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 28 | 29 | target_link_libraries( 30 | golos_${CURRENT_TARGET} 31 | golos::chain_plugin 32 | golos::p2p 33 | golos::api 34 | golos::protocol 35 | golos::network 36 | graphene_utilities 37 | graphene_time 38 | appbase 39 | ) 40 | target_include_directories(golos_${CURRENT_TARGET} 41 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") 42 | 43 | install(TARGETS 44 | golos_${CURRENT_TARGET} 45 | 46 | RUNTIME DESTINATION bin 47 | LIBRARY DESTINATION lib 48 | ARCHIVE DESTINATION lib 49 | ) 50 | 51 | -------------------------------------------------------------------------------- /plugins/market_history/include/golos/plugins/market_history/market_history_callbacks.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace golos { namespace plugins { namespace market_history { 4 | 5 | using callback_arg = fc::static_variant< 6 | order_create_operation, 7 | order_delete_operation, 8 | fill_order_operation 9 | >; 10 | 11 | }}} // golos::plugins::market_history 12 | 13 | -------------------------------------------------------------------------------- /plugins/market_history/include/golos/plugins/market_history/market_history_visitor.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace golos { namespace plugins { namespace market_history { 8 | using namespace golos::chain; 9 | 10 | struct operation_visitor { 11 | operation_visitor(market_history_plugin& plugin, database& db); 12 | using result_type = void; 13 | 14 | market_history_plugin& _plugin; 15 | 16 | database& _db; 17 | 18 | void operator()(const order_create_operation& op) const; 19 | 20 | void operator()(const order_delete_operation& op) const; 21 | 22 | void operator()(const fill_order_operation& op) const; 23 | 24 | template 25 | void operator()(Op&&) const { 26 | } /// ignore all other ops 27 | }; 28 | 29 | } } } // golos::plugins::market_history 30 | -------------------------------------------------------------------------------- /plugins/mongo_db/include/golos/plugins/mongo_db/mongo_db_plugin.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | 10 | namespace golos { 11 | namespace plugins { 12 | namespace mongo_db { 13 | 14 | class mongo_db_plugin final : public appbase::plugin { 15 | public: 16 | 17 | APPBASE_PLUGIN_REQUIRES( 18 | (chain::plugin) 19 | ) 20 | 21 | mongo_db_plugin(); 22 | 23 | virtual ~mongo_db_plugin(); 24 | 25 | void set_program_options( 26 | boost::program_options::options_description& cli, 27 | boost::program_options::options_description& cfg 28 | ) override; 29 | 30 | void plugin_initialize(const boost::program_options::variables_map& options) override; 31 | 32 | void plugin_startup() override; 33 | 34 | void plugin_shutdown() override; 35 | 36 | constexpr const static char *plugin_name = "mongo_db"; 37 | 38 | static const std::string& name() { 39 | static std::string name = plugin_name; 40 | return name; 41 | } 42 | 43 | private: 44 | class mongo_db_plugin_impl; 45 | 46 | std::unique_ptr pimpl_; 47 | }; 48 | 49 | }}} // namespace golos::plugins::mongo_db 50 | 51 | -------------------------------------------------------------------------------- /plugins/mongo_db/mongo_db_types.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace golos { 4 | namespace plugins { 5 | namespace mongo_db { 6 | 7 | void bmi_insert_or_replace(db_map& bmi, named_document doc) { 8 | auto& idx = bmi.get(); 9 | auto it = idx.find(std::make_tuple( 10 | doc.collection_name, 11 | doc.key, doc.keyval, doc.is_removal)); 12 | if (it != idx.end()) { 13 | idx.erase(it); 14 | } 15 | idx.emplace(std::move(doc)); 16 | } 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /plugins/network_broadcast_api/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET network_broadcast_api) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/network_broadcast_api/network_broadcast_api_plugin.hpp 5 | ) 6 | 7 | list(APPEND CURRENT_TARGET_SOURCES 8 | network_broadcast_api.cpp 9 | ) 10 | 11 | if(BUILD_SHARED_LIBRARIES) 12 | add_library(golos_${CURRENT_TARGET} SHARED 13 | ${CURRENT_TARGET_HEADERS} 14 | ${CURRENT_TARGET_SOURCES} 15 | ) 16 | else() 17 | add_library(golos_${CURRENT_TARGET} STATIC 18 | ${CURRENT_TARGET_HEADERS} 19 | ${CURRENT_TARGET_SOURCES} 20 | ) 21 | endif() 22 | 23 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 24 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 25 | 26 | target_link_libraries( 27 | golos_${CURRENT_TARGET} 28 | golos_chain 29 | golos::chain_plugin 30 | golos::json_rpc 31 | golos::p2p 32 | appbase 33 | ) 34 | 35 | target_include_directories(golos_${CURRENT_TARGET} 36 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/../../") 37 | 38 | install(TARGETS 39 | golos_${CURRENT_TARGET} 40 | 41 | RUNTIME DESTINATION bin 42 | LIBRARY DESTINATION lib 43 | ARCHIVE DESTINATION lib 44 | ) 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /plugins/nft_api/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET nft_api) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/nft_api/nft_api.hpp 5 | include/golos/plugins/nft_api/nft_api_objects.hpp 6 | include/golos/plugins/nft_api/nft_api_queries.hpp 7 | ) 8 | 9 | list(APPEND CURRENT_TARGET_SOURCES 10 | nft_api.cpp 11 | ) 12 | 13 | if(BUILD_SHARED_LIBRARIES) 14 | add_library(golos_${CURRENT_TARGET} SHARED 15 | ${CURRENT_TARGET_HEADERS} 16 | ${CURRENT_TARGET_SOURCES} 17 | ) 18 | else() 19 | add_library(golos_${CURRENT_TARGET} STATIC 20 | ${CURRENT_TARGET_HEADERS} 21 | ${CURRENT_TARGET_SOURCES} 22 | ) 23 | endif() 24 | 25 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 26 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 27 | 28 | target_link_libraries( 29 | golos_${CURRENT_TARGET} 30 | golos::chain_plugin 31 | golos::json_rpc 32 | appbase 33 | ) 34 | 35 | target_include_directories(golos_${CURRENT_TARGET} 36 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") 37 | 38 | install(TARGETS 39 | golos_${CURRENT_TARGET} 40 | 41 | RUNTIME DESTINATION bin 42 | LIBRARY DESTINATION lib 43 | ARCHIVE DESTINATION lib 44 | ) 45 | -------------------------------------------------------------------------------- /plugins/nft_api/include/golos/plugins/nft_api/nft_api.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | namespace golos { namespace plugins { namespace nft_api { 10 | 11 | namespace bpo = boost::program_options; 12 | using namespace golos::chain; 13 | 14 | DEFINE_API_ARGS(get_nft_collections, json_rpc::msg_pack, std::vector) 15 | DEFINE_API_ARGS(get_nft_tokens, json_rpc::msg_pack, std::vector) 16 | DEFINE_API_ARGS(get_nft_orders, json_rpc::msg_pack, std::vector) 17 | DEFINE_API_ARGS(get_nft_bets, json_rpc::msg_pack, std::vector) 18 | 19 | class nft_api_plugin final : public appbase::plugin { 20 | public: 21 | 22 | APPBASE_PLUGIN_REQUIRES((json_rpc::plugin)(chain::plugin)) 23 | 24 | nft_api_plugin(); 25 | 26 | virtual ~nft_api_plugin(); 27 | 28 | void set_program_options(bpo::options_description& cli, bpo::options_description& cfg) override; 29 | 30 | void plugin_initialize(const bpo::variables_map& options) override; 31 | 32 | void plugin_startup() override; 33 | 34 | void plugin_shutdown() override; 35 | 36 | static const std::string& name(); 37 | 38 | DECLARE_API( 39 | (get_nft_collections) 40 | (get_nft_tokens) 41 | (get_nft_orders) 42 | (get_nft_bets) 43 | ) 44 | private: 45 | class nft_api_plugin_impl; 46 | 47 | std::unique_ptr my; 48 | }; 49 | 50 | } } } // golos::plugins::nft_api 51 | -------------------------------------------------------------------------------- /plugins/operation_dump/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET operation_dump) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/operation_dump/operation_dump_plugin.hpp 5 | include/golos/plugins/operation_dump/operation_dump_container.hpp 6 | ) 7 | 8 | list(APPEND CURRENT_TARGET_SOURCES 9 | operation_dump_plugin.cpp 10 | ) 11 | 12 | if(BUILD_SHARED_LIBRARIES) 13 | add_library(golos_${CURRENT_TARGET} SHARED 14 | ${CURRENT_TARGET_HEADERS} 15 | ${CURRENT_TARGET_SOURCES} 16 | ) 17 | else() 18 | add_library(golos_${CURRENT_TARGET} STATIC 19 | ${CURRENT_TARGET_HEADERS} 20 | ${CURRENT_TARGET_SOURCES} 21 | ) 22 | endif() 23 | 24 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 25 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 26 | 27 | target_link_libraries( 28 | golos_${CURRENT_TARGET} 29 | golos::chain_plugin 30 | golos::follow 31 | golos::tags 32 | appbase 33 | ) 34 | 35 | target_include_directories(golos_${CURRENT_TARGET} 36 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") 37 | 38 | install(TARGETS 39 | golos_${CURRENT_TARGET} 40 | 41 | RUNTIME DESTINATION bin 42 | LIBRARY DESTINATION lib 43 | ARCHIVE DESTINATION lib 44 | ) 45 | -------------------------------------------------------------------------------- /plugins/operation_dump/include/golos/plugins/operation_dump/operation_dump_container.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace golos { namespace plugins { namespace operation_dump { 8 | 9 | namespace bfs = boost::filesystem; 10 | 11 | // Structure size can differ - uses sizeof 12 | struct dump_header { 13 | char magic[13] = "Golos\adumpOP"; 14 | uint32_t version = 1; 15 | }; 16 | 17 | using operation_number = std::pair; 18 | 19 | class dump_buffer : public std::stringstream { 20 | public: 21 | dump_buffer() { 22 | } 23 | 24 | using std::stringstream::write; 25 | 26 | void write(const operation_number& op_num) { 27 | fc::raw::pack(*this, op_num); 28 | } 29 | }; 30 | 31 | using dump_buffers = std::map; 32 | 33 | class dump_file : public bfs::ofstream { 34 | public: 35 | dump_file(const bfs::path& p): bfs::ofstream(p, std::ios_base::binary | std::ios_base::app) { 36 | bfs::ofstream::exceptions(std::ofstream::failbit | std::ofstream::badbit); 37 | } 38 | 39 | void write(const dump_header& hdr) { 40 | bfs::ofstream::write((const char*)&hdr, sizeof(dump_header)); 41 | } 42 | }; 43 | 44 | } } } // golos::plugins::operation_dump 45 | -------------------------------------------------------------------------------- /plugins/operation_dump/include/golos/plugins/operation_dump/operation_dump_plugin.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | namespace golos { namespace plugins { namespace operation_dump { 11 | 12 | namespace bpo = boost::program_options; 13 | using namespace golos::chain; 14 | 15 | template 16 | using clarifications = std::map>; 17 | 18 | class operation_dump_plugin final : public appbase::plugin { 19 | public: 20 | APPBASE_PLUGIN_REQUIRES((chain::plugin)) 21 | 22 | operation_dump_plugin(); 23 | 24 | ~operation_dump_plugin(); 25 | 26 | void set_program_options(bpo::options_description& cli, bpo::options_description& cfg) override; 27 | 28 | void plugin_initialize(const bpo::variables_map& options) override; 29 | 30 | void plugin_startup() override; 31 | 32 | void plugin_shutdown() override; 33 | 34 | static const std::string& name(); 35 | 36 | dump_buffers buffers; 37 | clarifications vote_rshares; 38 | clarifications not_deleted_comments; 39 | clarifications transfer_golos_amounts; 40 | private: 41 | class operation_dump_plugin_impl; 42 | 43 | std::unique_ptr my; 44 | }; 45 | 46 | } } } //golos::plugins::operation_dump 47 | -------------------------------------------------------------------------------- /plugins/operation_history/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET operation_history) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/operation_history/plugin.hpp 5 | include/golos/plugins/operation_history/history_object.hpp 6 | include/golos/plugins/operation_history/applied_operation.hpp 7 | ) 8 | 9 | list(APPEND CURRENT_TARGET_SOURCES 10 | plugin.cpp 11 | applied_operation.cpp 12 | ) 13 | 14 | if (BUILD_SHARED_LIBRARIES) 15 | add_library(golos_${CURRENT_TARGET} SHARED 16 | ${CURRENT_TARGET_HEADERS} 17 | ${CURRENT_TARGET_SOURCES} 18 | ) 19 | else() 20 | add_library(golos_${CURRENT_TARGET} STATIC 21 | ${CURRENT_TARGET_HEADERS} 22 | ${CURRENT_TARGET_SOURCES} 23 | ) 24 | endif() 25 | 26 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 27 | 28 | target_link_libraries ( 29 | golos_${CURRENT_TARGET} 30 | golos_chain 31 | golos_chain_plugin 32 | golos::account_history 33 | golos_protocol 34 | appbase 35 | golos_json_rpc 36 | graphene_time 37 | chainbase 38 | fc 39 | golos::api 40 | ) 41 | 42 | target_include_directories(golos_${CURRENT_TARGET} 43 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" 44 | "${CMAKE_CURRENT_SOURCE_DIR}/../../" 45 | ) 46 | 47 | install(TARGETS 48 | golos_${CURRENT_TARGET} 49 | 50 | RUNTIME DESTINATION bin 51 | LIBRARY DESTINATION lib 52 | ARCHIVE DESTINATION lib 53 | ) -------------------------------------------------------------------------------- /plugins/operation_history/applied_operation.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace golos { namespace plugins { namespace operation_history { 4 | 5 | applied_operation::applied_operation() = default; 6 | 7 | applied_operation::applied_operation(const operation_object& op_obj) 8 | : trx_id(op_obj.trx_id), 9 | block(op_obj.block), 10 | trx_in_block(op_obj.trx_in_block), 11 | op_in_trx(op_obj.op_in_trx), 12 | virtual_op(op_obj.virtual_op), 13 | timestamp(op_obj.timestamp), 14 | op(fc::raw::unpack(op_obj.serialized_op)) { 15 | } 16 | 17 | } } } // golos::plugins::operation_history 18 | -------------------------------------------------------------------------------- /plugins/operation_history/include/golos/plugins/operation_history/applied_operation.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace golos { namespace plugins { namespace operation_history { 8 | 9 | struct applied_operation final { 10 | applied_operation(); 11 | 12 | applied_operation(const operation_object&); 13 | 14 | golos::protocol::transaction_id_type trx_id; 15 | uint32_t block = 0; 16 | uint32_t trx_in_block = 0; 17 | uint16_t op_in_trx = 0; 18 | uint64_t virtual_op = 0; 19 | fc::time_point_sec timestamp; 20 | golos::protocol::operation op; 21 | string json_metadata; 22 | }; 23 | 24 | struct donate_meta final { 25 | account_name_type referrer; 26 | asset referrer_interest = asset(0, STEEM_SYMBOL); 27 | }; 28 | 29 | } } } // golos::plugins::operation_history 30 | 31 | FC_REFLECT( 32 | (golos::plugins::operation_history::applied_operation), 33 | (trx_id)(block)(trx_in_block)(op_in_trx)(virtual_op)(timestamp)(op)(json_metadata)) 34 | 35 | FC_REFLECT( 36 | (golos::plugins::operation_history::donate_meta), 37 | (referrer)(referrer_interest)) 38 | -------------------------------------------------------------------------------- /plugins/operation_history/include/golos/plugins/operation_history/history_queries.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | using namespace golos::protocol; 7 | 8 | namespace golos { namespace plugins { namespace operation_history { 9 | 10 | struct nft_token_ops_query { 11 | std::set token_ids; 12 | 13 | uint32_t from = 0; 14 | uint32_t limit = 20; 15 | 16 | bool reverse_sort = false; 17 | }; 18 | 19 | }}} 20 | 21 | FC_REFLECT( 22 | (golos::plugins::operation_history::nft_token_ops_query), 23 | (token_ids)(from)(limit)(reverse_sort) 24 | ) 25 | -------------------------------------------------------------------------------- /plugins/p2p/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET p2p) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/p2p/p2p_plugin.hpp 5 | ) 6 | 7 | list(APPEND CURRENT_TARGET_SOURCES 8 | p2p_plugin.cpp 9 | ) 10 | 11 | if(BUILD_SHARED_LIBRARIES) 12 | add_library(golos_${CURRENT_TARGET} SHARED 13 | ${CURRENT_TARGET_HEADERS} 14 | ${CURRENT_TARGET_SOURCES} 15 | ) 16 | else() 17 | add_library(golos_${CURRENT_TARGET} STATIC 18 | ${CURRENT_TARGET_HEADERS} 19 | ${CURRENT_TARGET_SOURCES} 20 | ) 21 | endif() 22 | 23 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 24 | 25 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 26 | 27 | target_link_libraries( 28 | golos_${CURRENT_TARGET} 29 | golos_chain 30 | golos::chain_plugin 31 | golos::network 32 | appbase 33 | ) 34 | 35 | target_include_directories( 36 | golos_${CURRENT_TARGET} 37 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" 38 | "${CMAKE_CURRENT_SOURCE_DIR}/../../" 39 | ) 40 | 41 | install(TARGETS 42 | golos_${CURRENT_TARGET} 43 | 44 | RUNTIME DESTINATION bin 45 | LIBRARY DESTINATION lib 46 | ARCHIVE DESTINATION lib 47 | ) 48 | -------------------------------------------------------------------------------- /plugins/p2p/include/golos/plugins/p2p/p2p_plugin.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | #define STEEM_P2P_PLUGIN_NAME "p2p" 8 | 9 | namespace golos { 10 | namespace plugins { 11 | namespace p2p { 12 | namespace bpo = boost::program_options; 13 | 14 | namespace detail { 15 | class p2p_plugin_impl; 16 | } 17 | 18 | class p2p_plugin final : public appbase::plugin { 19 | public: 20 | APPBASE_PLUGIN_REQUIRES((chain::plugin)) 21 | 22 | p2p_plugin(); 23 | 24 | ~p2p_plugin(); 25 | 26 | void set_program_options(boost::program_options::options_description &, 27 | boost::program_options::options_description &config_file_options) override; 28 | 29 | static const std::string &name() { 30 | static std::string name = STEEM_P2P_PLUGIN_NAME; 31 | return name; 32 | } 33 | 34 | void plugin_initialize(const boost::program_options::variables_map &options) override; 35 | 36 | void plugin_startup() override; 37 | 38 | void plugin_shutdown() override; 39 | 40 | void broadcast_block(const golos::protocol::signed_block &block); 41 | 42 | void broadcast_transaction(const golos::protocol::signed_transaction &tx); 43 | 44 | void set_block_production(bool producing_blocks); 45 | 46 | private: 47 | std::unique_ptr my; 48 | }; 49 | 50 | } 51 | } 52 | } // steem::plugins::p2p 53 | -------------------------------------------------------------------------------- /plugins/paid_subscription_api/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET paid_subscription_api) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/paid_subscription_api/paid_subscription_api.hpp 5 | include/golos/plugins/paid_subscription_api/paid_subscription_api_queries.hpp 6 | include/golos/plugins/paid_subscription_api/paid_subscription_api_objects.hpp 7 | ) 8 | 9 | list(APPEND CURRENT_TARGET_SOURCES 10 | paid_subscription_api.cpp 11 | ) 12 | 13 | if(BUILD_SHARED_LIBRARIES) 14 | add_library(golos_${CURRENT_TARGET} SHARED 15 | ${CURRENT_TARGET_HEADERS} 16 | ${CURRENT_TARGET_SOURCES} 17 | ) 18 | else() 19 | add_library(golos_${CURRENT_TARGET} STATIC 20 | ${CURRENT_TARGET_HEADERS} 21 | ${CURRENT_TARGET_SOURCES} 22 | ) 23 | endif() 24 | 25 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 26 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 27 | 28 | target_link_libraries( 29 | golos_${CURRENT_TARGET} 30 | golos::chain_plugin 31 | golos::json_rpc 32 | appbase 33 | ) 34 | 35 | target_include_directories(golos_${CURRENT_TARGET} 36 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") 37 | 38 | install(TARGETS 39 | golos_${CURRENT_TARGET} 40 | 41 | RUNTIME DESTINATION bin 42 | LIBRARY DESTINATION lib 43 | ARCHIVE DESTINATION lib 44 | ) 45 | -------------------------------------------------------------------------------- /plugins/paid_subscription_api/include/golos/plugins/paid_subscription_api/paid_subscription_api_objects.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace golos::chain; 8 | 9 | namespace golos { namespace plugins { namespace paid_subscription_api { 10 | 11 | struct paid_subscribe_result { 12 | paid_subscriber_object subscribe; 13 | paid_subscription_object subscription; 14 | }; 15 | 16 | }}} 17 | 18 | FC_REFLECT( 19 | (golos::plugins::paid_subscription_api::paid_subscribe_result), 20 | (subscribe)(subscription) 21 | ) 22 | -------------------------------------------------------------------------------- /plugins/private_message/include/golos/plugins/private_message/private_message_exceptions.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace golos { namespace plugins { namespace private_message { 7 | 8 | struct logic_errors { 9 | enum types { 10 | cannot_send_to_yourself, 11 | from_and_to_memo_keys_must_be_different, 12 | cannot_add_contact_to_yourself, 13 | sender_in_ignore_list, 14 | recipient_ignores_messages_from_unknown_contact, 15 | add_unknown_contact, 16 | contact_has_not_changed, 17 | no_unread_messages, 18 | too_low_gp, 19 | already_exists, 20 | cannot_change_group_encrypted, 21 | unauthorized, 22 | too_many_groups, 23 | too_many_moders, 24 | group_is_public 25 | }; 26 | }; 27 | 28 | } } } // golos::plugins::private_message 29 | 30 | namespace golos { 31 | template<> 32 | inline std::string get_logic_error_namespace() { 33 | return golos::plugins::private_message::private_message_plugin::name(); 34 | } 35 | } 36 | 37 | FC_REFLECT_ENUM(golos::plugins::private_message::logic_errors::types, 38 | (cannot_send_to_yourself) 39 | (from_and_to_memo_keys_must_be_different) 40 | (cannot_add_contact_to_yourself) 41 | (sender_in_ignore_list) 42 | (recipient_ignores_messages_from_unknown_contact) 43 | (add_unknown_contact) 44 | (contact_has_not_changed) 45 | (no_unread_messages) 46 | (too_low_gp) 47 | (already_exists) 48 | (cannot_change_group_encrypted) 49 | (unauthorized) 50 | (too_many_groups) 51 | (too_many_moders) 52 | (group_is_public) 53 | ); 54 | -------------------------------------------------------------------------------- /plugins/private_message/private_message_objects.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | namespace golos { namespace plugins { namespace private_message { 5 | bool starts_with_dog(const std::string& str) { 6 | return _NAME_HAS_DOG(str); 7 | } 8 | 9 | bool trim_dog(std::string& str) { 10 | if (_NAME_HAS_DOG(str)) { 11 | str.erase(0, 1); 12 | return true; 13 | } 14 | return false; 15 | } 16 | 17 | bool prepend_dog(std::string& str) { 18 | if (!_NAME_HAS_DOG(str)) { 19 | str.insert(0, "@"); 20 | return true; 21 | } 22 | return false; 23 | } 24 | 25 | std::string without_dog(const std::string& str) { 26 | std::string new_str(str); 27 | trim_dog(new_str); 28 | return new_str; 29 | } 30 | 31 | std::string with_dog(const std::string& str) { 32 | std::string new_str(str); 33 | prepend_dog(new_str); 34 | return new_str; 35 | } 36 | 37 | fc::variant to_variant(const message_accounts& accounts) { 38 | fc::mutable_variant_object obj; 39 | for (auto& entr : accounts) { 40 | obj[entr.first] = entr.second; 41 | } 42 | return obj; 43 | } 44 | }}} // golos::plugins::private_message 45 | -------------------------------------------------------------------------------- /plugins/raw_block/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET raw_block) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/raw_block/plugin.hpp 5 | ) 6 | 7 | list(APPEND CURRENT_TARGET_SOURCES 8 | plugin.cpp 9 | ) 10 | 11 | if(BUILD_SHARED_LIBRARIES) 12 | add_library(golos_${CURRENT_TARGET} SHARED 13 | ${CURRENT_TARGET_HEADERS} 14 | ${CURRENT_TARGET_SOURCES} 15 | ) 16 | else() 17 | add_library(golos_${CURRENT_TARGET} STATIC 18 | ${CURRENT_TARGET_HEADERS} 19 | ${CURRENT_TARGET_SOURCES} 20 | ) 21 | endif() 22 | 23 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 24 | 25 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 26 | 27 | target_link_libraries( 28 | golos_${CURRENT_TARGET} 29 | golos_chain 30 | golos_chain_plugin 31 | golos_protocol 32 | appbase 33 | golos::json_rpc 34 | fc 35 | ) 36 | 37 | target_include_directories( 38 | golos_${CURRENT_TARGET} 39 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" 40 | "${CMAKE_CURRENT_SOURCE_DIR}/../../" 41 | ) 42 | 43 | install(TARGETS 44 | golos_${CURRENT_TARGET} 45 | 46 | RUNTIME DESTINATION bin 47 | LIBRARY DESTINATION lib 48 | ARCHIVE DESTINATION lib 49 | ) 50 | -------------------------------------------------------------------------------- /plugins/social_network/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET social_network) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/social_network/social_network.hpp 5 | ) 6 | 7 | list(APPEND CURRENT_TARGET_SOURCES 8 | social_network.cpp 9 | ) 10 | 11 | if(BUILD_SHARED_LIBRARIES) 12 | add_library(golos_${CURRENT_TARGET} SHARED 13 | ${CURRENT_TARGET_HEADERS} 14 | ${CURRENT_TARGET_SOURCES} 15 | ) 16 | else() 17 | add_library(golos_${CURRENT_TARGET} STATIC 18 | ${CURRENT_TARGET_HEADERS} 19 | ${CURRENT_TARGET_SOURCES} 20 | ) 21 | endif() 22 | 23 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 24 | 25 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 26 | 27 | target_link_libraries( 28 | golos_${CURRENT_TARGET} 29 | golos_chain 30 | golos::chain_plugin 31 | golos::network 32 | golos::follow 33 | golos::tags 34 | appbase 35 | ) 36 | 37 | target_include_directories( 38 | golos_${CURRENT_TARGET} 39 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" 40 | "${CMAKE_CURRENT_SOURCE_DIR}/../../" 41 | ) 42 | 43 | install(TARGETS 44 | golos_${CURRENT_TARGET} 45 | 46 | RUNTIME DESTINATION bin 47 | LIBRARY DESTINATION lib 48 | ARCHIVE DESTINATION lib 49 | ) 50 | -------------------------------------------------------------------------------- /plugins/social_network/include/golos/plugins/social_network/social_network_queries.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | using namespace golos::protocol; 6 | 7 | namespace golos { namespace plugins { namespace social_network { 8 | 9 | enum class referrals_sort : uint8_t { 10 | by_joined, 11 | by_rewards 12 | }; 13 | 14 | struct referrals_query { 15 | account_name_type referrer; 16 | 17 | std::string start_name; 18 | uint32_t limit = 20; 19 | 20 | referrals_sort sort = referrals_sort::by_joined; 21 | }; 22 | 23 | enum class referrers_sort : uint8_t { 24 | by_referral_count, 25 | by_referral_vesting, 26 | by_referral_post_count, 27 | by_referral_comment_count, 28 | by_referral_total_postings 29 | }; 30 | 31 | struct referrers_query { 32 | std::string start_name; 33 | uint32_t limit = 20; 34 | 35 | referrers_sort sort = referrers_sort::by_referral_count; 36 | }; 37 | 38 | }}} 39 | 40 | FC_REFLECT_ENUM( 41 | golos::plugins::social_network::referrals_sort, 42 | (by_joined)(by_rewards) 43 | ) 44 | 45 | FC_REFLECT( 46 | (golos::plugins::social_network::referrals_query), 47 | (referrer)(start_name)(limit)(sort) 48 | ) 49 | 50 | FC_REFLECT_ENUM( 51 | golos::plugins::social_network::referrers_sort, 52 | (by_referral_count)(by_referral_vesting) 53 | (by_referral_post_count)(by_referral_comment_count)(by_referral_total_postings) 54 | ) 55 | 56 | FC_REFLECT( 57 | (golos::plugins::social_network::referrers_query), 58 | (start_name)(limit)(sort) 59 | ) 60 | -------------------------------------------------------------------------------- /plugins/statsd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET statsd) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/statsd/plugin.hpp 5 | include/golos/plugins/statsd/statistics_sender.hpp 6 | include/golos/plugins/statsd/runtime_bucket_object.hpp 7 | ) 8 | 9 | list(APPEND CURRENT_TARGET_SOURCES 10 | plugin.cpp 11 | statistics_sender.cpp 12 | ) 13 | 14 | if(BUILD_SHARED_LIBRARIES) 15 | add_library( golos_${CURRENT_TARGET} SHARED 16 | ${CURRENT_TARGET_HEADERS} 17 | ${CURRENT_TARGET_SOURCES} 18 | ) 19 | else() 20 | add_library( golos_${CURRENT_TARGET} STATIC 21 | ${CURRENT_TARGET_HEADERS} 22 | ${CURRENT_TARGET_SOURCES} 23 | ) 24 | endif() 25 | 26 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 27 | 28 | target_link_libraries( 29 | golos_${CURRENT_TARGET} 30 | golos_chain 31 | golos_chain_plugin 32 | golos_protocol 33 | appbase 34 | fc 35 | ) 36 | 37 | target_include_directories(golos_${CURRENT_TARGET} 38 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" 39 | "${CMAKE_CURRENT_SOURCE_DIR}/../../" 40 | ) 41 | 42 | install(TARGETS 43 | golos_${CURRENT_TARGET} 44 | 45 | RUNTIME DESTINATION bin 46 | LIBRARY DESTINATION lib 47 | ARCHIVE DESTINATION lib 48 | ) 49 | 50 | # TODO 51 | # Maybe we should also do smthng like this. 52 | # install(FILES ${HEADERS} DESTINATION "include/golos/chain_plugin") 53 | -------------------------------------------------------------------------------- /plugins/statsd/include/golos/plugins/statsd/statistics_sender.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | using namespace golos::chain; 10 | 11 | class statistics_sender final { 12 | public: 13 | statistics_sender() ; 14 | statistics_sender(uint32_t default_port); 15 | 16 | ~statistics_sender() = default; 17 | 18 | bool can_start(); 19 | 20 | // sends a string to all endpoints 21 | void push(const std::string & str); 22 | 23 | // adds address to recipient_endpoint_set. 24 | void add_address(const std::string & address); 25 | 26 | /// returns statistics recievers endpoints 27 | std::vector get_endpoint_string_vector(); 28 | 29 | golos::plugins::statsd::runtime_bucket_object previous_bucket; 30 | golos::plugins::statsd::runtime_bucket_object current_bucket; 31 | bool is_previous_bucket_set; 32 | private: 33 | // Stat sender will send data to all endpoints from recipient_endpoint_set 34 | std::set recipient_endpoint_set; 35 | // DefaultPort for asio broadcasting 36 | uint32_t default_port; 37 | void init(); 38 | boost::asio::io_service & ios; 39 | boost::asio::ip::udp::socket socket; 40 | }; 41 | -------------------------------------------------------------------------------- /plugins/tags/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET tags) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/tags/discussion_query.hpp 5 | include/golos/plugins/tags/plugin.hpp 6 | include/golos/plugins/tags/tag_api_object.hpp 7 | include/golos/plugins/tags/tag_visitor.hpp 8 | include/golos/plugins/tags/tags_object.hpp 9 | include/golos/plugins/tags/tags_sort.hpp 10 | ) 11 | 12 | list(APPEND CURRENT_TARGET_SOURCES 13 | plugin.cpp 14 | tag_visitor.cpp 15 | discussion_query.cpp 16 | ) 17 | 18 | if(BUILD_SHARED_LIBRARIES) 19 | add_library(golos_${CURRENT_TARGET} SHARED 20 | ${CURRENT_TARGET_HEADERS} 21 | ${CURRENT_TARGET_SOURCES} 22 | ) 23 | else() 24 | add_library(golos_${CURRENT_TARGET} STATIC 25 | ${CURRENT_TARGET_HEADERS} 26 | ${CURRENT_TARGET_SOURCES} 27 | ) 28 | endif() 29 | 30 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 31 | 32 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 33 | 34 | target_link_libraries( 35 | golos_${CURRENT_TARGET} 36 | golos_chain 37 | golos::chain_plugin 38 | golos::network 39 | golos::follow 40 | golos::api 41 | golos::social_network 42 | appbase 43 | ) 44 | 45 | target_include_directories( 46 | golos_${CURRENT_TARGET} 47 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" 48 | "${CMAKE_CURRENT_SOURCE_DIR}/../../" 49 | ) 50 | 51 | install(TARGETS 52 | golos_${CURRENT_TARGET} 53 | 54 | RUNTIME DESTINATION bin 55 | LIBRARY DESTINATION lib 56 | ARCHIVE DESTINATION lib 57 | ) 58 | -------------------------------------------------------------------------------- /plugins/tags/include/golos/plugins/tags/tag_api_object.hpp: -------------------------------------------------------------------------------- 1 | #ifndef GOLOS_TAG_API_OBJ_HPP 2 | #define GOLOS_TAG_API_OBJ_HPP 3 | 4 | #include 5 | #include 6 | 7 | namespace golos { namespace plugins { namespace tags { 8 | struct tag_api_object { 9 | tag_api_object(const tags::tag_stats_object& o) 10 | : name(o.name), 11 | total_children_rshares2(o.total_children_rshares2), 12 | total_payouts(o.total_payout), 13 | net_votes(o.net_votes), top_posts(o.top_posts), 14 | comments(o.comments) { 15 | } 16 | 17 | tag_api_object() { 18 | } 19 | 20 | std::string name; 21 | fc::uint128_t total_children_rshares2; 22 | golos::protocol::asset total_payouts; 23 | int32_t net_votes = 0; 24 | uint32_t top_posts = 0; 25 | uint32_t comments = 0; 26 | }; 27 | } } } // golos::plugins::tags 28 | 29 | 30 | FC_REFLECT((golos::plugins::tags::tag_api_object), 31 | (name)(total_children_rshares2)(total_payouts)(net_votes)(top_posts)(comments) 32 | ) 33 | #endif //GOLOS_TAG_API_OBJ_HPP 34 | -------------------------------------------------------------------------------- /plugins/test_api/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET test_api_plugin) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/test_api/test_api_plugin.hpp 5 | ) 6 | 7 | list(APPEND CURRENT_TARGET_SOURCES 8 | test_api_plugin.cpp 9 | ) 10 | 11 | if(BUILD_SHARED_LIBRARIES) 12 | add_library(golos_${CURRENT_TARGET} SHARED 13 | ${CURRENT_TARGET_HEADERS} 14 | ${CURRENT_TARGET_SOURCES} 15 | ) 16 | else() 17 | add_library(golos_${CURRENT_TARGET} STATIC 18 | ${CURRENT_TARGET_HEADERS} 19 | ${CURRENT_TARGET_SOURCES} 20 | ) 21 | endif() 22 | 23 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 24 | 25 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 26 | 27 | target_link_libraries( 28 | golos_${CURRENT_TARGET} 29 | golos::json_rpc 30 | fc 31 | appbase 32 | ) 33 | 34 | target_include_directories( 35 | golos_${CURRENT_TARGET} 36 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" 37 | "${CMAKE_CURRENT_SOURCE_DIR}/../../" 38 | ) 39 | 40 | install(TARGETS 41 | golos_${CURRENT_TARGET} 42 | 43 | RUNTIME DESTINATION bin 44 | LIBRARY DESTINATION lib 45 | ARCHIVE DESTINATION lib 46 | ) 47 | 48 | install(FILES ${HEADERS} DESTINATION "include/golos/test_api_plugin") 49 | 50 | 51 | #target_link_libraries( test_api_plugin plugin appbase fc ) -------------------------------------------------------------------------------- /plugins/test_api/test_api_plugin.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | namespace golos { 6 | namespace plugins { 7 | namespace test_api { 8 | 9 | test_api_plugin::test_api_plugin() { 10 | } 11 | 12 | test_api_plugin::~test_api_plugin() { 13 | } 14 | 15 | void test_api_plugin::plugin_initialize(const boost::program_options::variables_map &options) { 16 | JSON_RPC_REGISTER_API(plugin_name); 17 | } 18 | 19 | void test_api_plugin::plugin_startup() { 20 | } 21 | 22 | void test_api_plugin::plugin_shutdown() { 23 | } 24 | 25 | DEFINE_API(test_api_plugin, test_api_a) { 26 | test_api_a_t result; 27 | result.value = "A"; 28 | return result; 29 | } 30 | 31 | DEFINE_API(test_api_plugin, test_api_b) { 32 | test_api_b_t result; 33 | result.value = "B"; 34 | return result; 35 | } 36 | 37 | } 38 | } 39 | } // steem::plugins::test_api 40 | -------------------------------------------------------------------------------- /plugins/webserver/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET webserver_plugin) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/webserver/webserver_plugin.hpp 5 | ) 6 | 7 | list(APPEND CURRENT_TARGET_SOURCES 8 | webserver_plugin.cpp 9 | ) 10 | 11 | if(BUILD_SHARED_LIBRARIES) 12 | add_library(golos_${CURRENT_TARGET} SHARED 13 | ${CURRENT_TARGET_HEADERS} 14 | ${CURRENT_TARGET_SOURCES} 15 | ) 16 | else() 17 | add_library(golos_${CURRENT_TARGET} STATIC 18 | ${CURRENT_TARGET_HEADERS} 19 | ${CURRENT_TARGET_SOURCES} 20 | ) 21 | endif() 22 | 23 | 24 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 25 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 26 | target_link_libraries( 27 | golos_${CURRENT_TARGET} 28 | golos::json_rpc 29 | golos_chain 30 | golos::chain_plugin 31 | appbase 32 | fc) 33 | target_include_directories(golos_${CURRENT_TARGET} 34 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/../../") 35 | 36 | install(TARGETS 37 | golos_${CURRENT_TARGET} 38 | 39 | RUNTIME DESTINATION bin 40 | LIBRARY DESTINATION lib 41 | ARCHIVE DESTINATION lib 42 | ) 43 | -------------------------------------------------------------------------------- /plugins/witness/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET witness) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/witness/witness.hpp 5 | ) 6 | 7 | list(APPEND CURRENT_TARGET_SOURCES 8 | witness.cpp 9 | ) 10 | 11 | if(BUILD_SHARED_LIBRARIES) 12 | add_library(golos_${CURRENT_TARGET} SHARED 13 | ${CURRENT_TARGET_HEADERS} 14 | ${CURRENT_TARGET_SOURCES} 15 | ) 16 | else() 17 | add_library(golos_${CURRENT_TARGET} STATIC 18 | ${CURRENT_TARGET_HEADERS} 19 | ${CURRENT_TARGET_SOURCES} 20 | ) 21 | endif() 22 | 23 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 24 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 25 | 26 | target_link_libraries( 27 | golos_${CURRENT_TARGET} 28 | golos::chain_plugin 29 | golos::p2p 30 | golos::protocol 31 | golos::network 32 | graphene_utilities 33 | graphene_time 34 | appbase 35 | ) 36 | target_include_directories(golos_${CURRENT_TARGET} 37 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") 38 | 39 | install(TARGETS 40 | golos_${CURRENT_TARGET} 41 | 42 | RUNTIME DESTINATION bin 43 | LIBRARY DESTINATION lib 44 | ARCHIVE DESTINATION lib 45 | ) 46 | 47 | -------------------------------------------------------------------------------- /plugins/witness_api/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET witness_api) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/witness_api/plugin.hpp 5 | include/golos/plugins/witness_api/api_objects/feed_history_api_object.hpp 6 | ) 7 | 8 | list(APPEND CURRENT_TARGET_SOURCES 9 | plugin.cpp 10 | ) 11 | 12 | if (BUILD_SHARED_LIBRARIES) 13 | add_library(golos_${CURRENT_TARGET} SHARED 14 | ${CURRENT_TARGET_HEADERS} 15 | ${CURRENT_TARGET_SOURCES} 16 | ) 17 | else() 18 | add_library(golos_${CURRENT_TARGET} STATIC 19 | ${CURRENT_TARGET_HEADERS} 20 | ${CURRENT_TARGET_SOURCES} 21 | ) 22 | endif() 23 | 24 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 25 | 26 | target_link_libraries ( 27 | golos_${CURRENT_TARGET} 28 | golos_chain 29 | golos_chain_plugin 30 | golos_protocol 31 | golos_api 32 | appbase 33 | golos_json_rpc 34 | graphene_time 35 | chainbase 36 | fc 37 | ) 38 | 39 | target_include_directories(golos_${CURRENT_TARGET} 40 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" 41 | "${CMAKE_CURRENT_SOURCE_DIR}/../../" 42 | ) 43 | 44 | install(TARGETS 45 | golos_${CURRENT_TARGET} 46 | 47 | RUNTIME DESTINATION bin 48 | LIBRARY DESTINATION lib 49 | ARCHIVE DESTINATION lib 50 | ) -------------------------------------------------------------------------------- /plugins/witness_api/include/golos/plugins/witness_api/api_objects/feed_history_api_object.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace golos { namespace plugins { namespace witness_api { 6 | 7 | using namespace golos::chain; 8 | using namespace golos::protocol; 9 | 10 | struct feed_history_api_object { 11 | feed_history_api_object(const feed_history_object &f) : 12 | id(f.id), 13 | current_median_history(f.current_median_history), 14 | price_history(f.price_history.begin(), f.price_history.end()) { 15 | } 16 | 17 | feed_history_api_object() { 18 | } 19 | 20 | feed_history_id_type id; 21 | price current_median_history; 22 | deque price_history; 23 | }; 24 | } 25 | } 26 | } 27 | 28 | FC_REFLECT((golos::plugins::witness_api::feed_history_api_object), (id)(current_median_history)(price_history)) 29 | -------------------------------------------------------------------------------- /plugins/witness_api/include/golos/plugins/witness_api/api_objects/witness_vote_api_object.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace golos { namespace plugins { namespace witness_api { 6 | 7 | using namespace golos::chain; 8 | using namespace golos::protocol; 9 | 10 | struct witness_vote_api_object { 11 | witness_vote_api_object(const witness_vote_object& v, const database& _db) : 12 | account(_db.get(v.account).name), 13 | account_id(v.account), 14 | rshares(v.rshares) { 15 | } 16 | 17 | witness_vote_api_object() { 18 | } 19 | 20 | account_name_type account; 21 | account_id_type account_id; 22 | share_type rshares; 23 | }; 24 | } 25 | } 26 | } 27 | 28 | FC_REFLECT((golos::plugins::witness_api::witness_vote_api_object), 29 | (account)(account_id)(rshares)) 30 | -------------------------------------------------------------------------------- /plugins/worker_api/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET worker_api) 2 | 3 | list(APPEND CURRENT_TARGET_HEADERS 4 | include/golos/plugins/worker_api/worker_api_plugin.hpp 5 | include/golos/plugins/worker_api/worker_api_objects.hpp 6 | include/golos/plugins/worker_api/worker_api_queries.hpp 7 | include/golos/plugins/worker_api/worker_api_sorts.hpp 8 | ) 9 | 10 | list(APPEND CURRENT_TARGET_SOURCES 11 | worker_api_plugin.cpp 12 | worker_api_queries.cpp 13 | ) 14 | 15 | if(BUILD_SHARED_LIBRARIES) 16 | add_library(golos_${CURRENT_TARGET} SHARED 17 | ${CURRENT_TARGET_HEADERS} 18 | ${CURRENT_TARGET_SOURCES} 19 | ) 20 | else() 21 | add_library(golos_${CURRENT_TARGET} STATIC 22 | ${CURRENT_TARGET_HEADERS} 23 | ${CURRENT_TARGET_SOURCES} 24 | ) 25 | endif() 26 | 27 | add_library(golos::${CURRENT_TARGET} ALIAS golos_${CURRENT_TARGET}) 28 | set_property(TARGET golos_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_TARGET}) 29 | 30 | target_link_libraries( 31 | golos_${CURRENT_TARGET} 32 | golos::chain_plugin 33 | golos::protocol 34 | golos::network 35 | golos::json_rpc 36 | golos::api 37 | golos::follow 38 | golos::social_network 39 | graphene_utilities 40 | graphene_time 41 | appbase 42 | ) 43 | target_include_directories(golos_${CURRENT_TARGET} 44 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") 45 | 46 | install(TARGETS 47 | golos_${CURRENT_TARGET} 48 | 49 | RUNTIME DESTINATION bin 50 | LIBRARY DESTINATION lib 51 | ARCHIVE DESTINATION lib 52 | ) 53 | 54 | -------------------------------------------------------------------------------- /plugins/worker_api/include/golos/plugins/worker_api/worker_api_plugin.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | namespace golos { namespace plugins { namespace worker_api { 12 | 13 | using namespace golos::chain; 14 | 15 | DEFINE_API_ARGS(get_worker_requests, json_rpc::msg_pack, std::vector) 16 | DEFINE_API_ARGS(get_worker_request_votes, json_rpc::msg_pack, std::vector) 17 | 18 | class worker_api_plugin final : public appbase::plugin { 19 | public: 20 | APPBASE_PLUGIN_REQUIRES((json_rpc::plugin)) 21 | 22 | worker_api_plugin(); 23 | 24 | ~worker_api_plugin(); 25 | 26 | void set_program_options( 27 | boost::program_options::options_description& cli, 28 | boost::program_options::options_description& cfg) override; 29 | 30 | void plugin_initialize(const boost::program_options::variables_map& options) override; 31 | 32 | void plugin_startup() override; 33 | 34 | void plugin_shutdown() override; 35 | 36 | static const std::string& name(); 37 | 38 | DECLARE_API( 39 | (get_worker_requests) 40 | (get_worker_request_votes) 41 | ) 42 | private: 43 | class worker_api_plugin_impl; 44 | 45 | std::unique_ptr my; 46 | }; 47 | 48 | } } } //golos::plugins::worker_api 49 | -------------------------------------------------------------------------------- /plugins/worker_api/include/golos/plugins/worker_api/worker_api_queries.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace golos::chain; 8 | 9 | namespace golos { namespace plugins { namespace worker_api { 10 | 11 | struct worker_request_query { 12 | uint32_t limit = 20; 13 | fc::optional start_author; 14 | fc::optional start_permlink; 15 | std::set select_authors; 16 | std::set select_states; 17 | 18 | void validate() const; 19 | 20 | bool has_start() const { 21 | return !!start_author; 22 | } 23 | 24 | bool has_author() const { 25 | return !select_authors.empty(); 26 | } 27 | 28 | bool is_good_author(const std::string& author) const { 29 | return !has_author() || select_authors.count(author); 30 | } 31 | 32 | bool is_good_state(const worker_request_state& state) const { 33 | return select_states.empty() || select_states.count(state); 34 | } 35 | }; 36 | 37 | } } } // golos::plugins::worker_api 38 | 39 | FC_REFLECT((golos::plugins::worker_api::worker_request_query), 40 | (limit)(start_author)(start_permlink)(select_authors)(select_states) 41 | ); 42 | -------------------------------------------------------------------------------- /plugins/worker_api/include/golos/plugins/worker_api/worker_api_sorts.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace golos { namespace plugins { namespace worker_api { 6 | 7 | enum class worker_request_sort { 8 | by_created, 9 | by_net_rshares, 10 | by_upvotes, 11 | by_downvotes 12 | }; 13 | 14 | } } } // golos::plugins::worker_api 15 | 16 | FC_REFLECT_ENUM(golos::plugins::worker_api::worker_request_sort, (by_created)(by_net_rshares)(by_upvotes)(by_downvotes)) 17 | -------------------------------------------------------------------------------- /plugins/worker_api/worker_api_queries.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using golos::protocol::validate_account_name; 5 | using golos::protocol::validate_permlink; 6 | 7 | namespace golos { namespace plugins { namespace worker_api { 8 | 9 | void worker_request_query::validate() const { 10 | GOLOS_CHECK_LIMIT_PARAM(limit, 100); 11 | 12 | if (!!start_author) { 13 | GOLOS_CHECK_PARAM_ACCOUNT(*start_author); 14 | 15 | GOLOS_CHECK_PARAM(start_permlink, 16 | GOLOS_CHECK_VALUE(!!start_permlink, "start_author without start_permlink is useless")); 17 | } 18 | if (!!start_permlink) { 19 | GOLOS_CHECK_PARAM(*start_permlink, validate_permlink(*start_permlink)); 20 | 21 | GOLOS_CHECK_PARAM(start_author, 22 | GOLOS_CHECK_VALUE(!!start_author, "start_permlink without start_author is useless")); 23 | } 24 | 25 | for (auto& select_author : select_authors) { 26 | GOLOS_CHECK_PARAM_ACCOUNT(select_author); 27 | } 28 | } 29 | 30 | } } } // golos::plugins::worker_api 31 | 32 | -------------------------------------------------------------------------------- /programs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(build_helpers) 2 | add_subdirectory(cli_wallet) 3 | add_subdirectory(golosd) 4 | add_subdirectory(historian) 5 | #add_subdirectory( delayed_node ) 6 | add_subdirectory(js_operation_serializer) 7 | add_subdirectory(meter) 8 | add_subdirectory(size_checker) 9 | add_subdirectory(util) 10 | -------------------------------------------------------------------------------- /programs/build_helpers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(cat-parts cat-parts.cpp) 2 | if(UNIX AND NOT APPLE) 3 | set(rt_library rt) 4 | endif() 5 | 6 | # we only actually need Boost, but link against FC for now so we don't duplicate it. 7 | target_link_libraries(cat-parts PRIVATE fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS}) 8 | -------------------------------------------------------------------------------- /programs/cli_wallet/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(cli_wallet main.cpp) 2 | if(UNIX AND NOT APPLE) 3 | set(rt_library rt) 4 | endif() 5 | 6 | if(APPLE) 7 | list(APPEND PLATFORM_SPECIFIC_LIBS readline) 8 | endif() 9 | 10 | find_package(Gperftools QUIET) 11 | if(GPERFTOOLS_FOUND) 12 | message(STATUS "Found gperftools; compiling cli_wallet with TCMalloc") 13 | list(APPEND PLATFORM_SPECIFIC_LIBS tcmalloc) 14 | endif() 15 | 16 | FIND_PACKAGE(Boost REQUIRED COMPONENTS 17 | regex 18 | ) 19 | 20 | # I don't know why golos_app is required twice in the following line, I just know the linker breaks if it isn't. 21 | target_link_libraries( 22 | cli_wallet 23 | PRIVATE 24 | golos_network 25 | golos_chain 26 | golos_protocol 27 | graphene_utilities 28 | golos_wallet 29 | golos::database_api 30 | golos::account_history 31 | golos::market_history 32 | golos::social_network 33 | golos::private_message 34 | golos::follow 35 | golos::network_broadcast_api 36 | golos::witness_api 37 | fc 38 | ${readline_libraries} 39 | ${CMAKE_DL_LIBS} 40 | ${PLATFORM_SPECIFIC_LIBS} 41 | ${Boost_LIBRARIES} 42 | ) 43 | 44 | if(MSVC) 45 | set_source_files_properties(main.cpp PROPERTIES COMPILE_FLAGS "/bigobj") 46 | endif(MSVC) 47 | 48 | install(TARGETS 49 | cli_wallet 50 | 51 | RUNTIME DESTINATION bin 52 | LIBRARY DESTINATION lib 53 | ARCHIVE DESTINATION lib 54 | ) 55 | -------------------------------------------------------------------------------- /programs/golosd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CURRENT_TARGET golosd) 2 | add_executable(${CURRENT_TARGET} main.cpp) 3 | 4 | if(UNIX AND NOT APPLE) 5 | set(rt_library rt) 6 | elseif(APPLE) 7 | list(APPEND PLATFORM_SPECIFIC_LIBS readline) 8 | endif() 9 | 10 | find_package(Gperftools QUIET) 11 | if(GPERFTOOLS_FOUND) 12 | message(STATUS "Found gperftools; compiling golosd with TCMalloc") 13 | list(APPEND PLATFORM_SPECIFIC_LIBS tcmalloc) 14 | endif() 15 | 16 | target_link_libraries( 17 | ${CURRENT_TARGET} PRIVATE 18 | appbase 19 | golos::webserver_plugin 20 | golos::p2p 21 | graphene_utilities 22 | golos::chain_plugin 23 | golos::network_broadcast_api 24 | golos::witness 25 | golos::witness_api 26 | golos::database_api 27 | golos::test_api_plugin 28 | golos::social_network 29 | golos::tags 30 | golos::market_history 31 | golos::operation_dump 32 | golos::operation_history 33 | golos::statsd 34 | golos::account_by_key 35 | golos::account_history 36 | golos::account_notes 37 | golos::private_message 38 | golos::auth_util 39 | golos::debug_node 40 | golos::raw_block 41 | golos::block_info 42 | golos::json_rpc 43 | golos::follow 44 | golos::worker_api 45 | golos::elastic_search 46 | golos::event_plugin 47 | golos::account_relations 48 | golos::paid_subscription_api 49 | golos::nft_api 50 | golos::cryptor 51 | golos::exchange 52 | ${MONGO_LIB} 53 | golos_protocol 54 | fc 55 | ${CMAKE_DL_LIBS} 56 | ${PLATFORM_SPECIFIC_LIBS} 57 | ) 58 | 59 | install(TARGETS 60 | ${CURRENT_TARGET} 61 | 62 | RUNTIME DESTINATION bin 63 | LIBRARY DESTINATION lib 64 | ARCHIVE DESTINATION lib 65 | ) 66 | -------------------------------------------------------------------------------- /programs/historian/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(historian main.cpp) 2 | if(UNIX AND NOT APPLE) 3 | set(rt_library rt) 4 | endif() 5 | 6 | target_link_libraries(historian 7 | PRIVATE golos_chain 8 | golos_protocol 9 | fc 10 | indicators 11 | ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS}) 12 | 13 | install(TARGETS 14 | historian 15 | 16 | RUNTIME DESTINATION bin 17 | LIBRARY DESTINATION lib 18 | ARCHIVE DESTINATION lib 19 | ) 20 | -------------------------------------------------------------------------------- /programs/js_operation_serializer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(js_operation_serializer main.cpp) 2 | if(UNIX AND NOT APPLE) 3 | set(rt_library rt) 4 | endif() 5 | 6 | target_link_libraries(js_operation_serializer 7 | PRIVATE 8 | golos_chain 9 | golos_protocol 10 | graphene_utilities 11 | golos::private_message 12 | golos::follow 13 | fc 14 | ${CMAKE_DL_LIBS} 15 | ${PLATFORM_SPECIFIC_LIBS}) 16 | 17 | install(TARGETS 18 | js_operation_serializer 19 | 20 | RUNTIME DESTINATION bin 21 | LIBRARY DESTINATION lib 22 | ARCHIVE DESTINATION lib 23 | ) 24 | -------------------------------------------------------------------------------- /programs/meter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(meter main.cpp) 2 | if(UNIX AND NOT APPLE) 3 | set(rt_library rt) 4 | endif() 5 | 6 | target_link_libraries(meter 7 | PRIVATE golos_chain 8 | golos::account_by_key 9 | golos::account_history 10 | golos::account_notes 11 | golos::event_plugin 12 | golos::market_history 13 | golos::private_message 14 | golos::worker_api 15 | golos_protocol fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS}) 16 | 17 | install(TARGETS 18 | meter 19 | 20 | RUNTIME DESTINATION bin 21 | LIBRARY DESTINATION lib 22 | ARCHIVE DESTINATION lib 23 | ) 24 | -------------------------------------------------------------------------------- /programs/size_checker/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(size_checker main.cpp) 2 | if(UNIX AND NOT APPLE) 3 | set(rt_library rt) 4 | endif() 5 | 6 | target_link_libraries(size_checker 7 | PRIVATE golos_chain golos_protocol fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS}) 8 | 9 | install(TARGETS 10 | size_checker 11 | 12 | RUNTIME DESTINATION bin 13 | LIBRARY DESTINATION lib 14 | ARCHIVE DESTINATION lib 15 | ) 16 | -------------------------------------------------------------------------------- /programs/util/pretty_schema.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import itertools 4 | import json 5 | import requests 6 | 7 | id_count = itertools.count(1) 8 | 9 | result = requests.post("http://127.0.0.1:18390", data=json.dumps( 10 | {"jsonrpc": "2.0", "method": "call", 11 | "params": ["debug_node_api", "debug_get_json_schema", []], 12 | "id": next(id_count)})) 13 | str_schema = result.json()["result"] 14 | schema = json.loads(str_schema) 15 | 16 | 17 | def maybe_json(s): 18 | try: 19 | return json.loads(s) 20 | except ValueError: 21 | return s 22 | 23 | 24 | new_types = {k: maybe_json(v) for k, v in schema["types"].items()} 25 | schema["types"] = new_types 26 | 27 | print(json.dumps(schema, indent=3, sort_keys=True)) 28 | -------------------------------------------------------------------------------- /programs/util/saltpass.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import base64 4 | import getpass 5 | import hashlib 6 | import json 7 | import os 8 | 9 | pw = getpass.getpass("enter your password: ") 10 | pw_bytes = pw.encode("utf-8") 11 | salt_bytes = os.urandom(8) 12 | salt_b64 = base64.b64encode(salt_bytes) 13 | pw_hash = hashlib.sha256(pw_bytes + salt_bytes).digest() 14 | pw_hash_b64 = base64.b64encode(pw_hash) 15 | 16 | print(json.dumps( 17 | { 18 | "password_hash_b64": pw_hash_b64.decode("ascii"), 19 | "password_salt_b64": salt_b64.decode("ascii"), 20 | }, 21 | sort_keys=True, 22 | indent=3, separators=(',', ' : ') 23 | )) 24 | -------------------------------------------------------------------------------- /programs/util/schema_test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | using namespace graphene::db; 14 | 15 | struct mystruct { 16 | std::string alpha; 17 | uint64_t beta; 18 | }; 19 | 20 | FC_REFLECT(mystruct, 21 | (alpha) 22 | (beta) 23 | ); 24 | 25 | void process(std::shared_ptr s) { 26 | std::string name; 27 | s->get_name(name); 28 | std::cout << " name = " << name; 29 | std::vector> deps; 30 | s->get_deps(deps); 31 | std::vector dep_names; 32 | for (const std::shared_ptr &s : deps) { 33 | std::string s_name; 34 | s->get_name(s_name); 35 | dep_names.push_back(s_name); 36 | } 37 | std::cout << " deps = " << fc::json::to_string(dep_names); 38 | std::string str_schema; 39 | s->get_str_schema(str_schema); 40 | std::cout << " s = " << str_schema; 41 | std::cout << std::endl; 42 | } 43 | 44 | int main(int argc, char **argv, char **envp) { 45 | std::vector> schemas; 46 | 47 | schemas.push_back(get_schema_for_type()); 48 | schemas.push_back(get_schema_for_type()); 49 | add_dependent_schemas(schemas); 50 | 51 | for (const std::shared_ptr &s : schemas) { 52 | process(s); 53 | } 54 | 55 | return 0; 56 | } 57 | -------------------------------------------------------------------------------- /programs/util/sign_digest.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include 9 | 10 | #include 11 | 12 | struct signing_request { 13 | fc::sha256 dig; 14 | std::string wif; 15 | }; 16 | 17 | struct signing_result { 18 | fc::sha256 dig; 19 | golos::protocol::public_key_type key; 20 | golos::protocol::signature_type sig; 21 | }; 22 | 23 | FC_REFLECT((signing_request), (dig)(wif)) 24 | FC_REFLECT((signing_result), (dig)(key)(sig)) 25 | 26 | int main(int argc, char **argv, char **envp) { 27 | // hash key pairs on stdin 28 | std::string chain_id, hash, wif; 29 | while (std::cin) { 30 | std::string line; 31 | std::getline(std::cin, line); 32 | boost::trim(line); 33 | if (line == "") { 34 | continue; 35 | } 36 | 37 | fc::variant v = fc::json::from_string(line, fc::json::strict_parser); 38 | signing_request sreq; 39 | fc::from_variant(v, sreq); 40 | signing_result sres; 41 | sres.dig = sreq.dig; 42 | fc::ecc::private_key priv_key = *golos::utilities::wif_to_key(sreq.wif); 43 | sres.sig = priv_key.sign_compact(sreq.dig); 44 | sres.key = golos::protocol::public_key_type(priv_key.get_public_key()); 45 | std::cout << fc::json::to_string(sres) << std::endl; 46 | } 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /programs/util/sign_transaction.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include 9 | 10 | #include 11 | 12 | struct tx_signing_request { 13 | golos::protocol::transaction tx; 14 | std::string wif; 15 | }; 16 | 17 | struct tx_signing_result { 18 | golos::protocol::transaction tx; 19 | fc::sha256 digest; 20 | fc::sha256 sig_digest; 21 | golos::protocol::public_key_type key; 22 | golos::protocol::signature_type sig; 23 | }; 24 | 25 | FC_REFLECT((tx_signing_request), (tx)(wif)) 26 | FC_REFLECT((tx_signing_result), (digest)(sig_digest)(key)(sig)) 27 | 28 | int main(int argc, char **argv, char **envp) { 29 | // hash key pairs on stdin 30 | std::string chain_id, hash, wif; 31 | while (std::cin) { 32 | std::string line; 33 | std::getline(std::cin, line); 34 | boost::trim(line); 35 | if (line == "") { 36 | continue; 37 | } 38 | 39 | fc::variant v = fc::json::from_string(line, fc::json::strict_parser); 40 | tx_signing_request sreq; 41 | fc::from_variant(v, sreq); 42 | tx_signing_result sres; 43 | sres.tx = sreq.tx; 44 | sres.digest = sreq.tx.digest(); 45 | sres.sig_digest = sreq.tx.sig_digest(STEEMIT_CHAIN_ID); 46 | 47 | fc::ecc::private_key priv_key = *golos::utilities::wif_to_key(sreq.wif); 48 | sres.sig = priv_key.sign_compact(sres.sig_digest); 49 | sres.key = golos::protocol::public_key_type(priv_key.get_public_key()); 50 | std::cout << fc::json::to_string(sres) << std::endl; 51 | } 52 | return 0; 53 | } 54 | -------------------------------------------------------------------------------- /programs/util/test_block_log.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char **argv, char **envp) { 4 | try { 5 | //golos::chain::database db; 6 | golos::chain::block_log log; 7 | 8 | fc::temp_directory temp_dir("."); 9 | 10 | //db.open( temp_dir ); 11 | log.open(temp_dir.path() / "log"); 12 | 13 | idump((log.head())); 14 | 15 | golos::protocol::signed_block b1; 16 | b1.witness = "alice"; 17 | b1.previous = golos::protocol::block_id_type(); 18 | 19 | log.append(b1); 20 | log.flush(); 21 | idump((b1)); 22 | idump((log.head())); 23 | idump((fc::raw::pack_size(b1))); 24 | 25 | golos::protocol::signed_block b2; 26 | b2.witness = "bob"; 27 | b2.previous = b1.id(); 28 | 29 | log.append(b2); 30 | log.flush(); 31 | idump((b2)); 32 | idump((log.head())); 33 | idump((fc::raw::pack_size(b2))); 34 | 35 | auto r1 = log.read_block(0); 36 | idump((r1)); 37 | idump((fc::raw::pack_size(r1.first))); 38 | 39 | auto r2 = log.read_block(r1.second); 40 | idump((r2)); 41 | idump((fc::raw::pack_size(r2.first))); 42 | 43 | idump((log.read_head())); 44 | idump((fc::raw::pack_size(log.read_head()))); 45 | 46 | auto r3 = log.read_block(r2.second); 47 | idump((r3)); 48 | } 49 | catch (const std::exception &e) { 50 | edump((std::string(e.what()))); 51 | } 52 | 53 | return 0; 54 | } -------------------------------------------------------------------------------- /share/golosd/golosdctl: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | GOLOSD=golosd 4 | HOME="/var/lib/golosd" 5 | REPLAY_FLAG="$HOME/replay" 6 | FORCE_REPLAY_FLAG="$HOME/force-reply" 7 | 8 | USAGE="Usage: `basename $0` start | stop | restart | status | replay | force-replay" 9 | 10 | if [ $# -ne 1 ]; then 11 | echo "${USAGE}" >&2 12 | exit 1 13 | fi 14 | 15 | ACTION="${1}" 16 | 17 | case "${ACTION}" in 18 | start|stop|restart|status) 19 | exec sv "${ACTION}" "${GOLOSD}" 20 | ;; 21 | replay) 22 | touch "${REPLAY_FLAG}" 23 | exec sv restart "${GOLOSD}" 24 | ;; 25 | force-replay) 26 | touch "${FORCE_REPLAY_FLAG}" 27 | exec sv restart "${GOLOSD}" 28 | ;; 29 | *) 30 | echo "${USAGE}" >&2 31 | exit 1 32 | ;; 33 | esac 34 | -------------------------------------------------------------------------------- /share/golosd/seednodes: -------------------------------------------------------------------------------- 1 | 65.109.83.252:4243 2 | 23.88.107.61:2001 3 | 116.202.30.93:2001 4 | 167.235.139.111:2001 5 | 95.216.200.20:3001 6 | 65.21.6.225:2000 7 | 65.108.213.75:4243 8 | 65.109.200.83:4243 9 | 91.107.161.243:4243 10 | 95.217.228.80:4243 11 | 95.217.59.180:30218 12 | 37.192.123.64:9243 13 | -------------------------------------------------------------------------------- /share/golosd/seednodes_empty: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/README.md: -------------------------------------------------------------------------------- 1 | # Automated Testing Documentation 2 | 3 | ## To Run The Tests 4 | 5 | In the root of the repository. 6 | 7 | docker build --rm=false \ 8 | -t golosd/golosd-test \ 9 | -f share/golosd/docker/Dockerfile-test . 10 | 11 | ## To Troubleshoot Failing Tests 12 | 13 | docker run -ti \ 14 | golosd/golosd-test \ 15 | /bin/bash 16 | -------------------------------------------------------------------------------- /tests/common/builder.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "builder.hpp" 3 | 4 | #include "database_fixture.hpp" 5 | 6 | namespace golos { namespace chain { 7 | 8 | void builder_op::push(const private_key_type& private_key) { 9 | signed_transaction tx; 10 | operation oop = to_operation(); 11 | GOLOS_CHECK_NO_THROW(fixture()->push_tx_with_ops(tx, private_key, oop)); 12 | } 13 | 14 | } } 15 | -------------------------------------------------------------------------------- /tests/common/cryptor_fixture.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "database_fixture.hpp" 3 | 4 | using namespace golos::plugins::cryptor; 5 | using golos::plugins::json_rpc::msg_pack; 6 | 7 | struct cryptor_fixture : public clean_database_fixture_wrap { 8 | cryptor_fixture() : clean_database_fixture_wrap(true, [&]() { 9 | initialize(); 10 | }) { 11 | c_plugin = &(appbase::app().register_plugin()); 12 | 13 | std::vector args; 14 | args.push_back("golosd"); 15 | args.push_back("--cryptor-key"); 16 | args.push_back("1234567890123456"); 17 | 18 | bpo::options_description desc; 19 | c_plugin->set_program_options(desc, desc); 20 | 21 | bpo::variables_map options; 22 | bpo::store(parse_command_line(args.size(), (char**)(args.data()), desc), options); 23 | bpo::notify(options); 24 | 25 | c_plugin->plugin_initialize(options); 26 | 27 | open_database(); 28 | startup(); 29 | c_plugin->plugin_startup(); 30 | } 31 | 32 | encrypted_api_object encrypt_body(const encrypt_query& eq) { 33 | msg_pack mp; 34 | mp.args = std::vector({fc::variant(eq)}); 35 | return c_plugin->encrypt_body(mp); 36 | } 37 | 38 | decrypted_api_object decrypt_comments(const decrypt_query& dq) { 39 | msg_pack mp; 40 | mp.args = std::vector({fc::variant(dq)}); 41 | return c_plugin->decrypt_comments(mp); 42 | } 43 | 44 | cryptor* c_plugin = nullptr; 45 | }; 46 | -------------------------------------------------------------------------------- /tests/common/worker_api_fixture.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "worker_fixture.hpp" 3 | 4 | using golos::chain::worker_fixture; 5 | 6 | struct worker_api_fixture : public worker_fixture { 7 | worker_api_fixture() : worker_fixture(true, [&]() { 8 | database_fixture::initialize(); 9 | open_database(); 10 | startup(); 11 | }) { 12 | } 13 | }; 14 | -------------------------------------------------------------------------------- /tests/common/worker_fixture.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "database_fixture.hpp" 6 | 7 | namespace golos { namespace protocol { 8 | 9 | static inline std::ostream& operator<<(std::ostream& out, worker_request_state s) { 10 | return out << fc::json::to_string(s); 11 | } 12 | 13 | } } // golos::protocol 14 | 15 | namespace golos { namespace chain { 16 | 17 | struct worker_fixture : public clean_database_fixture_wrap { 18 | 19 | worker_fixture(bool init = true, std::function custom_init = {}) : 20 | clean_database_fixture_wrap(init, custom_init) { 21 | } 22 | 23 | void worker_request_vote( 24 | const string& voter, const private_key_type& voter_key, 25 | const string& author, const string& permlink, int16_t vote_percent) { 26 | signed_transaction tx; 27 | 28 | worker_request_vote_operation op; 29 | op.voter = voter; 30 | op.author = author; 31 | op.permlink = permlink; 32 | op.vote_percent = vote_percent; 33 | BOOST_CHECK_NO_THROW(push_tx_with_ops(tx, voter_key, op)); 34 | } 35 | 36 | void check_request_closed(const comment_id_type& post, worker_request_state state, asset consumption_after_close) { 37 | BOOST_TEST_MESSAGE("---- Checking request is not deleted but closed"); 38 | 39 | const auto* wro = _db.find_worker_request(post); 40 | BOOST_CHECK(wro); 41 | BOOST_CHECK(wro->state == state); 42 | 43 | BOOST_TEST_MESSAGE("---- Checking approves are cleared"); 44 | 45 | const auto& wrvo_idx = _db.get_index(); 46 | BOOST_CHECK(wrvo_idx.find(post) == wrvo_idx.end()); 47 | } 48 | }; 49 | 50 | } } // golos:chain 51 | -------------------------------------------------------------------------------- /tests/generate_empty_blocks/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(generate_empty_blocks main.cpp) 2 | if(UNIX AND NOT APPLE) 3 | set(rt_library rt) 4 | endif() 5 | 6 | target_link_libraries(generate_empty_blocks 7 | PRIVATE vaporware_app vaporware_chain fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS}) 8 | 9 | install(TARGETS 10 | generate_empty_blocks 11 | 12 | RUNTIME DESTINATION bin 13 | LIBRARY DESTINATION lib 14 | ARCHIVE DESTINATION lib 15 | ) 16 | -------------------------------------------------------------------------------- /tests/plugin_tests/worker_api_payment.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "worker_api_fixture.hpp" 4 | #include "helpers.hpp" 5 | 6 | #include 7 | 8 | using namespace golos; 9 | using namespace golos::protocol; 10 | using namespace golos::plugins::worker_api; 11 | 12 | BOOST_FIXTURE_TEST_SUITE(worker_api_plugin_payment, worker_api_fixture) 13 | 14 | BOOST_AUTO_TEST_SUITE_END() 15 | -------------------------------------------------------------------------------- /tests/tests/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Cryptonomex, Inc., and contributors. 3 | * 4 | * The MIT License 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | #include 25 | #include 26 | #include 27 | 28 | #ifdef BOOST_TEST_DYN_LINK 29 | #define BOOST_TEST_MODULE unit_tests 30 | #include 31 | #else 32 | #include 33 | #endif 34 | 35 | 36 | boost::unit_test::test_suite *init_unit_test_suite(int argc, char *argv[]) { 37 | fc::configure_logging(fc::logging_config::default_config(fc::log_level::error)); 38 | 39 | std::srand(time(NULL)); 40 | std::cout << "Random number generator seeded to " << time(NULL) 41 | << std::endl; 42 | return nullptr; 43 | } -------------------------------------------------------------------------------- /thirdparty/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(appbase) 2 | add_subdirectory(fc) 3 | add_subdirectory(chainbase) 4 | add_subdirectory(indicators) -------------------------------------------------------------------------------- /thirdparty/indicators/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(indicators INTERFACE) 2 | target_include_directories(indicators INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include" ) 3 | -------------------------------------------------------------------------------- /thirdparty/indicators/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Pranav 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /thirdparty/indicators/LICENSE.termcolor: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013, Ihor Kalnytskyi. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms of the software as well 5 | as documentation, with or without modification, are permitted provided 6 | that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above 12 | copyright notice, this list of conditions and the following 13 | disclaimer in the documentation and/or other materials provided 14 | with the distribution. 15 | 16 | * The names of the contributors may not be used to endorse or 17 | promote products derived from this software without specific 18 | prior written permission. 19 | 20 | THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE COPYRIGHT HOLDERS AND 21 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 22 | NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 24 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE AND DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 31 | DAMAGE. 32 | -------------------------------------------------------------------------------- /thirdparty/indicators/include/indicators/color.hpp: -------------------------------------------------------------------------------- 1 | 2 | #ifndef INDICATORS_COLOR 3 | #define INDICATORS_COLOR 4 | 5 | namespace indicators { 6 | enum class Color { grey, red, green, yellow, blue, magenta, cyan, white, unspecified }; 7 | } 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /thirdparty/indicators/include/indicators/cursor_control.hpp: -------------------------------------------------------------------------------- 1 | 2 | #ifndef INDICATORS_CURSOR_CONTROL 3 | #define INDICATORS_CURSOR_CONTROL 4 | 5 | #if defined(_MSC_VER) 6 | #if !defined(NOMINMAX) 7 | #define NOMINMAX 8 | #endif 9 | #include 10 | #include 11 | #else 12 | #include 13 | #endif 14 | 15 | namespace indicators { 16 | 17 | #if defined(_MSC_VER) 18 | 19 | static inline void show_console_cursor(bool const show) { 20 | HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE); 21 | 22 | CONSOLE_CURSOR_INFO cursorInfo; 23 | 24 | GetConsoleCursorInfo(out, &cursorInfo); 25 | cursorInfo.bVisible = show; // set the cursor visibility 26 | SetConsoleCursorInfo(out, &cursorInfo); 27 | } 28 | 29 | static inline void erase_line() { 30 | auto hStdout = GetStdHandle(STD_OUTPUT_HANDLE); 31 | if (!hStdout) 32 | return; 33 | 34 | CONSOLE_SCREEN_BUFFER_INFO csbiInfo; 35 | GetConsoleScreenBufferInfo(hStdout, &csbiInfo); 36 | 37 | COORD cursor; 38 | 39 | cursor.X = 0; 40 | cursor.Y = csbiInfo.dwCursorPosition.Y; 41 | 42 | DWORD count = 0; 43 | 44 | FillConsoleOutputCharacterA(hStdout, ' ', csbiInfo.dwSize.X, cursor, &count); 45 | 46 | FillConsoleOutputAttribute(hStdout, csbiInfo.wAttributes, csbiInfo.dwSize.X, 47 | cursor, &count); 48 | 49 | SetConsoleCursorPosition(hStdout, cursor); 50 | } 51 | 52 | #else 53 | 54 | static inline void show_console_cursor(bool const show) { 55 | std::fputs(show ? "\033[?25h" : "\033[?25l", stdout); 56 | } 57 | 58 | static inline void erase_line() { 59 | std::fputs("\r\033[K", stdout); 60 | } 61 | 62 | #endif 63 | 64 | } // namespace indicators 65 | 66 | #endif -------------------------------------------------------------------------------- /thirdparty/indicators/include/indicators/cursor_movement.hpp: -------------------------------------------------------------------------------- 1 | 2 | #ifndef INDICATORS_CURSOR_MOVEMENT 3 | #define INDICATORS_CURSOR_MOVEMENT 4 | 5 | #if defined(_MSC_VER) 6 | #if !defined(NOMINMAX) 7 | #define NOMINMAX 8 | #endif 9 | #include 10 | #include 11 | #else 12 | #include 13 | #endif 14 | 15 | namespace indicators { 16 | 17 | #ifdef _MSC_VER 18 | 19 | static inline void move(int x, int y) { 20 | auto hStdout = GetStdHandle(STD_OUTPUT_HANDLE); 21 | if (!hStdout) 22 | return; 23 | 24 | CONSOLE_SCREEN_BUFFER_INFO csbiInfo; 25 | GetConsoleScreenBufferInfo(hStdout, &csbiInfo); 26 | 27 | COORD cursor; 28 | 29 | cursor.X = csbiInfo.dwCursorPosition.X + x; 30 | cursor.Y = csbiInfo.dwCursorPosition.Y + y; 31 | SetConsoleCursorPosition(hStdout, cursor); 32 | } 33 | 34 | static inline void move_up(int lines) { move(0, -lines); } 35 | static inline void move_down(int lines) { move(0, -lines); } 36 | static inline void move_right(int cols) { move(cols, 0); } 37 | static inline void move_left(int cols) { move(-cols, 0); } 38 | 39 | #else 40 | 41 | static inline void move_up(int lines) { std::cout << "\033[" << lines << "A"; } 42 | static inline void move_down(int lines) { std::cout << "\033[" << lines << "B"; } 43 | static inline void move_right(int cols) { std::cout << "\033[" << cols << "C"; } 44 | static inline void move_left(int cols) { std::cout << "\033[" << cols << "D"; } 45 | 46 | #endif 47 | 48 | } // namespace indicators 49 | 50 | #endif -------------------------------------------------------------------------------- /thirdparty/indicators/include/indicators/font_style.hpp: -------------------------------------------------------------------------------- 1 | 2 | #ifndef INDICATORS_FONT_STYLE 3 | #define INDICATORS_FONT_STYLE 4 | 5 | namespace indicators { 6 | enum class FontStyle { bold, dark, italic, underline, blink, reverse, concealed, crossed }; 7 | } 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /thirdparty/indicators/include/indicators/progress_type.hpp: -------------------------------------------------------------------------------- 1 | 2 | #ifndef INDICATORS_PROGRESS_TYPE 3 | #define INDICATORS_PROGRESS_TYPE 4 | 5 | namespace indicators { 6 | enum class ProgressType { incremental, decremental }; 7 | } 8 | 9 | #endif -------------------------------------------------------------------------------- /thirdparty/indicators/include/indicators/terminal_size.hpp: -------------------------------------------------------------------------------- 1 | 2 | #ifndef INDICATORS_TERMINAL_SIZE 3 | #define INDICATORS_TERMINAL_SIZE 4 | #include 5 | 6 | 7 | #if defined(_WIN32) 8 | #include 9 | 10 | namespace indicators { 11 | 12 | static inline std::pair terminal_size() { 13 | CONSOLE_SCREEN_BUFFER_INFO csbi; 14 | int cols, rows; 15 | GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi); 16 | cols = csbi.srWindow.Right - csbi.srWindow.Left + 1; 17 | rows = csbi.srWindow.Bottom - csbi.srWindow.Top + 1; 18 | return {static_cast(rows), static_cast(cols)}; 19 | } 20 | 21 | static inline size_t terminal_width() { return terminal_size().second; } 22 | 23 | } // namespace indicators 24 | 25 | #else 26 | 27 | #include //ioctl() and TIOCGWINSZ 28 | #include // for STDOUT_FILENO 29 | 30 | namespace indicators { 31 | 32 | static inline std::pair terminal_size() { 33 | struct winsize size{}; 34 | ioctl(STDOUT_FILENO, TIOCGWINSZ, &size); 35 | return {static_cast(size.ws_row), static_cast(size.ws_col)}; 36 | } 37 | 38 | static inline size_t terminal_width() { return terminal_size().second; } 39 | 40 | } // namespace indicators 41 | 42 | #endif 43 | 44 | #endif --------------------------------------------------------------------------------