Questions tagged [callcode]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
22 views

external call to non-existing address returns success

I have this simple contracts which forwards the calldata to and external contract: // SPDX-License-Identifier: MIT pragma solidity ^0.8.13; contract AccountTest { /** * execute a ...
johnhckuo's user avatar
  • 341
2 votes
1 answer
392 views

Why an external call using an interface reverts if an error occurs in the called function, but why it doesn't rever if it was made using the .call()?

I was wondering what happens under the hood when a tx makes an external call using an interface compared to calling the exact same function but using the low-level call() function and the function's ...
Stalin Macias's user avatar
1 vote
1 answer
27 views

why contract is saving the ether in contract rather than sending it directly to senders wallet

Why the below code is saving the ether to the contract address rather than just directly sending it to sender ? In remix** // SPDX-License-Identifier: MIT pragma solidity ^0.8.12; contract payablee {...
MFaiqKhan's user avatar
0 votes
1 answer
116 views

How do I call delegatecall and how do I change it to use the following contract to call?

a is the contract that contains the delegate call, b is the calling contract, I wonder if this B contract can be used for another contract also which contains delegate call? In the end, I'm interested ...
tomas's user avatar
  • 25
0 votes
1 answer
569 views

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

I understand that the success tells if the receive/fallback methods returned successfully but what does the memory give?
tythereum's user avatar
0 votes
1 answer
744 views

solidity call(abi.encodeWithSignature) not working

