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

Unable to approve [closed]

/// pragma solidity ^0.6.0; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol"; import "https://github.com/OpenZeppelin/...
0
votes
0answers
17 views

How to use the arithmetic increment operator in an if statement? [closed]

What do I need to change to make these examples work? Example #1 uint256 totalDeposits; uint256 thisValue; if(amount > 0) { totalDeposits++; } if(totalDeposits == totalDeposits++) { ...
0
votes
0answers
21 views

Are assertions removed in release build?

Are assert() removed in release build? Please show an authoritative document documenting that they are removed or no removed.
2
votes
0answers
29 views

How to simulate time increase in Remix IDE?

In my JavaScript tests: module.exports = { increaseTime: (duration) => { const id = Date.now(); return new Promise((resolve, reject) => { web3.currentProvider.send({ ...
1
vote
1answer
21 views

How is caller's data related to bytecode?

I know that smart contract is deployed as bytecode. When we call a function from application, we use the encoding with the help of ABI and we get some bytes. let's say 220 bytes. These are the bytes ...
1
vote
1answer
38 views

contract inline assembly - return array parts by using assembly

I've a couple of questions. mload function returns the data that resides on the address we pass to mload. Is this correct ? add function is used to give us the address from 0 to whatever we pass. ...
0
votes
1answer
23 views

why separate assignments are better than single?

I've read that: It is more gas efficient to initialize a tightly packed struct with separate assignments instead of a single assignment. Separate assignments makes it easier for the optimizer to ...
0
votes
0answers
10 views

howt to generate AST tree form (not in JSON form) from Solidity File (.sol)

I have .sol file and want to generate AST only from .sol file. My scenario is that at the command line (after installation some package), I just have to give a command like package_command --AST [from ...
0
votes
0answers
22 views

Problem Uploading Contract Verification to Etherscan - Contract works perfectly and is already deployed

BOUNTY WILL BE GIVEN FOR SOLUTION I am having trouble authenticating my ERC-20 Token Contract on Etherscan. Token works perfectly and all functions are correct I am a novice dev and lead dev of ...
0
votes
2answers
36 views

Stuck ETH in Smart Contract

Can somebody please help me? Created and deployed a smart contract and now ETH is stuck in it and won’t show in the creator’s account. any way to get it using the creator’s PK? Need help so badly, ...
0
votes
0answers
13 views

How to find whether a call in debug trace has out of gas error?

In the debug trace of a transaction collected using debug_traceTransaction, how can we know that an internal call was terminated because of out of gas error? Specifically, when a send() is used to ...
0
votes
1answer
23 views

Auction project in Solidity: Why do I get “VM error: invalid opcode” for this code?

I am trying to do an Auction project and this part is bugging me. I can't figure out what is the problem that's causing the following error message: "VM error: invalid opcode.". Even if I do ...
0
votes
2answers
25 views

Token Access Issue

Hi Sir we Create Token but we cloud'n have full access on Tokens. Like we create 2000M Token but when I add it in my Metamask I got only 200M Tokens. Cloud you please me out for this?
0
votes
0answers
107 views

How to estimate gasLimit of ERC20 contracts in web3.php project?

I am using web3.php project in my Ethereum based project. A part of this project is sending ERC20 tokens, and in this regard, I need to estimate gas limit of transaction. For this purpose, I found the ...
0
votes
2answers
50 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, ...
0
votes
1answer
68 views

How to withdraw Other ERC20 tokens besides Ethereum from my contract

I'm trying to implement something like this (which works) function withdraw() public { msg.sender.transfer(address(this).balance) } but I need to be able to withdraw ERC20 tokens other than ...
2
votes
1answer
59 views

Why doesn't the solidity perform rounding off to nearest whole number

The function getInt() is always returning more than 1. Shouldn't it do a round off for values less than 0.5 and return 0 ? Please check the image and let me know, if I am doing something incorrectly ...
0
votes
2answers
470 views

How to debug a “rpc error with payload”

Debugging smart contract errors can be surprisingly hard. There is one particular kind of error that annoys me the most: the infamous rpc error with payload. For instance, just a few hours ago, while ...
0
votes
1answer
50 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 ...
0
votes
1answer
55 views

What are the flaws of this example contract?

I am currently writing a paper/article on tokenization, in the beginning of which I introduce smart contracts. To this end, I present the following contract as an example: pragma solidity ^0.6.0; ...
1
vote
0answers
33 views

What is the best practice to deploy local contracts for testing?

I am trying to developing smart contracts let use some Tokens and DeFi protocols like USDC, Compound, Uniswap, etc. Then if I need to testing locally, I need to deploy them in localhost blockchain (...
0
votes
1answer
65 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
38 views

Transaction halted with a RUNTIME ERROR

while debugging I encountered this error: There was no revert message. This may be due to an in intentional halting expression, such as assert(), revert(), or require(), or could be due to an ...
2
votes
0answers
45 views

How to know the reason of transaction's reversion in parity?

I am testing ERC20 USDT contract locally with parity. I imported contract to my private testnet and manually generated raw transaction that calls "transfer" method of contract. I send it to the node ...
1
vote
1answer
25 views

How to get active users of Dapp [closed]

Is it possible to have unique constraint on parameters of an event? I will have a number of users using my Dapp, and I have provided functionality to delete the users. So while reading from the ...
1
vote
3answers
164 views

simulate transaction without sending to blockchain

Is there any way to simulate a transaction without sending it to the blockchain and find the exact error (or line of code), in case it fails if its mined?
0
votes
1answer
17 views

Recover parameters from failed transaction on etherescan

I have some failed transactions on etherscan that I'd like to investigate. An example is this one. How do I convert inputs like 00000000000000000000000000000000000000000000000000000001ae43e5e0 to what ...
0
votes
1answer
43 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 ...
0
votes
1answer
15 views

Getting a, “ReferenceError: artificats is not defined” - Error running a simple “approver” test

(Working from the Lynda Ethereum course) Running the test code below I get the following error: truffle tests Warning: Both truffle-config.js and truffle.js were found. Using truffle-config.js. ...
0
votes
1answer
20 views

“TypeError” for a simple program causing failure to compile, “Type address is not implicitly convertible to expected type address payable.”

This is my first contract (working from Lynda course). Even when I use the supplied code I still age this error for the following code with I try to compile: TypeError: Type address is not implicitly ...
1
vote
1answer
28 views

Information Regarding LASER and Ethereum

I was reading this article https://diligence.consensys.net/files/D1T2%20-%20Bernhard%20Mueller%20-%20Smashing%20Ethereum%20Smart%20Contracts%20for%20Fun%20and%20ACTUAL%20Profit.pdf and came across ...
1
vote
2answers
82 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
21 views

Testing Smart Contract with multiple clients

After deploying a smart contract on Ropsten Testnet using Truffle framework, we can use truffle tests to do unit testing (create a client to interact with the deployed contract). My question is, how ...
0
votes
2answers
363 views

How to diagnose a “Error: Transaction has been reverted by the EVM”?

This the error intercepted from my javascript, using web3.js Error: Transaction has been reverted by the EVM: { "blockHash": "...
2
votes
1answer
164 views

Getting an 'invalid opcode' calling a solidty function from test file

im in the process of learning about ethereum and Solidity, and im having a problem calling a payable function from a test file. This is my contract pragma solidity >=0.4.22 <0.6.0; //pragma ...
3
votes
3answers
59 views

Revising Smart Contracts [closed]

If I create a Smart Contract that pays users for sharing their data, how can I ever update this smart contract in the case it has an error, or perhaps I wish to change the amount paid for data sharing?...
1
vote
1answer
66 views

Cannot transfer ownership of ERC20 contract

My contract source code likes below: contract StandardToken { uint256 totalSupply; ... } contract Ownable { address public owner; function Ownable() public { owner = msg.sender; } ...
0
votes
1answer
27 views

Why does declaring returns type bytes memory give a compiler error?

If we have the following code: pragma solidity >= 0.5; contract stringsContract { function takesTwo(string memory str, uint idx) public pure returns (bytes memory) { bytes memory ...
0
votes
1answer
89 views

Remix IDE: How to debug a contract having a function with a argument & for Loop

I am trying to debug a contract on Remix IDE: pragma solidity ^0.5.1; contract DebuggerSampleContract{ int counter = 10; function LoopCounter(int _input) public view returns (int) { int ...
0
votes
0answers
19 views

Sample Contracts for Testing Static Analysis Tools

I have to analyse some static Analysis tools against well documented vulnerabilities. My questions are ; Can we use the provided sample contracts (in above link) directly or not ? If not, then where ...
0
votes
1answer
513 views

VM error: revert.The called function should be payable if you send value and the value you send should be less than your current balance

There is already a similar question, but it doesn't help me. So I ask this question again and expect something useful information. Two contracts named AccessControl.sol and Judge.sol. I've removed ...
1
vote
2answers
1k views

Install Old Solc Compiler Versions

I would like to compile older versions of solc contract source code using a solc compiler on my local machine. Is there a website from which to download old solc compilers? Google revealed a GitHub ...
2
votes
0answers
30 views

Address to create a contract

This query is for informational purposes, with something that has had me in doubt all night. I am trying to send a self-signed transaction for the creation of a contract My Tx transaction to send is ...
2
votes
1answer
44 views

Solidity. Find whether a key exists in a mapping. Then get its value

I have a simple mapping: mapping(address => string) professorsExam; How can I check if msg.sender is a key in this mapping, and if it is, get its value? If it isn't I should return something. ...
0
votes
0answers
16 views

Backward program analysis (like symbolic backward execution) tools for smart contracts

I know there are some backward program analysis tools for traditional softwares, but i wonder if there are already backward symbolic execution tools for smart contracts, or any tool that I can refer ...
0
votes
1answer
108 views

Solidity - Creating child contract

Recent code: pragma solidity ^0.5.11; pragma experimental ABIEncoderV2; contract Master { address Pi_C_Owner; address payable public NewAuctionPayable; //Hilfsvariable um ...
0
votes
1answer
118 views

Help me Understand the flow of this smart contract

I have 2 smart contract, below is the implementatin of them : 1) import "./MaintainableUpgradeabilityProxy.sol"; function _createProxy(address implementation, address serviceRegistry) internal ...
0
votes
1answer
39 views

Adding a payee to a donation contract. Error: Transaction reverted

Disclaimer: I'm a noob when it comes to programming altogether let alone smart contracts. I refactored this code that was written like three years ago so it could work with solidity 0.5.0. I deployed ...
0
votes
1answer
64 views

How can I debug a my Solidity smart contract with a GUI?

Is there any way to debug a Solidity smart contract with a GUI, like remix? How can I do it for both testnets and mainnet?
1
vote
1answer
25 views

What are the ways to call a smart contract function during development?

What are the ways to call a smart contract function during development using Truffle simulated VM with a GUI interface (like Remix or EtherScan offer)? I know I could use CLI options like Truffle ...

1
2 3 4 5
10