Fix gwei to wei in database

pull/7537/head
Maxim Filonov 1 year ago
parent 1184ae6a19
commit d09d3fb127
  1. 4
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/withdrawal.ex
  2. 7
      apps/explorer/priv/repo/migrations/20230522130735_withdrawals_gwei_amount_to_wei_amount.exs

@ -45,7 +45,7 @@ defmodule EthereumJSONRPC.Withdrawal do
...> )
%{
address_hash: "0x388ea662ef2c223ec0b047d41bf3c0f362142ad5",
amount: 4040000000000,
amount: 4040000000000000000000,
block_hash: "0x7f035c5f3c0678250853a1fde6027def7cac1812667bd0d5ab7ccb94eb8b6f3a",
block_number: 3,
index: 3867,
@ -67,7 +67,7 @@ defmodule EthereumJSONRPC.Withdrawal do
address_hash: address_hash,
block_hash: block_hash,
block_number: block_number,
amount: amount
amount: amount * 1_000_000_000
}
end

@ -0,0 +1,7 @@
defmodule Explorer.Repo.Migrations.WithdrawalsGweiAmountToWeiAmount do
use Ecto.Migration
def change do
execute("UPDATE withdrawals SET amount = amount * 1000000000")
end
end
Loading…
Cancel
Save