Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
2
votes
1answer
349 views

Error: VM Exception while processing transaction: invalid opcode at transfer function

I try test function transfer in my contract. I following by tutorial. Full project locate on my git. It is my test.js code: var SPT = artifacts.require("StepanToken2"); contract("Testing ERC20 ...
1
vote
3answers
432 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 ...
1
vote
1answer
1k views

Javascript web3 calls Solidity contract function with extra parameter?

In the http://truffleframework.com/tutorials/pet-shop example, there is the following contract, and the function adopt(uint petId) has only one parameter. contract Adoption { address[16] public ...
2
votes
2answers
137 views

How to process Smart Contracts payable functions in batch?

I am aware that metamask will enable effective security for processing via the web browser a payable function action to a smart contract. What happens in batch? I have an API service which then ...
0
votes
1answer
2k views

Truffle Error : VM Exception while processing transaction: revert

I am trying to call following function of smart contract from App.js: function addCandidate(bytes32 _name, bytes32 _party) public{ //require(msg.sender == votingAdmin); //if(msg.sender != ...
2
votes
1answer
1k views

Truffle Bytecode Different from Etherscan Bytecode

I am having difficulty verifying my contract code on Etherscan using the code generated by Truffle. Using Etherscan VerifyContract V1: https://rinkeby.etherscan.io/verifyContract Truffle produced ...
0
votes
1answer
500 views

Running A Smart Contract With Two Nodes on Truffle

We have installed truffle to two nodes and we initialize our private blockchain with: $geth --datadir node init genesis.json Then we run geth on both nodes with: $geth --datadir node --nodiscover -...
0
votes
0answers
79 views

Web3: call the solidity function with the address can't return the expected outcome! (everyone can help?)

solidity code: address public administrator; constructor() public { administrator = msg.sender; } function isAdministrator(address _address) public view returns (bool) { return _address ==...
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
1answer
15 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 ...
3
votes
1answer
344 views

Geth Sync Problems | Rinkeby, Ropsten | Deploy contracts

Get Geth to sync --> Rinkeby test network. For the love of god I just want to deploy a contract. I have deployed it to Ganache-cli, GUI, remixIDE, deployed with truffle/Infuria.io...I keep failing to ...
1
vote
1answer
37 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
1answer
535 views

Migration 2_deploy_contracts invalid or does not take any parameters at Object.run()

I am trying to compile my smart contracts using truffle pet-shop. I have the following contract in directory election/contracts/election.sol ; pragma solidity >=0.4.0 <0.6.0; contract Election{ ...
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
0answers
10 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
0answers
50 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
41 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"; } ...
0
votes
1answer
160 views

Sending ETH from contract to EOA

OK, I'm baffled guys. maybe it's the amount of gas the function is using up that is causing this not to work. when I call the function: I get the following in response but no movement of Eth from my ...
1
vote
1answer
27 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 &...
0
votes
1answer
717 views

Truffle tries deploy from unknown account

I am trying to deploy a contract to Ropsten using Infura with the config file truffle.js below. The deploy fails because the account listed in the error message has insufficient funds – however I do ...
0
votes
1answer
149 views

Swaping ETH to DAI on Uniswap

I don't get why when trying to deploy my contract it says that gas estimation errored. Forked Mainnet with ganache-cli -f <INFURA_ID> Trying to deploy and execute following code: pragma solidity ...
0
votes
1answer
84 views

Issue with Serverless deploy of smart contract-Dependency mismatch -Package.json,Package-lock.json error

I'm trying to deploy my smart contract serverless(AWS lambda) and I'm using Truffle framework. The code is getting deployed in an earlier system(earlier it was deployed here). Now I have updated the ...
0
votes
1answer
594 views

Pass address[] array to Truffle deployer (MultisigWallet)

I am trying to deploy the MultisigWallet contract on testrpc. However, I can't figure out how to provide the address[] _owners constructor parameter in the deployment command. I've tried several ...
0
votes
0answers
15 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
1answer
207 views

My contract is deployed but instance is undefined

I have deployed a contract on the ganache blockchain successfully using truffle. In the truffle console, I can call the contract fine truffle(development)> MyCoin [Function: TruffleContract] { ...
0
votes
2answers
223 views

Having trouble figuring out Truffle testing with Javascript

I've started unit testing my contracts with Truffle (using Javascript). I'm fairly new to Truffle and Mocha both, and while I've tried to follow the tutorials, I'm struggling to follow exactly what's ...
0
votes
1answer
18 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
2answers
193 views

when to use MyContract.deployed()?

I was going through truffle-contract docs and came across this function MyContract.deployed() As mentioned in docs this function create an instance of contract abstraction(abi) representing the ...
0
votes
0answers
27 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
427 views

How to get event log Web3.py?

I am using solidity 0.7.4, web3.py 5.12.2, and python 3.7. I am working with Windows 10. My goal is to emit an event inside a solidity function, in order to retrieve the log after the function is ...
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
2answers
199 views

Solidity: uint parameter not being set properly

Testing my contract locally with truffle. I have a function with the signature: function purchase(address buyer, address seller, bytes16 bookId, uint tokens) public onlyOwner returns(bool success) ...
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 ...
1
vote
1answer
750 views

Why do I get VM Exception while processing transaction: revert?

I'm trying to call a function from a contract I've created on ganache-cli through a javascript on a website. Here's the code of the java script: web3.eth.defaultAccount=web3.eth.accounts[0]; var poe ...
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
1answer
118 views

Truffle Migrate

What happens when there is a minor change in the smart contract and I run truffle migrate command. Example: //before contract test{ function display() public returns (string){ return "...
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 ...
0
votes
0answers
13 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 ...
1
vote
1answer
133 views

Truffle - call migration file multiple times

I would like to execute migration file "6_deploy_and_register_group.js" every time when I need to create a new group. Is this a proper way to use migrations? If yes, how can I make it working? ...
1
vote
2answers
39 views

When i call a function: Error: Returned error: VM Exception while processing transaction: invalid opcode

I work on Truffle. My contract is A and its function is infoRep(). infoRep() returns some data. Whenever i call the function in Truffle console the below error occurs: Error: Returned error: VM ...
1
vote
4answers
263 views

Can the mapping storage change after contract deployment?

I am beginner in mapping.I work on Truffle and Ganache. I deploy the following contract: pragma solidity ^0.5.12; contract customerFinder{ mapping(uint256 => address payable) public ...
0
votes
0answers
22 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
13 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?
0
votes
1answer
92 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 ...
4
votes
1answer
404 views

How long does it take to “save artifacts” to Ropsten?

Migrating contracts with Truffle I get stuck at Saving artifacts... Sometimes for 10 minutes or more. I also get: Error: Transaction 0x123...123 wasn't processed in 240 seconds! Is it normal that ...
2
votes
1answer
21 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 ...

1
2
3 4 5
50