Indent Markdown lists 1 space for stand-alone lists

2 spaces only works with other prefixed text.
pull/162/head
Luke Imhoff 7 years ago
parent 840c64abca
commit 8e09990248
  1. 110
      apps/explorer/lib/explorer/chain.ex
  2. 14
      apps/explorer/lib/explorer/chain/address.ex
  3. 32
      apps/explorer/lib/explorer/chain/block.ex
  4. 8
      apps/explorer/lib/explorer/chain/credit.ex
  5. 8
      apps/explorer/lib/explorer/chain/debit.ex
  6. 32
      apps/explorer/lib/explorer/chain/internal_transaction.ex
  7. 12
      apps/explorer/lib/explorer/chain/internal_transaction/call_type.ex
  8. 10
      apps/explorer/lib/explorer/chain/internal_transaction/type.ex
  9. 27
      apps/explorer/lib/explorer/chain/log.ex
  10. 16
      apps/explorer/lib/explorer/chain/receipt.ex
  11. 4
      apps/explorer/lib/explorer/chain/receipt/status.ex
  12. 25
      apps/explorer/lib/explorer/chain/statistics.ex
  13. 43
      apps/explorer/lib/explorer/chain/transaction.ex
  14. 2
      apps/explorer/lib/explorer/chain/wei.ex
  15. 18
      apps/explorer/lib/explorer/exchange_rates/token.ex
  16. 10
      apps/explorer/lib/explorer/jsonrpc.ex
  17. 60
      apps/explorer/lib/explorer/jsonrpc/block.ex
  18. 16
      apps/explorer/lib/explorer/jsonrpc/log.ex
  19. 27
      apps/explorer/lib/explorer/jsonrpc/receipt.ex
  20. 45
      apps/explorer/lib/explorer/jsonrpc/transaction.ex
  21. 6
      apps/explorer/lib/explorer/market/market_history.ex
  22. 2
      apps/explorer_web/lib/explorer_web/views/transaction_view.ex
  23. 6
      apps/explorer_web/lib/explorer_web/views/wei_helpers.ex

