Questions tagged [truffle]
Questions regarding the implementation and use of the Truffle development and testing environment.
2,449
questions
0
votes
1answer
9 views
Truffle Migrate Endless Run
I am trying to deploy my contracts with
const Migrations = artifacts.require("Migrations");
const Market = artifacts.require("Market");
module.exports = function (deployer, ...
0
votes
0answers
16 views
truffle flattener cannot find part of path
I am trying to flatten a solidity file but I keep getting cannot find part of path error as shown below
out-file : Could not find a part of the path 'D:\Blockchain\bullrun\src\contracts\ERC721.sol'.
...
0
votes
1answer
236 views
How to get rid of “Visibility for constructor is ignored” warning
In VS Code I get this warning in my contract constructor:
Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
So I ...
0
votes
1answer
49 views
Truffle Install // npm WARN and Vulnerabilities — How i solve that issues?
I want to start working with Solidity in my Visual Studio Code so i installed Visuall Studio Code first, then nodejs and npm and in the end i try to install Truffles.
-I work on Window 10 OS
-Nodejs ...
3
votes
1answer
122 views
deploying a simple ERC721 contract: transaction could not be decoded: could not recover secp256k1 key: calculated Rx is larger than curve P
You can check out the code here: https://github.com/lopeselio/Chainlink-VH-DynamicNFT
Command:
truffle migrate --reset --network rinkeby -f 3
Then response is as follows:
Compiling your contracts...
=...
0
votes
0answers
8 views
web3.eth.Contract send() throws error invalid sender code -32000
I'm trying to invoke ERC20's contracts transfer function but I keep getting "invalid sender" error. I checked that the from address matches the local private key I imported into ...
0
votes
1answer
18 views
Deployment Failed “Ownable” is an abstract contract or an interface and cannot be deployed
"Ownable" is an abstract contract or an interface and cannot be deployed.
Import abstractions into the '.sol' file that uses them instead of deploying them separately.
Contracts that ...
0
votes
0answers
18 views
Truffle-plugin-verify says passed but still unverified on BSCscan
Contracts deployed via Truffle are not properly verifying on the mainnet. On my end it says verification passed but on the website it's still unverified. I've been able to deploy and verify the same ...
0
votes
1answer
18 views
Testing the functions of an instance contract with truffle
I have contract A and contract B with the following structures:
contract A {
int x;
function setX(){
x = _x;
}
}
contract B {
A[] contractInstances;
function ...
1
vote
0answers
11 views
InternalCompilerError: Compiled contract not found. Contracts are correctly pointed to
Environment
OpenZeppelin 2.5.1
Truffle v5.2.4 (core: 5.2.4)
Node v15.11.0
Details
Inheriting the PostDeliveryCrowdsale into my crowdsale contract fails to compile as can be seen below, this only ...
0
votes
0answers
20 views
Truffle test doesn't seem to finish before “succeeding”, and doesn't wait for transactionHash of a sent tx!
quick problem I've been slamming my head against since last night,
My truffle (v5.2.3) test file performs two (2) tests, that serially call() then actually send a transaction to make persistent ...
0
votes
1answer
19 views
Sending Transaction From the created contract address
I am trying to deploy my Roadmap contract from the address of another newly built contract with Truffle.
I tried to do something like this:
module.exports = function(deployer) {
deployer.deploy(...
0
votes
1answer
30 views
Truffle test failing with “Error: Returned error: VM Exception while processing transaction: revert” - how can I debug it?
I'm using truffle, the ganache AppImage to run a personal blockchain, and have 2 solidity smart contracts Migrations.sol and PassportManager.sol
I'm running a truffle test and getting Error: Returned ...
0
votes
1answer
34 views
Source file compile error
...
Source file requires different compiler version (current compiler is 0.8.2+commit.661d1103.Emscripten.clang) - note that nightly builds are considered to be strictly less than the released version
...
1
vote
1answer
27 views
Test not working in truffle
Got his error when run truffle test
Using network 'test'.
Compiling your contracts...
===========================
> Compiling .\test\TestFirst.sol
> Compilation warnings encountered:
/D/...
0
votes
0answers
24 views
Truffle migration with TypeScript
I've been able to run truffle tests successfully using TypeScript, but when it comes to migration, I get stuck.
1) My current setup:
tsconfig.json
{
"compilerOptions": {
"...
1
vote
2answers
100 views
Cannot install truffle. Node.js and npm are installed
I currently have
node 12.21.0 + npm 6.14.41 + macos big sur 11.2.1 + ganache 2.5.4 + command line for xtools 12.4
I read online that truffle does not support node v13, so i uninstalled the one i had (...
0
votes
0answers
25 views
Transfer ether in solidity 0.5.16 with truffle
I am currently working with Truffle and Ganache, therefore I use Solidity compiler version 0.5.16. With that version I have some problems to send ethers. I want to transfer ether to a specific address....
1
vote
1answer
35 views
ALERT: Transaction Error. Exception thrown in contract code.(metamask)
i am working on truffle Pet-shop with react, i am using local blockchain ganache with metamask, The issue I'm encountering with my application is that when i am trying to call deleteAdopter function ...
0
votes
1answer
19 views
Out of gas for a transaction on ganache
I am developing an NFT using truffle, and I struggle to make my mint() function work :
function mint(uint256 tokenId) public onlyElevated whenNotPaused returns (uint256) {
require(totalSupply() &...
0
votes
1answer
48 views
Cannot connect to Ethereum client using truffle/ganache
I first started ganache and see in the log that "Ganache started successfully" with the RPC Server set as: HTTP://127.0.0.1:7545
While running truffle migrate command, I've received the ...
0
votes
1answer
107 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
0answers
44 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.
...
0
votes
1answer
46 views
Unable to deploy smart contract on private blockchain
I'm trying to setup a private blockchain and deploy some contracts to it. I have the blockchain running but I am running into issues when I'm trying to deploy a contract to it.
This is my genesis ...
0
votes
1answer
47 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
14 views
ESOCKETTIMEDOUT ERROR while trying to deploy to Rinkeby
Unable to deploy a simple smart contract to Rinkeby
0
votes
1answer
35 views
When I run the truffle v command in my powershell and get these results
Truffle v5.2.2 (core: 5.2.2)
Solidity v0.5.16 (solc-js)
Node v12.19.0
Web3.js v1.2.9
where is that solidity version coming from? I know i install truffle globally sometimes, so does it ship with ...
0
votes
0answers
65 views
Call contract's mint function from Truffle console
I'm trying to call my contract's mint function from the Truffle console, but I keep getting an error.
The code looks like this:
function mint(uint256 _optionId, address _toAddress, uint256 _amount, ...
0
votes
1answer
14 views
Can you use Metamask to deploy a contract with Truffle?
I've given up on deploying to mainNet with Truffle, the user experience sucks.
Is there a way to deploy using Metamask, where I can see upfront what the price will be to deploy, no suprises?
0
votes
0answers
13 views
VM Exception while processing transaction - Solved but don't know how
EDIT: I restarted truffle and migrated the contracts once again, and it worked without any errors. But, I don't know how and would love to understand this.
Explanation -
Owner creates an item, which ...
0
votes
1answer
20 views
Assertion Error
Solidity file
pragma solidity ^0.5.0;
contract Todo {
struct User {
uint id;
string name;
}
User[] public users;
uint public nextId = 1;
function create(string memory name) public ...
0
votes
1answer
70 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 ...
1
vote
2answers
53 views
Why does this contract cost 1 Eth to deploy?
Truffle is telling me that it costs 1 Eth to deploy. Is that seriously the cost of deploying a simple contract (this is my first Mainnet deploy)? Or is there something else going on?
mainnet: {
...
0
votes
1answer
39 views
Truffle config gas price confusion
I'm doing a dry run of a mainnet to get the total gas cost/
Replacing 'Migrations'
> Total cost: 0.000343902 ETH
Replacing 'EthText'
> Total cost: 0.001205478 ETH
Summary
=====...
0
votes
0answers
47 views
Why With Truffle, token is not verified in bsc test network?
As seen on the screen, I did the build process, but the verification process fails. I got the API key, I entered but it is not working Where am I making a mistake?
address: https://testnet.bscscan.com/...
0
votes
1answer
31 views
Uncaught (in promise) TypeError: work.methods.workCount is not a function
Describe the bug
I am trying to call the public variable "workCount" from a smart contract using web3
Steps to reproduce:
const work = new web3.eth.Contract(ABI,Address)
const workCount = ...
0
votes
0answers
35 views
Issue sending ETH to smart contract with web3js/metamask
So I have a simple smart contract (shown below).
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
contract Casino {
function pay() external payable{
}
...
0
votes
1answer
26 views
“Truffle Networks” spits out error and can't migrate to Mainnet
I'm trying to deploy to Mainnet (for the first time) but the initial migration (1_initial_migration) is getting stuck. Deploying to Kovan works fine and is super fast. I have enough Eth to deploy to ...
0
votes
1answer
43 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
86 views
Solidity version mismatch
My smart contract has pragma solidity 0.4.18;
According to Solidity: Best practices - Which compiler version should I use? Advantages / Disadvantages, this pragma will work on any compiler from 0.4.18 ...
0
votes
1answer
28 views
Do contracts deploy their imported dependency contracts? Or do they point to live, already deployed versions?
This is a very newbie question about deploying contracts with imported dependencies.
I'm using Chainlink's AggregatorV3Interface and SafeMath from openzeppelin.
import "@chainlink/contracts/src/...
0
votes
0answers
76 views
Estimate the cost of gas in Truffle Console?
Is there a way in the Truffle console to estimate the cost of gas for deploying a contract to mainnet?
I'm attempting to truffle migrate --network main a contract, and it's running out of gas.
I've ...
0
votes
0answers
69 views
Migration 2_deploycontract invalid or does not take any parameters
I am trying to create this token and for some reason, the second migration keeps giving me this
Migration 2_deploycontracts.js invalid or does not take in any parameters
1_initial_migrations.js seems ...
0
votes
0answers
19 views
How to use promises with drizzle/vue-plugin
I'm trying to implement a blockchain based app. I'm using Drizzle Vue plugin to interact with the methods in smart contracts. However, I stumbled across the following issue. After executing the ...
0
votes
0answers
17 views
Truffle Pet Shop Example:
I am working through the pet shop tutorial in the Truffle Suite documentation and am hitting a error and have been looking at it for a while.
What is it that actually produces the DeployedAddresses....
1
vote
1answer
15 views
Call an existing contract function from truffle console
Let's suppose an existing Ethereum deployed contract.
I know the deployment Address and i have the contract's source code.
What i want to do is to call a function on this deployed contract from ...
0
votes
0answers
215 views
Debugging reverted BSC transaction that fails only through ganache-cli
I have a Truffle migration that deploys and configures a set of smart contracts on BSC (Binance Smart Chain).
When running the migration on the actual network, it works fine.
However, when I try to ...
0
votes
1answer
143 views
web3.js Proxy Contract Error Handling
I have been working on error handling recently using the event emitter. If I call a function directly from a contract (using contract.methods.myMethod().send{from: Ganache supplied account}) with an ...
0
votes
0answers
42 views
Step by step smartcontract debugging with truffle or brownie
I am writing smart-contracts with Vyper/Brownie or Solidity/Truffle.
In order to debug and test my smartcontracts, i want to execute them step by step.
Is there a way to do that exactly like we debug ...
0
votes
1answer
31 views
Truffle Console: How to print the value of a variable using get function
I want to printthe value of iVar:
pragma solidity ^0.5.1;
contract PRetVal {
uint8 iVar =0;
function testFunc() public returns (uint8) {
iVar = iVar + 10;
return iVar;...