We’re rewarding the question askers & reputations are being recalculated! Read more.

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
32 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
48 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
28 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
9 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?
0
votes
1answer
14 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
12 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
10 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
101 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
25 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
55 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
46 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
26 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
50 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
54 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
27 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 ...
3
votes
1answer
33 views

What is the “pre-commit” scheme to defeat TOD attack?

I am writing to inquire feasible strategies to defeat Transaction Ordering Dependence (TOD) bugs. I learned from the best practice guideline such that we can use a so-called "pre-committed" scheme ...
2
votes
1answer
46 views

How to trace the line where a tx failed in truffle tests?

I know about 0x's sol-compiler and sol-trace. I used them before and they do exactly what I'm looking for, but these modules bring significant overhead when used with truffle. Check out this file to ...
0
votes
2answers
33 views

what is the transferfrom event signature?

I am currently writing a code that list all types of transactions in a given contract . my plan is to just check for all logs whether the topics[0] == an event signature of a function. and now i am ...
0
votes
1answer
69 views

Sending value to a solidity contract method from web3 results in `Invalid Tuple Value` error

I'm sending values to a solidity 0.5.1 method using web3 and keep getting an invalid Tuple value error. Here's the relevant contract code: struct mystruct { bytes32 id; string str; } ...
1
vote
1answer
48 views

Token migration and IDEX smart contract problem

During a recent token migration from token A to token B, a large number of token A were held by a number of people in an IDEX address (where it was ready to trade). The IDEX address is part of a smart ...
0
votes
2answers
18 views

Mappings can not be assigned to error

I am trying to create a dividend function for my token. This is in the first part of the contract for my coin: mapping (address => uint256) private _SavedDividend; Here is the constructor code: ...
0
votes
1answer
29 views

The constructor should be payable if you send value. The transaction has been reverted to the initial state

I'm following a LinkedIn course on Solidity and creating a simple contract. Code below: I'm new to solidity so I'm not sure exactly where I'm going wrong but I get the following error: Transact to ...
1
vote
1answer
62 views

No matching declaration found after argument-dependent lookup in remix IDE

I'm getting this error in remix: "TypeError: No matching declaration found after argument-dependent lookup. require(_spender.call.value(msg.value)(_data)); ^-----^ " function approveAndCall(...
0
votes
0answers
22 views

web3j - getter for array of addresses

