Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
40 views

Error with Truffle React (the contract doesn't have address)

Someone knows something about this error with Truffle React box? Must be my Metamask wallet address but it is already in my truffle-config file. I leave the App.js file here (I didn't make it. It's ...
0
votes
1answer
564 views

Unhandled Rejection (Error): invalid string value (arg=“x”, coderType=“string”, value=5)

Using Truffle unbox react to unbox a boilerplate. received the following error from running npm run start Changes: Addition of "memory" parameters in the simpleStorage.sol Changed unit to string in ...
0
votes
0answers
5 views

cannot get state variable of a contract deployed from a factory contract in truffle

Hello I have 2 smart contracts - Children Factory and Child: pragma solidity 0.8.6; import "./Child.sol"; contract ChildrenFactory { Child[] public children; address[] ...
4
votes
3answers
5k views

Deploying a Contract at Test Time with truffle

I'm having trouble getting my test harness set up in truffle. I have 2 contracts. The first is an Issuing authority and in order for the second to be deployed, the creation address must be ...
0
votes
0answers
8 views

Unable to deploy contract using Truffle on local network Geth : “ProxyAdmin” hit an invalid opcode while deploying

I am trying to deploy a simple contract using truffle on my local Geth network. But it is throwing the following error: Santanu@ITS-7 MINGW64 /d/xampp/htdocs/truffle_nft_example_nuxt (main) > ...
0
votes
1answer
465 views

Fail with error 'UniswapV2Router: EXPIRED'

I forked UniswapV2's factory and router and deployed them in Kovan using remix I also made sure that I am sending an ETH I also made sure that I approved the tokens But I am getting this error when ...
0
votes
3answers
375 views

How to download or access ('web3/lib/web3/event.js');

The following test script requires('web3/lib/web3/event.js'); const SolidityEvent = require('web3/lib/web3/event.js'); function decodeLogs (logs, contract, address) { return logs.map(log => { ...
0
votes
2answers
67 views

How to hide “Events emitted during test” in truffle test?

When I run truffle test and my test fails - the log gets polluted with numerous messages which make difficult to read the error message itself and other debug outputs Events emitted during test: -...
4
votes
2answers
370 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", &...
3
votes
4answers
2k 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 ...
0
votes
1answer
185 views

Unable to connect to polygon mumbai test network using truffle

I'm trying to use Polygon test network with truffle and I followed this document and youtube video to configure Polygon network for truffle. But when I'm trying to execute truffle deploy --network ...
1
vote
1answer
781 views

openzeppelin,VM Exception while processing transaction: revert

using openzeppelin-solidity to create crowdsale. Then I use this statement to Buy Token: MyCrowdsaleInstance.sendTransaction({ from: purchaser[1], value: web3.utils.toWei("0.5", "ether"), ...
1
vote
2answers
23 views

I keep getting nonce is too low when using truffle to call functions on contracts even though this works fine on remix.How can I fix this

I keep getting the nonce is too low when running functions with sub transactions on the kovan test net is there a way I can stop this from happening?these sub transactions are making transactions with ...
0
votes
1answer
83 views

Couldn't get any accounts!, Ethereum client is not configured correctly

I'm running testrpc on the default port 7545. I run truffle console and test with: web3.eth.getAccounts().then( function (result) { return result[0] }); This works fine. According to docs the ...
1
vote
1answer
171 views

Error: Truffle Box at URL https://github.com/truffle-box/bare-box.git doesn't exist. Even after updating truffle

I am getting the Error: Truffle Box at URL https://github.com/truffle-box/bare-box.git doesn't exist. If you believe this is an error, please contact Truffle support. Even after updating of truffle to ...
2
votes
1answer
293 views

Truffle Deploy gas limit exhausted

I kept on getting this error. 9/10 of my deployment will fail. But out of the sudden it will be success without any reason. I have checked the transaction receipt and indeed it had reaches the gas ...
0
votes
1answer
19 views

The contract code couldn't be stored, please check your gas limit

I tried to deploy my contracts but every time I get this error. The first two contracts were deployed successfully, but the third contract, "PostFactory.sol" is facing this issue in loops. I ...
0
votes
1answer
16 views

The second contract is not getting deployed in migration

const Input = artifacts.require("Input"); const Register = artifacts.require("Register"); module.exports = function (deployer) { deployer.deploy(Input, "test_name") ....
0
votes
0answers
10 views

I'm not able to get .json files after compile (truffle react box)

I'm using truffle react kit. It is assumed that after compile command I should get my .json files of my two contracts. But That's not happening. There's no error when I'm executing compile, but those ...
1
vote
1answer
125 views

How to call variadic function in erc223 contract

There is two transfer function in my contract, And i m trying to call transfer function of erc223 for transfer token to contract address using this function. Token.deployed() .then(function(i) { ...
0
votes
1answer
736 views

Metamask TestRPC shows 0 Ether while connecting to Ganache- CLI

I've gone through various Q/A(s) of the problem of ganache-cli and metamask not linking but after trying all the solutions, still doesn't work for me. As soon as I type ganache-cli in windows cmd ...
1
vote
1answer
103 views

Is it possible to use a smart contract without connecting to a wallet?

I've a web application where I have some structure with ids and a function to get prices by an id from an smart contract, and I've payable functions. I'm not able to show prices for each item if I don'...
1
vote
1answer
115 views

Import address truffle console with private key

Im deploying to the BSC testnet: bscTest: { provider: () => new HDWalletProvider(privateKey, `https://data-seed-prebsc-1-s1.binance.org:8545/`), network_id: 97, confirmations: 1, ...
1
vote
1answer
18 views

I'm connecting to the wrong network but my configuration seems right

Trying to run truffle console I got this typical error: I've checked my configuration and it seems OK to me (I don't know why truffle is trying to connect to 127.0.0.1). Here you can see my project: ...
1
vote
1answer
393 views

Truffle contract.deployed does not get the latest instance deployed

I am developing a back-end DApp using truffle and nodejs on a private network. My application call Contract.deployed() and print the address of the obtained Contract. When I call truffle migrate --...
3
votes
3answers
2k views

How to access in JavaScript multiple return values returned from a solidity function

My contract function returns two values. How to access the multiple return values in JavaScript from a mocha testcase? contract X { function a() pure public returns(uint,uint) { uint p=10; ...
0
votes
3answers
2k views

how to use import “@openzeppelin” in remix or import “https://github…” in truffle?

I can do import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; in truffle and import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20....
1
vote
2answers
5k views

Error: Truffle is currently using solc 0.5.8,

i run migrate in the terminalbut it shows Error: Truffle is currently using solc 0.5.8, but one or more of your contracts specify "pragma solidity ^0.4.27". Please update your truffle config or ...
1
vote
2answers
2k 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....
0
votes
1answer
579 views

ParserError: Expected ',' but got ';'

I`m trying compilate this code and getting Parse error pragma solidity ^0.6.0; contract ZooFactory { event NewZoo(uint zooId, string name, uint dna); uint dnaDigits = 24; uint ...
0
votes
0answers
29 views

Balance of ERC-20 Token suddenly changing to 0 in try/catch block

I'm coding a paymentsplitter that accepts LP tokens and standard tokens. If it's an LP token, it needs to convert them into the underlying assets, otherwise just split the payment. Since I only have ...
2
votes
1answer
233 views

Deploy smart contract on Ropsten using truffle-hdwallet-provider

I have 7 smart contracts to deploy on the Ropsten network. I am using truffle-hdwallet-provider and below is the content of my truffle.js file: module.exports = { solc: { optimizer: { ...
1
vote
1answer
140 views

Are there any virtual IoT simulators that facilitate the connection with Ethereum Blockchain?

I already built a smart contract for Ethereum Blockchain by using truffle; Now, I'm looking to connect my smart contract with the IoT environment. So are there any IoT simulators (platform, framework,...
0
votes
1answer
147 views

Compiled solidity contract run out of gas on deployment

I have a solidity contract that compiles ok (0.5.1 compiler version), but it runs out of gas if I deploy the whole of it. If I comment some of the external methods of the contract, it compiles and ...
1
vote
1answer
112 views

Smart contract - OpenWeatherMap API

I'm wanting to create a smart contract that sends an amount of ether to an address when the weather is above 30 degrees for 3 or more consecutive days, using the OpenWeatherMap API. How can I use ...
0
votes
0answers
15 views

Metamask custom rpc not sending correct contract info

I have ganache running on localhost:7545 and I'm migrating deployments to ganache using truffle migrate with truffle-config.js port set to 7545. Then I am connecting to web3 in two ways: web3 = new ...
0
votes
1answer
297 views

Getting “gas required exceeds allowance (93846700840810) or always failing transaction” on private network. How to access geth client via nodejs?

I have recently started using Ethereum. I am trying to test my contract using multiple machines. Only solution I found was to setup a private network using Geth and add peers. Following is the genesis ...
0
votes
1answer
89 views

Smart contract transaction takes different amounts of gas on different platforms

I have an ERC-20 token contract on which I want to perform some testing on a local chain. I got my chain setup, contract deployment and testing scripts ready on my Windows machine. However, since I ...
1
vote
1answer
595 views

Error when testing the contract

ApprovalContract.sol pragma solidity ^0.5.1; contract ApprovalContract{ address public sender; address payable public reciever; address public constant approver=...
1
vote
1answer
197 views

Unable to read contract instance variable from deployed contract with truffle test

I am attempting to write some unit tests as I'm working on the development of some smart contracts, but I've run into an issue that's preventing me from continuing. I'm attempting to check the address ...
0
votes
1answer
91 views

Can't use token variable's method at contract that inherit zeppelin crowdsale?

Calling the method of Crowdsale's "token" on the source that inherited Crowdsale of zeppelin v1.8.0 inevitably causes "out of gas". Error: Error: VM Exception while executing eth_call: out of gas ...
0
votes
2answers
104 views

Calling web3.eth.getAccounts() does nothing - no errors

I am trying to get all accounts using web3@1.3.3 and @truffle/hdwallet-provider@1.2.2. I am using HDWalletProvider with Infura. I am running this code on backend (Node.js v14.15.5). This is the code ...
0
votes
1answer
127 views

Truffle testing not reading contract

Here's my solidity: contract Oracle { mapping(uint => uint) oracle_values; modifier onlyOwner { require(msg.sender == owner); _; } function Oracle() public { owner = msg....
1
vote
1answer
242 views

ERC721 Transfer Event issue

Looking at the open-zeppelin ERC721 Contract's code, I see that the very last thing that its mint function is doing is call emit on the contract's pre-defined Transfer event. My question is: how do ...
1
vote
1answer
104 views

Cannot call function in openzepplin ERC1155 contract via web3/metamask

I am trying to call the balanceOf function in a pretty barebones openzepplin ERC1155 contract through metamask. I am using web3 only to generate the ABI, and metamask to actually send out the call. ...
1
vote
1answer
240 views

by using truffle & metamask deployed my contracts, but a error occurred when sending a transaction on web

This is the err information. This is the web I built. Now the problem you see is that when I click the vote button, pay the gas, and send a transaction, but than error occurred. I write my program ...
0
votes
1answer
91 views

Quorum 7nodes example unable to finish simplestorage migration using privateFor

I'm following this example: truffle quorum example I created a cluster using docker-compose and all the nodes are up and running but when I run the truffle migrate command the migration doesn't end ...
2
votes
1answer
6k views

truffle test fails with ReferenceError: A is not defined

I am not sure what is missing. I keep getting "Reference error". Please find the details below Step 1 : Ubuntu# truffle compile Step 2: Ubuntu# truffle migrate --reset Using network 'development'....
0
votes
0answers
6 views

Truffle test accounts

I'm trying to run unit tests with Truffle but the accounts being generated during testing are not the same as the ones generated at compile time. Is there a way to configure these?
0
votes
0answers
15 views

Truffle incompatible with ESMs (ES5 / ES6 modules with “type”: “module” in package.json)?

is it possible to execute truffle commands inside a folder in "ESM mode", i.e. package.json contains "type": "module", uses import instead of require etc.? Here is what I ...

1
2 3 4 5
52