Questions tagged [delegatecall]
https://docs.soliditylang.org/en/v0.8.12/introduction-to-smart-contracts.html?highlight=delegatecall#delegatecall-callcode-and-libraries
64 questions with no upvoted or accepted answers
0
votes
1
answer
564
views
How to use a library contract function inside my contract without inheriting
I have a library contract deployed on ropsten with address 0xc0b843678E1E73c090De725Ee1Af6a9F728E2C47 and code
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
library ...
0
votes
0
answers
128
views
delegatecall return wrong value
I want to get userInfo which is masterchef's methods.
But I want to call userInfo from another contract, so I'm using delegatecall
address sender = msg.sender;
(bool success, bytes memory result) = ...
0
votes
0
answers
90
views
Encoded delegate calls fails
I have been using encodeFunctionCall() utils for encoding my function call. when i use the encoded data to execute delegateCall(), it gets reverted.
My solidity call is like
bool success, ) = ...
0
votes
0
answers
265
views
How does DELEGATECALL behave when calling other contracts?
I am trying to make a Parent-Contract which has a function which spends ERC-20 Tokens. I want to call this function from different Child-Contracts (which are deployed independently) using Delegatecall....
0
votes
0
answers
70
views
Delegate Call fails
I have the following function
enum OptionType {Invalid, Put, Call}
function create(
uint256 period,
uint256 amount,
uint256 strike,
OptionType optionType
) {
....
}
When I ...
0
votes
1
answer
49
views
Cannot get very simple delegatecall to work
I have this super simple code:
pragma solidity 0.5.13;
contract test1{
uint256 public number;
address public sender;
function setNumber(uint256 _number) public {
number =...
0
votes
0
answers
46
views
Does delegatecall() use only the calling function?
Let me explain with the code:
contract A {
function f() public {
[...]
g();
}
function g() private {
[...]
}
}
contract B {
A a;
function delegateA() public {
(bool success, ) = address(...
0
votes
0
answers
391
views
How to use delegate call with or without arguments functions?
Below is my contract:
contract A{
mapping (address => uint) public balances;
function put() payable public {
balances[msg.sender] = msg.value;
}
function get(address ...
0
votes
0
answers
294
views
No Events After Deploying Another Contract in Remix
I am trying to write an upgradable smart contract in Remix. This involves a Proxy contract, a Logic_0_1_0 contract, and a Logic_0_2_0 contract.
I uploaded Proxy and Logic_0_1_0 only, and the ...
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
0
answers
294
views
How to allow delegatecall only from specific contract?
I have a token contract, when transfer is called it calls other contract's transfer with data. Other contract checks msg.sender and allows only the first contract to pass and performs some important ...
0
votes
2
answers
967
views
How to use Role-Based Access Control via Proxy?
I have a PermissionsManager contract that uses OpenZeppelin's Role-Based Access Control (RBAC) template as a base. Currently function modifiers in my app call PermissionsManager directly to check for ...
0
votes
0
answers
136
views
call wont work in order to update another contract's storage
Storage(variable n) of E won't get updated when I use call from contract D.
addressOfE = "0x13fac93069c10e977204b9b64502439740cbe46a"; //Contract E's address that exist on my private chain.
call ...
0
votes
1
answer
271
views
When using Delegatecall or callcode, which Ether balance is used?
Simple question, but I couldn’t find the answer.
When contract A CALLCODE B, B will uses A’s ledger. But which Ether balance will be used if B makes a normal transfer, the balance of A or the balance ...