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

How to fix transfer in etherum

$ truffle test Using network 'development'. Compiling your contracts... Compiling ./contracts/DappToken.sol > compilation warnings encountered: /home/geet/toke_sale/contracts/DappToken.sol:39:...
1
vote
1answer
60 views

Smart contract - OpenWeatherMap API

I'm wanting to create a smart contract that sends an amount of ether to an address when the weather is above 30 degrees for 3 or more consecutive days, using the OpenWeatherMap API. How can I use ...
0
votes
1answer
68 views

Truffle console no compile or init options

While using truffle.cmd console I tried to use the compile option, or even init. These options are not available, so I cannot compile using console. truffle(development)> .help .break Sometimes ...
0
votes
1answer
147 views

Solidity: How are multiple return values returned?

Working in truffle with TDD testing and am getting some errors when evaluating the return values of some functions. If a function is returning multiple values in Solidity, how are they presented? Is ...
1
vote
1answer
130 views

Deploy smart contract on Ropsten using truffle-hdwallet-provider

I have 7 smart contracts to deploy on the Ropsten network. I am using truffle-hdwallet-provider and below is the content of my truffle.js file: module.exports = { solc: { optimizer: { ...
2
votes
1answer
58 views

Transaction execution and interacting with truffle

pragma solidity ^0.4.23; contract Hotelbooking{ address receiver; function deposit(uint256 _amount) payable public { require(msg.value == _amount); // nothing else to do! ...
0
votes
0answers
27 views

How to correctly send Ether between contracts in vyper?

I have a user, Contract A, and Contract B. I want user to call a function A of Contract A, that function executes function B from Contract B, which sends ether from Contract B to Contract A. Here is ...
0
votes
2answers
85 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 ...
1
vote
1answer
72 views

Not able to send Ether to contract

I am trying to send Ethers to a contract deployed on Ganache but I am getting VM Exception while processing transaction: revert, the same logic is able to transfer Ethers to other account. Following ...
0
votes
1answer
19 views

How to call external payable contract function from app.js (DApp)?

The contract has a function: function purchaseTokens() external payable { require(msg.value>0); ...etceteras... } What I need is an app.js part, something that would look like this (lets ...
0
votes
1answer
15 views

Truffle Contract Abstraction Contract.at() not returning logs when methods are called

In my test file I have this set up: let acc = await Account.deployed() Then when I call a method, I can get the logs in the receipt: let deposit = await acc.deposit() console.log(deposit.receipt....
1
vote
1answer
60 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 ...
1
vote
1answer
67 views

Which one of methods should I choose for deployment of smart contract geth or a wallet if I have to build API for smart contracts in nodejs?

I'm having trouble to understand which method would be better for deployment geth or a wallet if I'm building API in nodejs using web3. Where exactly is the contract stored?? Is the contract ...
0
votes
1answer
25 views

what is 'UnimplementedFeatureError: Not yet implemented - FixedPointType' error?

what is 'UnimplementedFeatureError: Not yet implemented - FixedPointType' error in solidity while compiling through truffle ? How to fix it ? Using solidity compiler version - 0.5.9
0
votes
1answer
98 views

I keep getting the error: “Uncaught (in promise) Error: Invalid number of arguments to Solidity function”

I have tested it in remix and the function does work, I also removed inputs just for testing purposes but it seems that it doesn't work anyway. Here is the function: struct Message{ string ...
1
vote
1answer
4k views

truffle test fails with ReferenceError: A is not defined

I am not sure what is missing. I keep getting "Reference error". Please find the details below Step 1 : Ubuntu# truffle compile Step 2: Ubuntu# truffle migrate --reset Using network 'development'....
0
votes
1answer
100 views

Truffle contract.deployed does not get the latest instance deployed

I am developing a back-end DApp using truffle and nodejs on a private network. My application call Contract.deployed() and print the address of the obtained Contract. When I call truffle migrate --...
0
votes
1answer
55 views

Unable to change the length of a global 2D storage array

I am facing difficulties changing the length of a global 2D storage array. It seems to be working correctly on Remix IDE, but when I try to test it on ganache-cli (formerly known as testrpc) - either ...
0
votes
1answer
58 views

Quorum 7nodes example unable to finish simplestorage migration using privateFor

I'm following this example: truffle quorum example I created a cluster using docker-compose and all the nodes are up and running but when I run the truffle migrate command the migration doesn't end ...
0
votes
1answer
70 views

Contract testing works in solidity but fails in truffle - testrpc

I have a contract like this: PublishService.sol, the strings.sol is taken from here. pragma solidity ^0.4.0; import "./strings.sol"; contract PublishService { using strings for *; struct ...
1
vote
1answer
24 views

What is the best way to deploy and test smart contracts on multiple machines?

I have recently started developement on Ethereum and the concepts are pretty much new to me. I need to test event emitting/listening on multiple machines for my contract. For the same, I have tried ...
0
votes
1answer
54 views

Calling Smart Contract function returns tx object instead of expected return value in Truffle test

I have started writing a smart contract for a gift registry. When I write tests using the Truffle Framework I get unexpected return values. For example, when calling the offerGift function from ...
0
votes
1answer
104 views

Why does triggering a send on a contract method work, while call doesn't?

I'm still somewhat new to web development and solidity, so do correct any of my misunderstandings. I've been working with web3 on the front end, but now I'm trying to set up a server side web3 ...
2
votes
1answer
125 views

Branch a Truffle test into various Ganache blockchain states

I am currently testing a contract that can evolve in different ways, depending on the interaction between parties. But all these possible scenarios share the same initialization. So, the question I ...
1
vote
1answer
254 views

UnimplementedFeatureError: Encoding type “struct BiddingContract.Bidder memory” not yet implemented

The code is broken with the new upgrade v0.5, using Truffle v5.0.1 (core: 5.0.1) struct Bidder { address bidders_address; uint productId; uint bidValue; } struct Product { uint ...
1
vote
1answer
137 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
118 views

web3 js send ether not broadcasting on main net

I am using folowing code sample to send ether between 2 of my own accounts, both have enough funds: "use strict"; var Web3 = require('web3'); var Tx = require('ethereumjs-tx'); // Show Web3 where it ...
2
votes
1answer
143 views

Using web3py with truffle framework

Can we use web3.py with Truffle framework ? If yes, please share such integration examples
0
votes
1answer
79 views

Error using web3.js from OpenZeppelin

Please, i need help. I am using truffle to test a smart contract. I run "truffle develop", then "migrate". The contract has been stored in the network. Then I run the command "test". An error occurred:...
1
vote
3answers
42 views

Basic question I guess but is “web3” a client in the sense that I want to use a very simple client to interact with the network?

Long story short I need a way to send programmatically a raw transaction without any bounds checkings or any checks...now I am not trying to abuse or flood the network - my goal is to attempt to send ...
6
votes
4answers
2k views

Undefined results for “web3.eth.accounts” in truffle console

truffle(development)> web3.eth.accounts[0] gives output as "undefined" truffle(development)> web3.eth.accounts instead of showing all accounts details gives the below output Accounts { ...
2
votes
2answers
220 views

Error when running Truffle Test in Terminal

I am trying to use truffle to test my smart contracts and have written some test files. I am getting an error on the terminal trying to run the test and am unsure what the reason is. I access my ...
0
votes
0answers
19 views

Can't include web3 & truffle in chrome extension

I'm trying to include web3 & truffle in my chrome extension. In npm, I'm doing it this way: const HDWalletProvider = require('truffle-hdwallet-provider'); const Web3 = require('web3'); ...
0
votes
1answer
198 views

Deploy Smart Contract to Mainnet using Truffle

I was able to deploy the contract successfully to Kovan with gas limit 350000. When i set the gas in truffle.js to 500000 for deployment to Mainnet, i get the below error: Error: Transaction cost ...
2
votes
1answer
228 views

Calling function from another contract reverts

I've been developing a dApp that needs ERC721 tokens. I have three contracts, a base contract, the one to mint tokens and another one for auctions. The inheritance looks like Base > Token > Auctions. ...
16
votes
3answers
4k views

How to check events in Truffle Tests?

What's the best way to check that events were fired in a Truffle test?
1
vote
1answer
19 views

Is there an equivalent of truffle's deployer.link() functionality without using truffle?

I'm trying to migrate a project away from using Truffle, and in the migration script, it currently uses truffle's link() function. Is there some sort of equivalent library, perhaps implemented by web3 ...
1
vote
1answer
42 views

Pass arrays to solidity's function from truffle

I am getting ALERT: Transaction Error. Exception thrown in contract code in metamask when calling addBet function from truffle. The function works without any errors when called from remix. The ...
1
vote
1answer
223 views

Error: Web3ProviderEngine does not support synchronous requests

Error: Web3ProviderEngine does not support synchronous requests. I have an error when deploying contract to rinkeby provider const HDWalletProvider = require('truffle-hdwallet-provider') module....
0
votes
1answer
60 views

When closing node (geth ropsten) I cannot save created accounts

I am pretty new to this. I downloaded the ropsten blockchain using a geth command line. Then, using Truffle, I created an account, but when I closed my node (ctrl - c on the geth command line) and ...
0
votes
1answer
41 views

Getting “gas required exceeds allowance (93846700840810) or always failing transaction” on private network. How to access geth client via nodejs?

I have recently started using Ethereum. I am trying to test my contract using multiple machines. Only solution I found was to setup a private network using Geth and add peers. Following is the genesis ...
2
votes
2answers
225 views

How would one use stubs for unit testing solidity code?

Given some contract A, that depends on another contract B, what would be the best way to unit test functions from A without inadvertently testing code from B. Normally, we could use stubs to return ...
1
vote
1answer
88 views

Transaction cost in a truffle test

I've a contract under test and the method I'm checking is supposed to transfer an amount, and in order to check I need to have the cost of the transaction. I'm using this code: var tx = await ...
0
votes
1answer
479 views

ERC20 is an abstract contract or an interface and cannot be deployed

i am trying to deploy a test erc20 token with truffle on ganache-cli My migration file name 2_deploy_contracts.js here is the code for it: var erc20 = artifacts.require('./ERC20.sol'); module....
0
votes
2answers
176 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
1answer
41 views

Payable external function call not updating state variables

I'm trying to get buyToken() to update the balance of the caller. I'm using Truffle and Ganache, running tests, but the testBuyToken() function keeps failing, apparently the BALANCES variable isn't ...
0
votes
2answers
91 views

Fetch the last state of particular asset for particular date

I have one smart contract, in which I am doing mapping of machine id and user id mentioned as below: mapping(bytes32 => uint256) public machineAllocs; machineAllocs[machineId] = userId; Now, I am ...
0
votes
1answer
255 views

ERC20 token with expiration date

I would like to create a ERC20 token with an expiration date to represent for example a ticket or a gift card. I've created a contract which overrides the open-zeppelin ERC20 contract methods. ...
0
votes
1answer
108 views

Transaction reverted when testing requires/asserts in non void functions

im trying to test the requires of a Smart Contract using just solidity according to this article: http://truffleframework.com/tutorials/testing-for-throws-in-solidity-tests This is the contract, the ...
0
votes
2answers
32 views

Not able to successfully send Transactions via MetaMask on Firefox Browser

Does anybody help me figuring out why I am getting failed transaction here?What does this error means? Few days back,with the same line of code,I was able to successfully send transactions. An update:...