Skip to content

Commit

Permalink
Merge pull request #312 from ConcealNetwork/currency-update
Browse files Browse the repository at this point in the history
Update currency and fee calculation
  • Loading branch information
AxVultis authored Oct 31, 2022
2 parents f8651d8 + 5325c5c commit bf3f164
Show file tree
Hide file tree
Showing 15 changed files with 544 additions and 336 deletions.
4 changes: 1 addition & 3 deletions src/BlockchainExplorer/BlockchainExplorerDataBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,11 @@ bool BlockchainExplorerDataBuilder::fillTransactionDetails(const Transaction& tr
return false;
}
transactionDetails.totalInputsAmount = core.currency().getTransactionAllInputsAmount(transaction, transactionDetails.blockHeight);

transactionDetails.fee = core.currency().getTransactionFee(transaction, transactionDetails.blockHeight);
if (transaction.inputs.size() > 0 && transaction.inputs.front().type() == typeid(BaseInput)) {
//It's gen transaction
transactionDetails.fee = 0;
transactionDetails.mixin = 0;
} else {
transactionDetails.fee = inputsAmount < transactionDetails.totalOutputsAmount ? cn::parameters::MINIMUM_FEE : core.currency().getTransactionFee(transaction, transactionDetails.blockHeight);
uint64_t mixin;
if (!getMixin(transaction, mixin)) {
return false;
Expand Down
10 changes: 5 additions & 5 deletions src/ConcealWallet/ConcealWallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1800,8 +1800,8 @@ bool conceal_wallet::deposit(const std::vector<std::string> &args)
* Change arg to uint64_t using boost then
* multiply by min_term so user can type in months
**/
uint64_t min_term = m_testnet ? parameters::TESTNET_DEPOSIT_MIN_TERM_V3 : parameters::DEPOSIT_MIN_TERM_V3;
uint64_t max_term = m_testnet ? parameters::TESTNET_DEPOSIT_MAX_TERM_V3 : parameters::DEPOSIT_MAX_TERM_V3;
uint64_t min_term = m_currency.depositMinTermV3();
uint64_t max_term = m_currency.depositMaxTermV3();
uint64_t deposit_term = boost::lexical_cast<uint64_t>(args[0]) * min_term;

/* Now validate the deposit term and the amount */
Expand All @@ -1827,10 +1827,10 @@ bool conceal_wallet::deposit(const std::vector<std::string> &args)
return true;
}

if (deposit_amount < cn::parameters::DEPOSIT_MIN_AMOUNT)
if (deposit_amount < m_currency.depositMinAmount())
{
logger(ERROR, BRIGHT_RED) << "Deposit amount is too small, min=" << cn::parameters::DEPOSIT_MIN_AMOUNT
<< ", given=" << m_currency.formatAmount(deposit_amount);
logger(ERROR, BRIGHT_RED) << "Deposit amount is too small, min=" << m_currency.depositMinAmount()
<< ", given=" << m_currency.formatAmount(deposit_amount);
return true;
}

Expand Down
6 changes: 5 additions & 1 deletion src/CryptoNoteConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ namespace cn
const uint32_t DEPOSIT_HEIGHT_V3 = 413400; /* consensus 2019 - deposts v3.0 */
const uint64_t DEPOSIT_MIN_TOTAL_RATE_FACTOR = 0; /* constant rate */
const uint64_t DEPOSIT_MAX_TOTAL_RATE = 4; /* legacy deposits */
const uint32_t DEPOSIT_HEIGHT_V4 = 1162162; /* enforce deposit terms */
const uint32_t BLOCK_WITH_MISSING_INTEREST = 425799; /* */

static_assert(DEPOSIT_MIN_TERM > 0, "Bad DEPOSIT_MIN_TERM");
static_assert(DEPOSIT_MIN_TERM <= DEPOSIT_MAX_TERM, "Bad DEPOSIT_MAX_TERM");
Expand Down Expand Up @@ -126,6 +128,8 @@ namespace cn
const uint32_t TESTNET_DEPOSIT_MIN_TERM_V3 = 30; /* testnet deposits 1 month -> 1 hour */
const uint32_t TESTNET_DEPOSIT_MAX_TERM_V3 = 12 * 30; /* testnet deposits 1 year -> 12 hour */
const uint32_t TESTNET_DEPOSIT_HEIGHT_V3 = 60;
const uint32_t TESTNET_DEPOSIT_HEIGHT_V4 = 300000;
const uint32_t TESTNET_BLOCK_WITH_MISSING_INTEREST = 0; /* testnet is not impacted */

static_assert(0 < UPGRADE_VOTING_THRESHOLD && UPGRADE_VOTING_THRESHOLD <= 100, "Bad UPGRADE_VOTING_THRESHOLD");
static_assert(UPGRADE_VOTING_WINDOW > 1, "Bad UPGRADE_VOTING_WINDOW");
Expand Down Expand Up @@ -368,7 +372,7 @@ namespace cn
{125000, "8a1737f2eee125776dff01288ada59ced95f9ab3a3fcbbed9c32a3dc20cad033"},
{130000, "30be866410a6a2bb4d7fdf69dc8e8256af116c5a8fdcf5169096a211c01bf160"},
{135000, "eaf75463b54076c4db11afb5d4917cded75b329b84b33fc8f455b7275867449c"},
{140000, "645512f82ab6e20fd8531716ea1f735fcaf5dcadeaec06bb4c238b36057b4934"}
{140000, "645512f82ab6e20fd8531716ea1f735fcaf5dcadeaec06bb4c238b36057b4934"}
};

} // namespace cn
Expand Down
Loading

0 comments on commit bf3f164

Please sign in to comment.