Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 20200

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

21 votes
Accepted

How to deploy contracts that take parameters in their initialisers using Truffle?

In your 2_deploy_contracts.js file you can add parameters when deploying the contract: var Contract = artifacts.require("./Contract.sol"); module.exports = function(deployer) { deployer.deploy(Con …
pabloruiz55's user avatar
  • 7,686
17 votes

truffle has not been deployed to detected network

Sometimes I've run into a similar issue where truffle doesn't detect changes in my contracts and either it doesn't compile it or, when it does, it doesn't migrate it (saying network is up to date). … You can try running truffle compile (and/or truffle migrate) with the --reset flag. …
pabloruiz55's user avatar
  • 7,686
10 votes
Accepted

function.call() behaves differently to function() in truffle test

With truffle you can even forgo the .call(). If the Solidity function is marked as view/constant/pure, truffle will know you are trying just to read a value and not modifying anything. …
pabloruiz55's user avatar
  • 7,686
7 votes

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

I've used this one in the past, with very good results and minimal setup: https://github.com/oraclesorg/oracles-combine-solidity git clone https://github.com/oraclesorg/oracles-combine-solidity cd or …
pabloruiz55's user avatar
  • 7,686
3 votes
Accepted

TokenTimelock gives out of gas errors when deployed within Truffle 4.0.1

Truffle 4.0 has optimization turned off by default, so you'll probably want to both increase supplied gas and turn optimization on so the gas used on creation is considerably reduced: module.exports = …
pabloruiz55's user avatar
  • 7,686
2 votes
Accepted

it should be possible to use interfaces with truffle

Check issue #67 and PR #68 on Github. https://github.com/ConsenSys/solidity-parser/issues/67 https://github.com/ConsenSys/solidity-parser/pull/68 Apparently it has been fixed but not yet released. …
pabloruiz55's user avatar
  • 7,686
2 votes
Accepted

Truffle migrate does not run 2_deploy_contracts.js

UPDATE: You can replace the code provided by the Infura / Truffle tutorial as follows, which is extremely shorter and easier to read/modify. … var HDWalletProvider = require("truffle-hdwallet-provider"); var mnemonic = "word1 word2 word3 etc"; Install truffle-hdwallet-provider package. …
pabloruiz55's user avatar
  • 7,686
2 votes

How to import a smart contract on github in a truffle contract?

The other thing you can do to use Oraclize with Truffle is just copying the http://github.com/oraclize/ethereum-api/oraclizeAPI_0.4.sol file locally and importing that file in the contract where you want … Truffle needs the contract to be named the same as the file in order to compile it, so you will need to rename the Oraclize file to UsingOraclize.sol. …
pabloruiz55's user avatar
  • 7,686
2 votes

Change gas amount in Truffle 4

Also, have in mind that truffle 4 has the optimizer turned off by default, so you'll probably want to turn it on if the contract still doesn't get deployed. …
pabloruiz55's user avatar
  • 7,686
2 votes

When using array.push in solidity contract the logs is empty (using truffle-contract)

The function you describe modifies state variables, so you can’t call them from outside solidity with call() When you remove the line that pushes the item into the array, the function does not modify …
pabloruiz55's user avatar
  • 7,686
2 votes

Return a response from selfdestruct function

There's 2 things going on in here: 1- The killContract function modifies the state of the blockchain, thus, marking it a constant/view won't work. Constant/view functions can only read state. Given …
pabloruiz55's user avatar
  • 7,686
2 votes
Accepted

testrpc requires restart after each test

You should review the test you are running. The "problem" you are facing doesn't have to do with testrpc itself but with what the test you are running does. One of the test cases invest the maximum a …
pabloruiz55's user avatar
  • 7,686
2 votes
Accepted

When writing tests in Truffle, is it possible to force specific wallet addresses to be used?

One way to achieve that would be to run testrpc always using the same mnemonic which will always generate the same accounts. You can do that by doing testrpc -m "word1 word2 word3 word..."
pabloruiz55's user avatar
  • 7,686
2 votes
Accepted

Truffle Setup Fails for some Truffle commands

You are using truffle 3.x.x. which doesn't come with it's own testrpc replacement. If you don't want to use testrpc, update to 4.x and test using the truffle develop command. …
pabloruiz55's user avatar
  • 7,686
1 vote

Why are there two types of tests in Truffle?

Truffle allows you to test your contracts either in JS or Solidity. …
pabloruiz55's user avatar
  • 7,686

15 30 50 per page