Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
8 views

Assertion Error

Solidity file pragma solidity ^0.5.0; contract Todo { struct User { uint id; string name; } User[] public users; uint public nextId = 1; function create(string memory name) public ...
0
votes
0answers
11 views

I can't call my functions in the components which I can improve to make web3 work correctly?

I'm having a problem with components, I'm using truffle unbox / react, I created a BuyForm.js component that will be the purchase form but I have problems trying to make the purchase I'm not able to ...
0
votes
0answers
5 views

Truffle not working after install using npm

I just tried to install truffle using npm. I followed the documentation and did npm -g install truffle However, after that, when I try to do anything (such as just run truffle or truffle --version), I ...
0
votes
0answers
23 views

Why does this contract cost 1 Eth to deploy?

Truffle is telling me that it costs 1 Eth to deploy. Is that seriously the cost of deploying a simple contract (this is my first Mainnet deploy)? Or is there something else going on? mainnet: { ...
0
votes
1answer
27 views

Truffle config gas price confusion

I'm doing a dry run of a mainnet to get the total gas cost/ Replacing 'Migrations' > Total cost: 0.000343902 ETH Replacing 'EthText' > Total cost: 0.001205478 ETH Summary =====...
0
votes
0answers
24 views

Why With Truffle, token is not verified in bsc test network?

As seen on the screen, I did the build process, but the verification process fails. I got the API key, I entered but it is not working Where am I making a mistake? address: https://testnet.bscscan.com/...
0
votes
1answer
24 views

Uncaught (in promise) TypeError: work.methods.workCount is not a function

Describe the bug I am trying to call the public variable "workCount" from a smart contract using web3 Steps to reproduce: const work = new web3.eth.Contract(ABI,Address) const workCount = ...
0
votes
0answers
72 views
+50

Do call methods cost money?

I've been developing a smart contract on Kovan with no issue. I've deployed to Mainnet and the call methods (with 'external view') are returning insufficient funds for gas errors. I thought that call ...
0
votes
0answers
25 views

Issue sending ETH to smart contract with web3js/metamask

So I have a simple smart contract (shown below). // SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; contract Casino { function pay() external payable{ } ...
0
votes
1answer
21 views

“Truffle Networks” spits out error and can't migrate to Mainnet

I'm trying to deploy to Mainnet (for the first time) but the initial migration (1_initial_migration) is getting stuck. Deploying to Kovan works fine and is super fast. I have enough Eth to deploy to ...
0
votes
1answer
39 views

Calling web3.eth.getAccounts() does nothing - no errors

I am trying to get all accounts using web3@1.3.3 and @truffle/hdwallet-provider@1.2.2. I am using HDWalletProvider with Infura. I am running this code on backend (Node.js v14.15.5). This is the code ...
0
votes
1answer
28 views

Solidity version mismatch

My smart contract has pragma solidity 0.4.18; According to Solidity: Best practices - Which compiler version should I use? Advantages / Disadvantages, this pragma will work on any compiler from 0.4.18 ...
0
votes
1answer
16 views

Do contracts deploy their imported dependency contracts? Or do they point to live, already deployed versions?

This is a very newbie question about deploying contracts with imported dependencies. I'm using Chainlink's AggregatorV3Interface and SafeMath from openzeppelin. import "@chainlink/contracts/src/...
0
votes
0answers
31 views

Estimate the cost of gas in Truffle Console?

Is there a way in the Truffle console to estimate the cost of gas for deploying a contract to mainnet? I'm attempting to truffle migrate --network main a contract, and it's running out of gas. I've ...
0
votes
0answers
32 views

Migration 2_deploycontract invalid or does not take any parameters

I am trying to create this token and for some reason, the second migration keeps giving me this Migration 2_deploycontracts.js invalid or does not take in any parameters 1_initial_migrations.js seems ...
0
votes
0answers
9 views

How to use promises with drizzle/vue-plugin

I'm trying to implement a blockchain based app. I'm using Drizzle Vue plugin to interact with the methods in smart contracts. However, I stumbled across the following issue. After executing the ...
0
votes
0answers
8 views

Truffle Pet Shop Example:

I am working through the pet shop tutorial in the Truffle Suite documentation and am hitting a error and have been looking at it for a while. What is it that actually produces the DeployedAddresses....
1
vote
1answer
11 views

Call an existing contract function from truffle console

Let's suppose an existing Ethereum deployed contract. I know the deployment Address and i have the contract's source code. What i want to do is to call a function on this deployed contract from ...
0
votes
0answers
36 views

Debugging reverted BSC transaction that fails only through ganache-cli

I have a Truffle migration that deploys and configures a set of smart contracts on BSC (Binance Smart Chain). When running the migration on the actual network, it works fine. However, when I try to ...
0
votes
1answer
50 views

web3.js Proxy Contract Error Handling

I have been working on error handling recently using the event emitter. If I call a function directly from a contract (using contract.methods.myMethod().send{from: Ganache supplied account}) with an ...
0
votes
0answers
18 views

Step by step smartcontract debugging with truffle or brownie

I am writing smart-contracts with Vyper/Brownie or Solidity/Truffle. In order to debug and test my smartcontracts, i want to execute them step by step. Is there a way to do that exactly like we debug ...
0
votes
1answer
21 views

Truffle Console: How to print the value of a variable using get function

I want to printthe value of iVar: pragma solidity ^0.5.1; contract PRetVal { uint8 iVar =0; function testFunc() public returns (uint8) { iVar = iVar + 10; return iVar;...
0
votes
1answer
17 views

How to deploy contract with vanity address using truffle?

I'm not sure I'm going in the right direction at all, so maybe you know totally different solution for deploying contract with vanity addresses? My current approach is this: generate private key such ...
0
votes
0answers
24 views

Truffle Migration: deploy or upgrade

I would like to write the following logic in the migration script for my truffle project with upgradeable contracts: if(contract is not yet deployed) { const mynewcontract = deployProxy(MyContract, ...
0
votes
1answer
22 views

Create different contracts in run-time

I am new to solidity :) I try to create a general contract which its attributes are known at run-time. Suppose we have the following contract: contract Product{ string name; uint price; ...
0
votes
0answers
17 views

Transferring aToken(aDAI) in my truffle tests reverts with unspecific error

I'm having issues with setting up a truffle test to transfer aTokens (aDAI) to my contract. I'm using Aave v2 and running ganache with a fork from mainnnet. This is what I did so far: 1- Started a ...
0
votes
1answer
14 views

How to hide “Events emitted during test” in truffle test?

When I run truffle test and my test fails - the log gets polluted with numerous messages which make difficult to read the error message itself and other debug outputs Events emitted during test: -...
1
vote
1answer
12 views

what is the reason for extra gas burned with truffle?

I have a complex smart contract which I want to deploy in test net (then main net). When I deploy the contract in rinkeby using remix (enabled optimization) It only cost round 3 millions gas. but When ...
0
votes
1answer
9 views

Interacting with existing Smart Contract deployed on test network like rinkeby from local test environment (truffle)

I have forked rinkeby network using ganache-cli as shown below ganache-cli -f https://rinkeby.infura.io/v3/id --account="fsdfmsadklksmdflskamf" Now, I want to test my smart contract which ...
0
votes
1answer
12 views

Use smartcontract's ENUM in test scenarios in truffle

I have create a truffle project with this command: truffle unbox react Here is my smartcontract contracts/SimpleStorage.sol : contract SimpleStorage { enum MyEnum { step1, step2, ...
0
votes
1answer
20 views

Big numbers in truffle test assertion

Here is what i've done: I have create a project this way: truffle unbox react npm install @openzeppelin/test-helpers I have keep SimpleStorage.sol sample contract and here is my test file: const { BN,...
0
votes
0answers
15 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
16 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
25 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
33 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
23 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
8 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
20 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
21 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
1answer
57 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
22 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
56 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
26 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
19 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
12 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
17 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
127 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
12 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 ...

1
2 3 4 5
48