Newbie. Getting cannot read property 'abi' of undefined when trying to deploy on Ubuntu

by user3393561   Last Updated June 12, 2019 06:28 AM - source

let abi = compiled.contracts.example.PartyTime.abi;

This is the line of code that is causing the error. I copied the abi code from Remix into an abi.json file. But it doesn't seem to be reading it correctly. Should I post the full code?

I am in the right folder where I have the code and have the code deploying it and the abi code in the same file.

Tags : solidity remix

Answers 1

This problem might be related with wrong path while trying to reading the json file from your local machine. If this will make your life easier you can define the abi of the contract as string and use it this way. Example:

let contract_abi = '[{"constant":true,"inputs":[],"name":"getA","outputs":[{"name":"","type":"uint256"},{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"returnAllowanceAndAmount","outputs":[{"name":"_bool","type":"bool"},{"name":"_val","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_val","type":"uint256"}],"name":"setA","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]';
Miroslav Nedelchev
Miroslav Nedelchev
June 12, 2019 06:19 AM

Related Questions

How can I pass struct from one contract to another?

Updated January 10, 2019 23:28 PM

Gas Estimatation

Updated January 02, 2019 03:28 AM

How use payable function with browser solidity?

Updated July 06, 2017 09:28 AM