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

web3-core-method.umd.js:1191 Uncaught (in promise) Error: Transaction has been reverted by the EVM:

Keep getting this error and really not sure what's causing it. Smart contract: contract BasaltStore { // struct of how a document will be stored struct documentStore { // unique id of the ...
1
vote
2answers
82 views

How use Truffle Framework [closed]

Anyone please help me to understand what is exactly Truffle & Ganache ? How to install & use Truffle ? Please reply who are know this.
0
votes
1answer
152 views

truffle migrate --network ropsten issues

When i run truffle migrate --network ropsten i don't see the contract deployment but just Compiling your contracts... =========================== > Everything is up to date, there is nothing to ...
1
vote
1answer
106 views

Dapp on Ganache and Truffle but… what about Remix?

My dapp runs well with Ganache and Truffle but how to deploy with Remix and connect the contract to web GUI without abi? I mean, i created a Dapp that runs really good on Ganache and i run the web ...
1
vote
4answers
50 views

Issue deploying this contract

This is a contract im trying to deploy and i think its an abstract contract as most of the functions dont seem to be implemented... anyway the issue im facing is that truffle is telling me i cant ...
1
vote
1answer
15 views

In case we have an interface written in a seperate .sol file how do we migrate it successfully?

HI consider i have 3 smart contracts A,B,C. I have a separate file D.sol which is an interface used in all A,B and C. What would the migration script look like for this project?
0
votes
0answers
88 views

Test requires block gas limit much higher than deployment cost

Im testing a really big smart contract using Truffle and Ganache-cli for my test blockchain. The Ganache-cli configuration im using is this: ganache-cli --allowUnlimitedContractSize -l 471238800 -d ...
0
votes
2answers
41 views

I can't migrate the contract using truffle init

I am working to build a Dapp using Ganache, Web3, and Truffle frameworks. I am unable to compile the contracts using truffle compile. I am facing an error. I want to explain you in detail what I did. ...
4
votes
2answers
36 views

How to test a function call that should fail?

Im using Truffle to test my smart contracts written in Solidity and I would like to mark test as passed if function call/execution fails. Example: await instance.cancelOrder({from: accounts[1]}); ...
1
vote
1answer
90 views

Truffle compile fails: could not find file from any sources

I'm following the steps of this tutorial. I created a simple contract, TodoList.sol pragma solidity ^0.5.0; contract TodoList { uint public taskCount = 0; } Then I run truffle compile and get ...
0
votes
0answers
120 views

TypeError: Member “equal” not found or not visible after argument-dependent lookup in type(library Assert)

Truffle v5.0.8 (core: 5.0.8) Solidity v0.5.0 (solc-js) Node v10.13.0 Web3.js v1.0.0-beta.37 Assert.equal worked in Truffle 4.x. pragma solidity >=0.4.21 <0.6.0; import "truffle/Assert.sol"; ...
1
vote
0answers
18 views

Adding additional info for initial state of Drizzle

How do I add extra content to the initial state of drizzle? I want to keep some local information that is not dependant on the blockchain. Should I keep a seperate redux store for that or is there a ...
3
votes
1answer
49 views

Embedding ETH Wallet Address into Webpage

Hey is there a quick way to embed an Ethereum wallet address and a button into my existing website so as to allow people to send in their ETH donations to me? Or do I need to go through the whole npm ...
1
vote
1answer
105 views

Drizzle CacheCall always returns null

I have set up drizzle to be able to connect to my smart contract from my react-application. After some fiddling, I decided to make this function in my smart contract: /*** test ***/ uint numberFive = ...
0
votes
1answer
72 views

How to test kill function including selfdestruct()?

there. I'm coding kill function below: function kill() public onlyOwner returns (bool) { selfdestruct(msg.sender); return true; } and my unit test code: function testOwnerCanKillContract()...
1
vote
2answers
196 views

How to integrate Drizzle with react

I have currently set up a truffle project with react, redux and react-router. I just finished writing my first implementation of the smart contract, and now want redux to connect with the smart ...
1
vote
1answer
54 views

Can I avoid manually changing code from solidity 0.4.17 to 0.5?

