CatapultServer  v0.5.0.1 (Elephant)
HarvestFeeObserver.cpp File Reference
Include dependency graph for HarvestFeeObserver.cpp:

Namespaces

 catapult
 
 catapult::observers
 

Functions

 catapult::observers::DECLARE_OBSERVER (HarvestFee, Notification)(MosaicId currencyMosaicId
 
return catapult::observers::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);} }))
 

Variables

uint8_t catapult::observers::harvestBeneficiaryPercentage
 
uint8_t const model::InflationCalculator & catapult::observers::calculator
 
auto catapult::observers::percentage = harvestBeneficiaryPercentage