Sha256: f301274a980950bf59c8fa445648147868df7323e5bb5c2b2106f05e66082255

Contents?: true

Size: 516 Bytes

Versions: 1

Compression:

Stored size: 516 Bytes

Contents

module AbiCoderRb
  def decode_fixed_array(type, data)
    l = type.length
    inner_type = type.inner_type
    if inner_type.dynamic?
      start_positions = (0...l).map { |i| decode_uint256(data[32 * i, 32]) }
      start_positions.push(data.size)

      outputs = (0...l).map { |i| data[start_positions[i]...start_positions[i + 1]] }

      outputs.map { |out| decode_type(inner_type, out) }
    else
      (0...l).map { |i| decode_type(inner_type, data[inner_type.size * i, inner_type.size]) }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
abi_coder_rb-0.2.9 lib/abi_coder_rb/decode/decode_fixed_array.rb