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.

1
vote
0answers
9 views

truffle unbox react - front end is unable to read / set state of the contract

I am experiencing problems with the Truffle React boilerplate code that the front end is unable to read / set state of the contract. Here are the details: I unboxed the React boilerplate using ...
-2
votes
0answers
8 views

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

i was getting error in truffle console BN { negative: 0, words: [ 0, <1 empty item> ], length: 1, red: null
1
vote
0answers
30 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"), ...
3
votes
1answer
24 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
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
0answers
19 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 >...
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
14 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-...
0
votes
0answers
13 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?
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 ...
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
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 --...
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(...); })...
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 ...
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 ...
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
0answers
14 views

Deploying multiple instances of contract, no error but no deployment

I am trying to deploy the same contract code to create multiple instance: const contract = require('truffle-contract') var Greeter3 = artifacts.require("Greeter3"); module.exports = function(...
0
votes
0answers
7 views

How to use cacheSend of drizzle library when the method needs two parameters

Should it be like the example below(2,2 as two different parametres) Ex: const stackId = drizzle.contracts.SimpleStorage.methods.set.cacheSend(2,2, {from: '0x3f...'})
0
votes
0answers
20 views

Geth - blockchain remains on genesis block, miner node doesn't mine

When attempting setup a local private PoW blockchain, an issue is arising where instead of mining new blocks, Geth instead hangs on the first attempt to 'commit new mining work'. Between the two geth ...
1
vote
1answer
14 views

Notation in npm solidity-coverage tests

I had been using the npm package solidity-coverage and while reading the coverage reports I came up with this E symbol. I am not sure what it means and there is no explanation in the documentation as ...
1
vote
1answer
15 views

How to pass account address to truffle deployer?

How do I pass my account address to the contract constructor while deploying with truffle migration? I want to pass address into MyAdress like below. deployer.deploy(MyContract, MyAddress) My ...
0
votes
1answer
18 views

I keep getting the error: “Uncaught (in promise) Error: Invalid number of arguments to Solidity function”

I have tested it in remix and the function does work, I also removed inputs just for testing purposes but it seems that it doesn't work anyway. Here is the function: struct Message{ string ...
0
votes
0answers
35 views

How to call A child Contract function in web3js?

Hey I am new at blockchain development and I need to make contract name organization that create sessions contracts. I had already implemented the solidity code but I have a problem in front-end ...
1
vote
1answer
39 views

My Solidity files are not compiling and I am getting constant error

I'm new to blockchain and I'm following a tutorial. However, I'm getting problem compiling my first contract on Truffle. Here's my code : pragma solidity ^ 0.5.2; contract ApprovalContract { ...
0
votes
0answers
30 views

How do I set constant state variables in source code before migrating to a test network?

Is there a way to change the value of address literals in solidity source code before migrating to a local test chain using Truffle? Currently, if a contract A needs to know the address of another ...
2
votes
1answer
14 views

Truffle: provide a different config file name via the CLI?

I've read through the Truffle docs on configuration, but I haven't found the option of providing a different file name other than truffle-config.js or truffle.js. In my case, I need multiple files ...
2
votes
1answer
17 views

Truffle: how to override compiler settings via the CLI?

This is a highly specific bottleneck encountered when using Truffle. In my normal truffle-config.js file, I have the optimizer enabled. I run a CI pipeline which has a coverage job. I use 0x/sol-...
0
votes
0answers
14 views

Supporting multiple HDwallets with truffle/drizzle

I have a dapp using truffle/ drizzle that implements regular user auth format (Login, id, tokn, etc). If I wanted to support each user having access to their own hd wallet, how would I do that with ...
0
votes
0answers
32 views

why .call() in Truffle did not return results as expected?

I'm deploying a contract to my private chain and try to call the contract's function. After I got in the geth console and finished deploy contract, I called the function but it doesn't work ...
0
votes
1answer
33 views

TypeError: tokenInstance.balanceOf is not a function

It happen when use truffle test, here my contract file: pragma solidity ^0.5.0; import "./DappToken.sol"; contract DappTokenSale { address payable admin; DappToken public tokenContract; ...
0
votes
1answer
21 views

tokenInstance.balanceOf is not a function [duplicate]

It happen when use truffle test, and here my DappTokenSale file: var DappToken = artifacts.require('./DappToken.sol'); var DappTokenSale = artifacts.require('./DappTokenSale.sol'); contract('...
0
votes
1answer
20 views

ReferenceError: admin is not defined

It happen when use truffle test, here my contract file: pragma solidity ^0.5.0; import "./DappToken.sol"; contract DappTokenSale { address payable admin; DappToken public tokenContract; ...
1
vote
0answers
94 views

Error: Returned values aren't valid, did it run Out of Gas?

I got this problem when follow the instruction, here my two contract: 1) token sale contract: pragma solidity ^0.5.0; import "./DappToken.sol"; contract DappTokenSale { address payable admin;...
0
votes
1answer
29 views

Operator == not compatible with type unit256 and address // TypeError: Invalid type for argument in function call

I got 2 problem when i follow instruction. Here my contract file: pragma solidity ^0.5.0; import "./DappToken.sol"; contract DappTokenSale { address admin; DappToken public tokenContract; ...
1
vote
1answer
29 views

Struct member access in web3 requires additional dummy field

If a struct contains a single field, then that field is inaccessible from web3. In the below example, field uint b must also be present in order to access field uint c from web3. Of course, it's not ...
0
votes
1answer
31 views

Create a large number of contracts with different addresses

I'm developing a performance test where I check the time a gateway spends to find a contract in a blockchain. I'm using ganache-cli to simulate the blockchain, my doubts are: 1) Is it possible to ...
0
votes
1answer
63 views

Invalid number of parameters for “undefine”. Got 0 expected 1!

I start my trial token sale contract, but it keep pop out this error when i test it with truffle. Here my token sale contract: pragma solidity ^0.5.0; import "./DappToken.sol"; contract ...
0
votes
1answer
27 views

Accessing one smart contract contained in another smart contract from javascript

I'm cross-posting this from Stack Overflow, since there seems to be more activity here. I am trying to develop a dApp with Truffle and want to test my smart contract. The contract contains a second ...
1
vote
1answer
13 views

Can ganache-cli connects to another ganache-cli?

Is it possible to create a private network using ganache-cli? Can a ganache-cli running on port 8545 connect to ganache-cli running on port 9545? Can we use ganache-cli as a node? Or it is a ...
1
vote
1answer
16 views

During gas-free transaction get an error “No relay responded! 4 attempted, 4 pinged”

I did all modification related to this instruction https://github.com/tabookey/tabookey-gasless However, when I'm trying to write some tests it fails and provides me the following error Error:...
0
votes
1answer
58 views

invalid number value (arg=“_goal”, coderType=“uint256”, value=2000000000000000000)

i am following a tutorial from here. And upon running truffle test. It produces following error. 2_HashnodeCrowdsale.js ====================== Deploying 'HashnodeCrowdsale' ------...
1
vote
1answer
62 views

Deploy new contract through another contract function in Truffle

I have a function in my contract minter.sol that creates another contract etnX.sol: function createNewContract(string memory name, string memory symbol, uint256 _maxSupply) public onlyOwner { ...
0
votes
0answers
18 views

Manage accounts in Remix Web3 Provider env connected to a TestRPC client node

When I run the TestRPC client (ganache-cli), it provides me with 10 different accounts and private keys along with a local server at localhost:8545 Available Accounts (0) ...
0
votes
0answers
13 views

Can ganache serve at a directory in addition to a port?

Using the ganache command line interface I can set a seed and a port: ganache-cli --seed 2048 --port 2020 Which serves to Listening on 127.0.0.1:2020 Can I get it to serve to a directory of my ...
0
votes
2answers
63 views

Can I automate the truffle (smart contracts) test scripts?

As we all aware about smart contract testing using truffle framework. Currently, we are writing the test scripts either in solidity or in java-script manually. Is there any way so that I can auto ...
0
votes
1answer
16 views

Error: sets the total supply upon deployment

Please help ! When i try to run test from truffle, i got this problem, here my test js code: var DappToken = artifacts.require("./DappToken.sol") contract(DappToken, function(accounts) { it ('...
1
vote
1answer
20 views

Return each struct value from a key inside a mapping, where the key is also a value from array inside another mapping

I have a project that I'm working on and I'm trying to figure out a way to do as the title says. I'm looking for the easiest and/or cheapest way(gas wise) and since I'm stuck I'm open to better ways ...
0
votes
1answer
20 views

This declaration shadows an existing declaration

When i try to run migration from truffle, i got this problem, here my contract code: pragma solidity ^0.5.0; contract DappToken { uint256 public totalSupply; function DappToken () public ...
1
vote
2answers
39 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
0answers
9 views

Solidity: (why) is it considered an anti-pattern to inherit a contract in a truffle test?

There are some functions I'd like to expose on my contract but only for testing purposes. It seems reasonable to specify them with a visibility modifier of internal and have the test contract inherit ...