Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
0
votes
2answers
489 views

“VM Exception while processing transaction: revert” in Truffle test and Truffle dev

this is my problem :) Issue "Error: Returned error: VM Exception while processing transaction: revert" when reaching the Transfer function. I think it is related to the fact that my Crowdsale smart ...
0
votes
0answers
3 views

Unable to connect to polygon mumbai test network using truffle

I'm trying to use Polygon test network with truffle and I followed this document and youtube video to configure Polygon network for truffle. But when I'm trying to execute truffle deploy --network ...
0
votes
1answer
424 views

Comparing msg.value using javascript test always fails

So I have this solidity function: function claimGoodTest(uint256 typeId) public payable { if (msg.value < 4000) revert(); } I test it with the following: var result = await contract....
29
votes
6answers
8k views

how to catch “revert” error in truffle test javascript?

How can I catch "revert" error in truffle test written in javascript? Error: VM Exception while processing transaction: revert Here is part of test contract, function doRevert() public { ...
0
votes
1answer
554 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
7 views

Swap ETH to WBTC or other alt coin

I am trying to create a smart contract for a gmae that is, If anyone send ETH to it's address, it divide the ETH value into two equal value and send equivalent WBTC of firs part to an address and ...
6
votes
5answers
6k views

Error : Could not connect to your Ethereum client with the following parameters:

Im creating my dapp with following below tutorial. http://www.dappuniversity.com/articles/the-ultimate-ethereum-dapp-tutorial however Im facing an error when I run truffle console it shows >...
1
vote
1answer
368 views

I tried to deploy a contract on Ropsten, but always get the following error

PS D:\nodejs\rff\metacoin> truffle --network ropsten migrate Using network 'ropsten'. Running migration: 1_initial_migration.js Deploying Migrations... Error encountered, bailing. Network state ...
2
votes
1answer
294 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.?
0
votes
0answers
16 views

Hyperledger caliper with local ethereum network

i am trying to use caliper with ethereum. i have deployed my contract using truffle. i am trying to run caliper locally. i am getting this error pls help. caliper launch manager --caliper-workspace . -...
2
votes
1answer
305 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
1answer
172 views

How to solve eth_getFilterChanges looping when deploying with truffle (parity)?

I am using truffle migrate and I get some kind of loop which just endlessly prints out eth_getFilterChanges. How can this be solved? I have used this truffle.js module.exports = { networks: { ...
1
vote
1answer
258 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
0answers
347 views

Fail with error 'UniswapV2Router: EXPIRED'

I forked UniswapV2's factory and router and deployed them in Kovan using remix I also made sure that I am sending an ETH I also made sure that I approved the tokens But I am getting this error when ...
4
votes
4answers
7k views

How do I get ETH into my testnet Metamask wallet?

After switching to testnet from the dropdown in Metamask, the address used is still my Mainnet address. web3.eth.getAccounts(function(a,b) { Merchant.accounts = b; console.log("Merchant ...
1
vote
1answer
845 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
200 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!
0
votes
0answers
10 views

How do I create a crowdsale smart contract that has maximum buy amount

I wrote a code for a crowdsale smart contract. Code is below: // SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.8.0; contract Context { constructor () internal { } // solhint-...
0
votes
3answers
686 views

Error: HelloWorld has not been deployed to detected network (network/artifact mismatch)

I'm following the steps in this link to create a truffle project. I'm using ganache-cli as the ethereum client. rajkumar@rajkumar: Ethereum$ mkdir helloworld rajkumar@rajkumar: Ethereum$ cd ...
0
votes
1answer
265 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
1answer
25 views

Retrieving the private/ public key with web3js for a specific wallet provided by truffle/hdwallet-provider

I can't find a way to retrieve the private key / public key / public address for a web3 account loaded via a provider. I have tried the web3.eth.accounts command but I am not getting the private key / ...
0
votes
2answers
224 views

How is gas price too low corrected (truffle deploy)?

truffle.js module.exports = { networks: { development: { host: "127.0.0.1", port: 8540, network_id: "*", gas: 4600000, gasPrice: 4000000 // Match any network id } ...
0
votes
1answer
5k 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 ...
0
votes
1answer
291 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/...
0
votes
0answers
9 views

Drizzle react ContractForm's sendargs and hidden parameter fields

I am using the truffle unbox drizzle boiler plate. Below are the versions in my package.json "@drizzle/react-components": "^1.5.1", "@drizzle/react-plugin": "^1.5.1&...
5
votes
1answer
518 views

Truffle test fails to call the base function, wants the override

I have an extended ERC20 contract with ERC827 functions, which are overrides of ERC20 with an extra callback parameter. I have these two pairs of base/override functions: Base: function ...
0
votes
0answers
116 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
8 views

Truffle contract not receiving events after some time

In my nodejs app I'm using truffle to communicate with a ERC721 contract, mainly to receive events. All I'm doing is listening for when a Transfer event happens. But it only works for the first few ...
0
votes
0answers
7 views

Import contracts from Github gives an error: 'Source not found: File import callback not supported"

Can someone help me with this simple thing? Step to reproduce: truffle unbox react SimpleStorage.sol file, add: import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.1/...
0
votes
0answers
5 views

Does pending account nonce affect truffle contract deployments?

I have pending transactions with nonce 0,1,2,3. I am deploying a contract with truffle-cli, with relatively low gas, but enough for it to deploy, successsfully passes truffle's gas checks. But it just ...
0
votes
1answer
131 views

How do I efficiently install truffle and ganache-cli in a docker container?

Say I want to run a container with ganache-cli and truffle globally installed for dev purposes. I have this first attempt Dockerfile FROM node:15-alpine RUN mkdir -p /home/node/app WORKDIR /home/...
0
votes
1answer
123 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 ...
0
votes
0answers
23 views

How to get the liquidity of a pair in pancakeswap or uniswap?

How can I know in pancakeswap or uniswap when a pair is created and how much liquidity is added? At the moment what I have thought is to read the "PairCreated" logs of the Factory contract, ...
2
votes
2answers
164 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 ...
0
votes
2answers
292 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 { ...
0
votes
1answer
42 views

Connecting to Truffle local network through Metamask

After launching Truffle in the "(develop)" view, I've tried to connect to it through Metamask (via the "Custom RPC" option in the "Networks" menu, I've set the URI to &...
0
votes
1answer
162 views

Deploying with Truffle

I deployed a contract through remix and then I run the following code MyContract.deployed() .then(instance => { c = instance; return c.getCreator(); }) .then(result => { ...
0
votes
1answer
20 views

How to use web3 to interact with contract deployed on private network [closed]

I have created a small private network using geth on my local machine and deployed a smart contract on this local private network using remix IDE. I want to be able to connect my nodejs backend to ...
0
votes
2answers
1k 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
11 views

How to configure `truffle test` to fork the main/rinkeby chain as its local chain?

The smart contract I want to unit test instantiates IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D). Obviously this contract does not exist on the local chain that is spawned by truffle ...
0
votes
0answers
7 views

How to test multiple contracts?

I have created a Ethereum dapp that has multiple contracts that access one another and use methods within each other. I would like to create a Javascript test which would emulate a use-case for this ...
0
votes
0answers
22 views

Truffle Test - Uniswap Router - Swap ETH for Token

I am trying to add an test for swapping ETH to Token. However, this works only if I am specifying as Receiver the Owner of the contract. As soon as I am changing the "to" parameter to ...
0
votes
0answers
11 views

Unreachable code

I am having the issue of Unreachable Code. // SPDX-License-Identifier: UNLICENSED pragma solidity >=0.4.24; // Import the library 'Roles' import "./Roles.sol"; // Define a contract '...
0
votes
2answers
253 views

Fund my Ropsten account to deploy my contract

I have a full geth node on my machine and I want to deploy my contract on Ropsten using truffle. How I can fund my coinable account with some ether to deploy my smart contract? I have tried fuusent....
1
vote
1answer
18 views

Openzeppelin test helper with hardhat config and tests

I'm using hardhat and I added a task to manipulate time in the hardhat.config.js file which is working fine. require("@nomiclabs/hardhat-waffle"); require("@nomiclabs/hardhat-truffle5&...
1
vote
1answer
12 views

call method in compiler 0.8

how can i change this for older compiler versions like 0.4.24? (bool success, ) = transaction.to.call{value: transaction.value}(transaction.data); and if you have time please explain to me the call ...
1
vote
1answer
272 views

Error: StartCoinCrowdsale contract constructor expected 5 arguments, received 6

This is my contract code. contract StartCoinCrowdsale is TimedCrowdsale, MintedCrowdsale, CappedCrowdsale, FinalizableCrowdsale { //100000000000 uint256 public constant TOTAL_SHARE = 100; ...
0
votes
1answer
36 views

truffle flattener cannot find part of path

I am trying to flatten a solidity file but I keep getting cannot find part of path error as shown below out-file : Could not find a part of the path 'D:\Blockchain\bullrun\src\contracts\ERC721.sol'. ...
1
vote
1answer
396 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"...
0
votes
1answer
469 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; ...

1
2 3 4 5
51