Questions tagged [openzeppelin-contracts]

OpenZeppelin Contracts is a library for secure smart contract development. It provides implementations of standards like ERC20 and ERC721 which you can deploy as-is or extend to suit your needs, as well as Solidity components to build custom contracts and more complex decentralized systems.

Filter by
Sorted by
Tagged with
0 votes
1 answer
24 views

Openzeppelin ERC721Enumerable getTokenIdsOfOwner reverts and I don't know why

I am trying to implement a staking contract, I wanted to map all the owned NFTs by a certain address, so came across ERC721Enumerable and getTokenIdsOfOwnerfunction, however whenever I call my ...
Mohamed Wael's user avatar
0 votes
1 answer
33 views

Upgrading Smart Contracts with New Fields: How to Safely Modify Storage Layout

I'm working on upgrading my Ethereum smart contract, which utilizes upgradable smart contract patterns. Currently, I have a struct named GovernorCountingSimpleStorage with existing fields, and I want ...
Agilulfo's user avatar
0 votes
2 answers
29 views

Smart contract creation

I just joined because I am trying to learn how to create Solidity contracts using OpenZepplin. I am using also claude AI to guide me but it has a limit and it's going in circles now. Until now I ...
Onigiri's user avatar
0 votes
1 answer
24 views

ERC721 Transfer Event in Constructor

I thought that when you mint an ERC721 Token in the Constructor of your smart-contract it will not emit the Transfer event. I'm thinking this cause of what's written in the official ERC721 EIP ...
Mark55's user avatar
  • 1,011
0 votes
2 answers
72 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 ...
DHC's user avatar
  • 357
1 vote
0 answers
16 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 ...
Serenity's user avatar
  • 125
1 vote
1 answer
23 views

Can I use safeTransfer from OpenZeppelin to send ETH along with ERC20 token?

My contract holds tokenA + ETH. Right now I pay users this way: tokenAcontract.safeTransfer(wallet, amountTokenA); // tokenA Address.sendValue(wallet, amountETH); // ETH Can I do it in one single ...
user130657's user avatar
1 vote
1 answer
47 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 ...
Pavlo Konchych's user avatar
0 votes
1 answer
29 views

Getting "insufficient allowance" error

// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "./TokenA.sol"; import "./TokenB.sol"; contract ...
soumyadeep.eth's user avatar
0 votes
0 answers
258 views

Anti Sniper / anti Snipe Bot for newly listed token on pancakeswap

Can Somebody explain how to have Bot Protection enabled against sniper bot for a token contract which is going to launch on pancakeswap or on any other decentralised exchange. do we have to create ...
Bhushan Dhiware's user avatar
2 votes
1 answer
148 views

OZ transparent upgradeable proxy admin reverts when trying upgrade an implementation

I have this transparent upgradeable proxy deployed on sepolia - 0x2dFC2A866eac363cAFF516b5ce7aCd6bae1F21C1 This is the admin contract - 0x6d429719f78b146892403d06df677afa6f968d91 When I try to call ...
Zartaj Afser's user avatar
  • 3,709
1 vote
0 answers
74 views

Handling Conflicting @openzeppelin/contracts Versions in Hardhat Project

I am currently working on a Hardhat project that requires the integration of two custom dependencies, namely custom-dep-a and custom-dep-b. Unfortunately, these two dependencies rely on different ...
MShakeG's user avatar
  • 1,613
0 votes
0 answers
15 views

Issues in the ERC20 token Contract burn

I was just going through this contract and that the _balances[account] is being deducted before the require statement. Is this still correct? also there was no else and seemed like it will be ...
Priyanshu Dwivedi's user avatar
0 votes
1 answer
68 views

Problem with "Openzeppelin ERC20Votes delegate function"

I hope you're doing great. I have been tinkering with ERC20Votes and creating a DAO for my Vendor contract. The issue I'm facing is that whenever I try to delegate my GovernanceToken contract to the ...
Hassan Ahmad's user avatar
0 votes
1 answer
9 views

new release of ERC1155SupplyUpgradeale has compilation issues

The new contracts lib from OZ, specifically ERC1155UspplyUpgradeable has compilation issues before even inheriting it in any child contract (check screenshot below) any idea why? or how to fix it? ...
sasha's user avatar
  • 41
0 votes
0 answers
15 views

Construction of OpenZeppelin voting contract with ٍERC777 token

I managed to easily create governor and implement voting with erc20 token, but now I have erc777 token that I need to do this with, please guide me how I can I have to do this because when I introduce ...
Mehran Ra's user avatar
  • 590
0 votes
1 answer
94 views

OpenZeppelin: Update UUPS proxy contract

