Questions tagged [openzeppelin]

OpenZeppelin provides tools to write, deploy and operate decentralized applications. It also protects leading organizations by performing security audits on their systems and products.

200 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5 votes
0 answers
333 views

Deploy Governance how to configure simple timelock from remix

I went to OpenZeppelin's wizard to attempt to set up a simple token with Governance, I'm can see examples of the token but I'm wondering what the standard deployment for a TimelockController is. I ...
johnny 5's user avatar
  • 293
4 votes
0 answers
159 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
3 votes
1 answer
556 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
3 votes
1 answer
3k views

Should I use totalSupply() or a custom counter for ERC-721 token id?

I'm following OpenZeppelin ERC721 guide. They use a counter (Counters.Counter) for the tokenId. My contract inherits from ERC721Enumerable so I have totalSupply() out of the box. I was wondering if I ...
Hector T.'s user avatar
3 votes
0 answers
449 views

How to perform a gasless erc20 transfer from the backend?

I'm trying to use a relayer to handle my transactions. Initially, I was going for Infura Transactions. Then I saw GSN. And then OpenZeppelin Defender. All of them can help me send gasless transactions ...
Marcio's user avatar
  • 31
3 votes
1 answer
1k views

Openzeppelin test helper with hardhat config and tests

I'm using hardhat and I added a task to manipulate time in the hardhat.config.js file which is working fine. require("@nomiclabs/hardhat-waffle"); require("@nomiclabs/hardhat-truffle5&...
Majd TL's user avatar
  • 3,217
3 votes
0 answers
203 views

Solidity : About function calls between deployed contracts

I want to make a function call between a token (MyToken.sol) that inherits MintableToken.sol of OpenZeppelin and manipulate that token (Buy. Sol). (MyToken.sol) pragma solidity ^0.4.21; import "...
kk bonjour's user avatar
2 votes
1 answer
143 views

Solidity Clones Contracts: How to save deployer as a storage variable which can be called in created clones?

I am using the OpenZeppelin Clones Library so that users of my dapp can create clones of my implementation contract. My dapp will be following the EIP-1167 standard. For functionality, I will need to ...
ethereumboy's user avatar
2 votes
0 answers
107 views

Why did meta-transaction fail to garner adoption

Open Zeppelin had an initiative to allow meta-transactions through their gas station network https://docs.opengsn.org/ but it failed to materialize. There was also eip-2770 https://eips.ethereum.org/...
user98496's user avatar
2 votes
2 answers
238 views

OpenZeppelin Context.sol, when to use & why?

When, and why is it better to use functions _msgSender() & _msgData() introduced by the Context.sol by OpenZeppelin, instead of msg.sender & msg.data?
David's user avatar
  • 153
2 votes
0 answers
295 views

Hardhat testing emitted events through a proxy

Have a proxy contract and the implementation contract setup and working well from manual testing using the OZ TransparentUpgradeableProxy. Before using a proxy we had a single contract that wasn't ...
stringRay2014's user avatar
2 votes
2 answers
735 views

How to burn erc721 token?

