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
13 views

Function stopped working? No check is being done now on transfer function

I created a function to deposit and transfer ether and it was working great until i tried to deploy again and now the transfer function is not working anymore No errors are being thrown, the transfer ...
0
votes
2answers
22 views

Cannot transfer ether from smart contract to another address

I am using truffle and when we type truffle develop it provides us with 10 address ** So, the problem I am facing is I have created 2 functions one to deposit ether and the other one to transfer the ...
0
votes
0answers
13 views

How is this possible using web3 and truffle accounts

all i want is this Alice sends contract 1 Ether. Now contract has 1 Ether. Contract forwards 1 Ether to Bob. Now contract has 0 Ether. I know this is possible but to accomplish it with front end AND ...
0
votes
0answers
10 views

“truffle migrate --network ropsten” stuck after compiling

I am trying to redeploy a contract on Ropsten Testnet using the command: truffle migrate --reset -f 1567182283 --network ropsten Here, "1567182283" is the prefix of my migration file. Upon executing,...
0
votes
1answer
15 views

Redeploy contract on Ropsten Network

I have already deployed my smart contract on Ropsten network for testing using truffle suite. The command line I used was: truffle deploy --network ropsten Now, I have made some changes to my ...
0
votes
0answers
18 views

How can we send ether to smart contract address and then transfer it to a account? [closed]

Any ideas, code or suggestions is welcome I am using truffle ,web3 ,metamask Can we send rawtransaction to contract address and then Retrieved the amount? I need to deduct amount from 2 people ...
0
votes
0answers
50 views

Cant call solidity function from app.js?

Solidity function Using web3 0.20 version and Cant call solidity BETONTEAM function pragma solidity ^0.4.22; import "installed_contracts/strings.sol"; import "installed_contracts/oraclize-api/...
0
votes
0answers
17 views

How can i transfer ether upon callback from Oraclize/Provable? [closed]

I am a newbie any help is highly appreciated I know how to send call to oraclize finally, and how to transfer ether between two accounts using web3,metamask But How can i transfer this fund when ...
0
votes
0answers
28 views

Cant call solidity function from app.js while sending transaction

