2022 Developer Survey is open! Take survey.

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
4 views

Upgrade a contract mapping struct

I have an upgradable contract (openzeppelin): contract MyContract is OwnableUpgradeable { ... struct MyStruct { uint a; uint b; } ... mapping(address => ...
user avatar
0 votes
0 answers
12 views

EscrowUpgradeable triggers "Ownable: caller is not the owner."

I am newbie and am on Truffle/Openzeppelin stack. I am following the example/tutorial for Using Escrow Library at https://medium.com/@ethdapp/using-the-openzeppelin-escrow-library-6384f22caa99 and all ...
user avatar
0 votes
0 answers
8 views

Deploy a crowdsale contract for a previously deployed ERC20 token

I have deployed an upgradable ERC20 token using ^0.8.4 and I would like to set up an AllocatedCrowdsale from OpenZeppelin for said token. I have set up a second project for the crowdsale using ^0.5.0 ...
user avatar
1 vote
0 answers
68 views

Error: missing revert data in call exception on tokenOfOwnerByIndex and tokenByIndex from openzeppelin ERC721Enumerable

I'm getting a odd error across several calls out to openzeppelin that Error: missing revert data in call exception; Transaction reverted without a reason string I didn't change anything and am using ...
user avatar
0 votes
0 answers
9 views

How ERC 1155 standard prevents from "out of gas" error in batch operations?

I was checking the implementation of Openzeppelin's implementation of ERC-1155 standard and I'm curious about the use of _safeBatchTransferFrom function to transfer multiple tokens at once. The ...
user avatar
  • 584
0 votes
0 answers
7 views

Can I use Crowdsale with ERC20 Token created in OZ4.5.0?

Basically, I already have ERC20 token created, which is using solidity 0.8.2 and OpenZeppelin version 4.5.0. I know that Crowdsales supports only OpenZeppelin Contracts 2.x version. I am not sure if I ...
user avatar
0 votes
1 answer
41 views

function selector was not recognized error

I'm extending OpenZeppelins ERC20 to create a Token that I use for testing in another smart contract. Here's how it looks: //SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "@...
user avatar
0 votes
2 answers
27 views

Sending ERC20s to a Contract on deployment

I'm trying to send an amount of ERC20 on Contract deploy to the contract itself. I'm using Hardhat and OpenZeppelin Contracts. Contract Code: //SPDX-License-Identifier: Unlicense pragma solidity ^0.8....
user avatar
0 votes
0 answers
18 views

If I use the cloning pattern to launch erc721s, will it list on exchanges like a normal contract?

Hey I'm looking at implementing a basic minimal clone of an ERC721 contract (using the openzepplin cloning implementation), and I was wondering if it would make any difference in how the tokens are ...
user avatar
0 votes
0 answers
38 views

Can't import OpenZeppelin Ownable contract

I'm following freecodecamp's solidity course but am unable to import Ownable from OpenZeppelin into my contract. Using brownie, this is what I have so far: and in the config.yaml file: And when I ...
user avatar
0 votes
1 answer
24 views

Referencing OpenZeppelin in Solidity Contract, working with Etherscan

I think I am making a simple mistake, but I have been stuck for a while. I have a simple ERC-20 contract which I have publish on the Ethereum Mainnet and others on Polygon. This is a sample contract ...
user avatar
0 votes
1 answer
139 views

upgradeble openzeppelin contracts - why the __gap is needed if you can add variables to the end?

https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps 1: https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps explains why the __gap variable is needed, but https://docs....
user avatar
1 vote
0 answers
30 views

Solidity Advanced Transparent Proxy pattern

Proxy contract - The contract users are calling to use current implementation Admin Proxy Contract - Contarct to Update Current Implementation or current Structure Model Implementation Contract (where ...
user avatar
0 votes
1 answer
45 views

Imported Openzeppelin contract is different than on GitHub

I am trying to import the ERC2981.sol from the OpenZeppelin contracts repository. In their GitHub page the royaltyInfo is a public function. But for some reason when I import it in my project, this ...
user avatar
  • 118
0 votes
0 answers
81 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(...
user avatar
1 vote
1 answer
108 views

How to test recoverSigner and splitSignature

I am currently trying to test a function that uses a recoverSigner inside and I'm not sure how to proceed. Here is the function: function claimToken(bytes32 message, bytes memory _signature, address ...
user avatar
1 vote
0 answers
28 views

Openzeppelin ERC1155 missing virtual function?

This is my ERC1155 contract: // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.13; pragma abicoder v2; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; contract ...
user avatar
0 votes
1 answer
104 views

How to use ERC721URIStorage and ERC721Royalty together (requires override)

I am initializing my contract as below: pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol";...
user avatar
  • 118
0 votes
0 answers
185 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 ...
user avatar
  • 11
0 votes
0 answers
29 views

Approve and dis-approve ownership of erc721 tokens

I have created a contract which takes care of buy and sell of NFT's or ERC721 tokens. So i have approved the contract to sell the NFT. Now my questions are:- Once I have transferred the contract to a ...
user avatar
0 votes
0 answers
207 views

nft images not showing on opensea

I created 13 images and corresponding JSON files uploaded the images to pinata then changed the file_url in the JSON file to cid of the image "ipfs://cid/image.png" uploaded the json file as ...
user avatar
  • 11
0 votes
0 answers
24 views

Getting an error when I try to create a ERC20 token from another contract

I'm trying to create an upgradeable ERC20 contract from a Factory but I'm receiving an error, these are my contracts: The token contract // SPDX-License-Identifier: MIT pragma solidity 0.8.7; import &...
user avatar
0 votes
0 answers
25 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 ...
user avatar
0 votes
2 answers
69 views

Solidity: Contract should be marked as abstract

I am trying to write a Smart Contract to generate Staking Rewards for an existing Cryptocurrency But I've been getting this error Contract "Stakeable" should be marked as abstract How do I ...
user avatar
0 votes
0 answers
19 views

Upgreadable ERC20 address cannot be passed as argument in another upgradeable contract

I created 2 smart contracts. contract A is ERC20 token and B is a contract that accepts ERC20 A as payment method. When deploying, contract A got deployed but when I passed the address where it was ...
user avatar
0 votes
0 answers
36 views

I can't deploy my Upgradeable contract using truffle plugins

I'm trying to deploy the following smart contract: // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; ...
user avatar
0 votes
0 answers
76 views

Upgrade ERC721 Contract

I've a question about an upgrade that I should apply to a contract that I deployed as upgradable (with openzeppelin Upgradable). I'm following the guidelines and best practices but I'm not sure the ...
user avatar
0 votes
1 answer
139 views

Deploy a contract passing data to the constructor

I'm trying to get familiarised with OpenZeppelin upgradable contracts but I find it difficult because there are not clear tutorials on how to do this kind of things so I'm using their docs to try to ...
user avatar
0 votes
1 answer
44 views

Ownable Minimal Proxy (EIP-1167)

I'm trying to create a clone from a contract that has some privileged functions and inherits from Ownable. I realized that after cloning the owner variable is zeroed, so any privileged function, such ...
user avatar
  • 33
0 votes
1 answer
82 views

What's the point of OpenZeppelin Counters library

I've been studying ERC721 token smart contracts and saw Counters library. I can see it being used when token is being minted with .increment() and then you can check total supply with .current(). But ...
user avatar
  • 103
0 votes
1 answer
226 views

EnumerableSet vs Access Control in Openzeppelin

Openzeppelin offers RBAC whereby an address may be granted a specific set of responsibilities. I would like to know which might be considered a better practice - using Access Control Or using an ...
user avatar
0 votes
1 answer
119 views

How to Use OpenZeppelin's ERC721Votes in an NFT Minter Contract

I'm trying to incorporate the new draft-ERC721Votes in my NFT minter contract called NFTVotes.sol When draft-ERC721Votes.sol is inherited in the minter contract, VS Code is gives the following error: ...
user avatar
  • 101
0 votes
0 answers
74 views

Lazy minting multiple NFTs belonging to a collection

in my project right now we have implemented lazy minting using signed voucher messages the signer of which gets verified on chain and hence letting the purchaser pay for the gas fees of minting the ...
user avatar
1 vote
0 answers
36 views

How to set multiple address(smart contracts) to another smart contract's owner via Gnosis Safe?

How can I set multiple addresses to an ERC20 token's owner? Here is what i want to do, i wrote an ERC20 token and it's interface, and using Openzeppelin's Ownable lib to set an function can only call ...
user avatar
  • 11
0 votes
1 answer
446 views

Contracts calling transferFrom from other contracts, getting error ERC20: insufficient allowance

I have a multi contract dapp going with a few ERC-20 tokens. My intermediary contract that the end user owns calls a function which mints new Tokens. The Token contract itself holds these. When some ...
user avatar
0 votes
0 answers
26 views

Incompatible Solc Version

I am trying to run a pytest file on a smart contract in VSCode using Brownie, but get the following error upon running the test: File "brownie/_cli/main.py", line 64, in main importlib....
user avatar
  • 13
0 votes
2 answers
114 views

Why does OpenZeppelin import interfaces to its own contracts?

I've noticed that all OpenZeppelin's token contracts import their interfaces into them. Why does OpenZeppelin import and inherit its own contract interface to the contract? Does importing a contract'...
user avatar
  • 342
0 votes
0 answers
84 views

ERC721URIStorage - why is tokenURI mapping optional?

I am trying to understand ERC721URIStorage, and I have read What does ERC721URIStorage actually mean?. My question is based on the OpenZeppelin source file, specifically this line: // Optional mapping ...
user avatar
0 votes
0 answers
63 views

Is there a universal version of the safeTransferFrom(from, _to, _tokenId, “”) function that captures all my ERC721 tokens?

Running my solidity code in the Remix IDE, under Environment injected Web3, connected to the Rinkeby testnet, I am able to successfully mint new ERC721 tokens and successfully use the the ...
user avatar
  • 107
0 votes
0 answers
82 views

How to set msg.sender in assembly

I'm making the following call in contract A: address payable partyClone = payable(Clones.cloneDeterministic( partyRegistryImplementation, salt )); where ...
user avatar
0 votes
0 answers
36 views

I don't undertstand what seem as a redundant verification, am I missing something?

function mintApe(uint numberOfTokens) public payable { require(saleIsActive, "Sale must be active to mint Ape"); require(numberOfTokens <= maxApePurchase, "Can only mint 20 ...
user avatar
0 votes
2 answers
76 views

Why am I getting Function, variable, struct or modifier declaration expected?

Pardon me, but am a novice to blockchain programming. Having followed several tutorials on how to use The OpenZeppelin library to quicken the solidity development process, I cant seem to shake this ...
user avatar
  • 107
0 votes
1 answer
326 views

Problem with using OpenZeppeling contracts with Hard Hat - not found: File import callback not supported

I was writing and testing my smart contracts in Remix where I was importing some contracts from OpenZeppelin, and now I want to move it to my project in VSC. But now my VSC is screaming with an error: ...
user avatar
0 votes
1 answer
40 views

How to use MintableToken, PausableToken, DetailedERC20 functions in open-zeppelin v4.4.2

I am trying to Create Token and Initial Coin Offering Contracts Using Truffle + Zeppelin Solidity. so i installed openZeppelin , truffle , node js , and solidity. The following veresions of these ...
user avatar
1 vote
2 answers
552 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 ...
user avatar
0 votes
1 answer
209 views

ERC721 contract deployed to mainnet gives enormous minting fees

I'm experiencing some weird behavior of the ERC721 contracts on the mainnet. I developed two very simple contracts using OpenZeppelin that are based on ERC721, ERC721URIStorage, and ERC721Enumerable. ...
user avatar
0 votes
1 answer
63 views

Ownable function call from another function

I have two ownable functions (I'm using openzeppelin), when I invoke the second function from the first one, I get: "Ownable: caller is not the owner". function first() external view ...
user avatar
0 votes
1 answer
209 views

EIP-2771: Is it possible to pay a function with from's eth, not the forwarder contract's eth

I use OpenZeppelin ERC-2771 lib. I managed to forward an EIP-712 signed transaction to a contract. The function I call is payable. So far I only managed to have my Forwarder contract paying the ...
user avatar
  • 151
0 votes
2 answers
202 views

Why removing royalty info on burn in Openzeppeling ERC721 Royalties extension?

In https://github.com/OpenZeppelin/openzeppelin-contracts/blob/783ac759a902a7b4a218c2d026a77e6a26b6c42d/contracts/token/ERC721/extensions/ERC721Royalty.sol#L34 we have function _burn(uint256 tokenId) ...
user avatar
2 votes
0 answers
122 views

Does anyone know how to use TimeLockController.sol from openzeppelin

I want to use the openzeppelin timelock controller contract in a way that it calls the functions of other deployed contracts at some time. The thing can be done with the openzeppelin timelock ...
user avatar

1
2 3 4 5