Questions tagged [proxy-contracts]
Contracts creating a transaction or call on behalf of another account
201 questions
0
votes
2
answers
655
views
How does a minimal proxy look like in Solidity code?
I have been using minimal proxy and I understand how it works. However, I would like to know how it looks like in Solidity as I plan to make some slight modifications to it while wanting to keep it as ...
0
votes
1
answer
30
views
Attempting to create a Proxy
I have to create a Proxy, first I created my own then I found out that is better to use TransparentUpgradeableProxy.sol
My initial logic implementation.
The upgraded implementation.
This is the proxy ...
1
vote
1
answer
83
views
What does a minimal ERC-1967 proxy in vyper look like?
What does a minimal ERC-1967 vyper proxy look like?
1
vote
1
answer
23
views
Can a proxy constructor replace the initializer used in upgradeable contracts?
I was wondering if a regular constructor could be used in the proxy of a proxy-implementation upgradeable contract, instead of an initializer in the implementation contract. If not, please explain why....
2
votes
1
answer
843
views
Any way to call the constructor of an inherited contract the initialize function using a proxy?
I am deploying a proxy on an ERC721 and Ownable contract. The problem is that the constructor of Ownable is not called on the initialize function so the owner is not defined and the onlyOwner modifier ...
0
votes
1
answer
538
views
How to do set the uri by calling the ERC1155 upgradeable initialize function from a proxy
const { ethers, upgrades } = require("hardhat");
async function main() {
const ERC1155 = await ethers.getContractFactory("ERC1155");
const uri = "ipfs://...
2
votes
3
answers
596
views
Proxy function clashing - what kind of danger comes exactly with it?
I read that if I am using proxy, there is a chance of function clashing. Let's say in my contract there is a function with a signature:
proxyOwner()
...
0
votes
0
answers
11
views
Timelock for upgradeable contracts
Also asked in OZ forum
Use case - Adding time delay for upgrading a proxy.
Example - mETH protocol.
mETH protocol uses timelock as the ProxyAdmin, means they don't deploy the seperate ProxyAdmin ...
0
votes
1
answer
329
views
contract.methods ** is not a function using upgradeable contract and web3
On the BSC testnet I have created the following Proxy (upgradeable) contract:
0xe73585adad24f0994b794eb276561303e1f46a9a with a related implementation contract: ...
0
votes
1
answer
609
views
Contract not using Upgraded Proxy Contracts
There's 2 contracts A and B, A imports B, where B is a library that can be upgraded. To achieve this, I tried replacing B with a proxy contract and a delegate contract.
We now have contracts Foo, ...
1
vote
0
answers
18
views
Can Intents Operate on Upgrades and Deployments?
Lets say you want to upgrade your smart contract using the proxy upgrade pattern.
Just like how intents can say "only do this tx if it meets this criteria"
Can we use intents to say "...
1
vote
1
answer
382
views
Contract A delegatecall function in contract B which calls function in contract c. msg.sender for function in contract c?
If Function in contract A delegatecall function in contract B which calls function in contract C. What will be the msg.sender for function in contract C?
1
vote
1
answer
617
views
Automatically getting implementation contract for eip 1967 proxy
Let's say I wanted to write code which looks at a smart contract, detects whether it is an upgradeable proxy, and then fetches the contract address.
Something like so:
const functionNames = abi.map((...
0
votes
1
answer
637
views
How to fix AccessControl: account missing role on upgradable contract?
I'm using AccessControlUpgradeable and i get the following error when i try to trigger an adnin function on my deployed smart conntract (it work when tested localy with chai)
Fail with error
'...
2
votes
0
answers
51
views
Why is only one of my proxy facets showing up on etherscan contract verification?
I deployed a diamond upgradeable contract on Sepolia with foundry --verify:
https://sepolia.etherscan.io/address/0xdCfB65CC9f69D78dDFA30f47eefD1594466fB47D
Only one of my facets shows up, but several ...
0
votes
2
answers
595
views
Non transparent (forward) Proxy in Solidity
For testing/mocking purposes, I need to call a contract (A) from another contract (B) that just forwards the calls to (A).
The calls need to be forwarded, not delegated. And I don't want to rewrite ...
1
vote
2
answers
452
views
hardhat-deploy deploy proxy - Error: The number of arguments passed to not match the number of argument in the implementation constructor
I have the following upgradeable contract using @import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
contract StargateSwap is Initializable, AccessControlUpgradeable, ...
0
votes
1
answer
63
views
How to use Access Control in different facets if a Diamond Contract
I am looking to change the design of my contract into diamond proxy. For that i have split up my contract into 3 parts. the issue i am facing is while setting up access control. When i am using OZ ...
0
votes
1
answer
58
views
Reason for Checking `msg.sender == _msgSender()` in OpenZeppelin's MulticallUpgradeable Contract
In the OpenZeppelin::MulticallUpgradeable contract, there's a validation that checks msg.sender == _msgSender(). Considering that msg.sender and _msgSender() typically return the same value, why is ...
0
votes
3
answers
1k
views
onlyOwner check fails using Proxy Contract
I was testing delegate calls with the proxy pattern for the upgradable contract. Things were going good till the time I added onlyOwner modifier.
My Contracts
pragma solidity 0.5.8;
contract ...
0
votes
1
answer
880
views
New initializable function in new implementation for a proxy contract
I am working on using Proxy contracts in solidity 0.4.24, I have deployed the logic contract and the proxy contract as well using the address of logic contract as the implementation contract address.
...
0
votes
1
answer
427
views
Truffle-upgrades - deployProxy - Type/values mismatch despite correct syntax
Asking my first question here, hope it's in the right format.
I'm trying to deploy my contract using a transparent proxy, using OpenZeppelin's truffle-upgrades, as they explain here.
However, I keep ...
10
votes
2
answers
3k
views
What is the value of "address(this)" when delegate calling?
Suppose that you have an upgradeable proxy "Foo" that calls an implementation contract "Bar" via DELEGATECALL.
In "Bar", there is a function that uses the Solidity syntax ...
3
votes
3
answers
889
views
How much extra gas is incurred per transaction when using a proxy contract?
Say I have a contract Foo with method bar that has a gas cost per call of x, now say I choose to implement a proxy contract Proxy for interacting with Foo to allow for upgradability to FooV2 if the ...
0
votes
1
answer
28
views
Understanding SmallProxy Contract Behavior with ImplementationA
I'm currently doing some experiments with the SmallProxy contract. Below is the code for the SmallProxy and ImplementationA contracts:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import &...
10
votes
3
answers
12k
views
How do I get the implementation contract address from the proxy contract address?
I'm using web3.py to interact with multiple unknown contracts, where I don't know beforehand if a contract is a proxy contract or the actual contract. I'm getting the ABIs for the contracts on-the-fly ...
0
votes
1
answer
71
views
`upgradeAndCall()` Reverting
I have a factory contract which deploys an upgradable token and I also want it to be able to upgrade it. It works fine when I callupgradeAndCall() with an empty data but when I try pass in an encoded ...
0
votes
3
answers
266
views
Upgrade ERC20 Onchain without hardhat with UUPS Proxy
I have a token governance token:
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol&...
3
votes
1
answer
88
views
Is it possible to emit generic events using assembly?
I'm trying out a proxy / upgrade pattern where the deployed contract is an ERC-721 but it delegates as much functionality to a "controller" contract as possible. The storage is split between ...
0
votes
0
answers
17
views
Clone of a uups proxy contract is not working
i have a factory contract which is creating clones of an NFT contract.
if the NFT contract is not a proxy everything is ok and cloning works just fine.
but since i need to have a upgradable UUPS NFT ...
0
votes
0
answers
19
views
Is there any way to explicitly trigger the fallback's execution if the msg.data matches an external function present in the contract?
I'm wondering whether there's a way to somehow explicitly trigger the fallback method, if the msg.data (calldataload, calldatasize and calldatacopy commands in Yul) already matches one of the ...
3
votes
1
answer
30
views
What can be the workaround to work with the new `Initializable` contract?
If we are using the initializable contract before OZ 0.5.0 for our transparent Upgradeable proxy.
It had two variables in slot 0.
uint8 private _initialized;
bool private _initializing;
Now in OZ 0.5....
15
votes
3
answers
17k
views
What exactly is a proxy contract and why is there a security vulnerability involved in it?
I was looking at the recent FE badger DAO exploit and this Twitter thread in it https://twitter.com/CryptoCatVC/status/1466380960648380419?s=20
One piece of advice the author gives before signing a ...
0
votes
1
answer
49
views
How do you implement diamond proxy fallback function?
According to the official EIP2535 in the fallback section:
It is missing the position slot:
// Find facet for function that is called and execute the
// function if a facet is found and return any ...
1
vote
1
answer
916
views
Deploy proxy upgrade pattern contract using hardhat ignition
I have a contract like this:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@...
0
votes
1
answer
89
views
Reading Events from Implementation contract
I own a proxy contract as well as an implementation contract. The implementation contract's function emits an event, but it does not emit the event when it is called from the proxy contract. Using the ...
0
votes
1
answer
67
views
Connected to a proxy function but getting an error when I call the transfer function of the implementation contract
I'm currently working on a project where I can transfer USDC from my account to another directly, provided I have my provider and private key, programmatic. So I connected to a proxy contract on the ...
0
votes
2
answers
55
views
What's the difference between upgradable and non upgradable Initializable contracts?
@openzeppelin/contracts/proxy/utils/Initializable.sol
vs
@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol
Why would anyone use proxies that do not support upgradable contracts? ...
0
votes
0
answers
30
views
EIP 1822 - Potential vulnerabilities in a proxiable contract example
I'm reading EIP-1822 UUPS. There's a reference, or sample, implementation of a proxy contract pattern for an ERC20 token contract, and I have some concerns about potential vulnerabilities. Here's the ...
0
votes
0
answers
14
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.
2
votes
2
answers
450
views
UUPS vs Beacon proxy pattern
I am delving into UUPS(Universal Upgradeable Proxy Standard) and Beacon proxy patterns.
I believe they serve distinct purposes, but I am unsure about the right use cases for each.
It seems that UUPS ...
3
votes
0
answers
100
views
How to get admin address while deploying transparent upgradeable proxy from OZ
After OZ version 5, the admin contract is deployed from within the constructor of the proxy.
And the admin address is emitted in the events of the deployment transaction. To get the admin address we ...
1
vote
1
answer
90
views
How does the proxy contract gets the storage variables of Implementation contract?
I understand that proxies use delegatecall to execute the logic contract's function with its own storage.
But what happens when we define any storage variables in the logic contract as well as ...
1
vote
0
answers
49
views
Proxy Smart Contracts
I am working on a KYC smart contract and I want to provide the upgradable feature so I can add more functions or add more fields to the struct in the future.
I have learned about proxies and the way I ...
4
votes
2
answers
2k
views
Why OpenSea Polygon proxy contract does not have transactions?
OpenSea basic integration tutorial for Polygon recommends to override the isApprovedForAll() function of ERC-721 contracts to this:
/**
* Override isApprovedForAll to auto-approve OS's proxy ...
1
vote
2
answers
1k
views
Can ReentrancyGuard be used in Proxies?
ReentrancyGuard's _status is set in the constructor & we can't set it anywhere else: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/64e48203cecad94f02de9891ecdeed4d629c6dae/contracts/...
1
vote
2
answers
113
views
Verification of a proxy contract not working because of constructor args
I am creating a smart contract verification service as a learning experiment and I am now able to verify most of contracts that I come across etherScan (in part doing so there is not only an option).
...
1
vote
1
answer
103
views
Proxy Contracts Initializing problems
Good afternoon. I’ll be brief - there is a Module in my ecosystem, the module is initialized by the proxy factory DeployProxy.sol and then the proxy contract address is entered into the Core contract ...
0
votes
1
answer
52
views
I sent ETH to an Opensea Ownable Delegate Proxy Contract, Is there anyway to retrieve it?
I accidentally sent ETH funds to the Ownable Delegate Proxy contract owned by my address. However, i am not a developer and have no know-how as to how i could obtain these funds back or if that is ...
1
vote
1
answer
54
views
Using inherited constructors with a proxy factory
I am attempting to use Chainlink VRF along with OpenZeppelin's upgradable contracts to generate a random number. In order to use VRF, I must inherit the constructor from VRFV2WrapperConsumerBase. ...