3

Yes, checkReturnData() will be able to read the return data from originalContractInterface and will return 1. For context, returndata is the data returned from the last function call. returndatasize is the size of the return data from that call. In the example given in the question, mainFunction() calls originalFunction(), which then sets the returndata ...


3

Check out the fallback function. https://github.com/rob-Hitchens/TrustlessUpgrades/blob/master/contracts/Proxy.sol function () external payable { address implementationAddress = userImplementation(msg.sender); //solium-disable-next-line security/no-inline-assembly assembly { let ptr := mload(0x40) ...


2

1 - Check this for more detailed info 2 - If you switch the pragma solidity 0.5.X to 0.6.2 (last one), you will see that you are able to deploy the same contract with no warning saying "you shouldn't deploy the experimental features in live networks". 3- Not for now, if you use solc bellow 0.6.X, the only way of retrieving the values by key/index Hope ...


2

It might be important to make a distinction between the EVM (and what is possible) and the solc compiler (and what is enforced). Have a look at this excerpt from a fallback function in a proxy contract. It offers no expectation about the return data size (no returns()). It could be anything the EVM can do. Even so, it faithfully returns whatever it ...


2

Yes, you are correct. Since byzatium fork we have two new opcodes RETURNDATASIZE and RETURNDATACOPY. They allow the caller contract to determine how much data was returned by the callee. In new versions of the solidity compiler it is enforced that the returned data size matches of the function being called and revert if they don't match.


2

No, they are not equivalent. The first will allow to return more than 32 bytes of data. The second one will revert in that case. There are also other side effects like the first one allocates memory for the returned data and the second doesn't allocate new memory it uses the 0 address.


1

You can get the status with web3.eth.getTransactionReceipt(). Running that command with your tx hash will produce the following: web3.eth.getTransactionReceipt('0xb818a71e2d8bc6b661f463fbf96c91ecbf60610042b39da7e8806b2e0b5c2575') > { blockHash: '0xfcce6583cfede31bd59b53ac4b562b391a0c1f1b8539f4961ded1418be50d241', blockNumber: 2856676, ...


1

Yes - use Solidity 0.6.x where the ABIEncoderV2 is no longer considered experimental ;). They've been working on it for a while, and it's been available to test in earlier versions during this period. Having said that, you still need to use a pragma to enable it in 0.6, but hopefully it all works now!


1

You may use web3.eth.call function like this: var myContract = new web3.eth.Contract (myContractABI, myContractAddress); var result = web3.eth.call ({ from: fromAddress, // Optional to: myContractAddress, data: myContract.methods.myMethod(... call parameters ...).encodeABI () }); Then you will need to somehow decode returned result yourself. To make ...


1

You can't do it without the experimental ABI encoder. You can turn that on with, per https://solidity.readthedocs.io/en/v0.5.11/layout-of-source-files.html#abiencoderv2: pragma experimental ABIEncoderV2;


1

There are a bunch of questions here which I will try to unpack. 1. How to get its return value? When a contract terminates in the EVM, it has a halting state, denoted H. This halting state takes three possible values: () when execution needs to halt without return value the empty set, let's call it None when execution needs to continue or a list of two ...


1

Solidity doesn't manage strings but you can use this function I've written for you : function _stringReplace(string memory _string, uint256 _pos, string memory _letter) internal pure returns (string memory) { bytes memory _stringBytes = bytes(_string); bytes memory result = new bytes(_stringBytes.length); for(uint i = 0; i < ...


1

It will be much easier if you emit an event with the name and address, then you can just watch ContractInstance.allEvents when the transaction is mined. The other option is to wait for the transaction to be mined and get the result: What's the proper way to wait for a transaction to be mined and get the results?


1

For the benefit of others who come across this. The statement f(a); invokes the function f() and ignores the response. The expected syntax error is raised when the return value of f() (bool) is explicitly returned: function g(uint a) public returns(uint) { return f(a); } f() cannot be returned from g() because function g() ... returns(uint) and ...


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