Skip to main content

All Questions

Filter by
Sorted by
Tagged with
2 votes
1 answer
21 views

Does delegate calling to a non-payable function result into a revert?

I have a payable function that takes an array of call datas as input, to which it delegate calls one-by-one: function batch(bytes[] calldata calls) external payable override { uint256 count = ...
Paul Razvan Berg's user avatar
0 votes
1 answer
162 views

Delegatecall failing 'could not coalesce error'

I'm trying to set a message to my Contract setmsg through a proxy contract using delegatecall.Using hardhat. getting this error: error: { code: -32603, message: "Error: VM Exception ...
Loputocharlio's user avatar
1 vote
1 answer
295 views

is this how delegatecall works? what other ways are there keep msg.sender the same when a contract is interacting with a different contract? [duplicate]

I recently started development on a personal project, and one of the suggested methods to achieve what i want was using delegatecall. Essentially I have a main contract that the user interacts with ...
pierre96's user avatar
2 votes
1 answer
260 views

check if a DELEGATECALL has taken place during the transaction

I know how to check if a current contract's function is been called using CALL or DELEGATECALL (by comparing address(this) to the contract's address that must have been previously saved as an ...
Alberto Molina's user avatar
0 votes
1 answer
85 views

How call() function works in solidity?

Learning call() function in Solidity, I read that we use call() only when we don't know the ABI of the called contract and we don't know its source code. Below I have an example, but it seems we DO ...
Nick's user avatar
  • 75
1 vote
1 answer
382 views

Contract A delegatecall function in contract B which calls function in contract c. msg.sender for function in contract c?

If Function in contract A delegatecall function in contract B which calls function in contract C. What will be the msg.sender for function in contract C?
user99015's user avatar
1 vote
1 answer
831 views

how to use the value of msg.value and msg.sender of a contract, when a function calls a different contract

I'm studing Solidity and tring to understand how it works. Starting from Safe Remote Purchase in the "Solidity section by example" the doc (https://docs.soliditylang.org/en/v0.8.12/solidity-...
juole's user avatar
  • 13
4 votes
2 answers
4k views

Why is there significant gas costs associated with call and delegate call?

I've been trying to understanding why Ethereum doesn't have a significant on chain package/library ecosystem despite having the capacity to do so via delegatecall or call to an ImplementationContract ...
MShakeG's user avatar
  • 1,855
3 votes
1 answer
1k views

What does "caller()" return in Yul when DELEGATECALL is used?

While browsing the Solidity docs, I noticed this instruction available in assembly: caller(): call sender (excluding delegatecall) What do the docs mean by "excluding delegatecall"? Is it ...
Paul Razvan Berg's user avatar
1 vote
1 answer
598 views

Can I use delegatecall with the target contract's storage?

With a scenario that goes as follows: I want a Contract A that allows me to call functions from other contracts, different each time, using the storage and code of the target contract. Essentially, I ...
riverwastaken's user avatar
0 votes
1 answer
853 views

How does Solidity decode a struct returned from a delegate call?

I have a proxy contract that delegate calls to a target contract. The proxy is similar to DSProxy. In it, there is an execute function: function execute(address target, bytes memory data) external ...
Paul Razvan Berg's user avatar
1 vote
2 answers
229 views

Code Example from “Mastering Ethereum: Building Smart Contracts and DApps” doesn't work

I'm reading the Ethereum book of Gavin Wood right know and the following code example gives an error message when I try to compile it with truffle: pragma solidity ^0.4.22; contract calledContract { ...
Bastin's user avatar
  • 11
1 vote
0 answers
75 views

Replaying the Bad Parity Hack

On a locally hosted instance of Ethererum I am trying to replay and understand the Bad Parity hack. I have a Wallet and a Wallet Library Contract. Wallet.sol constructor(address lib) public payable {...
user2147674's user avatar
3 votes
2 answers
774 views

Solidity CALL and DELEGATECALL: messages and data format

I have some questions about Solidity CALL and DELEGATECALL. I have already read some related threads (link), but found no answers to my doubts. 1) Is there any difference in performing a CALL to a ...
user3352382's user avatar
2 votes
2 answers
3k views

Warning: The use of low level "call" should be avoided whenever possible

I am writing my own smart contract and I want to call a function from a contract that has already been deployed. The fragment of my code: function myFunc(address _contractAddress, address _user, uint ...
EtherPaul's user avatar
  • 256
2 votes
1 answer
3k views

Solidity "call" function with array as input

I have a function on contract A for examples : uint256[] values; function set(uint256[] _arrayToSet){ values = _arrayToSet; } It works perfectly when called directly, but I would like to call it ...
MeMyself's user avatar
31 votes
1 answer
21k views

How does the delegatecall method work to call to another contract's method?

I'm trying to figure out how to use the delegatecall method on a contract address in a contract to call a function in a separate contract. I know Libraries are the higher level interface to use but I ...
aDude's user avatar
  • 313
1 vote
1 answer
137 views

Help me debug this delegatecall Serpent demo I'm working on?

https://gist.github.com/ChrisCalderon/2818e6ba0214c25962b16c02e761dc26 Whenever I try to run it, I get "Transaction Failed". What it's supposed to do is call it's own functions double and half using ...
Broseph's user avatar
  • 695
117 votes
6 answers
53k 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,113
8 votes
1 answer
720 views

What happens if you chained delegatecalls?

Solidity docs say "only the code of the given address is used, all other aspects (storage, balance, ...) are taken from the current contract." This is useful when creating a library. But what happens ...
samurai jack's user avatar
  • 1,135