Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
4
votes
1answer
3k views

truffle always says “.my_function is not a function” [duplicate]

I'm trying to do my first basic smart contract, following this popular HelloWorld tutorial. However whenever I get to the part where I run a function in the truffle console, it is always telling me "....
4
votes
1answer
587 views

Truffle: How to detect test environment while running smart contract test cases?

I'm trying to run some test cases in Travis CI using truffle but I want some of them not to run if the test environment(localhost:8545) is running via "testrpc" because some of my test cases only ...
4
votes
1answer
520 views

Watching events defined in libraries

Is it possible to watch for event triggers when the actual event and trigger is defined in a library? I get no console output with the following code library ObjectHistoryLib { event ...
4
votes
1answer
980 views

Truffle Dapp Deployed Contract Access

Which function we need to use in truffle for the communication of second Dapp to the contract deployed on blockchain by first Dapp, because contract deployed by truffle is not accessible by geth node. ...
4
votes
1answer
528 views

How do you provide a GasPrice and GasLimit to overcome the “low tx nonce or out of funds” log message

I am getting the following logged by my private chain geth node when running a test in truffle: removed tx ( TX(ff8ec4f713e64fb25df07d153607e29629c9276b57e0b7e331f17b5a3c31fdd1) Contract: ...
4
votes
0answers
45 views

What's the point of Truffle Migrations?

I've been reading a few articles and StackExchange posts (e.g. What are truffle migrations?) about Truffle Migrations, but I still don't get it: why do we need them? It seems they do only one thing (...
4
votes
1answer
99 views

How to raise version of oraclize-api installed via Truffle

I'm using local instance of Oraclize API, to make truffle compile work. I've installed it by truffle install oraclize-api but for now, I'm getting following error if (oraclize_randomDS_args[...
4
votes
1answer
199 views

Can't debug transactions that fail during the Web3.js estimateGas() call? No Tx Hash

NOTE: I am doing my work with the Ganache v1.2.2 GUI client on a Linux Ubuntu 18.04 station. There are many revert errors that happen during the estimateGas() call that precedes the actual Web3.js ...
4
votes
0answers
314 views

How to get Truffle to generate artifacts for contracts outside of project?

Say I have a contract MyToken.sol which has already been deployed to a public Ethereum network. Its source is maintained in an external repository and is included in my package.json file so that it ...
4
votes
1answer
291 views

Truffle hangs forever with parity with PoA

I'm trying to create a private chain using parity (PoA) and truffle but when I do truffle migrate it hangs forever with the following output: > [ > { > "jsonrpc": "2.0", &...
4
votes
1answer
383 views

Truffle test fails to call the base function, wants the override

I have an extended ERC20 contract with ERC827 functions, which are overrides of ERC20 with an extra callback parameter. I have these two pairs of base/override functions: Base: function ...
4
votes
2answers
741 views

Run truffle test without recompile every time?

Is there a way to run truffle test and not recompile the solidity code each time? It takes a lot of time if i just want to play around with the javascript tests... Thanks!
4
votes
0answers
696 views

Truffle migrate Error Invalid number of arguments to Solidity function

Truffle 4.0.1 I've got a contract declared "is Pausable" (OpenZeppelin framework) and I want to pause it as part of the deployment logic. I'm getting an error, however, when invoking pause() Error: ...
4
votes
0answers
535 views

How can I retrieve transaction hashes using web3 batch requests?

When I send a transaction using Truffle's contract wrappers - or using plain web3 sendTransaction() - I get a tx hash back that I can use to confirm the tx has completed. While using batch requests (...
4
votes
1answer
385 views

How long does it take to “save artifacts” to Ropsten?

Migrating contracts with Truffle I get stuck at Saving artifacts... Sometimes for 10 minutes or more. I also get: Error: Transaction 0x123...123 wasn't processed in 240 seconds! Is it normal that ...
4
votes
0answers
226 views

how to get revert at the previous timestamp of evm in testrpc

I am testing my contracts so at some point i need to increase the timestamp of evm that i achieve through evm_timeIncrease but now i want to execute some functions on the basis of current timestamp ...
4
votes
1answer
320 views

How do I get configuration variables (such as gasPrice) in a truffle test?

I learned from this answer that truffle configures gasPrice in truffle.js, defaulting to 100000000000. I'd like to use gasPrice in a test, without hardcoding the raw number. Is there any way to ...
4
votes
0answers
293 views

Storing a truffle contract interface in version control

What I'm doing When I compile and deploy a contract using Truffle, I get a .json build artifact that contains information about where the contract is deployed on the network (its address). So far I ...
4
votes
1answer
596 views

Out of gas exception: error when using GUI/JS but not within truffle

I'm trying something with Ethereum and my current testing environment is Truffle. In the smart contract I have a struct with 5 fields (bytes32, bytes32, bytes32, address, bool). If a call a function (...
4
votes
0answers
426 views

Deploying contracts on geth returns {“jsonrpc”:“2.0”,“error”:{“code”:-32600,“message”:“EOF”}}

I'm trying to connect geth with truffle to deploy my contracts to my testrpc. When I run truffle deploy it's running but when I do http://localhost:8545/ it's throwing {"jsonrpc":"2.0","error":{"...
4
votes
1answer
629 views

How to use IPFS with truffle framework [duplicate]

How to use IPFS to get the hash of the document and store it on private blockchain (using go-ethereum )? consider truffle framework and solidity as contract oriented language.
3
votes
1answer
2k views

Truffle Smart Contract Testing does not reset state

I have the following javascript test for a simple ERC 20 token. Which on the call return token.balanceOf.call(accounts[2]); will fetch some old data and fail from a previous test transaction writting ...
3
votes
2answers
1k views

Truffle test, logs do not include an emitted event

I am calling a contract function which emits an event in a transaction. This transaction should include the event and is typically visible via: const receipt = await contractInstance.someFunction() ...
3
votes
2answers
2k views

Deploy contract on live testnet using private key + truffle

I want to deploy my contract on live testnet ( rinkeby) using private key instead of mnemonic of my account and truffle. I have some configurations in truffle.js but I am getting error on migrate : ...
3
votes
1answer
5k views

Truffle: how to get balance of any address or contract's address

For example I have a testing block like this: contract('CreeptomaPresale', function(accounts) { describe("adopted over allow quantity", function () { it("test get balance", async function ...
3
votes
2answers
358 views

Zeppelin OS: revert Cannot call fallback function from the proxy admin

I have been attempting to create a simple upgradable contract using Zeppelin OS: Following the tutorial I have been able to: - Create a new contract - Deploy it using zos push - Create the proxy ...
3
votes
1answer
825 views

Inheritance of constructor [duplicate]

Why does warning appear with inheritance of constructor? contract MyToken is ERC721Token{ function MyToken(string _name, string _symbol) ERC721Token(_name, _symbol) public { } The content of the ...
3
votes
2answers
3k views

Get the abi of contract

In my contact have multiple imports and successfully deployed my contract. This is my contract address 0xc2d4d839001f9d985618a22b89155ea8d6550ae6 How can get the abi of my contracts : pragma ...
3
votes
2answers
3k views

How do you get the Contract JSON Interface from Truffle?

I'm developing smart contracts using Truffle. I got the contract's bytecode through truffle compile. This produced a large json file and it wasn't too ahrd to find the bytecode. Now, how can I find ...
3
votes
2answers
894 views

Function call returns 0

Hey can someone help me figure out why this function returns 0, when I call it? The function doesn't throw any errors when I send a transaction to it, but the Ether isn't sent and the variables aren't ...
3
votes
2answers
606 views

ERC20 transfer reverts when called from one smart contract

I have an ERC20 token MyToken which seems to be working fine. I have another smart contract AirDrop, that is supposed to distribute MyToken. The sendTokens() method takes an array of addresses, and an ...
3
votes
1answer
516 views

Quorum privateFor not working with truffle-hd-wallet-provider

I'm trying to deploy a contract private to one node in the Quourm 7-nodes example. The migrate works as expected when deployed normally with truffle, but ignores the privateFor part and deploys a ...
3
votes
1answer
1k views

Contract has not been deployed to detected network

I ran truffle compile and truffle migrate to deploy my contract: admin@admin-PC ~/Desktop/Coding Projects/truffleTestProject (master) $ truffle migrate Using network 'development'. Running ...
3
votes
3answers
1k views

Return a struct from a mapping in test truffle

I want the information stored in each struct inside the mapping. This is my struct: struct BurnApply { address applicant; uint amount; string btcAddress; uint8 flag; uint ...
3
votes
2answers
1k 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 ...
3
votes
1answer
2k views

Can't retrieve Event logs with MetaMask Web3

I have no problem retrieving events with this code: contract.MyEvent({}, { fromBlock: 0 }).get((err, data) => console.log(data)) But when I use the exact same code in a browser that is using ...
3
votes
2answers
923 views

Unit Testing Date Time Values

I have a function that makes use of the current time (now). The Contract as a whole is a Crowdfunding token and the cost of tokens differ depending on the date and time that tokens are purchased. ...
3
votes
1answer
1k views

Truffle SWARM and IPFS Integration

I am now able to use truffle to deploy my contracts in my private blockchain. Now I want to understand how to integrate truffle with SWARM and IPFS for web app deployment. It will be helpful if you ...
3
votes
2answers
2k views

Truffle test - Timeout during out-of-the-box metacoin.js test

Been trying to get the standard init tests to work for a couple of hours, but no joy. Would be grateful for any assistance. Steps taken so far truffle init Fine. So far, so good. truffle ...
3
votes
2answers
862 views

Contract deployment workflow with truffle/ether-pudding

I've managed to deploy a contract on geth by unlocking the account of the node. (How this would work in production I have no idea, as I think it would pose a security risk) Now I connect with my ...
3
votes
2answers
161 views

How to test events that were sent by inner transaction / delegate call?

Usually, using truffle I can check for events like this: let { logs } = await myContract.doSomethingImportant( xxx ); // 1500 tokens are expected to get expectEvent.inLogs(logs, '...
3
votes
2answers
621 views

simple dapp with React “issues with solidity”

i am trying to build a simple app (will improve once i get the simple one to work)I created a new Reactapp, added both the contracts and migrations directories and i use ganache and metamaks. I have ...
3
votes
1answer
397 views

I'm getting an error when i have more than 3 indexed arg for an event

I want to add all the arguments for my event to be indexed event TokenPurchase( address indexed purchaser, address indexed beneficiary, uint256 indexed value, uint256 indexed amount, ...
3
votes
1answer
2k views

How to convert BigNumber returned by Truffle Console [duplicate]

I have a simple contract Foo which is deployed to a Ganache network. pragma solidity ^0.4.18; contract Foo { uint storageData; function set(uint x) public { storageData = x; } ...
3
votes
1answer
48 views

Why does truffle require 4 authorizations for 1 contract + 1 migration?

Ok looking at this I see the Migrations.sol is setup by truffle to help you migrate versions of your contract? I'm still getting prompted to unlock my wallet 2x per contract (2x per migration, 2x for ...
3
votes
1answer
1k views

Truffle sendTransaction sending eth to contract address returns revert

I have a contract address not a deployed contract instance in which i want to send ETH to but it fails giving Error: VM Exception while processing transaction: revert MyContract.deployed() .then(...
3
votes
1answer
5k views

How to pass argument/parameter to a payable function of a contract that has been already deployed, via web3 / javascript / truffle?

I'm wondering how to pass argument to a payable function of a contract that has already been deployed, via web3 / javascript / truffle. For instance, I see the following piece of code at: http://...
3
votes
1answer
191 views

Can't migrate a project more than once

I'm running a local geth node, and I have a truffle project that was already migrated once, but I'm having issues migrating additional contracts, or even updating past contracts. I create a new ...
3
votes
3answers
1k views

Deploying from Truffle to Infura.io

I'm trying to use the Infura or any other public provider to compile and migrate a simple test contract. I don't get any errors when I run truffle compile --network test but it seems to hang and ...
3
votes
1answer
886 views

Truffle compile pragma 4.10

In my contracts i'm using ether transfers which requires Solidity compiler 4.10. With newly updated truffle and solcjs version 4.10. I still get the following error using Truffle to compile the ...

1
4 5
6
7 8
42