Questions tagged [truffle]

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

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

Set a gas limit when sending a transaction in a truffle test scenario

I am writing truffle tests for a smartcontract. I have create a truffle project with this command: truffle unbox react I have kept SimpleStorage.sol sample smartcontract. I have add some tests in ...
0
votes
1answer
17 views

Difference between contract.new and contract.deployed functions

I have create a basic truffle project and i am writing automated tests. There is 2 ways to instantiate the smartcontract to test and i want to understand the difference between this 2 ways: const ...
1
vote
1answer
17 views

Limit Ether balance on tests accounts

I have create a truffle project with this command: truffle unbox react I have looked at test/simplestorage.js and add a test: contract("SimpleStorage", accounts => { it("my ...
0
votes
1answer
30 views

Truffle test: could not find local build/contracts

I have create a truffle project with this command: truffle unbox react I have run this commands: npm install @openzeppelin/contracts npm install @openzeppelin/test-helpers npm install @openzeppelin/...
2
votes
1answer
68 views

Why do my truffle tests get much slower as I run more of them?

So I am currently building up a test suite for a project, and I have quite a few tests at this point. I am running into a problem however that truffle seems to run tests later in its execution much ...
1
vote
1answer
28 views

gasless contract deployment with ganache-cli

I have runned ganache-cli with this command: $ ganache-cli --port 8545 --gasLimit 12000000 --accounts 10 --hardfork istanbul --mnemonic test I have create a truffle project with this command: $ ...
1
vote
0answers
9 views

Manage migrations with truffle

Is there a way to manage migrations with truffle ? I mean by migrationa change to a new version of a smartcontract. Let's suppose this smartcontract: contract SimpleStorage { uint storedData; ...
0
votes
0answers
33 views

NPM Packages need fundings

I'm installing some developer tools on Mac to work on some bigger projects but some of the packages need funding. What does that mean and how do I fund them? KALEBS-MacBook-Pro:~ root# npm install ...
0
votes
0answers
28 views

Error message: Cannot read property 'eth' of undefined

<script type="text/javascript"> async function loadWeb3() { if (window.ethereum) { window.web3 = new Web3(window.ethereum); window.ethereum.enable(); } }...
0
votes
2answers
143 views

Can't install Truffle Framework to Mac OS Big Sur

so I checked to see if I had the latest version of nodejs, and it turns out that I do. kalebamarante$ node -v v15.5.0 then I tried installing a version of Truffle and it didn't work ~ kalebamarante$ ...
0
votes
1answer
26 views

selfdestruct: why am I able to execute the function containing selfdestruct(…) twice?

I have created the following contract with a destroy function invoking selfdestruct: pragma solidity >=0.5.0 < 0.7.0; contract Terminate{ function destroy() public { selfdestruct(msg....
0
votes
1answer
59 views

web3.eth.accounts[0] undefined

I am new and I am trying to make my first transaction using geth and truffle. to specify a sender address I type in the truffle console: src = web3.eth.accounts[0] but I get "undefined" if I ...
0
votes
0answers
13 views

chrome is stuck on the old last contract that I deployed

when I deploy a contract (on the local net )with truffle, I can't interact with it on the browser, on the browser I see an old contract that I deployed in the past. when I go to the console and do ...
0
votes
0answers
34 views

transaction receipt not working

I use react and web3 to interact with metamask. Until yesterday every thing was fine. but, today some of the transaction results are not returning. I use this code to load web3 let web3 if (window....
0
votes
0answers
53 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
14 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
21 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 ...
0
votes
1answer
406 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
13 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
21 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
10 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
14 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
97 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
1answer
81 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
0answers
16 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
21 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
72 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
31 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
36 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
23 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
115 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
1answer
40 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
55 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
32 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
21 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
22 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
76 views

Truffle Console: How to print Ether values for the accounts?

I am trying to follow a tutorial available at: medium Just Dev > getBalance = web3.eth.getBalance > balanceInEth = address => web3.fromWei(getBalance(address).toString()) I got errors so I ...
1
vote
1answer
185 views

How to use Chainlink with Truffle/Ganache?

How to use Chainlink with Truffle/Ganache without unboxing a new app? (I have an app already, I don't want to unbox a new one) I'm trying to get the Chainlink price feeds working in local development ...
0
votes
1answer
32 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
19 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 ...
1
vote
1answer
143 views

Solidity Contract Invalid Opcode RPC Errors

I have a pretty straight-forward contract that let's you buy ERC721 Tokens. My issue is that my "buyToken" function works half the time - and fails the other half of the time with the ...
0
votes
0answers
48 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 ...
1
vote
0answers
20 views

Replacing pending deploy tx with truffle

I deployed my contract with default params using truffle migrate --network mainnet --reset the gas was too low and got my tx pending for more than 20 hours already. I wanted to replace the tx with new ...
0
votes
0answers
622 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
116 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
1answer
31 views

How I can do steps in the truffle test?

I'm testing AMM, so I have steps like add liquidity, try to swap remove liquidity etc I can just add it in one it block like this answer suggests contract('amm', (accounts) => { it ("...
0
votes
1answer
14 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
47 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
41 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
37 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 = ...

1 2
3
4 5
49