Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [delegatecall]

https://docs.soliditylang.org/en/v0.8.12/introduction-to-smart-contracts.html?highlight=delegatecall#delegatecall-callcode-and-libraries

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

Utilize delegatecall to set values for struct fields

There are two smart contracts, A and B. They have identical slot numbers for their state variables. I need to assign some values to a struct in B by delegatecalling the fillDev() function of A. ...
Alireza's user avatar
  • 547
0 votes
1 answer
35 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
46 views

Payable multi-delegatecall

I have a code of multi-delegatecall like this: function multicall(bytes[] calldata _data) external payable returns(bytes[] memory _results) { _results = new bytes[](data.length); for (uint256 ...
zkYan's user avatar
  • 11
0 votes
1 answer
11 views

Identifying delegatecalls to a target contract

A contract I am auditing (contract A) is being used via delegate call by another contract. I suspect there may be more contracts using this code as well in the same manner but I cannot prove it. Is ...
Pablo González's user avatar
0 votes
0 answers
10 views

Can a contract call a proxy via delegatecall in a function?

I suppose this is not possible as the proxy contract code would try to retrieve the implementation code from the original contract storage.
alain's user avatar
  • 41
0 votes
0 answers
42 views

Access imported contract's function on behalf of another contract using delegatecall

So I have two contracts. the firt one is a contract that imports a token import {testToken} from "./testToken.sol"; testToken public token; and has this functionality AddressUpgradeable....
Non Fungible Person's user avatar
0 votes
1 answer
30 views

How to build a 3 contract structure with delegatecall

I'm looking for help to build an intermediate contract using delegatecall. My challenge would be with 3 contracts. I need contract A to be the owner of Contract B, and contract B to have a ...
Leandro Loures's user avatar
2 votes
0 answers
18 views

Why is `delegatecall` not working with simple example on quorum node?

Deploying these two contracts: // SPDX-License-Identifier: MIT pragma solidity ^0.5.0; // NOTE: Deploy this contract first contract B { // NOTE: storage layout must be the same as contract A ...
Ware's user avatar
  • 21
0 votes
0 answers
68 views

Solidity contract using delegation working well in remix vm shanghai environment but failing in our local node

We have a contract that use a delgatecall to finally register a node in a mapping array (nodeDB contract). This contracts works correctly if we executed in remix vm shanghai environment but if we ...
Ware's user avatar
  • 21
0 votes
1 answer
24 views

Unable to change the storage using Delegate call

// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract Preservation { // public library contracts address public timeZone1Library; address public timeZone2Library; address public ...
kumar's user avatar
  • 61
1 vote
1 answer
93 views

How to change the storage using Delegate call

// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract Preservation { // public library contracts address public timeZone1Library; address public timeZone2Library; address public ...
kumar's user avatar
  • 61
3 votes
0 answers
59 views

`delegatecall` in batch call stops working as expected when changing the code slightly

I have the following function for batching multiple calls, which returns the result (success or not) and the return data for each corresponding call. function callBatch(bytes[] calldata calls) public ...
Vlad Markushin's user avatar
1 vote
1 answer
78 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
0 votes
1 answer
81 views

Determining if a smart contract is using delegatecall

Let's say that I have the bytecode of a smart contract deployed on ethereum (which I got with a call to eth_getCode). How can I programmatically determine if this smart contract uses delegatecall ...
galpo's user avatar
  • 145
2 votes
2 answers
72 views

Solidity Proxy: why using initialiser instead of a constructor?

Why proxies can't read from the constructor?
Dakata's user avatar
  • 225
0 votes
0 answers
25 views

How can one OZ Transparent Proxy access data from another OZ Transparent proxy?

Scenario: I have two proxies: Root Proxy, this is created during deployment Secondary proxies, this is created at start of each transaction, and is initialized with the context of the transaction ...
Somjit's user avatar
  • 265
1 vote
0 answers
22 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 ...
Marty's user avatar
  • 11
0 votes
2 answers
99 views

Why we are using delegatecall?

As far as I understand is, Delegate is called to pass ETH from another contract. In my perspective, it seems like a transaction goes through twice. Why we are using delegate call?
Wonjae Choi's user avatar
0 votes
1 answer
46 views

delegateCall to a function of an upgradeable contract (TransparentUpgradeable)

I have the following TransparentUgradeable contract on ArbitrumOne: https://arbiscan.io/address/0x4582f67698843Dfb6A9F195C0dDee05B0A8C973F I want to call the function depositTokenViaUsdc() from a ...
user66732's user avatar
  • 455
0 votes
1 answer
42 views

Execute ERC20 Approve outside of ERC20 contract

I am rewriting the solidty-by-example.org crowdfunding exercise. IERC20 public immutable token; function pledge(uint _id, uint _amount) external { Campaign storage campaign = campaigns[_id]; ...
stevealock's user avatar
0 votes
0 answers
50 views

How to setup Module without Owner in Gnosis setup function using Smart Contract

I am trying to setup module by delegate call in setup function of Safe. In my custom factory Smart Contract // Create Gnosis Safe wallet using ProxyFactory address moduleImplementationAddress = ...
Nazar Havryliuk's user avatar
1 vote
0 answers
454 views

How to interact with proxy contract with ethers and wagmi

I have an upgradable proxy contract that points to a specific contract. This is the contract in mumbai polygonscan => https://mumbai.polygonscan.com/address/...
Murat's user avatar
  • 11
1 vote
1 answer
167 views

How to setup Module without Safe transaction using setup function

As I understand to and data parameters used in the setupModules function, can help to execute a delegated call that makes modules setup on the Safe creation. /// @dev Setup function sets initial ...
Nazar Havryliuk's user avatar
2 votes
1 answer
253 views

How is the data parameter constructed in the swap function of 1inch AggregationRouterV5

The swap function in AggregationRouterV5 is like this function swap( IAggregationExecutor executor, SwapDescription calldata desc, bytes calldata permit, bytes calldata data ) ...
Joe's user avatar
  • 43
1 vote
1 answer
73 views

Read value from DelegateCall

I would like to implement a whitelist using AccessControl of openzeppelin. Let's say I have the following setup: Contract A: It's doing some stuff but only for users that are whitelisted. // SPDX-...
alex's user avatar
  • 11
0 votes
1 answer
73 views

Using delegateCall without knowing the called contract's address

I am fairly new to Solidity and slowly starting to grasp its ecosystem :-) I have a question about using delegateCall: How do I ensure that I call exactly the contract I want to call? Let's assume I ...
alex's user avatar
  • 11
0 votes
1 answer
91 views

Is "msg.sender.token1().gas(msg.gas)" too low-level call?

Context : I decompiled this contract(https://bscscan.com/address/0x5cb11ce550a2e6c24ebfc8df86c5757b596e69c1#code) which is the attacker's smartcontract that hacked MEV-bot. You can check the ...
Shift_that's user avatar
1 vote
1 answer
169 views

Does delegatecall also works for calling other contract's constructor?

I want to call other contract's constructor, but I'm not sure if the delegatecall function will work for that case. I have no way to test it out on Remix, because my Remix seem to not work with even ...
caiosa's user avatar
  • 23
1 vote
2 answers
267 views

If a solidity library function is marked as public does it inline the function or call it with a delegatecall from the calling contract?

I am aware that a solidity library function marked as external will be deployed separately and called with delegatecall from the calling contract. Whereas a function marked as internal will just be ...
FreddyC's user avatar
  • 301
5 votes
2 answers
597 views

Preserving visibility "view" of a method using delegate call to a view method

I am using a delegate call inside a view function to a view function in the implementation contract The compiler throws an error meaning that the delegate call can change the state, therefore, can not ...
donoso.eth's user avatar
  • 1,493
2 votes
1 answer
174 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
1 vote
1 answer
1k 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 ...
0xbeny's user avatar
  • 193
2 votes
0 answers
456 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 ...
DHC's user avatar
  • 367
0 votes
1 answer
456 views

Can a 3rd party smart contract transfer user funds without approval by using delegatecall('transfer', to, amount)?

I'm creating a contract where the user would transfer X amounts of tokens A and B to my smart contract for a task. The problem with this is that in principle, the user would have to sign and send 3 ...
Hiperfly's user avatar
0 votes
1 answer
54 views

Can a user transfer X and Y tokens to a smart contract in a single transaction/interaction with the smart contract?

I'm trying to develop a contract to which users would send certain amounts of tokens A and B to the smart contract. Easiest/obvious way to do it would be to do several transactions in this order: ...
Hiperfly's user avatar
2 votes
4 answers
1k views

How can I create a Factory of TransparentUpgradeableProxy?

I have the following code for a Factory that creates instances of a contract that is Upgradeable. I understand that, in order to achieve this, one of the options I have is to use ...
Falcon Stakepool's user avatar
0 votes
1 answer
83 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
4 votes
1 answer
212 views

Low level delegatecalls from contract to deployed library issues

I'm looking to make low-level delegatecall to a library that can be changed via a setter on the contract(see code below). Within the library, I am looking to make state changes to the calling contract....
FreddyC's user avatar
  • 301
0 votes
2 answers
24 views

How to make a delegatecall to a already deployed library of which you have the address

The below code fails when calling foo() on TestContract. The adaptedLib as been set to the right address. How do you make a delegatecall to a lib correctly? contract TestContract { address public ...
FreddyC's user avatar
  • 301
0 votes
0 answers
32 views

Low level delegatecall to a lib does not change state in calling contract

In the code bellow when calling foo the storage of TestContract gets not changed. Expected behaviour to my understanding is that state.a is set to 5. The arg passed to the library function foo is a ...
FreddyC's user avatar
  • 301
0 votes
1 answer
114 views

What are the benefits of using Opensea's Creature Factory?

link : https://stonk.industries/how-to-create-your-own-nft-using-the-opensea-creatures-template/ To Factory or not to Factory that is the question This repo also includes a factory which is just ...
imelon2's user avatar
  • 548
2 votes
1 answer
583 views

The low-level functions call, delegatecall and staticcall return true as their first return value if the account called is non-existent

According to the official Solidity documentation: The low-level functions call, delegatecall and staticcall return true as their first return value if the account called is non-existent, as part of ...
Liron Achdut's user avatar
1 vote
0 answers
46 views

How can timeZone1Library value be changed to address of Attack code? (Ethernaut #16 Preservation)

I've been practicing Ethernaut #16 Preservation. Everything is okay and I understood what delegatecall is. But, I don't get why timeZone1Library can be changed when we pass deployed attack address as ...
Shift_that's user avatar
0 votes
2 answers
892 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 ...
DevABDee's user avatar
  • 473
1 vote
0 answers
41 views

How to decode DSProxy input data

I'm trying to debug a tx made through a DSProxy deployed on Polygonscan, but I'm having a difficult time since the _data part of the DSProxy function input is ABI-encoded. I would have to comb through ...
Ahmed Ihsan Tawfeeq's user avatar
0 votes
1 answer
239 views

testing in hardhat delegatecall returns invalid values

I'm trying to test if the delegatecall works fine, but I got an unwanted result. contract CallerContract{ uint256 public value; address public sender; string public name; ...
Fede's user avatar
  • 105
0 votes
1 answer
74 views

Propose delegatecall via the safe-apps-sdk

Is the safe-apps-sdk only meant to be used when we don't need to propose a delegatecall to the safe? It seems that the safe-apps-sdk uses MultiSendCallOnly.sol. Is it possible to customize the ...
Manboy's user avatar
  • 1
0 votes
0 answers
61 views

How to delegate call from one contract to another contract in different blockchain

My proxy contract and implementation contract are in different blockchains. Can i use delegate call?
rajat's user avatar
  • 1
1 vote
1 answer
260 views

How to use the factory pattern when the child is ownable?

I'm trying to reason how a factory can make calls to a child contract that is owned by an EOA. The goal of this project is to make a StoreFactory contract that allows anyone to deploy their own Store ...
soyboy's user avatar
  • 63
1 vote
0 answers
233 views

UUPS upgradeable contract call fails with delegatecall error when calling newly added functions

I created an upgradeable contract adhering to the UUPS standard following this guide here. I then added some new functions, deployed the upgrade using the upgrades plugin upgrades.prepareUpgrade() ...
Inn0vative1's user avatar

1
2 3 4 5