The Stack Overflow podcast is back! Listen to an interview with our new CEO.

New answers tagged

0

I was having the same problem. I would run the command truffle init and that would run fine. When I tried to run truffle test nothing would happen. No errors, no output, no timeout, just nothing. If I ran sudo truffle test it would work. In the end, I managed to get the tests to run by compiling for the first time. The commands I used where truffle init ...


0

Try reinstalling MetaMask on firefox. Sometimes it is just a bit buggy.


0

This might work: MetaMask settings -> Advanced -> Reset Account.


0

msg.value.mul(90).div(100) for 90% msg.value.mul(10).div(100) for 10%


0

You don't get a transaction hash because there is no transaction. If estimateGas reverts, then the actual transaction should revert as well. I don't know of a way to debug estimateGas calls, but you may want to set the properties for estimateGas the same as you will when you actually send the transaction (e.g. set the gas price and from address to what they ...


0

Hey I was just going through this issue. I solved it by locally installing an earlier version of node. First, I deleted all my node modules and package-lock.json. Then I installed an earlier version of node locally npm install --save node@8.10.0 Then I re-installed all my other node packages npm install --save drizzle drizzle-react drizzle components ...


0

So this issue was coming up because after adding my accounts to metamask I had to make migrations with truffle migrate and I did not do that. So that was the reason why Metamask had problems connecting to Ganache. New here! So suggestions are welcome! Thanks.


0

For most IoT project incorporating Smart Contracts, one will make use of an external oracle to input data into the Smart Contract. Try http://www.oraclize.it/ Hope this helps


0

I would go for the Arduino and here is why: The Arduino is "easier" to connect to sensors or electronic components which will work great in the IoT environment. Arduino's work great for projects in which one must quickly obtain data from sensors and perform an activity from it. I assume an external oracle, such as the Arduino, will input this data into the ...


0

From the Solidity documentation: Fixed point numbers are not fully supported by Solidity yet. They can be declared, but cannot be assigned to or from. The only possible fix at this point is to not use fixed point numbers.


0

The result of a view (read-only) function in web3.js and ethjs are object-like types, with string keys for the integer positions of the return values. If you stringified it, it would look like {'0': BN<some balance here>} Try balance['0'].toNumber() If your view functions return multiple values, it would look like `{'0': val0, '1': val1, ... }`


1

In the latest truffle after 5.x.x, it is possible to specify compiler version in truffle-config.js: module.exports = { networks: { ... etc ... }, compilers: { solc: { version: <string> // ex: "0.4.20". (Default: Truffle's installed solc) } } }; Reference: https://github.com/trufflesuite/truffle/releases/tag/v5.0.0-beta....


0

So I fixed it finally! It seems like the 2nd parameter in the event handler which which specified fromBlock and toBlock is not compatible with Metamask. It worked after I removed the toBlock parameter. Working snippet: App.PlatoonContract.PlatoonCreated({}, {fromBlock:0}).watch(function(err, result) { if (err) { console.log(err); ...


1

If you aren't set on using Truffle, Brownie can deploy multiple instances of a contract: >>> type(Token) <class 'brownie.network.contract.ContractContainer'> >>> Token [] >>> Token.deploy("TST", "Test Token", 18, "1000 ether", {'from': accounts[0]}) Transaction sent: ...


0

Clearly, if you have installed truffle globally (npm install -g truffle), you will need to provide the full path of that directory e.g.: "program": "/usr/local/lib/node_modules/truffle/build/cli.bundled.js"


0

The truffle-assertion package can easily help with this. Once the package is installed you can run the following: // Import the package to your file const truffleAssert = require('truffle-assertions'); // Deploy the contract let testContract = await TestContract.new() // Get the hash of the deployment transaction let txHash = testContract.transactionHash ...


0

Something I've done in the past is create a separate 'Stub' contract. So if you want to stub contract B, you create another contract BStub that inherits from B and override its methods to return some mock values instead. Then you initialise your A contract with a dependency on BStub instead of B. This has some drawbacks (like unavailability of private ...


1

Brownie allows you to use multiple versions of solidity within the same project. All that's required is setting the compiler version to null within your project's config file. From the documentation: If the version is set to null, Brownie looks at the version pragma of each contract and uses the latest matching compiler version that has been installed. If ...


2

function Donations() private { This is not the same name as the contract, which would be the old style of constructor. If you rename to Donation(), the compiler will probably recognize you intend for this to be a constructor and warn you that the syntax should be changed to the new explicit form: constructor() public { There may be other issues, but your ...


0

Etherscan creates a user interface for verified contracts. You can also use https://oneclickdapp.com to generate an interface.


0

It solved by updating truffle version.


Top 50 recent answers are included