Questions tagged [contract-debugging]

questions for finding and squashing bugs in smart contracts and decentralized development

Filter by
Sorted by
Tagged with
1
vote
1answer
119 views

Token migration and IDEX smart contract problem

During a recent token migration from token A to token B, a large number of token A were held by a number of people in an IDEX address (where it was ready to trade). The IDEX address is part of a smart ...
0
votes
1answer
10 views

declaration error identifier not found or not unique

pragma solidity 0.7.4; contract MyToken { address public minter; mapping (address => uint) public balances; constructor(){ minter = msg.sender; } function ...
0
votes
0answers
15 views

A smart contract that compiles and doesn't have errors, is not deployed and revert all the process

I have a central smart contract that inherits from other contracts and create two entities that are the entities of the contract that are going to sign it. This "central" contract is named &...
2
votes
1answer
1k views

How to debug transaction from truffle test on development network

I am trying to debug a failing solidity function, which I am calling from the JS test files with truffle. When I run my test, I am successfully able to get a transaction id. However, my solidity ...
0
votes
1answer
170 views

“execution reverted” Error when deploying Safemoon fork on Rinkeby

I keep getting this error message when trying to deploy a Safemoon fork. There's no other information provided. Code is here https://bscscan.com/address/0x8076c74c5e3f5852037f31ff0093eeb8c8add8d3#code ...
0
votes
0answers
13 views

Need help getting ETH back after BSC transfer [duplicate]

I have tried to transfer ETH from Binance to Trust Wallet using BSC. The funds went to C.R.E.A.M. Finance, which is accessible through Trust Wallet's DApp. It seems like there is no option to withdraw ...
0
votes
0answers
5 views

In the context of Ethereum contract creation, what does “cyclic creation dependencies are impossible” mean?

I'm reading the official solidity docs and came upon this passage on Ethereum contract creation: "cyclic creation dependencies are impossible", followed by the example code below (and also ...
0
votes
0answers
7 views

How to test contract interactions without pay fee

I have my contract which interacts with two different exchanges, can i test this interaction without pay fee? Before Deploy to the main net? I know it has Ropsten but it wouldn't work i think, i need ...
0
votes
1answer
371 views

Sending value to a solidity contract method from web3 results in `Invalid Tuple Value` error

I'm sending values to a solidity 0.5.1 method using web3 and keep getting an invalid Tuple value error. Here's the relevant contract code: struct mystruct { bytes32 id; string str; } ...
0
votes
1answer
14 views

Getting contract address

I saw an example about this, while was searching it on the internet. I want to deploy a new contract which is ProjectContract. However, I could not get contract address as below. I think this is for ...
0
votes
1answer
24 views

Cant verify Smart Contract deployed with Remix

// File: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface ...
0
votes
0answers
42 views

Scan for new Contract/Token

I am trying to find a way to use the JSON-RPC calls to scan for new tokens on the BEP-20 Binance chain. I cannot find any documentation or information regarding this.
1
vote
2answers
287 views

Token Sale Smart Contract

I am new to Ethereium Block Chain and have been trying some code written in solidity as follows. pragma solidity ^0.5.0; import "./MyERC20Token.sol"; import "./ERC20Burnable.sol"; contract ...
0
votes
1answer
309 views

I need help; the Solidity Code yields a warning you will see below

pragma solidity ^0.4.4; contract token { function mintToken(address receiver, uint amount){if (msg.value < amount) throw; if (msg.value > amount) throw; } } ...
1
vote
1answer
21 views

how are the exploited smart contracts fixed

We have seen many defi hacks taking place one thing i don't understand is how the bug in contract fixed given that smart contracts are immutable. Is it somehow related to delegate call or interfaces....
5
votes
2answers
667 views

Printing uint256 value to console while debugging with Truffle

I am trying to figure out how to print values to the console while doing truffle debug <txhash>. So far I have tried using an event called "TestValue", but I am not seeing the output in the ...
0
votes
2answers
198 views

solidity, how to wait n second function or others solution

I am working on a project for p2p energy trading using blockchain. I am building an experiment on my own to demonstrate the concept for my master thesis. For this project I have two python scripts, ...
1
vote
0answers
8 views

Is there any EVM debugger with a flexible UI layout available as of 2021?

Remix debugger seems to be pretty mature. But, its web-based interface makes it impossible to shuffle the block around. For example, I want to move the "Stack" section to the right sidebar ...
2
votes
1answer
116 views

How to trace the line where a tx failed in truffle tests?

I know about 0x's sol-compiler and sol-trace. I used them before and they do exactly what I'm looking for, but these modules bring significant overhead when used with truffle. Check out this file to ...
0
votes
1answer
17 views

Problem with smart contract's constructor instantiating another smart contract

I have the following two smart contracts in the same ".sol" file: Credentials and Proposals. Every Proposals smart contract should refer to a single Credentials smart contract, in order to ...
5
votes
1answer
375 views

Can't debug transactions that fail during the Web3.js estimateGas() call? No Tx Hash

NOTE: I am doing my work with the Ganache v1.2.2 GUI client on a Linux Ubuntu 18.04 station. There are many revert errors that happen during the estimateGas() call that precedes the actual Web3.js ...
1
vote
1answer
20 views

setting value using address.call() doesn't works

I am trying to run a setter function (testCallBar) in Caller contract which should run setVal() of Receiver contract using call method. But it does not works. testCallFoo() works as expected but ...
0
votes
3answers
189 views

New temporary struct causing state variables to be overwritten

I'm running an experiment where I'm trying to create the following behavior: Service owner deploys Experiment1 to the blockchain and is recorded as the owner. Owner then adds a user address, a user-...
1
vote
1answer
33 views

Solidity: ParserError: Expected pragma, import directive or contract/interface/library definition. function

I am using Truffle together with Ganache and I can't get this code to run: pragma solidity >=0.4.21<0.6.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@...
0
votes
1answer
18 views

My Ethereum smart contract is always returning an empty array when using web3 with metamask

import Web3 from 'web3'; window.ethereum.enable(); const web3 = new Web3(window.ethereum); const address = "0x977b5A39B6E95A7688570BF1b77e8FAb150791af"; const abi = [ { inputs: [], ...
0
votes
1answer
126 views

i want to get data from the transaction hash i tried many codes at last i am getting boxes in the output

1) First, I got the input console.log(web3.eth.getTransaction('0x725fc75264726f409793164e336e7d5ed35df8d2be469a0cc1a3a8cc4756b9b9').then((i) => console.log(i) )); 2) I manually pasted the input ...
7
votes
1answer
18k views

get array.length without a getter from other contract?

Is there a way to get length of an array in an other contract without a getter? pragma solidity ^0.4.11; contract MyContractA { uint[] public myArray; function MyContractA() { ...
0
votes
1answer
31 views

How to merge 2 transactions in one? [duplicate]

First of all, I have already searched on Google, and I didn't find a clear answer. What I would like to do : For example, I would like to make one swap on uniswap, and the second to sushiswap, in the ...
1
vote
1answer
98 views

Not able to send Ether to contract

I am trying to send Ethers to a contract deployed on Ganache but I am getting VM Exception while processing transaction: revert, the same logic is able to transfer Ethers to other account. Following ...
0
votes
1answer
16 views

bytes32 is not implicitly convertible

I am getting some errors related to bytes32. I tried to use the casting but it is not solving the proble. My code is: pragma solidity ^0.5.6.0; contract peInKSub{ bytes32 [] m_pendingIndex ;...
0
votes
1answer
64 views

minimumBet Appears to be Returning Incorrect Amount

I'm following this tutorial, which seems like a great intro to solidity contracts, but I've got an issue where I don't see the same results as on the post. When calling minimumBet from remix.solidity,...
1
vote
1answer
193 views

How to understand output of debug.trace

I have created a Private Ethereum network and I have deployed a contract in it.. Now I am trying to post a transaction in that contract but I m getting error that transaction has been reverted by EVM ...
0
votes
1answer
299 views

ParserError: Expected ',' but got ';'

I`m trying compilate this code and getting Parse error pragma solidity ^0.6.0; contract ZooFactory { event NewZoo(uint zooId, string name, uint dna); uint dnaDigits = 24; uint ...
1
vote
3answers
181 views

Incorrect Uniswap Liquidity Calculations. What could be wrong?

Looking though a uniswap address: https://info.uniswap.org/account/0xd62317c76E626D53C900088Fb07539b829B564B2 This address shows that it added $30k+ worth of liquidity, and none of it is removed. Why ...
1
vote
1answer
94 views

retrieving tokens from contract

I am using the MyAdvancedToken code from: https://www.ethereum.org/token I transferred tokens from owner account into the contract, to fund any buy(). Now, I want those tokens back. Is there any ...
0
votes
1answer
113 views

Are these BTCQ tokens sent to contract properly locked?

In the case of this contract code, all the tokens sent to the contract are forever locked? Were they effectively burned? I don't see any function like the solutions offered in this question, and I ...
0
votes
0answers
21 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 ...
2
votes
1answer
213 views

Contract working on Javascript VM and not Web3 Provider, why?

Here is the code: Calling contract: pragma solidity ^0.4.24; contract Caller { address public called_address; constructor() public payable { } function set_address(address _addy)...
0
votes
1answer
32 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 ...
1
vote
1answer
299 views

dApp index.html fails to load for dAppUniversity election application

Hit a brick wall with this. git clone https://github.com/dappuniversity/election The following is the Shell output I get when I npm run dev. I’m using the cloned project from GitHub but I’ve ...
0
votes
2answers
2k views

Division/Percentages in Solidity (a workaround)

Division/percentages is a required part of many applications but is difficult to implement since fixed and ufixed are not supported yet in Solidity. I've come up with this workaround: pragma ...
1
vote
1answer
20 views

Why is the math code causing transactions to fail

Ok so This is my first time working on solidity contracts and I'm at a loss how to debug this code. This code fails: function claimReturns(address claimant) private { uint otherTotals = ...
0
votes
1answer
92 views

Getting Errors with Solidity Contract

We are modifying the code used in a blockchain class to develop our first Dapp. We have added more variables to the contract code, and when we run the test files, we get the following errors: "...
3
votes
2answers
271 views

Issue with autonomous contract calling erc20 token's transferFrom for approved amount

Trying to transfer fund using ERC20 token handle and calling 'transferFrom'. Assume that the specific amount is preapproved by owner account for 'MyContract' contract address. contract StandardToken {...
0
votes
1answer
96 views

find the exact error in solidity transaction programmatically

I know we can detect that the transaction is going to be failed with the "Out of gas" warning beforehand but is it possible to find the exact error before sending it to the blockchain. How can we ...
1
vote
1answer
90 views

Constructor Arguments ABI-encoded - verification not working!

I think I must be going blind or something because I can not find the Constructor Arguments for this smart contract 0x3a2F46b0B0c187B152Db0c658b27E693f0A273a1 I have tried a number of options but ...
1
vote
0answers
31 views

Smart contract copying code beyong code length

I've seen a couple smart contracts (eg the contract decompiled in this answer) use this pattern: Code[Code.Length:Code.Length+x] This surprised me because I would expect Code.Length to mark the end of ...
119
votes
8answers
57k views

What is an ABI and why is it needed to interact with contracts?

ABI is referenced in many places including the official Ethereum website. What is an ABI and why is it necessary to use?
1
vote
2answers
401 views

Invalid Op Code - passing bytes32 array to a contract method called from another method of another contract

I've been banging my head on this one for some hours, I'd appreciate any help :) This is a final edit to clearly state the issue: Is there a proper way to pass a bytes32 array to a method on contract ...
1
vote
2answers
285 views

How can I persist an assignment to a struct in a mapping?

The following is a simplification of the problem I'm facing; pragma solidity 0.4.18; contract ValueSetter { struct BasicValue { uint256 value; } address my_address; // Just for the ...

1
2 3 4 5
11