I'm totally newbie in blockchain programming and I have a situation: I have to continue the project written on truffle framework with solidity version 0.4.17, the problem is that I couldn't manage to ...
1
vote
1answer
43 views

onERC721Recieved implementation

As per the ERC721 requirements, I have to implement onERC721Recieved. This is how I did it: function onERC721Received( address _operator, address _from, uint256 _tokenId, ...
0
votes
0answers
54 views

Uncaught (in promise) TypeError: rentalInstance.carsCount is not a function

I am beginner in writing Dapp. I am writing with truffle and solidity. Rental.sol pragma solidity ^0.5.0; contract Rental { // address[16] public rentals; // address public owner; ...
0
votes
0answers
25 views

Can I avoid metamask popups with calls to a server-side js script in order to pay for transactions?

I have a dapp that allows a user to input some info via the GUI, and this info is stored to the blockchain(testnet for now) when the user presses a button. This naturally incurs a cost, which causes ...
0
votes
1answer
190 views

ReferenceError: address is not defined

Truffle v5.0.5 (core: 5.0.5) Solidity v0.5.0 (solc-js) Node v10.15.1 ReferenceError: address is not defined. const ApprovalContracts = artifacts.require('../../contracts/ApprovalContracts.sol'); /...
1
vote
2answers
453 views

TypeError: Data location must be “memory” for parameter in function, but none was given

Contract fail to compile in IDE Remix.due to the following error: TypeError: Data location must be "storage" or "memory" for parameter in function, but none was given. version:0.5.6+commit....
0
votes
1answer
54 views

truffle test get different results between ganache-cli and local geth

When I run truffle test on ganache-cli, it will pass the test but when I run the same truffle test commnad on local geth node, it will fail with error saying invalid address at the method which takes ...
0
votes
1answer
279 views

Metamask not connecting to localhost “7545”

After following the pet shop tutorial i cant connect my localhost to the metamask wallet i'm still get 0eth in my wallet whereas it should be 99eth after connecting. The metamask is not showing it as ...
0
votes
1answer
23 views

Is there a good erc20 source using web3js?

I'm looking for some source codes using web3js for interaction with erc20 tokens and contracts. Does anyone know good source codes using web3js? Thanks in advance!
3
votes
2answers
184 views

Truffle Test Issue With `address payable` and Compiler Version

I am trying to run truffle test on an old contract which was written using pragma solidity 0.4.24;. While I am able to deploy the contracts using truffle migrate, I get the following error when ...
0
votes
1answer
27 views

Cannot retrieve data from smartcontract during tests

I am writing truffle tests for my smart contract solidity version 0.4.24. The tests are emitting events to write data to memory through smart contract. But I am unable to retrieve data from functions. ...
1
vote
1answer
70 views

Smart contract now vs javascript now

I have a trouble with comparing timestamp parameter(in test) and now in smart contract. Here is my smart contract: function create(uint created_at) public { require(now > created_at, "The ...
2
votes
2answers
131 views

Cannot able to call the contract inside the truffle console

I am new to the truffle framework. I have initialised my contract Dapp with the constructor function as given below pragma solidity ^0.5.0; contract Dapp { uint public totalSupply; ...
0
votes
1answer
157 views

Truffle tries deploy from unknown account

I am trying to deploy a contract to Ropsten using Infura with the config file truffle.js below. The deploy fails because the account listed in the error message has insufficient funds – however I do ...
0
votes
1answer
147 views

Solidity Contract Deployment fails - but account has plenty of ETH

I was just trying to deploy a new contract on the Ethereum MAIN-Net (not Ropsten, Rinkeby or the other test-nets) - and I’m getting this strange error: Message: sender doesn't have enough funds to ...
0
votes
0answers
96 views

Issue calling one contract from another using Quorum

I'm using truffle and running locally with 4 quorum nodes, trying to call another contract's function, but keep getting 0 in return instead of the expected value the I get once calling the contract ...
-2
votes
1answer
41 views

I had error when I ran truffle test call which I had followed the documentation of official truffle petshop documentation [closed]

chittiError: CompileError: Error parsing /Users/rahul/pet-shop-tutorial/test/TestAdoption.sol: ParsedContract.sol:10:1: ParserError: Expected pragma, import directive or contract/interface/library ...
1
vote
1answer
474 views

UnhandledPromiseRejectionWarning: Error: Subscriptions are not supported with the CustomProvider [duplicate]

Trying to deploy the newly created contract into rinkeby test network but got struck with the below error. Please check the code, error message and package.json details below. const HDWalletProvider =...
0
votes
2answers
109 views

After compiling contract, there is no build directory inside project directory?

After writing 'truffle compile' in terminal , it just give the message i.e. compiling your contracts...and exit, no build directory is formed in Project directory. What is the issue?
0
votes
3answers
199 views

Truffle compile command stuck at “Compiling your contracts…”

I developed a dapp using my PC (OS: Pop_OS!) and it was running fine. Then I had to format PC and installed new OS (Ubuntu 18.04 LTS), due to some issues in compatibility and performance.After that, I ...
0
votes
1answer
392 views

Invalid implicit conversion from address to address payable requested

first of all really nice to find this forum, I'm starting coding Solidity. Here the problem I get compiling a template of crowdsale smart contract ExampleTokenCrowdsale.sol, from this tutorial. The ...
0
votes
0answers
15 views

Metamask browser apps reusing Truffle tests?

After reading the documentation about metamask (https://github.com/trufflesuite/trufflesuite.com/blob/master/src/docs/truffle/getting-started/truffle-with-metamask.md) is not clear to me whether it's ...
1
vote
2answers
56 views

Trying to test the contracts fully

truffle(develop)> version Truffle v5.0.5 (core: 5.0.5) Solidity v0.5.0 (solc-js) Node v10.15.1 const ApprovalContracts = artifacts.require('../../contracts/ApprovalContracts.sol'); contract ('...
0
votes
1answer
82 views

Truffle Test async problem [closed]

When I "truffle test" and the below runs, I get 1,3 as the output. How do I make everything happen in order, I want to force it to wait until dai is defined. const DAI = artifacts.require("DSToken"); ...
1
vote
2answers
177 views

Why Truffle over Remix Ide

Can anyone please let me know why I should work in truffle framework to test the contracts when I have access to Remix Ide.
1
vote
1answer
53 views

ERC721 Transfer Event issue

Looking at the open-zeppelin ERC721 Contract's code, I see that the very last thing that its mint function is doing is call emit on the contract's pre-defined Transfer event. My question is: how do ...
0
votes
1answer
54 views

how to parse values returned by one contract into another?

I've two contracts deployed one is UserRegistration and another is Exam I've getUser(uint id) method to fetch data of particular user using users mapping, function getUser(uint _id) public constant ...
0
votes
0answers
46 views

Web3 & Solidity - Automatically read ABI and Create Contract

Is there a way to automatically create a new Solidity Contract - from within a web3 JS file using the .json file created in a project's build folder after each compile? I have already figured out how ...
1
vote
1answer
96 views

Solidity Contract Needs Another Contract's Address

Is there a way for a Solidity contract to programmatically find out another solidity Contract's address? Right now I'm letting Contract A know about Contract B by hard-coding the address of B into ...
3
votes
1answer
149 views

“ app.candidates is not a function” getting these error while caling the function through truffle console with "app.candidate'

pragma solidity ^0.5.0; contract Election { //Model a Candidate struct Candidate { uint id; string name; uint voteCount; } //Store Candidate //Fetch ...
0
votes
1answer
64 views

receiver.payable

Truffle v5.0.5 (core: 5.0.5) Solidity v0.5.0 (solc-js) Node v10.15.1 pragma solidity v0.5.0; contract ApprovalContracts { address public sender; address public receiver; address public ...
0
votes
2answers
258 views

Default getter and setter for mapping in solidity

In my smart contract I've public mapping as mapping (uint=>User) public users where User is a Struct, so is there any way to get the values of this mapping using default getter. For Example : If ...
0
votes
0answers
89 views

How to use multiple app.js in truffle project?

I'm new to blockchain and currently developing small application for educational purpose using solidity. I am using truffle framework and stuck at a point. currently there is only one app.js file in ...
0
votes
1answer
64 views

Truffle - how to share variables and functions between test files? [closed]

I have files in Test directory, each one performs different test but all of them contain at least exactly the same functions "register" and "vote", also few arrays like votings = [], groups = [] and ...