@ -17,9 +17,9 @@ defmodule Explorer.Chain do
@type direction :: :from | :to
@typedoc """
* `:optional` - the association is optional and only needs to be loaded if available
* `:required` - the association is required and MUST be loaded. If it is not available, then the parent struct
SHOULD NOT be returned.
* `:optional` - the association is optional and only needs to be loaded if available
* `:required` - the association is required and MUST be loaded. If it is not available, then the parent struct
SHOULD NOT be returned.
"""
@type necessity :: :optional | :required
@ -50,14 +50,14 @@ defmodule Explorer.Chain do
## Options
* `:direction` - if specified, will filter internal transactions by address type. If `:to` is specified, only internal
transactions where the "to" address matches will be returned. Likewise, if `:from` is specified, only internal
transactions where the "from" address matches will be returned. If :direction is omitted, internal transactions either
to or from the address will be returned.
* `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is
`:required`, and the `t:Explorer.Chain.InternalTransaction.t/0` has no associated record for that association, then
the `t:Explorer.Chain.InternalTransaction.t/0` will not be included in the page `entries`.
* `:pagination` - pagination params to pass to scrivener.
* `:direction` - if specified, will filter internal transactions by address type. If `:to` is specified, only
internal transactions where the "to" address matches will be returned. Likewise, if `:from` is specified, only
internal transactions where the "from" address matches will be returned. If :direction is omitted, internal
transactions either to or from the address will be returned.
* `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is
`:required`, and the `t:Explorer.Chain.InternalTransaction.t/0` has no associated record for that association,
then the `t:Explorer.Chain.InternalTransaction.t/0` will not be included in the page `entries`.
* `:pagination` - pagination params to pass to scrivener.
"""
def address_to_internal_transactions(%Address{hash: hash}, options \\ []) do
@ -81,14 +81,14 @@ defmodule Explorer.Chain do
## Options
* `:direction` - if specified, will filter transactions by address type. If `:to` is specified, only transactions
* `:direction` - if specified, will filter transactions by address type. If `:to` is specified, only transactions
where the "to" address matches will be returned. Likewise, if `:from` is specified, only transactions where the
"from" address matches will be returned. If :direction is omitted, transactions either to or from the address
will be returned.
* `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is
* `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is
`:required`, and the `t:Explorer.Chain.Transaction.t/0` has no associated record for that association, then the
`t:Explorer.Chain.Transaction.t/0` will not be included in the page `entries`.
* `:pagination` - pagination params to pass to scrivener.
* `:pagination` - pagination params to pass to scrivener.
"""
@spec address_to_transactions(Address.t(), [
@ -192,10 +192,10 @@ defmodule Explorer.Chain do
## Options
* `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is
* `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is
`:required`, and the `t:Explorer.Chain.Transaction.t/0` has no associated record for that association, then the
`t:Explorer.Chain.Transaction.t/0` will not be included in the page `entries`.
* `:pagination` - pagination params to pass to scrivener.
* `:pagination` - pagination params to pass to scrivener.
"""
@spec block_to_transactions(Block.t()) :: %Scrivener.Page{entries: [Transaction.t()]}
@spec block_to_transactions(Block.t(), [necessity_by_association_option | pagination_option]) :: %Scrivener.Page{
@ -413,7 +413,7 @@ defmodule Explorer.Chain do
## Options
* `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is
* `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is
`:required`, and the `t:Explorer.Chain.Transaction.t/0` has no associated record for that association, then the
`t:Explorer.Chain.Transaction.t/0` will not be included in the page `entries`.
"""
@ -704,27 +704,27 @@ defmodule Explorer.Chain do
## Tree
* `t:Explorer.Chain.Block.t/0`s
* `t:Explorer.Chain.Transaction.t/0`
* `t.Explorer.Chain.InternalTransaction.t/0`
* `t.Explorer.Chain.Receipt.t/0`
* `t.Explorer.Chain.Log.t/0`
* `t:Explorer.Chain.Block.t/0`s
* `t:Explorer.Chain.Transaction.t/0`
* `t.Explorer.Chain.InternalTransaction.t/0`
* `t.Explorer.Chain.Receipt.t/0`
* `t.Explorer.Chain.Log.t/0`
## Options
* `:timeout` - the timeout for the whole `c:Ecto.Repo.transaction/0` call. Defaults to `#{@transaction_timeout}`
milliseconds.
* `:insert_addresses_timeout` - the timeout for inserting all addresses found in the params lists across all types.
Defaults to `#{@insert_addresses_timeout}` milliseconds.
* `:insert_blocks_timeout` - the timeout for inserting all blocks. Defaults to `#{@insert_blocks_timeout}`
milliseconds.
* `:insert_internal_transactions_timeout` - the timeout for inserting all internal transactions. Defaults to
`#{@insert_internal_transactions_timeout}` milliseconds.
* `:insert_logs_timeout` - the timeout for inserting all logs. Defaults to `#{@insert_logs_timeout}` milliseconds.
* `:insert_receipts_timeout` - the timeout for inserting all receipts. Defaults to `#{@insert_receipts_timeout}`
milliseconds.
* `:insert_transactions_timeout` - the timeout for inserting all transactions found in the params lists across all types.
Defaults to `#{@insert_transactions_timeout}` milliseconds.
* `:timeout` - the timeout for the whole `c:Ecto.Repo.transaction/0` call. Defaults to `#{@transaction_timeout}`
milliseconds.
* `:insert_addresses_timeout` - the timeout for inserting all addresses found in the params lists across all types.
Defaults to `#{@insert_addresses_timeout}` milliseconds.
* `:insert_blocks_timeout` - the timeout for inserting all blocks. Defaults to `#{@insert_blocks_timeout}`
milliseconds.
* `:insert_internal_transactions_timeout` - the timeout for inserting all internal transactions. Defaults to
`#{@insert_internal_transactions_timeout}` milliseconds.
* `:insert_logs_timeout` - the timeout for inserting all logs. Defaults to `#{@insert_logs_timeout}` milliseconds.
* `:insert_receipts_timeout` - the timeout for inserting all receipts. Defaults to `#{@insert_receipts_timeout}`
milliseconds.
* `:insert_transactions_timeout` - the timeout for inserting all transactions found in the params lists across all
types. Defaults to `#{@insert_transactions_timeout}` milliseconds.
"""
def import_blocks(
%{
@ -814,10 +814,10 @@ defmodule Explorer.Chain do
## Options
* `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is
`:required`, and the `t:Explorer.Chain.Block.t/0` has no associated record for that association, then the
`t:Explorer.Chain.Block.t/0` will not be included in the page `entries`.
* `:pagination` - pagination params to pass to scrivener.
* `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is
`:required`, and the `t:Explorer.Chain.Block.t/0` has no associated record for that association, then the
`t:Explorer.Chain.Block.t/0` will not be included in the page `entries`.
* `:pagination` - pagination params to pass to scrivener.
"""
@spec list_blocks([necessity_by_association_option | pagination_option]) :: %Scrivener.Page{
@ -968,7 +968,7 @@ defmodule Explorer.Chain do
## Options
* `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is
* `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is
`:required`, and the `t:Explorer.Chain.Block.t/0` has no associated record for that association, then the
`t:Explorer.Chain.Block.t/0` will not be included in the page `entries`.
@ -1061,7 +1061,7 @@ defmodule Explorer.Chain do
## Options
* `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is
* `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is
`:required`, and the `t:Explorer.Chain.InternalTransaction.t/0` has no associated record for that association,
then the `t:Explorer.Chain.InternalTransaction.t/0` will not be included in the list.
@ -1131,10 +1131,10 @@ defmodule Explorer.Chain do
## Options
* `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is
* `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is
`:required`, and the `t:Explorer.Chain.InternalTransaction.t/0` has no associated record for that association,
then the `t:Explorer.Chain.InternalTransaction.t/0` will not be included in the list.
* `:pagination` - pagination params to pass to scrivener.
* `:pagination` - pagination params to pass to scrivener.
"""
@spec recent_pending_transactions([inserted_after_option | necessity_by_association_option]) :: %Scrivener.Page{
@ -1264,10 +1264,10 @@ defmodule Explorer.Chain do
## Options
* `:pending`
* `nil` - count all transactions
* `true` - only count pending transactions
* `false` - only count collated transactions
* `:pending`
* `nil` - count all transactions
* `true` - only count pending transactions
* `false` - only count collated transactions
"""
@spec transaction_count([{:pending, boolean()}]) :: non_neg_integer()
@ -1282,10 +1282,10 @@ defmodule Explorer.Chain do
## Options
* `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is
* `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is
`:required`, and the `t:Explorer.Chain.InternalTransaction.t/0` has no associated record for that association,
then the `t:Explorer.Chain.InternalTransaction.t/0` will not be included in the list.
* `:pagination` - pagination params to pass to scrivener.
* `:pagination` - pagination params to pass to scrivener.
"""
@spec transaction_hash_to_internal_transactions(Hash.Full.t()) :: %Scrivener.Page{entries: [InternalTransaction.t()]}
@ -1312,10 +1312,10 @@ defmodule Explorer.Chain do
## Options
* `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is
* `:necessity_by_association` - use to load `t:association/0` as `:required` or `:optional`. If an association is
`:required`, and the `t:Explorer.Chain.Log.t/0` has no associated record for that association, then the
`t:Explorer.Chain.Log.t/0` will not be included in the page `entries`.
* `:pagination` - pagination params to pass to scrivener.
* `:pagination` - pagination params to pass to scrivener.
"""
@spec transaction_to_logs(Transaction.t(), [
@ -1330,10 +1330,10 @@ defmodule Explorer.Chain do
## Returns
* `:failed` - the transaction failed without running out of gas
* `:pending` - the transaction has not be confirmed in a block yet
* `:out_of_gas` - the transaction failed because it ran out of gas
* `:success` - the transaction has been confirmed in a block
* `:failed` - the transaction failed without running out of gas
* `:pending` - the transaction has not be confirmed in a block yet
* `:out_of_gas` - the transaction failed because it ran out of gas
* `:success` - the transaction has been confirmed in a block
"""
@spec transaction_to_status(Transaction.t()) :: :failed | :pending | :out_of_gas | :success

@ -16,13 +16,13 @@ defmodule Explorer.Chain.Address do
@type hash :: Hash.t()
@typedoc """
* `fetched_balance` - The last fetched balance from Parity
* `balance_fetched_at` - the last time `balance` was fetched
* `credit` - accumulation of all credits to the address `hash`
* `debit` - accumulation of all debits to the address `hash`
* `hash` - the hash of the address's public key
* `inserted_at` - when this address was inserted
* `updated_at` when this address was last updated
* `fetched_balance` - The last fetched balance from Parity
* `balance_fetched_at` - the last time `balance` was fetched
* `credit` - accumulation of all credits to the address `hash`
* `debit` - accumulation of all debits to the address `hash`
* `hash` - the hash of the address's public key
* `inserted_at` - when this address was inserted
* `updated_at` when this address was last updated
"""
@type t :: %__MODULE__{
fetched_balance: Wei.t(),

@ -25,22 +25,22 @@ defmodule Explorer.Chain.Block do
@type block_number :: non_neg_integer()
@typedoc """
* `difficulty` - how hard the block was to mine.
* `gas_limit` - If the total number of gas used by the computation spawned by the transaction, including the original
message and any sub-messages that may be triggered, is less than or equal to the gas limit, then the transaction
processes. If the total gas exceeds the gas limit, then all changes are reverted, except that the transaction is
still valid and the fee can still be collected by the miner.
* `gas_used` - The actual `t:gas/0` used to mine/validate the transactions in the block.
* `hash` - the hash of the block.
* `miner` - the hash of the `t:Explorer.Chain.Address.t/0` of the miner. In Proof-of-Authority chains, this is the
validator.
* `nonce` - the hash of the generated proof-of-work. Not used in Proof-of-Authority chains.
* `number` - which block this is along the chain.
* `parent_hash` - the hash of the parent block, which should have the previous `number`
* `size` - The size of the block in bytes.
* `timestamp` - When the block was collated
* `total_diffficulty` - the total `difficulty` of the chain until this block.
* `transactions` - the `t:Explorer.Chain.Transaction.t/0` in this block.
* `difficulty` - how hard the block was to mine.
* `gas_limit` - If the total number of gas used by the computation spawned by the transaction, including the
original message and any sub-messages that may be triggered, is less than or equal to the gas limit, then the
transaction processes. If the total gas exceeds the gas limit, then all changes are reverted, except that the
transaction is still valid and the fee can still be collected by the miner.
* `gas_used` - The actual `t:gas/0` used to mine/validate the transactions in the block.
* `hash` - the hash of the block.
* `miner` - the hash of the `t:Explorer.Chain.Address.t/0` of the miner. In Proof-of-Authority chains, this is the
validator.
* `nonce` - the hash of the generated proof-of-work. Not used in Proof-of-Authority chains.
* `number` - which block this is along the chain.
* `parent_hash` - the hash of the parent block, which should have the previous `number`
* `size` - The size of the block in bytes.
* `timestamp` - When the block was collated
* `total_diffficulty` - the total `difficulty` of the chain until this block.
* `transactions` - the `t:Explorer.Chain.Transaction.t/0` in this block.
"""
@type t :: %__MODULE__{
difficulty: difficulty(),

@ -10,10 +10,10 @@ defmodule Explorer.Chain.Credit do
alias Explorer.Repo
@typedoc """
* `address` - address that was the `to_address`
* `address_hash` - foreign key for `address`
* `count` - the number of credits to `address`
* `value` - sum of all credit values.
* `address` - address that was the `to_address`
* `address_hash` - foreign key for `address`
* `count` - the number of credits to `address`
* `value` - sum of all credit values.
"""
@type t :: %__MODULE__{
address: %Ecto.Association.NotLoaded{} | Address.t(),

@ -10,10 +10,10 @@ defmodule Explorer.Chain.Debit do
alias Explorer.Repo
@typedoc """
* `address` - address that was the `from_address`
* `address_hash` - foreign key for `address`
* `count` - the number of debits to `address`
* `value` - sum of all debit values.
* `address` - address that was the `from_address`
* `address_hash` - foreign key for `address`
* `count` - the number of debits to `address`
* `value` - sum of all debit values.
"""
@type t :: %__MODULE__{
address: %Ecto.Association.NotLoaded{} | Address.t(),

@ -7,22 +7,22 @@ defmodule Explorer.Chain.InternalTransaction do
alias Explorer.Chain.InternalTransaction.{CallType, Type}
@typedoc """
* `call_type` - the type of call. `nil` when `type` is not `:call`.
* `error` - error message when `:call` `type` errors
* `from_address` - the source of the `value`
* `from_address_hash` - hash of the source of the `value`
* `gas` - the amount of gas allowed
* `gas_used` - the amount of gas used. `nil` when a call errors.
* `index` - the index of this internal transaction inside the `transaction`
* `input` - input bytes to the call
* `output` - output bytes from the call. `nil` when a call errors.
* `to_address` - the sink of the `value`
* `to_address_hash` - hash of the sink of the `value`
* `trace_address` - list of traces
* `transaction` - transaction in which this transaction occured
* `transaction_id` - foreign key for `transaction`
* `type` - type of internal transaction
* `value` - value of transfered from `from_address` to `to_address`
* `call_type` - the type of call. `nil` when `type` is not `:call`.
* `error` - error message when `:call` `type` errors
* `from_address` - the source of the `value`
* `from_address_hash` - hash of the source of the `value`
* `gas` - the amount of gas allowed
* `gas_used` - the amount of gas used. `nil` when a call errors.
* `index` - the index of this internal transaction inside the `transaction`
* `input` - input bytes to the call
* `output` - output bytes from the call. `nil` when a call errors.
* `to_address` - the sink of the `value`
* `to_address_hash` - hash of the sink of the `value`
* `trace_address` - list of traces
* `transaction` - transaction in which this transaction occured
* `transaction_id` - foreign key for `transaction`
* `type` - type of internal transaction
* `value` - value of transfered from `from_address` to `to_address`
"""
@type t :: %__MODULE__{
call_type: CallType.t() | nil,

@ -6,12 +6,12 @@ defmodule Explorer.Chain.InternalTransaction.CallType do
@behaviour Ecto.Type
@typedoc """
* `:call` - call a function in a contract by jumping into the contract's context
* `:callcode`
* `:delegatecall` - Instead of jumping into the code as with `"call"`, and using the call's contract's context, use
the current contract's context with the delegated contract's code. There's some good chances for finding bugs
when fuzzing these if the memory layout differs between the current contract and the delegated contract.
* `:staticcall`
* `:call` - call a function in a contract by jumping into the contract's context
* `:callcode`
* `:delegatecall` - Instead of jumping into the code as with `"call"`, and using the call's contract's context, use
the current contract's context with the delegated contract's code. There's some good chances for finding bugs
when fuzzing these if the memory layout differs between the current contract and the delegated contract.
* `:staticcall`
"""
@type t :: :call | :callcode | :delegatecall | :staticcall

@ -6,12 +6,12 @@ defmodule Explorer.Chain.InternalTransaction.Type do
@behaviour Ecto.Type
@typedoc """
* `:call`
* `:create`
* `:suicide`
* `:reward`
* `:call`
* `:create`
* `:reward`
* `:suicide`
"""
@type t :: :call | :create | :suicide | :reward
@type t :: :call | :create | :reward | :suicide
@doc """
Casts `term` to `t:t/0`

@ -9,19 +9,20 @@ defmodule Explorer.Chain.Log do
@optional_attrs ~w(first_topic second_topic third_topic fourth_topic)a
@typedoc """
* `address` - address of contract that generate the event
* `address_hash` - foreign key for `address`
* `data` - non-indexed log parameters.
* `first_topic` - `topics[0]`
* `fourth_topic` - `topics[3]`
* `index` - index of the log entry in all logs for the `receipt` / `transaction`
* `receipt` - receipt for the `transaction` being mined in a block
* `second_topic` - `topics[1]`
* `transaction` - transaction for which `receipt` is
* `transaction_hash` - foreign key for `receipt`. **ALWAYS join throught `receipts` and not directly to `transaction`
to ensure that any `t:Explorer.Chain.Transaction.t/0` has a receipt before it has logs in that receipt.**
* `third_topic` - `topics[2]`
* `type` - type of event
* `address` - address of contract that generate the event
* `address_hash` - foreign key for `address`
* `data` - non-indexed log parameters.
* `first_topic` - `topics[0]`
* `fourth_topic` - `topics[3]`
* `index` - index of the log entry in all logs for the `receipt` / `transaction`
* `receipt` - receipt for the `transaction` being mined in a block
* `second_topic` - `topics[1]`
* `transaction` - transaction for which `receipt` is
* `transaction_hash` - foreign key for `receipt`. **ALWAYS join through `receipts` and not directly to
`transaction` to ensure that any `t:Explorer.Chain.Transaction.t/0` has a receipt before it has logs in that
receipt.**
* `third_topic` - `topics[2]`
* `type` - type of event
"""
@type t :: %__MODULE__{
address: %Ecto.Association.NotLoaded{} | Address.t(),

@ -11,14 +11,14 @@ defmodule Explorer.Chain.Receipt do
@allowed_attrs @optional_attrs ++ @required_attrs
@typedoc """
* `cumulative_gas_used` - the cumulative gas used in `transaction`'s `t:Explorer.Chain.Block.t/0` before
`transaction`'s `index`
* `gas_used` - the gas used for just `transaction`
* `logs` - events that occurred while mining the `transaction`
* `status` - whether the transaction was successfully mined or failed
* `transaction` - the transaction for which this receipt is for
* `transaction_hash` - foreign key for `transaction`
* `transaction_index` - index of `transaction` in its `t:Explorer.Chain.Block.t/0`.
* `cumulative_gas_used` - the cumulative gas used in `transaction`'s `t:Explorer.Chain.Block.t/0` before
`transaction`'s `index`
* `gas_used` - the gas used for just `transaction`
* `logs` - events that occurred while mining the `transaction`
* `status` - whether the transaction was successfully mined or failed
* `transaction` - the transaction for which this receipt is for
* `transaction_hash` - foreign key for `transaction`
* `transaction_index` - index of `transaction` in its `t:Explorer.Chain.Block.t/0`.
"""
@type t :: %__MODULE__{
cumulative_gas_used: Gas.t(),

@ -11,8 +11,8 @@ defmodule Explorer.Chain.Receipt.Status do
@behaviour Ecto.Type
@typedoc """
* `:ok` - transaction succeeded
* `:error` - transaction failed
* `:ok` - transaction succeeded
* `:error` - transaction failed
"""
@type t :: :ok | :error

@ -67,18 +67,19 @@ defmodule Explorer.Chain.Statistics do
@type transactions_per_minute :: non_neg_integer()
@typedoc """
* `average_time` - the average time it took to mine/validate the last <= 100 `t:Explorer.Chain.Block.t/0`
* `block_velocity` - the number of `t:Explorer.Chain.Block.t/0` mined/validated in the last minute
* `blocks` - the last <= 5 `t:Explorer.Chain.Block.t/0`
* `lag` - the average time over the last hour between when the block was mined/validated
(`t:Explorer.Chain.Block.t/0` `timestamp`) and when it was inserted into the databasse
(`t:Explorer.Chain.Block.t/0` `inserted_at`)
* `number` - the latest `t:Explorer.Chain.Block.t/0` `number`
* `skipped_blocks` - the number of blocks that were mined/validated, but do not exist as `t:Explorer.Chain.Block.t/0`
* `timestamp` - when the last `t:Explorer.Chain.Block.t/0` was mined/validated
* `transaction_count` - the number of transactions confirmed in blocks that were mined/validated in the last day
* `transaction_velocity` - the number of `t:Explorer.Chain.Block.t/0` mined/validated in the last minute
* `transactions` - the last <= 5 `t:Explorer.Chain.Transaction.t/0`
* `average_time` - the average time it took to mine/validate the last <= 100 `t:Explorer.Chain.Block.t/0`
* `block_velocity` - the number of `t:Explorer.Chain.Block.t/0` mined/validated in the last minute
* `blocks` - the last <= 5 `t:Explorer.Chain.Block.t/0`
* `lag` - the average time over the last hour between when the block was mined/validated
(`t:Explorer.Chain.Block.t/0` `timestamp`) and when it was inserted into the databasse
(`t:Explorer.Chain.Block.t/0` `inserted_at`)
* `number` - the latest `t:Explorer.Chain.Block.t/0` `number`
* `skipped_blocks` - the number of blocks that were mined/validated, but do not exist as
`t:Explorer.Chain.Block.t/0`
* `timestamp` - when the last `t:Explorer.Chain.Block.t/0` was mined/validated
* `transaction_count` - the number of transactions confirmed in blocks that were mined/validated in the last day
* `transaction_velocity` - the number of `t:Explorer.Chain.Block.t/0` mined/validated in the last minute
* `transactions` - the last <= 5 `t:Explorer.Chain.Transaction.t/0`
"""
@type t :: %__MODULE__{
average_time: Duration.t(),

@ -71,27 +71,28 @@ defmodule Explorer.Chain.Transaction do
@type wei_per_gas :: Wei.t()
@typedoc """
* `block` - the block in which this transaction was mined/validated. `nil` when transaction is pending.
* `block_hash` - `block` foreign key. `nil` when transaction is pending.
* `from_address` - the source of `value`
* `from_address_hash` - foreign key of `from_address`
* `gas` - Gas provided by the sender
* `gas_price` - How much the sender is willing to pay for `gas`
* `hash` - hash of contents of this transaction
* `index` - index of this transaction in `block`. `nil` when transaction is pending.
* `input`- data sent along with the transaction
* `internal_transactions` - transactions (value transfers) created while executing contract used for this transaction
* `nonce` - the number of transaction made by the sender prior to this one
* `public_key` - public key of the signer of the transaction
* `r` - the R field of the signature. The (r, s) is the normal output of an ECDSA signature, where r is computed as
the X coordinate of a point R, modulo the curve order n.
* `s` - The S field of the signature. The (r, s) is the normal output of an ECDSA signature, where r is computed as
the X coordinate of a point R, modulo the curve order n.
* `standard_v` - The standardized V field of the signature
* `to_address` - sink of `value`
* `to_address_hash` - `to_address` foreign key
* `v` - The V field of the signature.
* `value` - wei transferred from `from_address` to `to_address`
* `block` - the block in which this transaction was mined/validated. `nil` when transaction is pending.
* `block_hash` - `block` foreign key. `nil` when transaction is pending.
* `from_address` - the source of `value`
* `from_address_hash` - foreign key of `from_address`
* `gas` - Gas provided by the sender
* `gas_price` - How much the sender is willing to pay for `gas`
* `hash` - hash of contents of this transaction
* `index` - index of this transaction in `block`. `nil` when transaction is pending.
* `input`- data sent along with the transaction
* `internal_transactions` - transactions (value transfers) created while executing contract used for this
transaction
* `nonce` - the number of transaction made by the sender prior to this one
* `public_key` - public key of the signer of the transaction
* `r` - the R field of the signature. The (r, s) is the normal output of an ECDSA signature, where r is computed as
the X coordinate of a point R, modulo the curve order n.
* `s` - The S field of the signature. The (r, s) is the normal output of an ECDSA signature, where r is computed as
the X coordinate of a point R, modulo the curve order n.
* `standard_v` - The standardized V field of the signature
* `to_address` - sink of `value`
* `to_address_hash` - `to_address` foreign key
* `v` - The V field of the signature.
* `value` - wei transferred from `from_address` to `to_address`
"""
@type t :: %__MODULE__{
block: %Ecto.Association.NotLoaded{} | Block.t() | nil,

@ -89,7 +89,7 @@ defmodule Explorer.Chain.Wei do
@typedoc """
Short for giga-wei
* 10<sup>9</sup> wei is one gwei
10<sup>9</sup> wei is 1 gwei.
"""
@type gwei :: Decimal.t()

@ -6,15 +6,15 @@ defmodule Explorer.ExchangeRates.Token do
@typedoc """
Represents an exchange rate for a given token.
* `:available_supply` - Available supply of a token
* `:btc_value` - The Bitcoin value of the currency
* `:id` - ID of a currency
* `:last_updated` - Timestamp of when the value was last updated
* `:market_cap_usd` - Market capitalization of the currency
* `:name` - Human-readable name of a ticker
* `:symbol` - Trading symbol used to represent a currency
* `:usd_value` - The USD value of the currency
* `:volume_24h_usd` - The volume from the last 24 hours in USD
* `:available_supply` - Available supply of a token
* `:btc_value` - The Bitcoin value of the currency
* `:id` - ID of a currency
* `:last_updated` - Timestamp of when the value was last updated
* `:market_cap_usd` - Market capitalization of the currency
* `:name` - Human-readable name of a ticker
* `:symbol` - Trading symbol used to represent a currency
* `:usd_value` - The USD value of the currency
* `:volume_24h_usd` - The volume from the last 24 hours in USD
"""
@type t :: %__MODULE__{
available_supply: Decimal.t(),

@ -174,14 +174,14 @@ defmodule Explorer.JSONRPC do
end
@doc """
1. POSTs JSON `payload` to `url`
2. Decodes the response
3. Handles the response
1. POSTs JSON `payload` to `url`
2. Decodes the response
3. Handles the response
## Returns
* Handled response
* `{:error, reason}` if POST failes
* Handled response
* `{:error, reason}` if POST failes
"""
def json_rpc(payload, url) do
json = encode_json(payload)

@ -12,37 +12,37 @@ defmodule Explorer.JSONRPC.Block do
@type elixir :: %{String.t() => non_neg_integer | DateTime.t() | String.t() | nil}
@typedoc """
* `"author"` - `t:Explorer.JSONRPC.address/0` that created the block. Aliased by `"miner"`.
* `"difficulty"` - `t:Explorer.JSONRPC.quantity/0`` of the difficulty for this block.
* `"extraData"` - the extra `t:Explorer.JSONRPC.data/0`` field of this block.
* `"gasLimit" - maximum gas `t:Explorer.JSONRPC.quantity/0`` in this block.
* `"gasUsed" - the total `t:Explorer.JSONRPC.quantity/0`` of gas used by all transactions in this block.
* `"hash"` - the `t:Explorer.JSONRPC.hash/0` of the block.
* `"logsBloom"` - `t:Explorer.JSONRPC.data/0`` for the [Bloom filter](https://en.wikipedia.org/wiki/Bloom_filter) for
the logs of the block. `nil` when block is pending.
* `"miner"` - `t:Explorer.JSONRPC.address/0` of the beneficiary to whom the mining rewards were given. Aliased by
* `"author"` - `t:Explorer.JSONRPC.address/0` that created the block. Aliased by `"miner"`.
* `"difficulty"` - `t:Explorer.JSONRPC.quantity/0`` of the difficulty for this block.
* `"extraData"` - the extra `t:Explorer.JSONRPC.data/0`` field of this block.
* `"gasLimit" - maximum gas `t:Explorer.JSONRPC.quantity/0`` in this block.
* `"gasUsed" - the total `t:Explorer.JSONRPC.quantity/0`` of gas used by all transactions in this block.
* `"hash"` - the `t:Explorer.JSONRPC.hash/0` of the block.
* `"logsBloom"` - `t:Explorer.JSONRPC.data/0`` for the [Bloom filter](https://en.wikipedia.org/wiki/Bloom_filter)
for the logs of the block. `nil` when block is pending.
* `"miner"` - `t:Explorer.JSONRPC.address/0` of the beneficiary to whom the mining rewards were given. Aliased by
`"author"`.
* `"nonce"` - `t:Explorer.JSONRPC.nonce/0`. `nil` when its pending block.
* `"number"` - the block number `t:Explorer.JSONRPC.quantity/0`. `nil` when block is pending.
* `"parentHash" - the `t:Explorer.JSONRPC.hash/0` of the parent block.
* `"receiptsRoot"` - `t:Explorer.JSONRPC.hash/0` of the root of the receipts.
[trie](https://github.com/ethereum/wiki/wiki/Patricia-Tree) of the block.
* `"sealFields"` - UNKNOWN
* `"sha3Uncles"` - `t:Explorer.JSONRPC.hash/0` of the
[uncles](https://bitcoin.stackexchange.com/questions/39329/in-ethereum-what-is-an-uncle-block) data in the block.
* `"signature"` - UNKNOWN
* `"size"` - `t:Explorer.JSONRPC.quantity/0`` of bytes in this block
* `"stateRoot" - `t:Explorer.JSONRPC.hash/0` of the root of the final state
[trie](https://github.com/ethereum/wiki/wiki/Patricia-Tree) of the block.
* `"step"` - UNKNOWN
* `"timestamp"`: the unix timestamp as a `t:Explorer.JSONRPC.quantity/0`` for when the block was collated.
* `"totalDifficulty" - `t:Explorer.JSONRPC.quantity/0`` of the total difficulty of the chain until this block.
* `"transactions"` - `t:list/0` of `t:Explorer.JSONRPC.Transaction.t/0`.
* `"transactionsRoot" - `t:Explorer.JSONRPC.hash/0` of the root of the transaction
[trie](https://github.com/ethereum/wiki/wiki/Patricia-Tree) of the block.
* `uncles`: `t:list/0` of
[uncles](https://bitcoin.stackexchange.com/questions/39329/in-ethereum-what-is-an-uncle-block)
`t:Explorer.JSONRPC.hash/0`.
* `"nonce"` - `t:Explorer.JSONRPC.nonce/0`. `nil` when its pending block.
* `"number"` - the block number `t:Explorer.JSONRPC.quantity/0`. `nil` when block is pending.
* `"parentHash" - the `t:Explorer.JSONRPC.hash/0` of the parent block.
* `"receiptsRoot"` - `t:Explorer.JSONRPC.hash/0` of the root of the receipts.
[trie](https://github.com/ethereum/wiki/wiki/Patricia-Tree) of the block.
* `"sealFields"` - UNKNOWN
* `"sha3Uncles"` - `t:Explorer.JSONRPC.hash/0` of the
[uncles](https://bitcoin.stackexchange.com/questions/39329/in-ethereum-what-is-an-uncle-block) data in the block.
* `"signature"` - UNKNOWN
* `"size"` - `t:Explorer.JSONRPC.quantity/0`` of bytes in this block
* `"stateRoot" - `t:Explorer.JSONRPC.hash/0` of the root of the final state
[trie](https://github.com/ethereum/wiki/wiki/Patricia-Tree) of the block.
* `"step"` - UNKNOWN
* `"timestamp"`: the unix timestamp as a `t:Explorer.JSONRPC.quantity/0`` for when the block was collated.
* `"totalDifficulty" - `t:Explorer.JSONRPC.quantity/0`` of the total difficulty of the chain until this block.
* `"transactions"` - `t:list/0` of `t:Explorer.JSONRPC.Transaction.t/0`.
* `"transactionsRoot" - `t:Explorer.JSONRPC.hash/0` of the root of the transaction
[trie](https://github.com/ethereum/wiki/wiki/Patricia-Tree) of the block.
* `uncles`: `t:list/0` of
[uncles](https://bitcoin.stackexchange.com/questions/39329/in-ethereum-what-is-an-uncle-block)
`t:Explorer.JSONRPC.hash/0`.
"""
@type t :: %{String.t() => JSONRPC.data() | JSONRPC.hash() | JSONRPC.quantity() | nil}

@ -9,14 +9,14 @@ defmodule Explorer.JSONRPC.Log do
@type elixir :: %{String.t() => String.t() | [String.t()] | non_neg_integer()}
@typedoc """
* `"address"` - `t:Explorer.JSONRPC.address/0` from which event originated.
* `"blockHash"` - `t:Explorer.JSONRPC.hash/0` of the block this transaction is in.
* `"blockNumber"` - `t:Explorer.JSONRPC.quantity/0` for the block number this transaction is in.
* `"data"` - Data containing non-indexed log parameter
* `"logIndex"` - `t:Explorer.JSONRPC.quantity/0` of the event index positon in the block.
* `"topics"` - `t:list/0` of at most 4 32-byte topics. Topic 1-3 contains indexed parameters of the log.
* `"transactionHash"` - `t:Explorer.JSONRPC.hash/0` of the transaction
* `"transactionIndex"` - `t:Explorer.JSONRPC.quantity/0` for the index of the transaction in the block.
* `"address"` - `t:Explorer.JSONRPC.address/0` from which event originated.
* `"blockHash"` - `t:Explorer.JSONRPC.hash/0` of the block this transaction is in.
* `"blockNumber"` - `t:Explorer.JSONRPC.quantity/0` for the block number this transaction is in.
* `"data"` - Data containing non-indexed log parameter
* `"logIndex"` - `t:Explorer.JSONRPC.quantity/0` of the event index positon in the block.
* `"topics"` - `t:list/0` of at most 4 32-byte topics. Topic 1-3 contains indexed parameters of the log.
* `"transactionHash"` - `t:Explorer.JSONRPC.hash/0` of the transaction
* `"transactionIndex"` - `t:Explorer.JSONRPC.quantity/0` for the index of the transaction in the block.
"""
@type t :: %{String.t() => String.t() | [String.t()]}

@ -13,19 +13,20 @@ defmodule Explorer.JSONRPC.Receipt do
@type elixir :: %{String.t() => String.t() | non_neg_integer}
@typedoc """
* `"contractAddress"` - The contract `t:Explorer.JSONRPC.address/0` created, if the transaction was a contract
creation, otherwise `nil`.
* `"blockHash"` - `t:Explorer.JSONRPC.hash/0` of the block where `"transactionHash"` was in.
* `"blockNumber"` - The block number `t:Explorer.JSONRPC.quanity/0`.
* `"cumulativeGasUsed"` - `t:Explorer.JSONRPC.quantity/0` of gas used when this transaction was executed in the block.
* `"gasUsed"` - `t:Explorer.JSONRPC.quantity/0` of gas used by this specific transaction alone.
* `"logs"` - `t:list/0` of log objects, which this transaction generated.
* `"logsBloom"` - `t:Explorer.JSONRPC.data/0` of 256 Bytes for
[Bloom filter](https://en.wikipedia.org/wiki/Bloom_filter) for light clients to quickly retrieve related logs.
* `"root"` - `t:Explorer.JSONRPC.hash/0` of post-transaction stateroot (pre-Byzantium)
* `"status"` - `t:Explorer.JSONRPC.quantity/0` of either 1 (success) or 0 (failure) (post-Byzantium)
* `"transactionHash"` - `t:Explorer.JSONRPC.hash/0` the transaction.
* `"transactionIndex"` - `t:Explorer.JSONRPC.quantity/0` for the transaction index in the block.
* `"contractAddress"` - The contract `t:Explorer.JSONRPC.address/0` created, if the transaction was a contract
creation, otherwise `nil`.
* `"blockHash"` - `t:Explorer.JSONRPC.hash/0` of the block where `"transactionHash"` was in.
* `"blockNumber"` - The block number `t:Explorer.JSONRPC.quanity/0`.
* `"cumulativeGasUsed"` - `t:Explorer.JSONRPC.quantity/0` of gas used when this transaction was executed in the
block.
* `"gasUsed"` - `t:Explorer.JSONRPC.quantity/0` of gas used by this specific transaction alone.
* `"logs"` - `t:list/0` of log objects, which this transaction generated.
* `"logsBloom"` - `t:Explorer.JSONRPC.data/0` of 256 Bytes for
[Bloom filter](https://en.wikipedia.org/wiki/Bloom_filter) for light clients to quickly retrieve related logs.
* `"root"` - `t:Explorer.JSONRPC.hash/0` of post-transaction stateroot (pre-Byzantium)
* `"status"` - `t:Explorer.JSONRPC.quantity/0` of either 1 (success) or 0 (failure) (post-Byzantium)
* `"transactionHash"` - `t:Explorer.JSONRPC.hash/0` the transaction.
* `"transactionIndex"` - `t:Explorer.JSONRPC.quantity/0` for the transaction index in the block.
"""
@type t :: %{String.t() => JSONRPC.address() | JSONRPC.data() | JSONRPC.hash() | JSONRPC.quantity() | list | nil}

@ -15,28 +15,29 @@ defmodule Explorer.JSONRPC.Transaction do
@type elixir :: %{String.t() => JSONRPC.address() | JSONRPC.hash() | String.t() | non_neg_integer() | nil}
@typedoc """
* `"blockHash"` - `t:Explorer.JSONRPC.hash/0` of the block this transaction is in. `nil` when transaction is pending.
* `"blockNumber"` - `t:Explorer.JSONRPC.quantity/0` for the block number this transaction is in. `nil` when
transaction is pending.
* `"chainId"` - the chain on which the transaction exists.
* `"condition"` - UNKNOWN
* `"creates"` - `t:Explorer.JSONRPC.address/0` of the created contract, if the transaction creates a contract.
* `"from"` - `t:Explorer.JSONRPC.address/0` of the sender.
* `"gas"` - `t:Explorer.JSONRPC.quantity/0` of gas provided by the sender. This is the max gas that may be used.
`gas * gasPrice` is the max fee in wei that the sender is willing to pay for the transaction to be executed.
* `"gasPrice"` - `t:Explorer.JSONRPC.quantity/0` of wei to pay per unit of gas used.
* `"hash"` - `t:Explorer.JSONRPC.hash/0` of the transaction
* `"input"` - `t:Explorer.JSONRPC.data/0` sent along with the transaction, such as input to the contract.
* `"nonce"` - `t:Explorer.JSONRPC.quantity/0` of transactions made by the sender prior to this one.
* `"publicKey"` - `t:Explorer.JSONRPC.hash/0` of the public key of the signer.
* `"r"` - `t:Explorer.JSONRPC.quantity/0` for the R field of the signature.
* `"raw"` - Raw transaction `t:Explorer.JSONRPC.data/0`
* `"standardV"` - `t:Explorer.JSONRPC.quantity/0` for the standardized V (`0` or `1`) field of the signature.
* `"to"` - `t:Explorer.JSONRPC.address/0` of the receiver. `nil` when it is a contract creation transaction.
* `"transactionIndex"` - `t:Explorer.JSONRPC.quantity/0` for the index of the transaction in the block. `nil` when
transaction is pending.
* `"v"` - `t:Explorer.JSONRPC.quantity/0` for the V field of the signature.
* `"value"` - `t:Explorer.JSONRPC.quantity/0` of wei transfered
* `"blockHash"` - `t:Explorer.JSONRPC.hash/0` of the block this transaction is in. `nil` when transaction is
pending.
* `"blockNumber"` - `t:Explorer.JSONRPC.quantity/0` for the block number this transaction is in. `nil` when
transaction is pending.
* `"chainId"` - the chain on which the transaction exists.
* `"condition"` - UNKNOWN
* `"creates"` - `t:Explorer.JSONRPC.address/0` of the created contract, if the transaction creates a contract.
* `"from"` - `t:Explorer.JSONRPC.address/0` of the sender.
* `"gas"` - `t:Explorer.JSONRPC.quantity/0` of gas provided by the sender. This is the max gas that may be used.
`gas * gasPrice` is the max fee in wei that the sender is willing to pay for the transaction to be executed.
* `"gasPrice"` - `t:Explorer.JSONRPC.quantity/0` of wei to pay per unit of gas used.
* `"hash"` - `t:Explorer.JSONRPC.hash/0` of the transaction
* `"input"` - `t:Explorer.JSONRPC.data/0` sent along with the transaction, such as input to the contract.
* `"nonce"` - `t:Explorer.JSONRPC.quantity/0` of transactions made by the sender prior to this one.
* `"publicKey"` - `t:Explorer.JSONRPC.hash/0` of the public key of the signer.
* `"r"` - `t:Explorer.JSONRPC.quantity/0` for the R field of the signature.
* `"raw"` - Raw transaction `t:Explorer.JSONRPC.data/0`
* `"standardV"` - `t:Explorer.JSONRPC.quantity/0` for the standardized V (`0` or `1`) field of the signature.
* `"to"` - `t:Explorer.JSONRPC.address/0` of the receiver. `nil` when it is a contract creation transaction.
* `"transactionIndex"` - `t:Explorer.JSONRPC.quantity/0` for the index of the transaction in the block. `nil` when
transaction is pending.
* `"v"` - `t:Explorer.JSONRPC.quantity/0` for the V field of the signature.
* `"value"` - `t:Explorer.JSONRPC.quantity/0` of wei transfered
"""
@type t :: %{String.t() => JSONRPC.address() | JSONRPC.hash() | JSONRPC.quantity() | String.t() | nil}

@ -13,9 +13,9 @@ defmodule Explorer.Market.MarketHistory do
@typedoc """
The recorded values of the configured coin to USD for a single day.
* `:closing_price` - Closing price in USD.
* `:date` - The date in UTC.
* `:opening_price` - Opening price in USD.
* `:closing_price` - Closing price in USD.
* `:date` - The date in UTC.
* `:opening_price` - Opening price in USD.
"""
@type t :: %__MODULE__{
closing_price: Decimal.t(),

@ -114,7 +114,7 @@ defmodule ExplorerWeb.TransactionView do
## Options
* `:include_label` - Boolean. Defaults to true. Flag for displaying unit with value.
* `:include_label` - Boolean. Defaults to true. Flag for displaying unit with value.
"""
def value(%mod{value: value}, opts \\ []) when is_transaction_type(mod) do
include_label? = Keyword.get(opts, :include_label, true)

@ -22,9 +22,9 @@ defmodule ExplorerWeb.WeiHelpers do
The third argument allows for keyword options to be passed for formatting the
converted number.
* `:fractional_digits` - Integer. Number of fractional digits to include
* `:include_unit_label` - Boolean (Defaults to `true`). Flag for if the unit
label should be included in the returned string
* `:fractional_digits` - Integer. Number of fractional digits to include
* `:include_unit_label` - Boolean (Defaults to `true`). Flag for if the unit
label should be included in the returned string
## Examples

Loading…
Cancel
Save