Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [truffle]

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

0
votes
1answer
145 views

Deploying with Truffle

I deployed a contract through remix and then I run the following code MyContract.deployed() .then(instance => { c = instance; return c.getCreator(); }) .then(result => { ...
0
votes
2answers
64 views

Uncaught TypeError: e is not a function from getAccounts() + web3 1.0.0-beta.37 + truffle + React Dapp

I am creating my first Dapp by using web3 1.0.0-beta.37 and trufflfe While getting the accounts in app.js by using ganache-CLI and Metamask, I am getting following error. Uncaught TypeError: e is ...
1
vote
2answers
110 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 ...
0
votes
2answers
141 views

Empty bytes32[] in truffle console

I am trying to get from truffle develop console an array of identifiers using a custom get function but the return array is []. Here is my contract: pragma solidity ^0.4.18; contract MyInfo { ...
1
vote
0answers
68 views

Transaction exited with an error (status 0) after consuming all gas

I developed some smart contracts to be deployed to a private PoA (Proof of Authority) blockchain. I spun up a private blockchain via truffle develop and got the following receipt: Compiling your ...
0
votes
1answer
44 views

TypeError: tokenInstance.balanceOf is not a function

It happen when use truffle test, here my contract file: pragma solidity ^0.5.0; import "./DappToken.sol"; contract DappTokenSale { address payable admin; DappToken public tokenContract; ...
0
votes
1answer
270 views

Testing transfer of tokens with truffle

I Have a Token contract: pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol"; contract MyToken is StandardToken{ string public name = "MyToken"; ...
0
votes
0answers
23 views

Expressjs backend (truffle box) with metamask

I use truffle to unbox the express-js box (https://truffleframework.com/boxes/express-box). The code loads the web3 instance in server side which connects directly to ganache. Now I want to be able to ...
1
vote
1answer
41 views

Drizzle - accessing array items from a getter

In my contract I have a getter function that returns a full array of addresses: function getDeployedCampaigns() public view returns(address[] memory) { return deployedCampaigns; } Using drizzle ...
1
vote
1answer
103 views

browser-solidity debug alternative for more automate process (rather than manually type in the function input everytime)

As specified in the title I use truffle to test now, but often times it just returns the error msg "invalid opcode" instead of clearly stating what happened. Any other testing/debugging tips will ...
0
votes
2answers
31 views

Error: Invalid number of parameters (regular getter function). Got 0 expected 1!

Playing with drizzle, I am trying to use a getter for an uint variable campaignCounter, that gets incremented by 1 whenever a factory creates a new campaign. Here is my component's code: import ...
5
votes
1answer
374 views

Truffle error “Don't set config.from directly”

I have parity running on my mac and I can start it with parity --rpcaddr 0.0.0.0 --rpcport 8547 --port 30305 --rpccorsdomain '*' --rpcapi "eth,net,web3" Once It's all sync'd up I then make a new ...
0
votes
1answer
55 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 ...
0
votes
1answer
110 views

Transfer contract address from truffle to meteor

I am very new to dApp-Development and therefore frankly i need some basic help. How can i get the address of my deployed contract by truffle in meteor? I hope there is a simple solution.
1
vote
2answers
56 views

Correct Contract Abstraction in Truffle

I am new to Solidity and tried to write a contract. Now for better developing reasons I made myself a setup with truffle. Previously I used to work with remix only. My Project contains multiple ...
0
votes
1answer
101 views

Why I am unable to write to contract in ethereum wallet?

I clicked on the watch contract and entered address and ABI. But I can't see any functions to write to contract. I compiled and deployed contract by using truffle framework ABI: { "...
0
votes
1answer
18 views

Contract [Contract's name] not found on network ID: 5777

I am using truffle with drizzle. In the contract folder I provide a file that includes two contracts A that is a factory contract and B that is created through one of A's functions After compiling ...
0
votes
1answer
152 views

Error: Cannot link contract without an address

I'm writing test for my smart contracts with truffle test. I got these strings of code: Library.new() .then((lib) => { console.log(lib.address); //0xd6f066a5b07562b6c8fdb6a59b7ba42036d5516c ...
1
vote
1answer
42 views

Looking for good guide on how to deploy and verify source code of Smart Contract using Truffle/Remix

Can't really find good guides on how to deploy and verify smart contracts to testnetwork Ropsten. Would like to deploy multifile smart contracts including libraries. Are there any good HowTos already? ...
8
votes
5answers
2k views

Flatten Truffle Solidity Contracts for Etherscan's `Verify Contract Code` Feature

Etherscan.io has a Verify Contract Code feature that takes the inputs Solidity Contract Code and Constructor Arguments ABI-encoded. Question: Is there a tool to flatten your solidity contracts (...
14
votes
2answers
2k views

Etherscan: How can I verify a contract with multiple imports deployed with Truffle?

When I deploy a contract with Truffle that has an import statement, and try to verify it on etherscan, my understanding is that I need to paste in the contents of the imported file. I get an error on ...
1
vote
1answer
151 views

Truffle migration with contract argument

I have have many examples and in the 2_deploy_contracts.js providing simple arguments like address, string is all good. However I am trying to deploy this example and it has a MintableToken _token as ...
0
votes
1answer
176 views

Trouble while installing truffle-contract module

When I run the command sudo npm install truffle-contract it gives me this error: npm ERR! code 1 npm ERR! Command failed: /usr/bin/git clone -q https://github.com/debris/bignumber.js.git /home/ubuntu/...
0
votes
0answers
14 views

Can't resolve 'react' after installing additional dependencies to truffle react box

I am using a truffle box react - after truffle unbox react everything works fine Later however, after yarn add @material-ui/core I get an error: Can't resolve 'react' The same happens after ...
0
votes
1answer
162 views

by using truffle & metamask deployed my contracts, but a error occurred when sending a transaction on web

This is the err information. This is the web I built. Now the problem you see is that when I click the vote button, pay the gas, and send a transaction, but than error occurred. I write my program ...
1
vote
0answers
14 views

How to pass array parameter. Drizzle

Is there have a way to pass array parameter from the drizzle to my contract ? I want to pass an array of uint[] i have read a lot about getData() function and encodeABI but how to use it in Drizzle ?
3
votes
1answer
973 views

instance.balanceOf(…).call is not a function

I have ERC20 standard token functions in my code...I´m trying to test the function balanceOf(address _owner) with a javascript test on truffle but I have the following problem: TypeError: ovxet....
2
votes
2answers
177 views

Error while doing truffle init. EDIT: Truffle isn't working itself

I am getting the following error while doing truffle init. I have followed the steps here: https://medium.com/@merunasgrincalaitis/the-ultimate-end-to-end-tutorial-to-create-and-deploy-a-fully-...
1
vote
1answer
97 views

Error : Could not connect to your Ethereum client with the following parameters:

Im creating my dapp with following below tutorial. http://www.dappuniversity.com/articles/the-ultimate-ethereum-dapp-tutorial however Im facing an error when I run truffle console it shows >...
1
vote
1answer
225 views

NodeJS with HDWalletProvider

I want to execute signed Ethereum transactions from a NodeJS program. I am creating a web3_provider like this var contract = require("truffle-contract"); var provider = new HDWalletProvider("nemonic"...
0
votes
1answer
138 views

Drizzle component returns BigNumber

I am using the following Drizzle (Truffle) component to call a function from a smart contract: <ContractData contract="Market" method="priceOf" methodArgs={this.props.id}/> The result is a ...
1
vote
1answer
43 views

openzeppelin,VM Exception while processing transaction: revert

using openzeppelin-solidity to create crowdsale. Then I use this statement to Buy Token: MyCrowdsaleInstance.sendTransaction({ from: purchaser[1], value: web3.utils.toWei("0.5", "ether"), ...
0
votes
1answer
203 views

SenTransaction can't send Ether to a contract address

I am using openzeppelin, Ganache and truffle, here's a very simple smart contract for fundraising: pragma solidity 0.4.24; import 'openzeppelin-solidity/contracts/crowdsale/Crowdsale.sol'; contract ...
0
votes
2answers
218 views

How to download or access ('web3/lib/web3/event.js');

The following test script requires('web3/lib/web3/event.js'); const SolidityEvent = require('web3/lib/web3/event.js'); function decodeLogs (logs, contract, address) { return logs.map(log => { ...
1
vote
1answer
162 views

How do I deploy a contract via a contract factory in truffle?

The code below does not set the simpleStorage instance's value to 55, but identical code works when the contract is not generated via a factory
0
votes
0answers
18 views

What is best way of setting and getting string=>uint pairs in Solidity?

I am developing a game smart contract and it has 20 numerical settings. like time, fee, difficulty etc I want to access these values using identifier throughout contract get all these values from ...
1
vote
1answer
34 views

Invalid number of parameters for “ ”. Got 0 expected 2!

I have the function below which doesn't take any arguments when i call it from truffle console i get the below error, any idea on how i can fix this: uint ownerCounter = 0; function ...
0
votes
1answer
12 views

truffle won't run tests while initializing a global contract instance

I am testing my smart contract in truffle. I need to declare some global variables hence I did so outside 'it'. I also tried declaring a global contract instance that I can use in all test cases. ...
1
vote
1answer
11 views

truffle pet shop example - metamask connects but adopt button not working

I am having some trouble with getting the adopt button to work in the truffle pet shop tutorial: https://truffleframework.com/tutorials/pet-shop I have worked through the truffle petshop example ...
0
votes
0answers
25 views

Unknown network “ganache”. See your Truffle configuration file for available networks

I am working windows 10 and have both truffle.js & truffle-config.js I am using command truffle migrate --reset --networks rinkeby Error produced: Unknown network "ganache". See ...
0
votes
0answers
21 views

How to use the address.transfer(amount)?

Using this smart contract, I want to transfer from one account to another. Here is my simple smart contract : pragma solidity ^0.5.0; contract Subtract { address payable public minter; uint ...
0
votes
1answer
162 views

Why does the transaction stay in queue from more than 240 second

I am running quorum nodes via the Quorum-maker script, and when trying to call functions from my already deployed smart contract, I get this error : Transaction ...
0
votes
1answer
195 views

How to chain functions in truffle framework?

I am wondering how to chain functions in truffle testing framework to avoid writing the same code twice. To give an example, I am experimenting with the old version of King of the Ether Throne ...
0
votes
1answer
223 views

Error when testing smart contract - use truffle and solidity

I'm executing a example in this link. https://truffleframework.com/tutorials/pet-shop While testing testing with file "TestAdoption.sol", I have encountered the error "Source truffle / Assert.sol not ...
0
votes
1answer
185 views

which wallet is usable with ganache test-rpc?

I tried metamask, but unable to send ether between accounts because metamask is trying to estimate gas and gets stuck :( myetherwallet doesn't save my seed so I need to enter it all the time
12
votes
4answers
7k views

“SyntaxError: Unexpected token import” on truffle test

I get an "SyntaxError: Unexpected token import" error when I do 'truffle test'. I am trying to import a function declared in another file into the java-script test file. I have been searching about ...
0
votes
1answer
155 views

Program for interacting with deployed contracts via a GUI?

So I've deployed a contract to Rinkbey using truffle, and now I'd like to play with it. I'd like something that builds a GUI for me from the ABI like EthFiddle does. I just want something that lists ...
0
votes
0answers
12 views

Testing a Smart Contract on two different devices at the same time

So the goal is to have two computers each owning one account or just different addresses on MetaMask for example and connecting them to the same Smart Contract that is deployed on Rinkeby. Now how ...
0
votes
0answers
12 views

Execute `transferFrom` after executing `approve` on erc20

I can not withdraw from adress specified by approve. truffle(development)> erc20.approve("0x9e26730bf972d6ae8840b8f6003a61f57e25ff92", 1).then(b=>res=b) { tx: '...