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

Openzeppelin ERC721Enumerable getTokenIdsOfOwner reverts and I don't know why

I am trying to implement a staking contract, I wanted to map all the owned NFTs by a certain address, so came across ERC721Enumerable and getTokenIdsOfOwnerfunction, however whenever I call my ...
Mohamed Wael's user avatar
0 votes
0 answers
13 views

unable to sell token despite seeing other wallets selling

I bought this token on base network and the contract looks perfect to me, but i realize i was unable to sell/swap the token after increasing the slippage to 50%, i can see other wallets selling and i ...
Job Toni's user avatar
0 votes
0 answers
12 views

Is everything okay with this Presale contract?

Could you help me check if this presale contract does what it's supposed to do and if it's safe? I tried to find bugs or flaws but couldn't find anything. The theory is very simple: the user can use ...
Integral's user avatar
  • 115
0 votes
0 answers
7 views

Truffle debugger can't connect to node

I'm trying to debug a contract. I have ganache open forking the Ethereum mainnet that uses in the settings the same host and port as my truffle-config.js (127.0.0.1:7545). I can migrate/deploy and ...
Hiperfly's user avatar
1 vote
1 answer
17 views

LP contract doesn't approve

I created this contract to simulate a liquidity pool and I'm testing it with the Remix IDE. I can say it works fine, except for the function to swap tokens for ether, which is bothering me. The user ...
Integral's user avatar
  • 115
0 votes
0 answers
12 views

Missing Eth after sending to contract - Internal transaction [duplicate]

I saw a YouTube video of how to create a smart contract, after sending 0.2 ETH it was transferred to a different contract through internal transactions. here is the link for the code and contract ...
Saba Purtseladze's user avatar
0 votes
1 answer
15 views

Sent Eth to contract address can I get it back

I sent some Eth to a contract address rather than my wallet. Can someone with some code experience have a look at this contract and let me know if there is a function on here that the Devs could use ...
Fez's user avatar
  • 3
0 votes
0 answers
11 views

What Delegate function does in this contract? Its not sellable but scanner dont recognize it

/** *Submitted for verification at Etherscan.io on 2024-03-26 */ // SPDX-License-Identifier: UNLICENSED /* Website: https://www.mode.network/ Twitter: https://twitter.com/modenetwork ...
Developer's user avatar
0 votes
0 answers
15 views

npx hardhat test "Timeout of 40000ms exceeded" when repaying flash loan

I am trying to follow along with a youtube tutorial that teaches you how to make a basic uniswap flash loan application. I have copied every piece of code, line by line, from the video as instructed. ...
ChewyCorndog's user avatar
0 votes
1 answer
16 views

How to fix? warning (2018) function state mutability can be restricted to view

function withdraw() external onlyOwner { if(block.timestamp < end || totalCollected < goal) { revert CollectNotFinished(); } }
ansoiri98's user avatar
0 votes
0 answers
24 views

Truffle ganache debug not working

I have installed truffle and ganache and the @ganache/console.log library. Furthermore, I have the following contract from an online course which serves as an example to demostrate the debug mode of ...
TheDude's user avatar
  • 111
0 votes
1 answer
19 views

Transfer Value isn't showing up in the contract value [duplicate]

So I'm totally new to ethereum. I'm asking you for help, maybe I don't understand the mechanics of this correctly. I set up a contract und transferred a little eth to it. But the transfer value never ...
trissdissi's user avatar
1 vote
0 answers
16 views

which fork debugger to use?

what tool are you using to debug mainnet contracts. So doing a fork and be able to step into line by line (considering you have the source ofcourse), but doing it on live contract. I tried to use ...
Josip's user avatar
  • 53
0 votes
0 answers
9 views

inspect local vars in fork?

Trying to find a way to inspect local variables during method call when having failed tx. Is there a way to example fork mainnet with hardhat and then to have insight on used local variables when ...
Josip's user avatar
  • 53
0 votes
0 answers
31 views

im building an auto crypto profit generator. i need some help making it work right. (incomplete code attached)

to start with, im already deep into the process of creating this thing, ive already spend $1000 on this contract (dont feel bad for me, thats one paycheck and i needed to learn the deploying and ...
SoullessScythe's user avatar
2 votes
1 answer
145 views

Solidity debugger in VS Code

Is there a good Solidity debugger out there for Foundry that gives you the same UX in VS code as when debugging a node.js app? Like local/state variables inspection, breakpoints, etc?
dNyrM's user avatar
  • 904
0 votes
0 answers
37 views

How to correctly read the storage changes from a contract based on stack values from debug_traceCall

I have an example structLogs from debug_traceCall { "depth": 6, "gas": 46056236, "gasCost": 2900, "op": &...
Billy Adelphia's user avatar
0 votes
0 answers
45 views

Spot the problem in the contract of the unsellable token

I am currently trying to understand how the smart contracts work. I have bought a tiny amount of a token that I suspect to be honeypot and indeed it is unsellable, PancakeSwap gives the error: ...
baronett's user avatar
0 votes
1 answer
30 views

Calling Uniswap Multihop Function returns Error

Deployed on Polygon Mumbai. Code compiles fine on REMIX and is meant to perform multihop swaps on Polygon Mumbai, but it returns error after function is called. Deployed Contract always funded with ...
Samuel Aniss's user avatar
0 votes
0 answers
56 views

What will happened to my WETH TOKEN if the receiver or the network didn't support WETH TOKEN

I send WRAPPED ETH to a wallet/network which is COINS PH WALLET that has supported ETH ADDRESS, i thought WETH and ETH are the same? Now my problem is how can i possible retrieve my TOKEN?
Omar's user avatar
  • 1
0 votes
1 answer
30 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
282 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
57 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
  • 71
1 vote
1 answer
27 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
2 votes
2 answers
505 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
34 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
  • 791
1 vote
3 answers
38 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
45 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
190 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
26 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
102 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
66 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
  • 19
1 vote
0 answers
38 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
  • 115
0 votes
0 answers
289 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
93 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
64 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
115 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
153 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
28 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
2k 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
38 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
51 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
364 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
  • 101
3 votes
1 answer
92 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
182 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
  • 904
2 votes
2 answers
66 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
34 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

1
2 3 4 5
15