Class: ArkEcosystem::Crypto::Transactions::Deserializers::Vote
- Defined in:
- lib/arkecosystem/crypto/transactions/deserializers/vote.rb
Overview
The deserializer for vote transactions.
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from ArkEcosystem::Crypto::Transactions::Deserializers::Base
Instance Method Details
#deserialize ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/arkecosystem/crypto/transactions/deserializers/vote.rb', line 7 def deserialize @transaction.asset = { votes: [] } vote_length = @binary.unpack("C#{@asset_offset / 2}Q<").last & 0xff i = 0 while i < vote_length index_start = @asset_offset + 2 + i * 2 * 34 index_end = 2 * 34 vote = @serialized[index_start, index_end] vote = (vote[1] == '1' ? '+' : '-') + vote[2..-1] @transaction.asset[:votes].push(vote) i += 1 end @transaction.parse_signatures(@serialized, @asset_offset + 2 + vote_length * 34 * 2) end |