Skip to content

"Cannot send value to non-payable constructor" even though the constructor is payable #4

Description

@derekchiang

First of all, congrats on the great work! Loving making dapps in ClojureScript so far thanks to your excellent libraries.

I'm attempting to create a contract while also sending it some ether. My event handler returns an effect like this:

   {:web3/call {:web3 web3
                :fns [{:fn web3-eth/contract-new
                       :args [abi
                              {:data bytecode
                               :arguments []
                               :gas 400000
                               :gasPrice "30000000000"
                               :value 1000000}]
                       :on-success [:contract-created]
                       :on-error [:contract-creation-error]}]}}

On Chrome, I get the following error:

Uncaught Error: Cannot send value to non-payable constructor
    at p.new (inpage.js:14330)
    at Function.cljs.core.js_invoke.cljs$core$IFn$_invoke$arity$variadic (core.cljs:518)
    at Function.cljs.core.js_invoke.cljs$lang$applyTo (core.cljs:514)
    at Function.cljs.core.apply.cljs$core$IFn$_invoke$arity$4 (core.cljs:3870)
    at cljs$core$apply (core.cljs:3870)
    at Function.cljs_web3.utils.js_apply.cljs$core$IFn$_invoke$arity$3 (utils.cljs?rel=1516267498445:47)
    at cljs_web3$utils$js_apply (utils.cljs?rel=1516267498445:41)
    at Function.cljs_web3.eth.contract_new.cljs$core$IFn$_invoke$arity$variadic (eth.cljs?rel=1516267499820:949)
    at Function.cljs_web3.eth.contract_new.cljs$lang$applyTo (eth.cljs?rel=1516267499820:914)
    at Function.cljs.core.apply.cljs$core$IFn$_invoke$arity$2 (core.cljs:3870)
    at cljs$core$apply (core.cljs:3836)
    at web3_fx.cljs?rel=1516267507485:214
    at re_frame$fx$do_fx_after (fx.cljc?rel=1516254953008:73)
    at re_frame$interceptor$invoke_interceptor_fn (interceptor.cljc?rel=1516254952122:67)
    at re_frame$interceptor$invoke_interceptors (interceptor.cljc?rel=1516254952122:105)
    at re_frame$interceptor$execute (interceptor.cljc?rel=1516254952122:198)
    at re_frame$events$handle (events.cljc?rel=1516254952335:64)
    at re_frame.router.EventQueue.re_frame$router$IEventQueue$_process_1st_event_in_queue$arity$1 (router.cljc?rel=1516254952952:175)
    at re_frame$router$_process_1st_event_in_queue (router.cljc?rel=1516254952952:83)
    at re_frame.router.EventQueue.re_frame$router$IEventQueue$_run_queue$arity$1 (router.cljc?rel=1516254952952:194)
    at re_frame$router$_run_queue (router.cljc?rel=1516254952952:85)
    at router.cljc?rel=1516254952952:142
    at re_frame.router.EventQueue.re_frame$router$IEventQueue$_fsm_trigger$arity$3 (router.cljc?rel=1516254952952:165)
    at re_frame$router$_fsm_trigger (router.cljc?rel=1516254952952:79)
    at router.cljc?rel=1516254952952:183
    at <anonymous>

However, my constructor is in fact payable, as can be seen in both the Solidity source and the compiled code:

// skipping non-relevant sections
{
"abi": [
    {
      "inputs": [],
      "payable": true,
      "stateMutability": "payable",
      "type": "constructor"
    }
  ]
}

Any idea why this might be happening?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions