Questions tagged [contract-debugging]

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

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

ganache modify code of smart contract after fork?

Ganache has recently introduced the ability to fork from a live blockchain at a particular block number. https://github.com/trufflesuite/ganache/releases/tag/v7.0.0 After forking, I would like to be ...
1
vote
2answers
36 views

How to initialize an array inside the function and push items into it?

How to initialize an array inside the function and push items into it? I'm not gonna initialize outside the function. Here's my code: function tokenOfOwner(address owner) public virtual returns (...
0
votes
0answers
10 views

How to listen for events in a well-known contract (Compound cDai) called by my contract

I don't know how to debug the situation where I wrote a contract (MyDeFiProject) which calls a well-known contract developed by someone else (in this case Compound cDai on Rinkeby). The transaction ...
0
votes
1answer
18 views

Contract address balance function returns BN in truffle but actual balance in remix

I am very new to solidity, contracts, and truffle, and I ran across a disconnect between the results of calling the getBalance() function of this basic contract: contract TruffleTutorial { address ...
0
votes
0answers
14 views

How to check malicious code if it's safe to connect wallet to website?

The source code of this website doesn't show the contract address being interacted with when someone connects their Ethereum wallet to their site. Would like to check the underlying Solidity code of ...
0
votes
0answers
28 views

Cannot remove Liquidity - BSC contract

I used a pre-made contract and after launching it, I cannot remove the liquidity from the Owner account. Some people bought. Would like to know why is it. Basically, it says that the Owner acc only ...
0
votes
1answer
25 views

Who can help what is wrong with this contract and codes?

abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } } You can see the Error in the image below:
1
vote
1answer
23 views

Why do Etherscan's opcode view and opcode disassembler show different opcodes for the USDT contract?

We have USDT smart contract, which is located at 0xdac17f958d2ee523a2206206994597c13d831ec7. I am trying to decompile the smart contract (at least view it as at opcodes). What I see is that it begins ...
1
vote
1answer
22 views

Solidity in Remix IDE: How to debug "false Transaction mined but execution failed"

So I'm a student working on a smart contract in Solidity as part of my coursework, and I'm a bit of a blockchain newbie. I've got my contract working now, but there is one function that's causing me ...
1
vote
1answer
76 views

Why can't I access the Uniswap v3 Factory .getPool() function?

As a personal exercise, I am trying to convert the following Uniswap v2 project to Uniswap v3: Uniswap token price monitoring (this is not swapping), i.e. ETH/DAI https://www.youtube.com/watch?v=...
0
votes
0answers
36 views

Could not interact with contract in BSC mainnet but succeed in testnet (but still a standard transfer)

I may send raw transaction by sendSignedTransaction to contract address on BSC testnet, and it succeed but this is just a standard transaction; it's not contract call like I want. But on BSC mainnet, ...
0
votes
0answers
25 views

Solidity contract : can't sell

I found a contract where I could buy but could not sell. I was wondering what was preventing me from selling in this contract. I looked for it but as I am a beginner in Solidity I will need some clues....
0
votes
0answers
23 views

How to change max value of a NFT contract once it's published

How to change max value of a NFT contract once it's published. I can't mint anymore NFTs because in my contract the max value is 1000, as the contract already has been published I can't find a way ...
0
votes
1answer
16 views

Remix - cant compile for unknown reason

When I compile the program it says it's expecting a ; somewhere in line 8. I've tried adding it in, getting rid of brackets in the line where it's telling me to, but with no avail. Be great if you ...
0
votes
0answers
15 views

Trying to make rock paper scissor smart contract

I am teaching myself solidity and I am trying to make a very basic Rock Paper Scissors app. I am trying to compare strings at the end to determine the winner, but solidity won't let me use the == ...
0
votes
2answers
191 views

Help with tokenURI (ERC-721 NFTs)

I am learning how to make NFTs in Solidity. I have two questions: 1.) what is token URI? What does it mean? 2.) I am following a ERC-721 guide, but I think the _setTokenURI function has been removed ...
0
votes
1answer
20 views

Transaction reverting while deploying contract with remix

I'm trying to deploy this contract on remix but i get an VM error and the transaction is reverting. Error is "the called function should be payable if you send value". At the beginning I ...
3
votes
1answer
58 views

Is there a way to abort or cancel web3 requests? (not transactions)

I am using myContract.getPastEvents (https://web3js.readthedocs.io/en/v1.2.11/web3-eth-contract.html#getpastevents) and I need to be able to cancel this request if a user switches their account or ...
0
votes
0answers
29 views

DeclarationError:identifier already declared Masterchef.sol

I'm getting the error, what's wrong? // SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./SafeMath.sol"; import "./IBEP20.sol"; import "./SafeBEP20.sol"; ...
0
votes
2answers
186 views

How to use changeEtherBalance from waffle-hardhat?

I want to check if the ether balance of an account decreased after the transaction using changeEtherBalance I tried to follow the waffle docs but couldn't do it either. await token.connect(...
0
votes
0answers
15 views

<UnknownContract> when calling call trace in brownie console

I'm using Ganache + brownie and having trouble generating a meaningful call trace on "mainnet-fork". How do I go about resolving this? I believe it has to do with a USDC contract I am ...
0
votes
0answers
15 views

console.log fails transaction

Let's say I have a system made up of four different sections with contracts, proxies, node files, etc: 1--------- | | | 2--------- | | | 3---...
1
vote
0answers
22 views

Web3js get event logs with call (without sending real transaction)

I need to predict which event logs will be emitted by sending a transaction to my contract, but without sending a real transaction, for exemple by using the call method of my contract (using web3). I ...
1
vote
0answers
88 views

Debugging functions that utilize the Pancakeswap/Uniswap interface

I wrote a smart contract which interacts with the Pancakeswap/Uniswap interface in order to swap tokens at Pancakeswap. My problem is that I can deploy the contract but the swapping functions are not ...
0
votes
1answer
155 views

Transaction reverted by the EVM and I cannot see the reason

I am new to blockchain technology and ethereum contracts development and I cannot track down the bug I have in my first contract code. This is an ERC-721 (NFT) contract type. NFT is a reward for ...
0
votes
0answers
37 views

Why did this txn fail? Gas Limit 2x and Price 1.3x, but 'Out of Gas'

I deployed a solidity contract to rinkeby, then mainnet. The same transaction that succeeds on rinkeby, fails on mainnet due to "Out of Gas". The contract and client are the same. On the ...
0
votes
0answers
16 views

KeyError: 'result'

i am getting the following error: Exception has occurred: KeyError 'result' From this line of code: event_filter = contract.events.PairCreated.createFilter(fromBlock='latest') Anyone have any ...
0
votes
0answers
15 views

Contract debugging problem!

I have a contract with a bunch of different functions. When I call function A to initiate a transaction and get hash, And then I'm going to debug it in the Truffle Debug hash, In the debugger, it's ...
1
vote
0answers
15 views

Bep20 - I sent the token to the Token Address [duplicate]

I accidentally sent the token to the contract itself. This mistake is worth more than $300,000 as of now. I was wondering if ANYONE could look over the code and help me resolve this issue. Is there ...
0
votes
1answer
41 views

Transaction failing without reason

This transaction failed without reason, https://blockscout.com/etc/mainnet/tx/0x58c0a6880fcf5a04957384768865966a05869d864932ab88b7a5ae3491191db5/internal-transactions. I don't think it ran out of gas, ...
0
votes
0answers
60 views

Check if smart contract function exists from code and then call it

I'm getting the code of a smart contract by using web3.eth.getCode(contract_address) I want to call certain functions that I'm fairly certain exist on that contract, however I don't know the ...
1
vote
0answers
17 views

in remix -> "Storage" -> what is the meaning of this top level key?

what is the meaning of this key? it's not a memory address of value - this is thisobject.key contract code (but it doesn't matter) // SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.5.12; ...
0
votes
1answer
241 views

ERROR "execution reverted: AssetContractShared#creatorOnly: ONLY_CREATOR_ALLOWED"

I am doing a two step minting process. user will setApprovalForAll for a new contract to transfer old tokens user will burn old tokens and mint new ones from the new contract Burn and mint function ...
2
votes
1answer
236 views

Can you test a contract function transaction by calling it instead

I am trying to test my deployed smart contract functions without having to go through the transaction and pay gas fees. I saw that Metamask can detect if a smart contract function is going to fail ...
1
vote
1answer
46 views

How do I initialise a dynamic array in a solidity struct for every newly created struct?

contract Foo { struct Bar { address owner; uint[] x; } mapping( uint => Bar) bars; function foobar(uint index) public { Bar memory b = bars[index]; ...
0
votes
2answers
665 views

How to fix Error: invalid address

I am trying to run the smart contract listed in the documentation here https://docs.soliditylang.org/en/v0.8.7/introduction-to-smart-contracts.html#subcurrency-example // Sends an amount of newly ...
0
votes
1answer
24 views

Contract Factory only recreates itself, not the subcontracts

I'm pretty sure I'm missing something really basic here, but my contract will only create new instances of itself (the factory), rather than of its subcontracts. I've stripped the code down to the ...
0
votes
0answers
7 views

parsing error in smartcontract constructor

parsing error in smartcontract constructor, can some one please help me out and show me what I am doing wring and why this error is even thought everytrhing is looking fine from outside.
0
votes
1answer
138 views

No contract at given address

I deployed a contract on a private network and it worked but all of a sudden it stopped working for reads only writes still succeed. I get no contract at given address. Below is my call of the ...
0
votes
1answer
12 views

Contract is working but no "Verify and Publish"

Contract is working but no "Read Contract" and "Write Contract" and no "Code" And no verify and publish. So i tried coding and the Minted Tokens are correct, 100% of the ...
1
vote
1answer
30 views

First Smart Contract: How to emit exact string data?

So I've written my first smart contract and deployed it onto the Ropsten test network, which is a simple program to write "hello world" into the data field when deployed. pragma solidity 0.8....
1
vote
1answer
423 views

Why is transaction reverting with no additional error details?

I don't understand how people can debug transactions when there are no error details shown. Here is a recent transaction I submitted to Polygon: As you can see, it doesn't in any way indicate what ...
1
vote
1answer
77 views

Reverted transaction and lost Eth of .05 during NFT sell out

I was buying a "Panda Dynasty" NFT during the sale Saturday and they ran out of Pandas. It says "Warning! Error encountered during contract execution [Reverted]", but I was never ...
0
votes
0answers
11 views

Need help for a big mistake with my ETH - please (Get 10% for a solution)

i´m Soeren. i was thinking this is the right way to get DAO token with Ether because i have found this tutorial: https://www.ethereum.org/token4 And with all of this codes (very complex for me) i have ...
0
votes
1answer
34 views

Is the vm trace step in the Remix debugger the program counter?

When debugging an Ethereum transaction with Remix, there is a section called "Step details" on the left-hand side of the screen: Is the "vm trace step" the same as the program ...
0
votes
1answer
64 views

Decompiling the contract with keccak function

Currently, I'm researching how to construct the solidity version from the bytecode. However, I try to understand how keccak works, but I'm not sure about the parameters (such as the below code) So, ...
0
votes
0answers
58 views

Creating Structure for mapping of data inside mapping? [duplicate]

you would need to change the data structure of playerInfo so that instead of one value for playerInfo[msg.sender].matchSelected, it would have a mapping of values. Also, you need to include ...
0
votes
1answer
19 views

"invalid opcode. The execution might have thrown." Error

The below contract compiles and can be deployed. But when I try to transact using the createProject function, I obtain an error as follows: transact to Details.createProject errored: VM error: ...
0
votes
2answers
34 views

Can someone help me to fix the betting, I can't bet on other game match_id once I bet on a match

Thi is the full smart contract:https://github.com/laronlineworld/betMatch/blob/main/betMatch.sol This is betting contract, when betting on id_1, the same address can't bet on id_2. I'm using Game ...
0
votes
1answer
85 views

Reference Examples for Amount of Gas (transaction/execution) Cost for Contract Deployment

Please excuse this newbie in advance! I am wondering if anyone would share their experiences on the cost of deploying a contract, be it in on the main net or on a test net or even remix. I understand ...

1
2 3 4 5
13