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

Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
120 views

passing defaultBlock “pending” param to a truffle-contract call

I need the pending balance of my contract. As far as I understand I could do it with web3: web3.eth.call(callObject [, defaultBlock] [, callback]) Can I pass defaultBlock to truffle-contract ...
0
votes
1answer
2k views

Uncaught ReferenceError: TruffleContract is not defined

I am working on a smart contract. When I try to serve my smart contract via lite-server I see following error in the browser console Here my app.js source code: https://pastebin.com/UjFuYCyQ I have ...
1
vote
1answer
408 views

Truffle migrate got stuck

Issue I ran the official example code: truffle migrate,and stuck there for a long long time: truffle migrate Running migration: 1_initial_migration.js Deploying Migrations... Steps to Reproduce I ...
0
votes
1answer
275 views

Error: Cannot find module 'ethereumjs-wallet'

A truffle test needs ethereumjs-wallet const wallet = require('ethereumjs-wallet'); I tried npm install ethereumjs-wallet and even npm uninstall ethereumjs-wallet npm install --save ethereumjs-...
0
votes
2answers
161 views

Empty bytes32[] in truffle console

I am trying to get from truffle develop console an array of identifiers using a custom get function but the return array is []. Here is my contract: pragma solidity ^0.4.18; contract MyInfo { ...
2
votes
1answer
43 views

How to trace the line where a tx failed in truffle tests?

I know about 0x's sol-compiler and sol-trace. I used them before and they do exactly what I'm looking for, but these modules bring significant overhead when used with truffle. Check out this file to ...
0
votes
1answer
104 views

Why I am unable to write to contract in ethereum wallet?

I clicked on the watch contract and entered address and ABI. But I can't see any functions to write to contract. I compiled and deployed contract by using truffle framework ABI: { "...
0
votes
1answer
110 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
74 views

web3-core-method.umd.js:1191 Uncaught (in promise) Error: Transaction has been reverted by the EVM:

Keep getting this error and really not sure what's causing it. Smart contract: contract BasaltStore { // struct of how a document will be stored struct documentStore { // unique id of the ...
26
votes
13answers
23k views

How to upgrade solidity compiler in truffle

I couldn't find a way to upgrade a version of truffle solidity compiler. Also curious how to see that information for deployed contracts in truffle console
0
votes
1answer
208 views

Trouble while installing truffle-contract module

When I run the command sudo npm install truffle-contract it gives me this error: npm ERR! code 1 npm ERR! Command failed: /usr/bin/git clone -q https://github.com/debris/bignumber.js.git /home/ubuntu/...
1
vote
1answer
99 views

Error when testing the contract

ApprovalContract.sol pragma solidity ^0.5.1; contract ApprovalContract{ address public sender; address payable public reciever; address public constant approver=...
1
vote
1answer
105 views

browser-solidity debug alternative for more automate process (rather than manually type in the function input everytime)

As specified in the title I use truffle to test now, but often times it just returns the error msg "invalid opcode" instead of clearly stating what happened. Any other testing/debugging tips will ...
0
votes
1answer
186 views

by using truffle & metamask deployed my contracts, but a error occurred when sending a transaction on web

This is the err information. This is the web I built. Now the problem you see is that when I click the vote button, pay the gas, and send a transaction, but than error occurred. I write my program ...
0
votes
0answers
22 views

Truffle test including mainnet contract - Error: Cannot create instance of Whitelist; no code at address

Problem with the error Error: Cannot create instance of Whitelist; no code at address 0x6198149b79AFE8114dc07b46A01d94a6af304ED9 How do I have to setup truffle so that I can run a test which includes ...
0
votes
1answer
200 views

How to chain functions in truffle framework?

I am wondering how to chain functions in truffle testing framework to avoid writing the same code twice. To give an example, I am experimenting with the old version of King of the Ether Throne ...
1
vote
1answer
214 views

Exceeds block gas limit error to call view functions

With solidity view function, you can specific the amount of gas to use. My understand is since it is not a state changing transaction, all the gas cost is not charged for, and the client should be ...
0
votes
2answers
249 views

How to download or access ('web3/lib/web3/event.js');

The following test script requires('web3/lib/web3/event.js'); const SolidityEvent = require('web3/lib/web3/event.js'); function decodeLogs (logs, contract, address) { return logs.map(log => { ...
1
vote
1answer
180 views

How do I deploy a contract via a contract factory in truffle?

The code below does not set the simpleStorage instance's value to 55, but identical code works when the contract is not generated via a factory
0
votes
1answer
31 views

Emited Solidity Events not being watched at frontend truffle contract instance

So, I have been reading through A LOT of pages about events in Solidity and how to interact with them on frontend but I am still pretty new to this and it seems like there have been multiple changes, ...
9
votes
2answers
2k views

Deploy multiple contracts using truffle

I am very new to developing smart contracts. I have a simple question, do i need to write migration file separately for each contract i deploy from an account using truffle or can i deploy multiple ...
8
votes
2answers
730 views

How can I debug a truffle JS unit test with vscode?

I am using visual studio code and truffle and would like to easily debug my JavaScript tests. A similar question has been asked here: how can I run a truffle test in a debugger?. This has been ...
1
vote
1answer
206 views

No output when writing data to IPFS and storing its hash through Solidity

So I am using truffle. Following from Creating a form in IPFS for users to enter data [check the code in answer], doing some changes: Contract name - IpfsContract.sol test.js uses the following JSON ...
0
votes
1answer
184 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!
1
vote
1answer
254 views

NodeJS with HDWalletProvider

I want to execute signed Ethereum transactions from a NodeJS program. I am creating a web3_provider like this var contract = require("truffle-contract"); var provider = new HDWalletProvider("nemonic"...
2
votes
2answers
66 views

assertEventEmitted from new contract construction call

At present there is no way I can see or is documented to be able to easily use something like this with the truffle framework: So using chai and writing a test to deploy a contract with something ...
0
votes
2answers
58 views

ParserError: Expected identifier, got 'LParen' constructor() public {

i don't know why i get this problem, anybody who can helps thanks a lot pragma solidity ^0.4.21; contract MathContract { function mulAtoB(uint a, uint b) pure public returns(uint) { ...
0
votes
1answer
235 views

SenTransaction can't send Ether to a contract address

I am using openzeppelin, Ganache and truffle, here's a very simple smart contract for fundraising: pragma solidity 0.4.24; import 'openzeppelin-solidity/contracts/crowdsale/Crowdsale.sol'; contract ...
0
votes
1answer
144 views

Drizzle component returns BigNumber

I am using the following Drizzle (Truffle) component to call a function from a smart contract: <ContractData contract="Market" method="priceOf" methodArgs={this.props.id}/> The result is a ...
4
votes
1answer
791 views

truffle migrate specific file

Is it possible to truffle migrate only one specific file? I found this on the internet: https://github.com/trufflesuite/truffle-migrate/issues/23 but truffle migrate -from 2 starts to migrate from ...
0
votes
0answers
24 views

Error: invalid number/address values

Having trouble with the submitOracleResponse inside the callback below: flightSuretyApp.events.OracleRequest({ fromBlock: 0 }, function (error, event) { if (error) console.log(error); ...
7
votes
3answers
2k views

Simulating the passage of time with testrpc

Any tips on how to simulate real network conditions on the testrpc testing client using truffle? I have some functions that look at blocknumber and try to deal with passing time. Has anyone come up ...
0
votes
1answer
18 views

Can i use a the msg.sender which is a address to call a function of the contract?

I am trying to mint a ERC721 token using openzeppilin/contracts. It was working correctly, but later had to change the design. So now i am forced to use the msg.sender who is the minter to call the ...
0
votes
1answer
165 views

Why does the transaction stay in queue from more than 240 second

I am running quorum nodes via the Quorum-maker script, and when trying to call functions from my already deployed smart contract, I get this error : Transaction ...
0
votes
1answer
306 views

Deploying new contract inside truffle test case

I was trying to transact between two contracts inside my truffle test case. But not been able to do it. The second contract instance comes back undefined always. As per the truffle documentation, ...
0
votes
0answers
36 views

Unable to deposit ether from External Account to Contract

This is my first question on StackOverflow. I am having trouble sending Ether from an account to the contract. The DApp I am creating is separated into a Data & App contract, where the Data ...
2
votes
2answers
222 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
26 views

Adding a payee to a donation contract. Error: Transaction reverted

Disclaimer: I'm a noob when it comes to programming altogether let alone smart contracts. I refactored this code that was written like three years ago so it could work with solidity 0.5.0. I deployed ...
0
votes
1answer
293 views

Error when testing smart contract - use truffle and solidity

I'm executing a example in this link. https://truffleframework.com/tutorials/pet-shop While testing testing with file "TestAdoption.sol", I have encountered the error "Source truffle / Assert.sol not ...
3
votes
2answers
95 views

Using two solc versions within the same truffle project

I am creating an app that has various imports that require two different versions of solidity. AragonOS(0.4.x) and openzeppelin(0.5.x) Of course, there are breaking changes in 0.5.x so my question is ...
0
votes
1answer
200 views

which wallet is usable with ganache test-rpc?

I tried metamask, but unable to send ether between accounts because metamask is trying to estimate gas and gets stuck :( myetherwallet doesn't save my seed so I need to enter it all the time
0
votes
0answers
14 views

Can't migrate, ropsten randomly throws out of gas

I have the following migration files with 50 contracts' deployment and their setup (calling each other functions like privileges, access and so on): On the development network everything works fine. ...
0
votes
1answer
42 views

Saving a function in a variable in Solidity

I am very new to solidity and stack exchange as well. I am trying to use the date time api from https://github.com/pipermerriam/ethereum-datetime/tree/master/contracts. What getYear(date) does is ...
0
votes
2answers
174 views

Program for interacting with deployed contracts via a GUI?

So I've deployed a contract to Rinkbey using truffle, and now I'd like to play with it. I'd like something that builds a GUI for me from the ABI like EthFiddle does. I just want something that lists ...
0
votes
1answer
273 views

Can I find constructor arguments from truffle artifact?

I'm in the process of verifying my contract on Etherscan. Etherscan asks for ABI-encoded constructor arguments during the verification process, though I was a bit silly and don't quite know what they ...
1
vote
2answers
166 views

How secure is an Oracle?

I am working on oracles. I saw this link - https://kndrck.co/posts/ethereum_oracles_a_simple_guide/ The code works, I tested it. But what is the issue to me, is the code actually secure? Can someone ...
0
votes
1answer
27 views

Zepellin Crowsale buyTokens error

I'm trying to use the buyTokens function of the Zepellin Crowsale interface, but this gives me an error, without any log to be able to debug contract TokenA is MintableToken, PausableToken, ...
0
votes
1answer
311 views

How can i connect external AWS server's truffle in browser?

I have deployed geth, truffle, testrpc whichever needed in live AWS server. All the configurations are working properly. I have initiated 'truffle develop' and 'npm run dev'. Both are working fine. ...
0
votes
0answers
31 views

Truffle how to test with reference to mainnet smart contract - Error: while migrating VM Exception while processing transaction: revert

I would like to run a truffle test on a smart contract that includes a smart contract address deployed on mainnet. However, this results in the following error Error: Error: Error: while migrating ...
0
votes
1answer
31 views

How to solve the error “”before all“ hook: prepare suite:” [closed]

When I tested my contract, I got this error ""before all" hook: prepare suite:" Does anyone know how to solve this error? This is my dependencies. "truffle": "5.0.7", "web3": "1.0.0-beta.46"