Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [contract-debugging]

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

0
votes
0answers
20 views

how much structure variable does solidity support?

Error: "UnimplementedFeatureError: Variable inaccessible, too deep inside stack" code: contract create{ struct s{ string s1; string s2; string s3; string s4; ...
-1
votes
0answers
10 views

What can I write in the app.js to exchange with ethereum smart contract

I want to send data to storage it into blockchain from file .txt automatically every hour. this is my smart contract : pragma solidity ^0.5.0; contract Storagedata{ bytes32 data; function setData( ...
4
votes
3answers
210 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
64 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 ...
0
votes
0answers
32 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
37 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
13 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
27 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
31 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
39 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
16 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
14 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
14 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
23 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
46 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)...
0
votes
1answer
30 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][...
1
vote
1answer
67 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
124 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
38 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' + ...
1
vote
1answer
221 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
24 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: ${...
0
votes
0answers
25 views

Myetherwallet Balances?

I was testing on (Ropsten) Myetherwallet, everything was fine yesterday morning, then that evening, my balances (Ropsten Ether and Tokens) would not show. I was getting "(error_21) Not a valid ERC-...
0
votes
1answer
30 views

Remix uploading the wrong contract?

I have a contract called bridgeStacked that uses a library called BytesLib. When I have both loaded into Remix, I compile and deploy bridgeStacked from in Remix. First, I notice that in the log it ...
0
votes
1answer
17 views

Allow all ERC20?

So far a user can allow a smart contract or any address on Ethereum blockchain to spend their coins by calling the 'approve' function. If I want to allow address X to spend 250 of my FabulousCoins I ...
0
votes
1answer
15 views

i got error in if statement while i using the solidity version 0.5.0;

pragma solidity ^0.5.0; ... function SearchByTenderId(string memory a) public view returns(string){ string memory Id=a; if(keccak256(TenderId) == keccak256(Id)){ return "TenderId is ...
-2
votes
1answer
124 views

ParserError: Expected '(' but got identifier function OrderItem(uint _itemid, string _itemname) public returns(address){

browser/Logistics.sol:60:14: ParserError: Expected '(' but got identifier function OrderItem(uint _itemid, string _itemname) public returns(address){ ^-------^ pragma solidity ^0.4....
-1
votes
1answer
111 views

Getting error as Member “balance” not found or not visible after argument-dependent lookup in contract Lottery

I am trying one Lottery contract in that I am using one function which give me error. function pickAWinner() public restricted { require(this.balance >= 10 ether); uint index = random() % ...
0
votes
0answers
61 views

getting error solidity-member-transfer-not-found-or-not-visible-after-argument-dependent

I am trying to create one contract for Lottary app however I am getting error as " browser/test.sol:103:9: TypeError: Member "transfer" not found or not visible after argument-dependent lookup in ...
0
votes
1answer
103 views

Getting error : Error encoding arguments: SyntaxError: Unexpected number in JSON at position 47

While developing a Smart Contract with Solidity on Remix, after creating the contract I'm trying to calling function setGrantAddress: mapping (address => uint256) public balanceOf; but when I call ...
2
votes
1answer
42 views

UnimplementedFeatureError: Only byte arrays can be encoded from calldata currently

I received the error message UnimplementedFeatureError: Only byte arrays can be encoded from calldata currently from the compiler, but without any reference to a file or line. In a big project, and ...
0
votes
3answers
47 views

Owner is returned as 0x0000 … , what should I do?

I am a japanese student. I am studying ethereum. pragma solidity ^ 0.4.18; contract Owned { address public owner; // contract owner // / modifier for access check modifier onlyOwner () { ...
4
votes
3answers
74 views

Can a “forward” smart contract forward the received ether to another “forward” smart contract which forwards it to an address?

I am pretty new to solidity. I am trying to create a smart contract which deploys another smart contract and transfers ether to the newly created contract when a payment greater than 0.01 ether is ...
0
votes
1answer
32 views

i want to get data from the transaction hash i tried many codes at last i am getting boxes in the output

1) First, I got the input console.log(web3.eth.getTransaction('0x725fc75264726f409793164e336e7d5ed35df8d2be469a0cc1a3a8cc4756b9b9').then((i) => console.log(i) )); 2) I manually pasted the input ...
0
votes
3answers
92 views

Use function return variable of smart contract in web3.py

since im new to solidity programming i have some problem with executing my Contract. My Contract looks like this: # Solidity source code contract_source_code = ''' pragma solidity ^0.4.1; contract ...
0
votes
2answers
27 views

Optimization Exception Remix Editor

I am trying to compile my solidity code in remix editor. I keep getting this error "Optimization exception during compilation". I was using solidity version 0.5.2 till day before yesterday. Now, It is ...
0
votes
0answers
31 views

My smart contract doesn't accept ERC20

NOTICE: The below implementation works. It assumes that the calling addresse has approved both the spender and the contract to carry the transaction. Because they were not approved it was not working. ...
1
vote
0answers
28 views

state channel between smart contracts

In my scenario, there are data sellers and data buyers which might be persons or organizations. I would like to create a smart contract for data seller and another smart contract for data buyer where ...
3
votes
3answers
52 views

Function that returns address if is passed or msg.sender

I'm implementing an ERC721 contract and I want to execute the following logic. This is what I want: If the user pass to a method an address, return that address, if not, return the user's address. I ...
1
vote
1answer
508 views

How does delegatecall work from Solidity 0.5.0 onwards?

I am trying, for learning purposes only, to make a mutable smart contract, but I couldn't find anything useful on stackexchange because everything I found was using pragma solidity ^0.4.x; So, I have ...
0
votes
1answer
28 views

Unable to transfer from a contract to another contract

I was trying to learn how smart contract interaction by implementing a bank contract and a client contract. The end user create a Client contract. Then, he use the Client contract to deposit or ...
2
votes
1answer
987 views

TypeError: Invalid type for argument in function call. Invalid implicit conversion from contract to address requested

I am unable to use the 'this' Keyword in below code. function buyTokens(uint256 _numberOfTokens) public payable { require(msg.value == multiply(_numberOfTokens, tokenPrice)); require(...
1
vote
1answer
341 views

Returning Struct Array in solidity

contract TripHistory { struct Trip { string lat; string lon; } mapping(string => Trip[]) trips; function getTrip(string _trip_id) public view ...
2
votes
2answers
276 views

Getting ParserError: Expected ',' but got 'payable' and also one important security issue with contract

I have write a small smart contract for lottery system. however there is problem. please see below full code. pragma solidity >=0.4.22 <0.6.0; contract Lottery{ address[] public players; //...
1
vote
1answer
29 views

Need to use function modifiers however little confuse when implement and how

Hi I need help for writing below auction code. I want to use modifier however there is some changes in solidity which make me confuse. I have mentioned below where I need changes within "//" pragma ...
2
votes
1answer
46 views

What is the best way to test calling a contract's function from another contract?

I'm playing around w/ Gnosis' MultiSigWallet and noticed in their replaceOwner function it has a modifier that requires msg.sender to be the MultiSigWallet contract itself: modifier onlyWallet() { ...
1
vote
1answer
50 views

error in msg.sender

I'm pretty new to this solidity thing, so don't expect me to not make some elementary mistakes. Here's the code: pragma solidity ^0.4.25; contract toss3D{ uint tossvalue = 0; uint targetBlock =...
-1
votes
1answer
140 views

Trying to figure out this 2 ETH smart contract quiz

Does anyone know whether this smart contract can be broken? Is there some trick behind this? https://etherscan.io/address/0xfc62a32da21052fb3086e8f68ad10a7118a98606
1
vote
1answer
22 views

Ethereum Node I want to export transactions from a token

I have an Ethereum node running and I am wanting to export transaction history for a specific ERC20 token to a local database every 10 minutes. Does anyone have any suggestions on how they would do ...
-2
votes
1answer
99 views

What other function calls can freeze a smart contract like the pause() function?

I'm learning to audit Ethereum smart contract code for clues if a smart contract can be frozen or not. Many smart contract creators claim their contracts are "unstoppable", but I'd like to know if ...
2
votes
1answer
83 views

Handling the String msg returned from revert() in solidity

This is my sample contract.. pragma solidity ^ 0.4.15; contract Sample{ struct Info { address pubKey; //key bytes32 Id; } mapping(address => Info) public userMap; // ...