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.

Filter by
Sorted by
Tagged with
13 votes
4 answers
9k views

Is it possible to include all the openzeppelin library files on Remix?

I am trying out Remix as an IDE. However, I'm using the excellent open-zeppelin library for development. Is there any way to include all the files from open-zeppelin in the build path for Remix ...
karianneberg's user avatar
12 votes
2 answers
7k views

What does ERC721URIStorage actually mean?

The official docs say ERC721 token with storage based token URI management. If someone could elaborate more on what exactly this means and when to use it, I'd be grateful.
Ape Toshi's user avatar
  • 311
12 votes
2 answers
2k views

Pros and Cons of smart contract upgradable patterns

There have been quite many arguments around how to achieve smart contract updates like Upgradeable smart contracts. I feel Proxycontract with Delegate-call is currently the most famous one. But aside ...
kohshiba's user avatar
  • 467
11 votes
5 answers
17k views

Error: Transaction reverted: function call to a non-contract account

I've been trying to debug this for the past 2 days, it has driven me insane. I'm getting this error when testing my contract: Error: Transaction reverted: function call to a non-contract account. It's ...
Colin Steidtmann's user avatar
11 votes
4 answers
10k views

What is the reason behind writing "using Counters for Counters.counters" when using the Counters openzeppelin library

While trying to understand the OpenZeppelin contracts that a contract inherited from, I stumbled upon the line using Counters for Counters.Counter; after the counters library of OpenZeppelin was ...
vadimpl's user avatar
  • 111
9 votes
3 answers
17k views

An unexpected error occurred: Error: Cannot find module '@nomiclabs/hardhat-waffle' [Hardhat, openzeppelin]

I keep getting this error when doing: npx hardhat run scripts/sample-script.js --network testnet. Edited the name of my computer for security reasons. How do I put in the module 'nomiclabs/hardhat-...
Feynman's user avatar
  • 231
8 votes
9 answers
18k views

HardhatError: HH700: Artifact for contract "Greeter" not found - clarification [Hardhat, openzeppelin]

I keep getting this error when doing: npx hardhat run scripts/sample-script.js --network testnet. I got an answer "You have named your contract 'Nikola' and not 'Greeter'. The actual file-names ...
Feynman's user avatar
  • 231
8 votes
6 answers
5k views

Slither Tool Error On Contract That Inherit From Openzeppeling

I'm trying to use SLITHER (the analysis tool), but when I try to use it on a contract that inherits from Open Zeppelin, it gives me this error: Error: Source "@openzeppelin/contracts/token/ERC20/...
Vadim Chilinciuc's user avatar
8 votes
2 answers
11k views

What's the point of ERC721Receiver.sol and ERC721Holder.sol in OpenZeppelin's implementation?

I'm studying OpenZeppelin's ERC721 token implementation and I'm having a hard time making sense of ERC721Receiver.sol and ERC721Holder.sol and how they relate to eachother. In the file ...
John DeBord's user avatar
7 votes
2 answers
3k views

How to get implementation address after deployProxy()? (@open-zepplin/hardhat-upgrades)

I'm deploying my token using the proxy pattern via hardhat-upgrades. const TokenFactory = await ethers.getContractFactory('MyToken'); const token = await upgrades.deployProxy(TokenFactory); const ...
parliament's user avatar
7 votes
3 answers
5k views

Error encountered, bailing. Network state unknown. Review successful transactions manually

Problem I get the following error after running $ truffle migrate --reset: Running migration: 1_initial_migration.js Replacing Migrations... ... ...
Robbert's user avatar
  • 311
7 votes
1 answer
1k views

safeTransferFrom is undefined in buidler test

I have started using buidler for testing/compiling my contracts. In one test i have setup a scenario that a owner attempts to transfer a token to another wallet address. My contract is inheriting from ...
Sam Mason's user avatar
  • 171
7 votes
1 answer
3k views

What's the benefit of using SafeERC20?

SafeERC20 is not really clear to me from Openzeppelin's explanation. What makes safeERC20 better than normal ERC20? In what way is it safer? Wrappers around ERC20 operations that throw on failure (...
Shift_that's user avatar
7 votes
3 answers
8k views

Importing openzeppelin contracts in foundry

I was trying to follow this video https://www.youtube.com/watch?v=fNMfMxGxeag and at 5:23 when he goes on to edit remappings - I have no "remappings" in foundry.tml. When I try to just put ...
wojak2's user avatar
  • 71
6 votes
3 answers
7k views

Best way to list all tokens of user in Solidity

I am using openzeppelin erc721 library to create an NFT and need to list all the tokens of a user. The most obvious way is to iterate through all the tokens in the contract and check if the owner of ...
Siyavash's user avatar
6 votes
1 answer
4k views

