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
2answers
32 views

find the bytecode of a contract during compilation

Is there a solution to recover the complete bytecode (init + runtime) of a contract imported in solidity. For example "bytes code = getBytecode (Escrow.sol)" and this would be replaced by bytecode ...
-1
votes
0answers
6 views

truflle consile error BN { negative: 0, words: [ 0, <1 empty item> ], length: 1, red: null

i was getting error in truffle console BN { negative: 0, words: [ 0, <1 empty item> ], length: 1, red: null
0
votes
1answer
59 views

truffle migrate --network ropsten issues

When i run truffle migrate --network ropsten i don't see the contract deployment but just Compiling your contracts... =========================== > Everything is up to date, there is nothing to ...
0
votes
1answer
243 views

Comparing msg.value using javascript test always fails

So I have this solidity function: function claimGoodTest(uint256 typeId) public payable { if (msg.value < 4000) revert(); } I test it with the following: var result = await contract....
1
vote
0answers
27 views

openzeppelin,VM Exception while processing transaction: revert

using openzeppelin-solidity to create crowdsale. Then I use this statement to Buy Token: MyCrowdsaleInstance.sendTransaction({ from: purchaser[1], value: web3.utils.toWei("0.5", "ether"), ...
0
votes
1answer
184 views

How can I use truffle to deploy my contract to a local testnet (not testrpc)?

I followed the steps in the following link to create a local Ethereum testnet, but now I want to deploy a contract to "MyTestNetNode": https://medium.com/@WWWillems/how-to-set-up-a-private-ethereum-...
1
vote
2answers
919 views

Identifier not found or Not Unique testing contract truffle

Created a simple HelloEthereum.sol contract: pragma solidity ^0.4.17; contract HelloEth { string message; function HelloEth() public{ message = "Hello Ethereum!"; } ...
3
votes
1answer
23 views

Ganache + Truffle: how to deploy a contract without considering the gas

I am working with Ganache and Truffle. I am trying to deploy kind of a huge smart contract, but most of the functions in this smart contract are pre-prod functions, so I do not really worry about real-...
0
votes
1answer
177 views

Loading truffle library in remix browser IDE

Besides writing smart contracts in the browser, I would also like to write my test in this IDE. Any suggestions how to load the truffle files in http://remix.ethereum.org? I appreciate your help!
0
votes
2answers
235 views

TypeError: Data location must be “memory” for parameter in function, but none was given

Contract fail to compile in IDE Remix.due to the following error: TypeError: Data location must be "storage" or "memory" for parameter in function, but none was given. version:0.5.6+commit....
2
votes
2answers
633 views

modify truffle console command to execute function on ropsten deployed contract thru geth

There are a couple of commands, reproduced below, which I've used successfully in the truffle console, executing on testrpc, which work and elicit the responses that I expect. How can I change them ...
0
votes
0answers
14 views

Contract has no network id set, cannot lookup artifact data

I am using web3 v1.0.0-beta.37 and truffle contract for server.js configuration. I have defined two contracts FlightSuretyData.sol and FlightSuretyApp.sol FlightSuretyApp contract access functions ...
0
votes
1answer
206 views

Error: The contract code couldn't be stored, please check your gas amount during deploy

I know this issue was discussed before several times, but I cant get the solution to my problem. I'm trying to deploy a contract with Truffle on Ganache. During the deployment in 2_deploy_contracts....
0
votes
0answers
18 views

Error : Could not connect to your Ethereum client with the following parameters:

Im creating my dapp with following below tutorial. http://www.dappuniversity.com/articles/the-ultimate-ethereum-dapp-tutorial however Im facing an error when I run truffle console it shows >...
1
vote
2answers
32 views

What are contract Variables and how are they different from normal varables declaration

pragma solidity ^0.4.2; import DappToken; contract DappTokenSale { address admin; DappToken public tokenContract; function DappTokeSale(DappToken _tokenContract) public { ...
0
votes
2answers
24 views

Load accounts to truffle

I'm using truffle v5.0.14 to handle my contracts. All was well while developing with ganache, but when I wanted to deploy to the real network (a private one) I have problems with the account. The ...
0
votes
0answers
13 views

truffle-assertions: TypeError: Cannot read property 'filter' of undefined

There is a part of my Solidity code: event elo(address pAddress); function test() external { emit elo(m_Registry); } And a chunk of my test: const truffleAssert = require('truffle-...
1
vote
1answer
36 views

Truffle Ropsten Deployment Issues

I just made some updates to my contracts and tried to redeploy them - but I'm getting this message, over and over again. Its not even attempting any of the migrations - it just goes right to this ...
0
votes
1answer
246 views

Contract not using Upgraded Proxy Contracts

There's 2 contracts A and B, A imports B, where B is a library that can be upgraded. To achieve this, I tried replacing B with a proxy contract and a delegate contract. We now have contracts Foo, ...
0
votes
1answer
220 views

How to deploy smart contract to main ethereum network

I am tring to deploy our ERC20 token in main net it gives an error Error: exceeds block gas limit. First I download or sync whole blockchain using geth command ( geth --syncmode "fast" --rpc --rpcapi ...
0
votes
0answers
11 views

Error occurs when I attempt to run `npm install drizzle` (Truffle product)

I am having an issue using Drizzle. When I run the command npm install drizzle I get the following error: How can I fix this?
39
votes
6answers
18k views

Truffle Migrate doesn't work: Error: No network specified. Cannot determine current network

When I try to run my migration with truffle migrate the following error message appears: Error: No network specified. Cannot determine current network. at Object.detect (/usr/local/lib/...
0
votes
2answers
440 views

Deploying on Rinkeby with Truffle using infura

If I want to use HDWalletProvider to deploy my contract on a specific address, what should I do? rinkeby: { provider: () => { return new HDWalletProvider("Mnemnoic", "https://ropsten.infura....
1
vote
2answers
19 views

How do I determine the network within a truffle exec script?

I'm writing a script to be executed with truffle exec and I need to add some logic conditional on the network we're calling truffle exec with. This is (roughly) what I want in my script: const ...
1
vote
1answer
123 views

call graphs for solidity smart contracts

Do we have some open source tools where we can get call graphs for solidity smart contracts execution ? For ex: Suppose Function A in contract C calls some other function B so the graph should contain ...
1
vote
3answers
38 views

Issue deploying this contract

This is a contract im trying to deploy and i think its an abstract contract as most of the functions dont seem to be implemented... anyway the issue im facing is that truffle is telling me i cant ...
0
votes
1answer
44 views

problem of call() returns null

contract permission{ struct transaction { address payable sender; address receiver; string datatype; Status status; } function getTransactionCount() public view ...
0
votes
1answer
28 views

A single exception in Truffle test causes every other test cases to fail

I'm making test script for my contract and it looks likes contract('...', async () => { let token = null; before('deploy', async () => { token = await MyContract.new(...); })...
4
votes
1answer
274 views

Truffle test fails to call the base function, wants the override

I have an extended ERC20 contract with ERC827 functions, which are overrides of ERC20 with an extra callback parameter. I have these two pairs of base/override functions: Base: function ...
0
votes
1answer
274 views

problem starting ganache

I'm using truffle with ganache GUI. It worked fine at first, but now I am unable to start it. (I made it executable) When I run ./ganache.AppImage I get this message: installed: X-AppImage-BuildId=...
2
votes
1answer
202 views

How would one use stubs for unit testing solidity code?

Given some contract A, that depends on another contract B, what would be the best way to unit test functions from A without inadvertently testing code from B. Normally, we could use stubs to return ...
0
votes
1answer
27 views

Truffle Exec Return Events

I have set up a JavaScript file that takes in my contract and executes the various functions and then returns the correct events. The file runs through 'truffle exec'. I am using the following line ...
2
votes
2answers
706 views

Truffle cannot find Ethereum client when running tests

By default this is the content of the file truffle.js: module.exports = { // See <http://truffleframework.com/docs/advanced/configuration> // to customize your Truffle configuration! }; ...
0
votes
1answer
257 views

Passing command-line arguments to 'truffle test'

I have a JS script which I pass to truffle test from command line: truffle test my_script.js I would like this script to take an input argument (retrieved via process.argv[2]). Does `truffle ...
2
votes
1answer
942 views

token transfer fails in crowdsale contract

I have a token contract and a crowdsale contract. When I try to send ether to the crowdsale contract from accounts[3](or any other really), I get an opcode error: Error: VM Exception while processing ...
1
vote
1answer
542 views

Invalid number of arguments error for getter function with no passed arguments

I am receiving this error when trying to call the getUsers getter function from the contract below: Invalid number of arguments to Solidity function. Running on Truffle in develop mode. mapping (...
0
votes
1answer
19 views

Truffle migrations - UNABLE TO MIGRATE (Error: Deployment Failed)

The compilations goes well on the Rinkeby testnet using the command geth --rinkeby --rpc --rpcapi="personal,eth,network,web3,net" --ipcpath "~/Library/Ethereum/geth.ipc" --syncmode light --cache 64 --...
1
vote
1answer
30 views

Which network does truffle use for testing?

I have a network 'foo' that is configured inside truffle.js. Running my tests works just fine truffle test --network foo ./test/*.js then I realized I forgot to start 'foo'. To confirm this running ...
0
votes
2answers
21 views

How to deploy truffle project on web server?

I've developed a DApp using truffle suite and now I want to deploy this dapp online so that everyone will be able to access it over the internet. I've used Rinkeby-Testnet for smart contract ...
1
vote
1answer
193 views

Truffle migrate not working

Every time I enter truffle migrate command in the terminal it doesn't do anything but takes some time and nothing happens after that. I am using Truffle version 5.0.4
0
votes
2answers
86 views

Default getter and setter for mapping in solidity

In my smart contract I've public mapping as mapping (uint=>User) public users where User is a Struct, so is there any way to get the values of this mapping using default getter. For Example : If ...
1
vote
3answers
70 views

Can't compile old solidity contracts(version 0.4.17)

I'm new with blockchain development. I'm working on an old project which use solidity 0.4.17 and truffle ^4.0.0-beta.2; These versions were in the package.json file of the project. When I installed ...
0
votes
1answer
393 views

Accessing Web3 in trufflebox's react-auth-box

Hi I am using trufflebox boilerplate react-auth-box. Created a new component called Foo where I am trying to access the web3 object that has been mapped from Store to this.props. However the console....
1
vote
1answer
475 views

Problem with truffle console : Cannot read property 'call' of undefined

I have a problem when executing the code HelloWorld.deployed().balance.call().then(console.log) This error introduced: Cannot read property 'call' of undefined This problem is similar to this ...
3
votes
1answer
159 views

truffle-hdWallet-provider not return correact address when using private key

I want to access MyEtherWallet account address from truffle-hdwallet-provider. This is the code. ``` var HDWalletProvider = require("truffle-hdwallet-provider"); var privateKey = process.env.KEY; ...
0
votes
1answer
26 views

passing variables between different contract by solidity (0.5.0+ version)

I writed ERC20 contract and ICO contract for a test , but I meet a lot problem with compile problem. My ERC20 contract have own constructor but,I also need a ICO contract(a control)for passing ...
2
votes
1answer
64 views

Simulating the DAO attack using truffle

I'm trying to simulate the DAO attack for a research project I'm working on. I have truffle and testrpc setup on my machine. I use the sample code given in this tutorial. I try calling the BankAttack ...
0
votes
1answer
348 views

Empty/null address handling in truffle pet shop tutorial

I am trying out the Truffle Pet Shop tutorial and it seems to be working all well except for a small issue. My solidity function getAdopters() returns an address[16] function getAdopters() public ...
4
votes
3answers
507 views

Truffle v5 runs out of gas but Truffle v4 deploys the contract

Truffle v4 used to deploy the contract successfully, but Truffle v5 truffle migrate command fails. My process to deploy: 1) delete buidl/ folder 2) truffle compile 3) truffle migrate Truffle v5 ...
18
votes
6answers
9k views

truffle has not been deployed to detected network

Is it possible to referer to a contract that has been deployed with Contract.new() with Contract.deployed() ? When referencing .deployed() in my test it throws : has not been deployed to detected ...