Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
0
votes
2answers
103 views

Resolve solidity compiler error

I am trying to create a smart contract and I am using ganache, visual studio code and truffle for that purpose. The versions installed in my windows system are: Truffle v5.1.49, Solidity v0.5.16 (solc-...
1
vote
1answer
13 views

What is the easiest way to interact with your contract in a development environment?

Is there some form of toolkit which generates a console similar to the one on etherscan, where you can call functions that are defined in your contracts ABI? It seems quite painful having to write the ...
0
votes
0answers
33 views

Error: Contract not deployed after cloning private geth network from one server to another

Steps to reproduce: Private geth network is running on server1. Deploy contract using truffle and make a few transactions. Stop geth n/w of server1 and copy its entire directory (accounts.txt, boot....
0
votes
0answers
42 views

uncaughtException : RangeError: Maximum call stack size exceeded

Facing an issue while working multi-http-provider. When I write var Web3 = require('web3'); require('multi-http-provider'); It throws an error uncaughtException : RangeError: Maximum call stack size ...
0
votes
0answers
41 views

Error parsing @openzeppelin/upgrades/contracts/upgradeability/ProxyFactory.sol

The @openZeppelin's ProxyFactory.sol("@openzeppelin/upgrades": "^2.8.0",/"truffle": "^5.1.51") is used in development of proxy contract: pragma solidity ^0.7.0; ...
0
votes
0answers
76 views

Solidity - Setting the length of an EnumerableSet UintSet

Is it possible to pre-set the length of the set of an EnumerableSet.UintSet type? For instance, if I declare this mapping: mapping (address => EnumerableSet.UintSet) private agentTickets; and then ...
0
votes
0answers
622 views

Using Webpack getting the error 'Uncaught Error: Module parse failed: Unexpected token (32:44)

Here is the complete error Uncaught Error: Module parse failed: Unexpected token (32:44) You may need an appropriate loader to handle this file type. | if(typeof window.web3 !== 'undefined') { | ...
0
votes
0answers
28 views

Empty Address when using Truffle Debug

I currently have a local chain with Ganache. Say I have two contracts written in Solidity: Foo_v0_0_1.sol Bar_v0_0_1.sol In the code for my smart contract Foo_v0_0_1, I have the following: import &...
0
votes
1answer
273 views

Deployed contract address in Truffle does not match Ganache

I have truffle set up with Ganache. I am running tests on my solidity contract that involve sending ether to the contract and withdrawing it from the contract. Funny thing is my tests are PASSING, but ...
0
votes
0answers
138 views

Uncaught (in promise) TypeError: Cannot read property 'deployed' of undefined

I am working on a truffle dapp project. Other than init(), initWeb3(), and initContract(), I have been doing fine interacting with my contracts in several JavaScript functions, until I created my 9th ...
0
votes
1answer
2k views

ReferenceError: cannot access 'CONTRACT' before initialization

I'm trying to test a single smart contract (PCE_Contract.sol) with (PCE_Contract_test.js) using Truffle. When I run Truffle test, console output is : ReferenceError: Cannot access 'PCE_Contract' ...
0
votes
0answers
28 views

How to work around warnings of infinite gas requirements for this function

This is the warning Gas costs: Gas requirement of function SimpleStorage.data is infinite: If the gas requirement of a function is higher than the block gas limit, it cannot be executed. Please avoid ...
1
vote
1answer
38 views

How do i test “it” methods with truffle?

I have this contract: contract('MetaCoin', (accounts) => { it('should put 10000 MetaCoin in the first account', async () => { const metaCoinInstance = await MetaCoin.deployed(); const ...
1
vote
1answer
14 views

How to change the sender of a function call?

I have this code from truffle unbox metacoin: ontract('MetaCoin', (accounts) => { it('should put 10000 MetaCoin in the first account', async () => { const metaCoinInstance = await MetaCoin....
0
votes
1answer
25 views

How to create a test contract that takes parameters?

I have a contract like so: pragma solidity ^0.5.16; pragma experimental ABIEncoderV2; Contract Ballot { constructor(string[] memory proposalNames) public { } } How do I create a test-instance ...
2
votes
1answer
216 views

Error: Could not find truffle/Assert.sol from any sources;

I started a project with truffle init, and I am trying to write a test and I have an import like so: import "truffle/Assert.sol"; I get an error: Error: Could not find truffle/Assert.sol ...
0
votes
0answers
12 views

Does the Bytecode and ABI generated for each contract also include it's imports?

If not, how does a contract such as an ERC20 get deployed if each output has its own ABI and Binary file? When compiling with truffle, and looking at A.json (where A imports B and C) it seems that it ...
0
votes
1answer
91 views

What is the proper way to check if msg.sender is the contract owner?

I'm trying to make a function that returns true if msg.sender is the owner. This is my function; function isAdmin() public view returns (bool){ require(admin == msg.sender); return true; ...
0
votes
0answers
22 views

Why does this function work in truffle tests and fail through metamask?

I have the following function and it has been working perfectly in truffle tests as I was developing the smart contracts and now that I am implementing it in the front end I have been getting a error ...
0
votes
0answers
43 views

How can I get intellisense to work when writing javascript tests in truffle?

Truffle injects a global web3 instance into your tests and also seems to set up some mocha functions in the global scope (contract, describe and it). When I open the test file for a truffle project in ...
1
vote
1answer
102 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 ...
0
votes
0answers
222 views

throw new Error(“Could not find artifacts for ” + import_path + “ from any sources”);

I’m receiving then ex error: C:\Users\xxxxx\AppData\Roaming\npm\node_modules\truffle\build\commands.bundled.js:455204 throw new Error("Could not find artifacts for " + import_path + " ...
0
votes
1answer
23 views

How to access a public function in solidity?

I have a smart contract deployed on the Testnet here - https://ropsten.etherscan.io/address/0xD99ea28F24317F28291556754edd24AA1352c26e This contract has a public function triggerAgeCount function ...
0
votes
0answers
38 views

Truffle Test Error Revert in Contract Factory

I'm trying to create a contract factory that creates "Oracles". Oracles have state variables that are initialized in the contract constructor, and I'm trying to use Truffle Test to verify ...
0
votes
1answer
114 views

Uncaught ReferenceError: TruffleContract is not defined 2

Firstly, I have viewed (Uncaught ReferenceError: TruffleContract is not defined) and am getting the same error for my smart contract: However, I received this error while having the contract script ...
1
vote
1answer
475 views

Deploying Smart Contract to Rinkeby

I'm getting the following error when I try to deploy my smart contract to Rinkeby using Truffle: Error: Unknown arguments format passed to new HDWalletProvider. Please check your configuration and try ...
1
vote
1answer
57 views

How to set time based function in solidity? [duplicate]

I want to run a function after every 365 days in Solidity. I have tried to use the now keyword, but it is not working (I tried in Remix). How can I get the time?
0
votes
2answers
632 views

Installation of openzeppelin/contracts Library

I have created a node.js project, within which I have created a truffle directory and initialised its project. I have installed the openzeppelin (npm install @openzeppelin/contracts) library in this ...
0
votes
0answers
96 views

Compatible versions of npm, truffle, node and web3 for Solidity 0.7.2

I'm using: Solidity 0.7.2, Node v12.18.4, Truffle v5.1.49 (core: 5.1.49), npm 6.14.8, web3 1.3.0 I want to know what versions are compatible with solidity 0.7.2. Many thanks and have a nice weekend.
0
votes
0answers
29 views

When truffle deploy a contract to multiple network, will this contract have a unique address valid on all of them?

I think the question say it all. If I deploy some contracts on multiple network in the same deployment. Will they each have a unique address valid on all network or will they each have different ...
0
votes
1answer
43 views

I have a truffle version problem. and I've done it but it's not working

I've done npm install -g solc@0.4.16 and it reads solc@0.5.16 when doing the truffle version compilers: { solc: { version: "^0.4.26", // A version or constraint - Ex. "^0.5....
0
votes
0answers
30 views

How to work with MythX in a Truffle project to analyze a contract?

I work with Truffle and Windows Powershell. I have a smart contract. Now, I want to analyze the contract's security with Mythx. For that, I installed pip3 to install MythX CLI after that. Now, I have ...
0
votes
0answers
31 views

How to use Mocha reporter in Truffle console?

I work with Truffle and Windows Powershell. I set Mocha in truffle-config.js like: module.exports = { . . . mocha: { reporter: '...
1
vote
1answer
336 views

How to interact with a contract from Truffle console without compiling and deploying?

I am looking for a solution that does not require having the contract solidiity code compiled and deployed. For example, if I want to send approve on WETH on live network from the console, without ...
0
votes
1answer
134 views

Trying to translate proxy deployment script from Truffle to Buidler. Not sure how

I have a custom proxy. Writing a deployment script for Buidler. Know how to do something in Truffle but not sure how to do the equivalent in Buidler. Truffle let testContract = await deployer.deploy(...
0
votes
1answer
19 views

The network id specified in the truffle config (4447) does not match the one returned by the network (4777)

Please, the error messsage is in this imgur link, how's that even possible? They are the same network, but I still cannot test my smart contract via Truffle. https://i.stack.imgur.com/vykIa.jpg Code ...
1
vote
1answer
22 views

Running test with multiple contract address on a local Ganache blockchain

I'm developing with Truffle and Ganache I have an standard ERC20 ABI that I import in my test file. it only has 3 optionals functions name, symbol and decimals. const Token = artifacts.require('./...
1
vote
1answer
113 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 ...
0
votes
1answer
53 views

How to handle Ropsten's smart contracts with Truffle?

I work with Truffle, Metamask, and Windows Powershell. I deployed my smart contract to Ropsten with Truffle by the below command in Powershell: truffle migrate --network ropsten Now, I need to ...
0
votes
0answers
417 views

Swap Ether to tokens on Uniswap V2 Router Gas Estimation Error

I am trying to buy DAI tokens from my smart contract using IUniswapV2Router02: contract BuyToken { address internal constant UNISWAP_ROUTER_ADDRESS = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; // ...
0
votes
1answer
51 views

How do i change Truffle default account after contract deployment to interact with it?

I work with Truffle and Ganache along side Windows Powershell. Here, Truffle's default account is account[0]. I deploy my contract with that. After a while, i need to interact with the contract with ...
1
vote
0answers
258 views

UniswapV2 addLiquidityETH() reverting when trying to deploy to ganache locally

I'm trying to locally deploy a contract similar to sushiswap, but I keep getting a revert from addLiquidityETH(), no message other than VM Exception while processing transaction: revert //module....
0
votes
0answers
31 views

how to get public key in ethereum

Error Says Method shh_getPublicKey not Supported. How can i solve this and get public key.
0
votes
1answer
212 views

Cloning Uiswap: Error: Returned error: VM Exception while processing transaction: revert in truffle migrate

Starting to work with a uniswap simple fork using truffle and ganache, and I am having this: truffle migrate --reset Error: Returned error: VM Exception while processing transaction: revert at ...
1
vote
0answers
184 views

Which ethereum framework to choose Traffle vs Brownie?

I know that the most used frmaework for smart contract testing deployment etc is Traffle. But, since I am not very good at javascript (i am mainly coding in python)- I saw there is an option to use ...
1
vote
1answer
39 views

Pass json of address to Contract

i am wanting to import an array of json data into my contract on construct. I want to pass it an array of address to be saved into an array in my contract. Is this possible? I have seen a few posts ...
1
vote
1answer
102 views

How to test your smart contract against currently existing ones on mainnet locally using Truffle?

Background I am fairly new to smart contracts and am currently experimenting using Ganache and Truffle to test on my local machine. My goal would be to have the smart contract interacting with other ...
0
votes
1answer
66 views

Revert error on delegated transfer function

Here is my code base, first I am deploying the tokenPS contract on the tesnet which generates an addr(0xaddr) and then I am deploying the caller contract. In caller contract when I am trying to ...
0
votes
1answer
43 views

Uncaught (in promise) Error: Returned error: oversized data when calling the set method for a very large cipher string

I am using a quorum 7 nodes example with IBFT genesis file. I have modified the maxCodeSizeConfig to 128KB (which is maximum). I have also increased the gas limit to 0x3B9AC9FFFFFF. But, when I am ...
0
votes
0answers
41 views

truffle develop not working in the pc

I am using Windows 10. ** When I run "truffle develop" commend is give me an error:** λ truffle develop user@DESKTOP-V44IVRJ MINGW64 ~ $ truffle develop ExtendableError: Could not find ...

1
3 4
5
6 7
49