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
18 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
4 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
12 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
5 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
18 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
30 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
22 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
9 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
11 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
25 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, ...
-1
votes
0answers
31 views

how to bet on other matches, playerInfo maps only one value, it needs a mapping of value including match?

source code::https://github.com/laronlineworld/bettingMatch/blob/main/bettingMatch.sol everytime user/wallet address bet on different matches, the date of playerinfo overwrite due to mapping of on ...
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
15 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
24 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
25 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
vote
3answers
62 views

How to debug a solidity test

I am using ganache and truffle to write some tests in solidity (following the example in https://www.trufflesuite.com/docs/truffle/testing/writing-tests-in-solidity). I am getting the usual, not ...
0
votes
1answer
44 views

{ "code": -32000, "message": "invalid opcode: opcode 0xfe not defined" }

When distributing prize, this error will show:{ "code": -32000, "message": "invalid opcode: opcode 0xfe not defined" } full code here:https://github.com/laronlineworld/...
0
votes
1answer
27 views

How to detect out of gas errors on internal transactions without a return?

I was working on the 13th level of Ethernaut when I discovered that calling a function of a contract with an explicit amount of gas results in a revert with no further description, even though the ...
0
votes
0answers
28 views

Etherscan Show Fail out of gas. Eth deducted. But transaction not completed [duplicate]

I have enough ETH to pay the gas fee. After I click accept the transaction fail and it show out of gas on etherscan. Now the gas have been deducted but no transaction happen. Can someone help? The gas ...
0
votes
0answers
24 views

Gas estimation error - Not sure why

I made two contracts, one for a simple ERC20 token and then another one to accept that token. Simple ERC20 Token pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol&...
1
vote
1answer
31 views

How to assign an array inside a struct?

I'm trying to assign an array to a struct item.creators.push(_creators[i]);, but it's not being assigned. I don't receive any error from the compile, but the only attribute that is created inside &...
0
votes
1answer
34 views

Send ERC20 token from a forwarder contract address to another address

I am having difficulty spending the funds in a smart contract address. The smart contract address was generated using an ETH forwarder smart contract - https://github.com/primozkocevar/SigWallet-ERC20/...
0
votes
1answer
39 views

How to fix TypeError in a Solidity contract?

I am having issues with getting the contract below to compile. Here is the contract I am trying to compile in Remix IDE. The issue has been commented below <--- ISSUE IS HERE. // SPDX-License-...
0
votes
0answers
17 views

{ "code": -32000, "message": "execution reverted" } For betting Reward distribution

function execution reverted if function is applying function distibuteRewards() onlyOwner public { require(bettingActive = false); bytes32 winningCandidate = candidateList[getWinner()]; /...
0
votes
1answer
35 views

Contract has not been not deployed to detected network

I'm trying to access a smart contract in my local dev environment, but it doesn't appear to be deploying fully. In summary, I get what seems to be a successful migration, however, I am not able to ...
0
votes
1answer
86 views

How to return a storage array from a Solidity function?

I wrote a very simple smart-contract where I want to create an external function which returns as an output a storage array which contains the following items [0,2,4,6,8,10,12,14,16,18]: pragma ...
0
votes
2answers
144 views

How to Approve contract to transfer tokens

I have two contracts, one that issues a token and gives the approval for the Marketplace contract. And the other, Marketplace, allows you to put a token for sale and sell the token. My problem happens ...
0
votes
0answers
42 views

Any way to revert setMaxTxPercent to original?

I deployed a token using cointool. Wanted to change the maxTxAmount - tried to do it from bscscan (write contract) instead of through cointool admin. I mistakenly thought setMaxTxPercent in the 'write ...
0
votes
1answer
16 views

smart contract information issue

Hi I was scammed by troncase, I want to know how to get my original staking out of the smart contract. it is asking me for a userAddress_address, last_uint256, first_uint256 What do i type in those ...
0
votes
1answer
20 views

How to interact with Smart contracts Locally

I'm interested in writing a some code that will interact with Aave and a few other Defi projects such as uniswap. I've downloaded truffle an ganache. However I'm bit confused on how to write a ...
0
votes
1answer
45 views

Truffle compiler version not changing

truffle.js: var HDWalletProvider = require("truffle-hdwallet-provider"); var mnemonic = ""; module.exports = { networks: { testnet: { provider: () => new ...
0
votes
0answers
41 views

Truffle compiler version error

I keep getting an error that my truffle is currently running version 0.5.16. Error: Truffle is currently using solc 0.5.16, but one or more of your contracts specify "pragma solidity >=0.8.4&...
2
votes
0answers
19 views

Solidity sourceMap and opcodes. No map entries for every code?

After compiling a simple contract, the output are these values: "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH1 0xF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP ...
0
votes
0answers
12 views

interacting with contracts using eth-cli

I have a test NFT contract deploying ok to test network, (using remix) pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@...
0
votes
0answers
17 views

ETH contract FAILED "reverted" - what is the ETA?

https://etherscan.io/tx/0x03b22e12ee4a0c044bd7cd6c8b065134fb47e00bc9826884e14686ad03dff225 How long does it take for a contract "reverted" to return to place of origin? Thank you for help
0
votes
0answers
80 views

How to prevent timeout on Solidity contract (not on tests or deployment config)

Consider the following function which is our current workaround to calculate the power of fractionals without overflowing (if you know a better one please let me know in the comments): function power(...
0
votes
0answers
32 views

Does pending account nonce affect truffle contract deployments?

I have pending transactions with nonce 0,1,2,3. I am deploying a contract with truffle-cli, with relatively low gas, but enough for it to deploy, successsfully passes truffle's gas checks. But it just ...
1
vote
1answer
212 views

Please, help with tuple[] in Remix interface (solidity, smart-contract)

Please, help with tuple[] in Remix interface. Contract - RaribleUserToken Function: mint I have problem with "fees" argument My attempts: ['0x0000000000000000000000000000000000000001', 34] [&...
0
votes
0answers
12 views

Why can't I send eth to this Smart Contract? [duplicate]

I am trying to send eth to an address of a contract which I deployed on ropsten testnet. When I tried sending eth for the first time. The transaction failed and I got an "out of gas error" : ...
0
votes
0answers
200 views

Uncaught TypeError: Cannot read property 'contract' of undefined

I'm getting this error. Can someone please help me Uncaught TypeError: Cannot read property 'contract' of undefined at add_details ((index):140) line:140--> var myContract = new Web3.eth.Contract(...
1
vote
0answers
44 views

AttributeError: 'list' object has no attribute 'encodePacked' when calling a smart contract function with web3.py

Here is the pycharm code: import json from web3 import Web3 ganache_url = 'http://127.0.0.1:7545' web3 = Web3(Web3.HTTPProvider(ganache_url)) web3.eth.defaultAccount = web3.eth.accounts[0] ...
0
votes
0answers
38 views

Withdraw funds from contract

I made the following withdraw function in my smart contract: function withdraw() public onlyOwner { (bool success, ) = msg.sender.call{value: address(this).balance}(""); } I call ...
0
votes
1answer
51 views

Balance of contract

I am testing a smart contract but I have troubles accessing the balance of the contract in my javascript test file. For simplicity assume this is my smart contract: contract Donation{ function ...
0
votes
1answer
42 views

How to call a payable function within a payable function from the same contract?

Imagine a contract with a 2 functions: A.sol: contract A{ function buyItem() { #implementation } function buyItems() { for(#loop_conditions) { ...
0
votes
1answer
23 views

splitting contract in data and application contract

I made 2 contracts in 2 different solidity files. Lets for simplicity assume the contracts are called A and B. A contains data and some simple function calls, B contains more complex function calls. ...
0
votes
0answers
67 views

Why is my smart contract address for my token accumulating tokens?

The link to my smart contract on bscscan is 0xB7EBB0715A799e5A3749DBAAF6657c10c1da07D3. You can see that the contract owns 1.8% of the total token supply. This number keeps rising. Can you explain why ...
0
votes
0answers
26 views

How to create a Nested Looping of an array of addresses and addresses' balances

I am writing a Presale contract for a particular number of addresses. it is only the owner of these addresses that can participate in the presale, however, I get fetched these addresses on-chain then ...
0
votes
1answer
91 views

Remix debugger: empty screen

I'm running Ganache with a fork of mainnet with Remix - when I try and debug a transaction by clicking on the 'debug' button after sending a transaction, it sends me to the debug screen. When I then ...
1
vote
0answers
85 views

Totally stumped with "INSUFFICIENT_LIQUIDITY_MINTED"

I have been at this now for about a day and a half an I'm totally lost. In advance, I'm sorry if this is a simple question - I'm new to solidity (although not new to programming, blockchain and crypto ...
0
votes
0answers
18 views

ALERT: Transaction Error. Exception thrown in contract code while using Safemoon fork [duplicate]

I'm currently trying to use dxlock to lock my tokens, but whenever I try to lock them, it gives me ALERT: Transaction Error. Exception thrown in contract code. Anyone has any idea what's going on? ...

1
2 3 4 5
12