Questions tagged [contract-debugging]

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

Filter by
Sorted by
Tagged with
0 votes
1 answer
27 views

My fund was stuck at ParaSpace, multi signer A&B initiated the code on@safe, but C said they were doing sth else, can someone help me?

It was a long story, i mistakenly sent 12eth to Para. https://etherscan.io/tx/0x72ef5f105ec1c40f917d92aa48caafe24448d9d8507c303ee9a66cbad2c0e983 but somehow para side set up this https://app.safe....
wonderX's user avatar
0 votes
1 answer
35 views

How do I add my address to a deployed contract public address using a security exploit? (coding challenge)

I'm working on a coding challenge for smart contract security exploits. I need to add my address to public address (browerr) in the contract. Do I need to create another contract that inherits the ...
johnTg's user avatar
  • 1
2 votes
1 answer
194 views

Failed to parse as type `uint256`: a character is not in the range 0-9

I am following Patrick Collins Smart Contract Lottery development and trying to run the deploy script test net ( sepolia ) but I am getting this error Error: Failed to parse as type `uint256`: a ...
Iftikhar uddin's user avatar
1 vote
1 answer
23 views

How to Implement a Proxy Contract to Fix an Existing Investment Smart Contract with Active Investments on BSC?

I'm currently facing a challenging issue with an investment smart contract deployed on the Binance Smart Chain (BSC). The contract already has active investments, but it contains a critical bug that ...
vasik's user avatar
  • 61
1 vote
1 answer
22 views

How to call a function from a separate contract

I have a already deployed contract and it has a withdraw() function. And i want to create another contract that first send some ETH to the target contract and then call the withdraw() to withdraw ...
Arkonomi's user avatar
1 vote
1 answer
135 views

What are the differences of Foundry vm.prank vs vm.broadcast

What are the differences of Foundry vm.prank vs vm.broadcast
anonauditor's user avatar
1 vote
0 answers
17 views

Truffle console: debug not showing me the code line that reverts a transaction

I'm trying to deploy my own swap router on the development network. I've got a transaction hash which reverts. I'm calling truffle console and then, when I press enter I get undefined. I can't reach ...
Radek_pl's user avatar
  • 761
1 vote
3 answers
35 views

If dos a single function solidity, will other functions not work?

