Blockscout: Developer accesses Contract Address Page

Created on 7 May 2018  路  4Comments  路  Source: blockscout/blockscout

Acceptance Criteria

  • Show the existent bytecode in the Address page
  • Identify the address as a Contract address

    • Change title to "Contract Address" instead of "Address"

    • Show tab "Code"

Questions:

  • [x] The bytecode isn't indexed yet, should we go without that or make some effort to include it in the index?
  • [x] The Address page is currently rendering the address_transaction/index.html.eex template. Although, there is an existent adress/show.html.eex template. What should we use for it?
Kuala Lumpur Vienna developer

Most helpful comment

Hey @gfreh!

I believe you will want to put your template in templates/address_contract.html.eex.

Transactions is just the default tab selection for the address page.

It may help to see the router:

    resources "/addresses", AddressController, only: [:show] do
      resources("/transactions", AddressTransactionController, only: [:index], as: :transaction)

      resources(
        "/internal_transactions",
        AddressInternalTransactionController,
        only: [:index],
        as: :internal_transaction
      )
    end

You will want to model off of the /transactions or /internal_transactions routes.

Let me know if I'm not answering your questions or if you need more clarification!

All 4 comments

Hey @gfreh!

I believe you will want to put your template in templates/address_contract.html.eex.

Transactions is just the default tab selection for the address page.

It may help to see the router:

    resources "/addresses", AddressController, only: [:show] do
      resources("/transactions", AddressTransactionController, only: [:index], as: :transaction)

      resources(
        "/internal_transactions",
        AddressInternalTransactionController,
        only: [:index],
        as: :internal_transaction
      )
    end

You will want to model off of the /transactions or /internal_transactions routes.

Let me know if I'm not answering your questions or if you need more clarification!

The bytecode is stored by the indexer as it exists in #162 as t:Explorer.Chain.InternalTransaction.t/0 created_contract_code. It is is not currently attached directly to the t:Explorer.Chain.Address.t/0.

After talking to @KronicDeth, we've agreed on including the contract_code column to the addresses table as a bytea in this card. 馃憣

@igorffs when adding fields, feel free to just rewrite the the corresponding table's migration. We're assuming that (for now) we'll drop the database and reindex for any indexed fields like this and so don't have to write layered migrations.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gfreh picture gfreh  路  5Comments

pashagonchar picture pashagonchar  路  5Comments

KronicDeth picture KronicDeth  路  3Comments

vbaranov picture vbaranov  路  7Comments

zulhfreelancer picture zulhfreelancer  路  6Comments