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
10 views

Display the value of a smart contract's variable with Truffle External Script

I will like to display the value of a variable in an existing smart contract in Truffle. Here's my script: module.exports = async function(callback) { const project = artifacts.require("project"); ...
1
vote
2answers
185 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 ...
1
vote
1answer
14 views

How to use solidity library with truffle

I'm using truffle V5.1.13 and when I run truffle test the res variable contains a transaction receipt rather than the expected 2. I notice if I remove everything that has to do with the library things ...
0
votes
1answer
126 views

A contract works in remix but not when used with truffle

Below is the contract: uint32 firstTimeUserPoints=10; struct struUser{ string orginalName; string originalKshoplink; string orginalDocumentConvention; bool ...
1
vote
1answer
25 views

Watching events with truffle test

Given following solidity code: pragma solidity ^0.5.1; contract Foo { event FooInc(uint256 _a); uint256 a; constructor() public { a = 42; } function inc() public ...
0
votes
1answer
60 views

When closing node (geth ropsten) I cannot save created accounts

I am pretty new to this. I downloaded the ropsten blockchain using a geth command line. Then, using Truffle, I created an account, but when I closed my node (ctrl - c on the geth command line) and ...
1
vote
1answer
100 views

Transaction cost in a truffle test

I've a contract under test and the method I'm checking is supposed to transfer an amount, and in order to check I need to have the cost of the transaction. I'm using this code: var tx = await ...
1
vote
3answers
127 views

Reading the result of a function that change state by using events in Solidity

I would like to get the result of a function by listening its emitted event. These are two pieces of code of my contrats CONTRACT 1: function createTradeableContract() public stopInEmergency ...
1
vote
2answers
93 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
2answers
28 views

Can change mapping storage?

I am beginner in mapping.I work on Truffle and Ganache. I deploy the following contract: pragma solidity ^0.5.12; contract customerFinder{ mapping(uint256 => address payable) public ...
0
votes
1answer
21 views

Truffle command not found [closed]

Hello, I am facing a problem with installing truffle. what shall I do? Thank you.
2
votes
1answer
253 views

Geth Sync Problems | Rinkeby, Ropsten | Deploy contracts

Get Geth to sync --> Rinkeby test network. For the love of god I just want to deploy a contract. I have deployed it to Ganache-cli, GUI, remixIDE, deployed with truffle/Infuria.io...I keep failing to ...
3
votes
4answers
3k views

Truffle Error- VM Exception while processing transaction: revert

I create a smart contract to sell my token.I am following the Dapp University(youtube channel) course. I have done unit testing of smart contract.All test cases pass. And I am trying to buy token ...
1
vote
2answers
484 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' ------...
0
votes
1answer
23 views

Convert big number to regular number [duplicate]

I call let inst = contract.deployed() and then on inst I can then call mybn = units.then(function(inst) {return inst.getBN()} mybn looks like this BN { negative: 0, words: [ 1, <1 empty item&...
0
votes
1answer
116 views

Transaction reverted when testing requires/asserts in non void functions

im trying to test the requires of a Smart Contract using just solidity according to this article: http://truffleframework.com/tutorials/testing-for-throws-in-solidity-tests This is the contract, the ...
0
votes
0answers
33 views

Error: project ID is required

I have a truffle project which was running on another machine without problem. But now I'm trying to npm install and I'm getting this error: >truffle install Error: project ID is required at ...
0
votes
1answer
82 views

Can't use token variable's method at contract that inherit zeppelin crowdsale?

Calling the method of Crowdsale's "token" on the source that inherited Crowdsale of zeppelin v1.8.0 inevitably causes "out of gas". Error: Error: VM Exception while executing eth_call: out of gas ...
0
votes
0answers
14 views

I got the error when I do 'truffle test' in Truffle tutorial that pet-shop-tutorial

I'm doing truffle tutorial the pet-shop-tutorial but when I typed truffle test in cmd, I got the error. Here is the error message. I have no idea how I can fix it and where should I check. Please ...
1
vote
1answer
163 views

Unable to read contract instance variable from deployed contract with truffle test

I am attempting to write some unit tests as I'm working on the development of some smart contracts, but I've run into an issue that's preventing me from continuing. I'm attempting to check the address ...
2
votes
3answers
778 views

Deploying smart contract with truffle and infura giving me error

I am having trouble deploying my smart contract to the ropsten network using infura and truffle am getting error that says "var sig = secp256k1.sign(msgHash, privateKey); ^ ...
0
votes
1answer
385 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
69 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
14 views

Truffle develop freezing. Trying to check variable values

truffle-config.js module.exports = { compilers: { solc: { version: "^0.6.0" } }, networks: { development: { host: "127.0.0.1", port: ...
0
votes
1answer
323 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
8 views

Aragon: How to update files after a contract compiles

I need to update certain files (in app/public/) every time when a contract compiles. Namely I need to extract the ABI from a contract and store in app/public/. Is it possible with the current version ...
1
vote
1answer
1k views

How do you call a getter created by solidity?

Apparently, solidity creates getter functions for public variables. How does one call them using javascript? (for testing within truffle)
0
votes
1answer
180 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 ...
0
votes
1answer
249 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
389 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 ...
2
votes
1answer
245 views

Passing one contract instance as an argument to the constructor of another contract

I need to use the functions of the ERC20 contract in another contract. The ERC20 contract is from the openZeppelin contract library. I found the following code on a website: import "../../...
0
votes
3answers
116 views

Error in the truffle init command, quorum

i'm trying to truffle a project but each time it shows me this message, whereas, i'm sure i installed the truffle successfully. vagrant@ubuntu-xenial:~/quorum-examples$ cd project vagrant@ubuntu-...
0
votes
1answer
37 views

Function stopped working? No check is being done now on transfer function

I created a function to deposit and transfer ether and it was working great until i tried to deploy again and now the transfer function is not working anymore No errors are being thrown, the transfer ...
3
votes
1answer
78 views

Non-specific error from truffle debugger

I am testing a contract which is using ecrecover function of solidity. While its testing when i go with a failed test case while debugging, it doesn't go step by step and at the end return the same ...
0
votes
2answers
675 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....
0
votes
1answer
80 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 ...
0
votes
1answer
363 views

Error: Truffle is currently using solc 0.5.8,

i run migrate in the terminalbut it shows Error: Truffle is currently using solc 0.5.8, but one or more of your contracts specify "pragma solidity ^0.4.27". Please update your truffle config or ...
2
votes
2answers
132 views

Truffle interaction with my smart contract getting Vm exception

pragma solidity ^0.4.23; contract Hotelbooking { event Transfer( address indexed _from, address indexed _to, uint256 _value ); mapping(address => uint256) public ...
1
vote
1answer
153 views

How can I configure node when I run truffle test?

How can I get truffle test to execute node with the --abort-on-uncaught-exception option? I'm guessing that I should probably add something in the Truffle's configuration file (truffle.js), but the ...
0
votes
1answer
131 views

Error npm installing consensys diligence takehome bignumber util

``` /sudo npm install Password: Unhandled rejection Error: Command failed: /usr/local/bin/git clone --depth=1 -q -b master https://github.com/debris/bignumber.js.git /Users/quantum/.npm/_cacache/tmp/...
0
votes
1answer
23 views

Importing OpenZeppelin loads all node_modules contracts into Ganache

I install OpenZeppelin's contracts npm install @openzeppelin/contracts Create a contract: pragma solidity ^0.5.0; import "@openzeppelin/contracts/token/ERC20/ERC20Mintable.sol"; contract NewCoin ...
0
votes
1answer
34 views

Getting stuck in truffle testing

I am trying to run a test and I am getting the following message; I have tried the following; npm install scrypt npm install web3 as to solve the yellow message and when running truffle test ...
4
votes
2answers
814 views

Truffle Compile with Solidity 0.5.0

I just upgraded my code to Solidity 0.5 and am trying to use the truffle framework with it. I did update my code in Remix and it does seem to work. The problem I have is that I am unable to compile ...
22
votes
5answers
7k views

Truffle configuration file name - is it 'truffle.js' or 'truffle-config.js'?

Truffle configuration file is mentioned in several places on the web (GitHub, truffle package on npm, solidity-coverage package on npm, etc.). Some refer to it as 'truffle.js, others refer to it as ...
0
votes
0answers
52 views

uncaught error:invalid address

Uncaught (in promise) Error: invalid address at inputAddressFormatter (formatters.js:271) at inputTransactionFormatter (formatters.js:97) at method.js:89 at Array.map (<anonymous>...
0
votes
1answer
14 views

Only 1 .SOL contract file is compiled in truffle project

I am having a very annoying problem but hopefully very simple to solve! I have a truffle project. In my contracts directory I have 2 files: > 1_Migrations.sol > 2_Factoring.SOL When I ...
0
votes
1answer
158 views

why i get a lot of errors when i use truffle?

Seems that i have a lot of lost dependencies for example installing sha3 errors: > node-gyp rebuild C:\Windows\system32\node_modules\sha3>if not defined npm_config_node_gyp (node " C:\Program ...
1
vote
2answers
228 views

How to stop listening to all events of contract

I am using the JavaScript API in my truffle tests to get the events from the contract: https://github.com/ethereum/wiki/wiki/JavaScript-API#contract-allevents const allEvents = instance....
0
votes
2answers
163 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
36 views

Cannot create contract from another contract - truffle and ganache

I'm trying to write a test with ganache and truffle to create a contract instance from another contract. Everything works in Remix but it doesn't in ganache. This is the code const assert = require('...

1 2 3 4 5 41