Questions tagged [truffle]

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

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

Facing an error while running "truffle compile"

I'm facing an error while running truffle compile- Error: Failed to fetch the Solidity compiler from the following locations: https://relay.trufflesuite.com/solc/bin/,https://solc-bin.ethereum.org/bin/...
user avatar
0 votes
1 answer
15 views

contract.methods.payFund is not a function. Unable to call any of my contract function

I am unable to call any function of my contact.............. when I am printing my contract object it shows that all the functions are in the object but unable to call. It is the output when i print ...
user avatar
0 votes
1 answer
7 views

Truffle cannot pass array of addresses as constructor arguments during deployment

I have a standard ERC777 Openzeppelin contract pragma solidity ^0.8.9; import "@openzeppelin/contracts/token/ERC777/ERC777.sol"; import "@openzeppelin/contracts/token/ERC777/IERC777.sol&...
user avatar
  • 1,460
0 votes
2 answers
56 views

Polygon Mumbai Testnet Not Working

I'm trying to deploy a contract to the Polygon Mumbai testnet and transactions just don't get processed, even after more than two days. I've tried setting higher gas amounts. I've also tried both ...
user avatar
0 votes
0 answers
8 views

Unit testing a double mapping

How to call a double mapping in unit tests? Here is an extract of our contrat: contract StackingPool { struct Staker { uint128 amount; // Amount token stake uint256 date; // Date ...
user avatar
  • 1
0 votes
1 answer
17 views

Sha256 Hash from Solidity Smart Contract doesn't match web3.js Hash

I'm struggling to match two hashes. I hash a Json in String format in my Smart Contract like this. function verifyProof(string calldata _fullProof) public returns(bool r){ bytes32 hashed = ...
user avatar
0 votes
1 answer
10 views

why there are differences in web3 when using truffle and when used in the browser?

1- why listening to events in truffle require another library called truffle-assertions, why can't we just use contractInstance.events.EventName() like we do in the browser? if truffle also use web3 ...
user avatar
  • 25
0 votes
0 answers
8 views

Truffle test: Error: expected event argument '_ids' to have value 1 but got 1

I wrote an ERC1155 Nft whith this following function: contract Nft is ERC1155{ using Counters for Counters.Counter; Counters.Counter private id; event MintBatch(address indexed _to, ...
user avatar
0 votes
0 answers
12 views

Error: The method evm_increaseTime does not exist/is not available

While testing a time-dependent smart contract with truffle, I tried to use openzeppelin test-helpers' increaseTo function to forward time. I required the dependency as shown below, const { time } = ...
user avatar
0 votes
0 answers
11 views

How to install Truffle in VS Code

I saw on stack overflow how to install truffle Truffle Installation. But it was on Visual Studio, not on VS Code. I search on Google too for past two weeks (although not be able to find a complete &...
user avatar
0 votes
0 answers
10 views

When to use Signed Transaction on Ethereum

I'm trying to implement ERC721's transferSign function, what i wanna achieve is to let user sign transaction and later that signature can be used by the platform owner to broadcast that transaction ...
user avatar
0 votes
1 answer
35 views

Error: Cannot create instance of <the-contract>; no code at address 0x

I'm using truffle and I want to use USDC token contract to send token to a address but it shows me this error when I run npx truffle migrate Error: Cannot create instance of ERC20Mock; no code at ...
user avatar
0 votes
1 answer
27 views

"Error: Returned error: VM Exception while processing transaction" when I run truffle test

I'm running my unit test with truffle in ganache environment. Here's my Lottery SC: pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@...
user avatar
0 votes
0 answers
10 views

Error: PollingBlockTracker but the contract still deployed through truffle. Now contract wont verify "No instance of contract found for network id 1

I am having an issue with a contract that I used many times to deploy and verify. Today I did a dry run and everything is fine than a mainnet deploy and received the following. -"Error: ...
user avatar
0 votes
2 answers
52 views

Truffle vs Hardhat vs Ethers vs Web3 what to choose for a beginner?

What is the most rewarding road map for a novice blockchain developer especially when having multiple technologies in the blockchain development realm ?
user avatar
0 votes
0 answers
20 views

Pete's Pet Shop error: Contract has not been deployed to detected network (network/artifact mismatch)

I followed Pete's Pet Shop tutorial at website: https://trufflesuite.com/tutorial/ However when I run npm run dev I get this error on the console window. Where did I go wrong? I double checked the ...
user avatar
0 votes
0 answers
17 views

How to run truffle debugger on failing test that reverts

One particular function in my smart contract always runs out of gas and reverts. I am trying to do a debug of my contract source code to figure out where the "gas leak" is, and fix it. I am ...
user avatar
0 votes
0 answers
28 views

How to increase an account nonce on web3js?

i'm running a script using web3js in which one i have my accounts[0] that is running 2 transactions. When i do: await web3.eth.getTransactionCount(accounts[0]) , i receive X (number) as a response. ...
user avatar
0 votes
1 answer
32 views

How to estimate gas of a receive method() in truffle

I know that if my contract has a name() method. I can go to the truffle console and try contractInstance.name.estimateGas() and this will give the estimate gas for that method. but what if have a ...
user avatar
0 votes
0 answers
17 views

usr/local/lib/node_modules/truffle/build/4889.bundled.js:21755 throw new Error("Could not find artifacts for " + import_path + " from any sources"); ^

I'm trying to run https://github.com/dappuniversity/governance However I keep running into this issue when I deploy the contracts I'm running everything out the box without making any changes at all ~...
user avatar
  • 1
0 votes
1 answer
23 views

Error: No events were emitted

I am coding an ICO project. However when trying to make the token purchase I got the following error: Using network 'test'. Compiling your contracts... =========================== > Compiling .\...
user avatar
0 votes
0 answers
28 views

Receiving "Error: Provided address "undefined" is invalid" - Decentragram

I apologize in advance if this is a newbie question. I am very new to coding and am working hard to complete my first project. I am following the Decentragram tutorial from Dappuniversity and getting ...
user avatar
0 votes
0 answers
17 views

Truffle Migrate: Solidity SyntaxError: Unexpected identifier

Here's my initial_migration importing LinkToken and and Oracle libraries to deploy. const Migrations = artifacts.require("Migrations"); const { LinkToken } = require('../node_modules/@...
user avatar
0 votes
0 answers
8 views

Truffle unit testing passes even if Solidity code fails because of require statement

I have a function in my contract code which actually checks for the balance of the msg.sender and the msg.value to work fine. function SetBalance() public payable{ require(msg.value<=msg.sender....
user avatar
0 votes
2 answers
35 views

How can I figure out why the transaction is reverted()

I'm playing Ethernaut level1: // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface Level1 { function withdraw() external; function contribute() external payable; } contract ...
user avatar
  • 169
0 votes
1 answer
16 views

Can't update contract address for a relayed contract

I've created a upgradable contract as suggested here: Upgradeable smart contracts // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract Relay { address public _addr; address public ...
user avatar
  • 169
0 votes
0 answers
21 views

How can I debug evm in VSCode?

Remix has a built-in evm debugger: https://remix-ide.readthedocs.io/en/latest/tutorial_debug.html How can I do that in VSCode? I've installed solidity plugin but it does not seem to support this:
user avatar
  • 169
0 votes
0 answers
13 views

Error when Compiling on truffle: "InternalCompilerError: Solidity assertion failed"

had an odd one popup today and can't find much on it, hoping someone else has had it before! When compiling my contracts I encounter an error: "InternalCompilerError: Solidity assertion failed&...
user avatar
  • 1
0 votes
0 answers
28 views

import path in truffle and solc

Here's my directory structure created by truffle with openzeppelin downloaded . ├── build │   └── contracts ├── contracts │   ├── Migrations.sol │   └── MyContract.sol ├── migrations │   └── ...
user avatar
1 vote
0 answers
9 views

Are there any security concers with using @truffle/hdwallet-provider?

The project I am working on asked if I would remove the usage of @truffle/hdwallet-provider from our project due to security concerns. (One of the previous team members had supposedly concluded it isn'...
user avatar
  • 775
0 votes
2 answers
35 views

How to get default value of String in Solidity?

I have a contract and need to check, if the String-Array inside a Struct is of a mapping is set. I found this answer: What is the zero value for a string? I convert my String to Bytes and check if it'...
user avatar
  • 3
0 votes
0 answers
6 views

Smart Contract interaction with drizzle cacheCall() returning undefined

I have an existing contract and want to integrate drizzle to read data using drizzle cacheCall() I have setup my drizzle options as seen below (saw this method in drizzle doc) const options = { ...
user avatar
  • 11
0 votes
0 answers
13 views

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

I am trying to follow up with this online tutorial but using Ropsten (Ethereum) instead of Fuji (AVAX). Everything went well until I reached this part of truffle migrate --network development. Here is ...
user avatar
0 votes
1 answer
17 views

Truffle Struct Test How To Call

how to call struct properties in truffle test ? for public variables we can use .call() but i cant figure out how to do with struct properties how to access properties of struct ? with any other ...
user avatar
0 votes
1 answer
21 views

truffle test does not run tests when test network is not specified

trying to run a test for my contract, but truffle test is just compiling the contracts and not running anything. my truffle.config does not specify a test network, which should result in truffle ...
user avatar
0 votes
0 answers
34 views

How to solve "payable" from the code and a new error came "RangeError: Maximum call stack size exceeded" on solidity with truffle?

Disclaimer I am very new to coding and trying my hardest to break into this space. However, I am having issues with msg.value. On my version of solidity, I have had a lot of issues msg.value. I am ...
user avatar
0 votes
0 answers
8 views

How to deploy Ethreum Smart Contract on Kava Testnet using kavatools?

suppose I have a contract and want to deploy it on Kava testnet pragma solidity ^0.8.0; contract MessageContract { string message = "Hello World"; function getMessage() public constant ...
user avatar
0 votes
0 answers
17 views

Can you pleaseexplain this smart contract? I understand what it does, but i do't understand the math behind it. How does paidPayouts gets incremented?

//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract Deed { address payable public beneficiary; address public lawyer; uint public earliest; uint public amount; uint ...
user avatar
0 votes
0 answers
11 views

My test doesn't pass but expectation return correct value (truffle)

I have a voting Contract which contains 3 functions , 1 Struct, 1 mapping, 1 modifier and I use Ownable from openzeppelin : struct Voter { bool isRegistered; bool hasVoted; ...
user avatar
  • 11
0 votes
0 answers
30 views

TypeError: contract.methods.mintToken is not a function

I am testing the creation of tokens in ethereum and here's my issue : I have this error TypeError: contract.methods.mintToken is not a function at HTMLButtonElement.mintToken (token.js:51:32) It's ...
user avatar
  • 1
0 votes
2 answers
17 views

How to use truffle-assertions to check if a constructor will revert?

Say I have a contract: contract Reverts{ constructor(param1){ require(param1); } } If param1 is false, the constructor should fail and revert state. truffle-assertions allows me to ...
user avatar
0 votes
0 answers
19 views

Unable solve the error ""Error: Returned error: the method eth_accounts does not exist/is not available" when I run truffle migrate

I created Polygon edge server and When I run truffle migrate I am getting this weird error ->"Error: Returned error: the method eth_accounts does not exist/is not available" when I tried ...
user avatar
0 votes
0 answers
21 views

facing error while compiling truffle in visual studio code

pragma solidity 0.8.4; contract Hellowworld{ function hellow() public pure returns (string memory) { return "hello world"; } } this is the simplest code I am using for ...
user avatar
1 vote
2 answers
77 views

wsl (ubuntu) to Ganache GUI on windows 10 Network Connection Error

Am using wsl(ubuntu) on windows 10. Problem is, am trying to deploy.js file with node, here's the error result --> (" reason: 'could not detect network', code: 'NETWORK_ERROR', event: '...
user avatar
0 votes
0 answers
11 views

Could not find artifacts for " + import_path + " from any sources"

I'm following this tutorial on creating my own nft and I came across this problem. Can someone help me PS C:\Users\caclc\contracts> truffle migrate Compiling your contracts... Everything is up to ...
user avatar
  • 1
2 votes
0 answers
43 views

Uniswap V3 NonfungiblePositionManager mint() using truffle/hardhat reverts without reason string

I want to initialize a new liquidity pool and add initial liquidity using uniswap V3-periphery library, using truffle/hardhat as the dev environment. I set hardhat to fork mainnet using infura. Here ...
user avatar
0 votes
0 answers
12 views

how to access ws connection in nodejs when truffle-config enables websockets

here is my truffle-config.js module.exports = { networks: { development: { host: "127.0.0.1", port: 9545, network_id: "*", websockets: true ...
user avatar
0 votes
1 answer
23 views

How to Call Smart Contract Function After Migrations

In my 2_deploy_contracts.js file, I can successfully migrate all my contracts using the command truffle migrate. My problem is that after migration, I want to call a function from contract D and pass ...
user avatar
  • 117
0 votes
1 answer
106 views

Returned error: VM Exception while processing transaction: revert when i use UniswapV2router functions

I'm using my owned cloned UniswapV2 smart contracts(core+periphery) and deployed them using ganache network, so when i start testing functions, i started with createPair() function located in ...
user avatar
2 votes
1 answer
28 views

Truffle contract factory test with Javascript

Here is my smart contract source code. // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.9; contract CampaignFactory { address[] public deployedCampaigns; function createCampaign(uint ...
user avatar

1
2 3 4 5
59