Skip to content

Commit

Permalink
Refactor constants so there is no hidden calculation in the code
Browse files Browse the repository at this point in the history
  • Loading branch information
VanGrx committed Jun 4, 2020
1 parent 0db2437 commit 1276100
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
12 changes: 8 additions & 4 deletions src/cryptonote_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,14 @@
constexpr uint64_t SAFEX_COMMAND_PROTOCOL_VERSION = 1;

//Safex token stake constants
constexpr uint64_t SAFEX_MINIMUM_TOKEN_STAKE_AMOUNT = 10000 * SAFEX_TOKEN;
constexpr uint64_t SAFEX_DEFAULT_TOKEN_STAKE_EXPIRY_PERIOD = 500000;
constexpr uint64_t SAFEX_DEFAULT_INTERVAL_PERIOD = 1000; //blocks
constexpr uint64_t SAFEX_DEFAULT_MINUMUM_TOKEN_STAKE_PERIOD = SAFEX_DEFAULT_INTERVAL_PERIOD*10; //blocks
constexpr uint64_t SAFEX_MINIMUM_TOKEN_STAKE_AMOUNT = 10000 * SAFEX_TOKEN;
constexpr uint64_t SAFEX_DEFAULT_TOKEN_STAKE_EXPIRY_PERIOD = 500000;
constexpr uint64_t SAFEX_DEFAULT_INTERVAL_PERIOD_FAKECHAIN = 10; //blocks
constexpr uint64_t SAFEX_DEFAULT_INTERVAL_PERIOD_TESTNET = 10; //blocks
constexpr uint64_t SAFEX_DEFAULT_INTERVAL_PERIOD = 1000; //blocks
constexpr uint64_t SAFEX_DEFAULT_MINUMUM_TOKEN_STAKE_PERIOD_FAKECHAIN = SAFEX_DEFAULT_INTERVAL_PERIOD_FAKECHAIN*3; //blocks
constexpr uint64_t SAFEX_DEFAULT_MINUMUM_TOKEN_STAKE_PERIOD_TESTNET = SAFEX_DEFAULT_INTERVAL_PERIOD_TESTNET*1; //blocks
constexpr uint64_t SAFEX_DEFAULT_MINUMUM_TOKEN_STAKE_PERIOD = SAFEX_DEFAULT_INTERVAL_PERIOD*10; //blocks

//Safex network fee constants
constexpr uint64_t SAFEX_DEFAULT_NETWORK_FEE_PERCENTAGE = 5;
Expand Down
8 changes: 4 additions & 4 deletions src/safex/safex_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ namespace safex
{

if (nettype == cryptonote::network_type::FAKECHAIN)
return SAFEX_DEFAULT_INTERVAL_PERIOD/100;
return SAFEX_DEFAULT_INTERVAL_PERIOD_FAKECHAIN;
else if (nettype == cryptonote::network_type::TESTNET)
return SAFEX_DEFAULT_INTERVAL_PERIOD/100;
return SAFEX_DEFAULT_INTERVAL_PERIOD_TESTNET;
else
return SAFEX_DEFAULT_INTERVAL_PERIOD;
}
Expand Down Expand Up @@ -217,9 +217,9 @@ namespace safex
{

if (nettype == cryptonote::network_type::FAKECHAIN)
return get_safex_interval_period(cryptonote::network_type::FAKECHAIN) * 3;
return SAFEX_DEFAULT_MINUMUM_TOKEN_STAKE_PERIOD_FAKECHAIN;
else if (nettype == cryptonote::network_type::TESTNET)
return get_safex_interval_period(cryptonote::network_type::TESTNET) * 1;
return SAFEX_DEFAULT_MINUMUM_TOKEN_STAKE_PERIOD_TESTNET;
else
return SAFEX_DEFAULT_MINUMUM_TOKEN_STAKE_PERIOD;
}
Expand Down

0 comments on commit 1276100

Please sign in to comment.