Sha256: 9822be87e9f49fee3dfa97d983ad487c48b6ad45499663aa611a2b72cac989cf

Contents?: true

Size: 708 Bytes

Versions: 3

Compression:

Stored size: 708 Bytes

Contents

# frozen_string_literal: true

module Silkey # :nodoc: all
  class RegistryContract
    CONTRACT_NAME = 'RegistryContractInstance'

    class << self
      def get_address(name)
        new.get_address(name)
      end
    end

    attr_reader :contract

    delegate :call, to: :contract, prefix: true

    def initialize(params = {})
      @contract = ContractFactory.call(default_params.merge(params))
    end

    def get_address(name)
      Silkey::Utils.add0x(contract_call.get_address(name))
    end

    def default_params
      {
        name: CONTRACT_NAME,
        address: Configuration.registry_contract_address,
        abi: Configuration.registry_contract_abi,
      }.freeze
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
silkey-sdk-0.0.3 lib/silkey/registry_contract/registry_contract.rb
silkey-sdk-0.0.2 lib/silkey/registry_contract/registry_contract.rb
silkey-sdk-0.0.1 lib/silkey/registry_contract/registry_contract.rb