State Transitions
These messages (Msg) in the energy module trigger state transitions.
Value may represents {V}, {A} and {A,V}
Route Key-Value storage is `0x00 | Source | Destination -> ProtocolBuffer(Route)`
Value Key-Value storage is `0x01 | Destination -> ProtocolBuffer(Value)`
Route creation
- Save destination account if account not already exist in storage (sdk's account keeper)
- Save route with given source, destination, alias and empty route value if route not already exist
- Call
OnCoinsTransfercyberbank's module hook to trigger index of balances to update with destination account (not storage)
Route set
- If route have zero value than escrow new value into
EnergyGridaccount - If route have old value more than new value to set than send
SendCoinsFromModuleToAccountfromEnergyGridaccount to source account difference between old and new values (old-new) - If route have old value less than new value to set than escrow with
SendCoinsFromAccountToModulefrom source account toEnergyGridaccount difference between new and old values (new-old) - Update routed to destination energy value (add of sub value)
- Update route with updated value
- Call
OnCoinsTransfercyberbank's module hook to trigger index of balances to update with source and destination accounts (not storage)
Route's alias edit
- Update route with new alias
Route remove
- Send
SendCoinsFromModuleToAccountfromEnergyGridaccount to source account route value (volts and amperes) - Update routed to destination energy value (sub value)
- Remove route
- Call
OnCoinsTransfercyberbank's module hook to trigger index of balances to update with source and destination accounts (not storage)
Import routes on genesis
- Initialize or update (add) routed to destination value
- Set route
- Call
OnCoinsTransfercyberbank's module hook to trigger index of balances to update with source and destination accounts (not storage)