I am trying to burn erc721 token. I have inherited ERC721Burnable contract,but the transaction gets failed.While debugging I found that in ERC721URIStorage contract,it reverts back at: if (bytes(...
Udit Yadav's user avatar
2 votes
0 answers
607 views

Transparent proxy tests - Error: missing revert data in call exception; Transaction reverted without a reason string;

I am trying to create a new token contract using the ERC20 Upgradeable contracts provided from Openzeppelin (OZ). I created the token contract and then made some basic unit tests. However, in one of ...
VitoCK's user avatar
  • 161
2 votes
0 answers
239 views

How can I create a factory of Upgradeable smart contracts?

I'm using OpenZeppelin hardhat plugin to deploy proxy contracts and I was asking myself how to achieve the same thing but from a contract. So for example I want to have a ProxyContractFactory that can ...
Allennick's user avatar
  • 243
2 votes
1 answer
440 views

How did tokenOfOwnerByIndex get used without ERC721Enumerable?

@openzeppelin/contracts v4.4.1 solidity >=0.6.0 <0.8.11; I have a contract that compiles and works fine on test net, and uses tokenOfOwnerByIndex(address _owner, uint256 _index) contract NFT is ...
Christian Lacdael's user avatar
2 votes
0 answers
122 views

In brownie tests how to use interfaces defined in packages

In brownie tests how to use third party interfaces defined in brownie packages? For example how do I use @openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol from OpenZeppelin ...
redfallenstar's user avatar
2 votes
0 answers
322 views

How to deploy a pre-compiled contract to hardhat node

I have a proxy contract and would like to replace the underlying implementation contract. I already have the abi & bytecode of a smart contract(retrieved from artifacts folder), so here is what I ...
johnhckuo's user avatar
  • 341
2 votes
0 answers
232 views

AccessControlEnumerable vs AccessControl

Is there a best practice on when to choose one or the other? The documentation vaguely discusses on-chain vs off-chain responsibilities. https://docs.openzeppelin.com/contracts/4.x/api/access
alpo's user avatar
  • 164
2 votes
0 answers
190 views

Deploying and Using OpenZeppelin PaymentSplitter in Web3

I currently have a contract that is creating an "item" for a customer to purchase. I've managed to follow a well put together tutorial for implementing this contract into my test network ...
scoot556's user avatar
2 votes
1 answer
210 views

Created Crowdsales contract, sending ropsten ETH to the contract and Failed

I created crowdsale contract - https://ropsten.etherscan.io/address/0xfbb2759ef0b7169d0a2effa971845ea0f99f87b1 My token - https://ropsten.etherscan.io/token/0x0f26c1c05f1bbBC7Eff0488F1a98619e8a9758cf ...
Josephhh's user avatar
  • 131
1 vote
0 answers
12 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
15 views

How do you get the amount of shares issued by a ERC-4626 deposit?

You can call previewDeposits but from what I've read it's not actually guaranteed that the amount of shares issued will be equal to the value returned be previewDeposit. There doesn't seem to be any ...
hear har's user avatar
1 vote
0 answers
11 views

Is brownie supporting OpenZeppelin/[email protected]?

I got the following answer after runing brownie pm install OpenZeppelin/[email protected] WARNING: Unable to compile OpenZeppelin/[email protected] due to a AttributeError - you ...
Lalo's user avatar
  • 11
1 vote
0 answers
65 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,603
1 vote
1 answer
128 views

Executing gasless transaction using etherjs and openzeppelin

My objective is simple I want to send a gasless transaction from one address to another. I am providing the code below. I am using openzeppelin Defender relayer to cover the gas prices of the ...
Syed Rabeet's user avatar
1 vote
1 answer
34 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. ...
root's user avatar
  • 11
1 vote
3 answers
280 views

Simple OpenZeppeling mockCoin for local testing, Mint function gets stuck in testing

I have a very simple smart contract for a MOCK coin where I need a mint function to be able to be run by any address as it is just for testing. I took the code from OpenZepplin and removed OnlyOwner. /...
Robert Mazurowski's user avatar
1 vote
1 answer
85 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
  • 665
1 vote
1 answer
812 views

Getting error in using ECDSA

We have a function: function _validSignature(bytes memory signature, bytes32 msgHash) internal view returns (bool) { return msgHash.toEthSignedMessageHash().recover(signature) == ...
Hacek 's user avatar
  • 665
1 vote
1 answer
72 views

Unable to Mint NFT: Transaction Reverted by EVM

I am trying to mint an NFT using a contract deployed on the Ethereum network. I have written a JavaScript code mint-nft.js, that uses the @alch/alchemy-web3 library to interact with the contract. ...
Tarun's user avatar
  • 11
1 vote
0 answers
134 views

Why doesn't Openzeppelin's IERC20 has a `decimal()` function?

In my projects, getting the decimals() is an important task, so I have to sometimes manually add the function in IERC20's interface. But why isn't this function officially in the contract? What am I ...
Shubham Sharma's user avatar
1 vote
1 answer
65 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
0 answers
60 views

Problem running ethernaut hacks locally

link here is the link of the video which I was watching for running ethernaut locally. At 5 min when running the command yarn start:ethernaut I came across a error: Starting the development server... ...
Pratyush Chauhan's user avatar
1 vote
1 answer
267 views

Setting immutable variables using clones

I've created a factory where I can clone my smart contracts using the openzeppelin clones factory. The problem I'm facing is that my "child" or "initializable" contract needs to ...
gggggggggg's user avatar
1 vote
0 answers
34 views

TypedData signature using Quorum Key Manager is failing/not verified

I am trying to create a TypedData transaction using OpenZeppelin Defender. I am using the OpenZeppelin MinimalForwarder to verify the authenticity of the signer. To create the signature, I am using ...
Subhadeep Karmakar's user avatar
1 vote
1 answer
106 views

Removing initializer on upgrade

Is it bad practice to remove the initializer on an upgradable contract on subsequent upgrades? Since the code wont be used any longer
Koray Kaya's user avatar
1 vote
1 answer
435 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
0 answers
198 views

Handle multiple tokenURI in one NFT contract

I have a simple nft contract and I want to create mint functions that if you press one or another that tokenId is bound to a URI I decide. I already tried multiple ways to do it but I got an error ...
Pablo's user avatar
  • 11
1 vote
1 answer
147 views

How to correctly test the initialisation of a clone contract on Hardhat? (EIP-1167)

So I have created an 'implementation contract' and a 'clone factory' which creates clones of the implementation contract. I have tested the functionality of the CloneFactory and it works in Remix. ...
ethereumboy's user avatar
1 vote
0 answers
75 views

can't get ERC721 transferFrom() to work

I'm using pragma solidity 0.8.15; and hardhat. Trying to send an ERC721 using transferFrom(), from an EOA to a contract. I did approve(address to, uint256 tokenId) first. But the transfer is still not ...
em_mutable's user avatar
1 vote
0 answers
143 views

How does one indirectly initialize a parent contract using a function in the child contract? (EIP-1167)

So I am creating an implementation contract which I intend to clone multiple times. As per the EIP-1167 standard, I cannot use a constructor in the implementation contract and have to use an '...
ethereumboy's user avatar
1 vote
0 answers
226 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
0 answers
70 views

`transferOwnership` is not a function

I am following the challenges from the speedrunEthereum and right now I am stuck on challenge 2 and not getting why the transferOwnership is not a function since I am also inheriting the Ownable from ...
Rishabh Raghwendra's user avatar
1 vote
0 answers
97 views

Wrong openzeppelin dependencies

In my hardhat project I'm using openzeppelin-contracts-upgradeable. I have installed the latest version using the command npm i @openzeppelin/contracts-upgradeable which brings the latest version for ...
forhas's user avatar
  • 775
1 vote
1 answer
409 views

Cannot call ERC20 mint function from another contract's payable function

Scenario: Contract A is a contract that sells ERC20 tokens Specified in Contract A using Open Zeppelin's ERC20 implementation. Contract A has a payable function that receives ether from a caller, as ...
ZeusLawyer's user avatar
1 vote
1 answer
65 views

Is there a reason a function is made public and then called internally in Solidity?

I have come across a popular smart contract in the OpenZeppelin library that manages access control of a contract. This is the library: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/...
Sarah cartenz's user avatar
1 vote
0 answers
238 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 vote
0 answers
400 views

How to use TransferFrom function?

Im currently creating a DEX where users swap tokens. However I have to use IERC20 transferfrom( address sender, address recipient, uint256 amount). But for this to happen the 3rd party(1inch) will ...
DeeGold's user avatar
  • 11
1 vote
0 answers
129 views

How do you find the child contract address when deployed from a factory?

I'm experimenting with the OpenZeppelin crowdsale contracts, using the MintedCrowdsale example. When this is deployed, hardhat logs out the contract address for MyCrowdsaleDeployer. Question: Where ...
Vinnie James's user avatar
1 vote
0 answers
142 views

How to create smart contract using openzeppelin metatx relayer to receive and withdraw usdt erc20 token using metamask?

Here is what I need to do, Create a smart contract that can use a relayer account from Openzeppelin defender and do the gasless meta transactions. Which I already created and sent some Ethereum too. ...
Abu Sayeed Mondal's user avatar