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

Namespaces

 catapult
 
 catapult::observers
 

Functions

 catapult::observers::DEFINE_OBSERVER (BalanceTransfer, model::BalanceTransferNotification, [](const auto &notification, const ObserverContext &context) { auto &cache=context.Cache.sub< cache::AccountStateCache >();auto senderIter=cache.find(notification.Sender);auto recipientIter=cache.find(context.Resolvers.resolve(notification.Recipient));auto &senderState=senderIter.get();auto &recipientState=recipientIter.get();auto mosaicId=context.Resolvers.resolve(notification.MosaicId);if(NotifyMode::Commit==context.Mode) Transfer(senderState, recipientState, mosaicId, notification.Amount);else Transfer(recipientState, senderState, mosaicId, notification.Amount);})