Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [truffle]

Questions regarding the implementation and use of the Truffle development and testing environment.

0
votes
0answers
15 views

web3 is not getting detected while migration in truffle [duplicate]

I am trying to deploy the contract in ropsten. In that process I use web3 for a conversion. Due to this the migration fails as mentioned below. Please assist me in resolving this. I have also tried ...
0
votes
0answers
108 views

Truffle: Error: Could not find a compiler version matching 0.5.0

I wonder why I get the error when I have v0.5.0 everywhere and do the following: In my Action.sol: pragma solidity ^0.5.0; In Migrations.sol: pragma solidity >=0.5.0 <0.6.0; When running truffle ...
0
votes
0answers
12 views

Is it possible to write to a file from a truffle console?

I am running some tests on my smart contracts and I need to gather a bunch of data to process in a spreadsheet. Is it possible to write to a file from the console?
1
vote
1answer
49 views

how to test overloaded function in truffle?

I recently upgraded truffle to the newest version. Now it does not automatically detect overloaded functions anymore. Before, I could just do the following: await contract.function({ from: accounts[...
0
votes
1answer
28 views

Making assertions (assert.equal) on two return values in Truffle

Appreciate any help I can get. I am trying to make an assertion on returned values from a smart contract, and I cannot figure out how to get it to work for a Truffle test. I cannot show all my code in ...
2
votes
0answers
38 views

Why truffle deploy fail with address value=0 after I upgrade to version 5.0.5?

I have a truffle 2_deploy_contracts.js something like this : const sample = artifacts.require('./Sample.sol'); module.exports = function(deployer) { deployer .then(()=>deployer.deploy(...
2
votes
1answer
33 views

Truffle .call() returns values with array index instead of keys

I am currently writing tests for solidity contract using truffle. When I invoke a function from the contract with .call(), the object that is being returned to me has the values included twice, once ...
1
vote
0answers
27 views

Truffle test {from} option is ignored

To test my contracts i need to use multiple accounts. I hoped that changing value of from option will help me with this. But it is ignored and msg.sender is always accounts[0] (my deployer) Truffle ...
2
votes
1answer
84 views

How to debug transaction from truffle test on development network

I am trying to debug a failing solidity function, which I am calling from the JS test files with truffle. When I run my test, I am successfully able to get a transaction id. However, my solidity ...
0
votes
1answer
48 views

Solidity. Truffle. Call contract function in migration file

Tell me, how through truffle, after the deployment of the contract, call one of its functions? I mean, during migration, how can I call the function of the contract? var Ownable = artifacts.require("....
2
votes
2answers
28 views

TruffleSuite contract class or Web3^1.0 contract class for production code?

Starting out with blockchain development and I'm coming across many sources/courses that recommend the Truffle/Contract class for interacting with deployed contracts because of "ease of use". But Web3^...
0
votes
1answer
123 views

Web3 not connecting with ropsten through infura

so my truffle based application is communicating fine with my smart contracts on my private network, ganache and ganache-cli. I then deployed it to ropsten where i used the endpoint i got from infura....
0
votes
1answer
50 views

Invalid JSON Response while connecting DApp, Metamask and Backend

I am getting some error(picture below) while trying to connect DApp with a backend. One day ago, everything worked fine, now I got an error: "basic auth failure". Contracts are deployed on Ropsten ...
0
votes
0answers
45 views

Revert on ERC20.transferFrom

I am getting Error: Returned error: VM Exception while processing transaction: revert when testing MyContract.deposit() Here are simplified versions of my code to highlight where the issue is ...
3
votes
2answers
50 views

Passing '-1' to a solidity function which takes a 'uint256' argument as input

Suppose I have: function func(uint256 x) external { ... } I would like to test this function via web3.js, with the maximum possible value of x. In a Truffle test, I have noticed that I can ...
1
vote
0answers
29 views

Error: Cannot create instance of X; no code at address

Having a little issue. I have deployed a Mock ERC20 contract on development network like so: const ERC20Mock = artifacts.require("ERC20Mock"); module.exports = async function(deployer, network, ...
0
votes
1answer
24 views

In truffle5, how to manipulate time with evm_increaseTime?

I am using truffle 5 and ganache-cli. I've imported increaseTime as import increaseTime from './helper/increaseTime'; and the increaseTime.js file is like this export default function increaseTime(...
0
votes
0answers
115 views

Truffle migrate not working with 2_deploy_contracts.js

I have made a sample contract using Truffle's pet-shop. I have also added the 2_deploy_contracts.js file. I have changed the solidity version and also the constructor() public {} to comply with the ...
0
votes
1answer
80 views

What does this Truffle onConnect error mean?

I've been following a tutorial to set up a simple voting application just for experimentation purposes but after installing truffle, it seems it won't connect. Heres the error I'm getting when I try ...
0
votes
0answers
38 views

truffle cant find function from contract made with address and abi

So I have a factory contract "RestaurantFactory" which i migrate, this contract creates another contract "Restaurant", after deploying the RestaurantFactory and calling createRestaurant() I receive an ...
0
votes
1answer
45 views

Truffle Pet Shop Tutorial App.js - Send Multiple Form Values to Function

Working through a little project using the Truffle Pet Shop as the starting point and hit a wall. It looks like this is the piece in App.js that fires the handleAdopt function: bindEvents: function() ...
0
votes
0answers
28 views

Issue with truffle migrate

I'm trying to migrate a simple contract on the ganache blockchain.But when I type 'truffle migrate' command in the terminal.It freezes for some time and then command execution stops without showing ...
0
votes
0answers
78 views

unable to deploy contract on rinkeby network

I am trying to deploy my contract to rinkeby test network but unable to do so here is my contract code. pragma solidity ^0.4.17; contract Inbox { string public message; function Inbox(string ...
2
votes
0answers
37 views

Function call always returns 0

Working with a simple contract to get the hang of this. I can't seem to get the correct value back from my contract function. It always outputs 0. Truffle version: 4.1.15 Contract: pragma solidity ...
0
votes
0answers
27 views

Web3 vs. web3.js

Experienced iOS developer here - but very new to Ethereum Smart Contract development. I'm trying to figure out why the web3 version that gets loaded by MetaMask into my browsers when I run my app (...
0
votes
1answer
26 views

Pushing constructor result to contract member array

I'm trying to do the following operation in Solidity: BetCampaign memory newCampaign = BetCampaign(id, new Bet[](0), betEndTime, false); betCampaigns.push(newCampaign); With the following member ...
1
vote
0answers
40 views

Web3 Version refuses to update

The official documentation of web3.js has this little commented statement saying: // in node.js use: const Web3 = require('web3'); (you can find it here: https://web3js.readthedocs.io/en/1.0/getting-...
0
votes
1answer
243 views

How To Connect Web3 With MetaMask?

No tutorial can help me, I have watched almost every major tutorial on Youtube and read a ton of results from Google... I have on my HTML file imported the web3.min.js (copied from Truffle pet-shop ...
1
vote
1answer
174 views

truffle migrate not working

every time I enter truffle migrate command in the terminal it doesn't does anything but takes some time and nothing happens after that. I am using Truffle version 5.0.4
0
votes
1answer
234 views

Specify different solc compiler for different files in truffle?

I am using truffle, and have a number of x.sol files in the contracts directory, different files require different versions of the compiler - how do i deal with that? I think i SHOULD be able to do ...
0
votes
0answers
78 views

“SyntaxError: Unexpected token” on truffle develop

Once I run truffle develop this is the error I am getting. /usr/local/lib/node_modules/truffle/build/cli.bundled.js:33499 Config.search = (options = {}, filename) => { ^ ...
0
votes
1answer
21 views

How I can generate a file.sol from ABI?

I have created an smart contract but the code in the sol file have disappeared. But the jeson file still remains. Can I generate my smartcontract again from ABI ?
1
vote
0answers
59 views

How to interact with my Rinkeby contract via truffle console?

I've been using truffle console to interact with a contract which I developed locally with Ganache. I'd like to be able to call the contract's methods using the console once deployed to the Rinkeby ...
3
votes
2answers
211 views

How to use bignumbers in truffle tests?

I am testing a smartcontract with Truffle V5. All works well if I do not use all decimals. If I set 18 decimals all explodes. The test code is this (from truffle docs): const MetaCoin = artifacts....
0
votes
1answer
32 views

ParsedContract.sol:1:17: ParserError: Token incompatible with Solidity parser as part of pragma directive

Code : git clone https://github.com/dappuniversity/election https://github.com/dappuniversity/election/tree/2019_update Errors faced : Commands: Compile: truffle compile Migrate: ...
0
votes
0answers
19 views

Truffle Deployment

I have created a DAPP using Truffle & Ganache. It is working fine in development server after running the following command. $ganache-cli Deploy the contract. $truffle migrate --reset Run the ...
1
vote
1answer
54 views

Truffle test, how to get address(0)?

This is going to be short question and may be silly, but I'm literally stuck with a problem, where I need to pass address(0) to function in Truffle Test in JS and don't really know how to do it. In ...
0
votes
1answer
51 views

Smart Contract function keep return Null value?

Hey I am new with Solidity. And I just tried to link my front end view with the smart contract. With the simplest possible approach. My contract:- My JS code:- Console keep printing 'null' I don't ...
0
votes
1answer
168 views

truffle migrate does not return anything

I am following the tutorial from Truffle to create a "pet shop" contract. I can follow everything until he tells me to truffle migrate. Here is the contract: pragma solidity ^0.5.0; contract ...
1
vote
1answer
24 views

Get a Tx hash from truffle

I have implemented a function call in truffle(web3js): await this.token1.transferFrom(holder1, holder2, transferAmount, {from: holder1}); and now I want to get the tx hash for that specific function....
0
votes
0answers
45 views

VM error in Truffle

Running the code below returns a vm error: Error: Returned error: VM Exception while processing transaction: revert at Object.ErrorResponse (node_modules/truffle/build/webpack:/~/web3-eth/~/web3-...
0
votes
1answer
115 views

ERC20 is an abstract contract or an interface and cannot be deployed

i am trying to deploy a test erc20 token with truffle on ganache-cli My migration file name 2_deploy_contracts.js here is the code for it: var erc20 = artifacts.require('./ERC20.sol'); module....
1
vote
0answers
38 views

Parsing Error while compiling pet-shop tutorial

I am just getting started with smart contract programming and was trying to implement the pet-shop example as per this tutorial https://medium.com/tomochain/how-to-build-a-dapp-on-tomochain-...
0
votes
0answers
8 views

Truffle Console detecting a single key press as multiple key presses

So I have installed truffle using: npm install truffle -g, now when running the truffle console some of the key presses are being detected as two key presses for example, pressing up to load the last ...
0
votes
0answers
42 views

TypeError: web3_eth_personal__WEBPACK_IMPORTED_MODULE_0___default.a is not a constructor

I have an application using truffle and webpack. When I run npm run server ( server's definition in package.json is : "server": "concurrently 'webpack --mode development --watch' 'wait-on build/...
0
votes
1answer
19 views

MetaMask repeated errors with LocalHost

Every time I try to send ETH to my locally deployed contract I get errors like this: -While the error message says "out of gas" I know that can't be true since all my accounts have like 100ETH in ...
1
vote
0answers
84 views

How to get the returned value of a smart contract function when it called by using cacheSend() in drizzle

I just tried to build a simple DApp using truffle, react and drizzle. My question is how to get the returned value of a smart contract function when it called by using cacheSend() in drizzle? As ...
0
votes
1answer
41 views

Remix vs Truffle project in VSCode [closed]

I do this post to ask your methodologies and customs when developing smart contracts. Between Remix + Ganache and Truffle Project + Ganache. What is more comfortable for you? Why is one better than ...
2
votes
1answer
144 views

Why do truffle compile or migrate commands fail silently?

Truffle v5.0.3 config: truffle-config.js module.exports = { // See <http://truffleframework.com/docs/advanced/configuration> networks: { development: { host: "127.0.0.1", //also ...
1
vote
1answer
62 views

Debugging a VM error in solidity

I'm getting the following error while running a test in truffle: Error: Returned error: VM Exception while processing transaction: revert Now, the code is simply to big and complicated to run ...