Sha256: 999d2baf1548d6f78fb45533a2e210f2b12bd2bf2b8ba31751faaac87a095e73

Contents?: true

Size: 1.54 KB

Versions: 1

Compression:

Stored size: 1.54 KB

Contents

# frozen_string_literal: true

# Copyright (c) 2018 by Jiang Jinyang <jjyruby@gmail.com>
# 
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# 
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# 
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.


require 'ciri/rlp'
require 'ciri/utils'
require 'ciri/types/address'
require 'ciri/types/uint'

module Ciri
  module Types

    class LogEntry
      include RLP::Serializable
      schema(
          address: Types::Address,
          topics: [Types::UInt32],
          data: RLP::Bytes
      )

      def to_blooms
        [address.to_s, *topics.map {|t| Utils.big_endian_encode(t, size: 32)}]
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ciri-common-0.1.0 lib/ciri/types/log_entry.rb