How to override supportsInterface() function if contract needs to support many interfaces?

I'm creating a basic ERC721 token that extends ERC721, ERC721Enumerable, AccessControlEnumerable. I want it to support ERC721Enumerable and AccessControlEnumerable interfaces. Is it enough to call ...
MantasFam's user avatar
  • 327
6 votes
1 answer
2k views

Missing artifacts for openzeppelin contracts with hardhat

I'm using hardhat to write a dapp. As I'm compiling my dapp I'm getting an error: Error HH700: Artifact for contract "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:...
forhas's user avatar
  • 785
6 votes
1 answer
213 views

Does OpenZeppelin make security audits? [closed]

Does the OpenZeppelin project offer security audit services for other projects and companies?
elopio's user avatar
  • 452
6 votes
2 answers
337 views

Do people have a strong preference for implementing EIP-2535 or OpenZeppelin's Proxy Upgrade Pattern?

Which use cases might lend themselves to one implementation versus the other?
Yan Digilov's user avatar
5 votes
4 answers
14k views

Function _setTokenURI() in ERC721 is gone in OpenZeppelin ^0.8.0 contracts

We had the following mapping to manage the URIs for ERC721 tokens in OpenZeppelin contracts until pragma ^0.7: // Optional mapping for token URIs mapping (uint256 => string) private _tokenURIs; ...
Sergi Juanati's user avatar
5 votes
2 answers
1k views

Zeppelin OS: revert Cannot call fallback function from the proxy admin

I have been attempting to create a simple upgradable contract using Zeppelin OS: Following the tutorial I have been able to: - Create a new contract - Deploy it using zos push - Create the proxy ...
amhed's user avatar
  • 161
5 votes
2 answers
6k views

How do I import from / install OpenZeppelin properly?

I'm a newb dev and want to play with smart contracts, and was trying to figure this out. Ive installed truffle and openzeppelin, everything seems to check out, but in Mist I still get an error when I ...
Future Blok's user avatar
5 votes
3 answers
1k views

Initializing the implementation contract when using UUPS to protect against attacks

In OpenZeppelin's documentation, it's mentioned that we should be invoking the _disableInitializers function, otherwise our contract might be vulnerable to certain attacks. Can someone explain how ...
Stephen Fong's user avatar
5 votes
1 answer
1k views

Ethereum stuck in the smart contract

I deployed a beta version of an NFT project, however, some people who were not in the whitelist got their eth stuck in the smart contract, now I need to refund them by withdrawing the eth in the smart ...
kool Erick's user avatar
5 votes
1 answer
4k views

How to set a max supply of an ERC-721 token?

I am using the OpenZeppelin framework and I've tried to find solutions on how to put a max supply of an ERC-721. The only answers I've found seems unnecessary complex and I haven't been able to make ...
Adam's user avatar
  • 53
5 votes
0 answers
334 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
1 answer
1k views

Difference between __init and __init_unchained

I am learning to develop upgradeable smart contracts using openzeppelin library for ERC721 and ERC1155 contracts. However, I don't understand what does the unchained function mean. More specifically ...
mzaidi's user avatar
  • 992
4 votes
2 answers
6k views

"send" and "transfer" are only available for objects of type "address payable", not "address" [duplicate]

I'm creating a smart contract to sell my tokens, but I'm having the following problem: TypeError: "send" and "transfer" are only available for objects of type "address payable&...
Crazy's user avatar
  • 161
4 votes
2 answers
6k views

Installation of openzeppelin/contracts Library

I have created a node.js project, within which I have created a truffle directory and initialised its project. I have installed the openzeppelin (npm install @openzeppelin/contracts) library in this ...
JF0001's user avatar
  • 281
4 votes
2 answers
1k views

Solidity Error: Exceeds block gas limit

When I start ganache-cli in one terminal window and run ./node_modules/.bin/solidity-coverage (command from documentation) in another I get Error: Exceeds block gas limit at Object....
CodingYourLife's user avatar
4 votes
1 answer
197 views

Clearing Open Zeppelin Enumerable Map

Supposed I have an enumerable map, now I want to clear it so it doesn't contain any element. What is the most gas efficient way to do that?
KaiJun's user avatar
  • 103
4 votes
2 answers
13k views

Transfer Ownership of a Token Contract

I'm trying to create a token contract using openzeppelin. I managed to create the token using the ownable contract from ownable.sol, which let me transfer the ownership of the token contract. However,...
qmFaisal's user avatar
  • 103
4 votes
1 answer
3k views

How to use ERC1155 with files hosted on IPFS, when files are added regularly?

