122 votes
Accepted

Difference between CALL, CALLCODE and DELEGATECALL

DELEGATECALL basically says that I'm a contract and I'm allowing (delegating) you to do whatever you want to my storage. DELEGATECALL is a security risk for the sending contract which needs to trust ...
user avatar
  • 78.7k
7 votes

What is the difference between the STATICCALL and CALL EVM opcodes?

Additionally, Since byzantium staticcall can be used as well. This is basically the same as call, but will revert if the called function modifies the state in any way.
user avatar
  • 401
4 votes

What is the difference between the STATICCALL and CALL EVM opcodes?

https://eips.ethereum.org/EIPS/eip-214 STATICCALL functions equivalently to a CALL, except it takes only 6 arguments (the “value” argument is not included and taken to be zero), and calls the child ...
user avatar
  • 41
4 votes

Difference between CALL, CALLCODE and DELEGATECALL

Showing the difference between the call, callcode and the delegatecall we can consider the example of the following code : Contracts can interact in three ways Call : By directly calling from a ...
user avatar
3 votes
Accepted

Why `address.call` function "saves" unnecessary gas for after the internal execution?

So there is some unexpected behavior in the solidity compiler: https://github.com/ethereum/solidity/issues/2999 Works on pragma experimental "v0.5.0"; with compiler 0.4.18.
user avatar
3 votes
Accepted

Understand an EVM call instruction with gas as 0x00

So basically the gas is specified as how much gas the sender willing to pay to send the money to the "msg.sender" This claim is not correct. To understand what's going on, you need to have a basic ...
user avatar
  • 1,754
3 votes
Accepted

What are some ways to decode bytecode?

You can use the manually-maintained directory at https://www.4byte.directory to search for the method given the signature. Here is the lookup for your example 0x3ccfd60b. There are further plans for ...
user avatar
3 votes

Difference between CALL, CALLCODE and DELEGATECALL

An update to @eth's example for solidity v6: function definitions must be public keccak256 in place of sha3 call arguments use abi.encode() address() to get contract address pragma solidity ^0.6.0;...
user avatar
  • 7,924
3 votes
Accepted

Can a contract know at what position in a callcode an argument begins?

The general answer is that it follows the conventions of the ABI. You can work it out based on those rules. In this particular case, the encoding of data will start at position 36. The first four ...
user avatar
  • 595
2 votes

Difference between CALL, CALLCODE and DELEGATECALL

callcode has been deprecated in favour of delegatecall as per version 0.8.4
user avatar
  • 121
2 votes
Accepted

Callcode | Delegatecall don't work

The problem has to do with how variables arranged in the storage. The storage of the called and the calling contract should match. The answer to this question can be found here https://github.com/...
user avatar
  • 4,168
2 votes
Accepted

Get return value of a low level call

Starting from solc 0.5, call returns two values: bool success, which indicates whether or not the function completed successfully bytes memory data, which is the actual data returned from the ...
user avatar
2 votes
Accepted

Solidity - selfdestruct

No, means that if you use delegate call in your contract and the code at the target address contains a line with selfdestruct(someaddress), this code will be executed in your contract context, ...
user avatar
  • 7,885
1 vote

What is the "bytes memory" in (bool success, bytes memory) = some_address.call{value: some_amount}("")

The call method can be used to send arbitrary data to another contract. If no data is sent this normally triggers the fallback data, but it is also possible to trigger any other function of the target ...
user avatar
  • 3,859
1 vote

How to get the returned value from the delegate call on the function of another contract?

Try this: pragma solidity ^0.5.0; contract A { function a() public returns(uint256) { return 2; } } contract B { address addrOfA; constructor (address _addrOfA) public { ...
user avatar
1 vote
Accepted

Error with this.balance

You are simply missing the bytes parameter for call: pragma solidity 0.5.9; contract Testing { function participate() public payable{ uint winner = 9; require(msg.value == 0.1 ...
user avatar
1 vote

How to use call, delegate call?

The problem is you are using uint when calculating the selector. You should use the full type uint256. function useCall() public{ require(address(a).call(bytes4(sha3("checkMe(uint256)")), 2)); } ...
user avatar
  • 29.5k
1 vote

Error: Member "func" not found or not visible after argument-dependent lookup in address

While you have knowledge about the code of Contract1 you can call the function directly. You can declare the return arguments (arg1, arg2) with the call. pragma solidity ^0.5.1; contract ...
user avatar
  • 2,968
1 vote

How to prevent the code of my contract being used in a CALLCODE?

Simple way uint private constant MAGIC = ...; // Your birthday here uint private magic = MAGIC; function isDelegated () internal view return (bool) { return magic != MAGIC; } The idea is that ...
user avatar
1 vote
Accepted

Is it possible for a smart contract to relay raw signed transaction

Unfortunately a contract can't handle raw transactions. We would face all sorts of new issues if it was possible (such as who pays for the gas). Nothing prevents you from creating your own contract ...
user avatar
1 vote
Accepted

How does the network / EVM handle same contract call within same block with same gas?

Transactions are included in a block in a specific order. In your example, even if both transactions are in the same block, one will come before the other. In this case, the first tx in the block's ...
user avatar
  • 3,820
1 vote

Instantiate a deployed Smart Contract

I think I found what was the problem: lack of double quotes. When instantiating the Smart Contract using the literal ABI from https://ethereum.github.io/browser-solidity/ everything works! > var ...
user avatar
1 vote

What are some ways to decode bytecode?

I don't think so. As I understand it, Solidity takes the first few bytes of the sha3 hash of the contract's signature to identify methods. It can't be done in reverse unless you already had the ...
user avatar

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