4

This is because recoveredAddresses isn't marked as memory, so by default, it's in storage. Every time you push to it, you're growing the length, even across transaction calls. That also means that the function contains has to iterate over a larger and larger array of addressArray every time it's executing, growing the gas cost over time. The solution is to ...


2

Alright, y'all are lazy so I did it myself. This is a super rough estimate. Here's a gist of my script to get all the function names in the top 1000 'verified contracts' on etherscan. The script downloads the abis for all the top contracts and checks for the existence of functions with the names in the following list: ['transfer(with bytes)', '...


2

All your migrations run from the beginning. Using ganache blockchain (for this example), you can check this information at the bottom of your contract's .json files. Before --reset: "networks": { "5777": { "events": {}, "links": {}, "address": "0x2429A2d4d4eE68C33a08e0490f5E3daf9d3329Ef", "transactionHash": "...


2

Try with this: pragma solidity ^0.5.1; contract MKotET1_12{ address payable king; uint public claimPrice = 100; function calculateCompensation() public returns(uint) {} function() external payable { if (msg.value < claimPrice) revert(); uint compensation = calculateCompensation(); (bool success, ) = king....


2

You'll have a much easier time of this if you can use a recent version of Solidity. Starting with 0.5.x, you can get back the return value as a byte array and then decode it yourself depending on its length. Here's some code that handles both return values (a single uint256 or a pair of them) and returns a 0 as the second value if it wasn't returned from ...


1

Reading the comments, maybe you are looking for something like the following. I've changed the values to see more easily the outputs. To test, you need to pass the address of NotMyContract1 or NotMyContract2 as a parameter of the getValue() function. pragma solidity ^0.4.25; contract NotMyContract1 { uint256 a = 721; function func() external view ...


1

You are getting a reversion because a call returns two values and you are treating it as one. When performing king.call.value(compensation)(""), what you actually receive back is the success bool and the bytes response. As it stands, you are trying to check for the bool value, but ignoring the fact that it also returns a response. Your code should look as ...


1

You do not need to explicitly state the second variable declaration. You can write it as follows: (bool success, ) = king.call.value(compensation)(""); require(success);


1

The version of solidity you are using is very old. The latest stable compiler for solidity is version:0.5.8+commit.23d335f2.Emscripten.clang. You can use the following code to remove the above error. But you have to use the latest version of solidity. pragma solidity >=0.4.0 <0.6.0; contract Stratus { string public greeting; address public ...


1

I fiddled with code formatting in the original question. The first issue is this line: bal+n; It should be bal = bal + n; to do something, or the shorthand, bal += n; but we will still have a problem. What is n? That's the complaint. In C you send(n). n has meaning in that context but the variable name is not transmitted. It's an amount of ether ...


1

Your use of for(i=0; i<n; i++_) implies O(n) complexity, meaning you can optimize the process but it will still increase in cost proportional to n. Optimization only affects slope steepness. The real problem is there is a slope at all. Unbounded for loops are an anti-pattern because they are not scale-invariant. Have a look at this: https://blog.b9lab....


1

Case 1 You cannot make map_1 public because the compiler doesn't know how to construct the "free" getter than comes with public. You have to make it yourself, like this: pragma solidity 0.5.1; contract Case1 { struct BB{ mapping (uint => address) map_2; } mapping (uint => BB) map_1; function getter(uint structId, uint ...


1

You can access the case 1s mapping by given the both keys. The key for map_1 and key for map_2. Use pragma solidity ^0.4.20; when compiling Case 1 contract test { struct BB { mapping(uint => string) map_2; } mapping(uint => BB) map_1; function test() public { map_1[1].map_2[1] = "hello"; //setting temp value } ...


1

None of the above. revert() will ensure no event is emitted. This, because revert "reverts" state changes and events are, indeed, state changes. Ergo, any events are reverted so you won't get the diagnostic outputs you are looking for. Use revert() with reason, revert("<reason>"); or require() with reason, require(<exp>, "<reason>");. ...


1

I figured it out. The problem was the compiler version of solidity. The smart contract only works with a solidity version below 0.5.4. There is already a Ticket in Github. For more information check: https://github.com/paritytech/parity-ethereum/issues/10502


1

Unless it is otherwise required to be a string, it would probably make sense for the function to accept a bytes variable. Assuming the string is coming from off-chain, this would throw if there are any invalid characters in there, and then you can just check the .length of the variable to ensure it's the correct length. uint hashLength = 10; //Or whatever ...


1

Assuming here a hash you mean is a TXID of Ethereum transaction, as there are many hashes and ways to present. Ethereum hashes are 256-bit numbers, usually in hexadecimal format. Hashes are not distinguishable from any big random numbers, as they do not contain checksum mechanisms and such. Verify that the entered input is hexadecimal. Also, you might want ...


1

It sounds to me like the state contract is too busy. Eternal Storage relies on storage contracts being as simple as possible. In that case, they would tend to not be very large. So, the size factor concerns me. It might imply an unwanted amount of complexity. You can use libraries to avoid repetition. Example, CRUD operations over key sets: https://...


1

To add further information about this issue, need to check if proper events are emitted. Looking at ABI: https://api.etherscan.io/api?module=contract&action=getabi&address=0x93ed3fbe21207ec2e8f2d3c3de6e058cb73bc04d The ABI does not show emit'ted events. So I think the MANUAL PROCESS is required. Note that some popular ERC20-like tokens such as ...


Only top voted, non community-wiki answers of a minimum length are eligible