I'm looking to build an ERC1155 smart contract (I'm using OpenZeppelin) that will contain NFTs whose metadata will be hosted on IPFS. About 4,000 images for now, all unique (all amount of 1). An ...
jeremy's user avatar
  • 141
4 votes
1 answer
806 views

Chainlink import causing Truffle console to crash

Related issue on GitHub: https://github.com/trufflesuite/truffle/issues/3329 If I compile my contracts with truffle compile and then open the truffle console with truffle develop then this happens: ...
Markus Kottländer's user avatar
4 votes
2 answers
375 views

zeppelin-solidity Crowdsales Contract Not Working

I grab the smart contract example code from Zeppelin-Solidity GitHub https://github.com/OpenZeppelin/zeppelin-solidity I create and deploy the SimpleToken using EXACTLY the same code from the ...
David Evony's user avatar
4 votes
2 answers
876 views

Using hardhat-deploy plugin for deploying OpenZeppelin upgradable contracts

What is the correct way to deploy OpenZeppelin upgradable contracts? OpenZeppelin upgrdable contracts have default initialize() function which is automatically called by the hardhat-upgrades plugin. ...
rlib's user avatar
  • 289
4 votes
2 answers
5k views

DeclarationError: Identifier already declared. Two imports import the same ERC721 contract

Im building a contract that uses two contracts that both use the ERC721 zeppelin contract, when I import the two as such: import nonFungableWidthAddedFunctionality1.sol; import ...
jasper's user avatar
  • 689
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
3 answers
2k views

Why Transfer(0x0, _to, _amount) after Minting Tokens

In https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/ERC20/MintableToken.sol#L38, why is it necessary to emit the event Transfer(0x0, _to, _amount); after minting some ...
Nyxynyx's user avatar
  • 1,167
3 votes
5 answers
4k views

Obtaining ERC721 interface IDs

There's a related question here ERC721: Interface ID Registration but I couldn't get the answer I need from there. In the OpenZeppelin ERC721 basic implementation, there's this part: // Base URI ...
Ruham's user avatar
  • 963
3 votes
1 answer
532 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
2 answers
3k views

ERC721 standard - What should you pass in the name and symbol arguments passed to the constructor?

I've been confused about the ERC721 standard. We pass a name and symbol to the constructor. What do they represent? In the source code, it just says token name and token symbol. Are they the name and ...
anusha garimella's user avatar
3 votes
2 answers
4k views

Type address is not implicitly convertible to expected type contract ERC20

I am trying to compile my crowdsale contract and get this error: " TypeError: Type address is not implicitly convertible to expected type contract ERC20. token = ...
Josephhh's user avatar
  • 131
3 votes
1 answer
955 views

Can not use sendValue method of Address library provided by Openzeppelin

I was trying to use Openzeppelin Address library sendValue(), and it kept showing error Member "sendValue" not found or not visible after argument-dependent lookup in address.solidity(9582) ...
Ray's user avatar
  • 133
3 votes
1 answer
2k views

Using OpenZeppelin merkle proof library

I want to use the OpenZeppelin Merkle proof library, but I am not able to figure out the hashes I have to provide in the proof parameter in the verify function of the library. Let's say I have these ...
Aditya Sharma's user avatar
3 votes
1 answer
3k views

How does the SafeMath library of OpenZeppelin protect your code from integer overflow?

Sorry for the newb question. I am reading the SafeMath code and it seems that it just does some multiplications and calculations? How do you use it to protect your code? Do you just import it?
bitalikvuterin's user avatar
3 votes
2 answers
946 views

Why does Openzeppelin's CountersUpgradeable library wrap arithmetic in an unchecked block?

I was reading through the source code for Openzeppelin's CountersUpgradeable library v4.3.0 and realised that the arithmetic operation in the increment / decrement functions is wrapped by an unchecked ...
navpal's user avatar
  • 362
3 votes
4 answers
11k views

Error HH411: The library openzeppelin-solidity is not installed. Try installing it using npm (for old 0.5.0 solidity code)

I have solidity project with files like pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; When I try to compile, I get error on not installed library ...
Paul Verest's user avatar
3 votes
2 answers
332 views

Difference of using transfer vs _transfer in OpenZeppelin (same for dash functions)

In openzeppelin contracts in same cases we have 2 types of functions for the same functionality, one of them preceded by a dash symbol (_). That is the case of transfer(x, y, z)/_transfer(x, y, z) ...
Alexander Herranz's user avatar
3 votes
2 answers
518 views

What is the preferred Inheritance for ERC20 token and why?

I tried to deploy both ERC20 contracts with burn functionality over the remix and both seems to work fine, I am confused if one way should be preferred over the other. Since, openzeppelin contract ...
priyanshu bindal's user avatar

1
2 3 4 5
12