Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
450 views

Truffle-contract error on deployed contract

Playing around with the gnosis multisig, using truffle-contract to interact with already deployed MultiSigWallet using truffle migrate. Contents of the file I am trying to run: var contract = ...
0
votes
1answer
421 views

Truffle test: error when passing more than one file as input

I have several test files, which I can successfully execute via truffle test (having started a ganache-cli process). For example: ganache-cli truffle test test/test1.js truffle test test/test2.js ...
13
votes
2answers
4k views

What are artifacts in truffle?

Your build artifacts are saved within the ./build directory, along side the compiled deployed contract artifacts in ./build/contracts. What exactly are these artifacts?
0
votes
1answer
31 views

Big discrepancy between the cost of deploying to the test net and the main net

I have a simple 100-line contract with 6 functions that I want to deploy to the main net. When I deploy it to the Rinkeby test net through Truffle, I get the following result: Summary ======= > ...
4
votes
1answer
354 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 ...
1
vote
1answer
102 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
2answers
601 views

Solidity & truffle: get elements from strings array

i'm glad to follow this forum, it is very helpful. I'm using truffle to develop contracts and i just found that dynamic arrays are not yet suported, for that reason i was using string arrays with a ...
0
votes
1answer
59 views

Error parsing openzeppelin. Expected pragma, import directive or contract/interface/library definition

None of the solutions that I saw solved this issue. When I do truffle compile I get this error Error parsing @openzeppelin/contracts/GSN/Context.sol: ParsedContract.sol:15:1: ParserError: Expected ...
0
votes
0answers
31 views

Undeclared identifier _setTokenURI in ERC721

I'm using pragma solidity ^0.8.0; I heard that _setTokenURI was removed in pragma 0.8.0 I tried these options https://forum.openzeppelin.com/t/function-settokenuri-in-erc721-is-gone-with-pragma-0-8-...
0
votes
1answer
41 views

Truffle test doesn't connect to Ganache

I'm using Truffle and Ganache for my development environment. Using the truffle console or truffle external scripts everything works fine, but truffle test does not seem to be connected to Ganache: ...
2
votes
1answer
62 views

Truffle: how to override compiler settings via the CLI?

This is a highly specific bottleneck encountered when using Truffle. In my normal truffle-config.js file, I have the optimizer enabled. I run a CI pipeline which has a coverage job. I use 0x/sol-...
0
votes
0answers
10 views

Truffle test - doesn't send funds to msg.sender

it seems like I have a wrong gnache or truffle setup ... I already ask a simular question here: Owner of contract is set to contract address? Basicly there is some mess up with addresses on my local ...
0
votes
1answer
13 views

“Uncaught ReferenceError: TodoList is not defined” as I tried to call Todolist.deployed() in truffle console

I was trying this Beginner tutorial on smart contracts and solidity. I typed truffle compile, truffle migrate and they ran without any error and I got my gas cost used up in Ganache. When I opened ...
1
vote
2answers
700 views

How to inherit an interface?

This code works - taken from Wiki - pragma solidity ^0.4.18; contract ERC20Interface { function transfer(address to, uint tokens) public returns (bool success); } contract FixedSupplyToken is ...
0
votes
1answer
192 views

How to creating multiple NFT tokens using ERC1115

I am new to solidity and ethereum network. I have knowledge of developing erc20 and erc721 tokens using openzepplin. But I am curious about erc1155. Also I have check the erc1155 documentation at ...
1
vote
1answer
159 views

Correctly compiled contract on remix returns empty ABI

I have two questions. My contract has compiled and deployed successfully both using remix and truffle. However: q1) remix returns an empty array of ABI. Also, after I hit compile the contract at the ...
1
vote
1answer
276 views

Error: project ID is required

I have a truffle project which was running on another machine without problem. But now I'm trying to npm install and I'm getting this error: >truffle install Error: project ID is required at ...
1
vote
1answer
42 views

how to verify a contract using truffle-plugin-verify

