diff --git a/.gitmodules b/.gitmodules index 609a2c93..120307b8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "cyberway.contracts"] path = cyberway.contracts url = https://github.com/cyberway/cyberway.contracts +[submodule "scripts/deployutils"] + path = scripts/deployutils + url = https://github.com/cyberway/deployutils.git diff --git a/CMakeLists.txt b/CMakeLists.txt index def5f639..e16692c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,17 @@ macro(install_contract TARGET) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}.abi DESTINATION ${CMAKE_INSTALL_PREFIX}/${TARGET}/) endmacro() +macro(add_contract_with_checked_abi CONTRACT_NAME TARGET ABIFILE) + add_contract(${CONTRACT_NAME} ${TARGET} ${ARGN}) + get_target_property(BINOUTPUT ${TARGET}.wasm BINARY_DIR) + add_custom_command(TARGET ${TARGET}.wasm POST_BUILD + COMMAND ${PROJECT_SOURCE_DIR}/scripts/deployutils/abiprinter.py <${BINOUTPUT}/${TARGET}.abi >${BINOUTPUT}/${TARGET}.abi.pretty) + add_custom_target(${TARGET}.abicheck ALL + COMMAND ${CYBERWAY_ABIDIFF} ${CMAKE_CURRENT_SOURCE_DIR}/${ABIFILE} ${BINOUTPUT}/${TARGET}.abi + DEPENDS ${TARGET}.wasm ${ABIFILE} + ) +endmacro() + macro(add_contract_with_abi TARGET ABIFILE) add_executable( ${TARGET}.wasm ${ARGN} ) target_compile_options( ${TARGET}.wasm PUBLIC -std=c++17) @@ -65,6 +76,7 @@ if (NOT DEFINED VESTING_NAME) endif(NOT DEFINED VESTING_NAME) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/common/config.hpp.in ${CMAKE_CURRENT_SOURCE_DIR}/common/config.hpp) +set(CYBERWAY_ABIDIFF ${CYBERWAY_CDT_ROOT}/bin/cyberway-abidiff) # include_directories(AFTER ${BOOST_ROOT}/include) add_subdirectory(golos.ctrl) diff --git a/golos.charge/CMakeLists.txt b/golos.charge/CMakeLists.txt index d7ef37ad..b18f72e7 100644 --- a/golos.charge/CMakeLists.txt +++ b/golos.charge/CMakeLists.txt @@ -1,4 +1,4 @@ -add_contract(golos.charge golos.charge golos.charge.cpp) +add_contract_with_checked_abi(golos.charge golos.charge golos.charge.abi golos.charge.cpp) install_contract(golos.charge) target_include_directories(golos.charge.wasm PUBLIC diff --git a/golos.charge/golos.charge.abi b/golos.charge/golos.charge.abi new file mode 100644 index 00000000..092eded0 --- /dev/null +++ b/golos.charge/golos.charge.abi @@ -0,0 +1,151 @@ +{ + "____comment": "This file was generated with eosio-abigen. DO NOT EDIT ", + "version": "cyberway::abi/1.1", + "types": [ + {"new_type_name": "base_t", "type": "int64"}, + {"new_type_name": "enum_t", "type": "uint8"}, + {"new_type_name": "index_t", "type": "uint64"} + ], + "structs": [{ + "name": "balance", "base": "", + "fields": [ + {"name": "charge_symbol", "type": "uint64"}, + {"name": "token_code", "type": "symbol_code"}, + {"name": "charge_id", "type": "uint8"}, + {"name": "last_update", "type": "uint64"}, + {"name": "value", "type": "base_t"} + ] + }, { + "name": "bytecode", "base": "", + "fields": [ + {"name": "varssize", "type": "index_t"}, + {"name": "operators", "type": "index_t[]"}, + {"name": "values", "type": "value[]"}, + {"name": "nums", "type": "base_t[]"}, + {"name": "consts", "type": "base_t[]"} + ] + }, { + "name": "chargestate", "base": "", + "fields": [ + {"name": "user", "type": "name"}, + {"name": "charge_symbol", "type": "uint64"}, + {"name": "token_code", "type": "symbol_code"}, + {"name": "charge_id", "type": "uint8"}, + {"name": "last_update", "type": "uint64"}, + {"name": "value", "type": "base_t"} + ] + }, { + "name": "restorer", "base": "", + "fields": [ + {"name": "charge_symbol", "type": "uint64"}, + {"name": "token_code", "type": "symbol_code"}, + {"name": "charge_id", "type": "uint8"}, + {"name": "func", "type": "bytecode"}, + {"name": "max_prev", "type": "base_t"}, + {"name": "max_vesting", "type": "base_t"}, + {"name": "max_elapsed", "type": "base_t"} + ] + }, { + "name": "setrestorer", "base": "", + "fields": [ + {"name": "token_code", "type": "symbol_code"}, + {"name": "charge_id", "type": "uint8"}, + {"name": "func_str", "type": "string"}, + {"name": "max_prev", "type": "int64"}, + {"name": "max_vesting", "type": "int64"}, + {"name": "max_elapsed", "type": "int64"} + ] + }, { + "name": "stored", "base": "", + "fields": [ + {"name": "id", "type": "uint64"}, + {"name": "symbol_stamp", "type": "uint128"}, + {"name": "value", "type": "base_t"} + ] + }, { + "name": "use", "base": "", + "fields": [ + {"name": "user", "type": "name"}, + {"name": "token_code", "type": "symbol_code"}, + {"name": "charge_id", "type": "uint8"}, + {"name": "price", "type": "int64"}, + {"name": "cutoff", "type": "int64"}, + {"name": "vesting_price", "type": "int64"} + ] + }, { + "name": "usenotifygt", "base": "", + "fields": [ + {"name": "user", "type": "name"}, + {"name": "token_code", "type": "symbol_code"}, + {"name": "charge_id", "type": "uint8"}, + {"name": "price_arg", "type": "int64"}, + {"name": "id", "type": "int64"}, + {"name": "code", "type": "name"}, + {"name": "action_name", "type": "name"}, + {"name": "cutoff", "type": "int64"} + ] + }, { + "name": "usenotifylt", "base": "", + "fields": [ + {"name": "user", "type": "name"}, + {"name": "token_code", "type": "symbol_code"}, + {"name": "charge_id", "type": "uint8"}, + {"name": "price_arg", "type": "int64"}, + {"name": "id", "type": "int64"}, + {"name": "code", "type": "name"}, + {"name": "action_name", "type": "name"}, + {"name": "cutoff", "type": "int64"} + ] + }, { + "name": "value", "base": "", + "fields": [ + {"name": "kind", "type": "enum_t"}, + {"name": "idx", "type": "index_t"} + ] + } + ], + "actions": [ + {"name": "setrestorer", "type": "setrestorer"}, + {"name": "use", "type": "use"}, + {"name": "usenotifygt", "type": "usenotifygt"}, + {"name": "usenotifylt", "type": "usenotifylt"} + ], + "events": [ + {"name": "chargestate", "type": "chargestate"} + ], + "tables": [{ + "name": "balances", "type": "balance", + "indexes": [{ + "name": "primary", "unique": true, + "orders": [ + {"field": "charge_symbol", "order": "asc"} + ] + } + ] + }, { + "name": "restorers", "type": "restorer", + "indexes": [{ + "name": "primary", "unique": true, + "orders": [ + {"field": "charge_symbol", "order": "asc"} + ] + } + ] + }, { + "name": "storedvals", "type": "stored", + "indexes": [{ + "name": "primary", "unique": true, + "orders": [ + {"field": "id", "order": "asc"} + ] + }, { + "name": "symbolstamp", "unique": true, + "orders": [ + {"field": "symbol_stamp", "order": "asc"} + ] + } + ] + } + ], + "variants": [] +} diff --git a/golos.config/CMakeLists.txt b/golos.config/CMakeLists.txt index 5e8e2570..1097a691 100644 --- a/golos.config/CMakeLists.txt +++ b/golos.config/CMakeLists.txt @@ -1,4 +1,4 @@ -add_contract(golos.config golos.config src/golos.config.cpp) +add_contract_with_checked_abi(golos.config golos.config golos.config.abi src/golos.config.cpp) install_contract(golos.config) target_include_directories(golos.config.wasm PUBLIC diff --git a/golos.config/golos.config.abi b/golos.config/golos.config.abi new file mode 100644 index 00000000..87649d64 --- /dev/null +++ b/golos.config/golos.config.abi @@ -0,0 +1,10 @@ +{ + "____comment": "This file was generated with eosio-abigen. DO NOT EDIT ", + "version": "cyberway::abi/1.1", + "types": [], + "structs": [], + "actions": [], + "events": [], + "tables": [], + "variants": [] +} diff --git a/golos.ctrl/CMakeLists.txt b/golos.ctrl/CMakeLists.txt index 7f6c13ab..1f4be8af 100644 --- a/golos.ctrl/CMakeLists.txt +++ b/golos.ctrl/CMakeLists.txt @@ -1,4 +1,4 @@ -add_contract(golos.ctrl golos.ctrl src/golos.ctrl.cpp) +add_contract_with_checked_abi(golos.ctrl golos.ctrl golos.ctrl.abi src/golos.ctrl.cpp) install_contract(golos.ctrl) target_include_directories(golos.ctrl.wasm PUBLIC diff --git a/golos.ctrl/golos.ctrl.abi b/golos.ctrl/golos.ctrl.abi new file mode 100644 index 00000000..ff1d0b87 --- /dev/null +++ b/golos.ctrl/golos.ctrl.abi @@ -0,0 +1,211 @@ +{ + "____comment": "This file was generated with eosio-abigen. DO NOT EDIT ", + "version": "cyberway::abi/1.1", + "types": [ + {"new_type_name": "ctrl_param", "type": "variant_ctrl_token_multisig_acc_max_witnesses_multisig_perms_max_witness_votes_update_auth"}, + {"new_type_name": "ctrl_token", "type": "ctrl_token_t"}, + {"new_type_name": "max_witness_votes", "type": "max_witness_votes_t"}, + {"new_type_name": "max_witnesses", "type": "max_witnesses_t"}, + {"new_type_name": "multisig_acc", "type": "multisig_acc_t"}, + {"new_type_name": "multisig_perms", "type": "multisig_perms_t"}, + {"new_type_name": "update_auth", "type": "update_auth_t"} + ], + "structs": [{ + "name": "changevest", "base": "", + "fields": [ + {"name": "who", "type": "name"}, + {"name": "diff", "type": "asset"} + ] + }, { + "name": "ctrl_state", "base": "", + "fields": [ + {"name": "id", "type": "uint64"}, + {"name": "token", "type": "ctrl_token"}, + {"name": "multisig", "type": "multisig_acc"}, + {"name": "witnesses", "type": "max_witnesses"}, + {"name": "msig_perms", "type": "multisig_perms"}, + {"name": "witness_votes", "type": "max_witness_votes"}, + {"name": "update_auth_period", "type": "update_auth"} + ] + }, { + "name": "ctrl_token_t", "base": "immutable_parameter", + "fields": [ + {"name": "code", "type": "symbol_code"} + ] + }, { + "name": "immutable_parameter", "base": "parameter", + "fields": [] + }, { + "name": "max_witness_votes_t", "base": "immutable_parameter", + "fields": [ + {"name": "max", "type": "uint16"} + ] + }, { + "name": "max_witnesses_t", "base": "parameter", + "fields": [ + {"name": "max", "type": "uint16"} + ] + }, { + "name": "msig_auths", "base": "", + "fields": [ + {"name": "id", "type": "uint64"}, + {"name": "witnesses", "type": "name[]"}, + {"name": "last_update", "type": "time_point_sec"} + ] + }, { + "name": "multisig_acc_t", "base": "parameter", + "fields": [ + {"name": "name", "type": "name"} + ] + }, { + "name": "multisig_perms_t", "base": "parameter", + "fields": [ + {"name": "super_majority", "type": "uint16"}, + {"name": "majority", "type": "uint16"}, + {"name": "minority", "type": "uint16"} + ] + }, { + "name": "parameter", "base": "", + "fields": [] + }, { + "name": "regwitness", "base": "", + "fields": [ + {"name": "witness", "type": "name"}, + {"name": "url", "type": "string"} + ] + }, { + "name": "setparams", "base": "", + "fields": [ + {"name": "params", "type": "ctrl_param[]"} + ] + }, { + "name": "startwitness", "base": "", + "fields": [ + {"name": "witness", "type": "name"} + ] + }, { + "name": "stopwitness", "base": "", + "fields": [ + {"name": "witness", "type": "name"} + ] + }, { + "name": "unregwitness", "base": "", + "fields": [ + {"name": "witness", "type": "name"} + ] + }, { + "name": "unvotewitn", "base": "", + "fields": [ + {"name": "voter", "type": "name"}, + {"name": "witness", "type": "name"} + ] + }, { + "name": "update_auth_t", "base": "parameter", + "fields": [ + {"name": "period", "type": "uint32"} + ] + }, { + "name": "validateprms", "base": "", + "fields": [ + {"name": "params", "type": "ctrl_param[]"} + ] + }, { + "name": "votewitness", "base": "", + "fields": [ + {"name": "voter", "type": "name"}, + {"name": "witness", "type": "name"} + ] + }, { + "name": "witness_info", "base": "", + "fields": [ + {"name": "name", "type": "name"}, + {"name": "url", "type": "string"}, + {"name": "active", "type": "bool"}, + {"name": "total_weight", "type": "uint64"}, + {"name": "counter_votes", "type": "uint64"} + ] + }, { + "name": "witness_voter", "base": "", + "fields": [ + {"name": "voter", "type": "name"}, + {"name": "witnesses", "type": "name[]"} + ] + }, { + "name": "witnessstate", "base": "", + "fields": [ + {"name": "witness", "type": "name"}, + {"name": "weight", "type": "uint64"}, + {"name": "active", "type": "bool"} + ] + } + ], + "actions": [ + {"name": "changevest", "type": "changevest"}, + {"name": "regwitness", "type": "regwitness"}, + {"name": "setparams", "type": "setparams"}, + {"name": "startwitness", "type": "startwitness"}, + {"name": "stopwitness", "type": "stopwitness"}, + {"name": "unregwitness", "type": "unregwitness"}, + {"name": "unvotewitn", "type": "unvotewitn"}, + {"name": "validateprms", "type": "validateprms"}, + {"name": "votewitness", "type": "votewitness"} + ], + "events": [ + {"name": "witnessstate", "type": "witnessstate"} + ], + "tables": [{ + "name": "ctrlparams", "type": "ctrl_state", + "indexes": [{ + "name": "primary", "unique": true, + "orders": [ + {"field": "id", "order": "asc"} + ] + } + ] + }, { + "name": "msigauths", "type": "msig_auths", + "indexes": [{ + "name": "primary", "unique": true, + "orders": [ + {"field": "id", "order": "asc"} + ] + } + ] + }, { + "name": "witness", "type": "witness_info", + "indexes": [{ + "name": "primary", "unique": true, + "orders": [ + {"field": "name", "order": "asc"} + ] + }, { + "name": "byweight", "unique": false, + "orders": [ + {"field": "total_weight", "order": "desc"} + ] + } + ] + }, { + "name": "witnessvote", "type": "witness_voter", + "indexes": [{ + "name": "primary", "unique": true, + "orders": [ + {"field": "voter", "order": "asc"} + ] + } + ] + } + ], + "variants": [{ + "name": "variant_ctrl_token_multisig_acc_max_witnesses_multisig_perms_max_witness_votes_update_auth", + "types": [ + "ctrl_token", + "multisig_acc", + "max_witnesses", + "multisig_perms", + "max_witness_votes", + "update_auth" + ] + } + ] +} diff --git a/golos.emit/CMakeLists.txt b/golos.emit/CMakeLists.txt index 03c6960d..08dc8adc 100644 --- a/golos.emit/CMakeLists.txt +++ b/golos.emit/CMakeLists.txt @@ -1,4 +1,4 @@ -add_contract(golos.emit golos.emit src/golos.emit.cpp) +add_contract_with_checked_abi(golos.emit golos.emit golos.emit.abi src/golos.emit.cpp) install_contract(golos.emit) target_include_directories(golos.emit.wasm PUBLIC diff --git a/golos.emit/golos.emit.abi b/golos.emit/golos.emit.abi new file mode 100644 index 00000000..37ed8b6a --- /dev/null +++ b/golos.emit/golos.emit.abi @@ -0,0 +1,121 @@ +{ + "____comment": "This file was generated with eosio-abigen. DO NOT EDIT ", + "version": "cyberway::abi/1.1", + "types": [ + {"new_type_name": "bwprovider", "type": "bwprovider_t"}, + {"new_type_name": "emit_interval", "type": "emit_interval_t"}, + {"new_type_name": "emit_param", "type": "variant_inflation_rate_reward_pools_emit_token_emit_interval_bwprovider"}, + {"new_type_name": "emit_token", "type": "emit_token_t"}, + {"new_type_name": "inflation_rate", "type": "inflation_rate_t"}, + {"new_type_name": "reward_pools", "type": "reward_pools_t"} + ], + "structs": [{ + "name": "bwprovider_t", "base": "parameter", + "fields": [ + {"name": "actor", "type": "name"}, + {"name": "permission", "type": "name"} + ] + }, { + "name": "emit", "base": "", + "fields": [] + }, { + "name": "emit_interval_t", "base": "parameter", + "fields": [ + {"name": "value", "type": "uint16"} + ] + }, { + "name": "emit_state", "base": "", + "fields": [ + {"name": "id", "type": "uint64"}, + {"name": "infrate", "type": "inflation_rate"}, + {"name": "pools", "type": "reward_pools"}, + {"name": "token", "type": "emit_token"}, + {"name": "interval", "type": "emit_interval"}, + {"name": "bwprovider", "type": "bwprovider"} + ] + }, { + "name": "emit_token_t", "base": "parameter", + "fields": [ + {"name": "symbol", "type": "symbol"} + ] + }, { + "name": "inflation_rate_t", "base": "parameter", + "fields": [ + {"name": "start", "type": "uint16"}, + {"name": "stop", "type": "uint16"}, + {"name": "narrowing", "type": "uint32"} + ] + }, { + "name": "parameter", "base": "", + "fields": [] + }, { + "name": "reward_pool", "base": "", + "fields": [ + {"name": "name", "type": "name"}, + {"name": "percent", "type": "uint16"} + ] + }, { + "name": "reward_pools_t", "base": "parameter", + "fields": [ + {"name": "pools", "type": "reward_pool[]"} + ] + }, { + "name": "setparams", "base": "", + "fields": [ + {"name": "params", "type": "emit_param[]"} + ] + }, { + "name": "start", "base": "", + "fields": [] + }, { + "name": "state", "base": "", + "fields": [ + {"name": "id", "type": "uint64"}, + {"name": "prev_emit", "type": "uint64"}, + {"name": "start_time", "type": "uint64"}, + {"name": "active", "type": "bool"} + ] + }, { + "name": "stop", "base": "", + "fields": [] + } + ], + "actions": [ + {"name": "emit", "type": "emit"}, + {"name": "setparams", "type": "setparams"}, + {"name": "start", "type": "start"}, + {"name": "stop", "type": "stop"} + ], + "events": [], + "tables": [{ + "name": "emitparams", "type": "emit_state", + "indexes": [{ + "name": "primary", "unique": true, + "orders": [ + {"field": "id", "order": "asc"} + ] + } + ] + }, { + "name": "state", "type": "state", + "indexes": [{ + "name": "primary", "unique": true, + "orders": [ + {"field": "id", "order": "asc"} + ] + } + ] + } + ], + "variants": [{ + "name": "variant_inflation_rate_reward_pools_emit_token_emit_interval_bwprovider", + "types": [ + "inflation_rate", + "reward_pools", + "emit_token", + "emit_interval", + "bwprovider" + ] + } + ] +} diff --git a/golos.memo/CMakeLists.txt b/golos.memo/CMakeLists.txt index a1d26ab1..0985851b 100644 --- a/golos.memo/CMakeLists.txt +++ b/golos.memo/CMakeLists.txt @@ -1,4 +1,4 @@ -add_contract(golos.memo golos.memo golos.memo.cpp) +add_contract_with_checked_abi(golos.memo golos.memo golos.memo.abi golos.memo.cpp) install_contract(golos.memo) target_include_directories(golos.memo.wasm PUBLIC diff --git a/golos.memo/golos.memo.abi b/golos.memo/golos.memo.abi new file mode 100644 index 00000000..a5c59468 --- /dev/null +++ b/golos.memo/golos.memo.abi @@ -0,0 +1,27 @@ +{ + "____comment": "This file was generated with eosio-abigen. DO NOT EDIT ", + "version": "cyberway::abi/1.1", + "types": [], + "structs": [{ + "name": "memo_key", "base": "", + "fields": [ + {"name": "name", "type": "name"}, + {"name": "key", "type": "public_key"} + ] + } + ], + "actions": [], + "events": [], + "tables": [{ + "name": "memo", "type": "memo_key", + "indexes": [{ + "name": "primary", "unique": true, + "orders": [ + {"field": "name", "order": "asc"} + ] + } + ] + } + ], + "variants": [] +} diff --git a/golos.publication/CMakeLists.txt b/golos.publication/CMakeLists.txt index 1a600f8b..2392c516 100644 --- a/golos.publication/CMakeLists.txt +++ b/golos.publication/CMakeLists.txt @@ -1,4 +1,4 @@ -add_contract(golos.publication golos.publication golos.publication.cpp) +add_contract_with_checked_abi(golos.publication golos.publication golos.publication.abi golos.publication.cpp) install_contract(golos.publication) target_include_directories(golos.publication.wasm PUBLIC diff --git a/golos.publication/golos.publication.abi b/golos.publication/golos.publication.abi new file mode 100644 index 00000000..fc9652bf --- /dev/null +++ b/golos.publication/golos.publication.abi @@ -0,0 +1,551 @@ +{ + "____comment": "This file was generated with eosio-abigen. DO NOT EDIT ", + "version": "cyberway::abi/1.1", + "types": [ + {"new_type_name": "base_t", "type": "int64"}, + {"new_type_name": "counter_t", "type": "uint64"}, + {"new_type_name": "enum_t", "type": "uint8"}, + {"new_type_name": "index_t", "type": "uint64"}, + {"new_type_name": "percent_t", "type": "uint16"}, + {"new_type_name": "posting_params", "type": "variant_st_max_vote_changes_st_cashout_window_st_max_beneficiaries_st_max_comment_depth_st_social_acc_st_referral_acc_st_curators_prcnt_st_bwprovider_st_min_abs_rshares"}, + {"new_type_name": "signed_percent_t", "type": "int16"}, + {"new_type_name": "st_bwprovider", "type": "st_bwprovider_t"}, + {"new_type_name": "st_cashout_window", "type": "st_cashout_window_t"}, + {"new_type_name": "st_curators_prcnt", "type": "st_curators_prcnt_t"}, + {"new_type_name": "st_max_beneficiaries", "type": "st_max_beneficiaries_t"}, + {"new_type_name": "st_max_comment_depth", "type": "st_max_comment_depth_t"}, + {"new_type_name": "st_max_vote_changes", "type": "st_max_vote_changes_t"}, + {"new_type_name": "st_min_abs_rshares", "type": "st_min_abs_rshares_t"}, + {"new_type_name": "st_referral_acc", "type": "st_referral_acc_t"}, + {"new_type_name": "st_social_acc", "type": "st_social_acc_t"}, + {"new_type_name": "wide_t", "type": "int128"} + ], + "structs": [{ + "name": "addpermlink", "base": "", + "fields": [ + {"name": "msg", "type": "mssgid"}, + {"name": "parent", "type": "mssgid"}, + {"name": "level", "type": "uint16"}, + {"name": "childcount", "type": "uint32"} + ] + }, { + "name": "addpermlinks", "base": "", + "fields": [ + {"name": "permlinks", "type": "permlink_info[]"} + ] + }, { + "name": "beneficiary", "base": "", + "fields": [ + {"name": "account", "type": "name"}, + {"name": "weight", "type": "percent_t"} + ] + }, { + "name": "bytecode", "base": "", + "fields": [ + {"name": "varssize", "type": "index_t"}, + {"name": "operators", "type": "index_t[]"}, + {"name": "values", "type": "value[]"}, + {"name": "nums", "type": "base_t[]"}, + {"name": "consts", "type": "base_t[]"} + ] + }, { + "name": "calcrwrdwt", "base": "", + "fields": [ + {"name": "account", "type": "name"}, + {"name": "mssg_id", "type": "int64"}, + {"name": "post_charge", "type": "base_t"} + ] + }, { + "name": "closemssgs", "base": "", + "fields": [ + {"name": "payer", "type": "name"} + ] + }, { + "name": "createmssg", "base": "", + "fields": [ + {"name": "message_id", "type": "mssgid"}, + {"name": "parent_id", "type": "mssgid"}, + {"name": "beneficiaries", "type": "beneficiary[]"}, + {"name": "tokenprop", "type": "percent_t"}, + {"name": "vestpayment", "type": "bool"}, + {"name": "headermssg", "type": "string"}, + {"name": "bodymssg", "type": "string"}, + {"name": "languagemssg", "type": "string"}, + {"name": "tags", "type": "string[]"}, + {"name": "jsonmetadata", "type": "string"}, + {"name": "curators_prcnt", "type": "uint16?"}, + {"name": "max_payout", "type": "asset?"} + ] + }, { + "name": "delegate_voter", "base": "", + "fields": [ + {"name": "delegator", "type": "name"}, + {"name": "interest_rate", "type": "percent_t"} + ] + }, { + "name": "deletemssg", "base": "", + "fields": [ + {"name": "message_id", "type": "mssgid"} + ] + }, { + "name": "deletevotes", "base": "", + "fields": [ + {"name": "message_id", "type": "int64"}, + {"name": "author", "type": "name"} + ] + }, { + "name": "delpermlink", "base": "", + "fields": [ + {"name": "msg", "type": "mssgid"} + ] + }, { + "name": "delpermlinks", "base": "", + "fields": [ + {"name": "permlinks", "type": "mssgid[]"} + ] + }, { + "name": "downvote", "base": "", + "fields": [ + {"name": "voter", "type": "name"}, + {"name": "message_id", "type": "mssgid"}, + {"name": "weight", "type": "percent_t"} + ] + }, { + "name": "erasereblog", "base": "", + "fields": [ + {"name": "rebloger", "type": "name"}, + {"name": "message_id", "type": "mssgid"} + ] + }, { + "name": "funcinfo", "base": "", + "fields": [ + {"name": "code", "type": "bytecode"}, + {"name": "maxarg", "type": "base_t"} + ] + }, { + "name": "funcparams", "base": "", + "fields": [ + {"name": "str", "type": "string"}, + {"name": "maxarg", "type": "base_t"} + ] + }, { + "name": "limitparams", "base": "", + "fields": [ + {"name": "act", "type": "uint64"}, + {"name": "charge_id", "type": "uint8"}, + {"name": "price", "type": "int64"}, + {"name": "cutoff", "type": "int64"}, + {"name": "vesting_price", "type": "int64"}, + {"name": "min_vesting", "type": "int64"} + ] + }, { + "name": "message", "base": "", + "fields": [ + {"name": "author", "type": "name"}, + {"name": "id", "type": "uint64"}, + {"name": "date", "type": "uint64"}, + {"name": "pool_date", "type": "uint64"}, + {"name": "tokenprop", "type": "percent_t"}, + {"name": "beneficiaries", "type": "beneficiary[]"}, + {"name": "rewardweight", "type": "percent_t"}, + {"name": "state", "type": "messagestate"}, + {"name": "curators_prcnt", "type": "percent_t"}, + {"name": "cashout_time", "type": "uint64"}, + {"name": "mssg_reward", "type": "asset"}, + {"name": "max_payout", "type": "asset"}, + {"name": "paid_amount", "type": "int64"} + ] + }, { + "name": "messagestate", "base": "", + "fields": [ + {"name": "netshares", "type": "base_t"}, + {"name": "voteshares", "type": "base_t"}, + {"name": "sumcuratorsw", "type": "base_t"} + ] + }, { + "name": "mssgid", "base": "", + "fields": [ + {"name": "author", "type": "name"}, + {"name": "permlink", "type": "string"} + ] + }, { + "name": "parameter", "base": "", + "fields": [] + }, { + "name": "paymssgrwrd", "base": "", + "fields": [ + {"name": "message_id", "type": "mssgid"} + ] + }, { + "name": "permlink", "base": "", + "fields": [ + {"name": "id", "type": "uint64"}, + {"name": "parentacc", "type": "name"}, + {"name": "parent_id", "type": "uint64"}, + {"name": "value", "type": "string"}, + {"name": "level", "type": "uint16"}, + {"name": "childcount", "type": "uint32"} + ] + }, { + "name": "permlink_info", "base": "", + "fields": [ + {"name": "msg", "type": "mssgid"}, + {"name": "parent", "type": "mssgid"}, + {"name": "level", "type": "uint16"}, + {"name": "childcount", "type": "uint32"} + ] + }, { + "name": "pool_erase_event", "base": "", + "fields": [ + {"name": "created", "type": "uint64"} + ] + }, { + "name": "pool_event", "base": "", + "fields": [ + {"name": "created", "type": "uint64"}, + {"name": "msgs", "type": "counter_t"}, + {"name": "funds", "type": "asset"}, + {"name": "rshares", "type": "wide_t"}, + {"name": "rsharesfn", "type": "wide_t"} + ] + }, { + "name": "poolstate", "base": "", + "fields": [ + {"name": "msgs", "type": "counter_t"}, + {"name": "funds", "type": "asset"}, + {"name": "rshares", "type": "wide_t"}, + {"name": "rsharesfn", "type": "wide_t"} + ] + }, { + "name": "post_event", "base": "", + "fields": [ + {"name": "author", "type": "name"}, + {"name": "permlink", "type": "string"}, + {"name": "netshares", "type": "base_t"}, + {"name": "voteshares", "type": "base_t"}, + {"name": "sumcuratorsw", "type": "base_t"}, + {"name": "sharesfn", "type": "base_t"} + ] + }, { + "name": "post_reward_event", "base": "", + "fields": [ + {"name": "message_id", "type": "mssgid"}, + {"name": "author_reward", "type": "asset"}, + {"name": "benefactor_reward", "type": "asset"}, + {"name": "curator_reward", "type": "asset"}, + {"name": "unclaimed_reward", "type": "asset"} + ] + }, { + "name": "posting_state", "base": "", + "fields": [ + {"name": "id", "type": "uint64"}, + {"name": "max_vote_changes", "type": "st_max_vote_changes"}, + {"name": "cashout_window", "type": "st_cashout_window"}, + {"name": "max_beneficiaries", "type": "st_max_beneficiaries"}, + {"name": "max_comment_depth", "type": "st_max_comment_depth"}, + {"name": "social_acc", "type": "st_social_acc"}, + {"name": "referral_acc", "type": "st_referral_acc"}, + {"name": "curators_prcnt", "type": "st_curators_prcnt"}, + {"name": "bwprovider", "type": "st_bwprovider"}, + {"name": "min_abs_rshares", "type": "st_min_abs_rshares"} + ] + }, { + "name": "reblog", "base": "", + "fields": [ + {"name": "rebloger", "type": "name"}, + {"name": "message_id", "type": "mssgid"}, + {"name": "headermssg", "type": "string"}, + {"name": "bodymssg", "type": "string"} + ] + }, { + "name": "reward_weight_event", "base": "", + "fields": [ + {"name": "message_id", "type": "mssgid"}, + {"name": "rewardweight", "type": "percent_t"} + ] + }, { + "name": "rewardpool", "base": "", + "fields": [ + {"name": "created", "type": "uint64"}, + {"name": "rules", "type": "rewardrules"}, + {"name": "state", "type": "poolstate"} + ] + }, { + "name": "rewardrules", "base": "", + "fields": [ + {"name": "mainfunc", "type": "funcinfo"}, + {"name": "curationfunc", "type": "funcinfo"}, + {"name": "timepenalty", "type": "funcinfo"}, + {"name": "maxtokenprop", "type": "percent_t"} + ] + }, { + "name": "setcurprcnt", "base": "", + "fields": [ + {"name": "message_id", "type": "mssgid"}, + {"name": "curators_prcnt", "type": "percent_t"} + ] + }, { + "name": "setlimit", "base": "", + "fields": [ + {"name": "act", "type": "string"}, + {"name": "token_code", "type": "symbol_code"}, + {"name": "charge_id", "type": "uint8"}, + {"name": "price", "type": "int64"}, + {"name": "cutoff", "type": "int64"}, + {"name": "vesting_price", "type": "int64"}, + {"name": "min_vesting", "type": "int64"} + ] + }, { + "name": "setmaxpayout", "base": "", + "fields": [ + {"name": "message_id", "type": "mssgid"}, + {"name": "max_payout", "type": "asset"} + ] + }, { + "name": "setparams", "base": "", + "fields": [ + {"name": "params", "type": "posting_params[]"} + ] + }, { + "name": "setrules", "base": "", + "fields": [ + {"name": "mainfunc", "type": "funcparams"}, + {"name": "curationfunc", "type": "funcparams"}, + {"name": "timepenalty", "type": "funcparams"}, + {"name": "maxtokenprop", "type": "percent_t"}, + {"name": "tokensymbol", "type": "symbol"} + ] + }, { + "name": "st_bwprovider_t", "base": "parameter", + "fields": [ + {"name": "actor", "type": "name"}, + {"name": "permission", "type": "name"} + ] + }, { + "name": "st_cashout_window_t", "base": "parameter", + "fields": [ + {"name": "window", "type": "uint32"}, + {"name": "upvote_lockout", "type": "uint32"} + ] + }, { + "name": "st_curators_prcnt_t", "base": "parameter", + "fields": [ + {"name": "min_curators_prcnt", "type": "percent_t"}, + {"name": "max_curators_prcnt", "type": "percent_t"} + ] + }, { + "name": "st_max_beneficiaries_t", "base": "parameter", + "fields": [ + {"name": "value", "type": "uint8"} + ] + }, { + "name": "st_max_comment_depth_t", "base": "parameter", + "fields": [ + {"name": "value", "type": "uint16"} + ] + }, { + "name": "st_max_vote_changes_t", "base": "parameter", + "fields": [ + {"name": "value", "type": "uint8"} + ] + }, { + "name": "st_min_abs_rshares_t", "base": "parameter", + "fields": [ + {"name": "value", "type": "uint64"} + ] + }, { + "name": "st_referral_acc_t", "base": "parameter", + "fields": [ + {"name": "value", "type": "name"} + ] + }, { + "name": "st_social_acc_t", "base": "parameter", + "fields": [ + {"name": "value", "type": "name"} + ] + }, { + "name": "syncpool", "base": "", + "fields": [ + {"name": "tokensymbol", "type": "symbol?"} + ] + }, { + "name": "unvote", "base": "", + "fields": [ + {"name": "voter", "type": "name"}, + {"name": "message_id", "type": "mssgid"} + ] + }, { + "name": "updatemssg", "base": "", + "fields": [ + {"name": "message_id", "type": "mssgid"}, + {"name": "headermssg", "type": "string"}, + {"name": "bodymssg", "type": "string"}, + {"name": "languagemssg", "type": "string"}, + {"name": "tags", "type": "string[]"}, + {"name": "jsonmetadata", "type": "string"} + ] + }, { + "name": "upvote", "base": "", + "fields": [ + {"name": "voter", "type": "name"}, + {"name": "message_id", "type": "mssgid"}, + {"name": "weight", "type": "percent_t"} + ] + }, { + "name": "value", "base": "", + "fields": [ + {"name": "kind", "type": "enum_t"}, + {"name": "idx", "type": "index_t"} + ] + }, { + "name": "vote_event", "base": "", + "fields": [ + {"name": "voter", "type": "name"}, + {"name": "author", "type": "name"}, + {"name": "permlink", "type": "string"}, + {"name": "weight", "type": "signed_percent_t"}, + {"name": "curatorsw", "type": "base_t"}, + {"name": "rshares", "type": "base_t"} + ] + }, { + "name": "voteinfo", "base": "", + "fields": [ + {"name": "id", "type": "uint64"}, + {"name": "message_id", "type": "uint64"}, + {"name": "voter", "type": "name"}, + {"name": "weight", "type": "signed_percent_t"}, + {"name": "time", "type": "uint64"}, + {"name": "count", "type": "uint8"}, + {"name": "delegators", "type": "delegate_voter[]"}, + {"name": "curatorsw", "type": "base_t"}, + {"name": "rshares", "type": "base_t"}, + {"name": "paid_amount", "type": "int64"} + ] + } + ], + "actions": [ + {"name": "addpermlink", "type": "addpermlink"}, + {"name": "addpermlinks", "type": "addpermlinks"}, + {"name": "calcrwrdwt", "type": "calcrwrdwt"}, + {"name": "closemssgs", "type": "closemssgs"}, + {"name": "createmssg", "type": "createmssg"}, + {"name": "deletemssg", "type": "deletemssg"}, + {"name": "deletevotes", "type": "deletevotes"}, + {"name": "delpermlink", "type": "delpermlink"}, + {"name": "delpermlinks", "type": "delpermlinks"}, + {"name": "downvote", "type": "downvote"}, + {"name": "erasereblog", "type": "erasereblog"}, + {"name": "paymssgrwrd", "type": "paymssgrwrd"}, + {"name": "reblog", "type": "reblog"}, + {"name": "setcurprcnt", "type": "setcurprcnt"}, + {"name": "setlimit", "type": "setlimit"}, + {"name": "setmaxpayout", "type": "setmaxpayout"}, + {"name": "setparams", "type": "setparams"}, + {"name": "setrules", "type": "setrules"}, + {"name": "syncpool", "type": "syncpool"}, + {"name": "unvote", "type": "unvote"}, + {"name": "updatemssg", "type": "updatemssg"}, + {"name": "upvote", "type": "upvote"} + ], + "events": [ + {"name": "poolerase", "type": "pool_erase_event"}, + {"name": "poolstate", "type": "pool_event"}, + {"name": "postreward", "type": "post_reward_event"}, + {"name": "poststate", "type": "post_event"}, + {"name": "rewardweight", "type": "reward_weight_event"}, + {"name": "votestate", "type": "vote_event"} + ], + "tables": [{ + "name": "limit", "type": "limitparams", + "indexes": [{ + "name": "primary", "unique": true, + "orders": [ + {"field": "act", "order": "asc"} + ] + } + ] + }, { + "name": "message", "type": "message", + "indexes": [{ + "name": "primary", "unique": true, + "orders": [ + {"field": "id", "order": "asc"} + ] + }, { + "name": "bycashout", "unique": false, + "orders": [ + {"field": "cashout_time", "order": "asc"} + ] + } + ] + }, { + "name": "permlink", "type": "permlink", + "indexes": [{ + "name": "primary", "unique": true, + "orders": [ + {"field": "id", "order": "asc"} + ] + }, { + "name": "byvalue", "unique": true, + "orders": [ + {"field": "value", "order": "asc"} + ] + } + ] + }, { + "name": "pstngparams", "type": "posting_state", + "indexes": [{ + "name": "primary", "unique": true, + "orders": [ + {"field": "id", "order": "asc"} + ] + } + ] + }, { + "name": "rewardpools", "type": "rewardpool", + "indexes": [{ + "name": "primary", "unique": true, + "orders": [ + {"field": "created", "order": "asc"} + ] + } + ] + }, { + "name": "vote", "type": "voteinfo", + "indexes": [{ + "name": "primary", "unique": true, + "orders": [ + {"field": "id", "order": "asc"} + ] + }, { + "name": "messageid", "unique": false, + "orders": [ + {"field": "message_id", "order": "asc"}, + {"field": "curatorsw", "order": "desc"} + ] + }, { + "name": "byvoter", "unique": true, + "orders": [ + {"field": "message_id", "order": "asc"}, + {"field": "voter", "order": "asc"} + ] + } + ] + } + ], + "variants": [{ + "name": "variant_st_max_vote_changes_st_cashout_window_st_max_beneficiaries_st_max_comment_depth_st_social_acc_st_referral_acc_st_curators_prcnt_st_bwprovider_st_min_abs_rshares", + "types": [ + "st_max_vote_changes", + "st_cashout_window", + "st_max_beneficiaries", + "st_max_comment_depth", + "st_social_acc", + "st_referral_acc", + "st_curators_prcnt", + "st_bwprovider", + "st_min_abs_rshares" + ] + } + ] +} diff --git a/golos.referral/CMakeLists.txt b/golos.referral/CMakeLists.txt index fd6470f5..f15f620a 100644 --- a/golos.referral/CMakeLists.txt +++ b/golos.referral/CMakeLists.txt @@ -1,4 +1,4 @@ -add_contract(golos.referral golos.referral src/golos.referral.cpp) +add_contract_with_checked_abi(golos.referral golos.referral golos.referral.abi src/golos.referral.cpp) install_contract(golos.referral) target_include_directories(golos.referral.wasm PUBLIC diff --git a/golos.referral/golos.referral.abi b/golos.referral/golos.referral.abi new file mode 100644 index 00000000..025d3e5d --- /dev/null +++ b/golos.referral/golos.referral.abi @@ -0,0 +1,116 @@ +{ + "____comment": "This file was generated with eosio-abigen. DO NOT EDIT ", + "version": "cyberway::abi/1.1", + "types": [ + {"new_type_name": "breakout_parametrs", "type": "breakout_parametrs_t"}, + {"new_type_name": "expire_parametrs", "type": "expire_parametrs_t"}, + {"new_type_name": "percent_parametrs", "type": "percent_parametrs_t"}, + {"new_type_name": "referral_params", "type": "variant_breakout_parametrs_expire_parametrs_percent_parametrs"} + ], + "structs": [{ + "name": "add_referral", "base": "", + "fields": [ + {"name": "referrer", "type": "name"}, + {"name": "referral", "type": "name"}, + {"name": "percent", "type": "uint16"}, + {"name": "expire", "type": "uint64"}, + {"name": "breakout", "type": "asset"} + ] + }, { + "name": "addreferral", "base": "", + "fields": [ + {"name": "referrer", "type": "name"}, + {"name": "referral", "type": "name"}, + {"name": "percent", "type": "uint16"}, + {"name": "expire", "type": "uint64"}, + {"name": "breakout", "type": "asset"} + ] + }, { + "name": "breakout_parametrs_t", "base": "parameter", + "fields": [ + {"name": "min_breakout", "type": "asset"}, + {"name": "max_breakout", "type": "asset"} + ] + }, { + "name": "closeoldref", "base": "", + "fields": [] + }, { + "name": "expire_parametrs_t", "base": "parameter", + "fields": [ + {"name": "max_expire", "type": "uint64"} + ] + }, { + "name": "parameter", "base": "", + "fields": [] + }, { + "name": "percent_parametrs_t", "base": "parameter", + "fields": [ + {"name": "max_percent", "type": "uint16"} + ] + }, { + "name": "referral_state", "base": "", + "fields": [ + {"name": "id", "type": "uint64"}, + {"name": "breakout_params", "type": "breakout_parametrs"}, + {"name": "expire_params", "type": "expire_parametrs"}, + {"name": "percent_params", "type": "percent_parametrs"} + ] + }, { + "name": "setparams", "base": "", + "fields": [ + {"name": "params", "type": "referral_params[]"} + ] + }, { + "name": "validateprms", "base": "", + "fields": [ + {"name": "params", "type": "referral_params[]"} + ] + } + ], + "actions": [ + {"name": "addreferral", "type": "add_referral"}, + {"name": "closeoldref", "type": "closeoldref"}, + {"name": "setparams", "type": "setparams"}, + {"name": "validateprms", "type": "validateprms"} + ], + "events": [], + "tables": [{ + "name": "referrals", "type": "addreferral", + "indexes": [{ + "name": "primary", "unique": true, + "orders": [ + {"field": "referral", "order": "asc"} + ] + }, { + "name": "referrerkey", "unique": false, + "orders": [ + {"field": "referrer", "order": "asc"} + ] + }, { + "name": "expirekey", "unique": false, + "orders": [ + {"field": "expire", "order": "asc"} + ] + } + ] + }, { + "name": "refparams", "type": "referral_state", + "indexes": [{ + "name": "primary", "unique": true, + "orders": [ + {"field": "id", "order": "asc"} + ] + } + ] + } + ], + "variants": [{ + "name": "variant_breakout_parametrs_expire_parametrs_percent_parametrs", + "types": [ + "breakout_parametrs", + "expire_parametrs", + "percent_parametrs" + ] + } + ] +} diff --git a/golos.social/CMakeLists.txt b/golos.social/CMakeLists.txt index 0a6c842b..44e1ba18 100644 --- a/golos.social/CMakeLists.txt +++ b/golos.social/CMakeLists.txt @@ -1,4 +1,4 @@ -add_contract(golos.social golos.social golos.social.cpp) +add_contract_with_checked_abi(golos.social golos.social golos.social.abi golos.social.cpp) install_contract(golos.social) target_include_directories(golos.social.wasm PUBLIC diff --git a/golos.social/golos.social.abi b/golos.social/golos.social.abi new file mode 100644 index 00000000..a97cf40f --- /dev/null +++ b/golos.social/golos.social.abi @@ -0,0 +1,120 @@ +{ + "____comment": "This file was generated with eosio-abigen. DO NOT EDIT ", + "version": "cyberway::abi/1.1", + "types": [], + "structs": [{ + "name": "accountmeta", "base": "", + "fields": [ + {"name": "type", "type": "string?"}, + {"name": "app", "type": "string?"}, + {"name": "email", "type": "string?"}, + {"name": "phone", "type": "string?"}, + {"name": "facebook", "type": "string?"}, + {"name": "instagram", "type": "string?"}, + {"name": "telegram", "type": "string?"}, + {"name": "vk", "type": "string?"}, + {"name": "whatsapp", "type": "string?"}, + {"name": "wechat", "type": "string?"}, + {"name": "website", "type": "string?"}, + {"name": "first_name", "type": "string?"}, + {"name": "last_name", "type": "string?"}, + {"name": "name", "type": "string?"}, + {"name": "birth_date", "type": "string?"}, + {"name": "gender", "type": "string?"}, + {"name": "location", "type": "string?"}, + {"name": "city", "type": "string?"}, + {"name": "about", "type": "string?"}, + {"name": "occupation", "type": "string?"}, + {"name": "i_can", "type": "string?"}, + {"name": "looking_for", "type": "string?"}, + {"name": "business_category", "type": "string?"}, + {"name": "background_image", "type": "string?"}, + {"name": "cover_image", "type": "string?"}, + {"name": "profile_image", "type": "string?"}, + {"name": "user_image", "type": "string?"}, + {"name": "ico_address", "type": "string?"}, + {"name": "target_date", "type": "string?"}, + {"name": "target_plan", "type": "string?"}, + {"name": "target_point_a", "type": "string?"}, + {"name": "target_point_b", "type": "string?"} + ] + }, { + "name": "addblock", "base": "", + "fields": [ + {"name": "blocker", "type": "name"}, + {"name": "blocking", "type": "name"} + ] + }, { + "name": "addpin", "base": "", + "fields": [ + {"name": "pinner", "type": "name"}, + {"name": "pinning", "type": "name"} + ] + }, { + "name": "block", "base": "", + "fields": [ + {"name": "blocker", "type": "name"}, + {"name": "blocking", "type": "name"} + ] + }, { + "name": "deletemeta", "base": "", + "fields": [ + {"name": "account", "type": "name"} + ] + }, { + "name": "pin", "base": "", + "fields": [ + {"name": "pinner", "type": "name"}, + {"name": "pinning", "type": "name"} + ] + }, { + "name": "pinblock_record", "base": "", + "fields": [ + {"name": "account", "type": "name"}, + {"name": "pinning", "type": "bool"}, + {"name": "blocking", "type": "bool"} + ] + }, { + "name": "unblock", "base": "", + "fields": [ + {"name": "blocker", "type": "name"}, + {"name": "blocking", "type": "name"} + ] + }, { + "name": "unpin", "base": "", + "fields": [ + {"name": "pinner", "type": "name"}, + {"name": "pinning", "type": "name"} + ] + }, { + "name": "updatemeta", "base": "", + "fields": [ + {"name": "account", "type": "name"}, + {"name": "meta", "type": "accountmeta"} + ] + } + ], + "actions": [ + {"name": "addblock", "type": "addblock"}, + {"name": "addpin", "type": "addpin"}, + {"name": "block", "type": "block"}, + {"name": "deletemeta", "type": "deletemeta"}, + {"name": "pin", "type": "pin"}, + {"name": "unblock", "type": "unblock"}, + {"name": "unpin", "type": "unpin"}, + {"name": "updatemeta", "type": "updatemeta"} + ], + "events": [], + "tables": [{ + "name": "pinblock", "type": "pinblock_record", + "indexes": [{ + "name": "primary", "unique": true, + "orders": [ + {"field": "account", "order": "asc"} + ] + } + ] + } + ], + "variants": [] +} diff --git a/golos.vesting/CMakeLists.txt b/golos.vesting/CMakeLists.txt index a0aa45f7..079f11cc 100644 --- a/golos.vesting/CMakeLists.txt +++ b/golos.vesting/CMakeLists.txt @@ -1,4 +1,4 @@ -add_contract(golos.vesting golos.vesting golos.vesting.cpp) +add_contract_with_checked_abi(golos.vesting golos.vesting golos.vesting.abi golos.vesting.cpp) install_contract(golos.vesting) target_include_directories(golos.vesting.wasm diff --git a/golos.vesting/golos.vesting.abi b/golos.vesting/golos.vesting.abi new file mode 100644 index 00000000..d36ed9dd --- /dev/null +++ b/golos.vesting/golos.vesting.abi @@ -0,0 +1,290 @@ +{ + "____comment": "This file was generated with eosio-abigen. DO NOT EDIT ", + "version": "cyberway::abi/1.1", + "types": [ + {"new_type_name": "vesting_amount", "type": "vesting_amount_t"}, + {"new_type_name": "vesting_bwprovider", "type": "vesting_bwprovider_t"}, + {"new_type_name": "vesting_delegation", "type": "vesting_delegation_t"}, + {"new_type_name": "vesting_param", "type": "variant_vesting_withdraw_vesting_amount_vesting_delegation_vesting_bwprovider"}, + {"new_type_name": "vesting_withdraw", "type": "vesting_withdraw_t"} + ], + "structs": [{ + "name": "account", "base": "", + "fields": [ + {"name": "vesting", "type": "asset"}, + {"name": "delegated", "type": "asset"}, + {"name": "received", "type": "asset"}, + {"name": "unlocked_limit", "type": "asset"}, + {"name": "delegators", "type": "uint32"} + ] + }, { + "name": "balance_event", "base": "", + "fields": [ + {"name": "account", "type": "name"}, + {"name": "vesting", "type": "asset"}, + {"name": "delegated", "type": "asset"}, + {"name": "received", "type": "asset"} + ] + }, { + "name": "close", "base": "", + "fields": [ + {"name": "owner", "type": "name"}, + {"name": "symbol", "type": "symbol"} + ] + }, { + "name": "create", "base": "", + "fields": [ + {"name": "symbol", "type": "symbol"}, + {"name": "notify_acc", "type": "name"} + ] + }, { + "name": "delegate", "base": "", + "fields": [ + {"name": "from", "type": "name"}, + {"name": "to", "type": "name"}, + {"name": "quantity", "type": "asset"}, + {"name": "interest_rate", "type": "uint16"} + ] + }, { + "name": "delegation", "base": "", + "fields": [ + {"name": "id", "type": "uint64"}, + {"name": "delegator", "type": "name"}, + {"name": "delegatee", "type": "name"}, + {"name": "quantity", "type": "asset"}, + {"name": "interest_rate", "type": "uint16"}, + {"name": "min_delegation_time", "type": "time_point_sec"} + ] + }, { + "name": "open", "base": "", + "fields": [ + {"name": "owner", "type": "name"}, + {"name": "symbol", "type": "symbol"}, + {"name": "ram_payer", "type": "name"} + ] + }, { + "name": "parameter", "base": "", + "fields": [] + }, { + "name": "procwaiting", "base": "", + "fields": [ + {"name": "symbol", "type": "symbol"}, + {"name": "payer", "type": "name"} + ] + }, { + "name": "retire", "base": "", + "fields": [ + {"name": "quantity", "type": "asset"}, + {"name": "user", "type": "name"} + ] + }, { + "name": "return_delegation", "base": "", + "fields": [ + {"name": "id", "type": "uint64"}, + {"name": "delegator", "type": "name"}, + {"name": "quantity", "type": "asset"}, + {"name": "date", "type": "time_point_sec"} + ] + }, { + "name": "setparams", "base": "", + "fields": [ + {"name": "symbol", "type": "symbol"}, + {"name": "params", "type": "vesting_param[]"} + ] + }, { + "name": "stopwithdraw", "base": "", + "fields": [ + {"name": "owner", "type": "name"}, + {"name": "symbol", "type": "symbol"} + ] + }, { + "name": "undelegate", "base": "", + "fields": [ + {"name": "from", "type": "name"}, + {"name": "to", "type": "name"}, + {"name": "quantity", "type": "asset"} + ] + }, { + "name": "unlocklimit", "base": "", + "fields": [ + {"name": "owner", "type": "name"}, + {"name": "quantity", "type": "asset"} + ] + }, { + "name": "validateprms", "base": "", + "fields": [ + {"name": "symbol", "type": "symbol"}, + {"name": "params", "type": "vesting_param[]"} + ] + }, { + "name": "vesting_amount_t", "base": "parameter", + "fields": [ + {"name": "min_amount", "type": "uint64"} + ] + }, { + "name": "vesting_bwprovider_t", "base": "parameter", + "fields": [ + {"name": "actor", "type": "name"}, + {"name": "permission", "type": "name"} + ] + }, { + "name": "vesting_delegation_t", "base": "parameter", + "fields": [ + {"name": "min_amount", "type": "uint64"}, + {"name": "min_remainder", "type": "uint64"}, + {"name": "return_time", "type": "uint32"}, + {"name": "min_time", "type": "uint32"}, + {"name": "max_delegators", "type": "uint32"} + ] + }, { + "name": "vesting_state", "base": "", + "fields": [ + {"name": "id", "type": "uint64"}, + {"name": "withdraw", "type": "vesting_withdraw"}, + {"name": "min_amount", "type": "vesting_amount"}, + {"name": "delegation", "type": "vesting_delegation"}, + {"name": "bwprovider", "type": "vesting_bwprovider"} + ] + }, { + "name": "vesting_stats", "base": "", + "fields": [ + {"name": "supply", "type": "asset"}, + {"name": "notify_acc", "type": "name"} + ] + }, { + "name": "vesting_supply", "base": "", + "fields": [ + {"name": "supply", "type": "asset"} + ] + }, { + "name": "vesting_withdraw_t", "base": "parameter", + "fields": [ + {"name": "intervals", "type": "uint8"}, + {"name": "interval_seconds", "type": "uint32"} + ] + }, { + "name": "withdraw", "base": "", + "fields": [ + {"name": "from", "type": "name"}, + {"name": "to", "type": "name"}, + {"name": "quantity", "type": "asset"} + ] + }, { + "name": "withdrawal", "base": "", + "fields": [ + {"name": "owner", "type": "name"}, + {"name": "to", "type": "name"}, + {"name": "interval_seconds", "type": "uint32"}, + {"name": "remaining_payments", "type": "uint8"}, + {"name": "next_payout", "type": "time_point_sec"}, + {"name": "withdraw_rate", "type": "asset"}, + {"name": "to_withdraw", "type": "asset"} + ] + } + ], + "actions": [ + {"name": "close", "type": "close"}, + {"name": "create", "type": "create"}, + {"name": "delegate", "type": "delegate"}, + {"name": "open", "type": "open"}, + {"name": "procwaiting", "type": "procwaiting"}, + {"name": "retire", "type": "retire"}, + {"name": "setparams", "type": "setparams"}, + {"name": "stopwithdraw", "type": "stopwithdraw"}, + {"name": "undelegate", "type": "undelegate"}, + {"name": "unlocklimit", "type": "unlocklimit"}, + {"name": "validateprms", "type": "validateprms"}, + {"name": "withdraw", "type": "withdraw"} + ], + "events": [ + {"name": "balance", "type": "balance_event"}, + {"name": "stat", "type": "vesting_supply"} + ], + "tables": [{ + "name": "accounts", "type": "account", + "indexes": [{ + "name": "primary", "unique": true, + "orders": [ + {"field": "vesting._sym", "order": "asc"} + ] + } + ] + }, { + "name": "delegation", "type": "delegation", "scope_type": "symbol_code", + "indexes": [{ + "name": "primary", "unique": true, + "orders": [ + {"field": "id", "order": "asc"} + ] + }, { + "name": "delegator", "unique": true, + "orders": [ + {"field": "delegator", "order": "asc"}, + {"field": "delegatee", "order": "asc"} + ] + }, { + "name": "delegatee", "unique": false, + "orders": [ + {"field": "delegatee", "order": "asc"} + ] + } + ] + }, { + "name": "rdelegation", "type": "return_delegation", + "indexes": [{ + "name": "primary", "unique": true, + "orders": [ + {"field": "id", "order": "asc"} + ] + }, { + "name": "date", "unique": false, + "orders": [ + {"field": "date", "order": "asc"} + ] + } + ] + }, { + "name": "stat", "type": "vesting_stats", + "indexes": [{ + "name": "primary", "unique": true, + "orders": [ + {"field": "supply._sym", "order": "asc"} + ] + } + ] + }, { + "name": "vestparams", "type": "vesting_state", "scope_type": "symbol_code", + "indexes": [{ + "name": "primary", "unique": true, + "orders": [ + {"field": "id", "order": "asc"} + ] + } + ] + }, { + "name": "withdrawal", "type": "withdrawal", "scope_type": "symbol_code", + "indexes": [{ + "name": "primary", "unique": true, + "orders": [ + {"field": "owner", "order": "asc"} + ] + }, { + "name": "nextpayout", "unique": false, + "orders": [ + {"field": "next_payout", "order": "asc"} + ] + } + ] + } + ], + "variants": [{ + "name": "variant_vesting_withdraw_vesting_amount_vesting_delegation_vesting_bwprovider", + "types": [ + "vesting_withdraw", + "vesting_amount", + "vesting_delegation", + "vesting_bwprovider" + ] + } + ] +} diff --git a/scripts/deployutils b/scripts/deployutils new file mode 160000 index 00000000..967e60f8 --- /dev/null +++ b/scripts/deployutils @@ -0,0 +1 @@ +Subproject commit 967e60f86e84467eb900110f3fdbe11f10709dbb diff --git a/tests/golos.vesting_test_api.hpp b/tests/golos.vesting_test_api.hpp index bdf0f176..3a1b3ca7 100644 --- a/tests/golos.vesting_test_api.hpp +++ b/tests/golos.vesting_test_api.hpp @@ -123,41 +123,6 @@ struct golos_vesting_api: base_contract_api { ("interest_rate", interest_rate)); } - action_result msig_delegate(name from, name to, asset quantity, uint16_t interest_rate = 0) { - name proposal_name = to; - auto pre_delegated = get_delegated(from, to); - fc::variants auth; - auth.push_back(fc::mutable_variant_object()("actor", from)("permission", name(config::active_name))); - auth.push_back(fc::mutable_variant_object()("actor", to) ("permission", name(config::active_name))); - - variant pretty_trx = args()("expiration", time_point_sec(std::numeric_limits::max())) - ("actions", fc::variants({ - fc::mutable_variant_object()("account", _code)("name", "delegate")("authorization", auth) - ("data", args()("from", from)("to", to)("quantity", quantity)("interest_rate", interest_rate))})); - transaction trx; - abi_serializer::from_variant(pretty_trx, trx, _tester->get_resolver(), base_tester::abi_serializer_max_time); - - auto ret = _tester->push_action(config::msig_account_name, N(propose), from, args() - ("proposer", from)("proposal_name", proposal_name)("trx", trx) - ("requested", std::vector{ {from, config::active_name}, {to, config::active_name} })); - if (ret != base_tester::success()) { return ret; } - - ret = _tester->push_action(config::msig_account_name, N(approve), from, args() - ("proposer", from)("proposal_name", proposal_name) ("level", permission_level{ from, config::active_name })); - if (ret != base_tester::success()) { return ret; } - - if (to != from) { - ret = _tester->push_action(config::msig_account_name, N(approve), to, args() - ("proposer", from)("proposal_name", proposal_name) ("level", permission_level{ to, config::active_name })); - if (ret != base_tester::success()) { return ret; } - } - ret = _tester->push_action(config::msig_account_name, N(exec), to, args() - ("proposer", from)("proposal_name", proposal_name)("executer", to)); - if (ret != base_tester::success()) { return ret; } - _tester->produce_block(); - return get_delegated(from, to) > pre_delegated ? base_tester::success() : base_tester::wasm_assert_msg(string("unsuccessful delegation")); - } - action_result undelegate(name from, name to, asset quantity, bool by_delegatee = false) { return push(N(undelegate), by_delegatee ? to : from, args() ("from", from) diff --git a/tests/golos.vesting_tests.cpp b/tests/golos.vesting_tests.cpp index fbfa0df7..15706d40 100644 --- a/tests/golos.vesting_tests.cpp +++ b/tests/golos.vesting_tests.cpp @@ -602,17 +602,17 @@ BOOST_FIXTURE_TEST_CASE(delegate, golos_vesting_tester) try { BOOST_CHECK_EQUAL(err.missing_auth(N(pasha)), vest.delegate_unauthorized(N(sania), N(pasha), amount, true)); BOOST_TEST_MESSAGE("--- fail when delegate more than scheduled to withdraw"); - BOOST_CHECK_EQUAL(success(), vest.msig_delegate(N(sania), N(pasha), amount, 0)); - BOOST_CHECK_EQUAL(success(), vest.msig_delegate(N(sania), N(tania), amount, 0)); + BOOST_CHECK_EQUAL(success(), vest.delegate(N(sania), N(pasha), amount, 0)); + BOOST_CHECK_EQUAL(success(), vest.delegate(N(sania), N(tania), amount, 0)); BOOST_CHECK_EQUAL(success(), vest.withdraw(N(sania), N(sania), vest.make_asset(100-3*min_remainder))); BOOST_CHECK_EQUAL(err.delegation_no_funds, vest.delegate(N(sania), N(vania), vest.make_asset(min_remainder+1))); BOOST_TEST_MESSAGE("--- succeed when withdraval counted"); - BOOST_CHECK_EQUAL(success(), vest.msig_delegate(N(sania), N(vania), amount)); + BOOST_CHECK_EQUAL(success(), vest.delegate(N(sania), N(vania), amount)); BOOST_TEST_MESSAGE("--- charge limit test"); BOOST_CHECK_EQUAL(success(), charge.use(_issuer, N(pasha), 0, charge_prop * cfg::_100percent, cfg::_100percent)); BOOST_CHECK_EQUAL(err.cutoff, vest.delegate(N(pasha), N(vania), vest.make_asset(default_vesting_amount * (1.01 - charge_prop)))); - BOOST_CHECK_EQUAL(success(), vest.msig_delegate(N(pasha), N(vania), vest.make_asset(default_vesting_amount * (1.0 - charge_prop)))); + BOOST_CHECK_EQUAL(success(), vest.delegate(N(pasha), N(vania), vest.make_asset(default_vesting_amount * (1.0 - charge_prop)))); BOOST_TEST_MESSAGE("--- check max delegators limit"); auto additional_users = add_accounts_with_vests(delegation_max_delegators + 1 - 2); // 2 are already delegated