As of May 31, 2023, we have updated our Code of Conduct.

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
0 answers
5 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
  • 159
0 votes
0 answers
7 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
22 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
0 votes
1 answer
16 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
  • 1
0 votes
0 answers
13 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
  • 159
0 votes
0 answers
15 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
  • 595
0 votes
0 answers
6 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
  • 595
0 votes
0 answers
54 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
19 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
10 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
  • 212
1 vote
1 answer
53 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
31 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
16 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
33 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
2 votes
1 answer
95 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
156 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
66 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
82 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
2 votes
2 answers
312 views

Expected string literal (path), "*" or alias list

// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol&...
nacerme's user avatar
  • 23
0 votes
1 answer
32 views

Why the default mint() signatures in OpenZeppelin's ERC1155 wizard use "onlyOwner" modifier?

If you visit OpenZeppelin's ERC1155 wizard (https://wizard.openzeppelin.com/#erc1155) and check the "Mintable" checkbox, two functions will be created in the contract: function mint(address ...
errata's user avatar
  • 139
1 vote
1 answer
681 views

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/utils' is not defined by "exports" in node_modules\ethers\package.json

Hello everyone I am trying to deploy my ERC721Upgradeable NFT Marketplace Smart Contracts in the local hardhat network but I am getting a error regarding it. I am using Openzeppelin's Upgradeable ...
Nirban Chakraborty's user avatar
0 votes
0 answers
23 views

To hash or not to hash strings for bytes32 AccessControl roles

Is there a preferred/safest way to declare roles for Openzeppelin's AccessControl.sol? I would imagine a straight assignment of a bytes32 from a string would be sufficient for role creation as long as ...
JasonGarcia.eth's user avatar
0 votes
1 answer
36 views

Getting error while making ERC721 soul bound

I am making a soul-bound NFT using openzeppelin and foundry in solidity ^0.8.13 And for that, I am overriding the _beforeTokenTransfer but on that function, I am getting an error. Function has ...
ninja's user avatar
  • 74
1 vote
1 answer
36 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
1 vote
1 answer
67 views

How to permission the initialize function in upgradeable contracts?

From what I understand, for UUPS proxies: the proxy contract is ERC1967Proxy.sol from OpenZeppelin Contracts and the implementation contract should inherit from UUPSUpgradeable.sol in OpenZeppelin ...
Ryan Sea's user avatar
  • 578
0 votes
1 answer
88 views

how to implement a crowdsale using the current version of openzeppelin 4.X

I develop smart contracts and I really like to use openzeppelin libraries for this, I know how to implement ICO using Crowdsale.sol contract from openzeppelin, but there is no such contract in the ...
Lll Cilician's user avatar
0 votes
0 answers
39 views

Generate EDSCA recoverable signature for use with OpenZeppelin EDSCA contract (Embedded/C/C++ Hardware wallet)

I'd like to sign a message on an Arduino-compatible microcontroller, and create a recoverable signature which can be used with EIP-191 and Ethereum's erecover / OpenZeppelin's ECDSA smart contracts to ...
xtools's user avatar
  • 101
0 votes
0 answers
41 views

Transaction has been reverted by the EVM, error while minting through the contract

The contract was working fine, It already minted 3201 NFTs and now suddenly I face the error Transaction has been reverted by the EVM The max_supply is set to 5000 and hence thats not a problem too. ...
Nishant Pacharne's user avatar
0 votes
2 answers
34 views

Approve and disapprove a transaction

i want to develop a contract student in which student sign a transaction to update its record and owner would be able to approve or disapprove this transaction how would I able to do this.
Saira Rao's user avatar
0 votes
0 answers
30 views

Can Ethereum smart contract sell token at fixed price that includes gas fee?

I am new to solidity and Ethereum in general. I am using openZeppelin lib and trying to modify an existing contract that exchanges ERC-1155 tokens so, that the price it expects to be payed for token ...
anton melnychuk's user avatar
0 votes
1 answer
405 views

Use cases of UUPS proxies over Transparent?

What are the use cases where UUPS proxies are more suitable apart from achieving immutability as the logic to update the contract resides in the Logic contract rather than proxies. Thank you!
April's user avatar
  • 5
0 votes
1 answer
129 views

My Openzepplin ERC-721 import is not compiling

Creating a minting capability for my dApp. Cannot compile due to solidity version error I believe. // SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; import "@openzeppelin/...
Harry Chaklader's user avatar
0 votes
1 answer
33 views

In an ERC721 contract how to create a status variable that saves -1 to indicate that an nft owner decided to transfer it to another address

In an ERC721 contract how to create a status variable that saves -1 to indicate that an nft owner address no longer owns it because it has decided to transfer it to another address. In order to ...
Alessandro Morandi's user avatar
0 votes
1 answer
68 views

