Questions tagged [contract-debugging]

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

Filter by
Sorted by
Tagged with
-1
votes
0answers
22 views

Can someone help me out with my Solidity code?

I'm trying to write a life insurance smart contract. My nested mapping of the beneficiaries compiles an error (undeclared identifier) and I really do not know how to divide the policy cash value and ...
0
votes
0answers
19 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
24 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
41 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
33 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
25 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
36 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
93 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
33 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; ...
0
votes
0answers
16 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
33 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
34 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
42 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
24 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
69 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
16 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
36 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
13 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
18 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
27 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
55 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
19 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
224 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": "...
1
vote
1answer
132 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
53 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
45 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
60 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
343 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
792 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
42 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
90 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
99 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
41 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 ...
0
votes
0answers
15 views

Pulling EVM Bytecode of Contract Address [duplicate]

Is there a way to pull the EVM bytecode of a given contract address? Using Web3 perhaps? I believe using the web3.eth.Contract command may get access to the contract, but I am specifically looking ...
0
votes
0answers
17 views

Feeding a contract address to echidna

Simple question: Can I use echidna on a contract address? Like in mythril the command I use is myth -v4 analyze -1 -a 0xec410f642db4a2bcc4d7a69bc13b1165ebad3cea. I don't see any supporting ...
1
vote
2answers
902 views

How to check Ethereum smart contract info?

I want to know 3 things: Is an address a smart contract? Is this smart contract an ERC20 or ERC721 token? Is the Solidity code public?
1
vote
1answer
31 views

How to call a function with params and check them

I want to create a smart contract that users can send a number to and receive an amount of ether. function airdrop(uint val) public payable { require(airdrop == true); if (val == 0x31){ ...
4
votes
2answers
97 views

Verifying a Token Contract with Interface

I managed to deploy a token contract with interface on Kovan Testnet. Now I wanted to verify the code. However this is a bigger problem than I thought. The contract got successfully deployed to: ...
1
vote
0answers
56 views

Cannot execute contract in non-intaractive scripts

I want to deploy and to execute ERC-20 contract on geth with non-interactive scripts. But, it seems that non-interactive scripts and console shows different results. Enviroment ubuntu 18.04(docker ...
0
votes
1answer
52 views

I accidentally sent a token to a token contract. Can I get it back? $MWAT [closed]

community! Instead of transferring my ERC20 token $MWAT (RED PLATFORM) to my wallet, I accidentally sent it to the contract itself https://etherscan.io/tx/...
0
votes
2answers
98 views

ParserError: Expected pragma, import directive or contract /interface/library definition

In an attempt to compile my ABI and verify my contract, I am getting the following warning: "ParserError: Expected pragma, import directive or contract /interface/library definition" on the first line ...
2
votes
2answers
274 views

Web3 - Access return value of events

I want to get the value that my smart contract returns in javascript. Here is the contract. (version 0.4.25 - web3 version 1.2) pragma solidity ^0.4.25; contract SimpleStorage { uint public ...
0
votes
0answers
46 views

How to debug a mainnet transaction which uses Delegatecall without running a full node?

I need to debug a transaction which was reverted on mainnet. The problem with most Debuggers (including remix), is if there’s a ᴅᴇʟᴇɢᴀᴛᴇᴄᴀʟʟ in that case, they don’t attempt to load the target ...

1
2 3 4 5
10