Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
2
votes
1answer
55 views

Ganache-cli Fork unlocked account to make transactions

I'm trying to use ganache-cli on a fork of the Main Network. I use the following command to start ganache. ganache-cli --fork https://mainnet.infura.io/v3/MY_API_KEY -- unlock ...
1
vote
1answer
968 views

Can't connect to local rinkeby node from web3.js

I'm developing a Dapp using truffle and I need to connect to a contract that I uploaded on rinkeby using truffle migrate --network rinkeby. Problem is that I'm unable to connect to the rinkeby network ...
0
votes
1answer
275 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
1answer
16 views

Web3 promise stuck on pending on forked mainnet

I am trying to run a method and the return is stuck on promise pending, if i have to do await it still stuck waiting for return. I have no idea why this happen, i log the value of localWeb3 and it ...
2
votes
1answer
84 views

Truffle test: how to get the block number of deployed contract?

In my test I would like to get the block or block number of when the contract was deployed. const instance = await MyContract.deployed() const contractDeploymentBlockNumber = await instance.?
1
vote
1answer
678 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
16 views

Truffle migrate shows an error on open zeppelin ERC721

I'm very new to truffle and solidity it might be a rookie mistake. When typing truffle migrate --reset, I've got the follow errors : @openzeppelin/contracts/introspection/ERC165.sol:24:5: Warning: ...
0
votes
0answers
11 views

trying to send some tokens from unlocked account

So I'm trying to send some tokens from an, with ganache-cli unlocked, address to mine to try something out, however for my code to work I need some starting amount of the initial token. Is there some ...
0
votes
0answers
7 views

Default Javascript syntax with truffle

I have created a new truffle project with this command in an empty directory: $ truffle unbox react Here is an extract of client/src/App.js: import React, { Component } from "react"; import ...
0
votes
0answers
4 views

unboxing truffle error

Error: Truffle Box at URL https://github.com/truffle-box/kamaix-box doesn't exist. If you believe this is an error, please contact Truffle support. at Request._callback (/usr/local/lib/node_modules/...
1
vote
1answer
772 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 ...
1
vote
1answer
1k views

truffle migrate hanging on Deploying Migrations

I am deploying a contract on Ropsten Network,These are my settings 2_deploy_contracts.js var SafeMath = artifacts.require("./SafeMath.sol"); var TahaCoin = artifacts.require("./TahaCoin.sol"); var ...
0
votes
1answer
146 views

I have written a javascript code for compiling the solidity code but it's showing error

I was trying to compile my contract using solc compiler but it returning me some errors. I will place my solidity code along with the error that I am getting here. Please help me out to sort this ...
0
votes
0answers
12 views

truffle console: Can't execute function i.e., TypeError: SimpleContract.at(…).getName is not a function

I am trying to familiarize with 'truffle console' by doing the tutorial at: https://medium.com/oli-systems/test-driven-solidity-with-truffle-e4beaa2bd194 $truffle migrate Compiling your contracts... ...
2
votes
2answers
1k 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
0answers
7 views

How can I modify inputs in truffle drizzle?

I have a set method in my contract with one address as input (address of tokens). I am using drizzle for UI, but when I use ContractForm, it will automatically generates a textbox for my input(address)...
0
votes
0answers
25 views

Swaping ETH to DAI on Uniswap

I don't get why when trying to deploy my contract it says that gas estimation errored. Forked Mainnet with ganache-cli -f <INFURA_ID> Trying to deploy and execute following code: pragma solidity ...
0
votes
0answers
10 views

Token not visible under “Tokens” on Etherscan

I have deployed an erc20 token contract to rinkeby, ropsten using truffle. Each time the contract is deployed properly. However, the token details are not visible under 'tokens' in etherscan. Please ...
0
votes
1answer
42 views

Smart contract transaction takes different amounts of gas on different platforms

I have an ERC-20 token contract on which I want to perform some testing on a local chain. I got my chain setup, contract deployment and testing scripts ready on my Windows machine. However, since I ...
0
votes
0answers
14 views

SushiSwap Fork reverting at createPair()

I have forked sushiswap recently from the repo. I am getting the following error when calling createPair() from UniswapV2Factory.sol during my deployment, the code has not been touched and I have no ...
0
votes
2answers
955 views

How to test contract with multiple accounts / addresses in truffle?

I want to test my truffle contract with multiple msg.sender addresses. Like "the first user sell token, the second user buys this token". For one address I simply write something like contract.buy....
0
votes
2answers
1k views

Truffle Deployment Error: Invalid number of parameters for “undefined”. Got 1 expected 0!

I am trying to deploy my smart contract. When I run truffle compile everything works however when I run truffle migrate, I get this occurring error message: Error: * Deployment Failed * "KJToken&...
0
votes
3answers
407 views

Truffle compile command stuck at “Compiling your contracts…”

I developed a dapp using my PC (OS: Pop_OS!) and it was running fine. Then I had to format PC and installed new OS (Ubuntu 18.04 LTS), due to some issues in compatibility and performance.After that, I ...
0
votes
1answer
115 views

Windows: command “npm install drizzle” give me an ERR!