I have such proxy: import { upgrades } from "hardhat"; proxy = await upgrades.deployProxy( Contract, [ address, flags, ], { initializer: "...
Meldum's user avatar
  • 173
0 votes
1 answer
38 views

Does the OpenZeppelin nonReentrant modifier block calling all functions that have the modifier on them, or it keeps a separate state for each function

Would the nonReentrant modifier from the OpenZeppelin ReentrancyGuard library prevent the user from calling stake() when the unstake() function hasn't yet been fully processed (in the example below)? ...
Mila A's user avatar
  • 1,179
1 vote
0 answers
131 views

Create3 deployment with proxy contract ownership?

I have deployed an upgradable proxy contract with create3factory from solmate. In my contract i transfer ownership to an address. But still the owner ship is not on that address. Its a differant ...
Furkan Sezal's user avatar
0 votes
0 answers
33 views

Ethernaut Challenge: GateKeeper Three | Is it possible to solve this challenge using proxy?

I read online and understand the solution to this challenge. I decided to experiment and solve this challenge using a proxy instead. As per my understanding of proxies and delegate call, the following ...
Shubham Sharma's user avatar
0 votes
0 answers
28 views

Reverted with reason string 'Governor: unknown proposal id

I using Governor contract from Openzeppelin. I have create the proposal and voted on the proposal. The state of proposal is succeeded. When I am trying to queue the proposal I am getting error ...
Sagar Atalatti's user avatar
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
1 answer
103 views

Property 'PROPOSER_ROLE' does not exist on type 'BaseContract'

TimeLock contract extends from TimelockController from OpenZeppelin Contracts. contract TimeLock is TimelockController { constructor( uint256 minDelay, address[] memory proposers, ...
Sagar Atalatti's user avatar
1 vote
1 answer
909 views

Property 'address' does not exist on type 'BaseContract'

I have TimeLock contract that extends TimelockController from OpenZeppelin contracts: contract TimeLock is TimelockController { constructor( uint256 minDelay, address[] memory proposers, ...
Sagar Atalatti's user avatar
0 votes
1 answer
26 views

Issue with DynamicSvgNft Contract: getHighSVG() and getLowSVG() Functions Returning Incorrect Values

Hello Stack Exchange community! I am currently working on a project that involves an NFT contract called DynamicSvgNft. The contract is designed to change the SVG image URI of the NFT based on a ...
Web3Phoenix's user avatar
0 votes
1 answer
27 views

1155URIStorage not available in npm package but is available on OpenZeppelin Github

I can import import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155URIStorage.sol"; on Remix. But it throws an error in Hardhat. I have attached a picture of node_modules and it ...
Pankaj Jagtap's user avatar
0 votes
0 answers
15 views

Doubt on upgradeable contract in Ethereum

I am testing upgradeable contract using foundry. The code is: //SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import 'forge-std/Test.sol'; import '../src/A.sol'; import '../src/B.sol'; import ...
Hacek 's user avatar
  • 657
0 votes
2 answers
80 views

UUPS proxy and file level constants, enums and structs compatibility

If i use UUPS upgradeable pattern and i define a couple of constants, enums and structs at the contract level, will those values still be available after an upgrade? I have 3 contracts and all 3 are ...
gabkov's user avatar
  • 113
0 votes
1 answer
20 views

How to limit canceller role in OpenZeppelin governance?

In openzeppelin governance contracts, a proposal can be cancelled by a wallet that has the canceller role. As the deployer of the DAO, I want to ensure the security of my DAO, hence I want to be able ...
MehmedB's user avatar
  • 241
3 votes
1 answer
624 views

Do we need OpenZeppelin's Counter with Solidiity 8 any more?

According to Solidity documentation: Prior to Solidity 0.8.0, arithmetic operations would always wrap in case of under- or overflow leading to widespread use of libraries that introduce additional ...
Alexander Herranz's user avatar
1 vote
1 answer
156 views

Is there still any reason to use SafeERC20Upgradeable with the ERC20Upgradeable?

From the ERC20Upgradeable docs: "We have followed general OpenZeppelin Contracts guidelines: functions revert instead returning false on failure. This behavior is nonetheless conventional and ...
noncy 's user avatar
  • 11
0 votes
0 answers
35 views

Openzeppalin Governance wizard reuturns "ProviderError: max code size exceeded"

openzeppalin wizard Governance error i am using the copy and pasted code from openzeppalin for there governance smartcontract but returns error smart contract // SPDX-License-Identifier: MIT pragma ...
jia-ayo's user avatar
0 votes
0 answers
25 views

How to know if it is the correct address and calldata when holders call the propose function?

The propose function in the governance contract from OZ can receive any random address and calldata. When the proposal is executed with the execution function in timeLockcontroller from OZ, the ...
DHC's user avatar
  • 357
0 votes
1 answer
46 views

What are the pros and cons of using OpenZeppelin ERC20Votes?

I want to use this extension for an ERC20 token. What are the pros and cons (if any) of adding this to it?
Falcon Stakepool's user avatar
0 votes
0 answers
334 views

Different address using Create2 due to difference in byteCode(type(ERC1967Proxy).creationCode and ethers.getContractFactory("ERC1967Proxy").bytecode

I am currently facing an issue while trying to calculate the address of a SimpleAccount contract using getCreate2Address() from ethers.utils in JavaScript. I noticed that the address I receive is ...
kannu's user avatar
  • 11
1 vote
1 answer
449 views

How can i pass constructor args to test solidity contracts in Hardhat?

I am using openzepplin with role based access control to create erc-20 token constructor(address minter, address burner) ERC20("ArtPlace Token", "ARTP") { _mint(msg.sender, ...
Ri dev's user avatar
  • 11
0 votes
0 answers
33 views

how to clone (minimal proxy pattern) a governance contract from OpenZeppelin

I am trying to clone oz's governance contract. However, it looks very complicated. Many contracts are inherited, and there are some values are set up in their constructors. In this case, how am I ...
DHC's user avatar
  • 357
0 votes
0 answers
18 views

How can I make my solidity skill too strong?

I am solidity developer and have been coding in solidity for 6 months. I have made 6-7 projects with solidity. I want to make my solidity skill very strong. Give me some tips how can I do it?
Hacek 's user avatar
  • 657
1 vote
1 answer
86 views

Help me to make my idea clean on initializer, reinitializer and disableinitializer

Openzeppelin has a solidity script initializable.sol which has some modifiers and internal functions. I wanna clear my idea on these. I am describing what i know about it, correct me if i am wrong. ...
Hacek 's user avatar
  • 657
0 votes
1 answer
354 views

Derived contract must override function "supportsInterface". Two or more base classes define function with same name and parameter types

TypeError: Derived contract must override function "supportsInterface". Two or more base classes define function with same name and parameter types. --> royalty.sol:9:1: | 9 | contract ...
soumyadeep.eth's user avatar
0 votes
1 answer
39 views

how to receive values from openzeppelin royaltyInfo function

trying to implement like this uint[2] memory royalty = royaltyInfo(_tokenId, price); payable(royalty[0]).transfer(royalty[1]); but getting error TypeError: Different number of components on the left ...
soumyadeep.eth's user avatar
0 votes
0 answers
18 views

how to use onlyGovernance modifier?

I want to use onlyGovernance modifier in my contracts. I have a governance contract but I want to use this modifier that is not a governance contract. I want to use it so I can restrict some of my ...
MehmedB's user avatar
  • 241
2 votes
1 answer
399 views

onlyInitializing vs initializer in OpenZeppelin Upgradeable Contracts

I'm reading the OpenZeppelin documentation about upgradeable contracts, and I'm getting a bit confused with these modifiers: initializer onlyInitializing I think I understand how initializer works. ...
Alexander Herranz's user avatar
0 votes
1 answer
392 views

When should I use ReentrancyGuard in a smart contract?

I am looking at the ReentrancyGuard smart contract from Open Zeppelin and I don't understand when I have to use it. Is it necessary in all my smart contracts or do I only have to add it in some ...
Falcon Stakepool's user avatar
1 vote
1 answer
36 views

Can a diamond Contract be cloned?

Error: invalid address or ENS name (argument="name", value=undefined, code=INVALID_ARGUMENT, version=contracts/5.7.0) So this is the error that occured. I am trying to implement diamond ...
Prajan Bhattarai's user avatar
1 vote
1 answer
49 views

@openzeppelin/contracts import failed

The issue I am having is when I am trying to compile my contract, I am getting multiple errors for ERC721. As imported ERC721 is importing more contracts, as seen from the errors, the issue is that it ...
Hasbik645's user avatar
3 votes
1 answer
537 views

How many storage gaps to add at the end of Base Upgradeable Contracts?

I have read about adding Storage gaps at the end of Base Upgradeable Contracts for reserving storage slots. More detailed explaination in Openzeppelin Docs here. But what is the exact amount of ...
Pankaj Jagtap's user avatar
3 votes
1 answer
677 views

What are Hooks and How are they used? Went thorough the explanation on the topic but can't wrap my head around it

So in the ERC720 contract there is a _transfer function which is calling a hook named _beforeTokenTransfer(). As we see in the image _beforeTokenTransfer is called and I understand it may be calling ...
Pratik Jussal's user avatar
3 votes
2 answers
89 views

Is there anything called conditional access control in solidity?

So here is my problem . I have 2 users of my DApp : Admin and User Admin is the contract owner and can access admin panel of my DApp . User is a normal user having something like a conditional access ....
Gaurav Pant's user avatar
2 votes
1 answer
185 views

Can I change Openzeppelin access control without having the right permissions?

If you check this link: openzeppelin github access control you will notice they use 2 function for granting a role: function grantRole(bytes32 role, address account) public virtual override onlyRole(...
Crypto Man's user avatar

1
2 3 4 5
7