2 #include <fc/io/json.hpp>
4 #include <boost/rational.hpp>
19 template <
class T>
bool is_unique(
const std::vector<T>& input)
21 std::vector<T> data(input);
23 sort(data.begin(), data.end());
24 return adjacent_find(data.begin(), data.end()) == data.end();
84 FC_ASSERT(
title.size() < 256,
"Title larger than size limit");
85 FC_ASSERT(fc::is_utf8(
title),
"Title not formatted in UTF8");
86 FC_ASSERT(
body.size() > 0,
"Body is empty");
87 FC_ASSERT(fc::is_utf8(
body),
"Body not formatted in UTF8");
135 FC_ASSERT(
amount.
amount > 0,
"Cannot transfer a negative amount (aka: stealing)");
137 FC_ASSERT(fc::is_utf8(
memo),
"Memo is not UTF8");
139 FC_CAPTURE_AND_RETHROW((*
this))
174 FC_ASSERT(
url.size() > 0,
"URL size must be greater than 0");
175 FC_ASSERT(fc::is_utf8(
url),
"URL is not valid UTF8");
198 FC_ASSERT(
fee.
amount >= 0,
"fee cannot be negative");
206 FC_ASSERT(fc::is_utf8(
json_meta),
"JSON Metadata not formatted in UTF8");
207 FC_ASSERT(fc::json::is_valid(
json_meta),
"JSON Metadata not valid JSON");
217 FC_ASSERT(
who ==
to ||
who ==
agent,
"to or agent must approve escrow");
226 FC_ASSERT(
who ==
from ||
who ==
to,
"who must be from or to");
253 "Cannot set new owner authority to the recent owner authority");
288 auto max_delegation = SCORUM_CREATE_ACCOUNT_REG_COMMITTEE_DELEGATION_MAX;
289 FC_ASSERT(
scorumpower <= max_delegation,
"Delegation cannot be more than ${0}", (
"0", max_delegation));
298 FC_ASSERT(
start <=
deadline,
"Deadline time must be greater or equal then start time");
359 fc::flat_set<market_type> set_of_markets(
markets.begin(),
markets.end());
361 FC_ASSERT(set_of_markets.size() ==
markets.size(),
"You provided duplicates in market list.",
363 (
"set_of_markets", set_of_markets));
388 const fc::flat_set<wincase_type> set_of_wincases(
wincases.begin(),
wincases.end());
390 FC_ASSERT(set_of_wincases.size() ==
wincases.size(),
"You provided duplicates in wincases list.",
392 (
"set_of_markets", set_of_wincases));
403 FC_ASSERT(
stake >= SCORUM_MIN_BET_STAKE,
"Stake must be greater or equal then ${s}", (
"s", SCORUM_MIN_BET_STAKE));
404 FC_ASSERT(
odds.
numerator > 0,
"odds numerator must be greater then zero");
405 FC_ASSERT(
odds.
denominator > 0,
"odds denominator must be greater then zero");
408 const auto min = SCORUM_MIN_ODDS.base();
409 const auto max = SCORUM_MIN_ODDS.inverted();
412 boost::rational<odds_value_type> min_odds(min.numerator, min.denominator);
413 boost::rational<odds_value_type> max_odds(max.numerator, max.denominator);
416 FC_ASSERT(bet_odds <= max_odds,
"Invalid odds value",
419 (
"min_odds", protocol::odds(min).to_string())
420 (
"max_odds", protocol::odds(max).to_string()));
422 FC_ASSERT(bet_odds >= min_odds,
"Invalid odds value",
425 (
"min_odds", protocol::odds(min).to_string())
426 (
"max_odds", protocol::odds(max).to_string()));
432 FC_ASSERT(
bet_uuids.size() > 0,
"List of bets is empty.");
433 FC_ASSERT(is_unique<uuid_type>(
bet_uuids),
"You provided duplicates in bets list.", (
"bets",
bet_uuids));
440 FC_ASSERT(!
uuid.is_nil(),
"uuid must not be nil");
447 FC_ASSERT(!
uuid.is_nil(),
"uuid must not be nil");
448 FC_ASSERT(
moderator == SCORUM_NFT_MODERATOR,
"invalid moderator account");
454 FC_ASSERT(!
uuid.is_nil(),
"uuid must not be nil");
455 FC_ASSERT(
moderator == SCORUM_NFT_MODERATOR,
"invalid moderator account");
460 FC_ASSERT(!
uuid.is_nil(),
"uuid must not be nil");
461 FC_ASSERT(
moderator == SCORUM_NFT_MODERATOR,
"invalid moderator account");
467 FC_ASSERT(!
uuid.is_nil(),
"uuid must not be nil");
469 FC_ASSERT(
verification_key.size() == 64,
"verification_key should have 64 symbols length");
470 FC_ASSERT(
seed.size() == 64,
"seed should have 64 symbols length");
475 FC_ASSERT(!
uuid.is_nil(),
"uuid must not be nil");
477 FC_ASSERT(
proof.size() == 160,
"proof should have 160 symbols length");
478 FC_ASSERT(
vrf.size() == 128,
"vrf should have 128 symbols length");
479 FC_ASSERT(
result >= 100,
"result should be greater or equal 100");
#define SCORUM_MAX_MEMO_SIZE
#define SCORUM_100_PERCENT
void validate_contract_metadata(const std::string &metadata)
void validate_secret(const std::string &secret_hex)
void validate_secret_hash(const std::string &secret_hash)
void validate_json_metadata(const std::string &json_metadata)
void validate_permlink(const std::string &permlink)
bool is_unique(const std::vector< T > &input)
fc::static_variant< vote_operation, comment_operation, transfer_operation, transfer_to_scorumpower_operation, withdraw_scorumpower_operation, account_create_by_committee_operation, account_create_operation, account_create_with_delegation_operation, account_update_operation, witness_update_operation, account_witness_vote_operation, account_witness_proxy_operation, delete_comment_operation, comment_options_operation, set_withdraw_scorumpower_route_to_account_operation, set_withdraw_scorumpower_route_to_dev_pool_operation, prove_authority_operation, request_account_recovery_operation, recover_account_operation, change_recovery_account_operation, escrow_approve_operation, escrow_dispute_operation, escrow_release_operation, escrow_transfer_operation, decline_voting_rights_operation, delegate_scorumpower_operation, create_budget_operation, close_budget_operation, proposal_vote_operation, proposal_create_operation, atomicswap_initiate_operation, atomicswap_redeem_operation, atomicswap_refund_operation, close_budget_by_advertising_moderator_operation, update_budget_operation, create_game_operation, cancel_game_operation, update_game_markets_operation, update_game_start_time_operation, post_game_results_operation, post_bet_operation, cancel_pending_bets_operation, delegate_sp_from_reg_pool_operation, create_nft_operation, update_nft_meta_operation, create_game_round_operation, update_game_round_result_operation, adjust_nft_experience_operation, update_nft_name_operation, author_reward_operation, comment_benefficiary_reward_operation, comment_payout_update_operation, comment_reward_operation, curation_reward_operation, hardfork_operation, producer_reward_operation, active_sp_holders_reward_operation, return_scorumpower_delegation_operation, shutdown_witness_operation, witness_miss_block_operation, expired_contract_refund_operation, acc_finished_vesting_withdraw_operation, devpool_finished_vesting_withdraw_operation, acc_to_acc_vesting_withdraw_operation, devpool_to_acc_vesting_withdraw_operation, acc_to_devpool_vesting_withdraw_operation, devpool_to_devpool_vesting_withdraw_operation, proposal_virtual_operation, budget_outgo_operation, budget_owner_income_operation, active_sp_holders_reward_legacy_operation, budget_closing_operation, bets_matched_operation, game_status_changed_operation, bet_resolved_operation, bet_cancelled_operation, bet_restored_operation, bet_updated_operation > operation
fc::fixed_string_16 account_name_type
void validate_wincases(const fc::flat_set< wincase_type > &wincases)
void validate_game(const game_type &game, const fc::flat_set< market_type > &markets)
bool is_asset_type(asset asset, asset_symbol_type symbol)
uint64_t asset_symbol_type
void validate_account_name(const std::string &name)
void operation_validate(const proposal_operation &op)
void validate_markets(const fc::flat_set< market_type > &markets)
void validate_wincase(const wincase_type &wincase)
account_name_type new_account_name
std::string json_metadata
account_name_type creator
account_name_type new_account_name
std::string json_metadata
account_name_type new_account_name
account_name_type creator
std::string json_metadata
account_name_type account
optional< authority > owner
optional< authority > active
std::string json_metadata
optional< authority > posting
account_name_type account
account_name_type account
account_name_type witness
account_name_type moderator
asset_symbol_type symbol() const
account_name_type recipient
account_name_type initiator
account_name_type participant
uint32_t weight_threshold
bool is_impossible() const
account_name_type moderator
moderator account name
std::vector< uuid_type > bet_uuids
bets list that is being canceling
account_name_type better
owner
account_name_type new_recovery_account
The account that creates the recover request.
account_name_type account_to_recover
The account that would be recovered in case of compromise.
account_name_type moderator
std::string json_metadata
fc::time_point_sec deadline
game_type game
game type (soccer, hockey, etc ...)
std::vector< market_type > markets
list of markets
account_name_type moderator
moderator account name
std::string json_metadata
JSON metadata.
std::string verification_key
std::string json_metadata
account_name_type account
asset scorumpower
The amount of scorumpower delegated.
account_name_type delegatee
The account receiving scorumpower.
account_name_type delegator
The account delegating scorumpower.
account_name_type delegatee
account_name_type reg_committee_member
asset scorum_amount
the amount of scorum to release
account_name_type to
the original 'to'
account_name_type who
the account that is attempting to release the funds, determines valid 'receiver'
account_name_type receiver
the account that should receive funds (might be from, might be to)
time_point_sec ratification_deadline
time_point_sec escrow_expiration
account_name_type better
owner for new bet
asset stake
stake amount in SCR
wincase_type wincase
wincase
odds_input odds
odds - rational coefficient that define potential result (p). p = odds * stake
account_name_type moderator
moderator account name
std::vector< wincase_type > wincases
list of wincases
account_name_type creator
account_name_type voting_account
account_name_type challenged
account_name_type account_to_recover
The account to be recovered.
authority new_owner_authority
The new owner authority as specified in the request account recovery operation.
authority recent_owner_authority
account_name_type account_to_recover
The account to recover. This is likely due to a compromised owner authority.
account_name_type recovery_account
The recovery account is listed as the recovery account on the account to recover.
authority new_owner_authority
known by the account to recover and will be confirmed in a recover_account_operation
account_name_type from_account
account_name_type to_account
account_name_type from_account
account_name_type to
Account to transfer asset to.
asset amount
The amount of asset to transfer from from to to.
account_name_type to
if null, then same as from
std::string json_metadata
account_name_type moderator
moderator account name
account_name_type moderator
moderator account name
account_name_type moderator
account_name_type account
chain_properties proposed_chain_props