All Questions
8 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
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
867
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?
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
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 ->...