CatapultServer
v0.5.0.1 (Elephant)
|
Go to the documentation of this file.
22 #include <boost/filesystem/path.hpp>
27 namespace catapult {
namespace harvesting {
static HarvestingConfiguration Uninitialized()
Creates an uninitialized harvesting configuration.
Definition: HarvestingConfiguration.cpp:30
bool IsAutoHarvestingEnabled
true if auto harvesting is enabled.
Definition: HarvestingConfiguration.h:36
Notifies the arrival of a transaction.
Definition: Notifications.h:231
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
uint8_t const model::InflationCalculator & calculator
Definition: HarvestFeeObserver.cpp:65
DECLARE_OBSERVER(HarvestFee, Notification)(MosaicId currencyMosaicId
return MAKE_OBSERVER(HarvestFee, Notification,([mosaicId, percentage, calculator](const auto ¬ification, 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);} }))
std::string HarvestKey
Harvest key.
Definition: HarvestingConfiguration.h:33
utils::BaseValue< uint64_t, Amount_tag > Amount
Definition: src/catapult/types.h:76
Binary layout for an inflation receipt.
Definition: Receipt.h:97
NotifyMode
Enumeration of possible notification modes.
Definition: ObserverContext.h:41
Harvesting configuration settings.
Definition: HarvestingConfiguration.h:30
Calculator for calculating the inflation at a given height and the total inflation up to a given heig...
Definition: InflationCalculator.h:28
HarvestingConfiguration()=default
A simple bag of properties.
Definition: ConfigurationBag.h:57
utils::BaseValue< uint64_t, MosaicId_tag > MosaicId
Definition: src/catapult/types.h:79
model::TransactionNotification Notification
Definition: CompletedAggregateObserver.cpp:29
Amount getSpotAmount(Height height) const
Gets the inflation amount at height.
Definition: InflationCalculator.cpp:35
uint8_t harvestBeneficiaryPercentage
Definition: HarvestFeeObserver.cpp:64
std::string Beneficiary
Public key of the account receiving part of the harvested fee.
Definition: HarvestingConfiguration.h:42
MosaicT< MosaicId > Mosaic
Definition: Mosaic.h:38
auto percentage
Definition: HarvestFeeObserver.cpp:67
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
static HarvestingConfiguration LoadFromPath(const boost::filesystem::path &resourcesPath)
Loads a harvesting configuration from resourcesPath.
Definition: HarvestingConfiguration.cpp:52
Definition: AddressExtractionExtension.cpp:28
static HarvestingConfiguration LoadFromBag(const utils::ConfigurationBag &bag)
Loads a harvesting configuration from bag.
Definition: HarvestingConfiguration.cpp:34
utils::ByteArray< Key_Size, Key_tag > Key
Definition: src/catapult/types.h:41
#define LOAD_HARVESTING_PROPERTY(NAME)
uint32_t MaxUnlockedAccounts
Maximum number of unlocked accounts.
Definition: HarvestingConfiguration.h:39