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
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
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
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
2 votes
3 answers
3k views

Issue with importing Chainlink & Openzeppelin

Currently trying to run a script and keep running into an error when trying to import chainlink and openzeppelin contracts. Not sure why, I looked at brownie pm list to make sure I have the correct ...
rizonpoint's user avatar
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
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
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
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
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
2 votes
2 answers
114 views

Ethernaut King - transfer function doesn't work

I'm stuck on King.sol (level 9) of ethernaut even though I know how to solve it. I looked at online solutions - One of which is: pragma solidity ^0.5.0; contract BadKing { function becomeKing(...
binny arora's user avatar
2 votes
1 answer
415 views

Correct way to transfer ERC-20 tokens and keeping decimals in count?

I have a token with 18 decimals, I'm using the OpenZeppelin StandardToken example and have figured out that when I want to send value I have to keep the decimals in count as such: _value * 10**...
jasper's user avatar
  • 689
1 vote
1 answer
44 views

_burn() odd behaviour

I stumbled upon an issue with burn() in OpenZeppelin ERC20 contracts. I have the following test: import { time, loadFixture } from "@nomicfoundation/hardhat-network-helpers"; import { ...
Jacek's user avatar
  • 135
1 vote
0 answers
4k views

How to get all NFTs from an Enumerable ERC721 Smart Contract?

I'm trying to add a function to the ERC721 Smart Contract to return all the NFTs (items identified by tokenID) from a user address. At first, I was thinking on something like the following: ...
Alexander Herranz's user avatar
1 vote
1 answer
849 views

Using Multiple Initializers in Upgradable Smart Contract

For Upgradable Smart contract following pattern as specified here: https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable#avoid-initial-values-in-field-declarations "Constructor&...
Leon Africa's user avatar
1 vote
2 answers
1k views

Noob question about how to use SafeERC20.sol from OpenZeppelin

I want to use SafeERC20.sol in my project, purely because of safeTransfer(). The way I do it is I just put the SafeERC20.sol file in my project folder, and then use the line import "./SafeERC20....
Hiperfly's user avatar
  • 459
1 vote
0 answers
201 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
661 views

ERC2981 NFT Royalties Implementation in a ERC721 Marketplace

I've read already many posts regarding this topic, but I just can't wrap my head around this Royalty implementation thing. Pls help me out, I don't know how I should play with this thing. what is ...
DevABDee's user avatar
  • 451
1 vote
3 answers
5k views

IERC20.approve(spender, amount) thinks the owner is also the contract

I have these functions and deployed my contract to Ropsten testnet. function setSmartContractAllownace(uint daiAmountIn) public { IERC20 daiToken = IERC20(ropstenDAI); daiToken.approve(...
Saehun Sean Oh's user avatar
1 vote
1 answer
1k views

Easiest way to call an implementation function from a proxy contract in Remix

I have the following code in my remix.ethereum.org project: pragma solidity ^0.6.10; // SPDX-License-Identifier: Unlicensed import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/...
Tarek's user avatar
  • 643
1 vote
1 answer
2k views

Gasless transactions - sending transaction instead of signing message. How does it work?

I'm following this tutorial: https://docs.openzeppelin.com/learn/sending-gasless-transactions But it doesn't really explain clearly how it works in details. A standard transaction is pretty simple to ...
Radek_pl's user avatar
  • 791
1 vote
1 answer
2k views

Transfer ownership of a contract to another contract (and back)

I have a contract WidgetMaker that uses Zeppelin-Solidity Ownable to ensure that only the owner of the contract can execute SendWidget. At present, the contract is owned by my own wallet address and ...
James Connolly's user avatar
0 votes
0 answers
551 views

Issues looping arrays inside view functions, in Solidity

I asked this question recently about discovering the list of NFTs from an owner's address. My first approach, to avoid using arrays, was to use Enumberable ERC721 with the following approach in the ...
Alexander Herranz's user avatar
0 votes
2 answers
666 views

Deploy contract that requires an ERC20 object in constructor

I am starting an ICO and basing my contract on OpenZeppelin. I am trying to deploy the contract using web3.js and my problem is that in the constructor I need to pass the ERC20 object of my token. I ...
Zaid Amir's user avatar
  • 312