Module: Filecoin::Deals::State

Included in:
Filecoin::Deal
Defined in:
lib/filecoin/deals/state.rb

Constant Summary collapse

STATES =
%i[
  unknown
  not_found
  proposal_rejected
  proposal_accepted
  staged
  sealing
  active
  expired
  slashed
  failing
  funds_ensured
  waiting_for_data_request
  validating
  waiting_for_acceptance
  transferring
  waiting_for_data
  verifying_data
  ensure_provider_funds
  ensure_client_funds
  provider_funding
  client_funding
  publish
  publishing
  error
  completed
].freeze
GOOD_STATES =
%i[proposal_accepted sealing active].freeze
BAD_STATES =
%i[failing error].freeze
PENDING_STATES =
%i[
  ensure_client_funds client_funding funds_ensured
  waiting_for_data_request transferring validating
].freeze
FINISHED_STATES =
%i[slashed expired].freeze

Instance Method Summary collapse

Instance Method Details

#bad?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/filecoin/deals/state.rb', line 46

def bad?
  BAD_STATES.include?(STATES[state])
end

#finished?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/filecoin/deals/state.rb', line 50

def finished?
  FINISHED_STATES.include?(STATES[state])
end

#good?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/filecoin/deals/state.rb', line 54

def good?
  GOOD_STATES.include?(STATES[state])
end

#pending?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/filecoin/deals/state.rb', line 58

def pending?
  PENDING_STATES.include?(STATES[state])
end