Solidity 0.5.0 how to call payable function from another contract

1 answers
1 votes
Solidity 0.5.0 how to call payable function from another contract
asked
hi All

I have 2 Solidity 0.5.0 Contracts. One contract wants to call the payable function in another contract.

Currently I invoke the Payable function from calling contract  as follows:

function editContract(string memory _name, string memory _comments) public payable{
        EditableContract de = EditableContract(dataEntities[_name]);
        de.editDE(_comments);
        emit Edited(_name, _comments, msg.sender);
    }

I tried the Contracts in remix it works, but not  from the DApp, I get following error:

"Error: [ethjs-rpc] rpc error with payload {"id":7784107239061,"jsonrpc":"2.0","params":["0xf9014e8203a08504a817c800836170d494afc7f2fd99ab5b224bfae0e21cf0c347926f1b4980b8e4296ce3a30000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000046564697400000000000000000000000000000000000000000000000000000000822d46a04069c5f15f607372d691f713db55658fff4c90d197ab2a175d27bf4bf6024170a04603dffdc2e3281a0c06ae5e7b0ddaf5e58c1433c25ad9294024e98d23b1c85e"],"method":"eth_sendRawTransaction"} [object Object]"

Answers

newest most voted
@Saarah

The metamask gas limit is not zero. Tried with high values the problem persists? I am using Ganache and from remix to ganache it works. IT is from my Dapp and this is how I call from DAapp:

contract.methods.editDE(name, annotations).send({from: this.state.account})

Hungry for knowledge?
New guides and courses each week
Looking to invest?
Market data, analysis, and reports
Just curious?
A community of blockchain experts to help

Get started today and earn 4 bonus blocks

Already have an account? Sign In