All Questions
Tagged with delegatecall evm
15 questions
1
vote
0
answers
28
views
Inheriting a contract to match state layout in a delegatecall
What is the best way to manage the state layout of a contract will exclusively be used via a delegatecall?
Let's say that there is a Parent contract that uses delegatecall on a Child contract. Within ...
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 ...
2
votes
1
answer
2k
views
Who is msg.sender in a nested delegatecall chain?
Who is the msg.sender in emitted event by calling callMe method on contract D?
pragma solidity 0.8.10;
contract A {
event LogMsgSender(address who);
function callMe() public {
emit ...
0
votes
2
answers
1k
views
How to ".call" a function of another contract which uses ".call"
So, I'm learning advanced smart contract development. Two days ago, I learned about Reentrancy attacks and then I also created two contracts Protocol.sol (vulnerable contract) + Hacker.sol (attacker ...
2
votes
1
answer
866
views
Is there a way to check if a call is a call or a delegatecall?
I want to add a modifier to one of my function that checks wether the function call is a call or a delegatecall?
Is there any way to figure that out? May be with some assembly?
0
votes
1
answer
118
views
How do you manipulate a storage struct array with an external library function?
Basic pseudocode mockup of my problem
import libraryB;
contract A{
struct Person{
string Name;
uint age;
}
Person[] public Party;
Party[0] = (Alice, 30);
libraryB.addAgeToPerson(Party[0], 1)
}
...
22
votes
2
answers
8k
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 ...
2
votes
1
answer
182
views
Preserve msg.sender but not storage
In this particular scheme, we pass the address of the Attacker contract in Victim.foo.
By using delegatecall, we maintain the msg.sender field, but we are not using the storage of Storage but Attacker'...
2
votes
1
answer
2k
views
How to perform delegate call inside of view call (staticall)?
Inside view method it's not possible to do delegatecall due to compilation errors. Is there any way to delegate view calls?
0
votes
1
answer
155
views
Unstructured storage proxies. Variables not being overwritten?
When using delegate call I was under the impression that storage slots declared in the proxy will be overwritten by the implementation.
Unstructured storage implementations declare bytes32 variables ...
0
votes
0
answers
259
views
Delegatecall not changing state
I was trying the code in https://gist.github.com/sogoiii/f0ced0a4e569b5f38d302e7072d78b43 to observe the difference between call and delegatecall.
pragma solidity ^0.4.18;
contract D {
uint public ...
0
votes
1
answer
3k
views
Is it possible to send Ether using delegatecall?
I tested this in Remix and it seems that the ether remains in the delegator contract and doesn't get forwarded. Using the code below to test:
contract SomeContract {
address public sender;
...
0
votes
1
answer
1k
views
Delegatecall to an internal function
Let's say I have a Dispatcher contract that delegates all function calls to an Implementation contract using delegatecall (see for example https://gist.github.com/Arachnid/...
2
votes
0
answers
102
views
What's the value of `this` inside a library function when called via a delegatecall?
Imagine a contract C that makes a delegatecall to a library L.
C -> L
What's the value of this inside L: address(C) or address(L) ?
If now that L makes a normal call to another contract D.
C ->...
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 ...