I'm trying to verify a simple contract. The contract is already deployed on the Ropsten network. import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/...
0
votes
0answers
11 views

How to make a deployer in truffle tests?

For some reason, our app will only work with a forked instance of the mainnet. And hence, we want to run our test on the forked ganache. We are using truffle, so we have written all of our tests in ...
0
votes
1answer
30 views

When I run truffle compile I get a ParserError: syntax error

Error i'm getting back when I run truffle compile ParserError: Expected ';' but got 'contract' How my contract looks: pragma solidity ^0.6.0; import "@openzeppelin/contracts/token/ERC721/...
1
vote
1answer
95 views

UniswapV2 addLiquidity revert ds-math-sub-underflow

I'm trying to use Uniswapv2Router with Truffle and Ganache, but haven't been able to identify what I'm doing wrong. I'm using addLiquidty method as follows: await uniswapV2Router02.addLiquidity(token0....
2
votes
1answer
115 views

How to trace the line where a tx failed in truffle tests?

I know about 0x's sol-compiler and sol-trace. I used them before and they do exactly what I'm looking for, but these modules bring significant overhead when used with truffle. Check out this file to ...
0
votes
1answer
337 views

Compilation Error

Hi guys I got this error when I try to compile using truffle develop. truffle(develop)> compile Compiling your contracts... Compiling ./contracts/StarNotary.sol /mnt/d/Blockchain/...
0
votes
1answer
36 views

Truffle console call contract without ABI (Ganache Forked BSC)

So I started Ganache-cli with -f option to fork the BSC (ETH FORK), and in the truffle console I want to interact with some smart contracts that are not mine nor I deployed them, how can I interact ...
0
votes
1answer
19 views

Connect local frontend with smart contract on ropsten

I'm new to DApp programming an I'm struggling with this problem since two days now. Cloned this github example: https://github.com/dappuniversity/election I deployed the smart contract to ropsten with ...
0
votes
0answers
16 views

Using functions from a library

I'm working on a Dapp for voting in a municipality and national election. There is a lot of code, and I've met the max limit of the contract size many times but have been able to keep it under the ...
0
votes
2answers
212 views

Can't install Truffle Framework to Mac OS Big Sur

so I checked to see if I had the latest version of nodejs, and it turns out that I do. kalebamarante$ node -v v15.5.0 then I tried installing a version of Truffle and it didn't work ~ kalebamarante$ ...
0
votes
0answers
10 views

Truffle test is failling with transferFrom.call

When I run tests with the following code, I get the following error: Error Error: Returned error: VM Exception while processing transaction: revert Tests it('Handles delegated token transfers', () =...
0
votes
1answer
14 views

expectEvent with string returning a non-string value

I am using expectEvent from OpenZeppelin's Test Helpers, and when running a Truffle test to check the event, it's all fine for address and integer fields, but have an issue for string type. Given a ...
0
votes
2answers
852 views

Error: VM Exception while processing transaction: revert: When trying to migrate a truffles initialised contract?

I'm trying to migrate/deploy a multi-signature contract through truffles, I am receiving "Error: VM Exception while processing transaction: revert" when the contract starts to migrate/deploy. ...
1
vote
1answer
92 views

Initiate transaction from server to smart contract

In my case, i have an API written in PHP which periodically checks the database. If certain condition was met, i need to send an alert message from the API to an account/node in the Ethereum ...
0
votes
2answers
1k views

Truffle migrate to ganache-cli (testrpc) hangs on deploying Migrations.sol

I am trying to truffle migrate Metacoin to debug why Tuffle migrate is not working to testRPC/ganache-cli. It gets hung up on deploying for testRPC/ganache but if I do it from truffle develop and not ...
1
vote
1answer
36 views

Dapp using react-native and truffle

I have a blockchain dapp which is working fine in web browser. Wallet : Metamask OS : Ubuntu 20 Node : 10.19.0 Npm : 6.14.4 But, I would like to run the dapp in mobile view using truffle ...
1
vote
1answer
331 views

Solidity Error:Running Out of Gas / selfdestruct problem

I've been going through 'Building Cryptocurrency and its ICO' by DappUniversity. I know many have questioned this issue and I've been through all the post but couldn't resolve it. The problem is self-...
1
vote
2answers
765 views

Import error in Truffle Pet Shop tutorial

I'm executing an example in the Truffle Pet Shop tutorial. While testing with file TestAdoption.sol, I have encountered the following error: Source truffle / Assert.sol not found The source code ...
5
votes
2answers
641 views

Deploy pre compiled bytecode using truffle migrations deployer api

I want to deploy pre-compiled Smart Contract bytecode using Truffle migrations. Specifically, it is the Uniswap V2 Factory contract. In the Uniswap V2 documentation there is a cliffhanger, where they ...
0
votes
1answer
77 views

Truffle not working after install using npm

I just tried to install truffle using npm. I followed the documentation and did npm -g install truffle However, after that, when I try to do anything (such as just run truffle or truffle --version), I ...
0
votes
1answer
243 views

Manage accounts in Remix Web3 Provider env connected to a TestRPC client node

When I run the TestRPC client (ganache-cli), it provides me with 10 different accounts and private keys along with a local server at localhost:8545 Available Accounts (0) ...
5
votes
1answer
373 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 ...
0
votes
1answer
66 views

Why do I always get “Returned values are not valid, did it run Out of Gas”?

I'm new on Ethereum blockchain and I'm working on deploy and using smart contract using truffle on my private blockchain. I have followed exactly this guide https://www.trufflesuite.com/docs/...
0
votes
0answers
18 views

Debugging mainnet contract [duplicate]

I'm hoping to be able to debug a main net transaction without needing to pay the gas fees to have it fail. Metamask tells me that it is going to cost 1.8 eth to run the transaction so I cant exactly ...
2
votes
5answers
1k 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.
5
votes
3answers
1k views

how to check if an event was added to the log in a contract constructor

when executing a transaction in truffle tests, the return value is the transaction receipt and one can check for the presence of a particular event in the logs. this is not possible when the ...
0
votes
1answer
66 views

Cannot Deploy to Rinkeby using Truffle, Infura, and Node

I am trying to deploy a contract to Rinkeby using Node and Truffle but I get a lengthy error: Truncated Error: Attempting to deploy from account 'MYACCOUNT#' [object Object] [object Object]...
0
votes
1answer
22 views

How can i properly git a truffle/react project

Here is what i've done in a blank directory: $ truffle unbox react $ npm install @openzeppelin/contracts $ npm install @openzeppelin/test-helpers $ npm install @truffle/hdwallet-provider Then, i have ...
0
votes
1answer
391 views

web3 Uncaught TypeError: Cannot read property 'createBox' of undefined

i'm trying to create simple application by using solidity 5.0.0 , Truffle v5.0.0 and web3 web3@1.0.0-beta.34. but i've gotten Uncaught TypeError: Cannot read property 'createBox' of undefined. ...
1
vote
1answer
13 views

Explore transaction from truffle test file

I have create this test: const { expectEvent } = require('@openzeppelin/test-helpers'); const MyContract = artifacts.require('MyContract'); contract('MyContract', function (accounts) { const [...
0
votes
3answers
1k views

truffle migrate --network ropsten issues

When i run truffle migrate --network ropsten i don't see the contract deployment but just Compiling your contracts... =========================== > Everything is up to date, there is nothing to ...
1
vote
1answer
117 views

Solidity - Error: Digest method not supported when calling ripemd160

As part of a large project I am attempting using ripemd160 in solidity. Ive boiled down the issue that im having to the code below, when calling ripemd160 I get the error: Error: Returned error: VM ...
8
votes
2answers
2k views

Truffle — testing enum values

I am using truffle to develop a simple smart contract. I have the following contract: contract Puppy { enum State { good, bad } State public status; State public constant INITIAL_STATUS = ...

1 2
3
4 5
50