non payable function with payable modifier

I have a non payable function to propose function. It has a modifier called isSubmitFeePaid. Modifier call a payable function. I am writing a script to propose. But problem is when i try call purpose ...
Furkan Sezal's user avatar
0 votes
1 answer
119 views

Governance Contract too large for Test Net Deployment

I am trying to deploy this governance contract, created using OpenZeppelin Template and it gives me the ERROR: Warning: Contract code size is 29977 bytes and exceeds 24576 bytes (a limit introduced in ...
Felix Saraiva's user avatar
0 votes
1 answer
134 views

TokenOfOwnerByIndex throws exception in one function but works on another with the same loop

I do Not understand how Erc721.tokenOfOwnerByIndex can not pass its require in this simple case: function cancelAllSales() external onlyOwner { require(_powerSwitch == false, "System is still ...
Stefan Laiu's user avatar
0 votes
1 answer
267 views

How can i verify more params with _hashTypedDataV4 from openzeppelin?

i'm trying to implement a 712 typed signature with openzeppelin: The contract has two functions: struct ProofData { address user; } bytes32 constant TYPE_HASH_EASY = keccak256("ProofData(...
kri-dev's user avatar
  • 101
0 votes
1 answer
282 views

users -> proxy -> proxy -> smart contract

I'm writing smart contract for Ethereum using Solidity and OpenZeppelin. I wish to implement this kind of situation Where I deploy a proxy for each user and a proxy uses the same smart contract with ...
Doe's user avatar
  • 3
1 vote
1 answer
255 views

How does the openzeppelin library Bitmaps actually work?

The openzeppelin provides a data structure library namely BitMaps which can be found here - https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/structs/BitMaps.sol Can ...
Stormbreaker's user avatar
1 vote
1 answer
1k views

How does tokenURI is set in the ERC721 implementation?

Recently, I was studying the ERC721 smart contract and came across something which I coult not understand. Look at the following code - function tokenURI(uint256 tokenId) public view virtual ...
Stormbreaker's user avatar
0 votes
1 answer
64 views

Upgrade contract version for upgradeable contracs

Case: We have a bunch of contracts with version 6.0.0. The upgradeability implemented using @openzeppelin/contracts-ethereum-package libraries How can I upgrade the solidity version to latest and ...
intosKai's user avatar
0 votes
0 answers
87 views

Unable to initialize OpenZeppelin Clone contract during Hardhat Test (Error: VM Exception)

I'm trying to create clones of my implementation contract (EIP-1167) using the OpenZeppelin Clones library, however I keep getting a VM Exception Error. This is the 'Initialize' function of my ...
ethereumboy's user avatar
4 votes
0 answers
108 views

Why does Ownable.sol from OpenZeppelin rely so much on the use of functions?

I wondered why OpenZeppelin relies so much on the use of functions when, at first glance, they seem unnecessary for such elementary operations. For example, take the Ownable.sol contract. Why isn't ...
PensoGlide's user avatar
1 vote
0 answers
122 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 vote
1 answer
252 views

How can I clone a contract (using Openzeppelin 'clones') which contains a chainlink vrfCoordinator address in it's constructor?

I'm trying to clone a Lottery contract which contains Chainlink VRF Coordinator address as part of the contructor. This is the constructor of the main contract which I'd like to clone: constructor(...
ethereumboy's user avatar
0 votes
1 answer
130 views

What is the purpose of this line of code in OpenZeppelin's ERC-20 example?

I was wondering how if(currentAllowance != type(uint256).max) worked in the following function from OpenZeppelin's ERC-20 template. I understand the purpose of this line -- to make sure there's no ...
J. Doe's user avatar
  • 95
1 vote
0 answers
43 views

OpenZeppelin AccessControl state shared between contracts rather that inheriting

I have contracts Marketplace and Escrow, and I want to share AccessControl state between the two, for instance I want to be able to grant and check roles from both contracts but having one source of ...
human's user avatar
  • 113
0 votes
1 answer
209 views

Hardhat — Can't verify an ERC20 token on Rinkeby

I am creating an ERC20 token using Openzeppelin's ERC20 contract, I wrote the deploy script using hardhat-deploy and it is running. But, when trying to run the hardhat verify script on that smart ...
Anas Latique's user avatar
0 votes
1 answer
549 views

I am unable to import the safe math library in my 0.6.12 version of my compiler

// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import &...
Mohindar Amarnadh's user avatar
1 vote
0 answers
115 views

Trouble with Solidity Compiler Version when combining Aave and Openzeppelin in Foundry

I'm trying to follow this tutorial by Patrick Collins on Flashloans but in Foundry: https://www.youtube.com/watch?v=Aw7yvGFtOvI&t=328s When in try to forge build I get the following error: : src\...
banyan's user avatar
  • 21

1
2 3 4 5 6