Questions tagged [truffle]

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

806 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0
votes
0answers
108 views

Lost beween useWeb3ReactCore and getWeb3

I am learning Solidity and DAPPs. I have tried to create a project with truffle, with this command: $ truffle unbox react Here is what i see in generated code: import getWeb3 from "./getWeb3&...
0
votes
0answers
19 views

Truffle does not inject web3 into the test.js files

I get the following error while executing my truffle js files. despite trying to use web3 = new Web3(); or web3Provider = new web3.providers.HttpProvider('http://127.0.0.1:7545'); web3 = new Web3(...
0
votes
1answer
553 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
21 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
29 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... ...
0
votes
0answers
11 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
15 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
221 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
20 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
0answers
24 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> ...
0
votes
0answers
176 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
51 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
0answers
43 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
122 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]...
0
votes
0answers
122 views

Deploying ERC20 Error

I'd like to deploy follow "StandardERC20" token to kovan test net using Truffle. I want to deploy same contract like "https://etherscan.io/address/...
0
votes
2answers
37 views

Issue deploying a contract successfully with Truffle and ganache

Long story short my contract is not passing the deployment test using truffle, mocha, and chai. I ran the code individually in the truffle console and it was returning an address just fine but it won'...
0
votes
0answers
28 views

Wrong contract balance shown by web3.eth.getBalance