npm WARN deprecated fs-promise@2.0.3: Use mz or fs-extra^3.0 with Promise Support npm WARN deprecated tar.gz@1.0.7: ⚠️ WARNING ⚠️ `tar.gz module has been deprecated and your application is ...
0
votes
2answers
141 views

Do I have to create a custom ERC20 to test transfers in Truffle?

I have a smart contract that escrows and transfers a specific ERC20 token to and from users (with their approval). I'm a bit confused as to how to test transfers of existing tokens. Do I have to copy+...
3
votes
3answers
795 views

writing tests in solidity for functions returning multiple values

I have a function that returns multiple values function getInfo(string id) returns(string x,string y){ bytes32 _id= strToBytes(id); return (infostruct[_id].x,infostruct[_id].y) ; } Now i want ...
0
votes
1answer
65 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
490 views

Truffle compiling error

I having the error below when I tried compile the contract. Should I downgrade the truffle version? If yes, which version because I couldn't find the appropriate version for sol 0.4.18. Thanks ...
1
vote
1answer
723 views

Out of gas on truffle test

I am following the tutorial on http://truffleframework.com/tutorials/pet-shop I am using Ganache for testing, where i am also deploying the tutorial contract. 1) TestAdoption "before all" hook: ...
3
votes
2answers
1k views

Invalid address error

I keep getting Error: Invalid address when trying to run the application. My current setup of web3 using infura node is if (typeof web3 !== 'undefined') { web3 = new Web3(web3.currentProvider); } ...
0
votes
1answer
3k views

invalid address error on running code - solidity

Here is my code : var Web3 = require('web3'); var fs = require("fs"); var Artifactor = require("truffle-artifactor"); var provider = new Web3.providers.HttpProvider("http://localhost:8545"); var ...
0
votes
0answers
13 views

A error: Use “truffle” to deploy the smart contract to testrpc

The version used is as follows: Truffle v5.1.61 (core: 5.1.61) Solidity v0.5.16 (solc-js) Node v14.15.4 Web3.js v1.2.9 EthereumJS TestRPC v6.0.3 Before "truffle migrate", I modified the &...
0
votes
1answer
30 views

I have a truffle version problem. and I've done it but it's not working

I've done npm install -g solc@0.4.16 and it reads solc@0.5.16 when doing the truffle version compilers: { solc: { version: "^0.4.26", // A version or constraint - Ex. "^0.5....
0
votes
1answer
459 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 ...
0
votes
1answer
89 views

truffle won't run tests while initializing a global contract instance

I am testing my smart contract in truffle. I need to declare some global variables hence I did so outside 'it'. I also tried declaring a global contract instance that I can use in all test cases. ...
0
votes
1answer
696 views

How to deploy a contract to parity using truffle?

I get this when trying to deploy to parity - Writing artifacts to ./build/contracts Invalid JSON RPC response: "Provided Host header is not whitelisted.\n" I am new to using truffle with ...
0
votes
1answer
37 views

Problem while compiling a solidity contract with truffle

Each time that I compile a contract with truffle I get this error: (cmd) # Compiling your contracts... > Compiling .\contracts\HW.sol Error executing vyper: 'vyper' is not recognized as an internal ...
0
votes
0answers
13 views

Display the user object array in react app using drizzle

I have been trying to do a simple use case where we return all the user details please find my code myComponent.js <div className="section"> <h2>JurStatus</h2> ...
1
vote
1answer
112 views

Truffle config not matching web3 infos

At truffle.js I set the account to the third ganache's account Then I run truffle console and coinbase was set to the first account and defaultAccount to undefined. Not only that, I've tried to ...
0
votes
1answer
30 views

Error: Could not find artifacts for Migrations from any sources

I was trying to deploy my contracts to Ropsten testnet. But in the process, my Dapp suddenly stopped working even on Ganache. When I now try to "truffle migrate --reset," I get the message &...
0
votes
0answers
19 views

When forking MainNet with ganache-cli and trying to interact with contract -> error thrown

Forked MainNet with Ganache-ClI wrote script to interact with on-chain DAI contract to send some Dai to account Unlocked the DAI contract const Web3 = require('web3'); const daiAbi = require('/Users/...
0
votes
0answers
15 views

Truffle test doesn't recognize estimateGas function

I'm trying to test my contracts using Truffle and Ganache, but I'm facing some problems with some functions. When I call a non view function, I'm getting the error "out of gas". Moreover, if ...
0
votes
1answer
475 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....
0
votes
0answers
24 views

Trying to work with ganche-cli, truffle and infura

When trying to migrate a truffle-config.js file following error appears. TypeError: Cannot read property 'fromMasterSeed' of undefined any help would be much appreciated. const HDWalletProvider = ...
0
votes
1answer
417 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 ...
0
votes
1answer
74 views

Unable to filter events with specific values of indexed parameters

I am currently trying to test a smart contract using the truffle suit ( with 'truffle test'). My contract is of a simple ERC20 token which includes the standard Transfer event: event Transfer(address ...
0
votes
1answer
16 views

mapping not updated

I'm testing a very primitive contract using mapping. contract PhysicalContract { uint numContracts; mapping (address => uint) contracts_test; function newDeal(address adr, ...
0
votes
1answer
31 views

Declare an string array inside a int array in Solidity

I am using truffle and I am trying to pass during the deployment execution script a double array of prices inside my contract's constructor. ie In the migration file I have a 2 dimensional array. It's ...
0
votes
1answer
2k views

html:82 Uncaught ReferenceError: App is not defined at HTMLButtonElement.onclick (html:82)

It's showing me uncaught reference error in my index.html file <div id="candidate-box"></div> <button class="btn btn-primary" onclick="App.vote()">Vote</button> ...
0
votes
0answers
27 views

Cannot Deploy to Rinkeby using Truffle, Infura, and Node

I am trying to deploy a contract to Rinkeby using Node and Truffle but I get a lengthy error: Truncated Error: Attempting to deploy from account 'MYACCOUNT#' [object Object] [object Object]...

1
2 3 4 5
47