Merge branch 'develop' into bug/94-docker-build
This commit is contained in:
commit
44dec0f157
200 changed files with 22041 additions and 7558 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -14,6 +14,7 @@ data
|
|||
CMakeDoxyfile.in
|
||||
|
||||
build
|
||||
build__*
|
||||
|
||||
libraries/utilities/git_revision.cpp
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
# Defines BitShares library target.
|
||||
project( BitShares )
|
||||
# Defines Peerplays library target.
|
||||
project( Peerplays )
|
||||
cmake_minimum_required( VERSION 2.8.12 )
|
||||
|
||||
set( BLOCKCHAIN_NAME "BitShares" )
|
||||
set( BLOCKCHAIN_NAME "Peerplays" )
|
||||
|
||||
set( CLI_CLIENT_EXECUTABLE_NAME graphene_client )
|
||||
set( GUI_CLIENT_EXECUTABLE_NAME BitShares )
|
||||
set( GUI_CLIENT_EXECUTABLE_NAME Peerplays )
|
||||
set( CUSTOM_URL_SCHEME "gcs" )
|
||||
set( INSTALLER_APP_ID "68ad7005-8eee-49c9-95ce-9eed97e5b347" )
|
||||
|
||||
|
|
@ -22,8 +22,45 @@ endif()
|
|||
|
||||
list( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules" )
|
||||
|
||||
# function to help with cUrl
|
||||
macro(FIND_CURL)
|
||||
if (NOT WIN32 AND NOT APPLE AND CURL_STATICLIB)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
set (OLD_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .a)
|
||||
find_package(CURL REQUIRED)
|
||||
list(APPEND CURL_LIBRARIES ${OPENSSL_LIBRARIES} ${BOOST_THREAD_LIBRARY} ${CMAKE_DL_LIBS})
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_SUFFIXES})
|
||||
else (NOT WIN32 AND NOT APPLE AND CURL_STATICLIB)
|
||||
find_package(CURL REQUIRED)
|
||||
endif (NOT WIN32 AND NOT APPLE AND CURL_STATICLIB)
|
||||
|
||||
if( WIN32 )
|
||||
if ( MSVC )
|
||||
list( APPEND CURL_LIBRARIES Wldap32 )
|
||||
endif( MSVC )
|
||||
|
||||
if( MINGW )
|
||||
# MinGW requires a specific order of included libraries ( CURL before ZLib )
|
||||
find_package( ZLIB REQUIRED )
|
||||
list( APPEND CURL_LIBRARIES ${ZLIB_LIBRARY} pthread )
|
||||
endif( MINGW )
|
||||
|
||||
list( APPEND CURL_LIBRARIES ${PLATFORM_SPECIFIC_LIBS} )
|
||||
endif( WIN32 )
|
||||
endmacro()
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS "ON")
|
||||
set(GRAPHENE_EGENESIS_JSON "${CMAKE_CURRENT_SOURCE_DIR}/genesis.json" CACHE PATH "location of the genesis.json to embed in the executable" )
|
||||
|
||||
if (BUILD_PEERPLAYS_TESTNET)
|
||||
set(GRAPHENE_EGENESIS_JSON "${CMAKE_CURRENT_SOURCE_DIR}/genesis-testnet.json" CACHE PATH "location of the genesis.json to embed in the executable" )
|
||||
#add_compile_definitions(BUILD_PEERPLAYS_TESTNET=1)
|
||||
add_definitions(-DBUILD_PEERPLAYS_TESTNET=1)
|
||||
message ("\n====================\nBuilding for Testnet\n====================\n")
|
||||
else (BUILD_PEERPLAYS_TESTNET)
|
||||
set(GRAPHENE_EGENESIS_JSON "${CMAKE_CURRENT_SOURCE_DIR}/genesis-mainnet.json" CACHE PATH "location of the genesis.json to embed in the executable" )
|
||||
message ("\n====================\nBuilding for Mainnet\n====================\n")
|
||||
endif (BUILD_PEERPLAYS_TESTNET)
|
||||
|
||||
#set (ENABLE_INSTALLER 1)
|
||||
#set (USE_PCH 1)
|
||||
|
|
@ -71,7 +108,7 @@ ENDIF()
|
|||
|
||||
if( WIN32 )
|
||||
|
||||
message( STATUS "Configuring BitShares on WIN32")
|
||||
message( STATUS "Configuring Peerplays on WIN32")
|
||||
set( DB_VERSION 60 )
|
||||
set( BDB_STATIC_LIBS 1 )
|
||||
|
||||
|
|
@ -103,20 +140,13 @@ if( WIN32 )
|
|||
SET(TCL_LIBRARY ${TCL_LIBS})
|
||||
|
||||
else( WIN32 ) # Apple AND Linux
|
||||
|
||||
find_library(READLINE_LIBRARIES NAMES readline)
|
||||
find_path(READLINE_INCLUDE_DIR readline/readline.h)
|
||||
#if(NOT READLINE_INCLUDE_DIR OR NOT READLINE_LIBRARIES)
|
||||
# MESSAGE(FATAL_ERROR "Could not find lib readline.")
|
||||
#endif()
|
||||
|
||||
if( APPLE )
|
||||
# Apple Specific Options Here
|
||||
message( STATUS "Configuring BitShares on OS X" )
|
||||
message( STATUS "Configuring Peerplays on OS X" )
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11 -stdlib=libc++ -Wall" )
|
||||
else( APPLE )
|
||||
# Linux Specific Options Here
|
||||
message( STATUS "Configuring BitShares on Linux" )
|
||||
message( STATUS "Configuring Peerplays on Linux" )
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11 -Wall" )
|
||||
set( rt_library rt )
|
||||
#set( pthread_library pthread)
|
||||
|
|
@ -135,7 +165,7 @@ else( WIN32 ) # Apple AND Linux
|
|||
endif( APPLE )
|
||||
|
||||
if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" )
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-builtin-memcmp -Wno-parentheses -Wno-terminate -Wno-invalid-offsetof -Wno-sign-compare" )
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" )
|
||||
elseif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
|
||||
if( CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 4.0.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.0.0 )
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-partial-specialization" )
|
||||
|
|
@ -154,7 +184,7 @@ else( WIN32 ) # Apple AND Linux
|
|||
|
||||
endif( WIN32 )
|
||||
|
||||
set(ENABLE_COVERAGE_TESTING FALSE CACHE BOOL "Build BitShares for code coverage analysis")
|
||||
set(ENABLE_COVERAGE_TESTING FALSE CACHE BOOL "Build Peerplays for code coverage analysis")
|
||||
|
||||
if(ENABLE_COVERAGE_TESTING)
|
||||
SET(CMAKE_CXX_FLAGS "--coverage ${CMAKE_CXX_FLAGS}")
|
||||
|
|
@ -163,13 +193,13 @@ endif()
|
|||
add_subdirectory( libraries )
|
||||
|
||||
|
||||
set(BUILD_BITSHARES_PROGRAMS TRUE CACHE BOOL "Build bitshares executables (witness node, cli wallet, etc)")
|
||||
set(BUILD_PEERPLAYS_PROGRAMS TRUE CACHE BOOL "Build peerplays executables (witness node, cli wallet, etc)")
|
||||
add_subdirectory( programs )
|
||||
|
||||
set(BUILD_BITSHARES_TESTS TRUE CACHE BOOL "Build bitshares unit tests")
|
||||
if( BUILD_BITSHARES_TESTS )
|
||||
set(BUILD_PEERPLAYS_TESTS TRUE CACHE BOOL "Build peerplays unit tests")
|
||||
if( BUILD_PEERPLAYS_TESTS )
|
||||
add_subdirectory( tests )
|
||||
endif( BUILD_BITSHARES_TESTS )
|
||||
endif( BUILD_PEERPLAYS_TESTS )
|
||||
|
||||
|
||||
if (ENABLE_INSTALLER)
|
||||
|
|
@ -191,18 +221,18 @@ set(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
|
|||
set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
|
||||
set(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
|
||||
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
|
||||
set(CPACK_PACKAGE_DESCRIPTION "A client for the BitShares network")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A client for the BitShares network")
|
||||
set(CPACK_PACKAGE_DESCRIPTION "A client for the Peerplays network")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A client for the Peerplays network")
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.md")
|
||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "BitShares ${CPACK_PACKAGE_VERSION}")
|
||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "Peerplays ${CPACK_PACKAGE_VERSION}")
|
||||
|
||||
if(WIN32)
|
||||
SET(CPACK_GENERATOR "ZIP;NSIS")
|
||||
set(CPACK_PACKAGE_NAME "BitShares") # override above
|
||||
set(CPACK_PACKAGE_NAME "Peerplays") # override above
|
||||
set(CPACK_NSIS_EXECUTABLES_DIRECTORY .)
|
||||
set(CPACK_NSIS_PACKAGE_NAME "BitShares v${CPACK_PACKAGE_VERSION}")
|
||||
set(CPACK_NSIS_PACKAGE_NAME "Peerplays v${CPACK_PACKAGE_VERSION}")
|
||||
set(CPACK_NSIS_DISPLAY_NAME "${CPACK_NSIS_PACKAGE_NAME}")
|
||||
set(CPACK_NSIS_DEFINES " !define MUI_STARTMENUPAGE_DEFAULTFOLDER \\\"BitShares\\\"")
|
||||
set(CPACK_NSIS_DEFINES " !define MUI_STARTMENUPAGE_DEFAULTFOLDER \\\"Peerplays\\\"")
|
||||
# it seems like windows zip files usually don't have a single directory inside them, unix tgz frequently do
|
||||
SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
|
||||
|
||||
|
|
@ -220,3 +250,8 @@ endif(LINUX)
|
|||
|
||||
include(CPack)
|
||||
endif(ENABLE_INSTALLER)
|
||||
|
||||
unset(GRAPHENE_EGENESIS_JSON)
|
||||
unset(GRAPHENE_EGENESIS_JSON CACHE)
|
||||
unset(BUILD_PEERPLAYS_TESTNET)
|
||||
unset(BUILD_PEERPLAYS_TESTNET CACHE)
|
||||
|
|
|
|||
|
|
@ -38,13 +38,15 @@ export BOOST_ROOT=$HOME/src/boost_1_67_0
|
|||
git clone https://github.com/peerplays-network/peerplays.git
|
||||
cd peerplays
|
||||
git submodule update --init --recursive
|
||||
# If you want to build Mainnet node
|
||||
cmake -DBOOST_ROOT="$BOOST_ROOT" -DCMAKE_BUILD_TYPE=Release
|
||||
# If you want to build Testnet node
|
||||
cmake -DBOOST_ROOT="$BOOST_ROOT" -DCMAKE_BUILD_TYPE=Release -DBUILD_PEERPLAYS_TESTNET=1
|
||||
make -j$(nproc)
|
||||
|
||||
make install # this can install the executable files under /usr/local
|
||||
```
|
||||
|
||||
docker build -t peerplays .
|
||||
|
||||
## Docker image
|
||||
|
||||
|
|
|
|||
|
|
@ -1,794 +0,0 @@
|
|||
# This is the CMakeCache file.
|
||||
# For build in directory: /home/pbattu/git/18.04/peerplays
|
||||
# It was generated by CMake: /usr/bin/cmake
|
||||
# You can edit this file to change values found and used by cmake.
|
||||
# If you do not want to change any of the values, simply exit the editor.
|
||||
# If you do want to change a value, simply edit, save, and exit the editor.
|
||||
# The syntax for the file is as follows:
|
||||
# KEY:TYPE=VALUE
|
||||
# KEY is the name of a variable in the cache.
|
||||
# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!.
|
||||
# VALUE is the current value for the KEY.
|
||||
|
||||
########################
|
||||
# EXTERNAL cache entries
|
||||
########################
|
||||
|
||||
//No help, variable specified on the command line.
|
||||
BOOST_ROOT:PATH=/home/pbattu/git/18.04/boost_1_67_0
|
||||
|
||||
//The threading library used by boost-thread
|
||||
BOOST_THREAD_LIBRARY:FILEPATH=/usr/lib/x86_64-linux-gnu/libpthread.so
|
||||
|
||||
//Build bitshares executables (witness node, cli wallet, etc)
|
||||
BUILD_BITSHARES_PROGRAMS:BOOL=TRUE
|
||||
|
||||
//Build bitshares unit tests
|
||||
BUILD_BITSHARES_TESTS:BOOL=TRUE
|
||||
|
||||
//Build websocketpp examples.
|
||||
BUILD_EXAMPLES:BOOL=OFF
|
||||
|
||||
//Build websocketpp tests.
|
||||
BUILD_TESTS:BOOL=OFF
|
||||
|
||||
//Value Computed by CMake
|
||||
BitShares_BINARY_DIR:STATIC=/home/pbattu/git/18.04/peerplays
|
||||
|
||||
//Value Computed by CMake
|
||||
BitShares_SOURCE_DIR:STATIC=/home/pbattu/git/18.04/peerplays
|
||||
|
||||
//Boost chrono library (debug)
|
||||
Boost_CHRONO_LIBRARY_DEBUG:FILEPATH=/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_chrono.a
|
||||
|
||||
//Boost chrono library (release)
|
||||
Boost_CHRONO_LIBRARY_RELEASE:FILEPATH=/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_chrono.a
|
||||
|
||||
//Boost context library (debug)
|
||||
Boost_CONTEXT_LIBRARY_DEBUG:FILEPATH=/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_context.a
|
||||
|
||||
//Boost context library (release)
|
||||
Boost_CONTEXT_LIBRARY_RELEASE:FILEPATH=/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_context.a
|
||||
|
||||
//Boost coroutine library (debug)
|
||||
Boost_COROUTINE_LIBRARY_DEBUG:FILEPATH=/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_coroutine.a
|
||||
|
||||
//Boost coroutine library (release)
|
||||
Boost_COROUTINE_LIBRARY_RELEASE:FILEPATH=/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_coroutine.a
|
||||
|
||||
//Boost date_time library (debug)
|
||||
Boost_DATE_TIME_LIBRARY_DEBUG:FILEPATH=/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_date_time.a
|
||||
|
||||
//Boost date_time library (release)
|
||||
Boost_DATE_TIME_LIBRARY_RELEASE:FILEPATH=/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_date_time.a
|
||||
|
||||
//The directory containing a CMake configuration file for Boost.
|
||||
Boost_DIR:PATH=Boost_DIR-NOTFOUND
|
||||
|
||||
//Boost filesystem library (debug)
|
||||
Boost_FILESYSTEM_LIBRARY_DEBUG:FILEPATH=/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_filesystem.a
|
||||
|
||||
//Boost filesystem library (release)
|
||||
Boost_FILESYSTEM_LIBRARY_RELEASE:FILEPATH=/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_filesystem.a
|
||||
|
||||
//Path to a file.
|
||||
Boost_INCLUDE_DIR:PATH=/home/pbattu/git/18.04/boost_1_67_0/include
|
||||
|
||||
//Boost iostreams library (debug)
|
||||
Boost_IOSTREAMS_LIBRARY_DEBUG:FILEPATH=/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_iostreams.a
|
||||
|
||||
//Boost iostreams library (release)
|
||||
Boost_IOSTREAMS_LIBRARY_RELEASE:FILEPATH=/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_iostreams.a
|
||||
|
||||
//Boost library directory
|
||||
Boost_LIBRARY_DIR:PATH=/home/pbattu/git/18.04/boost_1_67_0/lib
|
||||
|
||||
//Boost library directory DEBUG
|
||||
Boost_LIBRARY_DIR_DEBUG:PATH=/home/pbattu/git/18.04/boost_1_67_0/lib
|
||||
|
||||
//Boost library directory RELEASE
|
||||
Boost_LIBRARY_DIR_RELEASE:PATH=/home/pbattu/git/18.04/boost_1_67_0/lib
|
||||
|
||||
//Boost locale library (debug)
|
||||
Boost_LOCALE_LIBRARY_DEBUG:FILEPATH=/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_locale.a
|
||||
|
||||
//Boost locale library (release)
|
||||
Boost_LOCALE_LIBRARY_RELEASE:FILEPATH=/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_locale.a
|
||||
|
||||
//Boost program_options library (debug)
|
||||
Boost_PROGRAM_OPTIONS_LIBRARY_DEBUG:FILEPATH=/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_program_options.a
|
||||
|
||||
//Boost program_options library (release)
|
||||
Boost_PROGRAM_OPTIONS_LIBRARY_RELEASE:FILEPATH=/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_program_options.a
|
||||
|
||||
//Boost serialization library (debug)
|
||||
Boost_SERIALIZATION_LIBRARY_DEBUG:FILEPATH=/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_serialization.a
|
||||
|
||||
//Boost serialization library (release)
|
||||
Boost_SERIALIZATION_LIBRARY_RELEASE:FILEPATH=/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_serialization.a
|
||||
|
||||
//Boost signals library (debug)
|
||||
Boost_SIGNALS_LIBRARY_DEBUG:FILEPATH=/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_signals.a
|
||||
|
||||
//Boost signals library (release)
|
||||
Boost_SIGNALS_LIBRARY_RELEASE:FILEPATH=/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_signals.a
|
||||
|
||||
//Boost system library (debug)
|
||||
Boost_SYSTEM_LIBRARY_DEBUG:FILEPATH=/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_system.a
|
||||
|
||||
//Boost system library (release)
|
||||
Boost_SYSTEM_LIBRARY_RELEASE:FILEPATH=/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_system.a
|
||||
|
||||
//Boost thread library (debug)
|
||||
Boost_THREAD_LIBRARY_DEBUG:FILEPATH=/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_thread.a
|
||||
|
||||
//Boost thread library (release)
|
||||
Boost_THREAD_LIBRARY_RELEASE:FILEPATH=/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_thread.a
|
||||
|
||||
//Boost unit_test_framework library (debug)
|
||||
Boost_UNIT_TEST_FRAMEWORK_LIBRARY_DEBUG:FILEPATH=/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_unit_test_framework.a
|
||||
|
||||
//Boost unit_test_framework library (release)
|
||||
Boost_UNIT_TEST_FRAMEWORK_LIBRARY_RELEASE:FILEPATH=/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_unit_test_framework.a
|
||||
|
||||
//ON or OFF
|
||||
Boost_USE_STATIC_LIBS:STRING=ON
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_AR:FILEPATH=/usr/bin/ar
|
||||
|
||||
//Choose the type of build, options are: None(CMAKE_CXX_FLAGS or
|
||||
// CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.
|
||||
CMAKE_BUILD_TYPE:STRING=Debug
|
||||
|
||||
//Enable/Disable color output during build.
|
||||
CMAKE_COLOR_MAKEFILE:BOOL=ON
|
||||
|
||||
//Configurations
|
||||
CMAKE_CONFIGURATION_TYPES:STRING=Release;RelWithDebInfo;Debug
|
||||
|
||||
//CXX compiler
|
||||
CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++-5
|
||||
|
||||
//A wrapper around 'ar' adding the appropriate '--plugin' option
|
||||
// for the GCC compiler
|
||||
CMAKE_CXX_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-5
|
||||
|
||||
//A wrapper around 'ranlib' adding the appropriate '--plugin' option
|
||||
// for the GCC compiler
|
||||
CMAKE_CXX_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-5
|
||||
|
||||
//Flags used by the compiler during all build types.
|
||||
CMAKE_CXX_FLAGS:STRING=
|
||||
|
||||
//Flags used by the compiler during debug builds.
|
||||
CMAKE_CXX_FLAGS_DEBUG:STRING=-g
|
||||
|
||||
//Flags used by the compiler during release builds for minimum
|
||||
// size.
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
|
||||
|
||||
//Flags used by the compiler during release builds.
|
||||
CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
|
||||
|
||||
//Flags used by the compiler during release builds with debug info.
|
||||
CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
|
||||
|
||||
//C compiler
|
||||
CMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc-5
|
||||
|
||||
//A wrapper around 'ar' adding the appropriate '--plugin' option
|
||||
// for the GCC compiler
|
||||
CMAKE_C_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-5
|
||||
|
||||
//A wrapper around 'ranlib' adding the appropriate '--plugin' option
|
||||
// for the GCC compiler
|
||||
CMAKE_C_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-5
|
||||
|
||||
//Flags used by the compiler during all build types.
|
||||
CMAKE_C_FLAGS:STRING=
|
||||
|
||||
//Flags used by the compiler during debug builds.
|
||||
CMAKE_C_FLAGS_DEBUG:STRING=-g
|
||||
|
||||
//Flags used by the compiler during release builds for minimum
|
||||
// size.
|
||||
CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
|
||||
|
||||
//Flags used by the compiler during release builds.
|
||||
CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
|
||||
|
||||
//Flags used by the compiler during release builds with debug info.
|
||||
CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
|
||||
|
||||
//Flags used by the linker.
|
||||
CMAKE_EXE_LINKER_FLAGS:STRING=
|
||||
|
||||
//Flags used by the linker during debug builds.
|
||||
CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING=
|
||||
|
||||
//Flags used by the linker during release minsize builds.
|
||||
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING=
|
||||
|
||||
//Flags used by the linker during release builds.
|
||||
CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING=
|
||||
|
||||
//Flags used by the linker during Release with Debug Info builds.
|
||||
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
|
||||
|
||||
//Enable/Disable output of compile commands during generation.
|
||||
CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=OFF
|
||||
|
||||
//Install path prefix, prepended onto install directories.
|
||||
CMAKE_INSTALL_PREFIX:PATH=/usr/local
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_LINKER:FILEPATH=/usr/bin/ld
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/make
|
||||
|
||||
//Flags used by the linker during the creation of modules.
|
||||
CMAKE_MODULE_LINKER_FLAGS:STRING=
|
||||
|
||||
//Flags used by the linker during debug builds.
|
||||
CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING=
|
||||
|
||||
//Flags used by the linker during release minsize builds.
|
||||
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING=
|
||||
|
||||
//Flags used by the linker during release builds.
|
||||
CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING=
|
||||
|
||||
//Flags used by the linker during Release with Debug Info builds.
|
||||
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_NM:FILEPATH=/usr/bin/nm
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_NAME:STATIC=BitShares
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib
|
||||
|
||||
//Flags used by the linker during the creation of dll's.
|
||||
CMAKE_SHARED_LINKER_FLAGS:STRING=
|
||||
|
||||
//Flags used by the linker during debug builds.
|
||||
CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING=
|
||||
|
||||
//Flags used by the linker during release minsize builds.
|
||||
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING=
|
||||
|
||||
//Flags used by the linker during release builds.
|
||||
CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING=
|
||||
|
||||
//Flags used by the linker during Release with Debug Info builds.
|
||||
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING=
|
||||
|
||||
//If set, runtime paths are not added when installing shared libraries,
|
||||
// but are added when building.
|
||||
CMAKE_SKIP_INSTALL_RPATH:BOOL=NO
|
||||
|
||||
//If set, runtime paths are not added when using shared libraries.
|
||||
CMAKE_SKIP_RPATH:BOOL=NO
|
||||
|
||||
//Flags used by the linker during the creation of static libraries.
|
||||
CMAKE_STATIC_LINKER_FLAGS:STRING=
|
||||
|
||||
//Flags used by the linker during debug builds.
|
||||
CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING=
|
||||
|
||||
//Flags used by the linker during release minsize builds.
|
||||
CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING=
|
||||
|
||||
//Flags used by the linker during release builds.
|
||||
CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING=
|
||||
|
||||
//Flags used by the linker during Release with Debug Info builds.
|
||||
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING=
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_STRIP:FILEPATH=/usr/bin/strip
|
||||
|
||||
//If this value is on, makefiles will be generated without the
|
||||
// .SILENT directive, and all commands will be echoed to the console
|
||||
// during the make. This is useful for debugging only. With Visual
|
||||
// Studio IDE projects all commands are done without /nologo.
|
||||
CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE
|
||||
|
||||
//Path to a library.
|
||||
CURSES_CURSES_LIBRARY:FILEPATH=CURSES_CURSES_LIBRARY-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
CURSES_FORM_LIBRARY:FILEPATH=CURSES_FORM_LIBRARY-NOTFOUND
|
||||
|
||||
//Path to a file.
|
||||
CURSES_INCLUDE_PATH:PATH=CURSES_INCLUDE_PATH-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
CURSES_NCURSES_LIBRARY:FILEPATH=CURSES_NCURSES_LIBRARY-NOTFOUND
|
||||
|
||||
//Dot tool for use with Doxygen
|
||||
DOXYGEN_DOT_EXECUTABLE:FILEPATH=DOXYGEN_DOT_EXECUTABLE-NOTFOUND
|
||||
|
||||
//Doxygen documentation generation tool (http://www.doxygen.org)
|
||||
DOXYGEN_EXECUTABLE:FILEPATH=DOXYGEN_EXECUTABLE-NOTFOUND
|
||||
|
||||
//secp256k1 or openssl or mixed
|
||||
ECC_IMPL:STRING=secp256k1
|
||||
|
||||
//Build BitShares for code coverage analysis
|
||||
ENABLE_COVERAGE_TESTING:BOOL=FALSE
|
||||
|
||||
//Build websocketpp with CPP11 features enabled.
|
||||
ENABLE_CPP11:BOOL=ON
|
||||
|
||||
//TRUE to try to use full zlib for compression, FALSE to use miniz.c
|
||||
FC_USE_FULL_ZLIB:BOOL=FALSE
|
||||
|
||||
//Git command line client
|
||||
GIT_EXECUTABLE:FILEPATH=/usr/bin/git
|
||||
|
||||
//location of the genesis.json to embed in the executable
|
||||
GRAPHENE_EGENESIS_JSON:PATH=/home/pbattu/git/18.04/peerplays/genesis.json
|
||||
|
||||
//The directory containing a CMake configuration file for Gperftools.
|
||||
Gperftools_DIR:PATH=Gperftools_DIR-NOTFOUND
|
||||
|
||||
//Installation directory for CMake files
|
||||
INSTALL_CMAKE_DIR:PATH=lib/cmake/websocketpp
|
||||
|
||||
//Installation directory for header files
|
||||
INSTALL_INCLUDE_DIR:PATH=include
|
||||
|
||||
//Log long API calls over websocket (ON OR OFF)
|
||||
LOG_LONG_API:BOOL=ON
|
||||
|
||||
//Max API execution time in ms
|
||||
LOG_LONG_API_MAX_MS:STRING=1000
|
||||
|
||||
//API execution time in ms at which to warn
|
||||
LOG_LONG_API_WARN_MS:STRING=750
|
||||
|
||||
//Path to a library.
|
||||
OPENSSL_CRYPTO_LIBRARY:FILEPATH=/usr/lib/x86_64-linux-gnu/libcrypto.a
|
||||
|
||||
//Path to a file.
|
||||
OPENSSL_INCLUDE_DIR:PATH=/usr/include
|
||||
|
||||
//Path to a library.
|
||||
OPENSSL_SSL_LIBRARY:FILEPATH=/usr/lib/x86_64-linux-gnu/libssl.a
|
||||
|
||||
//Path to a program.
|
||||
PERL_EXECUTABLE:FILEPATH=/usr/bin/perl
|
||||
|
||||
//pkg-config executable
|
||||
PKG_CONFIG_EXECUTABLE:FILEPATH=/usr/bin/pkg-config
|
||||
|
||||
//Path to a file.
|
||||
READLINE_INCLUDE_DIR:PATH=/usr/include
|
||||
|
||||
//Path to a library.
|
||||
READLINE_LIBRARIES:FILEPATH=/usr/lib/x86_64-linux-gnu/libreadline.so
|
||||
|
||||
//Path to a file.
|
||||
Readline_INCLUDE_DIR:PATH=/usr/include
|
||||
|
||||
//Path to a library.
|
||||
Readline_LIBRARY:FILEPATH=/usr/lib/x86_64-linux-gnu/libreadline.so
|
||||
|
||||
//Path to a file.
|
||||
Readline_ROOT_DIR:PATH=/usr
|
||||
|
||||
//OFF
|
||||
UNITY_BUILD:BOOL=OFF
|
||||
|
||||
//Path to a file.
|
||||
ZLIB_INCLUDE_DIR:PATH=/usr/include
|
||||
|
||||
//Path to a library.
|
||||
ZLIB_LIBRARY_DEBUG:FILEPATH=ZLIB_LIBRARY_DEBUG-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
ZLIB_LIBRARY_RELEASE:FILEPATH=/usr/lib/x86_64-linux-gnu/libz.so
|
||||
|
||||
//Value Computed by CMake
|
||||
fc_BINARY_DIR:STATIC=/home/pbattu/git/18.04/peerplays/libraries/fc
|
||||
|
||||
//Dependencies for the target
|
||||
fc_LIB_DEPENDS:STATIC=general;-L/usr/local/lib;general;/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_thread.a;general;/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_date_time.a;general;/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_filesystem.a;general;/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_system.a;general;/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_program_options.a;general;/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_signals.a;general;/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_serialization.a;general;/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_chrono.a;general;/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_unit_test_framework.a;general;/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_context.a;general;/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_locale.a;general;/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_iostreams.a;general;/home/pbattu/git/18.04/boost_1_67_0/lib/libboost_coroutine.a;general;/usr/lib/x86_64-linux-gnu/libpthread.so;general;/usr/lib/x86_64-linux-gnu/libssl.a;general;/usr/lib/x86_64-linux-gnu/libcrypto.a;general;/usr/lib/x86_64-linux-gnu/libz.so;general;dl;general;rt;general;/usr/lib/x86_64-linux-gnu/libreadline.so;general;secp256k1;
|
||||
|
||||
//Value Computed by CMake
|
||||
fc_SOURCE_DIR:STATIC=/home/pbattu/git/18.04/peerplays/libraries/fc
|
||||
|
||||
//Dependencies for the target
|
||||
graphene_account_history_LIB_DEPENDS:STATIC=general;graphene_chain;general;graphene_app;
|
||||
|
||||
//Dependencies for the target
|
||||
graphene_accounts_list_LIB_DEPENDS:STATIC=general;graphene_chain;general;graphene_app;
|
||||
|
||||
//Dependencies for the target
|
||||
graphene_affiliate_stats_LIB_DEPENDS:STATIC=general;graphene_chain;general;graphene_app;
|
||||
|
||||
//Dependencies for the target
|
||||
graphene_app_LIB_DEPENDS:STATIC=general;graphene_market_history;general;graphene_account_history;general;graphene_accounts_list;general;graphene_affiliate_stats;general;graphene_chain;general;fc;general;graphene_db;general;graphene_net;general;graphene_time;general;graphene_utilities;general;graphene_debug_witness;general;graphene_bookie;
|
||||
|
||||
//Dependencies for the target
|
||||
graphene_bookie_LIB_DEPENDS:STATIC=general;graphene_chain;general;graphene_app;
|
||||
|
||||
//Dependencies for the target
|
||||
graphene_chain_LIB_DEPENDS:STATIC=general;fc;general;graphene_db;
|
||||
|
||||
//Dependencies for the target
|
||||
graphene_db_LIB_DEPENDS:STATIC=general;fc;
|
||||
|
||||
//Dependencies for the target
|
||||
graphene_debug_witness_LIB_DEPENDS:STATIC=general;graphene_chain;general;graphene_app;
|
||||
|
||||
//Dependencies for the target
|
||||
graphene_delayed_node_LIB_DEPENDS:STATIC=general;graphene_chain;general;graphene_app;
|
||||
|
||||
//Dependencies for the target
|
||||
graphene_egenesis_brief_LIB_DEPENDS:STATIC=general;graphene_chain;general;fc;
|
||||
|
||||
//Dependencies for the target
|
||||
graphene_egenesis_full_LIB_DEPENDS:STATIC=general;graphene_chain;general;fc;
|
||||
|
||||
//Dependencies for the target
|
||||
graphene_egenesis_none_LIB_DEPENDS:STATIC=general;graphene_chain;general;fc;
|
||||
|
||||
//Dependencies for the target
|
||||
graphene_generate_genesis_LIB_DEPENDS:STATIC=general;graphene_chain;general;graphene_app;general;graphene_time;
|
||||
|
||||
//Dependencies for the target
|
||||
graphene_generate_uia_sharedrop_genesis_LIB_DEPENDS:STATIC=general;graphene_chain;general;graphene_app;general;graphene_time;
|
||||
|
||||
//Dependencies for the target
|
||||
graphene_market_history_LIB_DEPENDS:STATIC=general;graphene_chain;general;graphene_app;
|
||||
|
||||
//Dependencies for the target
|
||||
graphene_net_LIB_DEPENDS:STATIC=general;fc;general;graphene_db;
|
||||
|
||||
//Dependencies for the target
|
||||
graphene_snapshot_LIB_DEPENDS:STATIC=general;graphene_chain;general;graphene_app;
|
||||
|
||||
//Dependencies for the target
|
||||
graphene_time_LIB_DEPENDS:STATIC=general;fc;
|
||||
|
||||
//Dependencies for the target
|
||||
graphene_utilities_LIB_DEPENDS:STATIC=general;fc;
|
||||
|
||||
//Dependencies for the target
|
||||
graphene_wallet_LIB_DEPENDS:STATIC=general;graphene_app;general;graphene_net;general;graphene_chain;general;graphene_utilities;general;fc;general;dl;
|
||||
|
||||
//Dependencies for the target
|
||||
graphene_witness_LIB_DEPENDS:STATIC=general;graphene_chain;general;graphene_app;
|
||||
|
||||
//Value Computed by CMake
|
||||
websocketpp_BINARY_DIR:STATIC=/home/pbattu/git/18.04/peerplays/libraries/fc/vendor/websocketpp
|
||||
|
||||
//Value Computed by CMake
|
||||
websocketpp_SOURCE_DIR:STATIC=/home/pbattu/git/18.04/peerplays/libraries/fc/vendor/websocketpp
|
||||
|
||||
|
||||
########################
|
||||
# INTERNAL cache entries
|
||||
########################
|
||||
|
||||
//ADVANCED property for variable: BOOST_ROOT
|
||||
BOOST_ROOT-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_CHRONO_LIBRARY_DEBUG
|
||||
Boost_CHRONO_LIBRARY_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_CHRONO_LIBRARY_RELEASE
|
||||
Boost_CHRONO_LIBRARY_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_CONTEXT_LIBRARY_DEBUG
|
||||
Boost_CONTEXT_LIBRARY_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_CONTEXT_LIBRARY_RELEASE
|
||||
Boost_CONTEXT_LIBRARY_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_COROUTINE_LIBRARY_DEBUG
|
||||
Boost_COROUTINE_LIBRARY_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_COROUTINE_LIBRARY_RELEASE
|
||||
Boost_COROUTINE_LIBRARY_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_DATE_TIME_LIBRARY_DEBUG
|
||||
Boost_DATE_TIME_LIBRARY_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_DATE_TIME_LIBRARY_RELEASE
|
||||
Boost_DATE_TIME_LIBRARY_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_DIR
|
||||
Boost_DIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_FILESYSTEM_LIBRARY_DEBUG
|
||||
Boost_FILESYSTEM_LIBRARY_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_FILESYSTEM_LIBRARY_RELEASE
|
||||
Boost_FILESYSTEM_LIBRARY_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_INCLUDE_DIR
|
||||
Boost_INCLUDE_DIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_IOSTREAMS_LIBRARY_DEBUG
|
||||
Boost_IOSTREAMS_LIBRARY_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_IOSTREAMS_LIBRARY_RELEASE
|
||||
Boost_IOSTREAMS_LIBRARY_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_LIBRARY_DIR
|
||||
Boost_LIBRARY_DIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_LIBRARY_DIR_DEBUG
|
||||
Boost_LIBRARY_DIR_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_LIBRARY_DIR_RELEASE
|
||||
Boost_LIBRARY_DIR_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_LOCALE_LIBRARY_DEBUG
|
||||
Boost_LOCALE_LIBRARY_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_LOCALE_LIBRARY_RELEASE
|
||||
Boost_LOCALE_LIBRARY_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_PROGRAM_OPTIONS_LIBRARY_DEBUG
|
||||
Boost_PROGRAM_OPTIONS_LIBRARY_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_PROGRAM_OPTIONS_LIBRARY_RELEASE
|
||||
Boost_PROGRAM_OPTIONS_LIBRARY_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_SERIALIZATION_LIBRARY_DEBUG
|
||||
Boost_SERIALIZATION_LIBRARY_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_SERIALIZATION_LIBRARY_RELEASE
|
||||
Boost_SERIALIZATION_LIBRARY_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_SIGNALS_LIBRARY_DEBUG
|
||||
Boost_SIGNALS_LIBRARY_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_SIGNALS_LIBRARY_RELEASE
|
||||
Boost_SIGNALS_LIBRARY_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_SYSTEM_LIBRARY_DEBUG
|
||||
Boost_SYSTEM_LIBRARY_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_SYSTEM_LIBRARY_RELEASE
|
||||
Boost_SYSTEM_LIBRARY_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_THREAD_LIBRARY_DEBUG
|
||||
Boost_THREAD_LIBRARY_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_THREAD_LIBRARY_RELEASE
|
||||
Boost_THREAD_LIBRARY_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_UNIT_TEST_FRAMEWORK_LIBRARY_DEBUG
|
||||
Boost_UNIT_TEST_FRAMEWORK_LIBRARY_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Boost_UNIT_TEST_FRAMEWORK_LIBRARY_RELEASE
|
||||
Boost_UNIT_TEST_FRAMEWORK_LIBRARY_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_AR
|
||||
CMAKE_AR-ADVANCED:INTERNAL=1
|
||||
//This is the directory where this CMakeCache.txt was created
|
||||
CMAKE_CACHEFILE_DIR:INTERNAL=/home/pbattu/git/18.04/peerplays
|
||||
//Major version of cmake used to create the current loaded cache
|
||||
CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3
|
||||
//Minor version of cmake used to create the current loaded cache
|
||||
CMAKE_CACHE_MINOR_VERSION:INTERNAL=10
|
||||
//Patch version of cmake used to create the current loaded cache
|
||||
CMAKE_CACHE_PATCH_VERSION:INTERNAL=2
|
||||
//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE
|
||||
CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1
|
||||
//Path to CMake executable.
|
||||
CMAKE_COMMAND:INTERNAL=/usr/bin/cmake
|
||||
//Path to cpack program executable.
|
||||
CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack
|
||||
//Path to ctest program executable.
|
||||
CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest
|
||||
//ADVANCED property for variable: CMAKE_CXX_COMPILER
|
||||
CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_CXX_COMPILER_AR
|
||||
CMAKE_CXX_COMPILER_AR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_CXX_COMPILER_RANLIB
|
||||
CMAKE_CXX_COMPILER_RANLIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_CXX_FLAGS
|
||||
CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG
|
||||
CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_COMPILER
|
||||
CMAKE_C_COMPILER-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_COMPILER_AR
|
||||
CMAKE_C_COMPILER_AR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_COMPILER_RANLIB
|
||||
CMAKE_C_COMPILER_RANLIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_FLAGS
|
||||
CMAKE_C_FLAGS-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG
|
||||
CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL
|
||||
CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE
|
||||
CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
||||
//Executable file format
|
||||
CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF
|
||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS
|
||||
CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG
|
||||
CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL
|
||||
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE
|
||||
CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS
|
||||
CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1
|
||||
//Name of external makefile project generator.
|
||||
CMAKE_EXTRA_GENERATOR:INTERNAL=
|
||||
//Name of generator.
|
||||
CMAKE_GENERATOR:INTERNAL=Unix Makefiles
|
||||
//Name of generator platform.
|
||||
CMAKE_GENERATOR_PLATFORM:INTERNAL=
|
||||
//Name of generator toolset.
|
||||
CMAKE_GENERATOR_TOOLSET:INTERNAL=
|
||||
//Have symbol pthread_create
|
||||
CMAKE_HAVE_LIBC_CREATE:INTERNAL=
|
||||
//Have library pthreads
|
||||
CMAKE_HAVE_PTHREADS_CREATE:INTERNAL=
|
||||
//Have library pthread
|
||||
CMAKE_HAVE_PTHREAD_CREATE:INTERNAL=1
|
||||
//Have include pthread.h
|
||||
CMAKE_HAVE_PTHREAD_H:INTERNAL=1
|
||||
//Source directory with the top level CMakeLists.txt file for this
|
||||
// project
|
||||
CMAKE_HOME_DIRECTORY:INTERNAL=/home/pbattu/git/18.04/peerplays
|
||||
//Install .so files without execute permission.
|
||||
CMAKE_INSTALL_SO_NO_EXE:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_LINKER
|
||||
CMAKE_LINKER-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_MAKE_PROGRAM
|
||||
CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS
|
||||
CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG
|
||||
CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL
|
||||
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE
|
||||
CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_NM
|
||||
CMAKE_NM-ADVANCED:INTERNAL=1
|
||||
//number of local generators
|
||||
CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=37
|
||||
//ADVANCED property for variable: CMAKE_OBJCOPY
|
||||
CMAKE_OBJCOPY-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_OBJDUMP
|
||||
CMAKE_OBJDUMP-ADVANCED:INTERNAL=1
|
||||
//Platform information initialized
|
||||
CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_RANLIB
|
||||
CMAKE_RANLIB-ADVANCED:INTERNAL=1
|
||||
//Path to CMake installation.
|
||||
CMAKE_ROOT:INTERNAL=/usr/share/cmake-3.10
|
||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS
|
||||
CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG
|
||||
CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL
|
||||
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE
|
||||
CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH
|
||||
CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SKIP_RPATH
|
||||
CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS
|
||||
CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG
|
||||
CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL
|
||||
CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE
|
||||
CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STRIP
|
||||
CMAKE_STRIP-ADVANCED:INTERNAL=1
|
||||
//uname command
|
||||
CMAKE_UNAME:INTERNAL=/bin/uname
|
||||
//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE
|
||||
CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CURSES_CURSES_LIBRARY
|
||||
CURSES_CURSES_LIBRARY-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CURSES_FORM_LIBRARY
|
||||
CURSES_FORM_LIBRARY-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CURSES_INCLUDE_PATH
|
||||
CURSES_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CURSES_NCURSES_LIBRARY
|
||||
CURSES_NCURSES_LIBRARY-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: DOXYGEN_DOT_EXECUTABLE
|
||||
DOXYGEN_DOT_EXECUTABLE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: DOXYGEN_EXECUTABLE
|
||||
DOXYGEN_EXECUTABLE-ADVANCED:INTERNAL=1
|
||||
//Details about finding OpenSSL
|
||||
FIND_PACKAGE_MESSAGE_DETAILS_OpenSSL:INTERNAL=[/usr/lib/x86_64-linux-gnu/libcrypto.a][/usr/include][v1.1.0g()]
|
||||
//Details about finding Perl
|
||||
FIND_PACKAGE_MESSAGE_DETAILS_Perl:INTERNAL=[/usr/bin/perl][v5.26.1()]
|
||||
//Details about finding Readline
|
||||
FIND_PACKAGE_MESSAGE_DETAILS_Readline:INTERNAL=[/usr/include][/usr/lib/x86_64-linux-gnu/libreadline.so][v()]
|
||||
//Details about finding Threads
|
||||
FIND_PACKAGE_MESSAGE_DETAILS_Threads:INTERNAL=[TRUE][v()]
|
||||
//Details about finding ZLIB
|
||||
FIND_PACKAGE_MESSAGE_DETAILS_ZLIB:INTERNAL=[/usr/lib/x86_64-linux-gnu/libz.so][/usr/include][v1.2.11()]
|
||||
//ADVANCED property for variable: GIT_EXECUTABLE
|
||||
GIT_EXECUTABLE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: OPENSSL_CRYPTO_LIBRARY
|
||||
OPENSSL_CRYPTO_LIBRARY-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: OPENSSL_INCLUDE_DIR
|
||||
OPENSSL_INCLUDE_DIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: OPENSSL_SSL_LIBRARY
|
||||
OPENSSL_SSL_LIBRARY-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: PERL_EXECUTABLE
|
||||
PERL_EXECUTABLE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: PKG_CONFIG_EXECUTABLE
|
||||
PKG_CONFIG_EXECUTABLE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Readline_INCLUDE_DIR
|
||||
Readline_INCLUDE_DIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Readline_LIBRARY
|
||||
Readline_LIBRARY-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Readline_ROOT_DIR
|
||||
Readline_ROOT_DIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: ZLIB_INCLUDE_DIR
|
||||
ZLIB_INCLUDE_DIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: ZLIB_LIBRARY_DEBUG
|
||||
ZLIB_LIBRARY_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: ZLIB_LIBRARY_RELEASE
|
||||
ZLIB_LIBRARY_RELEASE-ADVANCED:INTERNAL=1
|
||||
//Last used BOOST_ROOT value.
|
||||
_BOOST_ROOT_LAST:INTERNAL=/home/pbattu/git/18.04/boost_1_67_0
|
||||
//Components requested for this build tree.
|
||||
_Boost_COMPONENTS_SEARCHED:INTERNAL=chrono;context;coroutine;date_time;filesystem;iostreams;locale;program_options;serialization;signals;system;thread;unit_test_framework
|
||||
//Last used Boost_INCLUDE_DIR value.
|
||||
_Boost_INCLUDE_DIR_LAST:INTERNAL=/home/pbattu/git/18.04/boost_1_67_0/include
|
||||
//Last used Boost_LIBRARY_DIR_DEBUG value.
|
||||
_Boost_LIBRARY_DIR_DEBUG_LAST:INTERNAL=/home/pbattu/git/18.04/boost_1_67_0/lib
|
||||
//Last used Boost_LIBRARY_DIR value.
|
||||
_Boost_LIBRARY_DIR_LAST:INTERNAL=/home/pbattu/git/18.04/boost_1_67_0/lib
|
||||
//Last used Boost_LIBRARY_DIR_RELEASE value.
|
||||
_Boost_LIBRARY_DIR_RELEASE_LAST:INTERNAL=/home/pbattu/git/18.04/boost_1_67_0/lib
|
||||
//Last used Boost_NAMESPACE value.
|
||||
_Boost_NAMESPACE_LAST:INTERNAL=boost
|
||||
//Last used Boost_USE_MULTITHREADED value.
|
||||
_Boost_USE_MULTITHREADED_LAST:INTERNAL=TRUE
|
||||
//Last used Boost_USE_STATIC_LIBS value.
|
||||
_Boost_USE_STATIC_LIBS_LAST:INTERNAL=ON
|
||||
_OPENSSL_CFLAGS:INTERNAL=
|
||||
_OPENSSL_CFLAGS_I:INTERNAL=
|
||||
_OPENSSL_CFLAGS_OTHER:INTERNAL=
|
||||
_OPENSSL_FOUND:INTERNAL=1
|
||||
_OPENSSL_INCLUDEDIR:INTERNAL=/usr/include
|
||||
_OPENSSL_INCLUDE_DIRS:INTERNAL=
|
||||
_OPENSSL_LDFLAGS:INTERNAL=-lssl;-lcrypto
|
||||
_OPENSSL_LDFLAGS_OTHER:INTERNAL=
|
||||
_OPENSSL_LIBDIR:INTERNAL=/usr/lib/x86_64-linux-gnu
|
||||
_OPENSSL_LIBRARIES:INTERNAL=ssl;crypto
|
||||
_OPENSSL_LIBRARY_DIRS:INTERNAL=
|
||||
_OPENSSL_LIBS:INTERNAL=
|
||||
_OPENSSL_LIBS_L:INTERNAL=
|
||||
_OPENSSL_LIBS_OTHER:INTERNAL=
|
||||
_OPENSSL_LIBS_PATHS:INTERNAL=
|
||||
_OPENSSL_PREFIX:INTERNAL=/usr
|
||||
_OPENSSL_STATIC_CFLAGS:INTERNAL=
|
||||
_OPENSSL_STATIC_CFLAGS_I:INTERNAL=
|
||||
_OPENSSL_STATIC_CFLAGS_OTHER:INTERNAL=
|
||||
_OPENSSL_STATIC_INCLUDE_DIRS:INTERNAL=
|
||||
_OPENSSL_STATIC_LDFLAGS:INTERNAL=-lssl;-ldl;-lcrypto;-ldl
|
||||
_OPENSSL_STATIC_LDFLAGS_OTHER:INTERNAL=
|
||||
_OPENSSL_STATIC_LIBDIR:INTERNAL=
|
||||
_OPENSSL_STATIC_LIBRARIES:INTERNAL=ssl;dl;crypto;dl
|
||||
_OPENSSL_STATIC_LIBRARY_DIRS:INTERNAL=
|
||||
_OPENSSL_STATIC_LIBS:INTERNAL=
|
||||
_OPENSSL_STATIC_LIBS_L:INTERNAL=
|
||||
_OPENSSL_STATIC_LIBS_OTHER:INTERNAL=
|
||||
_OPENSSL_STATIC_LIBS_PATHS:INTERNAL=
|
||||
_OPENSSL_VERSION:INTERNAL=1.1.0g
|
||||
_OPENSSL_openssl_INCLUDEDIR:INTERNAL=
|
||||
_OPENSSL_openssl_LIBDIR:INTERNAL=
|
||||
_OPENSSL_openssl_PREFIX:INTERNAL=
|
||||
_OPENSSL_openssl_VERSION:INTERNAL=
|
||||
__pkg_config_arguments__OPENSSL:INTERNAL=QUIET;openssl
|
||||
__pkg_config_checked__OPENSSL:INTERNAL=1
|
||||
prefix_result:INTERNAL=/usr/lib/x86_64-linux-gnu
|
||||
|
||||
5
clang-format.sh
Executable file
5
clang-format.sh
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
find ./libraries/app -regex ".*[c|h]pp" | xargs clang-format -i
|
||||
find ./libraries/chain/hardfork.d -regex ".*hf" | xargs clang-format -i
|
||||
find ./libraries/plugins/peerplays_sidechain -regex ".*[c|h]pp" | xargs clang-format -i
|
||||
10438
genesis-testnet.json
Normal file
10438
genesis-testnet.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,12 +1,10 @@
|
|||
add_subdirectory( fc )
|
||||
add_subdirectory( db )
|
||||
#add_subdirectory( deterministic_openssl_rand )
|
||||
add_subdirectory( app )
|
||||
add_subdirectory( chain )
|
||||
add_subdirectory( db )
|
||||
add_subdirectory( egenesis )
|
||||
add_subdirectory( fc )
|
||||
add_subdirectory( net )
|
||||
#add_subdirectory( p2p )
|
||||
add_subdirectory( plugins )
|
||||
add_subdirectory( time )
|
||||
add_subdirectory( utilities )
|
||||
add_subdirectory( app )
|
||||
add_subdirectory( plugins )
|
||||
add_subdirectory( wallet )
|
||||
|
|
|
|||
|
|
@ -4,16 +4,19 @@ file(GLOB EGENESIS_HEADERS "../egenesis/include/graphene/app/*.hpp")
|
|||
add_library( graphene_app
|
||||
api.cpp
|
||||
application.cpp
|
||||
config_util.cpp
|
||||
database_api.cpp
|
||||
plugin.cpp
|
||||
config_util.cpp
|
||||
${HEADERS}
|
||||
${EGENESIS_HEADERS}
|
||||
)
|
||||
|
||||
# need to link graphene_debug_witness because plugins aren't sufficiently isolated #246
|
||||
#target_link_libraries( graphene_app graphene_market_history graphene_account_history graphene_chain fc graphene_db graphene_net graphene_utilities graphene_debug_witness )
|
||||
target_link_libraries( graphene_app graphene_market_history graphene_account_history graphene_accounts_list graphene_affiliate_stats graphene_chain fc graphene_db graphene_net graphene_time graphene_utilities graphene_debug_witness graphene_bookie graphene_elasticsearch peerplays_sidechain )
|
||||
target_link_libraries( graphene_app
|
||||
PUBLIC graphene_net graphene_utilities
|
||||
graphene_account_history graphene_accounts_list graphene_affiliate_stats graphene_bookie graphene_debug_witness graphene_elasticsearch graphene_es_objects graphene_generate_genesis graphene_market_history )
|
||||
|
||||
target_include_directories( graphene_app
|
||||
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../egenesis/include" )
|
||||
|
|
@ -30,3 +33,25 @@ INSTALL( TARGETS
|
|||
ARCHIVE DESTINATION lib
|
||||
)
|
||||
INSTALL( FILES ${HEADERS} DESTINATION "include/graphene/app" )
|
||||
|
||||
|
||||
|
||||
add_library( graphene_plugin
|
||||
plugin.cpp
|
||||
|
||||
include/graphene/app/plugin.hpp
|
||||
)
|
||||
|
||||
target_link_libraries( graphene_plugin
|
||||
PUBLIC graphene_net graphene_utilities )
|
||||
|
||||
target_include_directories( graphene_plugin
|
||||
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" )
|
||||
|
||||
INSTALL( TARGETS
|
||||
graphene_app
|
||||
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
)
|
||||
|
|
|
|||
|
|
@ -26,16 +26,16 @@
|
|||
#include <graphene/app/api.hpp>
|
||||
#include <graphene/app/api_access.hpp>
|
||||
#include <graphene/app/application.hpp>
|
||||
#include <graphene/chain/confidential_object.hpp>
|
||||
#include <graphene/chain/database.hpp>
|
||||
#include <graphene/chain/get_config.hpp>
|
||||
#include <graphene/utilities/key_conversion.hpp>
|
||||
#include <graphene/chain/protocol/fee_schedule.hpp>
|
||||
#include <graphene/chain/confidential_object.hpp>
|
||||
#include <graphene/chain/market_object.hpp>
|
||||
#include <graphene/chain/protocol/fee_schedule.hpp>
|
||||
#include <graphene/chain/tournament_object.hpp>
|
||||
#include <graphene/chain/transaction_object.hpp>
|
||||
#include <graphene/chain/withdraw_permission_object.hpp>
|
||||
#include <graphene/chain/worker_object.hpp>
|
||||
#include <graphene/chain/tournament_object.hpp>
|
||||
#include <graphene/utilities/key_conversion.hpp>
|
||||
|
||||
#include <fc/crypto/hex.hpp>
|
||||
#include <fc/rpc/api_connection.hpp>
|
||||
|
|
@ -50,25 +50,20 @@ template class fc::api<graphene::app::asset_api>;
|
|||
template class fc::api<graphene::debug_witness::debug_api>;
|
||||
template class fc::api<graphene::app::login_api>;
|
||||
|
||||
|
||||
namespace graphene { namespace app {
|
||||
|
||||
login_api::login_api(application& a)
|
||||
:_app(a)
|
||||
{
|
||||
login_api::login_api(application &a) :
|
||||
_app(a) {
|
||||
}
|
||||
|
||||
login_api::~login_api()
|
||||
{
|
||||
login_api::~login_api() {
|
||||
}
|
||||
|
||||
bool login_api::login(const string& user, const string& password)
|
||||
{
|
||||
bool login_api::login(const string &user, const string &password) {
|
||||
optional<api_access_info> acc = _app.get_api_access_info(user);
|
||||
if (!acc.valid())
|
||||
return false;
|
||||
if( acc->password_hash_b64 != "*" )
|
||||
{
|
||||
if (acc->password_hash_b64 != "*") {
|
||||
std::string password_salt = fc::base64_decode(acc->password_salt_b64);
|
||||
std::string acc_password_hash = fc::base64_decode(acc->password_hash_b64);
|
||||
|
||||
|
|
@ -84,50 +79,30 @@ namespace graphene { namespace app {
|
|||
return true;
|
||||
}
|
||||
|
||||
void login_api::enable_api( const std::string& api_name )
|
||||
{
|
||||
if( api_name == "database_api" )
|
||||
{
|
||||
void login_api::enable_api(const std::string &api_name) {
|
||||
if (api_name == "database_api") {
|
||||
_database_api = std::make_shared<database_api>(std::ref(*_app.chain_database()));
|
||||
}
|
||||
else if( api_name == "block_api" )
|
||||
{
|
||||
} else if (api_name == "block_api") {
|
||||
_block_api = std::make_shared<block_api>(std::ref(*_app.chain_database()));
|
||||
}
|
||||
else if( api_name == "network_broadcast_api" )
|
||||
{
|
||||
} else if (api_name == "network_broadcast_api") {
|
||||
_network_broadcast_api = std::make_shared<network_broadcast_api>(std::ref(_app));
|
||||
}
|
||||
else if( api_name == "history_api" )
|
||||
{
|
||||
} else if (api_name == "history_api") {
|
||||
_history_api = std::make_shared<history_api>(_app);
|
||||
}
|
||||
else if( api_name == "network_node_api" )
|
||||
{
|
||||
} else if (api_name == "network_node_api") {
|
||||
_network_node_api = std::make_shared<network_node_api>(std::ref(_app));
|
||||
}
|
||||
else if( api_name == "crypto_api" )
|
||||
{
|
||||
} else if (api_name == "crypto_api") {
|
||||
_crypto_api = std::make_shared<crypto_api>();
|
||||
}
|
||||
else if( api_name == "asset_api" )
|
||||
{
|
||||
} else if (api_name == "asset_api") {
|
||||
_asset_api = std::make_shared<asset_api>(_app);
|
||||
}
|
||||
else if( api_name == "debug_api" )
|
||||
{
|
||||
} else if (api_name == "debug_api") {
|
||||
// can only enable this API if the plugin was loaded
|
||||
if (_app.get_plugin("debug_witness"))
|
||||
_debug_api = std::make_shared<graphene::debug_witness::debug_api>(std::ref(_app));
|
||||
}
|
||||
else if( api_name == "bookie_api" )
|
||||
{
|
||||
} else if (api_name == "bookie_api") {
|
||||
// can only enable this API if the plugin was loaded
|
||||
if (_app.get_plugin("bookie"))
|
||||
_bookie_api = std::make_shared<graphene::bookie::bookie_api>(std::ref(_app));
|
||||
}
|
||||
else if( api_name == "affiliate_stats_api" )
|
||||
{
|
||||
} else if (api_name == "affiliate_stats_api") {
|
||||
// can only enable this API if the plugin was loaded
|
||||
if (_app.get_plugin("affiliate_stats"))
|
||||
_affiliate_stats_api = std::make_shared<graphene::affiliate_stats::affiliate_stats_api>(std::ref(_app));
|
||||
|
|
@ -136,11 +111,13 @@ namespace graphene { namespace app {
|
|||
}
|
||||
|
||||
// block_api
|
||||
block_api::block_api(graphene::chain::database& db) : _db(db) { }
|
||||
block_api::~block_api() { }
|
||||
block_api::block_api(graphene::chain::database &db) :
|
||||
_db(db) {
|
||||
}
|
||||
block_api::~block_api() {
|
||||
}
|
||||
|
||||
vector<optional<signed_block>> block_api::get_blocks(uint32_t block_num_from, uint32_t block_num_to)const
|
||||
{
|
||||
vector<optional<signed_block>> block_api::get_blocks(uint32_t block_num_from, uint32_t block_num_to) const {
|
||||
FC_ASSERT(block_num_to >= block_num_from && block_num_to - block_num_from <= 100, "Total blocks to be returned should be less than 100");
|
||||
vector<optional<signed_block>> res;
|
||||
for (uint32_t block_num = block_num_from; block_num <= block_num_to; block_num++) {
|
||||
|
|
@ -149,24 +126,22 @@ namespace graphene { namespace app {
|
|||
return res;
|
||||
}
|
||||
|
||||
network_broadcast_api::network_broadcast_api(application& a):_app(a)
|
||||
{
|
||||
_applied_block_connection = _app.chain_database()->applied_block.connect([this](const signed_block& b){ on_applied_block(b); });
|
||||
network_broadcast_api::network_broadcast_api(application &a) :
|
||||
_app(a) {
|
||||
_applied_block_connection = _app.chain_database()->applied_block.connect([this](const signed_block &b) {
|
||||
on_applied_block(b);
|
||||
});
|
||||
}
|
||||
|
||||
void network_broadcast_api::on_applied_block( const signed_block& b )
|
||||
{
|
||||
if( _callbacks.size() )
|
||||
{
|
||||
void network_broadcast_api::on_applied_block(const signed_block &b) {
|
||||
if (_callbacks.size()) {
|
||||
/// we need to ensure the database_api is not deleted for the life of the async operation
|
||||
auto capture_this = shared_from_this();
|
||||
for( uint32_t trx_num = 0; trx_num < b.transactions.size(); ++trx_num )
|
||||
{
|
||||
for (uint32_t trx_num = 0; trx_num < b.transactions.size(); ++trx_num) {
|
||||
const auto &trx = b.transactions[trx_num];
|
||||
auto id = trx.id();
|
||||
auto itr = _callbacks.find(id);
|
||||
if( itr != _callbacks.end() )
|
||||
{
|
||||
if (itr != _callbacks.end()) {
|
||||
auto block_num = b.block_num();
|
||||
auto &callback = _callbacks.find(id)->second;
|
||||
fc::async([capture_this, this, id, block_num, trx_num, trx, callback]() {
|
||||
|
|
@ -178,8 +153,7 @@ namespace graphene { namespace app {
|
|||
}
|
||||
}
|
||||
|
||||
void network_broadcast_api::broadcast_transaction(const signed_transaction& trx)
|
||||
{
|
||||
void network_broadcast_api::broadcast_transaction(const signed_transaction &trx) {
|
||||
trx.validate();
|
||||
_app.chain_database()->check_transaction_for_duplicated_operations(trx);
|
||||
_app.chain_database()->push_transaction(trx);
|
||||
|
|
@ -187,27 +161,25 @@ namespace graphene { namespace app {
|
|||
_app.p2p_node()->broadcast_transaction(trx);
|
||||
}
|
||||
|
||||
fc::variant network_broadcast_api::broadcast_transaction_synchronous(const signed_transaction& trx)
|
||||
{
|
||||
fc::variant network_broadcast_api::broadcast_transaction_synchronous(const signed_transaction &trx) {
|
||||
_app.chain_database()->check_transaction_for_duplicated_operations(trx);
|
||||
|
||||
fc::promise<fc::variant>::ptr prom(new fc::promise<fc::variant>());
|
||||
broadcast_transaction_with_callback([=](const fc::variant &v) {
|
||||
prom->set_value(v);
|
||||
}, trx );
|
||||
},
|
||||
trx);
|
||||
|
||||
return fc::future<fc::variant>(prom).wait();
|
||||
}
|
||||
|
||||
void network_broadcast_api::broadcast_block( const signed_block& b )
|
||||
{
|
||||
void network_broadcast_api::broadcast_block(const signed_block &b) {
|
||||
_app.chain_database()->push_block(b);
|
||||
if (_app.p2p_node() != nullptr)
|
||||
_app.p2p_node()->broadcast(net::block_message(b));
|
||||
}
|
||||
|
||||
void network_broadcast_api::broadcast_transaction_with_callback(confirmation_callback cb, const signed_transaction& trx)
|
||||
{
|
||||
void network_broadcast_api::broadcast_transaction_with_callback(confirmation_callback cb, const signed_transaction &trx) {
|
||||
trx.validate();
|
||||
_callbacks[trx.id()] = cb;
|
||||
_app.chain_database()->push_transaction(trx);
|
||||
|
|
@ -215,28 +187,23 @@ namespace graphene { namespace app {
|
|||
_app.p2p_node()->broadcast_transaction(trx);
|
||||
}
|
||||
|
||||
network_node_api::network_node_api( application& a ) : _app( a )
|
||||
{
|
||||
network_node_api::network_node_api(application &a) :
|
||||
_app(a) {
|
||||
_pending_trx_connection = _app.chain_database()->on_pending_transaction.connect([this](const signed_transaction &transaction) {
|
||||
|
||||
auto transaction_it = _pending_transactions.find(transaction.id());
|
||||
if (_pending_transactions.end() == transaction_it)
|
||||
{
|
||||
if (_pending_transactions.end() == transaction_it) {
|
||||
_pending_transactions[transaction.id()] = transaction;
|
||||
}
|
||||
|
||||
if (_on_pending_transaction)
|
||||
{
|
||||
if (_on_pending_transaction) {
|
||||
_on_pending_transaction(fc::variant(transaction, GRAPHENE_MAX_NESTED_OBJECTS));
|
||||
}
|
||||
});
|
||||
|
||||
_applied_block_connection = _app.chain_database()->applied_block.connect([this](const signed_block &block) {
|
||||
for (const auto& transaction: block.transactions)
|
||||
{
|
||||
for (const auto &transaction : block.transactions) {
|
||||
auto transaction_it = _pending_transactions.find(transaction.id());
|
||||
if (_pending_transactions.end() != transaction_it)
|
||||
{
|
||||
if (_pending_transactions.end() != transaction_it) {
|
||||
_pending_transactions.erase(transaction_it);
|
||||
}
|
||||
}
|
||||
|
|
@ -244,13 +211,10 @@ namespace graphene { namespace app {
|
|||
/*
|
||||
* Remove expired transactions from pending_transactions
|
||||
*/
|
||||
for (const auto& transaction: _pending_transactions)
|
||||
{
|
||||
if (transaction.second.expiration < block.timestamp)
|
||||
{
|
||||
for (const auto &transaction : _pending_transactions) {
|
||||
if (transaction.second.expiration < block.timestamp) {
|
||||
auto transaction_it = _pending_transactions.find(transaction.second.id());
|
||||
if (_pending_transactions.end() != transaction_it)
|
||||
{
|
||||
if (_pending_transactions.end() != transaction_it) {
|
||||
_pending_transactions.erase(transaction_it);
|
||||
}
|
||||
}
|
||||
|
|
@ -258,300 +222,101 @@ namespace graphene { namespace app {
|
|||
});
|
||||
}
|
||||
|
||||
fc::variant_object network_node_api::get_info() const
|
||||
{
|
||||
fc::variant_object network_node_api::get_info() const {
|
||||
fc::mutable_variant_object result = _app.p2p_node()->network_get_info();
|
||||
result["connection_count"] = _app.p2p_node()->get_connection_count();
|
||||
return result;
|
||||
}
|
||||
|
||||
void network_node_api::add_node(const fc::ip::endpoint& ep)
|
||||
{
|
||||
void network_node_api::add_node(const fc::ip::endpoint &ep) {
|
||||
_app.p2p_node()->add_node(ep);
|
||||
}
|
||||
|
||||
std::vector<net::peer_status> network_node_api::get_connected_peers() const
|
||||
{
|
||||
std::vector<net::peer_status> network_node_api::get_connected_peers() const {
|
||||
return _app.p2p_node()->get_connected_peers();
|
||||
}
|
||||
|
||||
std::vector<net::potential_peer_record> network_node_api::get_potential_peers() const
|
||||
{
|
||||
std::vector<net::potential_peer_record> network_node_api::get_potential_peers() const {
|
||||
return _app.p2p_node()->get_potential_peers();
|
||||
}
|
||||
|
||||
fc::variant_object network_node_api::get_advanced_node_parameters() const
|
||||
{
|
||||
fc::variant_object network_node_api::get_advanced_node_parameters() const {
|
||||
return _app.p2p_node()->get_advanced_node_parameters();
|
||||
}
|
||||
|
||||
void network_node_api::set_advanced_node_parameters(const fc::variant_object& params)
|
||||
{
|
||||
void network_node_api::set_advanced_node_parameters(const fc::variant_object ¶ms) {
|
||||
return _app.p2p_node()->set_advanced_node_parameters(params);
|
||||
}
|
||||
|
||||
map<transaction_id_type, signed_transaction> network_node_api::list_pending_transactions() const
|
||||
{
|
||||
map<transaction_id_type, signed_transaction> network_node_api::list_pending_transactions() const {
|
||||
return _pending_transactions;
|
||||
}
|
||||
|
||||
void network_node_api::subscribe_to_pending_transactions( std::function<void(const variant&)> callback )
|
||||
{
|
||||
void network_node_api::subscribe_to_pending_transactions(std::function<void(const variant &)> callback) {
|
||||
_on_pending_transaction = callback;
|
||||
}
|
||||
|
||||
void network_node_api::unsubscribe_from_pending_transactions()
|
||||
{
|
||||
void network_node_api::unsubscribe_from_pending_transactions() {
|
||||
_on_pending_transaction = std::function<void(const variant &)>();
|
||||
}
|
||||
|
||||
fc::api<network_broadcast_api> login_api::network_broadcast()const
|
||||
{
|
||||
fc::api<network_broadcast_api> login_api::network_broadcast() const {
|
||||
FC_ASSERT(_network_broadcast_api);
|
||||
return *_network_broadcast_api;
|
||||
}
|
||||
|
||||
fc::api<block_api> login_api::block()const
|
||||
{
|
||||
fc::api<block_api> login_api::block() const {
|
||||
FC_ASSERT(_block_api);
|
||||
return *_block_api;
|
||||
}
|
||||
|
||||
fc::api<network_node_api> login_api::network_node()const
|
||||
{
|
||||
fc::api<network_node_api> login_api::network_node() const {
|
||||
FC_ASSERT(_network_node_api);
|
||||
return *_network_node_api;
|
||||
}
|
||||
|
||||
fc::api<database_api> login_api::database()const
|
||||
{
|
||||
fc::api<database_api> login_api::database() const {
|
||||
FC_ASSERT(_database_api);
|
||||
return *_database_api;
|
||||
}
|
||||
|
||||
fc::api<history_api> login_api::history() const
|
||||
{
|
||||
fc::api<history_api> login_api::history() const {
|
||||
FC_ASSERT(_history_api);
|
||||
return *_history_api;
|
||||
}
|
||||
|
||||
fc::api<crypto_api> login_api::crypto() const
|
||||
{
|
||||
fc::api<crypto_api> login_api::crypto() const {
|
||||
FC_ASSERT(_crypto_api);
|
||||
return *_crypto_api;
|
||||
}
|
||||
|
||||
fc::api<asset_api> login_api::asset() const
|
||||
{
|
||||
fc::api<asset_api> login_api::asset() const {
|
||||
FC_ASSERT(_asset_api);
|
||||
return *_asset_api;
|
||||
}
|
||||
|
||||
fc::api<graphene::debug_witness::debug_api> login_api::debug() const
|
||||
{
|
||||
fc::api<graphene::debug_witness::debug_api> login_api::debug() const {
|
||||
FC_ASSERT(_debug_api);
|
||||
return *_debug_api;
|
||||
}
|
||||
|
||||
fc::api<graphene::bookie::bookie_api> login_api::bookie() const
|
||||
{
|
||||
fc::api<graphene::bookie::bookie_api> login_api::bookie() const {
|
||||
FC_ASSERT(_bookie_api);
|
||||
return *_bookie_api;
|
||||
}
|
||||
|
||||
fc::api<graphene::affiliate_stats::affiliate_stats_api> login_api::affiliate_stats() const
|
||||
{
|
||||
fc::api<graphene::affiliate_stats::affiliate_stats_api> login_api::affiliate_stats() const {
|
||||
FC_ASSERT(_affiliate_stats_api);
|
||||
return *_affiliate_stats_api;
|
||||
}
|
||||
|
||||
#if 0
|
||||
vector<account_id_type> get_relevant_accounts( const object* obj )
|
||||
{
|
||||
vector<account_id_type> result;
|
||||
if( obj->id.space() == protocol_ids )
|
||||
{
|
||||
switch( (object_type)obj->id.type() )
|
||||
{
|
||||
case null_object_type:
|
||||
case base_object_type:
|
||||
case OBJECT_TYPE_COUNT:
|
||||
return result;
|
||||
case account_object_type:{
|
||||
result.push_back( obj->id );
|
||||
break;
|
||||
} case asset_object_type:{
|
||||
const auto& aobj = dynamic_cast<const asset_object*>(obj);
|
||||
assert( aobj != nullptr );
|
||||
result.push_back( aobj->issuer );
|
||||
break;
|
||||
} case force_settlement_object_type:{
|
||||
const auto& aobj = dynamic_cast<const force_settlement_object*>(obj);
|
||||
assert( aobj != nullptr );
|
||||
result.push_back( aobj->owner );
|
||||
break;
|
||||
} case committee_member_object_type:{
|
||||
const auto& aobj = dynamic_cast<const committee_member_object*>(obj);
|
||||
assert( aobj != nullptr );
|
||||
result.push_back( aobj->committee_member_account );
|
||||
break;
|
||||
} case witness_object_type:{
|
||||
const auto& aobj = dynamic_cast<const witness_object*>(obj);
|
||||
assert( aobj != nullptr );
|
||||
result.push_back( aobj->witness_account );
|
||||
break;
|
||||
} case limit_order_object_type:{
|
||||
const auto& aobj = dynamic_cast<const limit_order_object*>(obj);
|
||||
assert( aobj != nullptr );
|
||||
result.push_back( aobj->seller );
|
||||
break;
|
||||
} case call_order_object_type:{
|
||||
const auto& aobj = dynamic_cast<const call_order_object*>(obj);
|
||||
assert( aobj != nullptr );
|
||||
result.push_back( aobj->borrower );
|
||||
break;
|
||||
} case custom_object_type:{
|
||||
break;
|
||||
} case proposal_object_type:{
|
||||
const auto& aobj = dynamic_cast<const proposal_object*>(obj);
|
||||
assert( aobj != nullptr );
|
||||
flat_set<account_id_type> impacted;
|
||||
transaction_get_impacted_accounts( aobj->proposed_transaction, impacted );
|
||||
result.reserve( impacted.size() );
|
||||
for( auto& item : impacted ) result.emplace_back(item);
|
||||
break;
|
||||
} case operation_history_object_type:{
|
||||
const auto& aobj = dynamic_cast<const operation_history_object*>(obj);
|
||||
assert( aobj != nullptr );
|
||||
flat_set<account_id_type> impacted;
|
||||
operation_get_impacted_accounts( aobj->op, impacted );
|
||||
result.reserve( impacted.size() );
|
||||
for( auto& item : impacted ) result.emplace_back(item);
|
||||
break;
|
||||
} case withdraw_permission_object_type:{
|
||||
const auto& aobj = dynamic_cast<const withdraw_permission_object*>(obj);
|
||||
assert( aobj != nullptr );
|
||||
result.push_back( aobj->withdraw_from_account );
|
||||
result.push_back( aobj->authorized_account );
|
||||
break;
|
||||
} case vesting_balance_object_type:{
|
||||
const auto& aobj = dynamic_cast<const vesting_balance_object*>(obj);
|
||||
assert( aobj != nullptr );
|
||||
result.push_back( aobj->owner );
|
||||
break;
|
||||
} case worker_object_type:{
|
||||
const auto& aobj = dynamic_cast<const worker_object*>(obj);
|
||||
assert( aobj != nullptr );
|
||||
result.push_back( aobj->worker_account );
|
||||
break;
|
||||
} case balance_object_type:{
|
||||
/** these are free from any accounts */
|
||||
break;
|
||||
} case son_object_type:{
|
||||
const auto& aobj = dynamic_cast<const son_object*>(obj);
|
||||
assert( aobj != nullptr );
|
||||
accounts.insert( aobj->son_account );
|
||||
break;
|
||||
} case sidechain_address_object_type:{
|
||||
const auto& aobj = dynamic_cast<const sidechain_address_object*>(obj);
|
||||
assert( aobj != nullptr );
|
||||
accounts.insert( aobj->sidechain_address_account );
|
||||
break;
|
||||
}
|
||||
case sport_object_type:
|
||||
case event_group_object_type:
|
||||
case event_object_type:
|
||||
case betting_market_group_object_type:
|
||||
case betting_market_object_type:
|
||||
/** these are free from any accounts */
|
||||
break;
|
||||
case bet_object_type:{
|
||||
const auto& aobj = dynamic_cast<const bet_object*>(obj);
|
||||
assert( aobj != nullptr );
|
||||
result.push_back( aobj->bettor_id );
|
||||
} case tournament_object_type:{
|
||||
const tournament_object* tournament_obj = dynamic_cast<const tournament_object*>(obj);
|
||||
assert(tournament_obj);
|
||||
const tournament_details_object& details = tournament_obj->tournament_details_id(*_app.chain_database());
|
||||
flat_set<account_id_type> impacted = details.registered_players;
|
||||
impacted.insert(tournament_obj->creator);
|
||||
std::copy(impacted.begin(), impacted.end(), std::back_inserter(result));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( obj->id.space() == implementation_ids )
|
||||
{
|
||||
switch( (impl_object_type)obj->id.type() )
|
||||
{
|
||||
case impl_global_property_object_type:
|
||||
break;
|
||||
case impl_dynamic_global_property_object_type:
|
||||
break;
|
||||
case impl_reserved0_object_type:
|
||||
break;
|
||||
case impl_asset_dynamic_data_type:
|
||||
break;
|
||||
case impl_asset_bitasset_data_type:
|
||||
break;
|
||||
case impl_account_balance_object_type:{
|
||||
const auto& aobj = dynamic_cast<const account_balance_object*>(obj);
|
||||
assert( aobj != nullptr );
|
||||
result.push_back( aobj->owner );
|
||||
break;
|
||||
} case impl_account_statistics_object_type:{
|
||||
const auto& aobj = dynamic_cast<const account_statistics_object*>(obj);
|
||||
assert( aobj != nullptr );
|
||||
result.push_back( aobj->owner );
|
||||
break;
|
||||
} case impl_transaction_object_type:{
|
||||
const auto& aobj = dynamic_cast<const transaction_object*>(obj);
|
||||
assert( aobj != nullptr );
|
||||
flat_set<account_id_type> impacted;
|
||||
transaction_get_impacted_accounts( aobj->trx, impacted );
|
||||
result.reserve( impacted.size() );
|
||||
for( auto& item : impacted ) result.emplace_back(item);
|
||||
break;
|
||||
} case impl_blinded_balance_object_type:{
|
||||
const auto& aobj = dynamic_cast<const blinded_balance_object*>(obj);
|
||||
assert( aobj != nullptr );
|
||||
result.reserve( aobj->owner.account_auths.size() );
|
||||
for( const auto& a : aobj->owner.account_auths )
|
||||
result.push_back( a.first );
|
||||
break;
|
||||
} case impl_block_summary_object_type:
|
||||
break;
|
||||
case impl_account_transaction_history_object_type:
|
||||
break;
|
||||
case impl_chain_property_object_type:
|
||||
break;
|
||||
case impl_witness_schedule_object_type:
|
||||
break;
|
||||
case impl_budget_record_object_type:
|
||||
break;
|
||||
case impl_special_authority_object_type:
|
||||
break;
|
||||
case impl_buyback_object_type:
|
||||
break;
|
||||
case impl_fba_accumulator_object_type:
|
||||
break;
|
||||
case impl_betting_market_position_object_type:
|
||||
break;
|
||||
case impl_global_betting_statistics_object_type:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
} // end get_relevant_accounts( obj )
|
||||
#endif
|
||||
|
||||
vector<order_history_object> history_api::get_fill_order_history( std::string asset_a, std::string asset_b, uint32_t limit )const
|
||||
{
|
||||
vector<order_history_object> history_api::get_fill_order_history(std::string asset_a, std::string asset_b, uint32_t limit) const {
|
||||
FC_ASSERT(_app.chain_database());
|
||||
const auto &db = *_app.chain_database();
|
||||
asset_id_type a = database_api.get_asset_id_from_string(asset_a);
|
||||
asset_id_type b = database_api.get_asset_id_from_string(asset_b);
|
||||
if( a > b ) std::swap(a,b);
|
||||
if (a > b)
|
||||
std::swap(a, b);
|
||||
const auto &history_idx = db.get_index_type<graphene::market_history::history_index>().indices().get<by_key>();
|
||||
history_key hkey;
|
||||
hkey.base = a;
|
||||
|
|
@ -561,9 +326,9 @@ namespace graphene { namespace app {
|
|||
uint32_t count = 0;
|
||||
auto itr = history_idx.lower_bound(hkey);
|
||||
vector<order_history_object> result;
|
||||
while( itr != history_idx.end() && count < limit)
|
||||
{
|
||||
if( itr->key.base != a || itr->key.quote != b ) break;
|
||||
while (itr != history_idx.end() && count < limit) {
|
||||
if (itr->key.base != a || itr->key.quote != b)
|
||||
break;
|
||||
result.push_back(*itr);
|
||||
++itr;
|
||||
++count;
|
||||
|
|
@ -575,11 +340,13 @@ namespace graphene { namespace app {
|
|||
vector<operation_history_object> history_api::get_account_history(const std::string account_id_or_name,
|
||||
operation_history_id_type stop,
|
||||
unsigned limit,
|
||||
operation_history_id_type start ) const
|
||||
{
|
||||
operation_history_id_type start) const {
|
||||
FC_ASSERT(_app.chain_database());
|
||||
const auto &db = *_app.chain_database();
|
||||
FC_ASSERT( limit <= 100 );
|
||||
FC_ASSERT(limit <= api_limit_get_account_history,
|
||||
"Number of querying accounts can not be greater than ${configured_limit}",
|
||||
("configured_limit", api_limit_get_account_history));
|
||||
|
||||
vector<operation_history_object> result;
|
||||
account_id_type account;
|
||||
try {
|
||||
|
|
@ -587,7 +354,9 @@ namespace graphene { namespace app {
|
|||
const account_transaction_history_object &node = account(db).statistics(db).most_recent_op(db);
|
||||
if (start == operation_history_id_type() || start.instance.value > node.operation_id.instance.value)
|
||||
start = node.operation_id;
|
||||
} catch(...) { return result; }
|
||||
} catch (...) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (_app.is_plugin_enabled("elasticsearch")) {
|
||||
auto es = _app.get_plugin<elasticsearch::elasticsearch_plugin>("elasticsearch");
|
||||
|
|
@ -597,7 +366,9 @@ namespace graphene { namespace app {
|
|||
|
||||
return _app.elasticsearch_thread->async([&es, &account, &stop, &limit, &start]() {
|
||||
return es->get_account_history(account, stop, limit, start);
|
||||
}, "thread invoke for method " BOOST_PP_STRINGIZE(method_name)).wait();
|
||||
},
|
||||
"thread invoke for method " BOOST_PP_STRINGIZE(method_name))
|
||||
.wait();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -606,8 +377,7 @@ namespace graphene { namespace app {
|
|||
auto index_start = by_op_idx.begin();
|
||||
auto itr = by_op_idx.lower_bound(boost::make_tuple(account, start));
|
||||
|
||||
while(itr != index_start && itr->account == account && itr->operation_id.instance.value > stop.instance.value && result.size() < limit)
|
||||
{
|
||||
while (itr != index_start && itr->account == account && itr->operation_id.instance.value > stop.instance.value && result.size() < limit) {
|
||||
if (itr->operation_id.instance.value <= start.instance.value)
|
||||
result.push_back(itr->operation_id(db));
|
||||
--itr;
|
||||
|
|
@ -623,25 +393,29 @@ namespace graphene { namespace app {
|
|||
int operation_id,
|
||||
operation_history_id_type start,
|
||||
operation_history_id_type stop,
|
||||
unsigned limit) const
|
||||
{
|
||||
unsigned limit) const {
|
||||
FC_ASSERT(_app.chain_database());
|
||||
const auto &db = *_app.chain_database();
|
||||
FC_ASSERT( limit <= 100 );
|
||||
FC_ASSERT(limit <= api_limit_get_account_history_operations,
|
||||
"Number of querying history accounts can not be greater than ${configured_limit}",
|
||||
("configured_limit", api_limit_get_account_history_operations));
|
||||
|
||||
vector<operation_history_object> result;
|
||||
account_id_type account;
|
||||
try {
|
||||
account = database_api.get_account_id_from_string(account_id_or_name);
|
||||
} catch (...) { return result; }
|
||||
} catch (...) {
|
||||
return result;
|
||||
}
|
||||
|
||||
const auto &stats = account(db).statistics(db);
|
||||
if( stats.most_recent_op == account_transaction_history_id_type() ) return result;
|
||||
if (stats.most_recent_op == account_transaction_history_id_type())
|
||||
return result;
|
||||
const account_transaction_history_object *node = &stats.most_recent_op(db);
|
||||
if (start == operation_history_id_type())
|
||||
start = node->operation_id;
|
||||
|
||||
while(node && node->operation_id.instance.value > stop.instance.value && result.size() < limit)
|
||||
{
|
||||
while (node && node->operation_id.instance.value > stop.instance.value && result.size() < limit) {
|
||||
if (node->operation_id.instance.value <= start.instance.value) {
|
||||
|
||||
if (node->operation_id(db).op.which() == operation_id)
|
||||
|
|
@ -649,7 +423,8 @@ namespace graphene { namespace app {
|
|||
}
|
||||
if (node->next == account_transaction_history_id_type())
|
||||
node = nullptr;
|
||||
else node = &node->next(db);
|
||||
else
|
||||
node = &node->next(db);
|
||||
}
|
||||
if (stop.instance.value == 0 && result.size() < limit) {
|
||||
auto head = db.find(account_transaction_history_id_type());
|
||||
|
|
@ -659,62 +434,59 @@ namespace graphene { namespace app {
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
vector<operation_history_object> history_api::get_relative_account_history(const std::string account_id_or_name,
|
||||
uint32_t stop,
|
||||
unsigned limit,
|
||||
uint32_t start) const
|
||||
{
|
||||
uint32_t start) const {
|
||||
FC_ASSERT(_app.chain_database());
|
||||
const auto &db = *_app.chain_database();
|
||||
FC_ASSERT(limit <= 100);
|
||||
FC_ASSERT(limit <= api_limit_get_relative_account_history,
|
||||
"Number of querying accounts can not be greater than ${configured_limit}",
|
||||
("configured_limit", api_limit_get_relative_account_history));
|
||||
|
||||
vector<operation_history_object> result;
|
||||
account_id_type account;
|
||||
try {
|
||||
account = database_api.get_account_id_from_string(account_id_or_name);
|
||||
} catch(...) { return result; }
|
||||
} catch (...) {
|
||||
return result;
|
||||
}
|
||||
const auto &stats = account(db).statistics(db);
|
||||
if (start == 0)
|
||||
start = stats.total_ops;
|
||||
else
|
||||
start = min(stats.total_ops, start);
|
||||
|
||||
|
||||
if( start >= stop && start > stats.removed_ops && limit > 0 )
|
||||
{
|
||||
if (start >= stop && start > stats.removed_ops && limit > 0) {
|
||||
const auto &hist_idx = db.get_index_type<account_transaction_history_index>();
|
||||
const auto &by_seq_idx = hist_idx.indices().get<by_seq>();
|
||||
|
||||
auto itr = by_seq_idx.upper_bound(boost::make_tuple(account, start));
|
||||
auto itr_stop = by_seq_idx.lower_bound(boost::make_tuple(account, stop));
|
||||
|
||||
do
|
||||
{
|
||||
do {
|
||||
--itr;
|
||||
result.push_back(itr->operation_id(db));
|
||||
}
|
||||
while ( itr != itr_stop && result.size() < limit );
|
||||
} while (itr != itr_stop && result.size() < limit);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
vector<account_balance_object> history_api::list_core_accounts()const
|
||||
{
|
||||
vector<account_balance_object> history_api::list_core_accounts() const {
|
||||
auto list = _app.get_plugin<accounts_list_plugin>("accounts_list");
|
||||
FC_ASSERT(list);
|
||||
return list->list_accounts();
|
||||
}
|
||||
|
||||
flat_set<uint32_t> history_api::get_market_history_buckets()const
|
||||
{
|
||||
flat_set<uint32_t> history_api::get_market_history_buckets() const {
|
||||
auto hist = _app.get_plugin<market_history_plugin>("market_history");
|
||||
FC_ASSERT(hist);
|
||||
return hist->tracked_buckets();
|
||||
}
|
||||
|
||||
vector<bucket_object> history_api::get_market_history(std::string asset_a, std::string asset_b,
|
||||
uint32_t bucket_seconds, fc::time_point_sec start, fc::time_point_sec end )const
|
||||
{ try {
|
||||
uint32_t bucket_seconds, fc::time_point_sec start, fc::time_point_sec end) const {
|
||||
try {
|
||||
FC_ASSERT(_app.chain_database());
|
||||
const auto &db = *_app.chain_database();
|
||||
asset_id_type a = database_api.get_asset_id_from_string(asset_a);
|
||||
|
|
@ -722,43 +494,40 @@ namespace graphene { namespace app {
|
|||
vector<bucket_object> result;
|
||||
result.reserve(200);
|
||||
|
||||
if( a > b ) std::swap(a,b);
|
||||
if (a > b)
|
||||
std::swap(a, b);
|
||||
|
||||
const auto &bidx = db.get_index_type<bucket_index>();
|
||||
const auto &by_key_idx = bidx.indices().get<by_key>();
|
||||
|
||||
auto itr = by_key_idx.lower_bound(bucket_key(a, b, bucket_seconds, start));
|
||||
while( itr != by_key_idx.end() && itr->key.open <= end && result.size() < 200 )
|
||||
{
|
||||
if( !(itr->key.base == a && itr->key.quote == b && itr->key.seconds == bucket_seconds) )
|
||||
{
|
||||
while (itr != by_key_idx.end() && itr->key.open <= end && result.size() < 200) {
|
||||
if (!(itr->key.base == a && itr->key.quote == b && itr->key.seconds == bucket_seconds)) {
|
||||
return result;
|
||||
}
|
||||
result.push_back(*itr);
|
||||
++itr;
|
||||
}
|
||||
return result;
|
||||
} FC_CAPTURE_AND_RETHROW( (asset_a)(asset_b)(bucket_seconds)(start)(end) ) }
|
||||
}
|
||||
FC_CAPTURE_AND_RETHROW((asset_a)(asset_b)(bucket_seconds)(start)(end))
|
||||
}
|
||||
|
||||
crypto_api::crypto_api(){};
|
||||
|
||||
commitment_type crypto_api::blind( const blind_factor_type& blind, uint64_t value )
|
||||
{
|
||||
commitment_type crypto_api::blind(const blind_factor_type &blind, uint64_t value) {
|
||||
return fc::ecc::blind(blind, value);
|
||||
}
|
||||
|
||||
blind_factor_type crypto_api::blind_sum( const std::vector<blind_factor_type>& blinds_in, uint32_t non_neg )
|
||||
{
|
||||
blind_factor_type crypto_api::blind_sum(const std::vector<blind_factor_type> &blinds_in, uint32_t non_neg) {
|
||||
return fc::ecc::blind_sum(blinds_in, non_neg);
|
||||
}
|
||||
|
||||
bool crypto_api::verify_sum( const std::vector<commitment_type>& commits_in, const std::vector<commitment_type>& neg_commits_in, int64_t excess )
|
||||
{
|
||||
bool crypto_api::verify_sum(const std::vector<commitment_type> &commits_in, const std::vector<commitment_type> &neg_commits_in, int64_t excess) {
|
||||
return fc::ecc::verify_sum(commits_in, neg_commits_in, excess);
|
||||
}
|
||||
|
||||
verify_range_result crypto_api::verify_range( const commitment_type& commit, const std::vector<char>& proof )
|
||||
{
|
||||
verify_range_result crypto_api::verify_range(const commitment_type &commit, const std::vector<char> &proof) {
|
||||
verify_range_result result;
|
||||
result.success = fc::ecc::verify_range(result.min_val, result.max_val, commit, proof);
|
||||
return result;
|
||||
|
|
@ -770,15 +539,13 @@ namespace graphene { namespace app {
|
|||
const blind_factor_type &nonce,
|
||||
int8_t base10_exp,
|
||||
uint8_t min_bits,
|
||||
uint64_t actual_value )
|
||||
{
|
||||
uint64_t actual_value) {
|
||||
return fc::ecc::range_proof_sign(min_value, commit, commit_blind, nonce, base10_exp, min_bits, actual_value);
|
||||
}
|
||||
|
||||
verify_range_proof_rewind_result crypto_api::verify_range_proof_rewind(const blind_factor_type &nonce,
|
||||
const commitment_type &commit,
|
||||
const std::vector<char>& proof )
|
||||
{
|
||||
const std::vector<char> &proof) {
|
||||
verify_range_proof_rewind_result result;
|
||||
result.success = fc::ecc::verify_range_proof_rewind(result.blind_out,
|
||||
result.value_out,
|
||||
|
|
@ -791,8 +558,7 @@ namespace graphene { namespace app {
|
|||
return result;
|
||||
}
|
||||
|
||||
range_proof_info crypto_api::range_get_info( const std::vector<char>& proof )
|
||||
{
|
||||
range_proof_info crypto_api::range_get_info(const std::vector<char> &proof) {
|
||||
return fc::ecc::range_get_info(proof);
|
||||
}
|
||||
|
||||
|
|
@ -800,11 +566,16 @@ namespace graphene { namespace app {
|
|||
asset_api::asset_api(graphene::app::application &app) :
|
||||
_app(app),
|
||||
_db(*app.chain_database()),
|
||||
database_api( std::ref(*app.chain_database())) { }
|
||||
asset_api::~asset_api() { }
|
||||
database_api(std::ref(*app.chain_database())) {
|
||||
}
|
||||
|
||||
asset_api::~asset_api() {
|
||||
}
|
||||
|
||||
vector<account_asset_balance> asset_api::get_asset_holders(std::string asset, uint32_t start, uint32_t limit) const {
|
||||
FC_ASSERT(limit <= 100);
|
||||
FC_ASSERT(limit <= api_limit_get_asset_holders,
|
||||
"Number of querying asset holder accounts can not be greater than ${configured_limit}",
|
||||
("configured_limit", api_limit_get_asset_holders));
|
||||
|
||||
asset_id_type asset_id = database_api.get_asset_id_from_string(asset);
|
||||
const auto &bal_idx = _db.get_index_type<account_balance_index>().indices().get<by_asset_balance>();
|
||||
|
|
@ -813,8 +584,7 @@ namespace graphene { namespace app {
|
|||
vector<account_asset_balance> result;
|
||||
|
||||
uint32_t index = 0;
|
||||
for( const account_balance_object& bal : boost::make_iterator_range( range.first, range.second ) )
|
||||
{
|
||||
for (const account_balance_object &bal : boost::make_iterator_range(range.first, range.second)) {
|
||||
if (result.size() >= limit)
|
||||
break;
|
||||
|
||||
|
|
@ -852,8 +622,7 @@ namespace graphene { namespace app {
|
|||
vector<asset_holders> result;
|
||||
|
||||
vector<asset_id_type> total_assets;
|
||||
for( const asset_object& asset_obj : _db.get_index_type<asset_index>().indices() )
|
||||
{
|
||||
for (const asset_object &asset_obj : _db.get_index_type<asset_index>().indices()) {
|
||||
const auto &dasset_obj = asset_obj.dynamic_asset_data_id(_db);
|
||||
|
||||
asset_id_type asset_id;
|
||||
|
|
@ -874,4 +643,4 @@ namespace graphene { namespace app {
|
|||
return result;
|
||||
}
|
||||
|
||||
} } // graphene::app
|
||||
}} // namespace graphene::app
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -25,34 +25,34 @@
|
|||
#include <graphene/app/config_util.hpp>
|
||||
#include <graphene/chain/config.hpp>
|
||||
|
||||
#include <fc/reflect/variant.hpp>
|
||||
#include <fc/string.hpp>
|
||||
#include <fc/exception/exception.hpp>
|
||||
#include <fc/log/console_appender.hpp>
|
||||
#include <fc/log/file_appender.hpp>
|
||||
#include <fc/log/logger_config.hpp>
|
||||
#include <fc/reflect/variant.hpp>
|
||||
#include <fc/string.hpp>
|
||||
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
#include <boost/property_tree/ini_parser.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/property_tree/ini_parser.hpp>
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
namespace bpo = boost::program_options;
|
||||
|
||||
class deduplicator
|
||||
{
|
||||
class deduplicator {
|
||||
public:
|
||||
deduplicator() : modifier(nullptr) {}
|
||||
deduplicator() :
|
||||
modifier(nullptr) {
|
||||
}
|
||||
|
||||
deduplicator(const boost::shared_ptr<bpo::option_description> (*mod_fn)(const boost::shared_ptr<bpo::option_description>&))
|
||||
: modifier(mod_fn) {}
|
||||
deduplicator(const boost::shared_ptr<bpo::option_description> (*mod_fn)(const boost::shared_ptr<bpo::option_description> &)) :
|
||||
modifier(mod_fn) {
|
||||
}
|
||||
|
||||
const boost::shared_ptr<bpo::option_description> next(const boost::shared_ptr<bpo::option_description>& o)
|
||||
{
|
||||
const boost::shared_ptr<bpo::option_description> next(const boost::shared_ptr<bpo::option_description> &o) {
|
||||
const std::string name = o->long_name();
|
||||
if (seen.find(name) != seen.end())
|
||||
return nullptr;
|
||||
|
|
@ -69,8 +69,7 @@ private:
|
|||
// are all most users would want to change. At a later time, options can
|
||||
// be added to control rotation intervals, compression, and other seldom-
|
||||
// used features
|
||||
static void write_default_logging_config_to_stream(std::ostream& out)
|
||||
{
|
||||
static void write_default_logging_config_to_stream(std::ostream &out) {
|
||||
out << "# declare an appender named \"stderr\" that writes messages to the console\n"
|
||||
"[log.console_appender.stderr]\n"
|
||||
"stream=std_error\n\n"
|
||||
|
|
@ -115,17 +114,14 @@ static void write_default_logging_config_to_stream(std::ostream& out)
|
|||
|
||||
// logging config is too complicated to be parsed by boost::program_options,
|
||||
// so we do it by hand
|
||||
static fc::optional<fc::logging_config> load_logging_config_from_ini_file(const fc::path& config_ini_filename)
|
||||
{
|
||||
try
|
||||
{
|
||||
static fc::optional<fc::logging_config> load_logging_config_from_ini_file(const fc::path &config_ini_filename) {
|
||||
try {
|
||||
fc::logging_config logging_config;
|
||||
bool found_logging_config = false;
|
||||
|
||||
boost::property_tree::ptree config_ini_tree;
|
||||
boost::property_tree::ini_parser::read_ini(config_ini_filename.preferred_string().c_str(), config_ini_tree);
|
||||
for (const auto& section : config_ini_tree)
|
||||
{
|
||||
for (const auto §ion : config_ini_tree) {
|
||||
const std::string §ion_name = section.first;
|
||||
const boost::property_tree::ptree §ion_tree = section.second;
|
||||
|
||||
|
|
@ -133,8 +129,7 @@ static fc::optional<fc::logging_config> load_logging_config_from_ini_file(const
|
|||
const std::string file_appender_section_prefix = "log.file_appender.";
|
||||
const std::string logger_section_prefix = "logger.";
|
||||
|
||||
if (boost::starts_with(section_name, console_appender_section_prefix))
|
||||
{
|
||||
if (boost::starts_with(section_name, console_appender_section_prefix)) {
|
||||
std::string console_appender_name = section_name.substr(console_appender_section_prefix.length());
|
||||
std::string stream_name = section_tree.get<std::string>("stream");
|
||||
|
||||
|
|
@ -153,9 +148,7 @@ static fc::optional<fc::logging_config> load_logging_config_from_ini_file(const
|
|||
console_appender_config.stream = fc::variant(stream_name).as<fc::console_appender::stream::type>(GRAPHENE_MAX_NESTED_OBJECTS);
|
||||
logging_config.appenders.push_back(fc::appender_config(console_appender_name, "console", fc::variant(console_appender_config, GRAPHENE_MAX_NESTED_OBJECTS)));
|
||||
found_logging_config = true;
|
||||
}
|
||||
else if (boost::starts_with(section_name, file_appender_section_prefix))
|
||||
{
|
||||
} else if (boost::starts_with(section_name, file_appender_section_prefix)) {
|
||||
std::string file_appender_name = section_name.substr(file_appender_section_prefix.length());
|
||||
fc::path file_name = section_tree.get<std::string>("filename");
|
||||
if (file_name.is_relative())
|
||||
|
|
@ -174,9 +167,7 @@ static fc::optional<fc::logging_config> load_logging_config_from_ini_file(const
|
|||
file_appender_config.rotation_limit = fc::days(limit);
|
||||
logging_config.appenders.push_back(fc::appender_config(file_appender_name, "file", fc::variant(file_appender_config, GRAPHENE_MAX_NESTED_OBJECTS)));
|
||||
found_logging_config = true;
|
||||
}
|
||||
else if (boost::starts_with(section_name, logger_section_prefix))
|
||||
{
|
||||
} else if (boost::starts_with(section_name, logger_section_prefix)) {
|
||||
std::string logger_name = section_name.substr(logger_section_prefix.length());
|
||||
std::string level_string = section_tree.get<std::string>("level");
|
||||
std::string appenders_string = section_tree.get<std::string>("appenders");
|
||||
|
|
@ -197,56 +188,45 @@ static fc::optional<fc::logging_config> load_logging_config_from_ini_file(const
|
|||
FC_RETHROW_EXCEPTIONS(warn, "")
|
||||
}
|
||||
|
||||
static const boost::shared_ptr<bpo::option_description> new_option_description( const std::string& name, const bpo::value_semantic* value, const std::string& description )
|
||||
{
|
||||
static const boost::shared_ptr<bpo::option_description> new_option_description(const std::string &name, const bpo::value_semantic *value, const std::string &description) {
|
||||
bpo::options_description helper("");
|
||||
helper.add_options()(name.c_str(), value, description.c_str());
|
||||
return helper.options()[0];
|
||||
}
|
||||
|
||||
|
||||
static void load_config_file(const fc::path &config_ini_path, const bpo::options_description &cfg_options,
|
||||
bpo::variables_map& options )
|
||||
{
|
||||
ilog("Loading config file at ${path}", ("path", config_ini_path));
|
||||
|
||||
bpo::variables_map &options) {
|
||||
deduplicator dedup;
|
||||
bpo::options_description unique_options("Graphene Witness Node");
|
||||
for( const boost::shared_ptr<bpo::option_description> opt : cfg_options.options() )
|
||||
{
|
||||
for (const boost::shared_ptr<bpo::option_description> opt : cfg_options.options()) {
|
||||
const boost::shared_ptr<bpo::option_description> od = dedup.next(opt);
|
||||
if( !od ) continue;
|
||||
if (!od)
|
||||
continue;
|
||||
unique_options.add(od);
|
||||
}
|
||||
|
||||
// get the basic options
|
||||
bpo::store(bpo::parse_config_file<char>(config_ini_path.preferred_string().c_str(),
|
||||
unique_options, true), options);
|
||||
unique_options, true),
|
||||
options);
|
||||
}
|
||||
|
||||
static bool load_logging_config_file(const fc::path& config_ini_path)
|
||||
{
|
||||
ilog("Loading logging config file at ${path}", ("path", config_ini_path));
|
||||
static bool load_logging_config_file(const fc::path &config_ini_path) {
|
||||
// try to get logging options from the config file.
|
||||
try
|
||||
{
|
||||
try {
|
||||
fc::optional<fc::logging_config> logging_config = load_logging_config_from_ini_file(config_ini_path);
|
||||
if (logging_config)
|
||||
{
|
||||
if (logging_config) {
|
||||
fc::configure_logging(*logging_config);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (const fc::exception& ex)
|
||||
{
|
||||
} catch (const fc::exception &ex) {
|
||||
wlog("Error parsing logging config from logging config file ${config}, using default config", ("config", config_ini_path.preferred_string()));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void create_new_config_file(const fc::path &config_ini_path, const fc::path &data_dir,
|
||||
const bpo::options_description& cfg_options )
|
||||
{
|
||||
const bpo::options_description &cfg_options) {
|
||||
ilog("Writing new config file at ${path}", ("path", config_ini_path));
|
||||
if (!fc::exists(data_dir))
|
||||
fc::create_directories(data_dir);
|
||||
|
|
@ -262,10 +242,10 @@ static void create_new_config_file(const fc::path& config_ini_path, const fc::pa
|
|||
deduplicator dedup(modify_option_defaults);
|
||||
std::ofstream out_cfg(config_ini_path.preferred_string());
|
||||
std::string plugin_header_surrounding(78, '=');
|
||||
for( const boost::shared_ptr<bpo::option_description> opt : cfg_options.options() )
|
||||
{
|
||||
for (const boost::shared_ptr<bpo::option_description> opt : cfg_options.options()) {
|
||||
const boost::shared_ptr<bpo::option_description> od = dedup.next(opt);
|
||||
if( !od ) continue;
|
||||
if (!od)
|
||||
continue;
|
||||
|
||||
if (od->long_name().find("plugin-cfg-header-") == 0) // it's a plugin header
|
||||
{
|
||||
|
|
@ -286,7 +266,8 @@ static void create_new_config_file(const fc::path& config_ini_path, const fc::pa
|
|||
auto example = od->format_parameter();
|
||||
if (example.empty())
|
||||
// This is a boolean switch
|
||||
out_cfg << od->long_name() << " = " << "false\n";
|
||||
out_cfg << od->long_name() << " = "
|
||||
<< "false\n";
|
||||
else {
|
||||
// The string is formatted "arg (=<interesting part>)"
|
||||
example.erase(0, 6);
|
||||
|
|
@ -307,11 +288,9 @@ static void create_new_config_file(const fc::path& config_ini_path, const fc::pa
|
|||
out_cfg.close();
|
||||
}
|
||||
|
||||
static void create_logging_config_file(const fc::path& config_ini_path, const fc::path& data_dir)
|
||||
{
|
||||
static void create_logging_config_file(const fc::path &config_ini_path, const fc::path &data_dir) {
|
||||
ilog("Writing new config file at ${path}", ("path", config_ini_path));
|
||||
if (!exists(data_dir))
|
||||
{
|
||||
if (!exists(data_dir)) {
|
||||
create_directories(data_dir);
|
||||
}
|
||||
|
||||
|
|
@ -322,18 +301,14 @@ static void create_logging_config_file(const fc::path& config_ini_path, const fc
|
|||
|
||||
namespace graphene { namespace app {
|
||||
|
||||
void load_configuration_options(const fc::path& data_dir, const bpo::options_description& cfg_options, bpo::variables_map& options)
|
||||
{
|
||||
void load_configuration_options(const fc::path &data_dir, const bpo::options_description &cfg_options, bpo::variables_map &options) {
|
||||
const auto config_ini_path = data_dir / "config.ini";
|
||||
const auto logging_ini_path = data_dir / "logging.ini";
|
||||
|
||||
if(!exists(config_ini_path) && fc::exists(logging_ini_path))
|
||||
{
|
||||
if (!exists(config_ini_path) && fc::exists(logging_ini_path)) {
|
||||
// this is an uncommon case
|
||||
create_new_config_file(config_ini_path, data_dir, cfg_options);
|
||||
}
|
||||
else if(!exists(config_ini_path))
|
||||
{
|
||||
} else if (!exists(config_ini_path)) {
|
||||
// create default config.ini and logging.ini
|
||||
create_new_config_file(config_ini_path, data_dir, cfg_options);
|
||||
create_logging_config_file(logging_ini_path, data_dir);
|
||||
|
|
@ -343,15 +318,12 @@ namespace graphene { namespace app {
|
|||
load_config_file(config_ini_path, cfg_options, options);
|
||||
|
||||
// load logging configuration
|
||||
if (fc::exists(logging_ini_path))
|
||||
{
|
||||
if (fc::exists(logging_ini_path)) {
|
||||
load_logging_config_file(logging_ini_path);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// this is the legacy config.ini case
|
||||
load_logging_config_file(config_ini_path);
|
||||
}
|
||||
}
|
||||
|
||||
} } // graphene::app
|
||||
}} // namespace graphene::app
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -25,24 +25,24 @@
|
|||
|
||||
#include <graphene/app/database_api.hpp>
|
||||
|
||||
#include <graphene/chain/protocol/types.hpp>
|
||||
#include <graphene/chain/protocol/confidential.hpp>
|
||||
#include <graphene/chain/protocol/types.hpp>
|
||||
|
||||
#include <graphene/market_history/market_history_plugin.hpp>
|
||||
#include <graphene/accounts_list/accounts_list_plugin.hpp>
|
||||
#include <graphene/market_history/market_history_plugin.hpp>
|
||||
|
||||
#include <graphene/elasticsearch/elasticsearch_plugin.hpp>
|
||||
|
||||
#include <graphene/debug_witness/debug_api.hpp>
|
||||
#include <graphene/affiliate_stats/affiliate_stats_api.hpp>
|
||||
#include <graphene/bookie/bookie_api.hpp>
|
||||
#include <graphene/debug_witness/debug_api.hpp>
|
||||
|
||||
#include <graphene/net/node.hpp>
|
||||
|
||||
#include <fc/api.hpp>
|
||||
#include <fc/optional.hpp>
|
||||
#include <fc/crypto/elliptic.hpp>
|
||||
#include <fc/network/ip.hpp>
|
||||
#include <fc/optional.hpp>
|
||||
|
||||
#include <boost/container/flat_set.hpp>
|
||||
|
||||
|
|
@ -60,15 +60,13 @@ namespace graphene { namespace app {
|
|||
|
||||
class application;
|
||||
|
||||
struct verify_range_result
|
||||
{
|
||||
struct verify_range_result {
|
||||
bool success;
|
||||
uint64_t min_val;
|
||||
uint64_t max_val;
|
||||
};
|
||||
|
||||
struct verify_range_proof_rewind_result
|
||||
{
|
||||
struct verify_range_proof_rewind_result {
|
||||
bool success;
|
||||
uint64_t min_val;
|
||||
uint64_t max_val;
|
||||
|
|
@ -77,14 +75,12 @@ namespace graphene { namespace app {
|
|||
string message_out;
|
||||
};
|
||||
|
||||
struct account_asset_balance
|
||||
{
|
||||
struct account_asset_balance {
|
||||
string name;
|
||||
account_id_type account_id;
|
||||
share_type amount;
|
||||
};
|
||||
struct asset_holders
|
||||
{
|
||||
struct asset_holders {
|
||||
asset_id_type asset_id;
|
||||
int count;
|
||||
};
|
||||
|
|
@ -94,11 +90,12 @@ namespace graphene { namespace app {
|
|||
*
|
||||
* This API contains methods to access account histories
|
||||
*/
|
||||
class history_api
|
||||
{
|
||||
class history_api {
|
||||
public:
|
||||
history_api(application& app)
|
||||
:_app(app), database_api( std::ref(*app.chain_database())) {}
|
||||
history_api(application &app) :
|
||||
_app(app),
|
||||
database_api(std::ref(*app.chain_database())) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get operations relevant to the specificed account
|
||||
|
|
@ -150,6 +147,10 @@ namespace graphene { namespace app {
|
|||
fc::time_point_sec start, fc::time_point_sec end) const;
|
||||
vector<account_balance_object> list_core_accounts() const;
|
||||
flat_set<uint32_t> get_market_history_buckets() const;
|
||||
uint32_t api_limit_get_account_history_operations = 100;
|
||||
uint32_t api_limit_get_account_history = 100;
|
||||
uint32_t api_limit_get_relative_account_history = 100;
|
||||
|
||||
private:
|
||||
application &_app;
|
||||
graphene::app::database_api database_api;
|
||||
|
|
@ -158,8 +159,7 @@ namespace graphene { namespace app {
|
|||
/**
|
||||
* @brief Block api
|
||||
*/
|
||||
class block_api
|
||||
{
|
||||
class block_api {
|
||||
public:
|
||||
block_api(graphene::chain::database &db);
|
||||
~block_api();
|
||||
|
|
@ -170,17 +170,14 @@ namespace graphene { namespace app {
|
|||
graphene::chain::database &_db;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief The network_broadcast_api class allows broadcasting of transactions.
|
||||
*/
|
||||
class network_broadcast_api : public std::enable_shared_from_this<network_broadcast_api>
|
||||
{
|
||||
class network_broadcast_api : public std::enable_shared_from_this<network_broadcast_api> {
|
||||
public:
|
||||
network_broadcast_api(application &a);
|
||||
|
||||
struct transaction_confirmation
|
||||
{
|
||||
struct transaction_confirmation {
|
||||
transaction_id_type id;
|
||||
uint32_t block_num;
|
||||
uint32_t trx_num;
|
||||
|
|
@ -221,6 +218,7 @@ namespace graphene { namespace app {
|
|||
* to be notified when a particular txid is included in a block.
|
||||
*/
|
||||
void on_applied_block(const signed_block &b);
|
||||
|
||||
private:
|
||||
boost::signals2::scoped_connection _applied_block_connection;
|
||||
map<transaction_id_type, confirmation_callback> _callbacks;
|
||||
|
|
@ -230,8 +228,7 @@ namespace graphene { namespace app {
|
|||
/**
|
||||
* @brief The network_node_api class allows maintenance of p2p connections.
|
||||
*/
|
||||
class network_node_api
|
||||
{
|
||||
class network_node_api {
|
||||
public:
|
||||
network_node_api(application &a);
|
||||
|
||||
|
|
@ -293,8 +290,7 @@ namespace graphene { namespace app {
|
|||
std::function<void(const variant &)> _on_pending_transaction;
|
||||
};
|
||||
|
||||
class crypto_api
|
||||
{
|
||||
class crypto_api {
|
||||
public:
|
||||
crypto_api();
|
||||
|
||||
|
|
@ -314,20 +310,17 @@ namespace graphene { namespace app {
|
|||
uint8_t min_bits,
|
||||
uint64_t actual_value);
|
||||
|
||||
|
||||
verify_range_proof_rewind_result verify_range_proof_rewind(const blind_factor_type &nonce,
|
||||
const fc::ecc::commitment_type &commit,
|
||||
const std::vector<char> &proof);
|
||||
|
||||
|
||||
range_proof_info range_get_info(const std::vector<char> &proof);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
class asset_api
|
||||
{
|
||||
class asset_api {
|
||||
public:
|
||||
asset_api(graphene::app::application &app);
|
||||
~asset_api();
|
||||
|
|
@ -354,12 +347,14 @@ namespace graphene { namespace app {
|
|||
*/
|
||||
vector<asset_holders> get_all_asset_holders() const;
|
||||
|
||||
uint32_t api_limit_get_asset_holders = 100;
|
||||
|
||||
private:
|
||||
graphene::app::application &_app;
|
||||
graphene::chain::database &_db;
|
||||
graphene::app::database_api database_api;
|
||||
};
|
||||
} } // graphene::app
|
||||
}} // namespace graphene::app
|
||||
|
||||
extern template class fc::api<graphene::app::block_api>;
|
||||
extern template class fc::api<graphene::app::network_broadcast_api>;
|
||||
|
|
@ -375,8 +370,7 @@ namespace graphene { namespace app {
|
|||
*
|
||||
* All other APIs must be requested from this API.
|
||||
*/
|
||||
class login_api
|
||||
{
|
||||
class login_api {
|
||||
public:
|
||||
login_api(application &a);
|
||||
~login_api();
|
||||
|
|
@ -414,8 +408,8 @@ namespace graphene { namespace app {
|
|||
|
||||
/// @brief Called to enable an API, not reflected.
|
||||
void enable_api(const string &api_name);
|
||||
private:
|
||||
|
||||
private:
|
||||
application &_app;
|
||||
optional<fc::api<block_api>> _block_api;
|
||||
optional<fc::api<database_api>> _database_api;
|
||||
|
|
@ -429,21 +423,26 @@ namespace graphene { namespace app {
|
|||
optional<fc::api<graphene::affiliate_stats::affiliate_stats_api>> _affiliate_stats_api;
|
||||
};
|
||||
|
||||
}} // graphene::app
|
||||
}} // namespace graphene::app
|
||||
|
||||
extern template class fc::api<graphene::app::login_api>;
|
||||
|
||||
// clang-format off
|
||||
|
||||
FC_REFLECT(graphene::app::network_broadcast_api::transaction_confirmation,
|
||||
(id)(block_num)(trx_num)(trx))
|
||||
|
||||
FC_REFLECT(graphene::app::verify_range_result,
|
||||
(success)(min_val)(max_val))
|
||||
|
||||
FC_REFLECT(graphene::app::verify_range_proof_rewind_result,
|
||||
(success)(min_val)(max_val)(value_out)(blind_out)(message_out))
|
||||
//FC_REFLECT_TYPENAME( fc::ecc::compact_signature );
|
||||
//FC_REFLECT_TYPENAME( fc::ecc::commitment_type );
|
||||
|
||||
FC_REFLECT( graphene::app::account_asset_balance, (name)(account_id)(amount) );
|
||||
FC_REFLECT( graphene::app::asset_holders, (asset_id)(count) );
|
||||
FC_REFLECT(graphene::app::account_asset_balance,
|
||||
(name)(account_id)(amount));
|
||||
|
||||
FC_REFLECT(graphene::app::asset_holders,
|
||||
(asset_id)(count));
|
||||
|
||||
FC_API(graphene::app::history_api,
|
||||
(get_account_history)
|
||||
|
|
@ -452,17 +451,17 @@ FC_API(graphene::app::history_api,
|
|||
(get_fill_order_history)
|
||||
(get_market_history)
|
||||
(get_market_history_buckets)
|
||||
(list_core_accounts)
|
||||
)
|
||||
(list_core_accounts))
|
||||
|
||||
FC_API(graphene::app::block_api,
|
||||
(get_blocks)
|
||||
)
|
||||
(get_blocks))
|
||||
|
||||
FC_API(graphene::app::network_broadcast_api,
|
||||
(broadcast_transaction)
|
||||
(broadcast_transaction_with_callback)
|
||||
(broadcast_transaction_synchronous)
|
||||
(broadcast_block)
|
||||
)
|
||||
(broadcast_block))
|
||||
|
||||
FC_API(graphene::app::network_node_api,
|
||||
(get_info)
|
||||
(add_node)
|
||||
|
|
@ -472,8 +471,8 @@ FC_API(graphene::app::network_node_api,
|
|||
(set_advanced_node_parameters)
|
||||
(list_pending_transactions)
|
||||
(subscribe_to_pending_transactions)
|
||||
(unsubscribe_from_pending_transactions)
|
||||
)
|
||||
(unsubscribe_from_pending_transactions))
|
||||
|
||||
FC_API(graphene::app::crypto_api,
|
||||
(blind)
|
||||
(blind_sum)
|
||||
|
|
@ -481,13 +480,13 @@ FC_API(graphene::app::crypto_api,
|
|||
(verify_range)
|
||||
(range_proof_sign)
|
||||
(verify_range_proof_rewind)
|
||||
(range_get_info)
|
||||
)
|
||||
(range_get_info))
|
||||
|
||||
FC_API(graphene::app::asset_api,
|
||||
(get_asset_holders)
|
||||
(get_asset_holders_count)
|
||||
(get_all_asset_holders)
|
||||
)
|
||||
(get_all_asset_holders))
|
||||
|
||||
FC_API(graphene::app::login_api,
|
||||
(login)
|
||||
(block)
|
||||
|
|
@ -499,5 +498,6 @@ FC_API(graphene::app::login_api,
|
|||
(asset)
|
||||
(debug)
|
||||
(bookie)
|
||||
(affiliate_stats)
|
||||
)
|
||||
(affiliate_stats))
|
||||
|
||||
// clang-format on
|
||||
|
|
|
|||
|
|
@ -31,26 +31,26 @@
|
|||
|
||||
namespace graphene { namespace app {
|
||||
|
||||
struct api_access_info
|
||||
{
|
||||
struct api_access_info {
|
||||
std::string password_hash_b64;
|
||||
std::string password_salt_b64;
|
||||
std::vector<std::string> allowed_apis;
|
||||
};
|
||||
|
||||
struct api_access
|
||||
{
|
||||
struct api_access {
|
||||
std::map<std::string, api_access_info> permission_map;
|
||||
};
|
||||
|
||||
} } // graphene::app
|
||||
}} // namespace graphene::app
|
||||
|
||||
// clang-format off
|
||||
|
||||
FC_REFLECT( graphene::app::api_access_info,
|
||||
(password_hash_b64)
|
||||
(password_salt_b64)
|
||||
(allowed_apis)
|
||||
)
|
||||
(allowed_apis))
|
||||
|
||||
FC_REFLECT( graphene::app::api_access,
|
||||
(permission_map)
|
||||
)
|
||||
(permission_map))
|
||||
|
||||
// clang-format on
|
||||
|
|
|
|||
|
|
@ -24,25 +24,26 @@
|
|||
#pragma once
|
||||
|
||||
#include <graphene/app/api_access.hpp>
|
||||
#include <graphene/net/node.hpp>
|
||||
#include <graphene/chain/database.hpp>
|
||||
#include <graphene/net/node.hpp>
|
||||
|
||||
#include <boost/program_options.hpp>
|
||||
|
||||
namespace graphene { namespace app {
|
||||
namespace detail { class application_impl; }
|
||||
namespace detail {
|
||||
class application_impl;
|
||||
}
|
||||
using std::string;
|
||||
|
||||
class abstract_plugin;
|
||||
|
||||
class application
|
||||
{
|
||||
class application {
|
||||
public:
|
||||
application();
|
||||
~application();
|
||||
|
||||
void set_program_options( boost::program_options::options_description& command_line_options,
|
||||
boost::program_options::options_description& configuration_file_options )const;
|
||||
void set_program_options(boost::program_options::options_description &cli,
|
||||
boost::program_options::options_description &cfg) const;
|
||||
void initialize(const fc::path &data_dir, const boost::program_options::variables_map &options);
|
||||
void initialize_plugins(const boost::program_options::variables_map &options);
|
||||
void startup();
|
||||
|
|
@ -51,19 +52,16 @@ namespace graphene { namespace app {
|
|||
void shutdown_plugins();
|
||||
|
||||
template <typename PluginType>
|
||||
std::shared_ptr<PluginType> register_plugin()
|
||||
{
|
||||
std::shared_ptr<PluginType> register_plugin() {
|
||||
auto plug = std::make_shared<PluginType>();
|
||||
plug->plugin_set_app(this);
|
||||
|
||||
boost::program_options::options_description plugin_cli_options(plug->plugin_name() + " plugin. " + plug->plugin_description() + "\nOptions"), plugin_cfg_options;
|
||||
//boost::program_options::options_description plugin_cli_options("Options for plugin " + plug->plugin_name()), plugin_cfg_options;
|
||||
plug->plugin_set_program_options(plugin_cli_options, plugin_cfg_options);
|
||||
if (!plugin_cli_options.options().empty())
|
||||
_cli_options.add(plugin_cli_options);
|
||||
|
||||
if( !plugin_cfg_options.options().empty() )
|
||||
{
|
||||
if (!plugin_cfg_options.options().empty()) {
|
||||
std::string header_name = "plugin-cfg-header-" + plug->plugin_name();
|
||||
std::string header_desc = plug->plugin_name() + " plugin options";
|
||||
_cfg_options.add_options()(header_name.c_str(), header_desc.c_str());
|
||||
|
|
@ -76,8 +74,7 @@ namespace graphene { namespace app {
|
|||
std::shared_ptr<abstract_plugin> get_plugin(const string &name) const;
|
||||
|
||||
template <typename PluginType>
|
||||
std::shared_ptr<PluginType> get_plugin( const string& name ) const
|
||||
{
|
||||
std::shared_ptr<PluginType> get_plugin(const string &name) const {
|
||||
std::shared_ptr<abstract_plugin> abs_plugin = get_plugin(name);
|
||||
std::shared_ptr<PluginType> result = std::dynamic_pointer_cast<PluginType>(abs_plugin);
|
||||
FC_ASSERT(result != std::shared_ptr<PluginType>());
|
||||
|
|
@ -109,4 +106,4 @@ namespace graphene { namespace app {
|
|||
boost::program_options::options_description _cfg_options;
|
||||
};
|
||||
|
||||
} }
|
||||
}} // namespace graphene::app
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include <fc/filesystem.hpp>
|
||||
#include <boost/program_options.hpp>
|
||||
#include <fc/filesystem.hpp>
|
||||
|
||||
namespace graphene { namespace app {
|
||||
|
||||
void load_configuration_options(const fc::path &data_dir, const boost::program_options::options_description &cfg_options,
|
||||
boost::program_options::variables_map &options);
|
||||
|
||||
} } // graphene::app
|
||||
}} // namespace graphene::app
|
||||
|
|
|
|||
|
|
@ -32,30 +32,30 @@
|
|||
#include <graphene/chain/account_object.hpp>
|
||||
#include <graphene/chain/asset_object.hpp>
|
||||
#include <graphene/chain/balance_object.hpp>
|
||||
#include <graphene/chain/betting_market_object.hpp>
|
||||
#include <graphene/chain/chain_property_object.hpp>
|
||||
#include <graphene/chain/committee_member_object.hpp>
|
||||
#include <graphene/chain/confidential_object.hpp>
|
||||
#include <graphene/chain/event_group_object.hpp>
|
||||
#include <graphene/chain/event_object.hpp>
|
||||
#include <graphene/chain/global_betting_statistics_object.hpp>
|
||||
#include <graphene/chain/market_object.hpp>
|
||||
#include <graphene/chain/operation_history_object.hpp>
|
||||
#include <graphene/chain/proposal_object.hpp>
|
||||
#include <graphene/chain/sport_object.hpp>
|
||||
#include <graphene/chain/event_group_object.hpp>
|
||||
#include <graphene/chain/event_object.hpp>
|
||||
#include <graphene/chain/betting_market_object.hpp>
|
||||
#include <graphene/chain/global_betting_statistics_object.hpp>
|
||||
#include <graphene/chain/sidechain_address_object.hpp>
|
||||
#include <graphene/chain/son_object.hpp>
|
||||
#include <graphene/chain/son_wallet_object.hpp>
|
||||
#include <graphene/chain/sidechain_address_object.hpp>
|
||||
#include <graphene/chain/sport_object.hpp>
|
||||
|
||||
#include <graphene/chain/worker_object.hpp>
|
||||
#include <graphene/chain/witness_object.hpp>
|
||||
#include <graphene/chain/tournament_object.hpp>
|
||||
#include <graphene/chain/witness_object.hpp>
|
||||
#include <graphene/chain/worker_object.hpp>
|
||||
|
||||
#include <graphene/chain/custom_permission_object.hpp>
|
||||
#include <graphene/chain/account_role_object.hpp>
|
||||
#include <graphene/chain/custom_account_authority_object.hpp>
|
||||
#include <graphene/chain/custom_permission_object.hpp>
|
||||
#include <graphene/chain/nft_object.hpp>
|
||||
#include <graphene/chain/offer_object.hpp>
|
||||
#include <graphene/chain/account_role_object.hpp>
|
||||
|
||||
#include <graphene/market_history/market_history_plugin.hpp>
|
||||
|
||||
|
|
@ -80,23 +80,20 @@ using namespace std;
|
|||
|
||||
class database_api_impl;
|
||||
|
||||
struct order
|
||||
{
|
||||
struct order {
|
||||
double price;
|
||||
double quote;
|
||||
double base;
|
||||
};
|
||||
|
||||
struct order_book
|
||||
{
|
||||
struct order_book {
|
||||
string base;
|
||||
string quote;
|
||||
vector<order> bids;
|
||||
vector<order> asks;
|
||||
};
|
||||
|
||||
struct market_ticker
|
||||
{
|
||||
struct market_ticker {
|
||||
string base;
|
||||
string quote;
|
||||
double latest;
|
||||
|
|
@ -107,16 +104,14 @@ struct market_ticker
|
|||
double quote_volume;
|
||||
};
|
||||
|
||||
struct market_volume
|
||||
{
|
||||
struct market_volume {
|
||||
string base;
|
||||
string quote;
|
||||
double base_volume;
|
||||
double quote_volume;
|
||||
};
|
||||
|
||||
struct market_trade
|
||||
{
|
||||
struct market_trade {
|
||||
fc::time_point_sec date;
|
||||
double price;
|
||||
double amount;
|
||||
|
|
@ -140,8 +135,7 @@ struct gpos_info {
|
|||
* read-only; all modifications to the database must be performed via transactions. Transactions are broadcast via
|
||||
* the @ref network_broadcast_api.
|
||||
*/
|
||||
class database_api
|
||||
{
|
||||
class database_api {
|
||||
public:
|
||||
database_api(graphene::chain::database &db);
|
||||
~database_api();
|
||||
|
|
@ -191,7 +185,6 @@ class database_api
|
|||
*/
|
||||
map<uint32_t, optional<block_header>> get_block_header_batch(const vector<uint32_t> block_nums) const;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Retrieve a full, signed block
|
||||
* @param block_num Height of the block to be returned
|
||||
|
|
@ -413,7 +406,6 @@ class database_api
|
|||
*/
|
||||
asset get_lottery_balance(asset_id_type lottery_id) const;
|
||||
|
||||
|
||||
/////////////////////
|
||||
// Peerplays //
|
||||
/////////////////////
|
||||
|
|
@ -548,8 +540,6 @@ class database_api
|
|||
*/
|
||||
vector<market_trade> get_trade_history(const string &base, const string "e, fc::time_point_sec start, fc::time_point_sec stop, unsigned limit = 100) const;
|
||||
|
||||
|
||||
|
||||
///////////////
|
||||
// Witnesses //
|
||||
///////////////
|
||||
|
|
@ -717,7 +707,6 @@ class database_api
|
|||
*/
|
||||
vector<worker_object> get_workers_by_account(const std::string account_id_or_name) const;
|
||||
|
||||
|
||||
///////////
|
||||
// Votes //
|
||||
///////////
|
||||
|
|
@ -947,10 +936,12 @@ class database_api
|
|||
std::shared_ptr<database_api_impl> my;
|
||||
};
|
||||
|
||||
} }
|
||||
}} // namespace graphene::app
|
||||
|
||||
extern template class fc::api<graphene::app::database_api>;
|
||||
|
||||
// clang-format off
|
||||
|
||||
FC_REFLECT(graphene::app::order, (price)(quote)(base));
|
||||
FC_REFLECT(graphene::app::order_book, (base)(quote)(bids)(asks));
|
||||
FC_REFLECT(graphene::app::market_ticker, (base)(quote)(latest)(lowest_ask)(highest_bid)(percent_change)(base_volume)(quote_volume));
|
||||
|
|
@ -958,7 +949,6 @@ FC_REFLECT( graphene::app::market_volume, (base)(quote)(base_volume)(quote_volum
|
|||
FC_REFLECT(graphene::app::market_trade, (date)(price)(amount)(value));
|
||||
FC_REFLECT(graphene::app::gpos_info, (vesting_factor)(award)(total_amount)(current_subperiod)(last_voted_time)(allowed_withdraw_amount)(account_vested_balance));
|
||||
|
||||
|
||||
FC_API(graphene::app::database_api,
|
||||
// Objects
|
||||
(get_objects)
|
||||
|
|
@ -1136,3 +1126,5 @@ FC_API(graphene::app::database_api,
|
|||
// Account Roles
|
||||
(get_account_roles_by_owner)
|
||||
)
|
||||
|
||||
// clang-format on
|
||||
|
|
|
|||
|
|
@ -24,15 +24,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <graphene/chain/account_object.hpp>
|
||||
#include <graphene/chain/vesting_balance_object.hpp>
|
||||
#include <graphene/chain/market_evaluator.hpp>
|
||||
#include <graphene/chain/vesting_balance_object.hpp>
|
||||
#include <graphene/chain/withdraw_permission_object.hpp>
|
||||
|
||||
namespace graphene { namespace app {
|
||||
using namespace graphene::chain;
|
||||
|
||||
struct full_account
|
||||
{
|
||||
struct full_account {
|
||||
account_object account;
|
||||
account_statistics_object statistics;
|
||||
string registrar_name;
|
||||
|
|
@ -52,7 +51,9 @@ namespace graphene { namespace app {
|
|||
vector<pending_dividend_payout_balance_for_holder_object> pending_dividend_payments;
|
||||
};
|
||||
|
||||
} }
|
||||
}} // namespace graphene::app
|
||||
|
||||
// clang-format off
|
||||
|
||||
FC_REFLECT(graphene::app::full_account,
|
||||
(account)
|
||||
|
|
@ -70,5 +71,6 @@ FC_REFLECT( graphene::app::full_account,
|
|||
(proposals)
|
||||
(assets)
|
||||
(withdraws)
|
||||
(pending_dividend_payments)
|
||||
)
|
||||
(pending_dividend_payments))
|
||||
|
||||
// clang-format on
|
||||
|
|
|
|||
|
|
@ -30,10 +30,10 @@
|
|||
|
||||
namespace graphene { namespace app {
|
||||
|
||||
class abstract_plugin
|
||||
{
|
||||
class abstract_plugin {
|
||||
public:
|
||||
virtual ~abstract_plugin(){}
|
||||
virtual ~abstract_plugin() {
|
||||
}
|
||||
virtual std::string plugin_name() const = 0;
|
||||
virtual std::string plugin_description() const = 0;
|
||||
|
||||
|
|
@ -84,18 +84,15 @@ class abstract_plugin
|
|||
* If a plugin does not need these options, it
|
||||
* may simply provide an empty implementation of this method.
|
||||
*/
|
||||
virtual void plugin_set_program_options(
|
||||
boost::program_options::options_description& command_line_options,
|
||||
boost::program_options::options_description& config_file_options
|
||||
) = 0;
|
||||
virtual void plugin_set_program_options(boost::program_options::options_description &command_line_options,
|
||||
boost::program_options::options_description &config_file_options) = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Provides basic default implementations of abstract_plugin functions.
|
||||
*/
|
||||
|
||||
class plugin : public abstract_plugin
|
||||
{
|
||||
class plugin : public abstract_plugin {
|
||||
public:
|
||||
plugin();
|
||||
virtual ~plugin() override;
|
||||
|
|
@ -106,15 +103,21 @@ class plugin : public abstract_plugin
|
|||
virtual void plugin_startup() override;
|
||||
virtual void plugin_shutdown() override;
|
||||
virtual void plugin_set_app(application *app) override;
|
||||
virtual void plugin_set_program_options(
|
||||
boost::program_options::options_description& command_line_options,
|
||||
boost::program_options::options_description& config_file_options
|
||||
) override;
|
||||
virtual void plugin_set_program_options(boost::program_options::options_description &command_line_options,
|
||||
boost::program_options::options_description &config_file_options) override;
|
||||
|
||||
chain::database &database() {
|
||||
return *app().chain_database();
|
||||
}
|
||||
application &app() const {
|
||||
assert(_app);
|
||||
return *_app;
|
||||
}
|
||||
|
||||
chain::database& database() { return *app().chain_database(); }
|
||||
application& app()const { assert(_app); return *_app; }
|
||||
protected:
|
||||
net::node& p2p_node() { return *app().p2p_node(); }
|
||||
net::node &p2p_node() {
|
||||
return *app().p2p_node();
|
||||
}
|
||||
|
||||
private:
|
||||
application *_app = nullptr;
|
||||
|
|
@ -123,18 +126,16 @@ class plugin : public abstract_plugin
|
|||
/// @group Some useful tools for boost::program_options arguments using vectors of JSON strings
|
||||
/// @{
|
||||
template <typename T>
|
||||
T dejsonify(const string& s, uint32_t max_depth)
|
||||
{
|
||||
T dejsonify(const string &s, uint32_t max_depth) {
|
||||
return fc::json::from_string(s).as<T>(max_depth);
|
||||
}
|
||||
|
||||
namespace impl {
|
||||
template <typename T>
|
||||
T dejsonify( const string& s )
|
||||
{
|
||||
T dejsonify(const string &s) {
|
||||
return graphene::app::dejsonify<T>(s, GRAPHENE_MAX_NESTED_OBJECTS);
|
||||
}
|
||||
}
|
||||
} // namespace impl
|
||||
|
||||
#define DEFAULT_VALUE_VECTOR(value) default_value({fc::json::to_string(value)}, fc::json::to_string(value))
|
||||
#define LOAD_VALUE_SET(options, name, container, type) \
|
||||
|
|
@ -144,4 +145,4 @@ if( options.count(name) ) { \
|
|||
}
|
||||
/// @}
|
||||
|
||||
} } //graphene::app
|
||||
}} // namespace graphene::app
|
||||
|
|
|
|||
|
|
@ -27,54 +27,44 @@
|
|||
|
||||
namespace graphene { namespace app {
|
||||
|
||||
plugin::plugin()
|
||||
{
|
||||
plugin::plugin() {
|
||||
_app = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
plugin::~plugin()
|
||||
{
|
||||
plugin::~plugin() {
|
||||
return;
|
||||
}
|
||||
|
||||
std::string plugin::plugin_name()const
|
||||
{
|
||||
std::string plugin::plugin_name() const {
|
||||
return "<unknown plugin>";
|
||||
}
|
||||
|
||||
std::string plugin::plugin_description()const
|
||||
{
|
||||
std::string plugin::plugin_description() const {
|
||||
return "<no description>";
|
||||
}
|
||||
|
||||
void plugin::plugin_initialize( const boost::program_options::variables_map& options )
|
||||
{
|
||||
void plugin::plugin_initialize(const boost::program_options::variables_map &options) {
|
||||
return;
|
||||
}
|
||||
|
||||
void plugin::plugin_startup()
|
||||
{
|
||||
void plugin::plugin_startup() {
|
||||
return;
|
||||
}
|
||||
|
||||
void plugin::plugin_shutdown()
|
||||
{
|
||||
void plugin::plugin_shutdown() {
|
||||
return;
|
||||
}
|
||||
|
||||
void plugin::plugin_set_app( application* app )
|
||||
{
|
||||
void plugin::plugin_set_app(application *app) {
|
||||
_app = app;
|
||||
return;
|
||||
}
|
||||
|
||||
void plugin::plugin_set_program_options(
|
||||
boost::program_options::options_description& command_line_options,
|
||||
boost::program_options::options_description& config_file_options
|
||||
)
|
||||
{
|
||||
boost::program_options::options_description &cli,
|
||||
boost::program_options::options_description &cfg) {
|
||||
return;
|
||||
}
|
||||
|
||||
} } // graphene::app
|
||||
}} // namespace graphene::app
|
||||
|
|
|
|||
|
|
@ -8,143 +8,29 @@ add_dependencies( build_hardfork_hpp cat-parts )
|
|||
file(GLOB HEADERS "include/graphene/chain/*.hpp")
|
||||
file(GLOB PROTOCOL_HEADERS "include/graphene/chain/protocol/*.hpp")
|
||||
|
||||
if( GRAPHENE_DISABLE_UNITY_BUILD )
|
||||
set( GRAPHENE_DB_FILES
|
||||
db_balance.cpp
|
||||
db_bet.cpp
|
||||
db_block.cpp
|
||||
db_debug.cpp
|
||||
db_getter.cpp
|
||||
db_init.cpp
|
||||
db_maint.cpp
|
||||
db_management.cpp
|
||||
db_market.cpp
|
||||
db_update.cpp
|
||||
db_witness_schedule.cpp
|
||||
)
|
||||
file(GLOB CPP_FILES "*.cpp")
|
||||
file(GLOB PROTOCOL_CPP_FILES "protocol/*.cpp")
|
||||
|
||||
#if( GRAPHENE_DISABLE_UNITY_BUILD )
|
||||
list(FILTER CPP_FILES EXCLUDE REGEX "[/]database[.]cpp$")
|
||||
#message ("--- ${CPP_FILES}")
|
||||
message( STATUS "Graphene database unity build disabled" )
|
||||
else( GRAPHENE_DISABLE_UNITY_BUILD )
|
||||
set( GRAPHENE_DB_FILES
|
||||
database.cpp )
|
||||
message( STATUS "Graphene database unity build enabled" )
|
||||
endif( GRAPHENE_DISABLE_UNITY_BUILD )
|
||||
#else( GRAPHENE_DISABLE_UNITY_BUILD )
|
||||
# list(FILTER CPP_FILES EXCLUDE REGEX ".*db_.*[.]cpp$")
|
||||
# #message ("--- ${CPP_FILES}")
|
||||
# message( STATUS "Graphene database unity build enabled" )
|
||||
#endif( GRAPHENE_DISABLE_UNITY_BUILD )
|
||||
|
||||
## SORT .cpp by most likely to change / break compile
|
||||
add_library( graphene_chain
|
||||
|
||||
# As database takes the longest to compile, start it first
|
||||
${GRAPHENE_DB_FILES}
|
||||
fork_database.cpp
|
||||
|
||||
protocol/types.cpp
|
||||
protocol/address.cpp
|
||||
protocol/authority.cpp
|
||||
protocol/asset.cpp
|
||||
protocol/assert.cpp
|
||||
protocol/account.cpp
|
||||
protocol/transfer.cpp
|
||||
protocol/chain_parameters.cpp
|
||||
protocol/committee_member.cpp
|
||||
protocol/witness.cpp
|
||||
protocol/market.cpp
|
||||
protocol/proposal.cpp
|
||||
protocol/withdraw_permission.cpp
|
||||
protocol/asset_ops.cpp
|
||||
protocol/lottery_ops.cpp
|
||||
protocol/memo.cpp
|
||||
protocol/worker.cpp
|
||||
protocol/custom.cpp
|
||||
protocol/operations.cpp
|
||||
protocol/transaction.cpp
|
||||
protocol/block.cpp
|
||||
protocol/fee_schedule.cpp
|
||||
protocol/confidential.cpp
|
||||
protocol/vote.cpp
|
||||
protocol/tournament.cpp
|
||||
protocol/small_ops.cpp
|
||||
protocol/custom_permission.cpp
|
||||
protocol/custom_account_authority.cpp
|
||||
protocol/offer.cpp
|
||||
|
||||
genesis_state.cpp
|
||||
get_config.cpp
|
||||
|
||||
pts_address.cpp
|
||||
|
||||
evaluator.cpp
|
||||
balance_evaluator.cpp
|
||||
account_evaluator.cpp
|
||||
assert_evaluator.cpp
|
||||
witness_evaluator.cpp
|
||||
committee_member_evaluator.cpp
|
||||
asset_evaluator.cpp
|
||||
lottery_evaluator.cpp
|
||||
transfer_evaluator.cpp
|
||||
proposal_evaluator.cpp
|
||||
market_evaluator.cpp
|
||||
vesting_balance_evaluator.cpp
|
||||
tournament_evaluator.cpp
|
||||
tournament_object.cpp
|
||||
match_object.cpp
|
||||
game_object.cpp
|
||||
withdraw_permission_evaluator.cpp
|
||||
worker_evaluator.cpp
|
||||
confidential_evaluator.cpp
|
||||
special_authority.cpp
|
||||
buyback.cpp
|
||||
|
||||
account_object.cpp
|
||||
asset_object.cpp
|
||||
fba_object.cpp
|
||||
proposal_object.cpp
|
||||
vesting_balance_object.cpp
|
||||
small_objects.cpp
|
||||
|
||||
block_database.cpp
|
||||
|
||||
is_authorized_asset.cpp
|
||||
|
||||
protocol/sport.cpp
|
||||
sport_evaluator.cpp
|
||||
protocol/event_group.cpp
|
||||
event_group_evaluator.cpp
|
||||
event_group_object.cpp
|
||||
protocol/event.cpp
|
||||
event_evaluator.cpp
|
||||
event_object.cpp
|
||||
protocol/betting_market.cpp
|
||||
betting_market_evaluator.cpp
|
||||
betting_market_object.cpp
|
||||
betting_market_group_object.cpp
|
||||
custom_permission_evaluator.cpp
|
||||
custom_account_authority_evaluator.cpp
|
||||
|
||||
affiliate_payout.cpp
|
||||
|
||||
offer_object.cpp
|
||||
offer_evaluator.cpp
|
||||
nft_evaluator.cpp
|
||||
protocol/nft.cpp
|
||||
protocol/account_role.cpp
|
||||
account_role_evaluator.cpp
|
||||
|
||||
son_evaluator.cpp
|
||||
son_object.cpp
|
||||
|
||||
son_wallet_evaluator.cpp
|
||||
son_wallet_deposit_evaluator.cpp
|
||||
son_wallet_withdraw_evaluator.cpp
|
||||
|
||||
sidechain_address_evaluator.cpp
|
||||
sidechain_transaction_evaluator.cpp
|
||||
|
||||
${CPP_FILES}
|
||||
${PROTOCOL_CPP_FILES}
|
||||
${HEADERS}
|
||||
${PROTOCOL_HEADERS}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/include/graphene/chain/hardfork.hpp"
|
||||
)
|
||||
|
||||
add_dependencies( graphene_chain build_hardfork_hpp )
|
||||
target_link_libraries( graphene_chain fc graphene_db )
|
||||
target_link_libraries( graphene_chain graphene_db )
|
||||
target_include_directories( graphene_chain
|
||||
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_BINARY_DIR}/include" )
|
||||
|
||||
|
|
|
|||
|
|
@ -597,7 +597,6 @@ void_result asset_update_dividend_evaluator::do_apply( const asset_update_divide
|
|||
obj.referrer = op.issuer;
|
||||
obj.lifetime_referrer = op.issuer(db()).lifetime_referrer;
|
||||
|
||||
auto& params = db().get_global_properties().parameters;
|
||||
obj.network_fee_percentage = GRAPHENE_DEFAULT_NETWORK_PERCENT_OF_FEE;
|
||||
obj.lifetime_referrer_fee_percentage = GRAPHENE_DEFAULT_LIFETIME_REFERRER_PERCENT_OF_FEE;
|
||||
obj.referrer_rewards_percentage = GRAPHENE_DEFAULT_LIFETIME_REFERRER_PERCENT_OF_FEE;
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ map< account_id_type, vector< uint16_t > > asset_object::distribute_winners_part
|
|||
*t += percents_to_distribute / holders.size();
|
||||
}
|
||||
auto sweeps_distribution_percentage = db.get_global_properties().parameters.sweeps_distribution_percentage();
|
||||
for( int c = 0; c < winner_numbers.size(); ++c ) {
|
||||
for( size_t c = 0; c < winner_numbers.size(); ++c ) {
|
||||
auto winner_num = winner_numbers[c];
|
||||
lottery_reward_operation reward_op;
|
||||
reward_op.lottery = get_id();
|
||||
|
|
|
|||
|
|
@ -76,6 +76,10 @@ void block_database::flush()
|
|||
|
||||
void block_database::store( const block_id_type& _id, const signed_block& b )
|
||||
{
|
||||
if (true == replay_mode){
|
||||
return;
|
||||
}
|
||||
|
||||
block_id_type id = _id;
|
||||
if( id == block_id_type() )
|
||||
{
|
||||
|
|
@ -271,4 +275,9 @@ optional<block_id_type> block_database::last_id()const
|
|||
return optional<block_id_type>();
|
||||
}
|
||||
|
||||
void block_database::set_replay_mode(bool mode)
|
||||
{
|
||||
replay_mode = mode;
|
||||
}
|
||||
|
||||
} }
|
||||
|
|
|
|||
|
|
@ -30,6 +30,6 @@
|
|||
#include "db_maint.cpp"
|
||||
#include "db_management.cpp"
|
||||
#include "db_market.cpp"
|
||||
#include "db_notify.cpp"
|
||||
#include "db_update.cpp"
|
||||
#include "db_witness_schedule.cpp"
|
||||
#include "db_notify.cpp"
|
||||
|
|
@ -140,8 +140,10 @@ void database::adjust_sweeps_vesting_balance(account_id_type account, int64_t de
|
|||
b.balance = delta;
|
||||
});
|
||||
} else {
|
||||
if( delta < 0 )
|
||||
FC_ASSERT( itr->get_balance() >= -delta, "Insufficient Balance: ${a}'s balance of ${b} is less than required ${r}", ("a",account)("b",itr->get_balance())("r",-delta));
|
||||
if( delta < 0 ) {
|
||||
uint64_t delta_uint64 = -delta;
|
||||
FC_ASSERT( itr->get_balance() >= delta_uint64, "Insufficient Balance: ${a}'s balance of ${b} is less than required ${r}", ("a",account)("b",itr->get_balance())("r",-delta));
|
||||
}
|
||||
modify(*itr, [&delta,&asset_id,this](sweeps_vesting_balance_object& b) {
|
||||
b.adjust_balance( asset( delta, asset_id ) );
|
||||
b.last_claim_date = head_block_time();
|
||||
|
|
|
|||
|
|
@ -303,8 +303,6 @@ void database::settle_betting_market_group(const betting_market_group_object& be
|
|||
remove(betting_market);
|
||||
}
|
||||
|
||||
const event_object& event = betting_market_group.event_id(*this);
|
||||
|
||||
fc_dlog(fc::logger::get("betting"), "removing betting market group ${id}", ("id", betting_market_group.id));
|
||||
remove(betting_market_group);
|
||||
|
||||
|
|
@ -537,11 +535,9 @@ int match_bet(database& db, const bet_object& taker_bet, const bet_object& maker
|
|||
// because we matched at the maker's odds and not the taker's odds, the remaining amount to match
|
||||
// may not be an even multiple of the taker's odds; round it down.
|
||||
share_type taker_remaining_factor = unrounded_taker_remaining_amount_to_match / takers_odds_maker_odds_ratio;
|
||||
share_type taker_remaining_maker_amount_to_match = taker_remaining_factor * takers_odds_maker_odds_ratio;
|
||||
share_type taker_remaining_bet_amount = taker_remaining_factor * takers_odds_taker_odds_ratio;
|
||||
|
||||
taker_refund_amount = taker_bet.amount_to_bet.amount - taker_amount_to_match - taker_remaining_bet_amount;
|
||||
//idump((taker_remaining_factor)(taker_remaining_maker_amount_to_match)(taker_remaining_bet_amount)(taker_refund_amount));
|
||||
}
|
||||
|
||||
if (taker_refund_amount > share_type())
|
||||
|
|
|
|||
|
|
@ -715,6 +715,7 @@ void database::_apply_block( const signed_block& next_block )
|
|||
perform_chain_maintenance(next_block, global_props);
|
||||
|
||||
check_ending_lotteries();
|
||||
check_ending_nft_lotteries();
|
||||
|
||||
create_block_summary(next_block);
|
||||
place_delayed_bets(); // must happen after update_global_dynamic_data() updates the time
|
||||
|
|
|
|||
|
|
@ -315,6 +315,38 @@ bool database::is_son_active( son_id_type son_id )
|
|||
return (it_son != active_son_ids.end());
|
||||
}
|
||||
|
||||
vector<uint64_t> database::get_random_numbers(uint64_t minimum, uint64_t maximum, uint64_t selections, bool duplicates)
|
||||
{
|
||||
FC_ASSERT( selections <= 100000 );
|
||||
if (duplicates == false) {
|
||||
FC_ASSERT( maximum - minimum >= selections );
|
||||
}
|
||||
|
||||
vector<uint64_t> v;
|
||||
v.reserve(selections);
|
||||
|
||||
if (duplicates) {
|
||||
for (uint64_t i = 0; i < selections; i++) {
|
||||
int64_t rnd = get_random_bits(maximum - minimum) + minimum;
|
||||
v.push_back(rnd);
|
||||
}
|
||||
} else {
|
||||
vector<uint64_t> tmpv;
|
||||
tmpv.reserve(selections);
|
||||
for (uint64_t i = minimum; i < maximum; i++) {
|
||||
tmpv.push_back(i);
|
||||
}
|
||||
|
||||
for (uint64_t i = 0; (i < selections) && (tmpv.size() > 0); i++) {
|
||||
uint64_t idx = get_random_bits(tmpv.size());
|
||||
v.push_back(tmpv.at(idx));
|
||||
tmpv.erase(tmpv.begin() + idx);
|
||||
}
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
bool database::is_asset_creation_allowed(const string &symbol)
|
||||
{
|
||||
time_point_sec now = head_block_time();
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@
|
|||
#include <graphene/chain/custom_account_authority_object.hpp>
|
||||
#include <graphene/chain/offer_object.hpp>
|
||||
#include <graphene/chain/account_role_object.hpp>
|
||||
#include <graphene/chain/random_number_object.hpp>
|
||||
|
||||
#include <graphene/chain/nft_object.hpp>
|
||||
|
||||
|
|
@ -94,12 +95,14 @@
|
|||
#include <graphene/chain/offer_evaluator.hpp>
|
||||
#include <graphene/chain/nft_evaluator.hpp>
|
||||
#include <graphene/chain/account_role_evaluator.hpp>
|
||||
#include <graphene/chain/nft_lottery_evaluator.hpp>
|
||||
#include <graphene/chain/son_evaluator.hpp>
|
||||
#include <graphene/chain/son_wallet_evaluator.hpp>
|
||||
#include <graphene/chain/son_wallet_deposit_evaluator.hpp>
|
||||
#include <graphene/chain/son_wallet_withdraw_evaluator.hpp>
|
||||
#include <graphene/chain/sidechain_address_evaluator.hpp>
|
||||
#include <graphene/chain/sidechain_transaction_evaluator.hpp>
|
||||
#include <graphene/chain/random_number_evaluator.hpp>
|
||||
|
||||
#include <graphene/chain/protocol/fee_schedule.hpp>
|
||||
|
||||
|
|
@ -203,6 +206,12 @@ const uint8_t offer_history_object::type_id;
|
|||
const uint8_t account_role_object::space_id;
|
||||
const uint8_t account_role_object::type_id;
|
||||
|
||||
const uint8_t nft_lottery_balance_object::space_id;
|
||||
const uint8_t nft_lottery_balance_object::type_id;
|
||||
|
||||
const uint8_t random_number_object::space_id;
|
||||
const uint8_t random_number_object::type_id;
|
||||
|
||||
void database::initialize_evaluators()
|
||||
{
|
||||
_operation_evaluators.resize(255);
|
||||
|
|
@ -295,6 +304,9 @@ void database::initialize_evaluators()
|
|||
register_evaluator<account_role_create_evaluator>();
|
||||
register_evaluator<account_role_update_evaluator>();
|
||||
register_evaluator<account_role_delete_evaluator>();
|
||||
register_evaluator<nft_lottery_token_purchase_evaluator>();
|
||||
register_evaluator<nft_lottery_reward_evaluator>();
|
||||
register_evaluator<nft_lottery_end_evaluator>();
|
||||
register_evaluator<create_son_evaluator>();
|
||||
register_evaluator<update_son_evaluator>();
|
||||
register_evaluator<deregister_son_evaluator>();
|
||||
|
|
@ -314,6 +326,7 @@ void database::initialize_evaluators()
|
|||
register_evaluator<sidechain_transaction_sign_evaluator>();
|
||||
register_evaluator<sidechain_transaction_send_evaluator>();
|
||||
register_evaluator<sidechain_transaction_settle_evaluator>();
|
||||
register_evaluator<random_number_store_evaluator>();
|
||||
}
|
||||
|
||||
void database::initialize_indexes()
|
||||
|
|
@ -403,7 +416,9 @@ void database::initialize_indexes()
|
|||
add_index< primary_index<lottery_balance_index > >();
|
||||
add_index< primary_index<sweeps_vesting_balance_index > >();
|
||||
add_index< primary_index<offer_history_index > >();
|
||||
add_index< primary_index<nft_lottery_balance_index > >();
|
||||
add_index< primary_index<son_stats_index > >();
|
||||
add_index< primary_index<random_number_index > >();
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -933,7 +948,6 @@ void database::init_genesis(const genesis_state_type& genesis_state)
|
|||
|
||||
const auto& idx = get_index_type<asset_index>().indices().get<by_symbol>();
|
||||
auto it = idx.begin();
|
||||
bool has_imbalanced_assets = false;
|
||||
|
||||
while( it != idx.end() )
|
||||
{
|
||||
|
|
@ -945,7 +959,6 @@ void database::init_genesis(const genesis_state_type& genesis_state)
|
|||
FC_ASSERT( debt_itr != total_debts.end() );
|
||||
if( supply_itr->second != debt_itr->second )
|
||||
{
|
||||
has_imbalanced_assets = true;
|
||||
elog( "Genesis for asset ${aname} is not balanced\n"
|
||||
" Debt is ${debt}\n"
|
||||
" Supply is ${supply}\n",
|
||||
|
|
@ -957,10 +970,6 @@ void database::init_genesis(const genesis_state_type& genesis_state)
|
|||
}
|
||||
++it;
|
||||
}
|
||||
// @romek
|
||||
#if 0
|
||||
FC_ASSERT( !has_imbalanced_assets );
|
||||
#endif
|
||||
|
||||
// Save tallied supplies
|
||||
for( const auto& item : total_supplies )
|
||||
|
|
|
|||
|
|
@ -32,24 +32,24 @@
|
|||
#include <graphene/chain/is_authorized_asset.hpp>
|
||||
|
||||
#include <graphene/chain/account_object.hpp>
|
||||
#include <graphene/chain/account_role_object.hpp>
|
||||
#include <graphene/chain/asset_object.hpp>
|
||||
#include <graphene/chain/budget_record_object.hpp>
|
||||
#include <graphene/chain/buyback_object.hpp>
|
||||
#include <graphene/chain/chain_property_object.hpp>
|
||||
#include <graphene/chain/committee_member_object.hpp>
|
||||
#include <graphene/chain/custom_account_authority_object.hpp>
|
||||
#include <graphene/chain/fba_object.hpp>
|
||||
#include <graphene/chain/global_property_object.hpp>
|
||||
#include <graphene/chain/market_object.hpp>
|
||||
#include <graphene/chain/special_authority_object.hpp>
|
||||
#include <graphene/chain/son_object.hpp>
|
||||
#include <graphene/chain/son_wallet_object.hpp>
|
||||
#include <graphene/chain/vesting_balance_object.hpp>
|
||||
#include <graphene/chain/vote_count.hpp>
|
||||
#include <graphene/chain/witness_object.hpp>
|
||||
#include <graphene/chain/witness_schedule_object.hpp>
|
||||
#include <graphene/chain/worker_object.hpp>
|
||||
#include <graphene/chain/custom_account_authority_object.hpp>
|
||||
|
||||
#define USE_VESTING_OBJECT_BY_ASSET_BALANCE_INDEX // vesting_balance_object by_asset_balance index needed
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ vector<std::reference_wrapper<const son_object>> database::sort_votable_objects<
|
|||
std::vector<std::reference_wrapper<const son_object>> refs;
|
||||
for( auto& son : all_sons )
|
||||
{
|
||||
if(son.has_valid_config() && son.status != son_status::deregistered)
|
||||
if(son.has_valid_config(head_block_time()) && son.status != son_status::deregistered)
|
||||
{
|
||||
refs.push_back(std::cref(son));
|
||||
}
|
||||
|
|
@ -210,20 +210,29 @@ void database::pay_sons()
|
|||
if( now < HARDFORK_SON2_TIME ) {
|
||||
son_weight = get_weight_before_son2_hf(_vote_tally_buffer[son_obj->vote_id]);
|
||||
}
|
||||
weighted_total_txs_signed += (s.txs_signed * son_weight);
|
||||
uint64_t txs_signed = 0;
|
||||
for (const auto &ts : s.txs_signed) {
|
||||
txs_signed = txs_signed + ts.second;
|
||||
}
|
||||
weighted_total_txs_signed += (txs_signed * son_weight);
|
||||
});
|
||||
|
||||
// Now pay off each SON proportional to the number of transactions signed.
|
||||
get_index_type<son_stats_index>().inspect_all_objects([this, &weighted_total_txs_signed, &dpo, &son_budget, &get_weight, &get_weight_before_son2_hf, &now](const object& o) {
|
||||
const son_statistics_object& s = static_cast<const son_statistics_object&>(o);
|
||||
if(s.txs_signed > 0){
|
||||
uint64_t txs_signed = 0;
|
||||
for (const auto &ts : s.txs_signed) {
|
||||
txs_signed = txs_signed + ts.second;
|
||||
}
|
||||
|
||||
if(txs_signed > 0){
|
||||
const auto& idx = get_index_type<son_index>().indices().get<by_id>();
|
||||
auto son_obj = idx.find( s.owner );
|
||||
auto son_weight = get_weight(_vote_tally_buffer[son_obj->vote_id]);
|
||||
if( now < HARDFORK_SON2_TIME ) {
|
||||
son_weight = get_weight_before_son2_hf(_vote_tally_buffer[son_obj->vote_id]);
|
||||
}
|
||||
share_type pay = (s.txs_signed * son_weight * son_budget.value)/weighted_total_txs_signed;
|
||||
share_type pay = (txs_signed * son_weight * son_budget.value)/weighted_total_txs_signed;
|
||||
modify( *son_obj, [&]( son_object& _son_obj)
|
||||
{
|
||||
_son_obj.pay_son_fee(pay, *this);
|
||||
|
|
@ -236,8 +245,9 @@ void database::pay_sons()
|
|||
//Reset the tx counter in each son statistics object
|
||||
modify( s, [&]( son_statistics_object& _s)
|
||||
{
|
||||
_s.total_txs_signed += _s.txs_signed;
|
||||
_s.txs_signed = 0;
|
||||
for (const auto &ts : s.txs_signed) {
|
||||
_s.txs_signed.at(ts.first) = 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -267,11 +277,13 @@ void database::update_son_metrics(const vector<son_info>& curr_active_sons)
|
|||
bool is_active_son = (std::find(current_sons.begin(), current_sons.end(), son.id) != current_sons.end());
|
||||
modify( stats, [&]( son_statistics_object& _stats )
|
||||
{
|
||||
if(is_active_son) {
|
||||
_stats.total_voted_time = _stats.total_voted_time + get_global_properties().parameters.maintenance_interval;
|
||||
}
|
||||
_stats.total_downtime += _stats.current_interval_downtime;
|
||||
_stats.current_interval_downtime = 0;
|
||||
if(is_active_son)
|
||||
{
|
||||
_stats.total_voted_time = _stats.total_voted_time + get_global_properties().parameters.maintenance_interval;
|
||||
for (const auto &str : _stats.sidechain_txs_reported) {
|
||||
_stats.sidechain_txs_reported.at(str.first) = 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -1206,7 +1218,6 @@ uint32_t database::get_gpos_current_subperiod()
|
|||
const auto period_start = fc::time_point_sec(gpo.parameters.gpos_period_start());
|
||||
|
||||
// variables needed
|
||||
const fc::time_point_sec period_end = period_start + vesting_period;
|
||||
const auto number_of_subperiods = vesting_period / vesting_subperiod;
|
||||
const auto now = this->head_block_time();
|
||||
auto seconds_since_period_start = now.sec_since_epoch() - period_start.sec_since_epoch();
|
||||
|
|
@ -1399,7 +1410,6 @@ void schedule_pending_dividend_balances(database& db,
|
|||
|
||||
uint32_t holder_account_count = 0;
|
||||
|
||||
#ifdef USE_VESTING_OBJECT_BY_ASSET_BALANCE_INDEX
|
||||
// get only once a collection of accounts that hold nonzero vesting balances of the dividend asset
|
||||
auto vesting_balances_begin =
|
||||
vesting_index.indices().get<by_asset_balance>().lower_bound(boost::make_tuple(dividend_holder_asset_obj.id, balance_type));
|
||||
|
|
@ -1414,22 +1424,6 @@ void schedule_pending_dividend_balances(database& db,
|
|||
("owner", vesting_balance_obj.owner(db).name)
|
||||
("amount", vesting_balance_obj.balance.amount));
|
||||
}
|
||||
#else
|
||||
// get only once a collection of accounts that hold nonzero vesting balances of the dividend asset
|
||||
const auto& vesting_balances = vesting_index.indices().get<by_id>();
|
||||
for (const vesting_balance_object& vesting_balance_obj : vesting_balances)
|
||||
{
|
||||
if (vesting_balance_obj.balance.asset_id == dividend_holder_asset_obj.id && vesting_balance_obj.balance.amount &&
|
||||
vesting_balance_object.balance_type == balance_type)
|
||||
{
|
||||
vesting_amounts[vesting_balance_obj.owner] += vesting_balance_obj.balance.amount;
|
||||
++gpos_holder_account_count;
|
||||
dlog("Vesting balance for account: ${owner}, amount: ${amount}",
|
||||
("owner", vesting_balance_obj.owner(db).name)
|
||||
("amount", vesting_balance_obj.balance.amount));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
auto current_distribution_account_balance_iter = current_distribution_account_balance_range.begin();
|
||||
if(db.head_block_time() < HARDFORK_GPOS_TIME)
|
||||
|
|
@ -1883,7 +1877,6 @@ void process_dividend_assets(database& db)
|
|||
{
|
||||
// if there was a previous payout, make our next payment one interval
|
||||
uint32_t current_time_sec = current_head_block_time.sec_since_epoch();
|
||||
fc::time_point_sec reference_time = *dividend_data_obj.last_scheduled_payout_time;
|
||||
uint32_t next_possible_time_sec = dividend_data_obj.last_scheduled_payout_time->sec_since_epoch();
|
||||
do
|
||||
next_possible_time_sec += *dividend_data_obj.options.payout_interval;
|
||||
|
|
@ -1944,10 +1937,7 @@ void database::perform_son_tasks()
|
|||
a.options.market_fee_percent = 500; // 5%
|
||||
a.options.issuer_permissions = UIA_ASSET_ISSUER_PERMISSION_MASK;
|
||||
a.options.flags = asset_issuer_permission_flags::charge_market_fee |
|
||||
//asset_issuer_permission_flags::white_list |
|
||||
asset_issuer_permission_flags::override_authority |
|
||||
asset_issuer_permission_flags::transfer_restricted |
|
||||
asset_issuer_permission_flags::disable_confidential;
|
||||
asset_issuer_permission_flags::override_authority;
|
||||
a.options.core_exchange_rate.base.amount = 100000;
|
||||
a.options.core_exchange_rate.base.asset_id = asset_id_type(0);
|
||||
a.options.core_exchange_rate.quote.amount = 2500; // CoinMarketCap approx value
|
||||
|
|
@ -1964,6 +1954,74 @@ void database::perform_son_tasks()
|
|||
gpo.pending_parameters->extensions.value.btc_asset = btc_asset.get_id();
|
||||
});
|
||||
}
|
||||
// create HBD asset here because son_account is the issuer of the HBD
|
||||
if (gpo.parameters.hbd_asset() == asset_id_type() && head_block_time() >= HARDFORK_SON_FOR_HIVE_TIME)
|
||||
{
|
||||
const asset_dynamic_data_object& dyn_asset =
|
||||
create<asset_dynamic_data_object>([](asset_dynamic_data_object& a) {
|
||||
a.current_supply = 0;
|
||||
});
|
||||
|
||||
const asset_object& hbd_asset =
|
||||
create<asset_object>( [&gpo, &dyn_asset]( asset_object& a ) {
|
||||
a.symbol = "HBD";
|
||||
a.precision = 3;
|
||||
a.issuer = gpo.parameters.son_account();
|
||||
a.options.max_supply = GRAPHENE_MAX_SHARE_SUPPLY;
|
||||
a.options.market_fee_percent = 500; // 5%
|
||||
a.options.issuer_permissions = UIA_ASSET_ISSUER_PERMISSION_MASK;
|
||||
a.options.flags = asset_issuer_permission_flags::charge_market_fee |
|
||||
asset_issuer_permission_flags::override_authority;
|
||||
a.options.core_exchange_rate.base.amount = 100000;
|
||||
a.options.core_exchange_rate.base.asset_id = asset_id_type(0);
|
||||
a.options.core_exchange_rate.quote.amount = 2500; // CoinMarketCap approx value
|
||||
a.options.core_exchange_rate.quote.asset_id = a.id;
|
||||
a.options.whitelist_authorities.clear(); // accounts allowed to use asset, if not empty
|
||||
a.options.blacklist_authorities.clear(); // accounts who can blacklist other accounts to use asset, if white_list flag is set
|
||||
a.options.whitelist_markets.clear(); // might be traded with
|
||||
a.options.blacklist_markets.clear(); // might not be traded with
|
||||
a.dynamic_asset_data_id = dyn_asset.id;
|
||||
});
|
||||
modify( gpo, [&hbd_asset]( global_property_object& gpo ) {
|
||||
gpo.parameters.extensions.value.hbd_asset = hbd_asset.get_id();
|
||||
if( gpo.pending_parameters )
|
||||
gpo.pending_parameters->extensions.value.hbd_asset = hbd_asset.get_id();
|
||||
});
|
||||
}
|
||||
// create HIVE asset here because son_account is the issuer of the HIVE
|
||||
if (gpo.parameters.hive_asset() == asset_id_type() && head_block_time() >= HARDFORK_SON_FOR_HIVE_TIME)
|
||||
{
|
||||
const asset_dynamic_data_object& dyn_asset =
|
||||
create<asset_dynamic_data_object>([](asset_dynamic_data_object& a) {
|
||||
a.current_supply = 0;
|
||||
});
|
||||
|
||||
const asset_object& hive_asset =
|
||||
create<asset_object>( [&gpo, &dyn_asset]( asset_object& a ) {
|
||||
a.symbol = "HIVE";
|
||||
a.precision = 3;
|
||||
a.issuer = gpo.parameters.son_account();
|
||||
a.options.max_supply = GRAPHENE_MAX_SHARE_SUPPLY;
|
||||
a.options.market_fee_percent = 500; // 5%
|
||||
a.options.issuer_permissions = UIA_ASSET_ISSUER_PERMISSION_MASK;
|
||||
a.options.flags = asset_issuer_permission_flags::charge_market_fee |
|
||||
asset_issuer_permission_flags::override_authority;
|
||||
a.options.core_exchange_rate.base.amount = 100000;
|
||||
a.options.core_exchange_rate.base.asset_id = asset_id_type(0);
|
||||
a.options.core_exchange_rate.quote.amount = 2500; // CoinMarketCap approx value
|
||||
a.options.core_exchange_rate.quote.asset_id = a.id;
|
||||
a.options.whitelist_authorities.clear(); // accounts allowed to use asset, if not empty
|
||||
a.options.blacklist_authorities.clear(); // accounts who can blacklist other accounts to use asset, if white_list flag is set
|
||||
a.options.whitelist_markets.clear(); // might be traded with
|
||||
a.options.blacklist_markets.clear(); // might not be traded with
|
||||
a.dynamic_asset_data_id = dyn_asset.id;
|
||||
});
|
||||
modify( gpo, [&hive_asset]( global_property_object& gpo ) {
|
||||
gpo.parameters.extensions.value.hive_asset = hive_asset.get_id();
|
||||
if( gpo.pending_parameters )
|
||||
gpo.pending_parameters->extensions.value.hive_asset = hive_asset.get_id();
|
||||
});
|
||||
}
|
||||
// Pay the SONs
|
||||
if (head_block_time() >= HARDFORK_SON_TIME)
|
||||
{
|
||||
|
|
@ -2024,7 +2082,7 @@ void database::perform_chain_maintenance(const signed_block& next_block, const g
|
|||
balance_type = vesting_balance_type::gpos;
|
||||
|
||||
const vesting_balance_index& vesting_index = d.get_index_type<vesting_balance_index>();
|
||||
#ifdef USE_VESTING_OBJECT_BY_ASSET_BALANCE_INDEX
|
||||
|
||||
auto vesting_balances_begin =
|
||||
vesting_index.indices().get<by_asset_balance>().lower_bound(boost::make_tuple(asset_id_type(), balance_type));
|
||||
auto vesting_balances_end =
|
||||
|
|
@ -2036,19 +2094,7 @@ void database::perform_chain_maintenance(const signed_block& next_block, const g
|
|||
("owner", vesting_balance_obj.owner(d).name)
|
||||
("amount", vesting_balance_obj.balance.amount));
|
||||
}
|
||||
#else
|
||||
const auto& vesting_balances = vesting_index.indices().get<by_id>();
|
||||
for (const vesting_balance_object& vesting_balance_obj : vesting_balances)
|
||||
{
|
||||
if (vesting_balance_obj.balance.asset_id == asset_id_type() && vesting_balance_obj.balance.amount && vesting_balance_obj.balance_type == balance_type)
|
||||
{
|
||||
vesting_amounts[vesting_balance_obj.owner] += vesting_balance_obj.balance.amount;
|
||||
dlog("Vesting balance for account: ${owner}, amount: ${amount}",
|
||||
("owner", vesting_balance_obj.owner(d).name)
|
||||
("amount", vesting_balance_obj.balance.amount));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void operator()( const account_object& stake_account, const account_statistics_object& stats )
|
||||
|
|
@ -2224,6 +2270,10 @@ void database::perform_chain_maintenance(const signed_block& next_block, const g
|
|||
p.pending_parameters->extensions.value.btc_asset = p.parameters.extensions.value.btc_asset;
|
||||
if( !p.pending_parameters->extensions.value.maximum_son_count.valid() )
|
||||
p.pending_parameters->extensions.value.maximum_son_count = p.parameters.extensions.value.maximum_son_count;
|
||||
if( !p.pending_parameters->extensions.value.hbd_asset.valid() )
|
||||
p.pending_parameters->extensions.value.hbd_asset = p.parameters.extensions.value.hbd_asset;
|
||||
if( !p.pending_parameters->extensions.value.hive_asset.valid() )
|
||||
p.pending_parameters->extensions.value.hive_asset = p.parameters.extensions.value.hive_asset;
|
||||
p.parameters = std::move(*p.pending_parameters);
|
||||
p.pending_parameters.reset();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include <graphene/chain/witness_schedule_object.hpp>
|
||||
#include <graphene/chain/special_authority_object.hpp>
|
||||
#include <graphene/chain/operation_history_object.hpp>
|
||||
#include <graphene/chain/nft_object.hpp>
|
||||
#include <graphene/chain/protocol/fee_schedule.hpp>
|
||||
|
||||
#include <fc/io/fstream.hpp>
|
||||
|
|
@ -107,7 +108,6 @@ void database::reindex( fc::path data_dir )
|
|||
ilog( "reindexing blockchain" );
|
||||
auto start = fc::time_point::now();
|
||||
const auto last_block_num = last_block->block_num();
|
||||
uint32_t flush_point = last_block_num < 10000 ? 0 : last_block_num - 10000;
|
||||
uint32_t undo_point = last_block_num < 50 ? 0 : last_block_num - 50;
|
||||
|
||||
ilog( "Replaying blocks, starting at ${next}...", ("next",head_block_num() + 1) );
|
||||
|
|
@ -123,8 +123,7 @@ void database::reindex( fc::path data_dir )
|
|||
}
|
||||
for( uint32_t i = head_block_num() + 1; i <= last_block_num; ++i )
|
||||
{
|
||||
if( i % 10000 == 0 ) std::cerr << " " << double(i*100)/last_block_num << "% "<<i << " of " <<last_block_num<<" \n";
|
||||
if( i == flush_point )
|
||||
if( i % 10000 == 0 )
|
||||
{
|
||||
ilog( "Writing database to disk at block ${i}", ("i",i) );
|
||||
flush();
|
||||
|
|
@ -233,7 +232,12 @@ void database::open(
|
|||
FC_ASSERT( *last_block >= head_block_id(),
|
||||
"last block ID does not match current chain state",
|
||||
("last_block->id", last_block)("head_block_id",head_block_num()) );
|
||||
|
||||
_block_id_to_block.set_replay_mode(true);
|
||||
|
||||
reindex( data_dir );
|
||||
|
||||
_block_id_to_block.set_replay_mode(false);
|
||||
}
|
||||
_opened = true;
|
||||
}
|
||||
|
|
@ -306,6 +310,24 @@ void database::check_ending_lotteries()
|
|||
} catch( ... ) {}
|
||||
}
|
||||
|
||||
void database::check_ending_nft_lotteries()
|
||||
{
|
||||
try {
|
||||
const auto &nft_lotteries_idx = get_index_type<nft_metadata_index>().indices().get<active_nft_lotteries>();
|
||||
for (auto checking_token : nft_lotteries_idx)
|
||||
{
|
||||
FC_ASSERT(checking_token.is_lottery());
|
||||
const auto &lottery_options = checking_token.lottery_data->lottery_options;
|
||||
FC_ASSERT(lottery_options.is_active);
|
||||
// Check the current supply of lottery tokens
|
||||
auto current_supply = checking_token.get_token_current_supply(*this);
|
||||
if ((lottery_options.ending_on_soldout && (current_supply == checking_token.max_supply)) ||
|
||||
(lottery_options.end_date != time_point_sec() && (lottery_options.end_date <= head_block_time())))
|
||||
checking_token.end_lottery(*this);
|
||||
}
|
||||
} catch( ... ) {}
|
||||
}
|
||||
|
||||
void database::check_lottery_end_by_participants( asset_id_type asset_id )
|
||||
{
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include <fc/container/flat.hpp>
|
||||
|
||||
#include <graphene/chain/database.hpp>
|
||||
#include <graphene/chain/protocol/authority.hpp>
|
||||
#include <graphene/chain/protocol/operations.hpp>
|
||||
#include <graphene/chain/protocol/transaction.hpp>
|
||||
|
|
@ -41,6 +42,10 @@
|
|||
#include <graphene/chain/transaction_object.hpp>
|
||||
#include <graphene/chain/impacted.hpp>
|
||||
#include <graphene/chain/hardfork.hpp>
|
||||
#include <graphene/chain/account_object.hpp>
|
||||
#include <graphene/chain/account_role_object.hpp>
|
||||
#include <graphene/chain/son_object.hpp>
|
||||
#include <graphene/chain/sidechain_address_object.hpp>
|
||||
|
||||
|
||||
using namespace fc;
|
||||
|
|
@ -359,6 +364,13 @@ struct get_impacted_account_visitor
|
|||
void operator()( const account_role_delete_operation& op ){
|
||||
_impacted.insert( op.owner );
|
||||
}
|
||||
void operator()( const nft_lottery_token_purchase_operation& op ){
|
||||
_impacted.insert( op.buyer );
|
||||
}
|
||||
void operator()( const nft_lottery_reward_operation& op ) {
|
||||
_impacted.insert( op.winner );
|
||||
}
|
||||
void operator()( const nft_lottery_end_operation& op ) {}
|
||||
void operator()( const son_create_operation& op ) {
|
||||
_impacted.insert( op.owner_account );
|
||||
}
|
||||
|
|
@ -416,6 +428,9 @@ struct get_impacted_account_visitor
|
|||
void operator()( const sidechain_transaction_settle_operation& op ) {
|
||||
_impacted.insert( op.payer );
|
||||
}
|
||||
void operator()( const random_number_store_operation& op ) {
|
||||
_impacted.insert( op.account );
|
||||
}
|
||||
};
|
||||
|
||||
void graphene::chain::operation_get_impacted_accounts( const operation& op, flat_set<account_id_type>& result, bool ignore_custom_operation_required_auths ) {
|
||||
|
|
@ -528,6 +543,9 @@ void get_relevant_accounts( const object* obj, flat_set<account_id_type>& accoun
|
|||
} case sidechain_transaction_object_type:{
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( obj->id.space() == implementation_ids )
|
||||
|
|
@ -582,6 +600,10 @@ void get_relevant_accounts( const object* obj, flat_set<account_id_type>& accoun
|
|||
break;
|
||||
case impl_fba_accumulator_object_type:
|
||||
break;
|
||||
case impl_nft_lottery_balance_object_type:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // end get_relevant_accounts( const object* obj, flat_set<account_id_type>& accounts )
|
||||
|
|
|
|||
|
|
@ -26,16 +26,18 @@
|
|||
#include <graphene/chain/db_with.hpp>
|
||||
|
||||
#include <graphene/chain/asset_object.hpp>
|
||||
#include <graphene/chain/betting_market_object.hpp>
|
||||
#include <graphene/chain/game_object.hpp>
|
||||
#include <graphene/chain/global_property_object.hpp>
|
||||
#include <graphene/chain/hardfork.hpp>
|
||||
#include <graphene/chain/market_object.hpp>
|
||||
#include <graphene/chain/offer_object.hpp>
|
||||
#include <graphene/chain/proposal_object.hpp>
|
||||
#include <graphene/chain/son_proposal_object.hpp>
|
||||
#include <graphene/chain/tournament_object.hpp>
|
||||
#include <graphene/chain/transaction_object.hpp>
|
||||
#include <graphene/chain/withdraw_permission_object.hpp>
|
||||
#include <graphene/chain/witness_object.hpp>
|
||||
#include <graphene/chain/tournament_object.hpp>
|
||||
#include <graphene/chain/game_object.hpp>
|
||||
#include <graphene/chain/betting_market_object.hpp>
|
||||
|
||||
#include <graphene/chain/protocol/fee_schedule.hpp>
|
||||
|
||||
|
|
@ -46,7 +48,6 @@ namespace graphene { namespace chain {
|
|||
void database::update_global_dynamic_data( const signed_block& b, const uint32_t missed_blocks )
|
||||
{
|
||||
const dynamic_global_property_object& _dgp = get_dynamic_global_properties();
|
||||
const global_property_object& gpo = get_global_properties();
|
||||
|
||||
// dynamic global properties updating
|
||||
modify( _dgp, [&b,this,missed_blocks]( dynamic_global_property_object& dgp ){
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
#ifndef HARDFORK_1000_TIME
|
||||
#define HARDFORK_1000_TIME (fc::time_point_sec( 1550491200 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_1000_TIME (fc::time_point_sec::from_iso_string("2018-10-20T01:46:40"))
|
||||
#else
|
||||
#define HARDFORK_1000_TIME (fc::time_point_sec::from_iso_string("2019-02-18T12:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
// added delete sport and delete event group operations
|
||||
#ifndef HARDFORK_1001_TIME
|
||||
#define HARDFORK_1001_TIME (fc::time_point_sec( 1550491200 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_1001_TIME (fc::time_point_sec::from_iso_string("2018-10-20T01:46:40"))
|
||||
#else
|
||||
#define HARDFORK_1001_TIME (fc::time_point_sec::from_iso_string("2019-02-18T12:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
// #357 Disallow publishing certain malformed price feeds
|
||||
#ifndef HARDFORK_357_TIME
|
||||
#define HARDFORK_357_TIME (fc::time_point_sec( 1444416300 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_357_TIME (fc::time_point_sec::from_iso_string("2015-10-09T18:45:00"))
|
||||
#else
|
||||
#define HARDFORK_357_TIME (fc::time_point_sec::from_iso_string("2015-10-09T18:45:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
// #359 Allow digits in asset name
|
||||
#ifndef HARDFORK_359_TIME
|
||||
#define HARDFORK_359_TIME (fc::time_point_sec( 1444416300 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_359_TIME (fc::time_point_sec::from_iso_string("2015-10-09T18:45:00"))
|
||||
#else
|
||||
#define HARDFORK_359_TIME (fc::time_point_sec::from_iso_string("2015-10-09T18:45:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
// #385 October 23 enforce PARENT.CHILD and allow short names
|
||||
#ifndef HARDFORK_385_TIME
|
||||
#define HARDFORK_385_TIME (fc::time_point_sec( 1445558400 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_385_TIME (fc::time_point_sec::from_iso_string("2015-10-23T00:00:00"))
|
||||
#else
|
||||
#define HARDFORK_385_TIME (fc::time_point_sec::from_iso_string("2015-10-23T00:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
// #409 Allow creation of sub-assets
|
||||
#ifndef HARDFORK_409_TIME
|
||||
#define HARDFORK_409_TIME (fc::time_point_sec( 1446652800 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_409_TIME (fc::time_point_sec::from_iso_string("2015-11-04T16:00:00"))
|
||||
#else
|
||||
#define HARDFORK_409_TIME (fc::time_point_sec::from_iso_string("2015-11-04T16:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
// #413 Add operation to claim asset fees
|
||||
#ifndef HARDFORK_413_TIME
|
||||
#define HARDFORK_413_TIME (fc::time_point_sec( 1446652800 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_413_TIME (fc::time_point_sec::from_iso_string("2015-11-04T16:00:00"))
|
||||
#else
|
||||
#define HARDFORK_413_TIME (fc::time_point_sec::from_iso_string("2015-11-04T16:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
// #415 Default accept policy for asset with no whitelist authorities
|
||||
#ifndef HARDFORK_415_TIME
|
||||
#define HARDFORK_415_TIME (fc::time_point_sec( 1446652800 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_415_TIME (fc::time_point_sec::from_iso_string("2015-11-04T16:00:00"))
|
||||
#else
|
||||
#define HARDFORK_415_TIME (fc::time_point_sec::from_iso_string("2015-11-04T16:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
// #416 enforce_white_list is inconsistently applied
|
||||
#ifndef HARDFORK_416_TIME
|
||||
#define HARDFORK_416_TIME (fc::time_point_sec( 1446652800 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_416_TIME (fc::time_point_sec::from_iso_string("2015-11-04T16:00:00"))
|
||||
#else
|
||||
#define HARDFORK_416_TIME (fc::time_point_sec::from_iso_string("2015-11-04T16:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
// #419 Account can pay fees in blacklisted asset
|
||||
#ifndef HARDFORK_419_TIME
|
||||
#define HARDFORK_419_TIME (fc::time_point_sec( 1446652800 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_419_TIME (fc::time_point_sec::from_iso_string("2015-11-04T16:00:00"))
|
||||
#else
|
||||
#define HARDFORK_419_TIME (fc::time_point_sec::from_iso_string("2015-11-04T16:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
// #436 Prevent margin call from being triggered unless feed < call price
|
||||
#ifndef HARDFORK_436_TIME
|
||||
#define HARDFORK_436_TIME (fc::time_point_sec( 1450288800 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_436_TIME (fc::time_point_sec::from_iso_string("2015-12-16T18:00:00"))
|
||||
#else
|
||||
#define HARDFORK_436_TIME (fc::time_point_sec::from_iso_string("2015-12-16T18:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
// #445 Refund create order fees on cancel
|
||||
#ifndef HARDFORK_445_TIME
|
||||
#define HARDFORK_445_TIME (fc::time_point_sec( 1450288800 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_445_TIME (fc::time_point_sec::from_iso_string("2015-12-16T18:00:00"))
|
||||
#else
|
||||
#define HARDFORK_445_TIME (fc::time_point_sec::from_iso_string("2015-12-16T18:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
// #453 Hardfork to retroactively correct referral percentages
|
||||
#ifndef HARDFORK_453_TIME
|
||||
#define HARDFORK_453_TIME (fc::time_point_sec( 1450288800 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_453_TIME (fc::time_point_sec::from_iso_string("2015-12-16T18:00:00"))
|
||||
#else
|
||||
#define HARDFORK_453_TIME (fc::time_point_sec::from_iso_string("2015-12-16T18:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
// #480 Fix non-BTS MIA core_exchange_rate check
|
||||
#ifndef HARDFORK_480_TIME
|
||||
#define HARDFORK_480_TIME (fc::time_point_sec( 1450378800 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_480_TIME (fc::time_point_sec::from_iso_string("2015-12-17T19:00:00"))
|
||||
#else
|
||||
#define HARDFORK_480_TIME (fc::time_point_sec::from_iso_string("2015-12-17T19:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
// #483 Operation history numbering change
|
||||
#ifndef HARDFORK_483_TIME
|
||||
#define HARDFORK_483_TIME (fc::time_point_sec( 1450378800 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_483_TIME (fc::time_point_sec::from_iso_string("2015-12-17T19:00:00"))
|
||||
#else
|
||||
#define HARDFORK_483_TIME (fc::time_point_sec::from_iso_string("2015-12-17T19:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
// 5050_1 HARDFORK Thursday, 22 April 2020 20:00:00 GMT
|
||||
#ifndef HARDFORK_5050_1_TIME
|
||||
#define HARDFORK_5050_1_TIME (fc::time_point_sec( 1587585600 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_5050_1_TIME (fc::time_point_sec::from_iso_string("2020-04-15T20:00:00"))
|
||||
#else
|
||||
#define HARDFORK_5050_1_TIME (fc::time_point_sec::from_iso_string("2020-04-22T20:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
// #516 Special authorities
|
||||
#ifndef HARDFORK_516_TIME
|
||||
#define HARDFORK_516_TIME (fc::time_point_sec( 1456250400 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_516_TIME (fc::time_point_sec::from_iso_string("2016-02-23T18:00:00"))
|
||||
#else
|
||||
#define HARDFORK_516_TIME (fc::time_point_sec::from_iso_string("2016-02-23T18:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
// #533 Improve vote counting implementation
|
||||
#ifndef HARDFORK_533_TIME
|
||||
#define HARDFORK_533_TIME (fc::time_point_sec( 1456250400 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_533_TIME (fc::time_point_sec::from_iso_string("2016-02-23T18:00:00"))
|
||||
#else
|
||||
#define HARDFORK_533_TIME (fc::time_point_sec::from_iso_string("2016-02-23T18:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
// #538 Buyback accounts
|
||||
#ifndef HARDFORK_538_TIME
|
||||
#define HARDFORK_538_TIME (fc::time_point_sec( 1456250400 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_538_TIME (fc::time_point_sec::from_iso_string("2016-02-23T18:00:00"))
|
||||
#else
|
||||
#define HARDFORK_538_TIME (fc::time_point_sec::from_iso_string("2016-02-23T18:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
// #555 Buyback accounts
|
||||
#ifndef HARDFORK_555_TIME
|
||||
#define HARDFORK_555_TIME (fc::time_point_sec( 1456250400 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_555_TIME (fc::time_point_sec::from_iso_string("2016-02-23T18:00:00"))
|
||||
#else
|
||||
#define HARDFORK_555_TIME (fc::time_point_sec::from_iso_string("2016-02-23T18:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
// #563 Stealth fee routing
|
||||
#ifndef HARDFORK_563_TIME
|
||||
#define HARDFORK_563_TIME (fc::time_point_sec( 1456250400 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_563_TIME (fc::time_point_sec::from_iso_string("2016-02-23T18:00:00"))
|
||||
#else
|
||||
#define HARDFORK_563_TIME (fc::time_point_sec::from_iso_string("2016-02-23T18:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
// #572 Allow asset to update permission flags when no supply exists
|
||||
#ifndef HARDFORK_572_TIME
|
||||
#define HARDFORK_572_TIME (fc::time_point_sec( 1456250400 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_572_TIME (fc::time_point_sec::from_iso_string("2016-02-23T18:00:00"))
|
||||
#else
|
||||
#define HARDFORK_572_TIME (fc::time_point_sec::from_iso_string("2016-02-23T18:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
// #599 Unpacking of extension is incorrect
|
||||
#ifndef HARDFORK_599_TIME
|
||||
#define HARDFORK_599_TIME (fc::time_point_sec( 1459789200 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_599_TIME (fc::time_point_sec::from_iso_string("2016-04-04T17:00:00"))
|
||||
#else
|
||||
#define HARDFORK_599_TIME (fc::time_point_sec::from_iso_string("2016-04-04T17:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
// #607 Disable negative voting on workers
|
||||
#ifndef HARDFORK_607_TIME
|
||||
#define HARDFORK_607_TIME (fc::time_point_sec( 1458752400 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_607_TIME (fc::time_point_sec::from_iso_string("2016-03-23T17:00:00"))
|
||||
#else
|
||||
#define HARDFORK_607_TIME (fc::time_point_sec::from_iso_string("2016-03-23T17:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
// #613 Deprecate annual membership
|
||||
#ifndef HARDFORK_613_TIME
|
||||
#define HARDFORK_613_TIME (fc::time_point_sec( 1458752400 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_613_TIME (fc::time_point_sec::from_iso_string("2016-03-23T17:00:00"))
|
||||
#else
|
||||
#define HARDFORK_613_TIME (fc::time_point_sec::from_iso_string("2016-03-23T17:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
// #615 Fix price feed expiration check, so websocket server will never spam too much data
|
||||
#ifndef HARDFORK_615_TIME
|
||||
#define HARDFORK_615_TIME (fc::time_point_sec( 1458752400 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_615_TIME (fc::time_point_sec::from_iso_string("2016-03-23T17:00:00"))
|
||||
#else
|
||||
#define HARDFORK_615_TIME (fc::time_point_sec::from_iso_string("2016-03-23T17:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
// Placeholder HF for affiliate reward system
|
||||
#ifndef HARDFORK_999_TIME
|
||||
#define HARDFORK_999_TIME (fc::time_point_sec( 1550491200 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_999_TIME (fc::time_point_sec::from_iso_string("2018-10-20T01:46:40"))
|
||||
#else
|
||||
#define HARDFORK_999_TIME (fc::time_point_sec::from_iso_string("2019-02-18T12:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
// bitshares-core #429 rounding issue when creating assets
|
||||
#ifndef HARDFORK_CORE_429_TIME
|
||||
#define HARDFORK_CORE_429_TIME (fc::time_point_sec( 1568340000 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_CORE_429_TIME (fc::time_point_sec::from_iso_string("2019-08-26T02:00:00"))
|
||||
#else
|
||||
#define HARDFORK_CORE_429_TIME (fc::time_point_sec::from_iso_string("2019-09-13T02:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
// #210 Check authorities on custom_operation
|
||||
#ifndef HARDFORK_CORE_210_TIME
|
||||
#define HARDFORK_CORE_210_TIME (fc::time_point_sec(1893456000)) // Jan 1 00:00:00 2030 (Not yet scheduled)
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_CORE_210_TIME (fc::time_point_sec::from_iso_string("2030-01-01T00:00:00")) // (Not yet scheduled)
|
||||
#else
|
||||
#define HARDFORK_CORE_210_TIME (fc::time_point_sec::from_iso_string("2030-01-01T00:00:00")) // (Not yet scheduled)
|
||||
#endif
|
||||
// Bugfix: pre-HF 210, custom_operation's required_auths field was ignored.
|
||||
#define MUST_IGNORE_CUSTOM_OP_REQD_AUTHS(chain_time) (chain_time <= HARDFORK_CORE_210_TIME)
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
// GPOS HARDFORK Monday, 17 February 2020 22:00:00 GMT
|
||||
#ifndef HARDFORK_GPOS_TIME
|
||||
#define HARDFORK_GPOS_TIME (fc::time_point_sec( 1581976800 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_GPOS_TIME (fc::time_point_sec::from_iso_string("2020-01-06T01:00:00"))
|
||||
#else
|
||||
#define HARDFORK_GPOS_TIME (fc::time_point_sec::from_iso_string("2020-02-17T22:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
// GPOS HARDFORK 2020-12-21 00:00:00 GMT
|
||||
#ifndef HARDFORK_NFT_TIME
|
||||
#define HARDFORK_NFT_TIME (fc::time_point_sec( 1608508800 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_NFT_TIME (fc::time_point_sec::from_iso_string("2020-08-15T00:00:00"))
|
||||
#else
|
||||
#define HARDFORK_NFT_TIME (fc::time_point_sec::from_iso_string("2020-12-21T00:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
// GPOS HARDFORK 2020-12-21 00:00:00 GMT
|
||||
#ifndef HARDFORK_SON_TIME
|
||||
#define HARDFORK_SON_TIME (fc::time_point_sec( 1608508800 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_SON_TIME (fc::time_point_sec::from_iso_string("2020-10-28T00:00:00"))
|
||||
#else
|
||||
#define HARDFORK_SON_TIME (fc::time_point_sec::from_iso_string("2020-12-21T00:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
// SON2 HARDFORK Saturday, July 31, 2021 00:00:00 GMT
|
||||
#ifndef HARDFORK_SON2_TIME
|
||||
#define HARDFORK_SON2_TIME (fc::time_point_sec( 1627689600 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_SON2_TIME (fc::time_point_sec::from_iso_string("2021-07-31T00:00:00"))
|
||||
#else
|
||||
#define HARDFORK_SON2_TIME (fc::time_point_sec::from_iso_string("2021-07-31T00:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
7
libraries/chain/hardfork.d/SON_FOR_HIVE.hf
Normal file
7
libraries/chain/hardfork.d/SON_FOR_HIVE.hf
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef HARDFORK_SON_FOR_HIVE_TIME
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_SON_FOR_HIVE_TIME (fc::time_point_sec::from_iso_string("2021-03-31T00:00:00"))
|
||||
#else
|
||||
#define HARDFORK_SON_FOR_HIVE_TIME (fc::time_point_sec::from_iso_string("2021-12-11T00:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -1,3 +1,7 @@
|
|||
#ifndef HARDFORK_SWEEPS_TIME
|
||||
#define HARDFORK_SWEEPS_TIME (fc::time_point_sec( 1568340000 ))
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define HARDFORK_SWEEPS_TIME (fc::time_point_sec::from_iso_string("2019-08-26T02:00:00"))
|
||||
#else
|
||||
#define HARDFORK_SWEEPS_TIME (fc::time_point_sec::from_iso_string("2019-09-13T02:00:00"))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -47,7 +47,11 @@ namespace graphene { namespace chain {
|
|||
optional<signed_block> fetch_by_number( uint32_t block_num )const;
|
||||
optional<signed_block> last()const;
|
||||
optional<block_id_type> last_id()const;
|
||||
|
||||
void set_replay_mode(bool mode);
|
||||
private:
|
||||
bool replay_mode = false;
|
||||
|
||||
optional<index_entry> last_index_entry()const;
|
||||
fc::path _index_filename;
|
||||
mutable std::fstream _blocks;
|
||||
|
|
|
|||
|
|
@ -23,8 +23,13 @@
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef BUILD_PEERPLAYS_TESTNET
|
||||
#define GRAPHENE_SYMBOL "TEST"
|
||||
#define GRAPHENE_ADDRESS_PREFIX "TEST"
|
||||
#else
|
||||
#define GRAPHENE_SYMBOL "PPY"
|
||||
#define GRAPHENE_ADDRESS_PREFIX "PPY"
|
||||
#endif
|
||||
|
||||
#define GRAPHENE_MIN_ACCOUNT_NAME_LENGTH 1
|
||||
#define GRAPHENE_MAX_ACCOUNT_NAME_LENGTH 63
|
||||
|
|
|
|||
|
|
@ -286,6 +286,7 @@ namespace graphene { namespace chain {
|
|||
|
||||
void check_lottery_end_by_participants( asset_id_type asset_id );
|
||||
void check_ending_lotteries();
|
||||
void check_ending_nft_lotteries();
|
||||
|
||||
//////////////////// db_getter.cpp ////////////////////
|
||||
|
||||
|
|
@ -325,6 +326,7 @@ namespace graphene { namespace chain {
|
|||
|
||||
uint32_t last_non_undoable_block_num() const;
|
||||
vector<authority> get_account_custom_authorities(account_id_type account, const operation& op)const;
|
||||
vector<uint64_t> get_random_numbers(uint64_t minimum, uint64_t maximum, uint64_t selections, bool duplicates);
|
||||
//////////////////// db_init.cpp ////////////////////
|
||||
|
||||
void initialize_evaluators();
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class global_betting_statistics_object : public graphene::db::abstract_object< g
|
|||
static const uint8_t space_id = implementation_ids;
|
||||
static const uint8_t type_id = impl_global_betting_statistics_object_type;
|
||||
|
||||
uint32_t number_of_active_events;
|
||||
uint32_t number_of_active_events = 0;
|
||||
map<asset_id_type, share_type> total_amount_staked;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
#pragma once
|
||||
#include <graphene/chain/protocol/operations.hpp>
|
||||
#include <graphene/chain/evaluator.hpp>
|
||||
#include <graphene/chain/database.hpp>
|
||||
|
||||
namespace graphene
|
||||
{
|
||||
namespace chain
|
||||
{
|
||||
|
||||
class nft_lottery_token_purchase_evaluator : public evaluator<nft_lottery_token_purchase_evaluator>
|
||||
{
|
||||
public:
|
||||
typedef nft_lottery_token_purchase_operation operation_type;
|
||||
|
||||
void_result do_evaluate(const nft_lottery_token_purchase_operation &o);
|
||||
object_id_type do_apply(const nft_lottery_token_purchase_operation &o);
|
||||
};
|
||||
|
||||
class nft_lottery_reward_evaluator : public evaluator<nft_lottery_reward_evaluator>
|
||||
{
|
||||
public:
|
||||
typedef nft_lottery_reward_operation operation_type;
|
||||
|
||||
void_result do_evaluate(const nft_lottery_reward_operation &o);
|
||||
void_result do_apply(const nft_lottery_reward_operation &o);
|
||||
};
|
||||
|
||||
class nft_lottery_end_evaluator : public evaluator<nft_lottery_end_evaluator>
|
||||
{
|
||||
public:
|
||||
typedef nft_lottery_end_operation operation_type;
|
||||
|
||||
void_result do_evaluate(const nft_lottery_end_operation &o);
|
||||
void_result do_apply(const nft_lottery_end_operation &o);
|
||||
};
|
||||
|
||||
} // namespace chain
|
||||
} // namespace graphene
|
||||
|
|
@ -6,6 +6,29 @@
|
|||
namespace graphene { namespace chain {
|
||||
using namespace graphene::db;
|
||||
|
||||
class nft_lottery_balance_object : public abstract_object<nft_lottery_balance_object>
|
||||
{
|
||||
public:
|
||||
static const uint8_t space_id = implementation_ids;
|
||||
static const uint8_t type_id = impl_nft_lottery_balance_object_type;
|
||||
|
||||
// Total Progressive jackpot carried over from previous lotteries
|
||||
asset total_progressive_jackpot;
|
||||
// Current total jackpot in this lottery inclusive of the progressive jackpot
|
||||
asset jackpot;
|
||||
// Total tickets sold
|
||||
share_type sweeps_tickets_sold;
|
||||
};
|
||||
|
||||
struct nft_lottery_data
|
||||
{
|
||||
nft_lottery_data() {}
|
||||
nft_lottery_data(const nft_lottery_options &options, nft_lottery_balance_id_type lottery_id)
|
||||
: lottery_options(options), lottery_balance_id(lottery_id) {}
|
||||
nft_lottery_options lottery_options;
|
||||
nft_lottery_balance_id_type lottery_balance_id;
|
||||
};
|
||||
|
||||
class nft_metadata_object : public abstract_object<nft_metadata_object>
|
||||
{
|
||||
public:
|
||||
|
|
@ -21,6 +44,21 @@ namespace graphene { namespace chain {
|
|||
bool is_transferable = false;
|
||||
bool is_sellable = true;
|
||||
optional<account_role_id_type> account_role;
|
||||
share_type max_supply = GRAPHENE_MAX_SHARE_SUPPLY;
|
||||
optional<nft_lottery_data> lottery_data;
|
||||
|
||||
nft_metadata_id_type get_id() const { return id; }
|
||||
bool is_lottery() const { return lottery_data.valid(); }
|
||||
uint32_t get_owner_num() const { return owner.instance.value; }
|
||||
time_point_sec get_lottery_expiration() const;
|
||||
asset get_lottery_jackpot(const database &db) const;
|
||||
share_type get_token_current_supply(const database &db) const;
|
||||
vector<account_id_type> get_holders(const database &db) const;
|
||||
vector<uint64_t> get_ticket_ids(const database &db) const;
|
||||
void distribute_benefactors_part(database &db);
|
||||
map<account_id_type, vector<uint16_t>> distribute_winners_part(database &db);
|
||||
void distribute_sweeps_holders_part(database &db);
|
||||
void end_lottery(database &db);
|
||||
};
|
||||
|
||||
class nft_object : public abstract_object<nft_object>
|
||||
|
|
@ -36,8 +74,23 @@ namespace graphene { namespace chain {
|
|||
std::string token_uri;
|
||||
};
|
||||
|
||||
struct nft_lottery_comparer
|
||||
{
|
||||
bool operator()(const nft_metadata_object& lhs, const nft_metadata_object& rhs) const
|
||||
{
|
||||
if ( !lhs.is_lottery() ) return false;
|
||||
if ( !lhs.lottery_data->lottery_options.is_active && !rhs.is_lottery()) return true; // not active lotteries first, just assets then
|
||||
if ( !lhs.lottery_data->lottery_options.is_active ) return false;
|
||||
if ( lhs.lottery_data->lottery_options.is_active && ( !rhs.is_lottery() || !rhs.lottery_data->lottery_options.is_active ) ) return true;
|
||||
return lhs.get_lottery_expiration() > rhs.get_lottery_expiration();
|
||||
}
|
||||
};
|
||||
|
||||
struct by_name;
|
||||
struct by_symbol;
|
||||
struct active_nft_lotteries;
|
||||
struct by_nft_lottery;
|
||||
struct by_nft_lottery_owner;
|
||||
using nft_metadata_multi_index_type = multi_index_container<
|
||||
nft_metadata_object,
|
||||
indexed_by<
|
||||
|
|
@ -49,6 +102,34 @@ namespace graphene { namespace chain {
|
|||
>,
|
||||
ordered_unique< tag<by_symbol>,
|
||||
member<nft_metadata_object, std::string, &nft_metadata_object::symbol>
|
||||
>,
|
||||
ordered_non_unique< tag<active_nft_lotteries>,
|
||||
identity< nft_metadata_object >,
|
||||
nft_lottery_comparer
|
||||
>,
|
||||
ordered_unique< tag<by_nft_lottery>,
|
||||
composite_key<
|
||||
nft_metadata_object,
|
||||
const_mem_fun<nft_metadata_object, bool, &nft_metadata_object::is_lottery>,
|
||||
member<object, object_id_type, &object::id>
|
||||
>,
|
||||
composite_key_compare<
|
||||
std::greater< bool >,
|
||||
std::greater< object_id_type >
|
||||
>
|
||||
>,
|
||||
ordered_unique< tag<by_nft_lottery_owner>,
|
||||
composite_key<
|
||||
nft_metadata_object,
|
||||
const_mem_fun<nft_metadata_object, bool, &nft_metadata_object::is_lottery>,
|
||||
const_mem_fun<nft_metadata_object, uint32_t, &nft_metadata_object::get_owner_num>,
|
||||
member<object, object_id_type, &object::id>
|
||||
>,
|
||||
composite_key_compare<
|
||||
std::greater< bool >,
|
||||
std::greater< uint32_t >,
|
||||
std::greater< object_id_type >
|
||||
>
|
||||
>
|
||||
>
|
||||
>;
|
||||
|
|
@ -86,8 +167,23 @@ namespace graphene { namespace chain {
|
|||
>;
|
||||
using nft_index = generic_index<nft_object, nft_multi_index_type>;
|
||||
|
||||
using nft_lottery_balance_index_type = multi_index_container<
|
||||
nft_lottery_balance_object,
|
||||
indexed_by<
|
||||
ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >
|
||||
>
|
||||
>;
|
||||
using nft_lottery_balance_index = generic_index<nft_lottery_balance_object, nft_lottery_balance_index_type>;
|
||||
|
||||
} } // graphene::chain
|
||||
|
||||
FC_REFLECT_DERIVED( graphene::chain::nft_lottery_balance_object, (graphene::db::object),
|
||||
(total_progressive_jackpot)
|
||||
(jackpot)
|
||||
(sweeps_tickets_sold) )
|
||||
|
||||
FC_REFLECT( graphene::chain::nft_lottery_data, (lottery_options)(lottery_balance_id) )
|
||||
|
||||
FC_REFLECT_DERIVED( graphene::chain::nft_metadata_object, (graphene::db::object),
|
||||
(owner)
|
||||
(name)
|
||||
|
|
@ -97,7 +193,9 @@ FC_REFLECT_DERIVED( graphene::chain::nft_metadata_object, (graphene::db::object)
|
|||
(revenue_split)
|
||||
(is_transferable)
|
||||
(is_sellable)
|
||||
(account_role) )
|
||||
(account_role)
|
||||
(max_supply)
|
||||
(lottery_data) )
|
||||
|
||||
FC_REFLECT_DERIVED( graphene::chain::nft_object, (graphene::db::object),
|
||||
(nft_metadata_id)
|
||||
|
|
|
|||
|
|
@ -68,6 +68,8 @@ namespace graphene { namespace chain {
|
|||
optional < account_id_type > son_account = GRAPHENE_NULL_ACCOUNT;
|
||||
optional < asset_id_type > btc_asset = asset_id_type();
|
||||
optional < uint16_t > maximum_son_count = GRAPHENE_DEFAULT_MAX_SONS; ///< maximum number of active SONS
|
||||
optional < asset_id_type > hbd_asset = asset_id_type();
|
||||
optional < asset_id_type > hive_asset = asset_id_type();
|
||||
};
|
||||
|
||||
struct chain_parameters
|
||||
|
|
@ -212,6 +214,12 @@ namespace graphene { namespace chain {
|
|||
inline uint16_t maximum_son_count()const {
|
||||
return extensions.value.maximum_son_count.valid() ? *extensions.value.maximum_son_count : GRAPHENE_DEFAULT_MAX_SONS;
|
||||
}
|
||||
inline asset_id_type hbd_asset() const {
|
||||
return extensions.value.hbd_asset.valid() ? *extensions.value.hbd_asset : asset_id_type();
|
||||
}
|
||||
inline asset_id_type hive_asset() const {
|
||||
return extensions.value.hive_asset.valid() ? *extensions.value.hive_asset : asset_id_type();
|
||||
}
|
||||
private:
|
||||
static void safe_copy(chain_parameters& to, const chain_parameters& from);
|
||||
};
|
||||
|
|
@ -247,6 +255,8 @@ FC_REFLECT( graphene::chain::parameter_extension,
|
|||
(son_account)
|
||||
(btc_asset)
|
||||
(maximum_son_count)
|
||||
(hbd_asset)
|
||||
(hive_asset)
|
||||
)
|
||||
|
||||
FC_REFLECT( graphene::chain::chain_parameters,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,86 @@
|
|||
#pragma once
|
||||
#include <graphene/chain/protocol/base.hpp>
|
||||
#include <graphene/chain/protocol/types.hpp>
|
||||
|
||||
namespace graphene
|
||||
{
|
||||
namespace chain
|
||||
{
|
||||
struct nft_lottery_token_purchase_operation : public base_operation
|
||||
{
|
||||
struct fee_parameters_type
|
||||
{
|
||||
uint64_t fee = GRAPHENE_BLOCKCHAIN_PRECISION;
|
||||
};
|
||||
asset fee;
|
||||
// Lottery NFT Metadata
|
||||
nft_metadata_id_type lottery_id;
|
||||
// Buyer purchasing lottery tickets
|
||||
account_id_type buyer;
|
||||
// count of tickets to buy
|
||||
uint64_t tickets_to_buy;
|
||||
// amount that can spent
|
||||
asset amount;
|
||||
|
||||
extensions_type extensions;
|
||||
|
||||
account_id_type fee_payer() const { return buyer; }
|
||||
void validate() const;
|
||||
share_type calculate_fee(const fee_parameters_type &k) const;
|
||||
};
|
||||
|
||||
struct nft_lottery_reward_operation : public base_operation
|
||||
{
|
||||
struct fee_parameters_type
|
||||
{
|
||||
uint64_t fee = GRAPHENE_BLOCKCHAIN_PRECISION;
|
||||
};
|
||||
|
||||
asset fee;
|
||||
// Lottery NFT Metadata
|
||||
nft_metadata_id_type lottery_id;
|
||||
// winner account
|
||||
account_id_type winner;
|
||||
// amount that won
|
||||
asset amount;
|
||||
// percentage of jackpot that user won
|
||||
uint16_t win_percentage;
|
||||
// true if recieved from benefators section of lottery; false otherwise
|
||||
bool is_benefactor_reward;
|
||||
|
||||
uint64_t winner_ticket_id;
|
||||
|
||||
extensions_type extensions;
|
||||
|
||||
account_id_type fee_payer() const { return account_id_type(); }
|
||||
void validate() const {};
|
||||
share_type calculate_fee(const fee_parameters_type &k) const { return k.fee; };
|
||||
};
|
||||
|
||||
struct nft_lottery_end_operation : public base_operation
|
||||
{
|
||||
struct fee_parameters_type
|
||||
{
|
||||
uint64_t fee = GRAPHENE_BLOCKCHAIN_PRECISION;
|
||||
};
|
||||
|
||||
asset fee;
|
||||
// Lottery NFT Metadata
|
||||
nft_metadata_id_type lottery_id;
|
||||
|
||||
extensions_type extensions;
|
||||
|
||||
account_id_type fee_payer() const { return account_id_type(); }
|
||||
void validate() const {}
|
||||
share_type calculate_fee(const fee_parameters_type &k) const { return k.fee; }
|
||||
};
|
||||
|
||||
} // namespace chain
|
||||
} // namespace graphene
|
||||
|
||||
FC_REFLECT(graphene::chain::nft_lottery_token_purchase_operation::fee_parameters_type, (fee))
|
||||
FC_REFLECT(graphene::chain::nft_lottery_reward_operation::fee_parameters_type, (fee))
|
||||
FC_REFLECT(graphene::chain::nft_lottery_end_operation::fee_parameters_type, (fee))
|
||||
FC_REFLECT(graphene::chain::nft_lottery_token_purchase_operation, (fee)(lottery_id)(buyer)(tickets_to_buy)(amount)(extensions))
|
||||
FC_REFLECT(graphene::chain::nft_lottery_reward_operation, (fee)(lottery_id)(winner)(amount)(win_percentage)(is_benefactor_reward)(winner_ticket_id)(extensions))
|
||||
FC_REFLECT(graphene::chain::nft_lottery_end_operation, (fee)(lottery_id)(extensions))
|
||||
|
|
@ -4,6 +4,29 @@
|
|||
|
||||
namespace graphene { namespace chain {
|
||||
|
||||
struct nft_lottery_benefactor {
|
||||
account_id_type id;
|
||||
uint16_t share; // percent * GRAPHENE_1_PERCENT
|
||||
nft_lottery_benefactor() = default;
|
||||
nft_lottery_benefactor( const nft_lottery_benefactor & ) = default;
|
||||
nft_lottery_benefactor( account_id_type _id, uint16_t _share ) : id( _id ), share( _share ) {}
|
||||
};
|
||||
|
||||
struct nft_lottery_options
|
||||
{
|
||||
std::vector<nft_lottery_benefactor> benefactors;
|
||||
// specifying winning tickets as shares that will be issued
|
||||
std::vector<uint16_t> winning_tickets;
|
||||
asset ticket_price;
|
||||
time_point_sec end_date;
|
||||
bool ending_on_soldout;
|
||||
bool is_active;
|
||||
bool delete_tickets_after_draw = false;
|
||||
std::vector<nft_metadata_id_type> progressive_jackpots;
|
||||
|
||||
void validate() const;
|
||||
};
|
||||
|
||||
struct nft_metadata_create_operation : public base_operation
|
||||
{
|
||||
struct fee_parameters_type
|
||||
|
|
@ -23,6 +46,10 @@ namespace graphene { namespace chain {
|
|||
bool is_sellable = true;
|
||||
// Accounts Role
|
||||
optional<account_role_id_type> account_role;
|
||||
// Max number of NFTs that can be minted from the metadata
|
||||
optional<share_type> max_supply;
|
||||
// Lottery configuration
|
||||
optional<nft_lottery_options> lottery_options;
|
||||
extensions_type extensions;
|
||||
|
||||
account_id_type fee_payer()const { return owner; }
|
||||
|
|
@ -133,6 +160,9 @@ namespace graphene { namespace chain {
|
|||
|
||||
} } // graphene::chain
|
||||
|
||||
FC_REFLECT( graphene::chain::nft_lottery_benefactor, (id)(share) )
|
||||
FC_REFLECT( graphene::chain::nft_lottery_options, (benefactors)(winning_tickets)(ticket_price)(end_date)(ending_on_soldout)(is_active)(delete_tickets_after_draw)(progressive_jackpots) )
|
||||
|
||||
FC_REFLECT( graphene::chain::nft_metadata_create_operation::fee_parameters_type, (fee) (price_per_kbyte) )
|
||||
FC_REFLECT( graphene::chain::nft_metadata_update_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::chain::nft_mint_operation::fee_parameters_type, (fee) (price_per_kbyte) )
|
||||
|
|
@ -140,7 +170,7 @@ FC_REFLECT( graphene::chain::nft_safe_transfer_from_operation::fee_parameters_ty
|
|||
FC_REFLECT( graphene::chain::nft_approve_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::chain::nft_set_approval_for_all_operation::fee_parameters_type, (fee) )
|
||||
|
||||
FC_REFLECT( graphene::chain::nft_metadata_create_operation, (fee) (owner) (name) (symbol) (base_uri) (revenue_partner) (revenue_split) (is_transferable) (is_sellable) (account_role) (extensions) )
|
||||
FC_REFLECT( graphene::chain::nft_metadata_create_operation, (fee) (owner) (name) (symbol) (base_uri) (revenue_partner) (revenue_split) (is_transferable) (is_sellable) (account_role) (max_supply) (lottery_options) (extensions) )
|
||||
FC_REFLECT( graphene::chain::nft_metadata_update_operation, (fee) (owner) (nft_metadata_id) (name) (symbol) (base_uri) (revenue_partner) (revenue_split) (is_transferable) (is_sellable) (account_role) (extensions) )
|
||||
FC_REFLECT( graphene::chain::nft_mint_operation, (fee) (payer) (nft_metadata_id) (owner) (approved) (approved_operators) (token_uri) (extensions) )
|
||||
FC_REFLECT( graphene::chain::nft_safe_transfer_from_operation, (fee) (operator_) (from) (to) (token_id) (data) (extensions) )
|
||||
|
|
|
|||
|
|
@ -50,12 +50,14 @@
|
|||
#include <graphene/chain/protocol/offer.hpp>
|
||||
#include <graphene/chain/protocol/nft_ops.hpp>
|
||||
#include <graphene/chain/protocol/account_role.hpp>
|
||||
#include <graphene/chain/protocol/nft_lottery.hpp>
|
||||
#include <graphene/chain/protocol/son.hpp>
|
||||
#include <graphene/chain/protocol/sidechain_address.hpp>
|
||||
#include <graphene/chain/protocol/son_wallet.hpp>
|
||||
#include <graphene/chain/protocol/son_wallet_deposit.hpp>
|
||||
#include <graphene/chain/protocol/son_wallet_withdraw.hpp>
|
||||
#include <graphene/chain/protocol/sidechain_transaction.hpp>
|
||||
#include <graphene/chain/protocol/random_number.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
|
||||
|
|
@ -184,7 +186,11 @@ namespace graphene { namespace chain {
|
|||
sidechain_transaction_create_operation,
|
||||
sidechain_transaction_sign_operation,
|
||||
sidechain_transaction_send_operation,
|
||||
sidechain_transaction_settle_operation
|
||||
sidechain_transaction_settle_operation,
|
||||
nft_lottery_token_purchase_operation,
|
||||
nft_lottery_reward_operation,
|
||||
nft_lottery_end_operation,
|
||||
random_number_store_operation
|
||||
> operation;
|
||||
|
||||
/// @} // operations group
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
#pragma once
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
|
||||
struct random_number_store_operation : public base_operation
|
||||
{
|
||||
struct fee_parameters_type { uint64_t fee = 5000 * GRAPHENE_BLOCKCHAIN_PRECISION; };
|
||||
|
||||
asset fee;
|
||||
|
||||
account_id_type account;
|
||||
vector<uint64_t> random_number;
|
||||
std::string data;
|
||||
|
||||
account_id_type fee_payer()const { return account; }
|
||||
};
|
||||
|
||||
} } // graphene::chain
|
||||
|
||||
FC_REFLECT( graphene::chain::random_number_store_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT( graphene::chain::random_number_store_operation, (fee)
|
||||
(account)
|
||||
(random_number)
|
||||
(data) )
|
||||
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
#include <graphene/chain/protocol/base.hpp>
|
||||
#include <graphene/chain/sidechain_defs.hpp>
|
||||
#include <graphene/chain/son_object.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
|
||||
|
|
@ -32,6 +33,7 @@ namespace graphene { namespace chain {
|
|||
optional<public_key_type> new_signing_key;
|
||||
optional<flat_map<sidechain_type, string>> new_sidechain_public_keys;
|
||||
optional<vesting_balance_id_type> new_pay_vb;
|
||||
optional<son_status> new_status;
|
||||
|
||||
account_id_type fee_payer()const { return owner_account; }
|
||||
share_type calculate_fee(const fee_parameters_type& k)const { return 0; }
|
||||
|
|
@ -103,7 +105,7 @@ FC_REFLECT(graphene::chain::son_create_operation, (fee)(owner_account)(url)(depo
|
|||
|
||||
FC_REFLECT(graphene::chain::son_update_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT(graphene::chain::son_update_operation, (fee)(son_id)(owner_account)(new_url)(new_deposit)
|
||||
(new_signing_key)(new_sidechain_public_keys)(new_pay_vb) )
|
||||
(new_signing_key)(new_sidechain_public_keys)(new_pay_vb)(new_status) )
|
||||
|
||||
FC_REFLECT(graphene::chain::son_deregister_operation::fee_parameters_type, (fee) )
|
||||
FC_REFLECT(graphene::chain::son_deregister_operation, (fee)(son_id)(payer) )
|
||||
|
|
|
|||
|
|
@ -183,6 +183,7 @@ namespace graphene { namespace chain {
|
|||
son_wallet_withdraw_object_type,
|
||||
sidechain_address_object_type,
|
||||
sidechain_transaction_object_type,
|
||||
random_number_object_type,
|
||||
OBJECT_TYPE_COUNT ///< Sentry value which contains the number of different object types
|
||||
};
|
||||
|
||||
|
|
@ -214,7 +215,8 @@ namespace graphene { namespace chain {
|
|||
impl_sweeps_vesting_balance_object_type,
|
||||
impl_offer_history_object_type,
|
||||
impl_son_statistics_object_type,
|
||||
impl_son_schedule_object_type
|
||||
impl_son_schedule_object_type,
|
||||
impl_nft_lottery_balance_object_type
|
||||
};
|
||||
|
||||
//typedef fc::unsigned_int object_id_type;
|
||||
|
|
@ -258,6 +260,7 @@ namespace graphene { namespace chain {
|
|||
class son_wallet_withdraw_object;
|
||||
class sidechain_address_object;
|
||||
class sidechain_transaction_object;
|
||||
class random_number_object;
|
||||
|
||||
typedef object_id< protocol_ids, account_object_type, account_object> account_id_type;
|
||||
typedef object_id< protocol_ids, asset_object_type, asset_object> asset_id_type;
|
||||
|
|
@ -297,6 +300,7 @@ namespace graphene { namespace chain {
|
|||
typedef object_id< protocol_ids, son_wallet_withdraw_object_type, son_wallet_withdraw_object> son_wallet_withdraw_id_type;
|
||||
typedef object_id< protocol_ids, sidechain_address_object_type, sidechain_address_object> sidechain_address_id_type;
|
||||
typedef object_id< protocol_ids, sidechain_transaction_object_type,sidechain_transaction_object> sidechain_transaction_id_type;
|
||||
typedef object_id< protocol_ids, random_number_object_type, random_number_object> random_number_id_type;
|
||||
|
||||
// implementation types
|
||||
class global_property_object;
|
||||
|
|
@ -321,6 +325,7 @@ namespace graphene { namespace chain {
|
|||
class lottery_balance_object;
|
||||
class sweeps_vesting_balance_object;
|
||||
class offer_history_object;
|
||||
class nft_lottery_balance_object;
|
||||
class son_statistics_object;
|
||||
class son_schedule_object;
|
||||
|
||||
|
|
@ -352,6 +357,7 @@ namespace graphene { namespace chain {
|
|||
typedef object_id< implementation_ids, impl_lottery_balance_object_type, lottery_balance_object > lottery_balance_id_type;
|
||||
typedef object_id< implementation_ids, impl_sweeps_vesting_balance_object_type, sweeps_vesting_balance_object> sweeps_vesting_balance_id_type;
|
||||
typedef object_id< implementation_ids, impl_offer_history_object_type, offer_history_object> offer_history_id_type;
|
||||
typedef object_id< implementation_ids, impl_nft_lottery_balance_object_type, nft_lottery_balance_object> nft_lottery_balance_id_type;
|
||||
typedef object_id< implementation_ids, impl_son_statistics_object_type, son_statistics_object > son_statistics_id_type;
|
||||
typedef object_id< implementation_ids, impl_son_schedule_object_type, son_schedule_object> son_schedule_id_type;
|
||||
|
||||
|
|
@ -496,6 +502,7 @@ FC_REFLECT_ENUM( graphene::chain::object_type,
|
|||
(son_wallet_withdraw_object_type)
|
||||
(sidechain_address_object_type)
|
||||
(sidechain_transaction_object_type)
|
||||
(random_number_object_type)
|
||||
(OBJECT_TYPE_COUNT)
|
||||
)
|
||||
FC_REFLECT_ENUM( graphene::chain::impl_object_type,
|
||||
|
|
@ -526,6 +533,7 @@ FC_REFLECT_ENUM( graphene::chain::impl_object_type,
|
|||
(impl_offer_history_object_type)
|
||||
(impl_son_statistics_object_type)
|
||||
(impl_son_schedule_object_type)
|
||||
(impl_nft_lottery_balance_object_type)
|
||||
)
|
||||
|
||||
FC_REFLECT_TYPENAME( graphene::chain::share_type )
|
||||
|
|
@ -575,6 +583,7 @@ FC_REFLECT_TYPENAME( graphene::chain::offer_history_id_type )
|
|||
FC_REFLECT_TYPENAME( graphene::chain::nft_metadata_id_type )
|
||||
FC_REFLECT_TYPENAME( graphene::chain::nft_id_type )
|
||||
FC_REFLECT_TYPENAME( graphene::chain::account_role_id_type )
|
||||
FC_REFLECT_TYPENAME( graphene::chain::nft_lottery_balance_id_type )
|
||||
FC_REFLECT_TYPENAME( graphene::chain::son_id_type )
|
||||
FC_REFLECT_TYPENAME( graphene::chain::son_proposal_id_type )
|
||||
FC_REFLECT_TYPENAME( graphene::chain::son_wallet_id_type )
|
||||
|
|
@ -582,7 +591,7 @@ FC_REFLECT_TYPENAME( graphene::chain::son_wallet_deposit_id_type )
|
|||
FC_REFLECT_TYPENAME( graphene::chain::son_wallet_withdraw_id_type )
|
||||
FC_REFLECT_TYPENAME( graphene::chain::sidechain_address_id_type )
|
||||
FC_REFLECT_TYPENAME( graphene::chain::sidechain_transaction_id_type )
|
||||
|
||||
FC_REFLECT_TYPENAME( graphene::chain::random_number_id_type )
|
||||
|
||||
FC_REFLECT( graphene::chain::void_t, )
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
#pragma once
|
||||
#include <graphene/chain/database.hpp>
|
||||
#include <graphene/chain/evaluator.hpp>
|
||||
#include <graphene/chain/protocol/operations.hpp>
|
||||
#include <graphene/chain/protocol/types.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
|
||||
class random_number_store_evaluator : public evaluator<random_number_store_evaluator>
|
||||
{
|
||||
public:
|
||||
typedef random_number_store_operation operation_type;
|
||||
|
||||
void_result do_evaluate( const random_number_store_operation& o );
|
||||
object_id_type do_apply( const random_number_store_operation& o );
|
||||
};
|
||||
|
||||
} } // graphene::chain
|
||||
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
#pragma once
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
using namespace graphene::db;
|
||||
|
||||
class random_number_object : public abstract_object<random_number_object>
|
||||
{
|
||||
public:
|
||||
static const uint8_t space_id = protocol_ids;
|
||||
static const uint8_t type_id = random_number_object_type;
|
||||
|
||||
account_id_type account; /* account who requested random number */
|
||||
time_point_sec timestamp; /* date and time when the number is read */
|
||||
vector<uint64_t> random_number; /* random number(s) */
|
||||
std::string data; /* custom data in json format */
|
||||
};
|
||||
|
||||
struct by_account;
|
||||
struct by_timestamp;
|
||||
using random_number_multi_index_type = multi_index_container<
|
||||
random_number_object,
|
||||
indexed_by<
|
||||
ordered_unique< tag<by_id>,
|
||||
member<object, object_id_type, &object::id>
|
||||
>,
|
||||
ordered_non_unique< tag<by_account>,
|
||||
member<random_number_object, account_id_type, &random_number_object::account>
|
||||
>,
|
||||
ordered_non_unique< tag<by_timestamp>,
|
||||
member<random_number_object, time_point_sec, &random_number_object::timestamp>
|
||||
>
|
||||
>
|
||||
>;
|
||||
using random_number_index = generic_index<random_number_object, random_number_multi_index_type>;
|
||||
|
||||
} } // graphene::chain
|
||||
|
||||
FC_REFLECT_DERIVED( graphene::chain::random_number_object, (graphene::db::object),
|
||||
(account) (timestamp)
|
||||
(random_number) (data) )
|
||||
|
||||
|
|
@ -57,6 +57,9 @@ namespace graphene
|
|||
case operation::tag<account_role_create_operation>::value:
|
||||
case operation::tag<account_role_update_operation>::value:
|
||||
case operation::tag<account_role_delete_operation>::value:
|
||||
case operation::tag<nft_lottery_token_purchase_operation>::value:
|
||||
case operation::tag<nft_lottery_reward_operation>::value:
|
||||
case operation::tag<nft_lottery_end_operation>::value:
|
||||
FC_ASSERT(block_time >= HARDFORK_NFT_TIME, "Custom permissions and roles not allowed on this operation yet!");
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ enum class sidechain_type {
|
|||
bitcoin,
|
||||
ethereum,
|
||||
eos,
|
||||
peerplays
|
||||
peerplays,
|
||||
hive
|
||||
};
|
||||
|
||||
} }
|
||||
|
|
@ -19,4 +20,5 @@ FC_REFLECT_ENUM(graphene::chain::sidechain_type,
|
|||
(bitcoin)
|
||||
(ethereum)
|
||||
(eos)
|
||||
(hive)
|
||||
(peerplays) )
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@ namespace graphene { namespace chain {
|
|||
static const uint8_t space_id = protocol_ids;
|
||||
static const uint8_t type_id = sidechain_transaction_object_type;
|
||||
|
||||
sidechain_type sidechain;
|
||||
time_point_sec timestamp;
|
||||
sidechain_type sidechain = sidechain_type::unknown;
|
||||
object_id_type object_id;
|
||||
std::string transaction;
|
||||
std::vector<son_info> signers;
|
||||
|
|
@ -37,7 +38,7 @@ namespace graphene { namespace chain {
|
|||
uint32_t current_weight = 0;
|
||||
uint32_t threshold = 0;
|
||||
|
||||
sidechain_transaction_status status;
|
||||
sidechain_transaction_status status = sidechain_transaction_status::invalid;
|
||||
};
|
||||
|
||||
struct by_object_id;
|
||||
|
|
@ -70,6 +71,7 @@ FC_REFLECT_ENUM( graphene::chain::sidechain_transaction_status,
|
|||
(settled) )
|
||||
|
||||
FC_REFLECT_DERIVED( graphene::chain::sidechain_transaction_object, (graphene::db::object ),
|
||||
(timestamp)
|
||||
(sidechain)
|
||||
(object_id)
|
||||
(transaction)
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@ namespace graphene { namespace chain {
|
|||
|
||||
son_id_type owner;
|
||||
// Lifetime total transactions signed
|
||||
uint64_t total_txs_signed = 0;
|
||||
flat_map<sidechain_type, uint64_t> total_txs_signed;
|
||||
// Transactions signed since the last son payouts
|
||||
uint64_t txs_signed = 0;
|
||||
flat_map<sidechain_type, uint64_t> txs_signed;
|
||||
// Total Voted Active time i.e. duration selected as part of voted active SONs
|
||||
uint64_t total_voted_time = 0;
|
||||
// Total Downtime barring the current down time in seconds, used for stats to present to user
|
||||
|
|
@ -47,9 +47,9 @@ namespace graphene { namespace chain {
|
|||
// Deregistered Timestamp
|
||||
fc::time_point_sec deregistered_timestamp;
|
||||
// Total sidechain transactions reported by SON network while SON was active
|
||||
uint64_t total_sidechain_txs_reported = 0;
|
||||
flat_map<sidechain_type, uint64_t> total_sidechain_txs_reported;
|
||||
// Sidechain transactions reported by this SON
|
||||
uint64_t sidechain_txs_reported = 0;
|
||||
flat_map<sidechain_type, uint64_t> sidechain_txs_reported;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -76,6 +76,7 @@ namespace graphene { namespace chain {
|
|||
|
||||
void pay_son_fee(share_type pay, database& db);
|
||||
bool has_valid_config()const;
|
||||
bool has_valid_config(time_point_sec head_block_time)const;
|
||||
};
|
||||
|
||||
struct by_account;
|
||||
|
|
|
|||
|
|
@ -200,6 +200,20 @@ namespace graphene { namespace chain {
|
|||
*/
|
||||
struct by_account;
|
||||
struct by_asset_balance;
|
||||
|
||||
struct by_asset_balance_helper_asset_id {
|
||||
typedef asset_id_type result_type;
|
||||
result_type operator()(const vesting_balance_object& vbo) const {
|
||||
return vbo.balance.asset_id;
|
||||
}
|
||||
};
|
||||
struct by_asset_balance_helper_asset_amount {
|
||||
typedef share_type result_type;
|
||||
result_type operator()(const vesting_balance_object& vbo) const {
|
||||
return vbo.balance.amount;
|
||||
}
|
||||
};
|
||||
|
||||
typedef multi_index_container<
|
||||
vesting_balance_object,
|
||||
indexed_by<
|
||||
|
|
@ -210,11 +224,9 @@ namespace graphene { namespace chain {
|
|||
ordered_non_unique< tag<by_asset_balance>,
|
||||
composite_key<
|
||||
vesting_balance_object,
|
||||
member_offset<vesting_balance_object, asset_id_type, (size_t) (offsetof(vesting_balance_object,balance) + offsetof(asset,asset_id))>,
|
||||
by_asset_balance_helper_asset_id,
|
||||
member<vesting_balance_object, vesting_balance_type, &vesting_balance_object::balance_type>,
|
||||
member_offset<vesting_balance_object, share_type, (size_t) (offsetof(vesting_balance_object,balance) + offsetof(asset,amount))>
|
||||
//member<vesting_balance_object, account_id_type, &vesting_balance_object::owner>
|
||||
//member_offset<vesting_balance_object, account_id_type, (size_t) (offsetof(vesting_balance_object,owner))>
|
||||
by_asset_balance_helper_asset_amount
|
||||
>,
|
||||
composite_key_compare<
|
||||
std::less< asset_id_type >,
|
||||
|
|
|
|||
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2015 Cryptonomex, Inc., and contributors.
|
||||
*
|
||||
* The MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#include <fc/io/raw.hpp>
|
||||
#include <graphene/chain/index.hpp>
|
||||
#include <graphene/chain/database.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
void base_primary_index::save_undo( const object& obj )
|
||||
{ _db.save_undo( obj ); }
|
||||
|
||||
void base_primary_index::on_add( const object& obj )
|
||||
{
|
||||
_db.save_undo_add( obj );
|
||||
for( auto ob : _observers ) ob->on_add( obj );
|
||||
}
|
||||
|
||||
void base_primary_index::on_remove( const object& obj )
|
||||
{ _db.save_undo_remove( obj ); for( auto ob : _observers ) ob->on_remove( obj ); }
|
||||
|
||||
void base_primary_index::on_modify( const object& obj )
|
||||
{for( auto ob : _observers ) ob->on_modify( obj ); }
|
||||
} } // graphene::chain
|
||||
|
|
@ -24,6 +24,26 @@ void_result nft_metadata_create_evaluator::do_evaluate( const nft_metadata_creat
|
|||
const auto& ar_obj = (*op.account_role)(db());
|
||||
FC_ASSERT(ar_obj.owner == op.owner, "Only the Account Role created by the owner can be attached");
|
||||
}
|
||||
|
||||
// Lottery Related
|
||||
if (!op.lottery_options) {
|
||||
return void_result();
|
||||
}
|
||||
FC_ASSERT((*op.lottery_options).end_date > now || (*op.lottery_options).end_date == time_point_sec());
|
||||
if (op.max_supply) {
|
||||
FC_ASSERT(*op.max_supply >= 5);
|
||||
}
|
||||
|
||||
for(auto lottery_id: (*op.lottery_options).progressive_jackpots) {
|
||||
const auto& lottery_obj = lottery_id(db());
|
||||
FC_ASSERT(lottery_obj.owner == op.owner, "Only the Owner can attach progressive jackpots");
|
||||
FC_ASSERT(lottery_obj.is_lottery(), "Only lottery objects can be attached as progressive jackpots");
|
||||
FC_ASSERT(lottery_obj.lottery_data->lottery_options.is_active == false, "Lottery should not be active");
|
||||
FC_ASSERT(lottery_obj.lottery_data->lottery_options.ticket_price.asset_id == (*op.lottery_options).ticket_price.asset_id, "Lottery asset type should be same");
|
||||
const auto& lottery_balance_obj = lottery_obj.lottery_data->lottery_balance_id(db());
|
||||
FC_ASSERT(lottery_balance_obj.jackpot.amount > 0, "Non zero progressive jackpot not allowed");
|
||||
}
|
||||
|
||||
return void_result();
|
||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||
|
||||
|
|
@ -39,6 +59,26 @@ object_id_type nft_metadata_create_evaluator::do_apply( const nft_metadata_creat
|
|||
obj.is_transferable = op.is_transferable;
|
||||
obj.is_sellable = op.is_sellable;
|
||||
obj.account_role = op.account_role;
|
||||
if (op.max_supply) {
|
||||
obj.max_supply = *op.max_supply;
|
||||
}
|
||||
if (op.lottery_options) {
|
||||
asset jackpot_sum(0,(*op.lottery_options).ticket_price.asset_id);
|
||||
for(auto lottery_id: (*op.lottery_options).progressive_jackpots) {
|
||||
const auto& lottery_obj = lottery_id(db());
|
||||
const auto& lottery_balance_obj = lottery_obj.lottery_data->lottery_balance_id(db());
|
||||
FC_ASSERT(lottery_balance_obj.jackpot.amount > 0, "Non zero progressive jackpot not allowed");
|
||||
db().modify(lottery_balance_obj, [&] ( nft_lottery_balance_object& nlbo ) {
|
||||
jackpot_sum += nlbo.jackpot;
|
||||
nlbo.jackpot -= nlbo.jackpot;
|
||||
});
|
||||
}
|
||||
const auto& new_lottery_balance_obj = db().create<nft_lottery_balance_object>([&](nft_lottery_balance_object& nlbo) {
|
||||
nlbo.total_progressive_jackpot = jackpot_sum;
|
||||
nlbo.jackpot = jackpot_sum;
|
||||
});
|
||||
obj.lottery_data = nft_lottery_data(*op.lottery_options, new_lottery_balance_obj.id);
|
||||
}
|
||||
});
|
||||
return new_nft_metadata_object.id;
|
||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||
|
|
@ -110,6 +150,7 @@ void_result nft_mint_evaluator::do_evaluate( const nft_mint_operation& op )
|
|||
FC_ASSERT( itr_nft_md != idx_nft_md.end(), "NFT metadata not found" );
|
||||
FC_ASSERT( itr_nft_md->owner == op.payer, "Only metadata owner can mint NFT" );
|
||||
|
||||
FC_ASSERT(itr_nft_md->get_token_current_supply(db()) < itr_nft_md->max_supply, "NFTs can't be minted more than max_supply");
|
||||
return void_result();
|
||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||
|
||||
|
|
|
|||
145
libraries/chain/nft_lottery_evaluator.cpp
Normal file
145
libraries/chain/nft_lottery_evaluator.cpp
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
#include <graphene/chain/nft_lottery_evaluator.hpp>
|
||||
#include <graphene/chain/nft_object.hpp>
|
||||
#include <graphene/chain/protocol/operations.hpp>
|
||||
#include <graphene/chain/account_role_object.hpp>
|
||||
#include <graphene/chain/hardfork.hpp>
|
||||
|
||||
namespace graphene
|
||||
{
|
||||
namespace chain
|
||||
{
|
||||
void_result nft_lottery_token_purchase_evaluator::do_evaluate(const nft_lottery_token_purchase_operation &op)
|
||||
{
|
||||
try
|
||||
{
|
||||
const database &d = db();
|
||||
auto now = d.head_block_time();
|
||||
FC_ASSERT(now >= HARDFORK_NFT_TIME, "Not allowed until NFT HF");
|
||||
op.buyer(d);
|
||||
const auto &lottery_md_obj = op.lottery_id(d);
|
||||
FC_ASSERT(lottery_md_obj.is_lottery(), "Not a lottery type");
|
||||
if (lottery_md_obj.account_role)
|
||||
{
|
||||
const auto &ar_idx = d.get_index_type<account_role_index>().indices().get<by_id>();
|
||||
auto ar_itr = ar_idx.find(*lottery_md_obj.account_role);
|
||||
if (ar_itr != ar_idx.end())
|
||||
{
|
||||
FC_ASSERT(d.account_role_valid(*ar_itr, op.buyer, get_type()), "Account role not valid");
|
||||
}
|
||||
}
|
||||
|
||||
auto lottery_options = lottery_md_obj.lottery_data->lottery_options;
|
||||
FC_ASSERT(lottery_options.ticket_price.asset_id == op.amount.asset_id);
|
||||
FC_ASSERT((double)op.amount.amount.value / lottery_options.ticket_price.amount.value == (double)op.tickets_to_buy);
|
||||
return void_result();
|
||||
}
|
||||
FC_CAPTURE_AND_RETHROW((op))
|
||||
}
|
||||
|
||||
object_id_type nft_lottery_token_purchase_evaluator::do_apply(const nft_lottery_token_purchase_operation &op)
|
||||
{
|
||||
try
|
||||
{
|
||||
transaction_evaluation_state nft_mint_context(&db());
|
||||
nft_mint_context.skip_fee_schedule_check = true;
|
||||
const auto &lottery_md_obj = op.lottery_id(db());
|
||||
nft_id_type nft_id;
|
||||
for (size_t i = 0; i < op.tickets_to_buy; i++)
|
||||
{
|
||||
nft_mint_operation mint_op;
|
||||
mint_op.payer = lottery_md_obj.owner;
|
||||
mint_op.nft_metadata_id = lottery_md_obj.id;
|
||||
mint_op.owner = op.buyer;
|
||||
nft_id = db().apply_operation(nft_mint_context, mint_op).get<object_id_type>();
|
||||
}
|
||||
db().adjust_balance(op.buyer, -op.amount);
|
||||
db().modify(lottery_md_obj.lottery_data->lottery_balance_id(db()), [&](nft_lottery_balance_object &obj) {
|
||||
obj.jackpot += op.amount;
|
||||
});
|
||||
return nft_id;
|
||||
}
|
||||
FC_CAPTURE_AND_RETHROW((op))
|
||||
}
|
||||
|
||||
void_result nft_lottery_reward_evaluator::do_evaluate(const nft_lottery_reward_operation &op)
|
||||
{
|
||||
try
|
||||
{
|
||||
const database &d = db();
|
||||
auto now = d.head_block_time();
|
||||
FC_ASSERT(now >= HARDFORK_NFT_TIME, "Not allowed until NFT HF");
|
||||
op.winner(d);
|
||||
|
||||
const auto &lottery_md_obj = op.lottery_id(d);
|
||||
FC_ASSERT(lottery_md_obj.is_lottery());
|
||||
|
||||
const auto &lottery_options = lottery_md_obj.lottery_data->lottery_options;
|
||||
FC_ASSERT(lottery_options.is_active);
|
||||
FC_ASSERT(lottery_md_obj.get_lottery_jackpot(d) >= op.amount);
|
||||
return void_result();
|
||||
}
|
||||
FC_CAPTURE_AND_RETHROW((op))
|
||||
}
|
||||
|
||||
void_result nft_lottery_reward_evaluator::do_apply(const nft_lottery_reward_operation &op)
|
||||
{
|
||||
try
|
||||
{
|
||||
const auto &lottery_md_obj = op.lottery_id(db());
|
||||
db().adjust_balance(op.winner, op.amount);
|
||||
db().modify(lottery_md_obj.lottery_data->lottery_balance_id(db()), [&](nft_lottery_balance_object &obj) {
|
||||
obj.jackpot -= op.amount;
|
||||
});
|
||||
return void_result();
|
||||
}
|
||||
FC_CAPTURE_AND_RETHROW((op))
|
||||
}
|
||||
|
||||
void_result nft_lottery_end_evaluator::do_evaluate(const nft_lottery_end_operation &op)
|
||||
{
|
||||
try
|
||||
{
|
||||
const database &d = db();
|
||||
auto now = d.head_block_time();
|
||||
FC_ASSERT(now >= HARDFORK_NFT_TIME, "Not allowed until NFT HF");
|
||||
const auto &lottery_md_obj = op.lottery_id(d);
|
||||
FC_ASSERT(lottery_md_obj.is_lottery());
|
||||
|
||||
const auto &lottery_options = lottery_md_obj.lottery_data->lottery_options;
|
||||
FC_ASSERT(lottery_options.is_active);
|
||||
FC_ASSERT(lottery_md_obj.get_lottery_jackpot(d).amount == 0);
|
||||
return void_result();
|
||||
}
|
||||
FC_CAPTURE_AND_RETHROW((op))
|
||||
}
|
||||
|
||||
void_result nft_lottery_end_evaluator::do_apply(const nft_lottery_end_operation &op)
|
||||
{
|
||||
try
|
||||
{
|
||||
const auto &lottery_md_obj = op.lottery_id(db());
|
||||
db().modify(lottery_md_obj, [&](nft_metadata_object &obj) {
|
||||
obj.lottery_data->lottery_options.is_active = false;
|
||||
});
|
||||
db().modify(lottery_md_obj.lottery_data->lottery_balance_id(db()), [&](nft_lottery_balance_object &obj) {
|
||||
obj.sweeps_tickets_sold = lottery_md_obj.get_token_current_supply(db());
|
||||
});
|
||||
|
||||
if (lottery_md_obj.lottery_data->lottery_options.delete_tickets_after_draw)
|
||||
{
|
||||
const auto &nft_index_by_md = db().get_index_type<nft_index>().indices().get<by_metadata>();
|
||||
auto delete_nft_itr = nft_index_by_md.lower_bound(op.lottery_id);
|
||||
while (delete_nft_itr != nft_index_by_md.end() && delete_nft_itr->nft_metadata_id == op.lottery_id)
|
||||
{
|
||||
const nft_object &nft_obj = *delete_nft_itr;
|
||||
++delete_nft_itr;
|
||||
db().remove(nft_obj);
|
||||
}
|
||||
}
|
||||
|
||||
return void_result();
|
||||
}
|
||||
FC_CAPTURE_AND_RETHROW((op))
|
||||
}
|
||||
} // namespace chain
|
||||
} // namespace graphene
|
||||
171
libraries/chain/nft_lottery_object.cpp
Normal file
171
libraries/chain/nft_lottery_object.cpp
Normal file
|
|
@ -0,0 +1,171 @@
|
|||
#include <graphene/chain/database.hpp>
|
||||
#include <graphene/chain/nft_object.hpp>
|
||||
|
||||
namespace graphene
|
||||
{
|
||||
namespace chain
|
||||
{
|
||||
time_point_sec nft_metadata_object::get_lottery_expiration() const
|
||||
{
|
||||
if (lottery_data)
|
||||
return lottery_data->lottery_options.end_date;
|
||||
return time_point_sec();
|
||||
}
|
||||
|
||||
asset nft_metadata_object::get_lottery_jackpot(const database &db) const
|
||||
{
|
||||
if (lottery_data)
|
||||
return lottery_data->lottery_balance_id(db).jackpot;
|
||||
return asset();
|
||||
}
|
||||
|
||||
share_type nft_metadata_object::get_token_current_supply(const database &db) const
|
||||
{
|
||||
share_type current_supply;
|
||||
const auto &idx_lottery_by_md = db.get_index_type<nft_index>().indices().get<by_metadata>();
|
||||
auto lottery_range = idx_lottery_by_md.equal_range(id);
|
||||
current_supply = std::distance(lottery_range.first, lottery_range.second);
|
||||
return current_supply;
|
||||
}
|
||||
|
||||
vector<account_id_type> nft_metadata_object::get_holders(const database &db) const
|
||||
{
|
||||
const auto &idx_lottery_by_md = db.get_index_type<nft_index>().indices().get<by_metadata>();
|
||||
auto lottery_range = idx_lottery_by_md.equal_range(id);
|
||||
vector<account_id_type> holders;
|
||||
holders.reserve(std::distance(lottery_range.first, lottery_range.second));
|
||||
std::for_each(lottery_range.first, lottery_range.second,
|
||||
[&](const nft_object &ticket) {
|
||||
holders.emplace_back(ticket.owner);
|
||||
});
|
||||
return holders;
|
||||
}
|
||||
|
||||
vector<uint64_t> nft_metadata_object::get_ticket_ids(const database &db) const
|
||||
{
|
||||
const auto &idx_lottery_by_md = db.get_index_type<nft_index>().indices().get<by_metadata>();
|
||||
auto lottery_range = idx_lottery_by_md.equal_range(id);
|
||||
vector<uint64_t> tickets;
|
||||
tickets.reserve(std::distance(lottery_range.first, lottery_range.second));
|
||||
std::for_each(lottery_range.first, lottery_range.second,
|
||||
[&](const nft_object &ticket) {
|
||||
tickets.emplace_back(ticket.id.instance());
|
||||
});
|
||||
return tickets;
|
||||
}
|
||||
|
||||
void nft_metadata_object::distribute_benefactors_part(database &db)
|
||||
{
|
||||
transaction_evaluation_state eval(&db);
|
||||
const auto &lottery_options = lottery_data->lottery_options;
|
||||
share_type jackpot = lottery_options.ticket_price.amount * get_token_current_supply(db) + lottery_data->lottery_balance_id(db).total_progressive_jackpot.amount;
|
||||
|
||||
for (auto benefactor : lottery_options.benefactors)
|
||||
{
|
||||
nft_lottery_reward_operation reward_op;
|
||||
reward_op.lottery_id = id;
|
||||
reward_op.winner = benefactor.id;
|
||||
reward_op.is_benefactor_reward = true;
|
||||
reward_op.win_percentage = benefactor.share;
|
||||
reward_op.amount = asset(jackpot.value * benefactor.share / GRAPHENE_100_PERCENT, lottery_options.ticket_price.asset_id);
|
||||
db.apply_operation(eval, reward_op);
|
||||
}
|
||||
}
|
||||
|
||||
map<account_id_type, vector<uint16_t>> nft_metadata_object::distribute_winners_part(database &db)
|
||||
{
|
||||
transaction_evaluation_state eval(&db);
|
||||
auto current_supply = get_token_current_supply(db);
|
||||
auto &lottery_options = lottery_data->lottery_options;
|
||||
|
||||
auto holders = get_holders(db);
|
||||
vector<uint64_t> ticket_ids = get_ticket_ids(db);
|
||||
FC_ASSERT(current_supply.value == (int64_t)holders.size());
|
||||
FC_ASSERT(get_lottery_jackpot(db).amount.value == current_supply.value * lottery_options.ticket_price.amount.value);
|
||||
map<account_id_type, vector<uint16_t>> structurized_participants;
|
||||
for (account_id_type holder : holders)
|
||||
{
|
||||
if (!structurized_participants.count(holder))
|
||||
structurized_participants.emplace(holder, vector<uint16_t>());
|
||||
}
|
||||
uint64_t jackpot = get_lottery_jackpot(db).amount.value;
|
||||
auto selections = lottery_options.winning_tickets.size() <= holders.size() ? lottery_options.winning_tickets.size() : holders.size();
|
||||
auto winner_numbers = db.get_random_numbers(0, holders.size(), selections, false);
|
||||
|
||||
auto &tickets(lottery_options.winning_tickets);
|
||||
|
||||
if (holders.size() < tickets.size())
|
||||
{
|
||||
uint16_t percents_to_distribute = 0;
|
||||
for (auto i = tickets.begin() + holders.size(); i != tickets.end();)
|
||||
{
|
||||
percents_to_distribute += *i;
|
||||
i = tickets.erase(i);
|
||||
}
|
||||
for (auto t = tickets.begin(); t != tickets.begin() + holders.size(); ++t)
|
||||
*t += percents_to_distribute / holders.size();
|
||||
}
|
||||
auto sweeps_distribution_percentage = db.get_global_properties().parameters.sweeps_distribution_percentage();
|
||||
for (size_t c = 0; c < winner_numbers.size(); ++c)
|
||||
{
|
||||
auto winner_num = winner_numbers[c];
|
||||
nft_lottery_reward_operation reward_op;
|
||||
reward_op.lottery_id = id;
|
||||
reward_op.is_benefactor_reward = false;
|
||||
reward_op.winner = holders[winner_num];
|
||||
if (ticket_ids.size() > winner_num)
|
||||
{
|
||||
reward_op.winner_ticket_id = ticket_ids[winner_num];
|
||||
}
|
||||
reward_op.win_percentage = tickets[c];
|
||||
reward_op.amount = asset(jackpot * tickets[c] * (1. - sweeps_distribution_percentage / (double)GRAPHENE_100_PERCENT) / GRAPHENE_100_PERCENT, lottery_options.ticket_price.asset_id);
|
||||
db.apply_operation(eval, reward_op);
|
||||
|
||||
structurized_participants[holders[winner_num]].push_back(tickets[c]);
|
||||
}
|
||||
return structurized_participants;
|
||||
}
|
||||
|
||||
void nft_metadata_object::distribute_sweeps_holders_part(database &db)
|
||||
{
|
||||
transaction_evaluation_state eval(&db);
|
||||
auto &asset_bal_idx = db.get_index_type<account_balance_index>().indices().get<by_asset_balance>();
|
||||
auto sweeps_params = db.get_global_properties().parameters;
|
||||
uint64_t distribution_asset_supply = sweeps_params.sweeps_distribution_asset()(db).dynamic_data(db).current_supply.value;
|
||||
const auto range = asset_bal_idx.equal_range(boost::make_tuple(sweeps_params.sweeps_distribution_asset()));
|
||||
asset remaining_jackpot = get_lottery_jackpot(db);
|
||||
uint64_t holders_sum = 0;
|
||||
for (const account_balance_object &holder_balance : boost::make_iterator_range(range.first, range.second))
|
||||
{
|
||||
int64_t holder_part = remaining_jackpot.amount.value / (double)distribution_asset_supply * holder_balance.balance.value * SWEEPS_VESTING_BALANCE_MULTIPLIER;
|
||||
db.adjust_sweeps_vesting_balance(holder_balance.owner, holder_part);
|
||||
holders_sum += holder_part;
|
||||
}
|
||||
uint64_t balance_rest = remaining_jackpot.amount.value * SWEEPS_VESTING_BALANCE_MULTIPLIER - holders_sum;
|
||||
db.adjust_sweeps_vesting_balance(sweeps_params.sweeps_vesting_accumulator_account(), balance_rest);
|
||||
db.modify(lottery_data->lottery_balance_id(db), [&](nft_lottery_balance_object &obj) {
|
||||
obj.jackpot -= remaining_jackpot;
|
||||
});
|
||||
}
|
||||
|
||||
void nft_metadata_object::end_lottery(database &db)
|
||||
{
|
||||
transaction_evaluation_state eval(&db);
|
||||
const auto &lottery_options = lottery_data->lottery_options;
|
||||
|
||||
FC_ASSERT(is_lottery());
|
||||
FC_ASSERT(lottery_options.is_active && (lottery_options.end_date <= db.head_block_time() || lottery_options.ending_on_soldout));
|
||||
|
||||
auto participants = distribute_winners_part(db);
|
||||
if (participants.size() > 0)
|
||||
{
|
||||
distribute_benefactors_part(db);
|
||||
distribute_sweeps_holders_part(db);
|
||||
}
|
||||
|
||||
nft_lottery_end_operation end_op;
|
||||
end_op.lottery_id = get_id();
|
||||
db.apply_operation(eval, end_op);
|
||||
}
|
||||
} // namespace chain
|
||||
} // namespace graphene
|
||||
|
|
@ -219,6 +219,18 @@ struct proposal_operation_hardfork_visitor
|
|||
FC_ASSERT( block_time >= HARDFORK_NFT_TIME, "account_role_delete_operation not allowed yet!" );
|
||||
}
|
||||
|
||||
void operator()(const nft_lottery_token_purchase_operation &v) const {
|
||||
FC_ASSERT( block_time >= HARDFORK_NFT_TIME, "nft_lottery_token_purchase_operation not allowed yet!" );
|
||||
}
|
||||
|
||||
void operator()(const nft_lottery_reward_operation &v) const {
|
||||
FC_ASSERT( block_time >= HARDFORK_NFT_TIME, "nft_lottery_reward_operation not allowed yet!" );
|
||||
}
|
||||
|
||||
void operator()(const nft_lottery_end_operation &v) const {
|
||||
FC_ASSERT( block_time >= HARDFORK_NFT_TIME, "nft_lottery_end_operation not allowed yet!" );
|
||||
}
|
||||
|
||||
void operator()(const son_create_operation &v) const {
|
||||
FC_ASSERT( block_time >= HARDFORK_SON_TIME, "son_create_operation not allowed yet!" );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2018 Peerplays Blockchain Standards Association, and contributors.
|
||||
*
|
||||
* The MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#include <graphene/chain/protocol/competitor.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
|
||||
void competitor_create_operation::validate() const
|
||||
{
|
||||
FC_ASSERT( fee.amount >= 0 );
|
||||
}
|
||||
|
||||
|
||||
} } // graphene::chain
|
||||
|
||||
|
|
@ -30,7 +30,10 @@ namespace graphene { namespace chain {
|
|||
void memo_data::set_message(const fc::ecc::private_key& priv, const fc::ecc::public_key& pub,
|
||||
const string& msg, uint64_t custom_nonce)
|
||||
{
|
||||
if( priv != fc::ecc::private_key() && public_key_type(pub) != public_key_type() )
|
||||
bool should_encrypt = (priv != fc::ecc::private_key() && pub.valid());
|
||||
should_encrypt = (should_encrypt) && (msg.size()) && (msg.find("#") == 0);
|
||||
|
||||
if( should_encrypt )
|
||||
{
|
||||
from = priv.get_public_key();
|
||||
to = pub;
|
||||
|
|
@ -49,6 +52,7 @@ void memo_data::set_message(const fc::ecc::private_key& priv, const fc::ecc::pub
|
|||
}
|
||||
else
|
||||
{
|
||||
to = public_key_type();
|
||||
auto text = memo_message(0, msg).serialize();
|
||||
message = vector<char>(text.begin(), text.end());
|
||||
}
|
||||
|
|
@ -57,7 +61,7 @@ void memo_data::set_message(const fc::ecc::private_key& priv, const fc::ecc::pub
|
|||
string memo_data::get_message(const fc::ecc::private_key& priv,
|
||||
const fc::ecc::public_key& pub)const
|
||||
{
|
||||
if( from != public_key_type() )
|
||||
if( from != public_key_type() && to != public_key_type() && pub.valid() )
|
||||
{
|
||||
auto secret = priv.get_shared_secret(pub);
|
||||
auto nonce_plus_secret = fc::sha512::hash(fc::to_string(nonce) + secret.str());
|
||||
|
|
|
|||
|
|
@ -45,6 +45,10 @@ void nft_metadata_create_operation::validate() const
|
|||
FC_ASSERT(fee.amount >= 0, "Fee must not be negative");
|
||||
FC_ASSERT(is_valid_nft_token_name(name), "Invalid NFT name provided");
|
||||
FC_ASSERT(is_valid_nft_token_name(symbol), "Invalid NFT symbol provided");
|
||||
if (lottery_options)
|
||||
{
|
||||
(*lottery_options).validate();
|
||||
}
|
||||
}
|
||||
|
||||
void nft_metadata_update_operation::validate() const
|
||||
|
|
|
|||
38
libraries/chain/protocol/nft_lottery.cpp
Normal file
38
libraries/chain/protocol/nft_lottery.cpp
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#include <graphene/chain/protocol/nft_ops.hpp>
|
||||
#include <graphene/chain/protocol/nft_lottery.hpp>
|
||||
#include <graphene/chain/protocol/operations.hpp>
|
||||
|
||||
namespace graphene
|
||||
{
|
||||
namespace chain
|
||||
{
|
||||
|
||||
void nft_lottery_options::validate() const
|
||||
{
|
||||
FC_ASSERT(winning_tickets.size() <= 64);
|
||||
FC_ASSERT(ticket_price.amount >= 1);
|
||||
uint16_t total = 0;
|
||||
for (auto benefactor : benefactors)
|
||||
{
|
||||
total += benefactor.share;
|
||||
}
|
||||
for (auto share : winning_tickets)
|
||||
{
|
||||
total += share;
|
||||
}
|
||||
FC_ASSERT(total == GRAPHENE_100_PERCENT, "distribution amount not equals GRAPHENE_100_PERCENT");
|
||||
FC_ASSERT(ending_on_soldout == true || end_date != time_point_sec(), "lottery may not end");
|
||||
}
|
||||
|
||||
share_type nft_lottery_token_purchase_operation::calculate_fee(const fee_parameters_type &k) const
|
||||
{
|
||||
return k.fee;
|
||||
}
|
||||
|
||||
void nft_lottery_token_purchase_operation::validate() const
|
||||
{
|
||||
FC_ASSERT(fee.amount >= 0, "Fee must not be negative");
|
||||
FC_ASSERT(tickets_to_buy > 0);
|
||||
}
|
||||
} // namespace chain
|
||||
} // namespace graphene
|
||||
24
libraries/chain/random_number_evaluator.cpp
Normal file
24
libraries/chain/random_number_evaluator.cpp
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#include <graphene/chain/random_number_evaluator.hpp>
|
||||
#include <graphene/chain/random_number_object.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
|
||||
void_result random_number_store_evaluator::do_evaluate( const random_number_store_operation& op )
|
||||
{ try {
|
||||
|
||||
return void_result();
|
||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||
|
||||
object_id_type random_number_store_evaluator::do_apply( const random_number_store_operation& op )
|
||||
{ try {
|
||||
const auto& new_random_number_object = db().create<random_number_object>( [&]( random_number_object& obj ) {
|
||||
obj.account = op.account;
|
||||
obj.timestamp = db().head_block_time();
|
||||
obj.random_number = op.random_number;
|
||||
obj.data = op.data;
|
||||
});
|
||||
return new_random_number_object.id;
|
||||
} FC_CAPTURE_AND_RETHROW( (op) ) }
|
||||
|
||||
} } // graphene::chain
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue