feat: Certified smart contracts (#9910)
* Certified smart-contracts * Prioritize certified smart-contracts in the search * Refactoring: remove CustomContractsHelper * Return certified in the list and in the search * mix format * Fix tests * Process review commentpull/9929/head
parent
942df2196f
commit
cef3285999
@ -0,0 +1,29 @@ |
||||
defmodule Explorer.SmartContract.CertifiedSmartContractCataloger do |
||||
@moduledoc """ |
||||
Actualizes certified smart-contracts. |
||||
""" |
||||
|
||||
use GenServer, restart: :transient |
||||
|
||||
alias Explorer.Chain.SmartContract |
||||
|
||||
def start_link(_) do |
||||
GenServer.start_link(__MODULE__, :ok, name: __MODULE__) |
||||
end |
||||
|
||||
@impl GenServer |
||||
def init(args) do |
||||
send(self(), :fetch_certified_smart_contracts) |
||||
|
||||
{:ok, args} |
||||
end |
||||
|
||||
@impl GenServer |
||||
def handle_info(:fetch_certified_smart_contracts, state) do |
||||
certified_contracts_list = Application.get_env(:block_scout_web, :contract)[:certified_list] |
||||
|
||||
SmartContract.set_smart_contracts_certified_flag(certified_contracts_list) |
||||
|
||||
{:noreply, state} |
||||
end |
||||
end |
@ -0,0 +1,13 @@ |
||||
defmodule Explorer.Repo.Migrations.SmartContractsAddCertifiedFlag do |
||||
use Ecto.Migration |
||||
@disable_ddl_transaction true |
||||
@disable_migration_lock true |
||||
|
||||
def change do |
||||
alter table("smart_contracts") do |
||||
add(:certified, :boolean, null: true) |
||||
end |
||||
|
||||
create_if_not_exists(index(:smart_contracts, [:certified])) |
||||
end |
||||
end |
Loading…
Reference in new issue