Questions tagged [contract-debugging]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
33 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
14 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
21 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
40 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
14 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
17 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
29 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
16 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
37 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
15 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
21 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
241 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
107 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
45 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
64 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
28 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
55 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
61 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
54 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
19 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
25 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
49 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
44 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
116 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
215 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
52 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
435 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
36 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
30 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
40 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
16 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
273 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
156 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
67 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
164 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
59 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
48 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
86 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
35 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
140 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
32 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
43 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
76 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
735 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
31 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 ...
4
votes
1answer
1k 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(...