archethic-foundation / smart-contract-playground

Archethic Smart Contract playground
GNU Affero General Public License v3.0
0 stars 2 forks source link

Bad argument in arithmetic expression #63

Open bchamagne opened 1 year ago

bchamagne commented 1 year ago

Describe the problem you discovered

from the logs

ESC[0mESC[36m2023-07-24 21:43:39.758 [debug] HANDLE EVENT
  View: ArchethicPlaygroundWeb.EditorLive
  Event: "parse"
  Parameters: %{"code" => "@version 1\n\ncondition transaction: []\nactions triggered_by: transaction do\n  Contract.se
t_content(\"Hello world!\")\nend\n\n"}
ESC[0mESC[36m2023-07-24 21:43:39.758 [debug] Replied in 163µs
ESC[0mESC[31m2023-07-24 21:43:39.771 [error] GenServer #PID<0.13044.0> terminating
** (ArithmeticError) bad argument in arithmetic expression
    (erts 13.1.2) :erlang.*(nil, 100000000)
    (archethic 1.2.4) lib/archethic/utils.ex:35: Archethic.Utils.to_bigint/1
    (archethic_playground 0.1.0) lib/archethic_playground/transaction.ex:162: anonymous fn/1 in ArchethicPlayground.Transaction.to_archethic/1
    (elixir 1.14.1) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
    (archethic_playground 0.1.0) lib/archethic_playground/transaction.ex:159: ArchethicPlayground.Transaction.to_archethic/1
    (archethic_playground 0.1.0) lib/archethic_playground.ex:13: ArchethicPlayground.parse/1
    (archethic_playground 0.1.0) lib/archethic_playground_web/live/editor_live.ex:162: ArchethicPlaygroundWeb.EditorLive.parse_and_get_triggers/1
    (archethic_playground 0.1.0) lib/archethic_playground_web/live/editor_live.ex:70: ArchethicPlaygroundWeb.EditorLive.handle_info/2
    (phoenix_live_view 0.18.16) lib/phoenix_live_view/channel.ex:271: Phoenix.LiveView.Channel.handle_info/2
    (stdlib 4.1.1) gen_server.erl:1123: :gen_server.try_dispatch/4
    (stdlib 4.1.1) gen_server.erl:1200: :gen_server.handle_msg/6
    (stdlib 4.1.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3

Describe the solution you'd like

No response

Epic

No response

bchamagne commented 1 year ago

Happens when we create a UCO transfer, leave every fields empty and then trigger a contract. It probably behave the same way for all subforms (uco transfer/token transfer/ownership/recipient)