Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
2 votes
0 answers
600 views

Solidity assembly code - calldatacopy, delegatecall

I have been trying to understand how assembly code works,spending lots of hours, but I could not. Please help me Basically, I am digging into a proxy contract, and I do not really understand ...
1 vote
1 answer
1k views

What exactly is each parameter for assembly delegatecall?

I've been searching everywhere but I'm still not clear what each of the parameters are for delegatecall. What I have found is this delegatecall(g, a, in, insize, out, outsize), where g is gas and a is ...
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 ...
1 vote
1 answer
285 views

Assembly vs solidity delegatecall

Is there a real difference nowadays, performance-wise, between using assembly delegatecall and the high-level solidity version? I know that in the past assembly was used so you could get the returned ...
2 votes
1 answer
3k views

Set data for call(), delegatecall(), etc, in Yul / inline assembly?

It seems that almost all the examples of external calls are simple proxies, which do something like this: assembly { // Copy msg.data. We take full control of memory in this inline ...
2 votes
1 answer
1k views

Factory contract to clone existing contracts

I am researching about Factory contract to clone existing contracts, First is the implementation present at https://github.com/optionality/clone-factory/blob/master/contracts/CloneFactory.sol. I don't ...
1 vote
1 answer
928 views

Understanding why this blob of assembly code adds 0x20 and 0x1f [duplicate]

The execute function defined in MakerDAO's DSProxy contains this blob of assembly code: assembly { let succeeded := delegatecall(sub(gas, 5000), _target, add(_data, 0x20), mload(_data), 0, 0) ...
4 votes
1 answer
1k views

Difference in "delegate call via assembly"

I came across different versions of delegatecall via assembly and I tried all of them - no different result so far. How do they differ and which is the best version to use? OpenZeppelin version: ...
1 vote
2 answers
2k views

In assembly... can't get delegatecall to work

Delegatecall can be used in either solidity or assembly. In solidity, I can get it working with the following code: bytes memory payload = abi.encodeWithSignature ("get_value(uint16,uint16)",...
1 vote
0 answers
275 views

delegatecall (assembly) didn't change state variable in Remix with Web3 Provider

I am trying to test proxy pattern in Remix, which connected to my private chain with Web3 Provider. By the way, miner is working all the time. After invoking add function of Proxy contract, the state ...
2 votes
0 answers
564 views

Proxy contract DELEGATECALL to pass a DYNAMIC array to a function in the target contract

I'm trying to get a Proxy contract to correctly do a delegatecall to a function in another 'target' contract. The problem is, that I need to pass a dynamic array as the parameter to this function. Q: ...
1 vote
0 answers
297 views

out of gas error by assembly delegatecall

I want to get a return value from current contract call other contract by delegatecall, but got a error of out-of-gas. I try to add gas limit to 3000000000, but it doesn't work. please help me. And i ...
3 votes
1 answer
1k views

How do I use delegatecall assembly with a storage pointer to a struct

I am trying to call a library function using assembly and the delegatecall opcode. The library function accepts two parameters, the state object storage pointer and an address, it returns a single ...
2 votes
1 answer
3k views

Can I use delegatecall in a transaction?

I'm interested in techniques to perform multiple sends/contract calls inside of a single transaction but with the EOA that originates the transaction still being the sender for all operations (not a ...
2 votes
0 answers
718 views

Call vs Delegate Call call data format

I'm using both call and delegatecall within an assembly block and i've noticed that when issuing a call I need to provide 4 bytes (sig) + any arguments, whereas for delegatecall I need to provide 4 ...