I want to test if the balance updates when I send some eths it("the balance matches the price of a person", async function(){ let instance = await People.deployed() await instance....
0
votes
1answer
70 views

Truffle Test AssertionError: error message must contain revert

I can't figure out why this error occurs Here my test js code: var YarockToken = artifacts.require("./YarockToken.sol"); contract('YarockToken', function(accounts) { var tokenInstance; ...
0
votes
0answers
32 views

Getting this error when I run a test on truffle : sets the total supply upon deployment

When I try to run a test from truffle, I got this problem, here my test js code: var YarockToken=artifacts.require("./YarockToken.sol"); contract('YarockToken',function(accounts){ var ...
0
votes
0answers
114 views

Slither not working with Truffle imports

Currently I have a project that needs slither run against it so I pulled down the docker image for slither as specified in the docs here https://hub.docker.com/r/trailofbits/slither/, then I shared ...
0
votes
0answers
2k views

Metamask RPC error -32603… {“error”:“revert”,“program_counter”:6758,“return”:“0x”}

I have a dApp that leverages ERC721 contract which allows users to upload images onto IPFS and transfer them to each other. User A can upload images fine and transfer them fine to User B. Once ...
0
votes
1answer
17 views

Accessing to a contract's public array from javascript

Look at this basic Solidity contract: // SPDX-License-Identifier: MIT pragma solidity 0.6.11; contract MyContract { string[] public tmp; ... function read_tmp() public view returns(string[]...
0
votes
0answers
77 views

AttributeError: type object 'Transaction' has no attribute 'exclude'

When I execute a python script to deploy smart contracts, it throws the following exceptions: Traceback (most recent call last): File "contrCompDeploy.py", line 7, in <module> ...
0
votes
0answers
57 views

Truffle “test” is passing only 1 it(“”) test instead of showing “all 3 tests passed”

MyToken.sol //// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract MyToken is ERC20 { constructor(uint256 ...
0
votes
1answer
141 views

Truffle test deploys everytime a new contract with .deployed()

I want to test some contracts^^ And now Im wondering because like I understand .deployed() should take the contracts from the migration in truffle and dont deploy new ones? My test.js: const one = ...
0
votes
0answers
119 views

“before each” hook error while run truffle test command

I ran truffle test command on my project for testing but I got an error like this: "before each" hook for "1- should be return true Pauser Role for account[0]" why I'm getting ...
0
votes
0answers
22 views

New to blockchain development

hope everyone's doing ok. So I am really interested in blockchain development. My programming experience so far has been C++ and a little bit of Python. I know the basics of Javascript as well. So I ...
0
votes
0answers
14 views

truffle deployer - addess is still there without deploy

First Question: // Stage deploying A before B deployer.deploy(A); deployer.deploy(B); This is found on the truffle website. It says stage deploying A before B. So this must mean that deploying B ...
0
votes
0answers
29 views

TypeError: Library functions must be implemented if declared for solc compiler version ^0.6.0 library implementation

Suppose I have the following code: // SPDX-License-Identifier: MIT pragma solidity >=0.4.21 <0.7.0; library SomeLib { function add(uint256 a, uint256 b) public returns(uint256); } contract ...
0
votes
0answers
20 views

deployment failed

Error: * Deployment Failed * "ERC20TransferLiquidityLock" is an abstract contract or an interface and cannot be deployed. Import abstractions into the '.sol' file that uses them instead of ...
0
votes
1answer
62 views

problem with the truffle develop command

I am trying to use the "truffle develop" command but it does not work. I get this error message below. It seems to say there is a problem in the truffle-config file but there is no error. Do ...
0
votes
3answers
25 views

How to get token address inside a crowdsale contract, if you create separate migration files?

To expand on the question, I have created an erc20 token contract, & a crowdsale contract. For each file, I intend to create separate migration files. How can i get the token address for reference ...
0
votes
1answer
159 views

TypeError: value.forEach is not a function when calling a function

I am using Truffle to deploy a contract on Ganache and retrieve the contract in an express app. While I can get the contract instance and it can console.log a list of function object, the function ...
0
votes
0answers
29 views

amount of gas used in receive and fallback functions in truffle tests

I have a contract that is written in solidity ^0.6.4 and has a simple implementation of reverting funds when someone directly transfers some eth or calls an unhandled function. Now it appears to be ...
0
votes
0answers
266 views

How to Load JSON Build of Solidity Contract into Javascipt

I'm thinking there's gotta be a way to load the abi (or the entire JSON build file) of a smart contract into my front-end Javascript app after compilation automatically - meaning via some kind of ...
0
votes
1answer
48 views

How to call a function in a smart contract from Truffle (or anywhere else)?

PSA: I'm new to Solidity/Truffle and I'm hoping you guys won't be too harsh on me I'm trying to figure out how call a function that only the smart contract owner can call. The reason why I want to do ...
0
votes
0answers
40 views

Not Able to create 1 ERC 20 tokens with 18 decimals of my own using code provided from open zeppelin truffle

I am trying to create my own ERC 20 token but I ran some issue with openzepelin code. Here is the code var SampleToken = artifacts.require("SampleToken"); module.exports = function(deployer)...
0
votes
0answers
149 views

Truffle returns no code at address after contract update

etherjs (5.0) is used to deployed a smart contract Hello.sol. Here is the js code (truffle 5.1.52/ganache CLI 6.12.1): import { ContractFactory, ethers } from "ethers"; let privateKey = ...
0
votes
0answers
116 views

Slither Error: Invalid compilation: Solidity version not found ['']

I work with Truffle Fluidity to get an analysis on my contract. My contract is in contracts file that Truffle determines that. I preformed all steps that Truffle mentioned in document. I work with ...
0
votes
0answers
34 views

Error: Contract not deployed after cloning private geth network from one server to another

Steps to reproduce: Private geth network is running on server1. Deploy contract using truffle and make a few transactions. Stop geth n/w of server1 and copy its entire directory (accounts.txt, boot....
0
votes
0answers
50 views

uncaughtException : RangeError: Maximum call stack size exceeded

Facing an issue while working multi-http-provider. When I write var Web3 = require('web3'); require('multi-http-provider'); It throws an error uncaughtException : RangeError: Maximum call stack size ...
0
votes
0answers
66 views

Error parsing @openzeppelin/upgrades/contracts/upgradeability/ProxyFactory.sol

The @openZeppelin's ProxyFactory.sol("@openzeppelin/upgrades": "^2.8.0",/"truffle": "^5.1.51") is used in development of proxy contract: pragma solidity ^0.7.0; ...
0
votes
0answers
124 views

Solidity - Setting the length of an EnumerableSet UintSet

Is it possible to pre-set the length of the set of an EnumerableSet.UintSet type? For instance, if I declare this mapping: mapping (address => EnumerableSet.UintSet) private agentTickets; and then ...
0
votes
0answers
753 views

Using Webpack getting the error 'Uncaught Error: Module parse failed: Unexpected token (32:44)

Here is the complete error Uncaught Error: Module parse failed: Unexpected token (32:44) You may need an appropriate loader to handle this file type. | if(typeof window.web3 !== 'undefined') { | ...
0
votes
0answers
38 views

Empty Address when using Truffle Debug

I currently have a local chain with Ganache. Say I have two contracts written in Solidity: Foo_v0_0_1.sol Bar_v0_0_1.sol In the code for my smart contract Foo_v0_0_1, I have the following: import &...
0
votes
0answers
304 views

Uncaught (in promise) TypeError: Cannot read property 'deployed' of undefined

I am working on a truffle dapp project. Other than init(), initWeb3(), and initContract(), I have been doing fine interacting with my contracts in several JavaScript functions, until I created my 9th ...
0
votes
0answers
34 views

How to work around warnings of infinite gas requirements for this function

This is the warning Gas costs: Gas requirement of function SimpleStorage.data is infinite: If the gas requirement of a function is higher than the block gas limit, it cannot be executed. Please avoid ...
0
votes
0answers
12 views

Does the Bytecode and ABI generated for each contract also include it's imports?

If not, how does a contract such as an ERC20 get deployed if each output has its own ABI and Binary file? When compiling with truffle, and looking at A.json (where A imports B and C) it seems that it ...
0
votes
0answers
26 views

Why does this function work in truffle tests and fail through metamask?

I have the following function and it has been working perfectly in truffle tests as I was developing the smart contracts and now that I am implementing it in the front end I have been getting a error ...
0
votes
0answers
64 views

How can I get intellisense to work when writing javascript tests in truffle?

Truffle injects a global web3 instance into your tests and also seems to set up some mocha functions in the global scope (contract, describe and it). When I open the test file for a truffle project in ...

1
8 9
10
11 12
17