I have problems using the "address.call(abi.encodeWithSignature(....))" method. Below is the code I am testing in Remix: pragma solidity >=0.7.0 <0.9.0; library lib { event ...
Alberto Molina's user avatar
1 vote
0 answers
49 views

Is it safe to make a contract call from a giant loop?

I have this function in solidity: function payPlayers(address[] memory players, uint256[] memory values) public payable returns (bool[] memory result) { result = new bool[](players.length); ...
simonced's user avatar
2 votes
0 answers
218 views

How to forward returned bytes from calls executed with assembly?

I would like to make an external call with assembly, but am having trouble retrieving the return data as "bytes". The code below currently returns only 32 bytes, which just shows the length ...
James C.'s user avatar
  • 121
18 votes
2 answers
7k views

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

Besides the regular and very common CALL, the Ethereum Virtual Machine has the STATICCALL opcode. In which ways does it differ from the regular CALL? Edit: This is not a duplicate because this ...
Jesbus's user avatar
  • 10.3k
0 votes
1 answer
684 views

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

Here is my example: contract A { function a() public returns(uint256) { return 1; } } contract B { address addrOfA; function b() public returns(uint256) { (, bytes ...
xxs's user avatar
  • 31
5 votes
1 answer
2k views

Get return value of a low level call

I'd like to get the return value of a low level call. (bool success, ) = address(0x1234...7890).call{value:0}(callData); This post discusses a solution that sounds like it should work, but it doesn'...
LampShade's user avatar
  • 640
0 votes
1 answer
171 views

Error with this.balance

pragma solidity 0.5.9; contract Testing{ function participate()public payable{ uint winner = 9; require(msg.value == 0.1 ether); if ( winner==9) { ...
zak100's user avatar
  • 1,416
1 vote
1 answer
829 views

How to use call, delegate call?

I have created two contracts A and B as follow: Contract A: pragma solidity 0.4.25; contract A{ // uint public X ; event MyName(address _from, address sender); function checkMe(uint val)...
Fariha Abbasi's user avatar
1 vote
0 answers
41 views

How to get the address of the code being executed from CALLCODE?

I want to write a library which can be callcalled by any contract. As part of this, I want to write a function which returns the contract address of the library to the contract which callcalled it. ...
user2284570's user avatar
0 votes
1 answer
217 views

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

I am trying replicate the program given at the following link: What is a function Selector However, I am not using the function selector. I am using the name of the function explicitly to invoke it ...
zak100's user avatar
  • 1,416
1 vote
1 answer
650 views

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

Simple question but I couldn’t find the answer anywhere. How to know if the code of my contract is used in a CALLCODE or DELEGATECALL by third party sinceaddress(this)returns the address of the caller ...
user2284570's user avatar
1 vote
1 answer
385 views

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

I am rethinking the flow for token transfer and confirmation on the network (ERC20,ERC721...). I am unaware of a way presently to: 1- transfer tokens and 2- trigger a call in different contract, ...
Adibas03's user avatar
  • 388
1 vote
1 answer
675 views

Understand an EVM call instruction with gas as 0x00

I am trying to understand the following EVM call instruction generated from here: https://ethervm.io/decompile memory[temp3:temp3 + 0x00] = address(msg.sender).call.gas(0x00).value(var1)(memory[...
lllllllllllll's user avatar
0 votes
1 answer
72 views

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

As an example take the following test contract: pragma solidity ^0.4.24; contract DoubleCall { address public superHero; uint256 public price = 1 ether; function becomeSuperHero() ...
Senju's user avatar
  • 691
1 vote
1 answer
1k views

Solidity - selfdestruct

I'm just wondering what would happen if I don't put a selfdestrut() method in my smart contract. As I read from the Solidity documentation (Self-destruct): Even if a contract’s code does not ...
Louisio95's user avatar
  • 101
0 votes
1 answer
235 views

When using Delegatecall or callcode, which Ether balance is used?

Simple question, but I couldn’t find the answer. When contract A CALLCODE B, B will uses A’s ledger. But which Ether balance will be used if B makes a normal transfer, the balance of A or the balance ...
user2284570's user avatar
0 votes
1 answer
56 views

When a Callcalled contract calls an other contract normally, who is msg.sender?

If I understand correctly CALLCODE substitute/replace (and not add) the ledger of the target contract with the one the calling contract, isn’t it ? So that when contract Victor CALLCODE Alice, Alice ...
user2284570's user avatar
1 vote
2 answers
95 views

Call a smart contract from the protocol level

I am wondering if it is possible to call a function of a smart contract every time a block is mined, perhaps as part of the coinbase transaction? The result of the call would be to send a percentage ...
lulbaiking's user avatar
2 votes
1 answer
409 views

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

I deployed a contract of a multisig wallet to ropsten and try to test its abilities: https://ropsten.etherscan.io/address/0x8bf20c41ee6a9fd84e81d6f6df872d9628cd08b2 Things that worked fine: Withdraw ...
Tal Beja's user avatar
1 vote
0 answers
1k views

abstract way of calling internal function instead of `this.call(callData)`

In Solidity I can call an internal function (inside the same contract that is calling it) the "usual" way: myFunc(); or I can call it via .call, as discussed here or here: callData = bytes4(sha3("...
SCBuergel's user avatar
  • 8,704
0 votes
0 answers
135 views

call wont work in order to update another contract's storage

Storage(variable n) of E won't get updated when I use call from contract D. addressOfE = "0x13fac93069c10e977204b9b64502439740cbe46a"; //Contract E's address that exist on my private chain. call ...
alper's user avatar
  • 8,368
1 vote
1 answer
572 views

Instantiate a deployed Smart Contract

After deploying a Smart Contract and knowing that: address = 0x20e4ac9385ea45919b9709c2b38d3190efa42ee4 ABI = [{ constant: false, inputs: [], name: "kill", outputs: [],...
Juan Ignacio Pérez Sacristán's user avatar
6 votes
3 answers
3k views

What are some ways to decode bytecode?

For example, the withdraw method on WithdrawDAO has methodID 0x3ccfd60b. Given the methodID, could it be decoded to know what method it calls ?
bitcoinZ's user avatar
3 votes
1 answer
1k views

Callcode | Delegatecall don't work

I was playing around with call, delegatecall and callcode and discovered that the function reset stopped working after I had made a callcode call (here are my actions): FROM JS SIDE: — A.makeCall({...
manidos's user avatar
  • 4,278
7 votes
1 answer
243 views

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

using for example inline assembly with calldatacopy(t, f, s), which copies s bytes from calldata at position f to memory at position t in a call to for example function newContract(bytes data) { ... }...
dor's user avatar
  • 725
115 votes
6 answers
50k views

Difference between CALL, CALLCODE and DELEGATECALL

CALL and CALLCODE take the same number of operands (in the execution stack). For the exception flag being pushed on top of the stack: 0 means exception, 1 means successful execution. CALL is easy to ...
Loi.Luu's user avatar
  • 2,083