Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if exists custom_cap property of extended token object before access it #4812

Merged
merged 1 commit into from
Oct 25, 2021

Conversation

vbaranov
Copy link
Member

@vbaranov vbaranov commented Oct 25, 2021

Motivation

Request: GET /token/0x431ad2ff6a9C365805eBaD47Ee021148d6f7DBe0/token-transfers
** (exit) an exception was raised:
    ** (KeyError) key :custom_cap not found in: %{__meta__: #Ecto.Schema.Metadata<:loaded, "tokens">, __struct__: Explorer.Chain.Token, bridged: nil, cataloged: true, contract_address: %Explorer.Chain.Address{__meta__: #Ecto.Schema.Metadata<:loaded, "addresses">, contract_code: %Explorer.Chain.Data{bytes: <<96, 128, 96, 64, 82, 52, 128, 21, 97, 0, 16, 87, 96, 0, 128, 253, 91, 80, 96, 4, 54, 16, 97, 1, 95, 87, 96, 0, 53, 124, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...>>}, contracts_creation_internal_transaction: #Ecto.Association.NotLoaded<association :contracts_creation_internal_transaction is not loaded>, contracts_creation_transaction: #Ecto.Association.NotLoaded<association :contracts_creation_transaction is not loaded>, decompiled: true, decompiled_smart_contracts: #Ecto.Association.NotLoaded<association :decompiled_smart_contracts is not loaded>, fetched_coin_balance: #Explorer.Chain.Wei<0>, fetched_coin_balance_block_number: 13488030, has_decompiled_code?: nil, hash: %Explorer.Chain.Hash{byte_count: 20, bytes: <<67, 26, 210, 255, 106, 156, 54, 88, 5, 235, 173, 71, 238, 2, 17, 72, 214, 247, 219, 224>>}, inserted_at: ~U[2019-07-25 02:10:45.349094Z], names: #Ecto.Association.NotLoaded<association :names is not loaded>, nonce: nil, smart_contract: nil, smart_contract_additional_sources: #Ecto.Association.NotLoaded<association :smart_contract_additional_sources is not loaded>, stale?: nil, token: #Ecto.Association.NotLoaded<association :token is not loaded>, updated_at: ~U[2019-07-25 02:10:45.349094Z], verified: false}, contract_address_hash: %Explorer.Chain.Hash{byte_count: 20, bytes: <<67, 26, 210, 255, 106, 156, 54, 88, 5, 235, 173, 71, 238, 2, 17, 72, 214, 247, 219, 224>>}, decimals: #Decimal<18>, holder_count: 1652, inserted_at: ~U[2019-07-25 03:39:28.587232Z], name: "dForce", skip_metadata: nil, symbol: "DF", total_supply: #Decimal<999934997348875914379213820>, type: "ERC-20", updated_at: ~U[2021-10-24 10:42:38.416602Z], usd_value: #Decimal<0.216994>}
        (block_scout_web 0.0.1) lib/block_scout_web/views/tokens/overview_view.ex:62: BlockScoutWeb.Tokens.OverviewView.total_supply_usd/1
        (block_scout_web 0.0.1) lib/block_scout_web/templates/tokens/overview/_details.html.eex:108: BlockScoutWeb.Tokens.OverviewView."_details.html"/1
        (block_scout_web 0.0.1) lib/block_scout_web/templates/tokens/transfer/index.html.eex:2: BlockScoutWeb.Tokens.TransferView."index.html"/1
        (phoenix 1.5.13) lib/phoenix/view.ex:310: Phoenix.View.render_within/3
        (phoenix 1.5.13) lib/phoenix/view.ex:472: Phoenix.View.render_to_iodata/3
        (phoenix 1.5.13) lib/phoenix/controller.ex:777: Phoenix.Controller.render_and_send/4
        (block_scout_web 0.0.1) lib/block_scout_web/controllers/tokens/transfer_controller.ex:1: BlockScoutWeb.Tokens.TransferController.action/2
        (block_scout_web 0.0.1) lib/block_scout_web/controllers/tokens/transfer_controller.ex:1: BlockScoutWeb.Tokens.TransferController.phoenix_controller_pipeline/2

Checklist for your Pull Request (PR)

@vbaranov vbaranov merged commit e30b8c8 into master Oct 25, 2021
@vbaranov vbaranov deleted the vb-check-custom-cap branch October 25, 2021 18:31
sidhujag pushed a commit to syscoin/blockscout that referenced this pull request Oct 26, 2021
Check if exists custom_cap property of extended token object before access it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant