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

How should I reset a user's password?

So I'm making a dapp. This portion uses smart contract for login. I need to add the ability to reset the user's password if they forget it. contract Auth { struct Credentials { string fullName; ...
1
vote
0answers
7 views

Accessing a public mapping from a deployed Ethereum Contract

I'm trying to get my Contract to interface with the already-deployed CryptoPunksMarket Contract, seen here: https://etherscan.io/address/0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb#code Specifically, I ...
1
vote
1answer
16 views

Incorrect Product of BigDecimals

My solidity function emits an event with a uint256 of: 5060584000000000000000000 The problem is on the truffle side in my javascript test. Here is the code: const { BN, expectEvent, constants } = ...
0
votes
0answers
8 views

Connect MetaMask with Ganache

unable to connect MetaMask with local blockchain(Ganache) Chrome Console Error truffle-contract.js:425 Uncaught (in promise) Error: Contract has not been deployed to detected network (network/...
1
vote
1answer
10 views

multiple arguments giving error web3

.addMedicalReport( patientBio.id, patientBio.name, patientBio.birthDate, patientBio.phoneNumber, patientBio._address, patientBio.MedReportId, ...
1
vote
1answer
8 views

How to initialize and assign value to constant in constructor?

I have the following code and want to initialize a constant in constructor. import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract IToken is ERC20 { uint256 private ...
0
votes
2answers
28 views

Truffle Deployment Error: has no network configuration for its current network id (97)

I'm having an issue deploying a contract with Truffle. The contract constructor takes 7 parameters which are all within the 2_deploy_xxx.js file. However, every time I do, I get an error when I get to ...
0
votes
0answers
28 views

{ code: -32000, message: 'invalid sender' } - Truffle deployment with Infura endpoint to Rinkeby

I am having trouble with deployment of a project contract to the Rinkeby network using @truffle/hdwallet-provider and an Infura endpoint. Here is the code for deploy.js: const HDWalletProvider = ...
0
votes
0answers
14 views

How do you deploy a smart contract to GoQuorum?

I have a set of smart contracts that I have compiled and deployed to rinkeby test network. I now need to deploy the to a private goquorum blockchain that runs on the IBFT consensus. The blockchain was ...
0
votes
0answers
9 views

How to pass a blank bytes calldata into a solidity function call?

I have a function that looks like this: function foo(uint _someVar, bytes calldata _data) public { ... } Then I make a call to it from another function with "" as _data: foo(123, "&...
0
votes
0answers
8 views

How do you test your contracts, and how long do you spend testing?

I want to improve how I test to increase my effectiveness and efficiency, so would like to hear from others. How do you test your smart contracts i.e. do you have a particular methodology for what ...
0
votes
1answer
11 views

Verify a signature generated with web3 in solidity

I am trying to verify a signature in solidity, which I generated in my truffle test. I followed this tutorial for implementing the smart contract, but made small adjustions: library Lib { /** ...
1
vote
1answer
29 views

Error when migrating contracts using truffle

When using traffle deploying contracts it gives these errors: "Migrations" -- Unable to decode sender address from transaction: Incompatible EIP155-based V 38 and chain id 3. See the ...
0
votes
0answers
12 views

How to use openzeppelin contracts for a specific version

Consider me a beginner to writing smart contracts. My question is, openzeppelin's contracts are using latest versions of solidity (by their repo). How do I use say 0.6 version, do they have it ...
0
votes
1answer
18 views

What are the ways of creating contract instance in a client environment, example in test?

I have found this sample from udemy course https://github.com/acloudfan/Blockchain-Course-Basic-Solidity/blob/93ca256bcf8c436c144425291257dcff5c3b269f/test/TestMetacoin.sol#L10 It uses the ...
0
votes
0answers
9 views

error.message.indexOf is not a function truffle ganache

for truffle developers var Election = artifacts.require('./Election.sol'); contract("Election",function(accounts){ var electionInstance; it("throws an exception for double voting"...
0
votes
1answer
14 views

What are the truffle console commands to interact with a mapping function of struct

Im writing a simple smart contract to store and retrieve data of series of patients' name and blood group with an id using mapping function in solidity. I don't know the commands to interact with the ...
0
votes
0answers
34 views

Can I burn tokens held by uniswap/pancake contract?

I'm trying to implement a function in solidity that burns tokens in liquidity. e.g I add 10k tokens to pancakeswap, after some sales I have 15k tokens in liquidity and I want to burn 5K, so I decided ...
1
vote
1answer
27 views

Hit a require or revert statement somewhere in its constructor?

I'm trying to fork a token contract and deploy it locally using ganache but I keep running into the following error: I have tried to debug the error using truffle debug 'transaction' and find the ...
1
vote
0answers
10 views

How to return a constant string?

I have recently started learning solidity. I added a function showMessage() like below: function showMessage() public view returns(string memory) { return "This is a constant"; } ...
1
vote
1answer
21 views

I ran into an error when using Pragma Solidity 0.4.24

I use pragma solidity 0.4.24 on the smart contract, but when running the truffle compile command, an error appears like this: =========================== > Compiling ./contracts/ImageRegister.sol &...
3
votes
0answers
67 views

Unable to use Truffle Migrate with Kovan

I'm trying to use Truffle for the first time to deploy and test my new Smart Contract. I can deploy and test it in Remix just fine, but the truffle migrate command fails with the following error: ...
0
votes
0answers
14 views

Getting ETHER balance from an account on Ganache node

Currently trying to get the amount of ether on a given account. Running Truffle on windows 10, and entered into the truffle console. Trying to run the following command: web3.fromWei(web3.eth....
0
votes
0answers
16 views

TypeError: token.decimals is not a function [closed]

hey guys not sure why I am receiving the following error hoping you can help. TypeError: token.decimals is not a function code below const Token = artifacts.require('./Token') require('chai') .use(...
0
votes
0answers
22 views

Verifying contract on bsc testnet using truffle plugin verify fails

I have a project that compiles and deploys successfully on binance smart chain testnet. I am trying to verify the contract using truffle run verify NiftRouter --network bscTestnet --debug command but ...
0
votes
1answer
16 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, ...
0
votes
1answer
19 views

Why is .call() necessary when I want to see returned values from a function?

In my contract I have this function (solc 0.8.4): function makeDecision(address person) external returns (string memory name, bool approved) { require(msg.sender == loanOfficer, "Only ...
0
votes
0answers
13 views

Truffle when is deployer.link required for migrate

In truffle quick start, its contract MetaCoin has dependency of library ConvertLib. Then in the deployment file, deployer.link(ConvertLib, MetaCoin) is manually added, and if deployer.link is deleted, ...
0
votes
0answers
6 views

How to replace on going mainnet deployment?

I'm using truffle to deploy my contracts on mainnet. I need to replace a deployment transaction by manually setting nonce. I couldn't find a way to use nonce on truffle deployer. Is there any method , ...
0
votes
0answers
5 views

Successfully migrated Solidity file isn't showing up in Ganache GUI

I was trying to test out deploying a 'hello world' equivalent smart contract via truffle onto ganache for practice and ran into the following issue with the network/deployment step: I ran truffle init ...
1
vote
0answers
13 views

Deploying Migrations.sol file in mainnet

I've seen some tutorials about deploying a smart contract to mainnet using Truffle. In those tutorials they are also deploying Migrations.sol contract to mainnet. What is the purpose of doing that? I ...
0
votes
0answers
14 views

My button created on my HTML file resulted in failed transaction when it interacted with smart contracts function

I created a simple html to register an address in smart contracts. The function in smart contracts have been tested and it passed. So i believe my problem should be in how the input data transferred ...
2
votes
1answer
59 views

uniswap solidity contract: swapExactTokensForTokens Failed in my own smart contract

I am using sushiswap to transfer weth to dai. Everything goes fine when I use web3.js to call swapExactTokensForTokens directory. However, thing goes wrong when I try to include the ...
0
votes
0answers
11 views

Send LP tokens to a payable function using truffle console

I am trying to stake the LP tokens that I got after adding liquidity in pancakeswap contract function. I can see the LP tokens in my metamask wallet as well. Now I cant understand how will send some ...
0
votes
1answer
19 views

'Transaction nonce is too low. Try incrementing the nonce.' while following truffle tutorial

I ran into a nonce error on the last leg of this tutorial : https://www.trufflesuite.com/boxes/flashloan-box I also supplemented the tutorial with this video on yt(fyi b/c some of the code comes from ...
0
votes
0answers
18 views

RangeError: Maximum call stack size exceeded or Contract code size over limit, yet this is just a copy of a contract already deployed

I am trying to create a DeFi app that works with PAXG gold token. But in order to do this, I need to first be able to deploy a copy of PAXG on my local testnet (Ganache). I have forked the github and ...
0
votes
0answers
11 views

What is the purpose of a dry run in truffle?

What is the purpose of a dry run in truffle? I mean apart from showing you how much it will cost to deploy your contract?
2
votes
1answer
18 views

Can I Specify gas fees in the smart contract?

Deploying my contract on rinkeby cost ~12 USD in gas fees (using truffle cli). Is it possible for me to specify gas fees/set a limit in the smart contract so it costs me 0.5 USD, but takes longer to ...
0
votes
0answers
20 views

Truffle migrations error: Transaction was not mined within 750 seconds, please make sure your transaction was properly sent

My env Truffle v5.3.1 (core: 5.3.1) Solidity - ^0.8.0 (solc-js) Node v15.11.0 Web3.js v1.3.5 my truffle-config file const HDWalletProvider = require('@truffle/hdwallet-provider'); require('dotenv')....
0
votes
0answers
32 views
+50

How do I efficiently install truffle and ganache-cli in a docker container?

Say I want to run a container with ganache-cli and truffle globally installed for dev purposes. I have this first attempt Dockerfile FROM node:15-alpine RUN mkdir -p /home/node/app WORKDIR /home/...
1
vote
3answers
319 views

Failed to add liquidity in pancakeswap

I am trying to make a few transactions on binance test net using a script in solidity and truffle which is a clone of PANCAKESWAP. I was able to successfully compile and execute the script once. When ...
0
votes
0answers
36 views

Calling function from web3 fails, calling it from truffle console works

I have the following JS code to call a contract: const txHash = await timelockContract.methods.executeTransaction( "0x71c1179e3C351De2641845cDAe537aCFC1808Fd2", 0, "&...
0
votes
1answer
24 views

Truffle cant find script file

I am trying to execute a script in my truffle project. The script is located in the scripts folder. But whether I run the command from within the root of the project or inside the scripts folder, it ...
0
votes
0answers
32 views

Undeclared identifier _setTokenURI in ERC721

I'm using pragma solidity ^0.8.0; I heard that _setTokenURI was removed in pragma 0.8.0 I tried these options https://forum.openzeppelin.com/t/function-settokenuri-in-erc721-is-gone-with-pragma-0-8-...
0
votes
0answers
10 views

Truffle test - doesn't send funds to msg.sender

it seems like I have a wrong gnache or truffle setup ... I already ask a simular question here: Owner of contract is set to contract address? Basicly there is some mess up with addresses on my local ...
0
votes
1answer
13 views

“Uncaught ReferenceError: TodoList is not defined” as I tried to call Todolist.deployed() in truffle console

I was trying this Beginner tutorial on smart contracts and solidity. I typed truffle compile, truffle migrate and they ran without any error and I got my gas cost used up in Ganache. When I opened ...
0
votes
0answers
11 views

How to make a deployer in truffle tests?

For some reason, our app will only work with a forked instance of the mainnet. And hence, we want to run our test on the forked ganache. We are using truffle, so we have written all of our tests in ...
0
votes
1answer
30 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
96 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
42 views

Truffle test doesn't connect to Ganache

I'm using Truffle and Ganache for my development environment. Using the truffle console or truffle external scripts everything works fine, but truffle test does not seem to be connected to Ganache: ...

1
2 3 4 5
50