CatapultServer  v0.5.0.1 (Elephant)
HarvestingConfiguration.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include <boost/filesystem/path.hpp>
23 #include <string>
24 
25 namespace catapult { namespace utils { class ConfigurationBag; } }
26 
27 namespace catapult { namespace harvesting {
28 
31  public:
33  std::string HarvestKey;
34 
37 
40 
42  std::string Beneficiary;
43 
44  private:
45  HarvestingConfiguration() = default;
46 
47  public:
50 
51  public:
54 
56  static HarvestingConfiguration LoadFromPath(const boost::filesystem::path& resourcesPath);
57  };
58 }}
catapult::harvesting::HarvestingConfiguration::Uninitialized
static HarvestingConfiguration Uninitialized()
Creates an uninitialized harvesting configuration.
Definition: HarvestingConfiguration.cpp:30
Mosaic.h
catapult::harvesting::HarvestingConfiguration::IsAutoHarvestingEnabled
bool IsAutoHarvestingEnabled
true if auto harvesting is enabled.
Definition: HarvestingConfiguration.h:36
catapult::model::TransactionNotification
Notifies the arrival of a transaction.
Definition: Notifications.h:231
catapult::utils::VerifyBagSizeLte
void VerifyBagSizeLte(const ConfigurationBag &bag, size_t expectedSize)
Verifies that the number of properties in bag is no greater than expectedSize.
Definition: utils/ConfigurationUtils.cpp:38
catapult::observers::calculator
uint8_t const model::InflationCalculator & calculator
Definition: HarvestFeeObserver.cpp:65
catapult::observers::DECLARE_OBSERVER
DECLARE_OBSERVER(HarvestFee, Notification)(MosaicId currencyMosaicId
catapult::observers::MAKE_OBSERVER
return MAKE_OBSERVER(HarvestFee, Notification,([mosaicId, percentage, calculator](const auto &notification, auto &context) { auto inflationAmount=calculator.getSpotAmount(context.Height);auto totalAmount=notification.TotalFee+inflationAmount;auto beneficiaryAmount=ShouldShareFees(notification.Signer, notification.Beneficiary, percentage) ? Amount(totalAmount.unwrap() *percentage/100) :Amount();auto harvesterAmount=totalAmount - beneficiaryAmount;ApplyFee(notification.Signer, { mosaicId, harvesterAmount }, context);if(Amount() !=beneficiaryAmount) ApplyFee(notification.Beneficiary, { mosaicId, beneficiaryAmount }, context);if(Amount() !=inflationAmount &&NotifyMode::Commit==context.Mode) { model::InflationReceipt receipt(model::Receipt_Type_Inflation, mosaicId, inflationAmount);context.StatementBuilder().addReceipt(receipt);} }))
catapult::harvesting::HarvestingConfiguration::HarvestKey
std::string HarvestKey
Harvest key.
Definition: HarvestingConfiguration.h:33
catapult::Amount
utils::BaseValue< uint64_t, Amount_tag > Amount
Definition: src/catapult/types.h:76
catapult::model::InflationReceipt
Binary layout for an inflation receipt.
Definition: Receipt.h:97
InflationCalculator.h
catapult::observers::NotifyMode
NotifyMode
Enumeration of possible notification modes.
Definition: ObserverContext.h:41
catapult::harvesting::HarvestingConfiguration
Harvesting configuration settings.
Definition: HarvestingConfiguration.h:30
catapult::model::InflationCalculator
Calculator for calculating the inflation at a given height and the total inflation up to a given heig...
Definition: InflationCalculator.h:28
catapult::harvesting::HarvestingConfiguration::HarvestingConfiguration
HarvestingConfiguration()=default
catapult::utils::ConfigurationBag
A simple bag of properties.
Definition: ConfigurationBag.h:57
ConfigurationFileLoader.h
catapult::MosaicId
utils::BaseValue< uint64_t, MosaicId_tag > MosaicId
Definition: src/catapult/types.h:79
catapult::observers::Notification
model::TransactionNotification Notification
Definition: CompletedAggregateObserver.cpp:29
Observers.h
HarvestingConfiguration.h
catapult::model::InflationCalculator::getSpotAmount
Amount getSpotAmount(Height height) const
Gets the inflation amount at height.
Definition: InflationCalculator.cpp:35
catapult::observers::harvestBeneficiaryPercentage
uint8_t harvestBeneficiaryPercentage
Definition: HarvestFeeObserver.cpp:64
catapult::harvesting::HarvestingConfiguration::Beneficiary
std::string Beneficiary
Public key of the account receiving part of the harvested fee.
Definition: HarvestingConfiguration.h:42
catapult::model::Mosaic
MosaicT< MosaicId > Mosaic
Definition: Mosaic.h:38
AccountStateCache.h
ConfigurationUtils.h
ConfigurationBag.h
catapult::observers::percentage
auto percentage
Definition: HarvestFeeObserver.cpp:67
catapult::cache::ProcessForwardedAccountState
void ProcessForwardedAccountState(AccountStateCacheDelta &cache, const Key &publicKey, const consumer< state::AccountState & > &action)
Forwards account state or linked account state found in cache associated with publicKey to action.
Definition: AccountStateCacheUtils.cpp:26
catapult::harvesting::HarvestingConfiguration::LoadFromPath
static HarvestingConfiguration LoadFromPath(const boost::filesystem::path &resourcesPath)
Loads a harvesting configuration from resourcesPath.
Definition: HarvestingConfiguration.cpp:52
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::harvesting::HarvestingConfiguration::LoadFromBag
static HarvestingConfiguration LoadFromBag(const utils::ConfigurationBag &bag)
Loads a harvesting configuration from bag.
Definition: HarvestingConfiguration.cpp:34
AccountStateCacheUtils.h
catapult::Key
utils::ByteArray< Key_Size, Key_tag > Key
Definition: src/catapult/types.h:41
LOAD_HARVESTING_PROPERTY
#define LOAD_HARVESTING_PROPERTY(NAME)
catapult::harvesting::HarvestingConfiguration::MaxUnlockedAccounts
uint32_t MaxUnlockedAccounts
Maximum number of unlocked accounts.
Definition: HarvestingConfiguration.h:39