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
4 views

Error in Truffle deployment

When I run truffle compile, I run into this problem: UnhandledRejections detected Promise { <rejected> Error: EACCES: permission denied, open '/Users/user/Desktop/AAA/AAA/build/contracts/...
0
votes
1answer
11 views

ParserError: Expected ',' but got '}'

I saw similar questions, but my problem is not matching any of those answered questions. I've written a function in a library that also includes in-assembly code but getting an unexpected parser error....
0
votes
1answer
11 views

Problem approving allowance using external Metamask Account with local Ganache

I am using React, to interact with a smart contract deployed on local Ganache, I can approve allowances to accounts generated by Ganache, but I can't approve allowance with Metamask accounts which ...
0
votes
1answer
10 views

Javascript testing vs remix

So what would be the benefit of testing the smart contracts using javascript with truffle instead of remix? I just feel is really tedious. I'm guessing there is a reason, but I don't see it, so should ...
0
votes
0answers
5 views

simulate the passage of time with ganache-cli [duplicate]

I'm building a test suite for my contracts in ganache-cli using mocha. I'm currently testing a time locked contract and, to be able to assert some behaviors, I'd need to simulate the passage of some ...
0
votes
0answers
18 views

Transaction Error on Creating a Smart Contract with a deployed Smart Contract in Web3

I am trying to create a Contr smart contract object with deployed SystemAPI contract, but I get a transaction revert error upon calling it. SystemAPI contract: pragma solidity ^0.8.0; import "./...
0
votes
0answers
8 views

How to deploy vyper contract with arguments using truffle?

I am trying to deploy a contract written in Vyper using Truffle migrations, but the parameters I am passing to deployer.deploy() are not being used in the vyper contract initialize() function. Is ...
0
votes
0answers
5 views

How to make function selector of the function from another deployed contract

I want to make the function selector of a function that is being interacted from another deployed contract. My code goes like this... interface Ierc20 { function mint(address to, uint amount) ...
1
vote
0answers
14 views

What is the right way to manually interact with contracts in Ganache?

I've deployed and properly configured MetaCoin with Truffle and Ganache. But I don't see a way to actually interact with the deployed contract via Ganache's UI? https://trufflesuite.com/docs/ganache/...
0
votes
0answers
5 views

Nothing returned from `truffle develop` command on powershell

I'm new to web3. I'm trying to deploy a smart contract to the Ganache core ETH development node using Truffle. However, when I ran the truffle develop command, the console is stuck and does not do ...
0
votes
1answer
13 views

Should I care about these benchmark values?

Let's say I have a contract which, for the sake of this post, inherits OpenZeppelin's Ownable. I made a minor update (in terms of code / complexity: an override & revert to disable a method). Then ...
0
votes
0answers
33 views

Why I can't push items into this array?

it's very tricky, when in the truffle , I call f(),it can't push an item into addressArray.(console.log(addressArray[0]) always unidifined)) but when I use Remix, it worked. pragma solidity ^0.6.6; ...
0
votes
1answer
14 views

Could not find artifacts for " + import_path + " from any sources

I'm working through a Solidity course on Udemy. I'm trying to run migrate on truffle. Here's my code: MyToken.sol // contracts/GLDToken.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; ...
0
votes
1answer
22 views

Address of deployed contract in hardhat

Whenever you deploy a contract in truffle the generated abi is in build/contracts/contract.json. In this json there is also the address of the contract and I can import it in my other files. In ...
0
votes
0answers
8 views

Expected primary expression: {from: proposer}

According to the docs of TimelockController.sol The proposers are in charge of scheduling (and canceling) operations. This is a critical role, that should be given to governing entities. So, the ...
1
vote
1answer
35 views

How much can I trust on the truffle test gasUsed value?

I'm trying to guarantee that I'm not going to require more than the 200k gas limit on VRF fulfillrandomness call. I'm running the truffles test and they present to me gasUsed on the txn value of the ...
0
votes
1answer
19 views

Type bytes memory is not implicitly convertible to expected type bytes calldata

I'm using the openzeppelin library of TimelockController.sol. Specifically using the library's schedule function. function schedule( address target, uint256 value, bytes ...
0
votes
0answers
7 views

Can't get event logs with web3, got empty list

I have a simple contract that emits events on payment // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract ThisBalance { event TestEvent(string text); receive() external payable {...
0
votes
1answer
13 views

How can I invoke the fallback method with sendTransaction?

I'm testing the delegatecall vulnerability. And I've created two contracts to do that. WalletLibrary.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract MyWalletLibrary { uint ...
0
votes
1answer
14 views

Can't call methods with ether

I have a simple contract: // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract Reentrancy { mapping(address => uint256) public balances; function depositFunds() external ...
1
vote
0answers
37 views

Not able to call any method from contract in react js app (Solidity, Ganache, Truffle & React)

Not able to call any method from contract in react-js app, but if I print contracts in console, I can see all the methods that I've define in contract. I have also upload this project to git here is ...
0
votes
0answers
23 views

Does anyone know how to use TimeLockController.sol from openzeppelin

I want to use the openzeppelin timelock controller contract in a way that it calls the functions of other deployed contracts at some time. The thing can be done with the openzeppelin timelock ...
0
votes
1answer
6 views

Passing Contract's variable as param constructure of another contract when migrate truffle

This are my contracts: Token.sol contract Token is ERC20 { address public admin; constructor () ERC20("SimpleToken", "SIM") { admin = msg.sender; _mint(msg....
0
votes
0answers
45 views

"Migrations" ran out of gas

I am trying to deploy 3 contracts to Avalanche. I have already deployed these same contracts to Ropsten, Rinkeby, and Ethereum mainnet. When I try to deploy to Avalanche, I get this error message: ...
1
vote
1answer
25 views

How do I set required gas fee to zero for localhost on Metamask?

I'm doing a Solidity tutorial and trying to get a React example up and running. I've got Truffle running and when I run npm start and Chrome connects to localhost, Metamast says "Insufficient ...
0
votes
1answer
21 views

Why can't I see my updates I made with truffle test in ganache?

making my first steps in blockchain technique I picked the most simple example SimpleStorage I'm using truffle and ganache. I coded the contract simple_storage.sol: // SPDX-License-Identifier: MIT ...
0
votes
2answers
69 views

Why are my smart contract rinkeby transactions failing?

I deployed a smart contract in rinkeby network, and I have no problem deploying the contract. But when I try to run method addClient() it always fails (Seems to be gas issue). I tried changing gas ...
0
votes
0answers
27 views

Error: Returned error: VM Exception while processing transaction: revert Transaction failed -- Reason given: Transaction failed

I am following a youtube tutorial for coding a smart contract for a MultiSigWallet. The code is working fine in Remix. All the functions, submitTransaction, confirmTransaction and executetTransaction ...
0
votes
0answers
23 views

Truffle deployment error in VS code [duplicate]

I am using Ganache and Truffle to deploy a practice smart contract from VS code. When I run: HelloWorld.deployed().then(function(instance){return instance}); in the truffle development console, I get ...
0
votes
2answers
20 views

Correct default development blockchain port for truffle

How is the truffle port set when one runs truffle unbox react and then truffle develop ? The documentation states that the default port is 9545 (https://trufflesuite.com/docs/truffle/getting-started/...
0
votes
0answers
15 views

Ganache Storage not updated after minting ERC721 token

I am using a standard OpenZeppelin ERC721 token API to mint a NFT. The code looks as below: pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@...
0
votes
0answers
8 views

Why don't we have to import web3.js into testing js files? [duplicate]

As a newbie to solidity, this is my code for testing some smart contract that I wrote, by following a tutorial. The name of the file is "EthSwap.test.js" and I'm using "truffle". ...
0
votes
1answer
21 views

TypeError: Greeter.deployed(...).greet is not a function

Getting error Code: address payable owner; constructor () { owner= payable(msg.sender); } function kill() public { if(msg.sender== owner) {selfdestruct(owner);} } } ...
0
votes
2answers
54 views

ERC20 Token deployed to Ganache not seen on Metamask

I connected my truffle project to the ganache network. Also I added ganache network into the metamask. After deploying erc20 contract to ganache, I can see my account's token balance on truffle ...
0
votes
0answers
8 views

Should I test the flattened ERC20 contract in truffle?

I have an ERC-20 contract that I have deployed successfully on the Rinkeby testnet. I have also successfully verified the contract so that I can interact with it on Etherscan. I am learning Truffle ...
1
vote
1answer
45 views

Deploying multiple contracts (.sol files) to one contract address

As an exercise, I am trying to deploy a large contract that is greater than the 24kB limit imposed by the Spurious Dragon hardfork. So, I am looking at Uniswap V3 as an aim and my goal is to deploy a ...
0
votes
1answer
18 views

Contract address balance function returns BN in truffle but actual balance in remix

I am very new to solidity, contracts, and truffle, and I ran across a disconnect between the results of calling the getBalance() function of this basic contract: contract TruffleTutorial { address ...
1
vote
2answers
30 views

Web3 + React: After successful transacion, try to get changed state but returns old value?

I'm trying to do something pretty simple using React, but I can't understand what's going on. const A = await myContract.getA() // A = 0 myContract .setA(1) // should set A = 1 => ...
0
votes
1answer
8 views

Error: Returned error: sender doesn't have enough funds to send tx. The upfront cost is: xxxxxxxxx and the sender's account only has: xxxxxxxxxxx

I'm trying to run a huge test suite(around 50 test cases) using Truffle and after around 18-20 test cases pass I'm getting this error for the remaining test cases. The tests seem to be running fine ...
0
votes
0answers
22 views

How to access different contracts with same name in Truffle

I deployed three contracts where the contract itself is same but the parameters are different. const Token = artifacts.require("Token"); module.exports = async function (deployer) { // ...
0
votes
0answers
15 views

Could not connect to your Ethereum client with the following parameters

Following my first tutorial on truffle, zeppelin and ganache (and nothing else). I am trying truffle migrate. The code compiles, then issues this error: > Something went wrong while attempting to ...
0
votes
0answers
12 views

Beyond ethereum stackexchange what are the other good resources for asking questions regarding truffle, ganache-cli, babel and solidity?

Beyond ethereum stackexchange what are some good resources for asking questions regarding truffle, ganache-cli, babel and solidity? Starting working on blockchain development need information on good ...
1
vote
1answer
39 views

Signing messages in Truffle tests

I use Truffle to develop locally and run tests with truffle test (letting it create a temporary local blockchain). In one of my tests I need to sign a message and for that I need the test wallet's ...
0
votes
0answers
14 views

Truffle test: How to Calculate transfer Gas cost to be 2300 wei?

I am using gasleft() function. I am storing the gasleft() before transfer and gasLeft() after transfer, and then finding the difference. But I am getting wrong result maybe 7554. Somebody please guide ...
0
votes
0answers
15 views

How to verify polygon smart contract using truffle?

I deployed a simple NFT smart contract on polygon mumbai testnet but when I am trying to verify it then It is showing an error. please guide me how to verify it... This is the error which I am getting ...
0
votes
0answers
28 views

Why am I getting the "not recognized as an internal or external command" error when I run truffle unbox on Windows?

I'm getting this error running trufflesuit unbox react: Starting unbox... ================= √ Preparing to download box √ Downloading 'files\solidity\web\frontend\client\node_modules\.bin\' is not ...
1
vote
1answer
33 views

Truffle migration from within WSL not connecting to Ganache

Truffle migrate and test would not connect to Ganache [
0
votes
1answer
23 views

Function not working on Truffle, but works on Remix

I have a contract that does the following: It maintains a list of items, which stores the name, id, sold status etc. I have a function, createItem, which creates these items and requires the name of ...
0
votes
0answers
6 views

Unable to create logs / events with simple smart contract using truffle develop

I'm wondering why I am unable to generate an event that logs data to the tx using truffle develop with the below smart contract. When I try to log the logs, I am getting an empty array. SmartContract /...
1
vote
1answer
20 views

Why doesn't Truffle's testing framework automatically retrieve fresh values of public state variables after every interaction with the contract?

I have the following simple smart contract defined: contract LoanApplication { struct Applicant { bytes32 ssn; bool hasApplied; } struct Loan { string loanID; uint ...

1
2 3 4 5
56