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
34 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
209 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
117 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
355 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
58 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
22 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
249 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
12 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
15 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 ...
1
vote
2answers
859 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
43 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
336 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
782 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
671 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
82 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
254 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
381 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
69 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
19 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
74 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
23 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
395 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
125 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 = ...
15
votes
3answers
6k views

How to pass constructor parameters to a contract using Truffle?

I am using testrpc and truffle for deploying contracts.I want to pass constructor parameters while deploying. contract User { string public userName; function User(string ...
2
votes
2answers
364 views

Error: Unhandled Rejection (Error): This contract object doesn't have address set yet, please set an address first?

I was learning Solidity through Remix and I decided to make a simple front-end application with pure HTML and CSS, it worked using Rinkeby. Then I discovered Truffle and since then I try to make the ...
0
votes
0answers
27 views

Owner of contract is set to contract address?

I just testing a contract with truffle and Im wondering why the owner of the contract is set to the contract address itself. Migrations: const contractA= artifacts.require("ContractA"); ...
1
vote
1answer
24 views

Fail to deploy contract on rinkeby using truffle and metamask

Following is a snippet from my truffle-config.js file networks: { // Useful for testing. The `development` name is special - truffle uses it by default // if it's defined here and no other ...
1
vote
1answer
34 views

Solidity: ParserError: Expected pragma, import directive or contract/interface/library definition. function

I am using Truffle together with Ganache and I can't get this code to run: pragma solidity >=0.4.21<0.6.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@...
0
votes
0answers
26 views

Deployed truffle contract: Cannot create instance of <contract>; no code at address

I deployed my contract at 0xa518a732606baae1c72490313cb7bb42c62c7a50. Now, what I try to do is to interact with my functions.. I've created an node.js application over web3 and truffle/contract but I ...
0
votes
1answer
143 views

truffle solc specific compiler fail

,/C/Users/juhne/ipfs-image-dapp/contracts/Migrations.sol:1:1: ParserError: Source file requires different compiler version (current compiler is 0.5.16+commit.9c3226ce.Emscripten.clang - note that ...
0
votes
1answer
18 views

Error in passing a contract or interface as parameter to a function

I have seen some examples of Contracts where people are passing other Contract or Interface as a parameter. (Linear example, Synthetix example. However, when I was trying it in one of my contracts, I ...
0
votes
1answer
89 views

Execution gas cost

I use web3 and truffle to get info about my testnet transactions. There are few fields about gas used per transaction, such as: gasPrice, gas, gasUsed. But how to get field 'execution cost'?
0
votes
0answers
14 views

Error in running truffle test [duplicate]

D:\Truffle Projects\payable>truffle test Compiling your contracts... =========================== > Compiling .\contracts\First.sol > Compiling .\contracts\Migrations.sol > Compiling .\...
2
votes
1answer
1k views

How to turn off specific warnings for the solidity compiler?

Whenever I use pragma experimental ABIEncoderV2 and truffle, I get the following warning in the terminal: Warning: Experimental features are turned on. Do not use experimental features on live ...
2
votes
1answer
394 views

How to implement percentage deposit function to smart contract

I need to implement on the deposit function when the ownerAddress is doing a deposit a 10% to be freeze in the smart contract and and if the ownerAddress want's to call the returnDeposit function by ...
0
votes
1answer
122 views

Im getting the following error: ParserError: Expected primary expression. struct ManagingOrder.Parking memory new_Parking = Parking({

Im using blockchain technology for the first time, for a college project. Im trying to run a smart contract from Github. After debugging the errors shown while compiling the smart contract (in ...
0
votes
1answer
53 views

problem with sequence deployment

I followed this way of deploying contracts using truffle. // Deploy A, then deploy B, passing in A's newly deployed address deployer.deploy(A).then(function() { return deployer.deploy(B, A.address)...
0
votes
0answers
16 views

Error: Returned error: VM Exception while processing transaction [duplicate]

Gettting Error: Returned error: VM Exception while processing transaction function getLatestPrice() public payable returns (int) { ( uint80 roundID, int price, ...
0
votes
1answer
2k views

Specify different solc compiler for different files in truffle?

I am using truffle, and have a number of x.sol files in the contracts directory, different files require different versions of the compiler - how do i deal with that? I think i SHOULD be able to do ...
1
vote
1answer
56 views

How can I add new contracts generated from a factory to my drizzle-react app?

I have a Factory contract which creates new contracts. How do I get the new contract into my drizzle-react web app? I am using to send the transaction to create a new contract but I don't know how ...
0
votes
0answers
10 views

Signer Address Recovery

I have these 2 functions in my contract with help of which I want to recover the address of the signer: function formSigningData(address NFTAddress, uint NFTId, uint amount, address tokenAddress, uint ...
0
votes
2answers
110 views

promise chaining in test.js file

it("should throw an exception if you try to buy an article that does not exist", function() { return ChainList.deployed().then(function(instance) { chainListInstance = instance; ...

1 2 3
4
5
50