Solidity function As i want to call function so that oraclize can send query function betOnTeam(uint team) payable public { update(); emit LogInfo("Oraclize query was NOT sent, ...
0
votes
1answer
23 views

Can someone explain the difference between using metamask or web3 to send ether from truffle accounts?

I am using web3 and truffle (i am a newbie wants to understand concept) I need to transfer ether so i understand that i need to use web3.eth.sendtransaction But will it work as i am using localhost ...
0
votes
1answer
22 views

Can we take input of an address and pass it on the function to send ether using truffle and web3?

Actually i am trying to create a betting application so when i get the result that Home team has won Before this i will be taking both address as input (betting do two address whoever wins gets the ...
0
votes
1answer
29 views

How to encode an object with ABIEncoder V2?

How to encode an object with ABIEncoder V2? For example, this one: { items: [ { str: "str", num: 5, bol: true } ] } Solidity struct: struct Item { string str; ...
0
votes
1answer
31 views

Getting stuck in truffle testing

I am trying to run a test and I am getting the following message; I have tried the following; npm install scrypt npm install web3 as to solve the yellow message and when running truffle test ...
1
vote
2answers
24 views

How to read data returned by a function? [duplicate]

Counter.sol: pragma solidity >=0.5.0 <0.7.0; contract Counter { uint public _counter = 0; function GenNextID() public returns (uint) { return _counter++; } } I use ...
0
votes
2answers
27 views

Function, variable, struct or modifier declaration expected [duplicate]

I am using the following code structure; pragma solidity ^0.5.0; contract TtdmToken { uint256 public totalSupply; function TtdmToken () public { totalSupply = 1000000; } } ...
0
votes
0answers
42 views

How to call solidity function from javascript file? Keep getting error deploying through truffle and webpack

Error -> TypeError: fetch.amount is not a function [WDS] Disconnected! Please explain or provide code on how to call solidity function Trying to call from ready() function console.log(contract.abi)...
1
vote
1answer
14 views

Setting sending account in Truffle test

I need to create contracts from various accounts in a Truffle JS Test. To do so, I set: let accounts = await web3.eth.getAccounts(); MyContract.web3.from = accounts[9]; Before creating my contract ...
2
votes
1answer
15 views

Telling Truffle to ignore certain files

Whenever I edit a file called filename.something, my text editor creates a file called .#filename.something when I modify anything. That file exists until I save. These files never were a problem ...
1
vote
1answer
28 views

Invalid number value when deploying contract using truffle? But how to fix it in code is the value or _amount variable ?i cannot figure it out

2_deploy_contracts.js Replacing 'OraclizeTest' Error: * Deployment Failed * "OraclizeTest" -- invalid number value (arg="_amount", coderType="uint256", value={"from":"...
0
votes
2answers
38 views

Truffle best practices - unit vs integration tests

Think about having two contracts: MockToken Faucet (which takes token address as constructor parameter) To unit test Faucet I would create two new instances: const token = await MockToken.new() ...
1
vote
2answers
21 views

Test using async/await in truffle not working

I am using node v12.13.1, truffle@5.1.8 and ubuntu 18.04 and running the test using documentation of async/await. https://www.trufflesuite.com/docs/truffle/testing/writing-tests-in-javascript#using-...
0
votes
1answer
24 views

how can someone use the smart contract deployed on Rinkeby network? what are next steps after successful deployment? [duplicate]

I am new to the smart contract and blockchain technology but learning step by step. I developed a small bidding smart contract in solidity. Using Truffle, NPM and Infura, I deployed it in the Rinkeby ...
0
votes
0answers
36 views

Can someone use and test the smart contract written in solidity deployed in Rinkeby network? [closed]

I am new to the smart contract and blockchain technology but learning step by step. I developed a small bidding smart contract in solidity. Using Truffle, NPM and Infura, I deployed it in the Rinkeby ...
0
votes
0answers
19 views

Truffle - set or disable optimizer only for selected contracts

I have over 40 contracts in my project, for example: admin groups votings registry token In my truffle config I have optimizer enabled with 600 runs. compilers: { solc: { version: "0.5....
0
votes
0answers
26 views

Testing of 2 Smart Contracts using Truffle

I'm writing 2 smart contracts: one is a satellite of the other. That is contract A is calling contract B. When I migrate in truffle all is OK, but when I try to run the tests it is not working. Is ...
0
votes
0answers
44 views

Smart contract works on remix and ganache but not on private chain developed by geth

The smart contract works well on the ganache and remix but not work on the private chain, even though i use the --testnet geth --identity "EDU" --rpccorsdomain "*" --rpc --rpcport "8545" --...
0
votes
1answer
19 views

Could not deploy on Ropsten network using Truffle

I have following truffle-config.js file const fs = require('fs'); const HDWalletProvider = require("truffle-hdwallet-provider"); const secrets = JSON.parse( fs.readFileSync("abc.txt").toString()....
0
votes
1answer
22 views

TypeError: balance.toNumber is not a function

I need check that token has no balance when selfDestruct was called, but shows an error that balance.toNumber is not a function in the test file. DappTokenSale.sol function endSale() public { //...
0
votes
1answer
29 views

How to create account using mnemonic words or private key in web3js and call contracts using that account

I have a simple React Project with web3@1.2.4 installed and I want to call a contract's method like this: await maincontract.methods.CurrentMethod("arguments").send({ from: accounts[0]/*my account ...
0
votes
0answers
49 views

Mocha timeout when running truffle test. Works fine on ganache, not on public networks

This is the error I get when running truffle test --network kovan: 1) "before all" hook: prepare suite Error: Timeout of 120000ms exceeded. For async tests and hooks, ensure "done()" is called; if ...
1
vote
1answer
44 views

How could return events of specific args?

In my solidity contract, I just have one event which is: transferOwnerShip (uint id, address indexed newowner); and I want to filter the events log in order to retrieve only the events that belong ...
1
vote
1answer
29 views

I got this error during truffle testing. AssertionError: it returns true: expected { Object (tx, receipt, …) } to equal true

DappToken.sol function transfer(address _to, uint256 _value) public returns (bool success){ require(balanceOf[msg.sender] >= _value); balanceOf[msg.sender] -= _value; balanceOf[...
4
votes
3answers
57 views

I got this error during migration in truffle. : ParserError: Expected '(' but got identifier

This is my smartcontract code pragma solidity ^0.5.0; contract DappToken{ uint256 public totalSupply; constructor DappToken() public{ totalSupply = 10000; } } This is code for ...
1
vote
0answers
26 views

Is there a way to deploy a contract using bytecode only (to Ropsten …)?

One solution on medium.com describes how to do that via myetherwallet but it's the old verion of myetherwallet where you can switch between ropsten/mainnet - right now I can't find how to switch to ...
1
vote
1answer
31 views

Metamask Signing gives different signature than web3.js

I have successfully been using metamask to sign EIP712 data. I am currently trying to write truffle tests and need to replicate the signing process outside the browser. The issue I am facing is that ...
1
vote
0answers
17 views

Invalid implicit conversion from int_const 0 to address requested [duplicate]

Invalid type for argument in a function call. Invalid implicit conversion from int_const 0 to address requested.
0
votes
0answers
11 views

Truffle to Ropsten Testnet Deployment Issue: No migration

I am trying to deploy my contract on Ropsten test network through Truffle Framework. I use the command truffle migrate --network ropsten. Following is my truffle-config.js: const HDWalletProvider = ...
2
votes
1answer
21 views

Check emitted event with BN

I'm currently testing events that include numeric values: const level = new BN(1); truffleAssert.eventEmitted(tx, 'EventName', {level}); As you can see, the level variable is a BN, and holds the ...
0
votes
1answer
115 views

npm ERR! code ENOENT npm ERR! syscall spawn git

I use the command npx truffle unbox react to develop a dapp but I get these errors below in my console. Can anybody help me? I really don't know how can I solve them.
1
vote
1answer
52 views

truffle unbox pet-shop gives DownloadingError: read ECONNRESET at TLSWrap.onStreamRead (internal/stream_base_commons.js:201:27)

Ubuntu 18.04. Truffle v5.1.2 (core: 5.1.2) Solidity v0.5.12 (solc-js) Node v13.2.0 Web3.js v1.2.2 When I execute truffle unbox pet-shop on terminal, I get error ✔ Preparing to download ⠼ ...
1
vote
1answer
26 views

Truffle js test. Test not really testing

I have this tests that supposedly pass (in the terminal, I can see the checks). But they never actually run the code: it("should add an exam to the exams list", () => { let hash_test = "...
1
vote
1answer
74 views

Error Installing Truffle [closed]

OS: Ubuntu 18.04 I am following this guide (https://www.codeooze.com/blockchain/ethereum-dev-environment-2019/) to install Ganache, npm, and then Truffle. Everything is fine till I execute sudo ...
0
votes
1answer
54 views

RPC error when interacting with contract using Ganache GUI, but it works fine when using Ganache CLI

I have a truffle project, if I migrate it onto ganache-cli and then interact with my contract (via Metamask) it works great. But if I try and do the exact same thing using ganahe-gui the contract ...
0
votes
1answer
20 views

Deploy smart contract on Ropsten, Kovan

When I deploy my truffle smart contract on test networks like Ropsten and Kovan, can I interact with it using multiple PCs at once simultaneously? And will the data updated from one PC be visible on ...
1
vote
0answers
18 views

An error occurred while running C:\Users\path marketplace1\marketplace1\truffle-config.js! Did you forget to `npm install` your project?

I am getting this error when I try to add the truffle-config file to my project in ganache. What to do?
1
vote
0answers
11 views

Any idea how to add new contracts into drizzle react app using the address?

I have a react app which creates new contracts. lets say A creates B. I have the addresses of the newly created contracts of B. How do i add the newly created contracts of B using its address to ...
1
vote
1answer
104 views

Issue with selfdestruct() getting an error

main contract function which calls my secondary contract function gameOver(uint _matchId)public payable onlyOwner returns(bool) { Match my_match = Match(matchTracker[_matchId]); bool success ...
0
votes
1answer
28 views

Truffle js test a call with arguments

I am trying to testa a smart contract function that receives an arg. I'm using truffle javascript tests, this is the smart contract function, very simple: function addExam(string memory hash) public ...
0
votes
1answer
21 views

How can fix in smart contract written in solidity?

TypeError: Invalid type for argument in function call. Invalid implicit conversion from address to address payable requested. selfdestruct(admin); pragma solidity >=0.4.21 <0.6.0; ...
0
votes
1answer
35 views

Uncaught (in promise) Error: Invalid JSON RPC response: “”

How to solve this error that show in the picture of chrome browser below? Bundle.js var contractABI = []; var contractAddress = '0x9B69fA769D70728d14a70A4F10E7078032FF1632'; var web3 = new Web3('...