hswick / exw3

High level Ethereum RPC Client for Elixir
Apache License 2.0
151 stars 45 forks source link

Passing string as parameter throws error #114

Open somoza opened 2 years ago

somoza commented 2 years ago

I create 2 diff contracts, one with set function receiving integer as parameter, the other receiving string.

First works fine and the second one fails with this message:

{:error,
 %{
   "code" => -32000,
   "data" => %{
     "0xe20bb21666d462cfec33dad694cae424fadd38cdc4820970c8769f2e7690f149" => %{
       "error" => "revert",
       "program_counter" => 5281,
       "return" => "0x"
     },
     "name" => "RuntimeError",
     "stack" => "RuntimeError: VM Exception while processing transaction: revert\n    at Function.RuntimeError.fromResults (/tmp/.mount_ganachjrwblU/resources/static/node/node_modules/ganache-core/lib/utils/runtimeerror.js:94:13)\n    at BlockchainDouble.processBlock (/tmp/.mount_ganachjrwblU/resources/static/node/node_modules/ganache-core/lib/blockchain_double.js:627:24)\n    at runMicrotasks (<anonymous>)\n    at processTicksAndRejections (internal/process/task_queues.js:93:5)"
   },
   "message" => "VM Exception while processing transaction: revert"
 }}

I've tried converting string to hex and didn't work either.

Please add an example on readme on how to format string before passing it to contract function.

samparmenter commented 2 years ago

Are you passing an ethereum address as the parameter to the contract function or is it just a normal string?