Questions tagged [truffle]

Development environment, testing framework and asset pipeline for Ethereum

Truffle is a development environment, testing framework and asset pipeline for Ethereum, aiming to make life as an Ethereum developer easier. With Truffle, you get:

  • Built-in smart contract compilation, linking, deployment and binary management.
  • Automated contract testing with Mocha and Chai.
  • Configurable build pipeline with support for custom build processes.
  • Scriptable deployment & migrations framework.
  • Network management for deploying to many public & private networks.
  • Interactive console for direct contract communication.
  • Instant rebuilding of assets during development.
  • External script runner that executes scripts within a Truffle environment.

Github Repository

Official Website

1088 questions
3
votes
1 answer

SyntaxError: Unexpected identifier in TypeScript on import Web3 from "web3"

I'm setting up a Node.js environment in Visual Studio Code to debug Truffle for Ethereum development. I open the truffle source folder in VSCode, then select truffle-migrate/index.js file, press F5 and after I fix a bunch of unresolved imports, I…
Dimitri Lozovoy
  • 403
  • 1
  • 3
  • 13
3
votes
1 answer

Truffle Test - How To Show Errors Only

How does one suppress all compilation warnings (not errors) when running truffle test? Using the --quiet parameter does not seem to work. Truffle v5.0.0 (core: 5.0.0) Node v10.15.3
trajan
  • 1,093
  • 2
  • 12
  • 15
3
votes
2 answers

Why Could not find artifacts for contract from any sources

I am using windows 10 with truffle and ganache-cli. I have 2 contracts file to be deployed contain interfaces of other contracts defined within the contract: Contracts: ERC721Mintable.sol Ownable Pausable is Ownable ERC165 ERC721 is Pausable,…
Sagar Atalatti
  • 486
  • 1
  • 8
  • 21
3
votes
2 answers

How to read public variable in solidity with truffle test codes?

I try to get a value from my public variable in solidity with truffle console, but I don't know the correct syntax. truffle version Truffle v5.0.14 (core: 5.0.14) Solidity - 0.5.4 (solc-js) Node v11.10.1 Web3.js…
June
  • 346
  • 4
  • 16
3
votes
1 answer

creating a contract using solidity butit doesn't execute

I'am building a local blockchain using etherium.I wrote a smart contract "Hello" that allows to display a phrase. when I execute truffle.compile an error occurs: No visibility specified. Did you intend to add "public"? pragma solidity…
MS B
  • 199
  • 3
  • 14
3
votes
2 answers

Truffle deploy compiles contracts but doesnt migrate to network

As shown below, when running truffle deploy contracts are being compiled in /build directory, but they are never migrated to the specified network. There are NO LOGS at all for truffle deploy to allow debugging of the issue. even while running…
Ghassan Zein
  • 4,089
  • 3
  • 19
  • 30
3
votes
1 answer

Cannot exec simple javascript file into Truffle

I have a file x.js which works fine on it's own. function test() { console.log("test"); } I want to include this into truffle, so I do the following truffle(development)> exec ./x.js Using network 'development'. TypeError: fn is not a…
Peter Prographo
  • 1,141
  • 1
  • 10
  • 27
3
votes
1 answer

Revert on ERC20.transferFrom

My code is reverting when testing a function that contains a transferFrom. The revert is isolated to this line, when commented out, it runs fine. My (wrong) hypotheses so far: Issue approving tokens (wrong from address, or wrong Loan contract…
isaacsultan
  • 3,784
  • 3
  • 16
  • 29
3
votes
3 answers

Uncaught Error: Invalid Address web3.currentProvider MetaMask

I have deployed my ERC721 contract to Rinkeby TestNet. The contract has been deployed successfully. I unable to invoke transactions with MetaMask. Spent the whole day looking to resolve this issue. Found some answers stating it the issue with…
Sagar Atalatti
  • 486
  • 1
  • 8
  • 21
3
votes
3 answers

Truffle test fails with Error: Could not find artifacts

I learn the demo: Code is come from: https://truffleframework.com/tutorials/pet-shop, when I test: $ truffle.cmd test Using network 'development'. Compiling .\test\TestAdoption.sol... TestAdoption 1) "before all" hook: prepare suite 0 passing…
SmallMan
  • 144
  • 1
  • 2
  • 11
3
votes
1 answer

how to create new ethereum/solidity contract for each test in javascript/truffle

background I have written an ethereum smart-contract in the Solidity language. In order to test things, I can run a local node using Ganache and deploy my contract on it using truffle migrate. requirements I want to test my contract using…
mareoraft
  • 3,474
  • 4
  • 26
  • 62
3
votes
2 answers

How to deploy multiple solidity smart contracts that uses functions of each other?

I have three smart contracts say a.sol, b.sol and c.sol... Out of these three, first two are independent smart contracts whereas c.sol uses the functions of a.sol and b.sol and thus c.sol requires to "import" the first two smart contracts. "Import"…
3
votes
1 answer

How to test contract with multiple accounts / addresses in truffle?

I want to test my truffle contract with multiple msg.sender addresses. Like "the first user sell token, the second user buys this token". For one address I simply write something like contract.buy.value(10 wei)();. But where I could get another…
Kroid
  • 1,081
  • 2
  • 12
  • 22
3
votes
1 answer

How to test payable method in truffle?

I'm trying to test smart contract's payable method in truffle framework: contract Contract { mapping (address => uint) public balances; function myBalance() public view returns(uint) { return balances[msg.sender]; } function deposit()…
Kroid
  • 1,081
  • 2
  • 12
  • 22
3
votes
2 answers

Time delay in Truffle Tests

I am writing test cases for my contract and have to delay the assertion check because it is time sensitive. getCompletedCampaigns() will have the address of the Campaign whose deadline has passed. it("Time sensitive check", async () => { var…
Sushant Kumar
  • 435
  • 7
  • 24