I have a contract which has a field registry which is an array of addresses, Also have a getter for this field: function getRegistry() view public returns (address[] memory){ return ...
1
vote
1answer
28 views

Using contract to create Child contracts (web3j Java wrapper)

I have a simple Parent contract that creates child contracts and stores their address. contract Parent { address[] public registry; function createChild () public { address newChild =...
0
votes
1answer
47 views

Contract function call error “TypeError: Cannot read property 'isMinter' of undefined” using Truffle tool

I deployed a ERC20Mintable token in truffle env(the .sol file is ERC20Mintable.sol). 2_mintable.js ============= Deploying 'ERC20Mintable' ------------------------- > transaction hash: ...
0
votes
1answer
19 views

Syntax Error & how pay( ) would execute without explicitly calling pay( )?

I am getting a syntax error in the following code: pragma solidity ^0.5.1; contract C { function pay(uint n, address payable d)public { d.send(n); } } contract D1 { uint ...
0
votes
1answer
102 views

How to test the fuctionality of a Bittrex-related smart contract?

I've got my hands on a smart contract related to the Bittrex exchange. I would like to deploy this smart contract to test the functionality but I don't know how to call the functions properly. My ...
0
votes
1answer
32 views

truffle won't run tests while initializing a global contract instance

I am testing my smart contract in truffle. I need to declare some global variables hence I did so outside 'it'. I also tried declaring a global contract instance that I can use in all test cases. ...
0
votes
0answers
27 views

how much structure variable does solidity support? [duplicate]

Error: "UnimplementedFeatureError: Variable inaccessible, too deep inside stack" code: contract create{ struct s{ string s1; string s2; string s3; string s4; ...
4
votes
3answers
286 views

Handling decimals in somewhat complex math

I'm a bit lost on what to do with the following calculation. The problem is that decimals are being round up/down, which obviously doesn't give me the result I desire. int totalValue = 275000; int ...
2
votes
1answer
168 views

Is it normal to have Invalid opcode in a contract?

I was debugging my smart contract, while I did not encounter an invalid opcode error, I saw a lot of invalid opcodes in my deployed contract. Screenshot is from remix debugger. Is it normal to have ...
1
vote
0answers
104 views

why .call() in Truffle did not return results as expected?

I'm deploying a contract to my private chain and try to call the contract's function. After I got in the geth console and finished deploy contract, I called the function but it doesn't work ...
0
votes
1answer
109 views

dApp index.html fails to load for dAppUniversity election application

Hit a brick wall with this. git clone https://github.com/dappuniversity/election The following is the Shell output I get when I npm run dev. I’m using the cloned project from GitHub but I’ve ...
0
votes
1answer
42 views

Deploy Contract Syntax Error

I am testing a contract, when I run the truffle migrate command, in my deplyment contract located in the migrations folder the following error appears: var HelloWorld=artifacts.require (“./HelloWorld....
0
votes
0answers
76 views

Transaction to Smart Contract runs out of gas on Ropsten but not on Rinkeby

the following execution of my smart contract function runs out of Gas on the Ropsten network, but works fine on Rinkeby, do you have an idea why this happens? struct vehicleData{ string ...
1
vote
1answer
114 views

Using address.call.value to send ether from contract to contract in 0.5.0 and above

In Solidity v0.4.24 and below, I would send ether from contract to contract using the following code within a bigger function : if (!_address.call.value(_ether)()){ revert(); } ...
1
vote
1answer
75 views

overflow/underflow issues?

pragma solidity 0.5.1; contract basics{ using SafeMath for *; uint time; address payable sender; uint amount; event moneySent(address s,uint a); mapping(address=>person) ...
0
votes
1answer
28 views

Compile source code error expected pragma

I am getting an error when coding a token with the Ethereum wallet. Namely, Expected pragma, import directive or contract/interface/library definition. function burn (uint256 _value)public returns(...
0
votes
1answer
20 views

Memory error while compiling

Please have a look at the contract pragma solidity ^0.5.1; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, ...
1
vote
0answers
15 views

Understanding a simple online contract which seems not functional

I am writing to understand the functionality of this contract (https://etherscan.io/address/0x1f14b77e9f4844889fa63bc1e5180c8b90ec18db), this does not look even "functional" to me. Here is the ...
0
votes
0answers
26 views

Strange behavior of solidity program

After a long debugging I found that I had two following problems in a private ethereum network using geth: If I have a require statement then the code is not executed on the EVM. The solution I found ...
0
votes
1answer
57 views

Emit not firing event more than once

I'm experimenting a little bit with the blockchain, I'm currently trying to send from an oracle an address to store on the blockchain through a smart contract. The code (very simple and without checks)...
1
vote
2answers
34 views

Why is solidity throwing “Note: The constructor should be payable if you send value. ”, when clearly the issue is elsewhere?

I'm writing a contract on Remix that is able to deploy and track child contracts. Here are the 2 contracts: pragma solidity ^0.5.0; Contract Factory contract ContractFactory{ ChildContract[] ...
0
votes
1answer
49 views

What DSAuthority(0) and eos.owner() means and does?

In ERC20 EOS crowdsale contract, what these three lines(469-471) does? function initialize(DSToken eos) auth { assert(address(EOS) == address(0)); //[Someone explained this line here][...
2
votes
1answer
250 views

Debugging a failed transaction

I have a smart contract deployed to mainnet. A user has executed a transaction that resulted in a revert failure. How can I debug this transaction to determine what exactly happened that resulted in ...
2
votes
1answer
327 views

How to debug transaction from truffle test on development network

I am trying to debug a failing solidity function, which I am calling from the JS test files with truffle. When I run my test, I am successfully able to get a transaction id. However, my solidity ...
0
votes
0answers
60 views

Get the result back of a smart contract function call using INFURA

This is the function I use to send a signed transaction using Infura to invoke a smart contrac function (see details for the params of the transaction). web3.eth.sendSignedTransaction('0x' + ...
2
votes
1answer
775 views

How to make smart contract call using INFURA and NodeJS web3js

I can not understand how I can prepare the transaction to be signed. Because INFURA does not support eth_sendTransaction but only eth_sendRawTransaction (INFURA API which then requires you to prepare ...
0
votes
0answers
59 views

Hot to debug a contract method invocation?

Running this code: PrintProofOfWork.methods.printRequested(gcodeHash).send({from: web3.eth.defaultAccount}) .then((result) => { console.log(`result of the invocation: ${...