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
25 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
37 views

What are the tests that can be or should be written for this smart contract? [closed]

I have the following contract for a dutch auction with a specified function to get the price at any given point. // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/...
user avatar
0 votes
0 answers
6 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
11 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
10 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
0 votes
0 answers
16 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
1 answer
12 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
14 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
17 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
0 votes
1 answer
14 views

network error trying to deploy js file using ganache on windows 10 wsl (ubuntu)

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
8 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
1 vote
0 answers
14 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
16 views

How to fix SyntaxError: Unexpected identifier while compiling openzepplin smart contract in parity ethereum

I am trying to compile and deploy ERC20PresetMinterPauser smart contract using parity. it gives me error. SyntaxError: Unexpected identifier same smart contract is works fine with remix. my parity is ...
user avatar
0 votes
0 answers
8 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
20 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
31 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
15 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
0 votes
1 answer
37 views

Storage arrays don't store my input values

I checked other similar topics but I still can't figure out how to solve my problem, the code below is part of my contract, pragma solidity ^0.8.13; contract MyContract{ address owner; ...
user avatar
0 votes
0 answers
8 views

Change default signer for transactions

This is an incredibly noob question, but suppose my truffle config file has 5 private keys in its configuration. Then suppose I have a script.js that calls functions like await usdc.approve(router....
user avatar
  • 1
0 votes
3 answers
46 views

Pushing a contract to an array in another contract

I am new to Solidity, and I have a small problem. For exemple I have these 2 contracts contract Dog { string name; constructor(string _name){ name = _name; } } contract Human { ...
user avatar
  • 3
0 votes
1 answer
21 views

Avoid "out of gas" when calling a view function using truffle

I have a rather computationally expensive view function on my smart contract, which works with no problem on rinkeby (calling it from etherscan). However, deploying the contract into a local chain (on ...
user avatar
  • 101
0 votes
0 answers
17 views

I tried a lot in an attempt to fork Mainnet but I am getting this CodedError: connection not open on send()

I am using ethers.js and truffle, while running truffle migrate, I am getting CodedError: connection not open on send() error This is my truffle-config file module.exports = { networks: { ...
user avatar
0 votes
0 answers
12 views

Fork Safemoon, without reward and tax

I want to fork the safemoon Token: https://github.com/safemoonprotocol/Safemoon.sol/blob/main/Safemoon.sol with few modifying functions. First of all I only want a fee for the liquidity pool. I want ...
user avatar
0 votes
0 answers
19 views

Truffle test not running completely

I am a beginner in Solidity and truffle. Trying to create something from scratch so I am not using anything from openzeppelin. I created an ERC20 token smart contract and created a second smart ...
user avatar
1 vote
1 answer
37 views

RPC Error 32603 when deploy new Contract

Im trying to deploy ERC20 contract through web3. Token Code (OpenZeppelin): // SPDX-License-Identifier: MIT pragma solidity ^0.8.14; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; ...
user avatar
  • 11
0 votes
0 answers
30 views

Problem with funds and incrementing counter

I am writing this app using Truffle and Ganache suite and I am having trouble with a certain transaction. Solidity ver is 0.8.3. I am using metamask to connect the wallet and importing contacts from ...
user avatar
0 votes
0 answers
27 views

Can not deploy my contract on ganache-cli using ETH mainnet fork

I used ganache-cli in combination with my Infura key to fork ETH mainnet so I could use the Uniswap router in my development environment: ganache-cli --fork https://mainnet.infura.io/v3/<mykeyhere&...
user avatar
0 votes
1 answer
19 views

Truffle - Invalid number of parameters for "undefined". Got 0 expected 2!

I have the below js script to deploy my contract to the Ropsten test network. I am using @truffle/hdwallet-provider v2.0.8 and web3.js v1.7.3. const HDWalletProvider = require('@truffle/hdwallet-...
user avatar
0 votes
1 answer
30 views

Error Installing Truffle in VS Code?

I'm trying to install truffle on VS Code(in window 10) after installing node.js, npm and ganache. All the above three have been installed and worked but When I tried to install truffle in VS Code in ...
user avatar
0 votes
0 answers
14 views

why vs code not recognizing the node version

when I install a "truffle for vs code" extension in vs code and try to create a new solidity project then nodejs version is not recognized but I have installed nodejs's correct version.
user avatar
  • 1
0 votes
1 answer
23 views

VM Exception while processing transaction: revert — Transferring ether from EOA to contract account

Problem summary I get the following error whenever I try transferring ether from an EOA(externally owned account) to a contract account in one of my functions as seen below. I am currently using the ...
user avatar
  • 105
0 votes
0 answers
42 views

Ganache Error - VM Exception while processing transaction

I have installed the following packages: Truffle v5.5.5 (core: 5.5.5) Ganache v^7.0.3 Solidity v0.5.16 (solc-js) Node v16.15.0 Web3.js v1.5.3 Ubuntu 20.4 When executing my transaction the following: ...
user avatar
  • 120
1 vote
1 answer
14 views

How to switch between accounts to check Approve functionality on truffle CLI

I am cloning myself of the Openzeppline for my own NFT marketplace. Mint, enumeration, transferFrom, approve functionalities have been implemented but I have no idea of testing approve functionality ...
user avatar
0 votes
0 answers
10 views

Truffle init Problem

I am getting the following error while doing truffle init. C:\Users\ok\AppData\Roaming\nvm\v8.9.0\node_modules\truffle\build\231.bundled.js:54129 } catch { ^ SyntaxError: Unexpected token {...
user avatar
0 votes
0 answers
9 views

Should I use truffle for compiling and deploying my contracts or writing my own compiling script and deploying script?

I'm working on my cli project and in this cli project i need to compile 15 different smart contract and deploying to multiple blockchains for user inputs. I'm using golang for creating this project ...
user avatar
0 votes
0 answers
30 views

view functions error : Returned values aren't valid, did it run Out of Gas?

I'm calling the methods in the deployed smart contracts in Ganache. Other methods are working fine, but the view functions returns an error. Here's the view function in Solidity: mapping (address =>...
user avatar
0 votes
1 answer
20 views

Hi,I had written the code for voting purpose.Can you guys help me out to write a truffle testing code for this?

// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; contract voting{ address private onlyowner; uint private Virat =0; uint private Rohit =0; constructor(){ onlyowner = msg.sender; } ...
user avatar
  • 11
0 votes
0 answers
42 views

EscrowUpgradeable triggers "Ownable: caller is not the owner."

I am newbie and am on Truffle/Openzeppelin stack. I am following the example/tutorial for Using Escrow Library at https://medium.com/@ethdapp/using-the-openzeppelin-escrow-library-6384f22caa99 and all ...
user avatar
0 votes
0 answers
38 views

Uncaught (in promise) TypeError: myFunction.watch is not a function

I'm trying to develop my first DAPP based on this tutorial (https://livebook.manning.com/book/building-ethereum-dapps/chapter-12/) and I'm encountering some errors in the javascript part. In ...
user avatar
0 votes
1 answer
51 views

Truffle Test Console Logging

I'm having some trouble with Truffle logging configuration. During tests, each submitted transaction and its hash is logged on the console and this one becomes full of useless messages that disturb ...
user avatar
0 votes
1 answer
24 views

How to deploy a contract from a different account (using truffle)

I want to use an account different than the default account to deploy a contract. I'm looking for the equivalent of ethers connect() function and I can't seem to find it. Currently deploying like so ...
user avatar
0 votes
0 answers
20 views

Deploy a crowdsale contract for a previously deployed ERC20 token

I have deployed an upgradable ERC20 token using ^0.8.4 and I would like to set up an AllocatedCrowdsale from OpenZeppelin for said token. I have set up a second project for the crowdsale using ^0.5.0 ...
user avatar
0 votes
0 answers
11 views

How to create a external call instance function to truffle suite

Is there a way to instantiate a function of my contract, not using the truffle console but by creating a js file? if so, how do I do it?
user avatar
  • 1
0 votes
0 answers
40 views

Problems with find a compiler version matching 0.8.13 with truffle compile

I'm very lost with this issue. I'm trying to make a dapp but when I run truffle compile I get the error that I post on title. Next I run truffle compile --list and a receive this: $ truffle compile --...
user avatar
0 votes
0 answers
11 views

How can I fix "Stack too deep, try using fewer variables" error?

Every time I try to run this solidity code, I get the Stack Too Deep error. I know what the error means but I do not know how to make it go away. And I also do not know how to transform this code with ...
user avatar
0 votes
0 answers
24 views

Have metamask user pay minting fee, but owner sign transaction. onlyOwner and payable

I want to allow a user to mint an NFT through my React app to a payable function, but I also want to control the URI and Token ID sent to the contract because we use many different folders on IPFS. Is ...
user avatar
  • 101
0 votes
1 answer
28 views

Array length returns 0 even if there are elements in it?

pragma solidity >=0.8.13; contract MyContract { // ...Variables declared here constructor() { // ... Variables initialized here } address[] ...
user avatar
0 votes
1 answer
33 views

Truffle default account private keys

Is there a way in truffle develop tests to access the list of private keys in the same way we can access the list of accounts? Basically, for every contract I need to test, the truffle test contract ...
user avatar
0 votes
1 answer
82 views

Encountered an error while attempting to update latest block (error code 1020 on Polygon mainnet)

I'm trying to migrate a smart contract on Polygon (Matic) mainnet through truffle, but I get the following error: node_modules\@trufflesuite\web3-provider-engine\subproviders\rpc.js:57 const ...
user avatar
0 votes
0 answers
17 views

Why a transaction function that modifies array state variable returns an invalid length (NaN) back in JS?

I want to know why a function I made that .push an element in the array then immediately followed by return the .length would result in a NaN back in JavaScript (truffle test)? Originally, I intended ...
user avatar

1
2 3 4 5
59