Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
106 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
18 views

Do I have to create a custom ERC20 to test transfers in Truffle?

I have a smart contract that escrows and transfers a specific ERC20 token to and from users (with their approval). I'm a bit confused as to how to test transfers of existing tokens. Do I have to copy+...
0
votes
1answer
17 views

Sending transaction to a Web3 contract object in Truffle test produces 'file import callback not supported'

I need to send a state-changing transaction to a Web3 contract object in my Truffle tests, which is hitting a fork of Kovan in my local ganache chain (ganache-cli --fork https://kovan.infura.io/v3/[...
3
votes
3answers
2k views

Is there ERC20 token test library?

I have a custom ERC20 token project and I would like to cover the token behaviour with tests. As the ERC20 interface is standardized I wonder whether there are some libraries to test ERC20 ...
0
votes
3answers
466 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'); /...
0
votes
0answers
14 views

why web3.eth.getBlockNumber().then(console.log) returns 0

I have build a Ethereum Full Node in Ubuntu 18.04. geth is running through the following command: nohup geth --rpcaddr 127.0.0.1 -rpcport 8545 --rpc -rpcapi "wb3,admin,eth,personal,net" --ws --wsaddr ...
0
votes
1answer
352 views

Contract not using Upgraded Proxy Contracts

There's 2 contracts A and B, A imports B, where B is a library that can be upgraded. To achieve this, I tried replacing B with a proxy contract and a delegate contract. We now have contracts Foo, ...
0
votes
0answers
6 views

CheckMarx Docker based Example: Installing the ganache and Truffle again

I am trying to work on an example provided at: CheckMarx Example $ ./ddenv Pulling ganache (trufflesuite/ganache-cli:latest)... ERROR: Get https://registry-1.docker.io/v2/: net/http: request ...
0
votes
0answers
7 views

Creating Multiple ERC721 Tokens

Imagine you wright your own token following the ERC721 standard. Now you want to create 10,000 tokens of this type. Do you need one contract to manage each token? Do you have to deploy 10,000 token ...
0
votes
1answer
314 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
1answer
26 views

Can i use a the msg.sender which is a address to call a function of the contract?

I am trying to mint a ERC721 token using openzeppilin/contracts. It was working correctly, but later had to change the design. So now i am forced to use the msg.sender who is the minter to call the ...
0
votes
2answers
301 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
3answers
247 views

Deploy smart contract on Ropsten with Truffle without truffle-hdwallet-provider

Here is my truffle-config.js networks: { ropsten: { network_id: 3, host: '127.0.0.1', port: 8545, gas: 4000000, from: "address_in_metamask" }, I ran a geth node using the command: geth --...
1
vote
2answers
470 views

Getting async/await to work in truffle JS tests

I see many examples are happily using async/await in their JS tests, but it looks like mine doesn't seem to be using ES8? I'm not sure how to check. I installed truffle using "npm install truffle" ...
0
votes
0answers
16 views

Using a bash script containing truffle commands to connect with multiple network in order to send transactions

Context: I have created a local Ethereum test net. I am using truffle to send transactions to EVM nodes. I have created a bash script that looks as follows (send_transactions.sh): sudo truffle ...
1
vote
1answer
260 views

Error: StartCoinCrowdsale contract constructor expected 5 arguments, received 6

This is my contract code. contract StartCoinCrowdsale is TimedCrowdsale, MintedCrowdsale, CappedCrowdsale, FinalizableCrowdsale { //100000000000 uint256 public constant TOTAL_SHARE = 100; ...
0
votes
0answers
10 views

How can I listen for Truffle Actions such as TX_BROADCASTED, TX_ERROR via the Drizzle Vue Plugin?

In my Vue JS Dapp, which uses Drizzle Vue Plugin, I listen for contract events using $drizzleEvents like so: this.$drizzleEvents.$on('drizzle/contractEvent', (payload) => { this....
0
votes
2answers
2k views

Cannot read property 'deployed' of undefined issue

I am trying to launch an Election-Dapp. I have these dependencies installed: - Nodejs v9.11.1 - npm v5.8.0 - Truffle v4.1.3 - web3js v0.2 - ganache-cli Below is my solidity contract pragma ...
0
votes
1answer
24 views

Compiled solidity contract run out of gas on deployment

I have a solidity contract that compiles ok (0.5.1 compiler version), but it runs out of gas if I deploy the whole of it. If I comment some of the external methods of the contract, it compiles and ...
0
votes
0answers
11 views

How to keep track of deployed versions and implement a CD strategy with truffle?

My original question on SO here didn't had much success... so I copy/paste it here, hoping for more interest. Thanks in advance! I'm working on a dapp project which includes a main smart contract, ...
0
votes
1answer
34 views

TypeError: … is not a function

I'm trying to test my contract functions in Truffle v5+ but getting TypeError: myContract.methods.register is not a function. Contract MyContract { function register(uint256 amount) external {...}...
0
votes
1answer
386 views

Deploying new contract inside truffle test case

I was trying to transact between two contracts inside my truffle test case. But not been able to do it. The second contract instance comes back undefined always. As per the truffle documentation, ...
2
votes
2answers
632 views

Simple Truffle tests timeout “before all” hook: prepare suite

I'm trying to write my first tests for truffle, but I run in a timeout each time I want to execute the tests. Error: Timeout of 120000ms exceeded. For async tests and hooks, ensure "done()" is ...
1
vote
3answers
829 views

“before all” hook: prepare suite

This is the error code: Adoption.sol code: TestAdoption.sol code: I dont know how to solve this, it fails when i try to use this comand: "truffle test". Thanks.
0
votes
1answer
11 views

Event filter not returning correct events web3js

I am trying to filter certain events emitted in the past based on the value of a certain field. The code I have used corresponds to the method specified on the web3js documentation page. However, the ...
1
vote
1answer
216 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
1answer
14 views

Truffle testing a contract against an already-deployed external contract

Let's say I'm writing an escrow contract. The conditions of this escrow are based on the properties of a second already-deployed contract on Kovan and mainnet. Should I skip testing my escrow contract ...
0
votes
1answer
228 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
1answer
6 views

How is data sent to the front-end by a View function?

I am required to send some data from a view-only function to the front-end. I tried using the standard approach by emitting an event with the required fields. However, when the emit call is placed ...
1
vote
1answer
156 views

Error deploying smart contract with web3.js and Truffle HD wallet provider

My web3 version is 1.0.0-beta.41, node version is 10.15.1 solc compiler is 0.4.25 compile.js is successfully compiled with interface and bytecode exports. My deploy.js file const HDWalletProvider ...
0
votes
1answer
314 views

Comparing msg.value using javascript test always fails

So I have this solidity function: function claimGoodTest(uint256 typeId) public payable { if (msg.value < 4000) revert(); } I test it with the following: var result = await contract....
0
votes
1answer
36 views

Ubuntu 18.04: Error during compilation using Truffle: How to install the updated version

I am working on Ubuntu 18.04. I have installed Truffle from the following site: Truffle for Linux I am trying to execute an application from the following site: Petshop Tutorial I am able to ...
0
votes
1answer
17 views

ParserError: Expected ',' but got ';'

I`m trying compilate this code and getting Parse error pragma solidity ^0.6.0; contract ZooFactory { event NewZoo(uint zooId, string name, uint dna); uint dnaDigits = 24; uint ...
1
vote
2answers
43 views

What are contract Variables and how are they different from normal varables declaration

pragma solidity ^0.4.2; import DappToken; contract DappTokenSale { address admin; DappToken public tokenContract; function DappTokeSale(DappToken _tokenContract) public { ...
5
votes
4answers
1k views

How to change settings for truffle develop?

I'm trying to change the settings for my truffle develop node, but the values in truffle.js don't seem to work. Here's what I have there: networks: { development: { host: "127.0.0.10", ...
0
votes
0answers
11 views

Drizzle problem: how to connect to infura direct when user has Metamask, but isn't connected?

I understand how to connect direct to infura if the user has no wallet at all (for displaying blockchain data when users don't have a wallet) the problem is that I don’t know how to connect to infura ...
0
votes
1answer
54 views

Saving a function in a variable in Solidity

I am very new to solidity and stack exchange as well. I am trying to use the date time api from https://github.com/pipermerriam/ethereum-datetime/tree/master/contracts. What getYear(date) does is ...
0
votes
1answer
9 views

mnemonic.includes in not a function

I've been trying to compile my solidity smart contracts So I'd be able to deploy them on the Ropsten Test network when I run truffle compile I get this error : TypeError: mnemonic.includes is not a ...
0
votes
1answer
56 views

Truffle deployment error while deploying with Infura (Error: Callback was already called)

I am trying to deploy a token smart contract to Ropsten test network with Infura, but I am always getting an error as I am using truffle migrate --reset --network ropsten_infura Compiling your ...
0
votes
2answers
406 views

How to detect what instruction caused “truffle test” to result in “invalid opcode” error?

I wrote a test for my contract and it returns invalid opcode as a result. Full output: 1) Contract: FPCoin1 One can purchase tokens for ether: Error: VM Exception while processing transaction: ...
0
votes
1answer
326 views

Can I find constructor arguments from truffle artifact?

I'm in the process of verifying my contract on Etherscan. Etherscan asks for ABI-encoded constructor arguments during the verification process, though I was a bit silly and don't quite know what they ...
1
vote
1answer
156 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 ...
0
votes
0answers
9 views

migrate error from new buffer(process.env)

I follow the book Ethereum from Gavin Wood and when i use truffle migrate --network ganache it gives me following error; TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be one of type ...
0
votes
1answer
30 views

How can I make sense of solidity-coverage reports

I'm trying to check the coverage of an entire ERC20 set of openzeppelin tests. I'm using openzeppelin/test-environment and solidity-coverage v0.7.4 as plugins in truffle. The tests went fine but I get ...
0
votes
1answer
26 views

How to find the address of the contract owner?

I'm under the impression that the owner of the contract is simply referred to as accounts[0] in Truffle's testing environment, but I'm getting the error by the modifier that the caller of a certain ...
1
vote
1answer
471 views

How to get the returned value of a smart contract function when it called by using cacheSend() in drizzle

I just tried to build a simple DApp using truffle, react and drizzle. My question is how to get the returned value of a smart contract function when it called by using cacheSend() in drizzle? As ...
1
vote
1answer
28 views

Sending transaction from different addresses in truffle test case

I am having an admin in my contract who can do certain things. Here is the contract function changeAdmin(address admin_) public { if (msg.sender != admin) revert(); potentialAdmin = admin_; }...
0
votes
1answer
28 views

How do we access a contract that was deployed by another contract in Truffle?

I am trying to figure out how do we access Contract2's instance in Truffle's test if it was deployed by Contract1 in Truffle Develop? Can't seem to find a question that described my issue exactly so ...
0
votes
1answer
31 views

Zepellin Crowsale buyTokens error

I'm trying to use the buyTokens function of the Zepellin Crowsale interface, but this gives me an error, without any log to be able to debug contract TokenA is MintableToken, PausableToken, ...
0
votes
1answer
544 views

problem starting ganache

I'm using truffle with ganache GUI. It worked fine at first, but now I am unable to start it. (I made it executable) When I run ./ganache.AppImage I get this message: installed: X-AppImage-BuildId=...

1
2 3 4 5
43