I read lots of articles about dos causing a Denial Of Service. Let say that a contract has 2 functions, if called one of them repeatedly, will the other function works? Contract ABC { function one() ...
anonauditor's user avatar
1 vote
0 answers
36 views

failed to deploy smart contract on my private network

I created a private network of POA, and I use clef to seal blocks like this: I have successfully run this chain becaues it can produce blocks and I can create transactions between 2 accounts, and ...
jds250's user avatar
  • 11
0 votes
1 answer
91 views

Help - MEV Contract [duplicate]

I created an deployed a MEV bot via remix.re — after deploying the contract — I noticed the internal transaction sent to an unknown address. Any help on seeing what happened here?? My Contract Address ...
Levi's user avatar
  • 1
0 votes
1 answer
16 views

Issue with DynamicSvgNft Contract: getHighSVG() and getLowSVG() Functions Returning Incorrect Values

Hello Stack Exchange community! I am currently working on a project that involves an NFT contract called DynamicSvgNft. The contract is designed to change the SVG image URI of the NFT based on a ...
Web3Phoenix's user avatar
0 votes
0 answers
80 views

foundry debug: unknown address at

I use debug in foundry, but it doesn't show the contract. I have read these two issues, but doesn't work.issues#2348, issues#2947 forge debug --debug src/Counter.sol --sig "setMember()"
LEVI_104's user avatar
0 votes
0 answers
47 views

I have tried debugging the code but still i am not able to find the error. Function "getDonators" not found in contract

import React, { useContext, createContext } from "react"; import { useAddress, useContract, useMetamask, useContractWrite, } from "@thirdweb-dev/react"; import { ethers } ...
Indul's user avatar
  • 9
1 vote
0 answers
32 views

How to deploy a contract to the same address in testnet?

My code for deploying a contract import { ethers } from "hardhat"; async function main() { const CF = await ethers.getContractFactory('abc'); const c = await CF.deploy(); await c....
Camila326's user avatar
0 votes
0 answers
192 views

Cannot read properties of undefined (reading '0')

I am following FreeCodeCamp's javascript Blockchain/SmartContract course. Facing issue at lesson 9 staging test. Contract deployment and unit tests are running fine. Running mocha test on sepolia ...
mohmaya's user avatar
0 votes
1 answer
69 views

Hi all! I have got a problem with verification of the contract on BSCScan ! Can some one explain me the problem please?

ParserError: Source "@openzeppelin/[email protected]/token/ERC20/ERC20.sol" not found: File import callback not supported --> myc:4:1: | 4 | import "@openzeppelin/[email protected]/token/...
John Smith's user avatar
0 votes
2 answers
55 views

Can someone explain why this require does not stop the function?

it might be simple but I am in the process of learning solidity. In remix IDE, debugging a contract function, the function starts with two requires: function transferFrom(address owner, address ...
Christophe Brun's user avatar
1 vote
1 answer
69 views

Trying to use the Debug feature in Hardhat, but facing the following error "Error HH404: File, not found."

I am trying to debug a smart contract using hardhat. I am using the below code. pragma solidity ^0.8.9; import "Hardhat/node_modules/hardhat/console.sol"; contract SmartWallet { ...
Pratik Jussal's user avatar
1 vote
0 answers
115 views

Remix IDE runs every transaction twice in Remix VM - Mainnet fork (and Testnet forks)

I ran some unit tests in Remix IDE using the Remix VM - Merge. It works without any issues. As I needed the ERC-1820 registry contract I switched to Remix VM - Mainnet fork for the unit tests. Some ...
fish filet's user avatar
0 votes
0 answers
26 views

Understanding RouteProcessor.sol script and how to use the contract function

I am a beginner trying to understand what is the bot/contract transaction that is displayed in some DEXs. Attaching screenshot from dextools and pair link here. I followed the transaction here and ...
metame_anon's user avatar
3 votes
1 answer
17 views

How do I make a blanket statement to be notified if certain wallets mint?

I've been trying to come up with a way to track wallets and be notified when they 'mint'. The way i'm doing it now seems like it will only catch around 50% of all transactions due to the nature of the ...
oyxf's user avatar
  • 41
1 vote
1 answer
1k views

bought a token that is unsellable, but I do not spot the code in the contrat that is responsible

I bought this token, had a good app for trading and a well written medium which didn't seem scammish at all. the token even managed to pass on the normal basic tools for honeypot detection and ...
user119739's user avatar
2 votes
1 answer
31 views

Getting successful and failed txs with the same code

// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; contract Shuffle { constructor() { ranking = [0,1,2,3,4,5,6,7]; currentSeason = SeasonType.Spring; } enum ...
East's user avatar
  • 21
0 votes
1 answer
22 views

the `cancelEvent` function in my contract works fine when no ticket has been purchased but raises an error once a user purchases a ticket

function cancelEvent(uint256 eventId) external returns (bool){ require(eventExists[eventId], "Event does not exist"); require(events[eventId].eventstatus != Status.CLOSED, "Event is ...
Ogolo Prince's user avatar
0 votes
1 answer
42 views

Why am I getting `undefined` when trying to access array elements in Truffle Console?

I am getting an array from my contract, which seems to have the correct number of elements. However, when trying to access the first element using index notation, I am getting undefined: myArray = ...
pooya13's user avatar
  • 103
0 votes
1 answer
214 views

Error - reverted with reason string 'LOK'

i got "reverted with reason string 'LOK'" error when executing this code (on the 'router.exactInputSingle(params)' exactly ) , why and how to fix this error ?; contract UniswapV3FlashSwap { ...
adam mr's user avatar
  • 61
3 votes
1 answer
79 views

How to splitt smart conract for reducing size of smart contract

Warning: Contract code size is 44924 bytes and exceeds 24576 bytes (a limit introduced in Spurious Dragon). This contract may not be deployable on Mainnet. Consider enabling the optimizer (with a low &...
Sohail Ghafoor's user avatar
2 votes
0 answers
138 views

Debug Hardhat with Foundry

Can you debug a Hardhat project using Foundry? I know that doing Foundry tests on Hardhat is possible through their plugin, but is it possible to debug also?
dNyrM's user avatar
  • 711
2 votes
2 answers
50 views

What induces the large bytecode warning, and how can I fix it?

The error that happens to me when I make a large contract. My contract cannot be split up into multiple contracts, it needs to all be one (particularly large) contract. Warning: Contract code size is ...
Henry Gagnier's user avatar
0 votes
1 answer
31 views

I need some contracts about the gas vulnerability

I am working on detecting gas-related vulnerabilities in smart contracts, out of gas caused by excessive iteration and malicious loops , etc. If you have such contracts, please provide them to me, ...
simin chen's user avatar
0 votes
0 answers
16 views

After trying to run my code i get this in the console but not any other errors in my code: "Unexpected token ']'"

pragma solidity ^0.8.18; /** * @title ContractName * @dev ContractDescription * @custom:dev-run-script election.sol */ contract Voting { struct Candidate { string name; uint ...
NAkis's user avatar
  • 1
1 vote
1 answer
16 views

My payout function to lottery winners is failing. I'm storing the winners in an array and attempting to payout but getting reverts

the code: function payoutWinners() public payable { require(msg.value >= payoutOwed, "send more than what is owed"); for (uint i = 0; i < winningAddresses.length; ...
snejad123's user avatar
0 votes
1 answer
60 views

Error Message: out of gas

when making a swap via IUniswapV2Router(router).swapExactTokensForTokens(_amount, 1, path, address(this), deadline) on Goerli i got the following error on Tenderly:
adam mr's user avatar
  • 61
1 vote
2 answers
183 views

console.log output on live network

how to read the output of console.log() (it doesn't appear on my hardhat node console ) when i m running a smart contract on goerli (alchemy) via a js script (hardhat) ? import "hardhat/console....
adam mr's user avatar
  • 61
1 vote
1 answer
131 views

Does delegatecall also works for calling other contract's constructor?

I want to call other contract's constructor, but I'm not sure if the delegatecall function will work for that case. I have no way to test it out on Remix, because my Remix seem to not work with even ...
caiosa's user avatar
  • 23
0 votes
0 answers
90 views

"Error: Function call to a non contract account " without any context

I have been learning about reading from Blockchain and been trying to put tokens from Pancakeswap using the functions -allPairs() from PancakeV2Factory and -token0() ,token1() from IPancakeV2Pair ...
user114091's user avatar
1 vote
0 answers
118 views

What's the best way to debug a smart contract for testing purposes?

I am getting the following error on a specific function when I try to send a transaction: Error: Transaction reverted: function returned an unexpected amount of data at SmartWallet._checkTokenType ...
Falcon Stakepool's user avatar
0 votes
1 answer
21 views

Spot revert tx root cause in empty function call with struct as a parameter

I am debugging one interesting issue. I have a contract. I have a test coverage for this contract. I have a private locally deployed chain for quick prototyping where this script partly automate ...
Gleichmut's user avatar
  • 472
2 votes
1 answer
38 views

Google BigData ETh Query Question

This is a question for all those that are familiar with crafting Google BigData queries to extract data. My request is fairly simple. I'm looking to extract a definitive list of smart contracts with ...
librehash's user avatar
0 votes
1 answer
840 views

Foundry Forge Debugger: How to inspect contents of variables?

Is there a convenient way to view the contents of a variable while debugging? Similar to other tooling, like the python debugger in pycharm, or the lldb debugger in Xcode. The forge debugger has a ...
urlauba's user avatar
0 votes
1 answer
64 views

Simple contract interface is reverted

This is an example code taken from Chainlink being run on remix: pragma solidity ^0.8.7; import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; contract ...
IBeFrogs's user avatar
0 votes
1 answer
502 views

Error: call revert exception Uniswap getAmountsOut

I am trying to build a bot that can perform tri-arbitrage trades and I ran into an issue that I don't really understand when trying to interact with the Uniswap v2 router in my contract to estimate a ...
ccurves's user avatar
  • 133
1 vote
1 answer
92 views

A Problem with the index of an array of smart contracts in Solidity: Expected constant integer error

I am totally new to solidity and not sure how different data types are used. I am writing a code that handles an array of smart contracts, read and store values in them etc. In one function (...
FAW's user avatar
  • 13
1 vote
3 answers
90 views

Is this transfer functions code vulnerable to integer overflow?

I have been doing some bug hunting on etherscan.io and have come across many contracts with this kind of code. Specifically, the ones that don't use safe math library, are older then solidity 0.8, and ...
Wesley Jones's user avatar
-3 votes
1 answer
28 views

ethereum smart contract have bug? [closed]

this source code correct? function isPokit() constant returns (bool isPokit); } contract SafeTriumpTransfer { bool pokit; function SafeTriumpTransfer() { pokit = ...
tomas's user avatar
  • 25
0 votes
1 answer
40 views

How to withdraw from contract plus interest

I have created a simple savings contract, where users can withdraw back their deposit plus interest after a while. Interest rate is 12% only per hour for testing purposes. Unfortunately, when I try to ...
f22daniel's user avatar
  • 313
0 votes
1 answer
200 views

When using `ContractFunction.build_transaction` from a contract factory you must provide a to address with the transaction

I am getting the error in the title when trying to update the contract with a function I wrote. Any help with this? If I change 'from' to 'to' and use my address it also doesn't work properly. I am ...
jlearnsdefi's user avatar
0 votes
1 answer
759 views

How can I find the line of code that caused a transaction to revert?

I'm using hardhat/ethers.js to deploy and test a smart contract that uses Chainlink VRF and Automation, and while testing some of the functions that interact with the Chainlink contracts on the Goerli ...
Roman Scher's user avatar
0 votes
0 answers
157 views

Use AAVE contract in my own contract. cannot estimate gas; transaction may fail or may require manual gas limit

I am tring to use AAVE contract in my own contract. but I have a question on this mysterious error. Error: cannot estimate gas; transaction may fail or may require manual gas limit [ See: https://...
Ethanabc's user avatar
  • 101
0 votes
0 answers
392 views

Handle multiple tokenURI in one NFT smart contract to different mint functions

I have a simple nft contract and I want to create mint functions that if you press one or another that tokenId is bound to a URI I decide. I already tried multiple ways to do it but I got an error ...
Pablo's user avatar
  • 11

1
2 3 4 5
14