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

Namespaces

 catapult
 
 catapult::observers
 

Functions

 catapult::observers::DEFINE_OBSERVER (BalanceDebit, model::BalanceDebitNotification, [](const auto &notification, const ObserverContext &context) { auto &cache=context.Cache.sub< cache::AccountStateCache >();auto senderIter=cache.find(notification.Sender);auto &senderState=senderIter.get();auto mosaicId=context.Resolvers.resolve(notification.MosaicId);if(NotifyMode::Commit==context.Mode) senderState.Balances.debit(mosaicId, notification.Amount);else senderState.Balances.credit(mosaicId, notification.Amount);})