Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
46 views

How do I solve this error involving web3 and webpack in my truflle-react box based project?

The project is a truffle-react trufflebox, a bounties creating and solving application. It uses Truffle v5.0.1. This is the home page. Below is the page that displays when you click on the 'Become a ...
0
votes
0answers
148 views

How to call contract method from specific address and private key without Metamask check

Good morning, I need to known how call contract method in javascript from specific address(and relative private key) without the check of Metamask. I explain better. This is an example of js code, ...
0
votes
1answer
237 views

Truffle test scripts - Help Please [duplicate]

I want to know if my syntax is correct not how to catch a revert. the task is: Call bid method from accounts[1] of Auction.sol using auctionInstance and pass itemId=0, count=6 as arguments it("...
0
votes
0answers
19 views

Research Papers related to Mythril, Truffle and ReMix

I have found research papers related to most of the testing tools like Oyente, Gasper, MadMax, Securify and so on but I can't find research papers related to Mythril, Truffle and Remix. Are these ...
0
votes
0answers
208 views

Transferring ether balance from contract balance to winner,not working

here is my Solidity snippet: function deliverPrizes(address payable winner) public onlyOwner{ winner.transfer(address(this).balance); } This is what I wrote on truffle console: dCoders....
0
votes
2answers
229 views

access mapping inside mapping of struct in Solidity ^0.5.0

I have a contract which looks like this: contract a { struct Str { uint256 totalTokens; mapping(address => uint256) playerTokens; } mapping(uint256 => Str) public ...
0
votes
1answer
171 views

How to change the account that is interacting with the deployed smart contract on Ganache? [duplicate]

When I enter truffle console and start interacting with the deployed contract truffle uses the first address, how to change the address for testing ? user@user:~/workspace/smart-contract$ truffle ...
0
votes
0answers
95 views

Truffle-contract cannot find module 'debug'

I'm trying to connect my smart contracts to a frontend app using web3 and the truffle-contract node package. In my client-side javascript file, I am requiring the package as follows: import contract ...
0
votes
0answers
35 views

Member “transfer” not found or not visible after argument-dependent [duplicate]

I am writing ERC721 contract with truffle. I have recently upgrade solc to 0.5.0 due to openzepplin compiler version. Read about the changes to the 0.5.0 version unfortunately I am unable to resolve ...
0
votes
2answers
53 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 ...
0
votes
0answers
527 views

FATAL ERROR: Rebalance Allocation failed - process out of memory

So while running truffle compile for my contracts on AWS Ubuntu server I got the following error: <--- Last few GCs ---> [17055:0x3985730] 11958 ms: Scavenge 511.7 (553.4) -> 506.9 (553.4) ...
0
votes
1answer
324 views

Build failed SyntaxError: Unexpected token: name (length)

I setup truffle unbox react-auth and add few libraries as shown in my package.json below. I have no problem running npm run start but failed to compile npm run build with the following error: ...
0
votes
0answers
162 views

How to `truffle migrate` to private permissioned network?

I am running a private permissioned network and would like to use Truffle v5.0.1 for deployment. I use it according to the documentation: Compile my project with truffle compile so that the ./build ...
0
votes
0answers
108 views

Invalid opcode on estimateGas 'code': -32000

this is my contract : pragma solidity >=0.4.21 <0.6.0; contract CloudProject { uint public nbCandidates = 0; uint public nbBureau = 0; uint public nPartiPouvoir = 0; ...
0
votes
0answers
153 views

Uncaught ReferenceError: TruffleContract is not defined (Truffle Pet Shop)

I'm writing my own application that follows a similar form to the Truffle Pet Shop. I have the following code in my app.js: initContracts: function(){ $.getJSON('Greeter.json', function(data) { ...
0
votes
1answer
352 views

Migrates contract with specific account without hard-code address using truffle and Genache

Block Builders! I am trying to migrate my two smart contracts using truffle and Genache. I would like to specify the deploying accounts existing locally. However, when I try to migrate the contracts I ...
0
votes
1answer
304 views

web3 Uncaught TypeError: Cannot read property 'createBox' of undefined

i'm trying to create simple application by using solidity 5.0.0 , Truffle v5.0.0 and web3 web3@1.0.0-beta.34. but i've gotten Uncaught TypeError: Cannot read property 'createBox' of undefined. ...
0
votes
0answers
81 views

i can't get rid of this error

const HDWalletProvider = require("truffle-hdwallet-provider"); const Web3 = require('web3'); const {interface,bytecode} = require('./compile.js'); const provider = new HDWalletProvider( 'slim ...
0
votes
1answer
32 views

SC Truffle Testing: Domain Object Returned?

Working through some tests in Truffle to become more acquainted with the environment but am running into an issue. What I am trying to do Test a smart contract with, among others, the following ...
0
votes
1answer
209 views

Is there a way to set specific account when using truffle console rinkeby?

When I tested on ganache-cli at local, I could test on 'truffle console development' with some accounts which ganache-cli gave. But at rinkeby, I can't use function_name(argumets, {from: specific ...
0
votes
1answer
122 views

Set up backup from private Ethereum (Ganache) [duplicate]

I have created an ethereum application with Ganache and truffle js. i have installed ganache in a server, and th application work. but when i stop the server i lose the the smart contract that i have ...
0
votes
1answer
234 views

ERC20 token with expiration date

I would like to create a ERC20 token with an expiration date to represent for example a ticket or a gift card. I've created a contract which overrides the open-zeppelin ERC20 contract methods. ...
0
votes
1answer
331 views

Truffle Migrate Error: Could not find built Migrations contract: Unexpected token in JSON at position 0

Running truffle migrate with valid contract code started causing this error for me: Writing artifacts to ./build/contracts Using network 'development'. Error: Could not find built Migrations ...
0
votes
1answer
140 views

Solidity: How are multiple return values returned?

Working in truffle with TDD testing and am getting some errors when evaluating the return values of some functions. If a function is returning multiple values in Solidity, how are they presented? Is ...
0
votes
2answers
67 views

(Truffle) how to call finalize() function after finishing crowdsale

I would like to call token.transferOwnership(msg.sender) after finishing timed crowdsale. So, I inherited FinalizableCrowdsale contract, then override finalization() function to call transferOwnership ...
0
votes
1answer
33 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 ...
0
votes
1answer
37 views

InterfaceImp constract defined success,but interface function called failed

I'm trying to call a interface function for testing, but it can't work. Here is my test contract: pragma solidity ^0.4.24; interface InterfaceTest{ function testInterface() external pure ...
0
votes
3answers
62 views

Truffle wrapper

ExampleContract { address public miner; constructor(){ address miner = msg.sender; } } I am using truffle and ganache-cli and I executed the following command: truffle migrate --...
0
votes
1answer
543 views

Module not found: Can't resolve 'bignumber.js' [duplicate]

I'm using truffle unbox react to bootstrap my dapp. Whenever I run the client end of the application with npm run start, I see that React fails to compile with the following error: Module not found: ...
0
votes
1answer
217 views

“truffle test” says “assert.rejects” is not a function even it is Node 10

As per the official documentation, assert.rejects was added since Node v10.0.0. Also, the node console confirms that: even though, truffle test throws this error: TypeError: assert.rejects is ...
0
votes
1answer
208 views

Truffle migrate code with library, interface and contract

Suppose that I have a token contract as follow. How can i write the new migration.js file in truffle to deploy the contract? TestCoin.sol import "openzeppelin-solidity/contracts/math/SafeMath.sol"; ...
0
votes
1answer
161 views

Truffle develop vs Ganache. Is there a reason to prefer one over the other?

Now that Ganache is usable, I don't see a reason to use truffle develop anymore. Is there still a scenario where the latter is preferred?
0
votes
0answers
468 views

Deploy Contract with truffle on Private Network using Parity

First I followed this demo PoA tutorial to build a private PoA network using Parity. Then I wanted to use truffle to compile and deploy a smart contract. I tested the deployment using ganache test ...
0
votes
0answers
244 views

Deploying a contract from Remix IDE, using from Truffle

As I understand, if I compile a contract via truffle compile to have the Contract.json, and then deploy the contract from Remix IDE to, say, Ropsten, the dapp should work via MetaMask pointed to ...
0
votes
0answers
356 views

Truffle-contract error on deployed contract

Playing around with the gnosis multisig, using truffle-contract to interact with already deployed MultiSigWallet using truffle migrate. Contents of the file I am trying to run: var contract = ...
0
votes
1answer
67 views

Truffle console no compile or init options

While using truffle.cmd console I tried to use the compile option, or even init. These options are not available, so I cannot compile using console. truffle(development)> .help .break Sometimes ...
0
votes
1answer
38 views

Problem watching events without invoke functions in the Smart Contract

I have an event which is sent each time when a contract is deployed. It is launched in the constructor. I have a Dapp where I want to watch this event to send a tx each time that a smart contract is ...
0
votes
2answers
126 views

How to debug mappings of structs in truffle tests

This is my test file: pragma solidity ^0.4.24; import "truffle/Assert.sol"; import "truffle/DeployedAddresses.sol"; import "../contracts/Salaries.sol"; contract TestSalaries { function ...
0
votes
1answer
276 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
76 views

promise chaining in test.js file

it("should throw an exception if you try to buy an article that does not exist", function() { return ChainList.deployed().then(function(instance) { chainListInstance = instance; ...
0
votes
2answers
151 views

Intracting with dapp using frontend truffle petbox

App = { web3Provider: null, contracts: {}, account: '0x0', init: function() { // Load pets. return App.initWeb3(); }, initWeb3: function() { if (typeof web3 !== 'undefined') {...
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 ...
0
votes
0answers
148 views

Setup Parity PoA network compatible with truffle framework deployment mechanizm

The question from the title kind of wraps around the real problem but it is actually what I'm having trouble making work. I'm trying to setup production PoA network so using all the flags made for ...
0
votes
1answer
50 views

How can I persist the chain state of Truffle develop? [duplicate]

Is it possible to persist the chain state of Truffle develop? If my truffle console crash, can I restore the chain state?
0
votes
2answers
530 views

Running solidity-coverage with truffle gives error: can not find 'coverageEnv/migrations'

Running solidity-coverage gives the following error: $npm run coverage ... Writing artifacts to ./build/contracts Launched testrpc on port 8555 Running: node --max-old-space-size=4096 ../...
0
votes
1answer
41 views

Difference between the way methods are called in smart contract

What is the difference between instance.totalSupply() vs instance.methods.totalSupply().call() To my knowledge one is for truffle and the other is for web3. But truffle also uses web3 then why can ...
0
votes
1answer
129 views

How to properly test bytes32 in Javascript testing

How do i address the bytes32 testing issue below? From the code below: coinState = await NewCoin.at(newCoinAddress).getAuthorization(web3.fromAscii("1A2B3C4D5E6F7G8H9I0J")); console.log(coinState);...
0
votes
0answers
56 views

How to register truffle contract with ENS(Ethereum Name Service)?

I am wondering how I can publish my smart contract to ENS via truffle. I think I might need to include a smart contract called ENS.sol, but I am not sure. Is it the same as publishing a package to ...
0
votes
1answer
59 views

Truffle beta Contract.at is supposed to be a promise

I'm trying to test a contract with Truffle beta (because of the new web3 1.0.0 support). When i try to create the contract object by using Contract = artifacts.require("Contract"); contract = ...
0
votes
1answer
122 views

Vyper: Truffle test read mapping value inside struct

I have the following struct inside my vyper file: races: public({ start: timestamp, end: timestamp, racersBetHash: bytes32[address], racersBetAmount: wei_value[address] }[int128]) Then I ...